aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi.h10
-rw-r--r--include/linux/agp_backend.h1
-rw-r--r--include/linux/ahci_platform.h31
-rw-r--r--include/linux/aio.h5
-rw-r--r--include/linux/altera_jtaguart.h16
-rw-r--r--include/linux/altera_uart.h14
-rw-r--r--include/linux/amba/bus.h11
-rw-r--r--include/linux/amba/mmci.h27
-rw-r--r--include/linux/amba/pl022.h32
-rw-r--r--include/linux/amba/pl330.h45
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/atmdev.h17
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/auto_fs.h1
-rw-r--r--include/linux/backing-dev.h33
-rw-r--r--include/linux/bio.h158
-rw-r--r--include/linux/bitops.h30
-rw-r--r--include/linux/blk_types.h194
-rw-r--r--include/linux/blkdev.h223
-rw-r--r--include/linux/blktrace_api.h18
-rw-r--r--include/linux/brcmphy.h7
-rw-r--r--include/linux/buffer_head.h18
-rw-r--r--include/linux/cache.h2
-rw-r--r--include/linux/caif/caif_socket.h199
-rw-r--r--include/linux/caif/if_caif.h34
-rw-r--r--include/linux/can/dev.h1
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/can/platform/mcp251x.h4
-rw-r--r--include/linux/can/platform/sja1000.h2
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cgroup.h29
-rw-r--r--include/linux/clocksource.h36
-rw-r--r--include/linux/coda_psdev.h8
-rw-r--r--include/linux/compaction.h89
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/compiler-gcc.h13
-rw-r--r--include/linux/compiler-gcc4.h4
-rw-r--r--include/linux/compiler.h2
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/console.h18
-rw-r--r--include/linux/console_struct.h4
-rw-r--r--include/linux/cper.h314
-rw-r--r--include/linux/cpu.h27
-rw-r--r--include/linux/cpufreq.h35
-rw-r--r--include/linux/cpuidle.h12
-rw-r--r--include/linux/cpuset.h71
-rw-r--r--include/linux/cred.h37
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/dcache.h15
-rw-r--r--include/linux/dcbnl.h2
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/debugobjects.h11
-rw-r--r--include/linux/delay.h1
-rw-r--r--include/linux/device.h151
-rw-r--r--include/linux/dma-mapping.h33
-rw-r--r--include/linux/dmaengine.h198
-rw-r--r--include/linux/dmi.h9
-rw-r--r--include/linux/dnotify.h1
-rw-r--r--include/linux/dns_resolver.h34
-rw-r--r--include/linux/dqblk_xfs.h33
-rw-r--r--include/linux/drbd.h5
-rw-r--r--include/linux/drbd_limits.h16
-rw-r--r--include/linux/drbd_nl.h6
-rw-r--r--include/linux/ds2782_battery.h8
-rw-r--r--include/linux/dvb/frontend.h1
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/dynamic_debug.h6
-rw-r--r--include/linux/edac_mce.h31
-rw-r--r--include/linux/eeprom_93cx6.h1
-rw-r--r--include/linux/elevator.h6
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/elfcore.h4
-rw-r--r--include/linux/err.h10
-rw-r--r--include/linux/etherdevice.h14
-rw-r--r--include/linux/ethtool.h95
-rw-r--r--include/linux/ext2_fs_sb.h9
-rw-r--r--include/linux/ext3_fs.h5
-rw-r--r--include/linux/fanotify.h105
-rw-r--r--include/linux/fb.h49
-rw-r--r--include/linux/fcntl.h6
-rw-r--r--include/linux/fdtable.h4
-rw-r--r--include/linux/fec.h21
-rw-r--r--include/linux/file.h1
-rw-r--r--include/linux/filter.h51
-rw-r--r--include/linux/firewire-cdev.h501
-rw-r--r--include/linux/firewire.h67
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/flex_array.h5
-rw-r--r--include/linux/fs.h172
-rw-r--r--include/linux/fscache-cache.h47
-rw-r--r--include/linux/fscache.h3
-rw-r--r--include/linux/fsl-diu-fb.h223
-rw-r--r--include/linux/fsnotify.h161
-rw-r--r--include/linux/fsnotify_backend.h211
-rw-r--r--include/linux/ftrace.h66
-rw-r--r--include/linux/ftrace_event.h119
-rw-r--r--include/linux/fuse.h37
-rw-r--r--include/linux/generic_acl.h4
-rw-r--r--include/linux/genetlink.h8
-rw-r--r--include/linux/gfp.h18
-rw-r--r--include/linux/gpio.h5
-rw-r--r--include/linux/gpio_keys.h2
-rw-r--r--include/linux/gsmmux.h25
-rw-r--r--include/linux/hdpu_features.h26
-rw-r--r--include/linux/hid.h11
-rw-r--r--include/linux/highmem.h16
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/hw_breakpoint.h25
-rw-r--r--include/linux/i2c-omap.h9
-rw-r--r--include/linux/i2c.h6
-rw-r--r--include/linux/i2c/adp5588.h37
-rw-r--r--include/linux/i2c/adp8860.h154
-rw-r--r--include/linux/i2c/max732x.h3
-rw-r--r--include/linux/i2c/mcs.h34
-rw-r--r--include/linux/i2c/mcs5000_ts.h24
-rw-r--r--include/linux/i2c/pca953x.h2
-rw-r--r--include/linux/i2c/qt602240_ts.h38
-rw-r--r--include/linux/i2c/sx150x.h78
-rw-r--r--include/linux/i2c/twl.h14
-rw-r--r--include/linux/i8042.h12
-rw-r--r--include/linux/ide.h8
-rw-r--r--include/linux/ieee80211.h4
-rw-r--r--include/linux/if.h4
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_bonding.h1
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_fddi.h8
-rw-r--r--include/linux/if_frad.h2
-rw-r--r--include/linux/if_hippi.h8
-rw-r--r--include/linux/if_link.h136
-rw-r--r--include/linux/if_macvlan.h24
-rw-r--r--include/linux/if_packet.h2
-rw-r--r--include/linux/if_pppol2tp.h16
-rw-r--r--include/linux/if_pppox.h15
-rw-r--r--include/linux/if_tun.h2
-rw-r--r--include/linux/if_x25.h26
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/in6.h5
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/init_task.h16
-rw-r--r--include/linux/inotify.h185
-rw-r--r--include/linux/input.h108
-rw-r--r--include/linux/input/ad714x.h63
-rw-r--r--include/linux/input/adxl34x.h349
-rw-r--r--include/linux/input/cy8ctmg110_pdata.h10
-rw-r--r--include/linux/input/matrix_keypad.h6
-rw-r--r--include/linux/input/tps6507x-ts.h24
-rw-r--r--include/linux/intel_mid_dma.h86
-rw-r--r--include/linux/intel_pmic_gpio.h15
-rw-r--r--include/linux/interrupt.h39
-rw-r--r--include/linux/io-mapping.h16
-rw-r--r--include/linux/io.h4
-rw-r--r--include/linux/iocontext.h1
-rw-r--r--include/linux/iommu-helper.h12
-rw-r--r--include/linux/iommu.h25
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/ip_vs.h2
-rw-r--r--include/linux/ipv6.h24
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isapnp.h8
-rw-r--r--include/linux/iscsi_boot_sysfs.h123
-rw-r--r--include/linux/iscsi_ibft.h12
-rw-r--r--include/linux/isdnif.h2
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/ivtvfb.h1
-rw-r--r--include/linux/jbd.h3
-rw-r--r--include/linux/jbd2.h27
-rw-r--r--include/linux/jffs2.h9
-rw-r--r--include/linux/joystick.h4
-rw-r--r--include/linux/kdb.h121
-rw-r--r--include/linux/kernel.h80
-rw-r--r--include/linux/kfifo.h1193
-rw-r--r--include/linux/kgdb.h70
-rw-r--r--include/linux/kmemtrace.h25
-rw-r--r--include/linux/kmod.h64
-rw-r--r--include/linux/kobj_map.h9
-rw-r--r--include/linux/kobject.h38
-rw-r--r--include/linux/kref.h3
-rw-r--r--include/linux/ks8842.h38
-rw-r--r--include/linux/ksm.h2
-rw-r--r--include/linux/kthread.h65
-rw-r--r--include/linux/ktime.h10
-rw-r--r--include/linux/kvm.h39
-rw-r--r--include/linux/kvm_host.h51
-rw-r--r--include/linux/kvm_types.h4
-rw-r--r--include/linux/l2tp.h163
-rw-r--r--include/linux/lcd.h23
-rw-r--r--include/linux/leds.h12
-rw-r--r--include/linux/libata.h119
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/lis3lv02d.h12
-rw-r--r--include/linux/list.h28
-rw-r--r--include/linux/lmb.h89
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/lru_cache.h2
-rw-r--r--include/linux/lsm_audit.h34
-rw-r--r--include/linux/mISDNif.h2
-rw-r--r--include/linux/marvell_phy.h21
-rw-r--r--include/linux/matroxfb.h3
-rw-r--r--include/linux/mbcache.h20
-rw-r--r--include/linux/memblock.h89
-rw-r--r--include/linux/memcontrol.h37
-rw-r--r--include/linux/memory_hotplug.h1
-rw-r--r--include/linux/mempolicy.h28
-rw-r--r--include/linux/meye.h12
-rw-r--r--include/linux/mfd/88pm860x.h7
-rw-r--r--include/linux/mfd/ab4500.h262
-rw-r--r--include/linux/mfd/ab8500.h128
-rw-r--r--include/linux/mfd/abx500.h (renamed from include/linux/mfd/ab3100.h)134
-rw-r--r--include/linux/mfd/davinci_voicecodec.h126
-rw-r--r--include/linux/mfd/janz.h54
-rw-r--r--include/linux/mfd/mc13783.h66
-rw-r--r--include/linux/mfd/pcf50633/backlight.h51
-rw-r--r--include/linux/mfd/pcf50633/core.h4
-rw-r--r--include/linux/mfd/rdc321x.h26
-rw-r--r--include/linux/mfd/sh_mobile_sdhi.h6
-rw-r--r--include/linux/mfd/tc35892.h132
-rw-r--r--include/linux/mfd/tmio.h11
-rw-r--r--include/linux/mfd/tps6507x.h169
-rw-r--r--include/linux/mfd/wm831x/core.h5
-rw-r--r--include/linux/mfd/wm8350/audio.h2
-rw-r--r--include/linux/mfd/wm8994/core.h53
-rw-r--r--include/linux/mfd/wm8994/pdata.h1
-rw-r--r--include/linux/migrate.h6
-rw-r--r--include/linux/miscdevice.h9
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mlx4/qp.h7
-rw-r--r--include/linux/mm.h22
-rw-r--r--include/linux/mmc/card.h4
-rw-r--r--include/linux/mmc/host.h8
-rw-r--r--include/linux/mmc/mmc.h1
-rw-r--r--include/linux/mmc/sdhci-spear.h42
-rw-r--r--include/linux/mmc/sdio.h2
-rw-r--r--include/linux/mmc/sdio_func.h3
-rw-r--r--include/linux/mmc/sh_mmcif.h200
-rw-r--r--include/linux/mmdebug.h2
-rw-r--r--include/linux/mmzone.h37
-rw-r--r--include/linux/mod_devicetable.h42
-rw-r--r--include/linux/module.h50
-rw-r--r--include/linux/mount.h6
-rw-r--r--include/linux/mroute.h20
-rw-r--r--include/linux/mroute6.h35
-rw-r--r--include/linux/msi.h2
-rw-r--r--include/linux/msm_mdp.h78
-rw-r--r--include/linux/mtd/bbm.h24
-rw-r--r--include/linux/mtd/blktrans.h31
-rw-r--r--include/linux/mtd/cfi.h50
-rw-r--r--include/linux/mtd/cfi_endian.h19
-rw-r--r--include/linux/mtd/compatmac.h10
-rw-r--r--include/linux/mtd/concat.h17
-rw-r--r--include/linux/mtd/doc2000.h23
-rw-r--r--include/linux/mtd/flashchip.h25
-rw-r--r--include/linux/mtd/gen_probe.h19
-rw-r--r--include/linux/mtd/map.h22
-rw-r--r--include/linux/mtd/mtd.h27
-rw-r--r--include/linux/mtd/mtdram.h2
-rw-r--r--include/linux/mtd/nand.h29
-rw-r--r--include/linux/mtd/nand_ecc.h4
-rw-r--r--include/linux/mtd/nftl.h17
-rw-r--r--include/linux/mtd/onenand.h11
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/mtd/sh_flctl.h7
-rw-r--r--include/linux/mv643xx_eth.h5
-rw-r--r--include/linux/nbd.h2
-rw-r--r--include/linux/ncp.h10
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/ncp_fs_sb.h14
-rw-r--r--include/linux/net.h17
-rw-r--r--include/linux/netdevice.h478
-rw-r--r--include/linux/netfilter/Kbuild7
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h5
-rw-r--r--include/linux/netfilter/nf_conntrack_tuple_common.h3
-rw-r--r--include/linux/netfilter/nfnetlink_log.h1
-rw-r--r--include/linux/netfilter/x_tables.h95
-rw-r--r--include/linux/netfilter/xt_CHECKSUM.h20
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h22
-rw-r--r--include/linux/netfilter/xt_IDLETIMER.h45
-rw-r--r--include/linux/netfilter/xt_MARK.h6
-rw-r--r--include/linux/netfilter/xt_TEE.h12
-rw-r--r--include/linux/netfilter/xt_connmark.h11
-rw-r--r--include/linux/netfilter/xt_cpu.h11
-rw-r--r--include/linux/netfilter/xt_ipvs.h27
-rw-r--r--include/linux/netfilter/xt_mark.h4
-rw-r--r--include/linux/netfilter/xt_quota.h2
-rw-r--r--include/linux/netfilter/xt_recent.h7
-rw-r--r--include/linux/netfilter_bridge.h29
-rw-r--r--include/linux/netfilter_ipv4/ipt_LOG.h3
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h4
-rw-r--r--include/linux/netfilter_ipv6/ip6t_LOG.h3
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/netpoll.h35
-rw-r--r--include/linux/nfs4.h1
-rw-r--r--include/linux/nfs_fs.h34
-rw-r--r--include/linux/nfs_fs_sb.h8
-rw-r--r--include/linux/nfs_mount.h1
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h19
-rw-r--r--include/linux/nfsd/nfsfh.h6
-rw-r--r--include/linux/nilfs2_fs.h78
-rw-r--r--include/linux/nl80211.h100
-rw-r--r--include/linux/nmi.h13
-rw-r--r--include/linux/notifier.h16
-rw-r--r--include/linux/of.h10
-rw-r--r--include/linux/of_address.h44
-rw-r--r--include/linux/of_device.h65
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_gpio.h35
-rw-r--r--include/linux/of_i2c.h13
-rw-r--r--include/linux/of_irq.h70
-rw-r--r--include/linux/of_platform.h59
-rw-r--r--include/linux/of_spi.h11
-rw-r--r--include/linux/omapfb.h7
-rw-r--r--include/linux/oom.h33
-rw-r--r--include/linux/padata.h166
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/page_cgroup.h5
-rw-r--r--include/linux/pagemap.h4
-rw-r--r--include/linux/pch_dma.h37
-rw-r--r--include/linux/pci.h17
-rw-r--r--include/linux/pci_ids.h73
-rw-r--r--include/linux/pci_regs.h6
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/percpu-defs.h4
-rw-r--r--include/linux/percpu.h20
-rw-r--r--include/linux/percpu_counter.h11
-rw-r--r--include/linux/perf_event.h201
-rw-r--r--include/linux/personality.h2
-rw-r--r--include/linux/phonet.h4
-rw-r--r--include/linux/phy.h37
-rw-r--r--include/linux/pipe_fs_i.h15
-rw-r--r--include/linux/platform_device.h66
-rw-r--r--include/linux/plist.h29
-rw-r--r--include/linux/pm.h16
-rw-r--r--include/linux/pm_qos_params.h23
-rw-r--r--include/linux/pm_runtime.h7
-rw-r--r--include/linux/pm_wakeup.h48
-rw-r--r--include/linux/pnp.h1
-rw-r--r--include/linux/posix-timers.h2
-rw-r--r--include/linux/power/jz4740-battery.h24
-rw-r--r--include/linux/power_supply.h6
-rw-r--r--include/linux/ppp_channel.h5
-rw-r--r--include/linux/ptp_classify.h126
-rw-r--r--include/linux/ptrace.h12
-rw-r--r--include/linux/quota.h44
-rw-r--r--include/linux/quotaops.h151
-rw-r--r--include/linux/radix-tree.h6
-rw-r--r--include/linux/ramfs.h5
-rw-r--r--include/linux/random.h28
-rw-r--r--include/linux/rar_register.h44
-rw-r--r--include/linux/ratelimit.h13
-rw-r--r--include/linux/rbtree.h8
-rw-r--r--include/linux/rculist.h42
-rw-r--r--include/linux/rcupdate.h132
-rw-r--r--include/linux/rcutiny.h31
-rw-r--r--include/linux/rcutree.h7
-rw-r--r--include/linux/rds.h12
-rw-r--r--include/linux/regulator/machine.h9
-rw-r--r--include/linux/regulator/tps6507x.h32
-rw-r--r--include/linux/reiserfs_acl.h4
-rw-r--r--include/linux/reiserfs_fs.h4
-rw-r--r--include/linux/reiserfs_fs_i.h4
-rw-r--r--include/linux/reiserfs_xattr.h6
-rw-r--r--include/linux/resource.h9
-rw-r--r--include/linux/ring_buffer.h10
-rw-r--r--include/linux/rio.h55
-rw-r--r--include/linux/rio_drv.h6
-rw-r--r--include/linux/rio_ids.h14
-rw-r--r--include/linux/rio_regs.h80
-rw-r--r--include/linux/rmap.h63
-rw-r--r--include/linux/rtc-v3020.h2
-rw-r--r--include/linux/rtnetlink.h8
-rw-r--r--include/linux/sched.h177
-rw-r--r--include/linux/sctp.h80
-rw-r--r--include/linux/sdhci-pltfm.h35
-rw-r--r--include/linux/security.h201
-rw-r--r--include/linux/sem.h4
-rw-r--r--include/linux/serial.h9
-rw-r--r--include/linux/serial_8250.h5
-rw-r--r--include/linux/serial_core.h19
-rw-r--r--include/linux/serial_mfd.h47
-rw-r--r--include/linux/serial_reg.h16
-rw-r--r--include/linux/serial_sci.h8
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/sfi.h24
-rw-r--r--include/linux/sh_clk.h163
-rw-r--r--include/linux/sh_dma.h102
-rw-r--r--include/linux/sh_intc.h26
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/skbuff.h159
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/slab_def.h29
-rw-r--r--include/linux/slob_def.h10
-rw-r--r--include/linux/slow-work.h163
-rw-r--r--include/linux/slub_def.h28
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/socket.h10
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spi/max7301.h8
-rw-r--r--include/linux/spi/spi_bitbang.h101
-rw-r--r--include/linux/spi/wl12xx.h2
-rw-r--r--include/linux/spinlock.h2
-rw-r--r--include/linux/splice.h7
-rw-r--r--include/linux/srcu.h6
-rw-r--r--include/linux/ssb/ssb.h163
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h15
-rw-r--r--include/linux/ssb/ssb_regs.h239
-rw-r--r--include/linux/statfs.h25
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/stop_machine.h122
-rw-r--r--include/linux/sunrpc/auth.h22
-rw-r--r--include/linux/sunrpc/auth_gss.h1
-rw-r--r--include/linux/sunrpc/cache.h1
-rw-r--r--include/linux/sunrpc/clnt.h5
-rw-r--r--include/linux/sunrpc/gss_api.h8
-rw-r--r--include/linux/sunrpc/gss_krb5.h184
-rw-r--r--include/linux/sunrpc/metrics.h7
-rw-r--r--include/linux/sunrpc/sched.h27
-rw-r--r--include/linux/sunrpc/xdr.h8
-rw-r--r--include/linux/sunrpc/xprt.h14
-rw-r--r--include/linux/suspend.h43
-rw-r--r--include/linux/swap.h31
-rw-r--r--include/linux/swiotlb.h37
-rw-r--r--include/linux/syscalls.h67
-rw-r--r--include/linux/sysctl.h2
-rw-r--r--include/linux/sysfs.h38
-rw-r--r--include/linux/sysrq.h22
-rw-r--r--include/linux/sysv_fs.h11
-rw-r--r--include/linux/tboot.h1
-rw-r--r--include/linux/tca6416_keypad.h34
-rw-r--r--include/linux/threads.h9
-rw-r--r--include/linux/tick.h5
-rw-r--r--include/linux/timb_dma.h55
-rw-r--r--include/linux/time.h22
-rw-r--r--include/linux/timer.h25
-rw-r--r--include/linux/timex.h5
-rw-r--r--include/linux/tipc.h36
-rw-r--r--include/linux/tipc_config.h1
-rw-r--r--include/linux/topology.h109
-rw-r--r--include/linux/tracepoint.h197
-rw-r--r--include/linux/tty.h60
-rw-r--r--include/linux/types.h21
-rw-r--r--include/linux/u64_stats_sync.h140
-rw-r--r--include/linux/uinput.h10
-rw-r--r--include/linux/usb.h142
-rw-r--r--include/linux/usb/Kbuild1
-rw-r--r--include/linux/usb/atmel_usba_udc.h2
-rw-r--r--include/linux/usb/audio-v2.h438
-rw-r--r--include/linux/usb/audio.h321
-rw-r--r--include/linux/usb/cdc.h94
-rw-r--r--include/linux/usb/ch11.h167
-rw-r--r--include/linux/usb/ch9.h16
-rw-r--r--include/linux/usb/composite.h7
-rw-r--r--include/linux/usb/ehci_def.h29
-rw-r--r--include/linux/usb/functionfs.h199
-rw-r--r--include/linux/usb/g_hid.h32
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/gadgetfs.h2
-rw-r--r--include/linux/usb/hcd.h644
-rw-r--r--include/linux/usb/langwell_udc.h2
-rw-r--r--include/linux/usb/musb.h40
-rw-r--r--include/linux/usb/ncm.h114
-rw-r--r--include/linux/usb/net2280.h6
-rw-r--r--include/linux/usb/otg.h11
-rw-r--r--include/linux/usb/quirks.h8
-rw-r--r--include/linux/usb/rndis_host.h66
-rw-r--r--include/linux/usb/serial.h36
-rw-r--r--include/linux/usb/ulpi.h180
-rw-r--r--include/linux/usb/usbnet.h40
-rw-r--r--include/linux/usb/video.h404
-rw-r--r--include/linux/usb/wusb-wa.h2
-rw-r--r--include/linux/user_namespace.h14
-rw-r--r--include/linux/uuid.h70
-rw-r--r--include/linux/vgaarb.h22
-rw-r--r--include/linux/via-core.h219
-rw-r--r--include/linux/via-gpio.h14
-rw-r--r--include/linux/via_i2c.h42
-rw-r--r--include/linux/videodev2.h76
-rw-r--r--include/linux/virtio.h55
-rw-r--r--include/linux/virtio_9p.h2
-rw-r--r--include/linux/virtio_blk.h5
-rw-r--r--include/linux/virtio_console.h25
-rw-r--r--include/linux/vmalloc.h2
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/vt_kern.h64
-rw-r--r--include/linux/wait.h184
-rw-r--r--include/linux/wireless.h4
-rw-r--r--include/linux/wlp.h22
-rw-r--r--include/linux/wm97xx_batt.h16
-rw-r--r--include/linux/workqueue.h158
-rw-r--r--include/linux/writeback.h24
-rw-r--r--include/linux/xattr.h16
-rw-r--r--include/linux/z2_battery.h17
-rw-r--r--include/linux/zorro.h22
496 files changed, 16784 insertions, 5014 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e2ea0b2159cd..9d65d4d0bd9c 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -39,6 +39,7 @@ header-y += ax25.h
39header-y += b1lli.h 39header-y += b1lli.h
40header-y += baycom.h 40header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blk_types.h
42header-y += blkpg.h 43header-y += blkpg.h
43header-y += bpqether.h 44header-y += bpqether.h
44header-y += bsg.h 45header-y += bsg.h
@@ -94,6 +95,7 @@ header-y += if_ppp.h
94header-y += if_slip.h 95header-y += if_slip.h
95header-y += if_strip.h 96header-y += if_strip.h
96header-y += if_tun.h 97header-y += if_tun.h
98header-y += if_x25.h
97header-y += in_route.h 99header-y += in_route.h
98header-y += ioctl.h 100header-y += ioctl.h
99header-y += ip6_tunnel.h 101header-y += ip6_tunnel.h
@@ -209,6 +211,7 @@ unifdef-y += ethtool.h
209unifdef-y += eventpoll.h 211unifdef-y += eventpoll.h
210unifdef-y += signalfd.h 212unifdef-y += signalfd.h
211unifdef-y += ext2_fs.h 213unifdef-y += ext2_fs.h
214unifdef-y += fanotify.h
212unifdef-y += fb.h 215unifdef-y += fb.h
213unifdef-y += fcntl.h 216unifdef-y += fcntl.h
214unifdef-y += filter.h 217unifdef-y += filter.h
@@ -275,6 +278,7 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
275 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),) 278 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
276unifdef-y += kvm_para.h 279unifdef-y += kvm_para.h
277endif 280endif
281unifdef-y += l2tp.h
278unifdef-y += llc.h 282unifdef-y += llc.h
279unifdef-y += loop.h 283unifdef-y += loop.h
280unifdef-y += lp.h 284unifdef-y += lp.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b926afe8c03e..ccf94dc5acdf 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,11 +116,12 @@ extern unsigned long acpi_realmode_flags;
116 116
117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); 117int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 118int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
119int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi);
119 120
120#ifdef CONFIG_X86_IO_APIC 121#ifdef CONFIG_X86_IO_APIC
121extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity); 122extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity);
122#else 123#else
123#define acpi_get_override_irq(bus, trigger, polarity) (-1) 124#define acpi_get_override_irq(gsi, trigger, polarity) (-1)
124#endif 125#endif
125/* 126/*
126 * This function undoes the effect of one call to acpi_register_gsi(). 127 * This function undoes the effect of one call to acpi_register_gsi().
@@ -247,11 +248,12 @@ int acpi_check_region(resource_size_t start, resource_size_t n,
247int acpi_check_mem_region(resource_size_t start, resource_size_t n, 248int acpi_check_mem_region(resource_size_t start, resource_size_t n,
248 const char *name); 249 const char *name);
249 250
251int acpi_resources_are_enforced(void);
252
250#ifdef CONFIG_PM_SLEEP 253#ifdef CONFIG_PM_SLEEP
251void __init acpi_no_s4_hw_signature(void); 254void __init acpi_no_s4_hw_signature(void);
252void __init acpi_old_suspend_ordering(void); 255void __init acpi_old_suspend_ordering(void);
253void __init acpi_s4_no_nvs(void); 256void __init acpi_nvs_nosave(void);
254void __init acpi_set_sci_en_on_resume(void);
255#endif /* CONFIG_PM_SLEEP */ 257#endif /* CONFIG_PM_SLEEP */
256 258
257struct acpi_osc_context { 259struct acpi_osc_context {
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 9101ed64f803..09ea4a1e9505 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -79,7 +79,6 @@ struct agp_memory {
79 u32 physical; 79 u32 physical;
80 bool is_bound; 80 bool is_bound;
81 bool is_flushed; 81 bool is_flushed;
82 bool vmalloc_flag;
83 /* list of agp_memory mapped to the aperture */ 82 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list; 83 struct list_head mapped_list;
85 /* DMA-mapped addresses */ 84 /* DMA-mapped addresses */
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
new file mode 100644
index 000000000000..be3d9a77d6ed
--- /dev/null
+++ b/include/linux/ahci_platform.h
@@ -0,0 +1,31 @@
1/*
2 * AHCI SATA platform driver
3 *
4 * Copyright 2004-2005 Red Hat, Inc.
5 * Jeff Garzik <jgarzik@pobox.com>
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@ru.mvista.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 */
14
15#ifndef _AHCI_PLATFORM_H
16#define _AHCI_PLATFORM_H
17
18#include <linux/compiler.h>
19
20struct device;
21struct ata_port_info;
22
23struct ahci_platform_data {
24 int (*init)(struct device *dev, void __iomem *addr);
25 void (*exit)(struct device *dev);
26 const struct ata_port_info *ata_port_info;
27 unsigned int force_port_map;
28 unsigned int mask_port_map;
29};
30
31#endif /* _AHCI_PLATFORM_H */
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 811dbb369379..7a8db4155281 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -212,6 +212,8 @@ extern void kick_iocb(struct kiocb *iocb);
212extern int aio_complete(struct kiocb *iocb, long res, long res2); 212extern int aio_complete(struct kiocb *iocb, long res, long res2);
213struct mm_struct; 213struct mm_struct;
214extern void exit_aio(struct mm_struct *mm); 214extern void exit_aio(struct mm_struct *mm);
215extern long do_io_submit(aio_context_t ctx_id, long nr,
216 struct iocb __user *__user *iocbpp, bool compat);
215#else 217#else
216static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; } 218static inline ssize_t wait_on_sync_kiocb(struct kiocb *iocb) { return 0; }
217static inline int aio_put_req(struct kiocb *iocb) { return 0; } 219static inline int aio_put_req(struct kiocb *iocb) { return 0; }
@@ -219,6 +221,9 @@ static inline void kick_iocb(struct kiocb *iocb) { }
219static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; } 221static inline int aio_complete(struct kiocb *iocb, long res, long res2) { return 0; }
220struct mm_struct; 222struct mm_struct;
221static inline void exit_aio(struct mm_struct *mm) { } 223static inline void exit_aio(struct mm_struct *mm) { }
224static inline long do_io_submit(aio_context_t ctx_id, long nr,
225 struct iocb __user * __user *iocbpp,
226 bool compat) { return 0; }
222#endif /* CONFIG_AIO */ 227#endif /* CONFIG_AIO */
223 228
224static inline struct kiocb *list_kiocb(struct list_head *h) 229static inline struct kiocb *list_kiocb(struct list_head *h)
diff --git a/include/linux/altera_jtaguart.h b/include/linux/altera_jtaguart.h
new file mode 100644
index 000000000000..953b178a1650
--- /dev/null
+++ b/include/linux/altera_jtaguart.h
@@ -0,0 +1,16 @@
1/*
2 * altera_jtaguart.h -- Altera JTAG UART driver defines.
3 */
4
5#ifndef __ALTJUART_H
6#define __ALTJUART_H
7
8#define ALTERA_JTAGUART_MAJOR 204
9#define ALTERA_JTAGUART_MINOR 186
10
11struct altera_jtaguart_platform_uart {
12 unsigned long mapbase; /* Physical address base */
13 unsigned int irq; /* Interrupt vector */
14};
15
16#endif /* __ALTJUART_H */
diff --git a/include/linux/altera_uart.h b/include/linux/altera_uart.h
new file mode 100644
index 000000000000..8d441064a30d
--- /dev/null
+++ b/include/linux/altera_uart.h
@@ -0,0 +1,14 @@
1/*
2 * altera_uart.h -- Altera UART driver defines.
3 */
4
5#ifndef __ALTUART_H
6#define __ALTUART_H
7
8struct altera_uart_platform_uart {
9 unsigned long mapbase; /* Physical address base */
10 unsigned int irq; /* Interrupt vector */
11 unsigned int uartclk; /* UART clock rate */
12};
13
14#endif /* __ALTUART_H */
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 8b1038607831..b0c174012436 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -14,14 +14,19 @@
14#ifndef ASMARM_AMBA_H 14#ifndef ASMARM_AMBA_H
15#define ASMARM_AMBA_H 15#define ASMARM_AMBA_H
16 16
17#include <linux/clk.h>
17#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h>
18#include <linux/resource.h> 20#include <linux/resource.h>
19 21
20#define AMBA_NR_IRQS 2 22#define AMBA_NR_IRQS 2
21 23
24struct clk;
25
22struct amba_device { 26struct amba_device {
23 struct device dev; 27 struct device dev;
24 struct resource res; 28 struct resource res;
29 struct clk *pclk;
25 u64 dma_mask; 30 u64 dma_mask;
26 unsigned int periphid; 31 unsigned int periphid;
27 unsigned int irq[AMBA_NR_IRQS]; 32 unsigned int irq[AMBA_NR_IRQS];
@@ -59,6 +64,12 @@ struct amba_device *amba_find_device(const char *, struct device *, unsigned int
59int amba_request_regions(struct amba_device *, const char *); 64int amba_request_regions(struct amba_device *, const char *);
60void amba_release_regions(struct amba_device *); 65void amba_release_regions(struct amba_device *);
61 66
67#define amba_pclk_enable(d) \
68 (IS_ERR((d)->pclk) ? 0 : clk_enable((d)->pclk))
69
70#define amba_pclk_disable(d) \
71 do { if (!IS_ERR((d)->pclk)) clk_disable((d)->pclk); } while (0)
72
62#define amba_config(d) (((d)->periphid >> 24) & 0xff) 73#define amba_config(d) (((d)->periphid >> 24) & 0xff)
63#define amba_rev(d) (((d)->periphid >> 20) & 0x0f) 74#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
64#define amba_manf(d) (((d)->periphid >> 12) & 0xff) 75#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 6b4241748dda..ca84ce70d5d5 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,9 +6,32 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/**
10 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block.
12 * @f_max: the maximum operational frequency for this host in this
13 * platform configuration. When this is specified it takes precedence
14 * over the module parameter for the same frequency.
15 * @ocr_mask: available voltages on the 4 pins from the block, this
16 * is ignored if a regulator is used, see the MMC_VDD_* masks in
17 * mmc/host.h
18 * @vdd_handler: a callback function to translate a MMC_VDD_*
19 * mask into a value to be binary (or set some other custom bits
20 * in MMCIPWR) or:ed and written into the MMCIPWR register of the
21 * block. May also control external power based on the power_mode.
22 * @status: if no GPIO read function was given to the block in
23 * gpio_wp (below) this function will be called to determine
24 * whether a card is present in the MMC slot or not
25 * @gpio_wp: read this GPIO pin to see if the card is write protected
26 * @gpio_cd: read this GPIO pin to detect card insertion
27 * @capabilities: the capabilities of the block as implemented in
28 * this platform, signify anything MMC_CAP_* from mmc/host.h
29 */
9struct mmci_platform_data { 30struct mmci_platform_data {
10 unsigned int ocr_mask; /* available voltages */ 31 unsigned int f_max;
11 u32 (*translate_vdd)(struct device *, unsigned int); 32 unsigned int ocr_mask;
33 u32 (*vdd_handler)(struct device *, unsigned int vdd,
34 unsigned char power_mode);
12 unsigned int (*status)(struct device *); 35 unsigned int (*status)(struct device *);
13 int gpio_wp; 36 int gpio_wp;
14 int gpio_cd; 37 int gpio_cd;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index e4836c6b3dd7..abf26cc47a2b 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -71,6 +71,7 @@ struct ssp_clock_params {
71 71
72/** 72/**
73 * enum ssp_rx_endian - endianess of Rx FIFO Data 73 * enum ssp_rx_endian - endianess of Rx FIFO Data
74 * this feature is only available in ST versionf of PL022
74 */ 75 */
75enum ssp_rx_endian { 76enum ssp_rx_endian {
76 SSP_RX_MSB, 77 SSP_RX_MSB,
@@ -181,7 +182,8 @@ enum ssp_microwire_wait_state {
181}; 182};
182 183
183/** 184/**
184 * enum Microwire - whether Full/Half Duplex 185 * enum ssp_duplex - whether Full/Half Duplex on microwire, only
186 * available in the ST Micro variant.
185 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional, 187 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
186 * SSPRXD not used 188 * SSPRXD not used
187 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is 189 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
@@ -193,6 +195,31 @@ enum ssp_duplex {
193}; 195};
194 196
195/** 197/**
198 * enum ssp_clkdelay - an optional clock delay on the feedback clock
199 * only available in the ST Micro PL023 variant.
200 * @SSP_FEEDBACK_CLK_DELAY_NONE: no delay, the data coming in from the
201 * slave is sampled directly
202 * @SSP_FEEDBACK_CLK_DELAY_1T: the incoming slave data is sampled with
203 * a delay of T-dt
204 * @SSP_FEEDBACK_CLK_DELAY_2T: dito with a delay if 2T-dt
205 * @SSP_FEEDBACK_CLK_DELAY_3T: dito with a delay if 3T-dt
206 * @SSP_FEEDBACK_CLK_DELAY_4T: dito with a delay if 4T-dt
207 * @SSP_FEEDBACK_CLK_DELAY_5T: dito with a delay if 5T-dt
208 * @SSP_FEEDBACK_CLK_DELAY_6T: dito with a delay if 6T-dt
209 * @SSP_FEEDBACK_CLK_DELAY_7T: dito with a delay if 7T-dt
210 */
211enum ssp_clkdelay {
212 SSP_FEEDBACK_CLK_DELAY_NONE,
213 SSP_FEEDBACK_CLK_DELAY_1T,
214 SSP_FEEDBACK_CLK_DELAY_2T,
215 SSP_FEEDBACK_CLK_DELAY_3T,
216 SSP_FEEDBACK_CLK_DELAY_4T,
217 SSP_FEEDBACK_CLK_DELAY_5T,
218 SSP_FEEDBACK_CLK_DELAY_6T,
219 SSP_FEEDBACK_CLK_DELAY_7T
220};
221
222/**
196 * CHIP select/deselect commands 223 * CHIP select/deselect commands
197 */ 224 */
198enum ssp_chip_select { 225enum ssp_chip_select {
@@ -235,6 +262,8 @@ struct pl022_ssp_controller {
235 * @ctrl_len: Microwire interface: Control length 262 * @ctrl_len: Microwire interface: Control length
236 * @wait_state: Microwire interface: Wait state 263 * @wait_state: Microwire interface: Wait state
237 * @duplex: Microwire interface: Full/Half duplex 264 * @duplex: Microwire interface: Full/Half duplex
265 * @clkdelay: on the PL023 variant, the delay in feeback clock cycles
266 * before sampling the incoming line
238 * @cs_control: function pointer to board-specific function to 267 * @cs_control: function pointer to board-specific function to
239 * assert/deassert I/O port to control HW generation of devices chip-select. 268 * assert/deassert I/O port to control HW generation of devices chip-select.
240 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph) 269 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
@@ -258,6 +287,7 @@ struct pl022_config_chip {
258 enum ssp_microwire_ctrl_len ctrl_len; 287 enum ssp_microwire_ctrl_len ctrl_len;
259 enum ssp_microwire_wait_state wait_state; 288 enum ssp_microwire_wait_state wait_state;
260 enum ssp_duplex duplex; 289 enum ssp_duplex duplex;
290 enum ssp_clkdelay clkdelay;
261 void (*cs_control) (u32 control); 291 void (*cs_control) (u32 control);
262}; 292};
263 293
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
new file mode 100644
index 000000000000..cbee7de7dd36
--- /dev/null
+++ b/include/linux/amba/pl330.h
@@ -0,0 +1,45 @@
1/* linux/include/linux/amba/pl330.h
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __AMBA_PL330_H_
13#define __AMBA_PL330_H_
14
15#include <asm/hardware/pl330.h>
16
17struct dma_pl330_peri {
18 /*
19 * Peri_Req i/f of the DMAC that is
20 * peripheral could be reached from.
21 */
22 u8 peri_id; /* {0, 31} */
23 enum pl330_reqtype rqtype;
24
25 /* For M->D and D->M Channels */
26 int burst_sz; /* in power of 2 */
27 dma_addr_t fifo_addr;
28};
29
30struct dma_pl330_platdata {
31 /*
32 * Number of valid peripherals connected to DMAC.
33 * This may be different from the value read from
34 * CR0, as the PL330 implementation might have 'holes'
35 * in the peri list or the peri could also be reached
36 * from another DMAC which the platform prefers.
37 */
38 u8 nr_valid_peri;
39 /* Array of valid peripherals */
40 struct dma_pl330_peri *peri;
41 /* Bytes to allocate for MC buffer */
42 unsigned mcbuf_sz;
43};
44
45#endif /* __AMBA_PL330_H_ */
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 5a5a7fd62490..e1b634b635f2 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -38,10 +38,12 @@
38#define UART01x_FR 0x18 /* Flag register (Read only). */ 38#define UART01x_FR 0x18 /* Flag register (Read only). */
39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */ 39#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */
40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */ 40#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
41#define ST_UART011_LCRH_RX 0x1C /* Rx line control register. */
41#define UART01x_ILPR 0x20 /* IrDA low power counter register. */ 42#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
42#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */ 43#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */
43#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */ 44#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */
44#define UART011_LCRH 0x2c /* Line control register. */ 45#define UART011_LCRH 0x2c /* Line control register. */
46#define ST_UART011_LCRH_TX 0x2c /* Tx Line control register. */
45#define UART011_CR 0x30 /* Control register. */ 47#define UART011_CR 0x30 /* Control register. */
46#define UART011_IFLS 0x34 /* Interrupt fifo level select. */ 48#define UART011_IFLS 0x34 /* Interrupt fifo level select. */
47#define UART011_IMSC 0x38 /* Interrupt mask. */ 49#define UART011_IMSC 0x38 /* Interrupt mask. */
@@ -84,6 +86,7 @@
84#define UART010_CR_TIE 0x0020 86#define UART010_CR_TIE 0x0020
85#define UART010_CR_RIE 0x0010 87#define UART010_CR_RIE 0x0010
86#define UART010_CR_MSIE 0x0008 88#define UART010_CR_MSIE 0x0008
89#define ST_UART011_CR_OVSFACT 0x0008 /* Oversampling factor */
87#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */ 90#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
88#define UART01x_CR_SIREN 0x0002 /* SIR enable */ 91#define UART01x_CR_SIREN 0x0002 /* SIR enable */
89#define UART01x_CR_UARTEN 0x0001 /* UART enable */ 92#define UART01x_CR_UARTEN 0x0001 /* UART enable */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 700c5b9b3583..fe6e681a9d74 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -467,7 +467,7 @@ enum ata_ioctls {
467 467
468/* core structures */ 468/* core structures */
469 469
470struct ata_prd { 470struct ata_bmdma_prd {
471 __le32 addr; 471 __le32 addr;
472 __le32 flags_len; 472 __le32 flags_len;
473}; 473};
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b23705c91..f6481daf6e52 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -431,6 +431,14 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
431 int number,unsigned long *flags); /* number == -1: pick first available */ 431 int number,unsigned long *flags); /* number == -1: pick first available */
432struct atm_dev *atm_dev_lookup(int number); 432struct atm_dev *atm_dev_lookup(int number);
433void atm_dev_deregister(struct atm_dev *dev); 433void atm_dev_deregister(struct atm_dev *dev);
434
435/* atm_dev_signal_change
436 *
437 * Propagate lower layer signal change in atm_dev->signal to netdevice.
438 * The event will be sent via a notifier call chain.
439 */
440void atm_dev_signal_change(struct atm_dev *dev, char signal);
441
434void vcc_insert_socket(struct sock *sk); 442void vcc_insert_socket(struct sock *sk);
435 443
436 444
@@ -510,6 +518,15 @@ void register_atm_ioctl(struct atm_ioctl *);
510 */ 518 */
511void deregister_atm_ioctl(struct atm_ioctl *); 519void deregister_atm_ioctl(struct atm_ioctl *);
512 520
521
522/* register_atmdevice_notifier - register atm_dev notify events
523 *
524 * Clients like br2684 will register notify events
525 * Currently we notify of signal found/lost
526 */
527int register_atmdevice_notifier(struct notifier_block *nb);
528void unregister_atmdevice_notifier(struct notifier_block *nb);
529
513#endif /* __KERNEL__ */ 530#endif /* __KERNEL__ */
514 531
515#endif 532#endif
diff --git a/include/linux/audit.h b/include/linux/audit.h
index f391d45c8aea..e24afabc548f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -544,7 +544,7 @@ extern int audit_signals;
544#define audit_putname(n) do { ; } while (0) 544#define audit_putname(n) do { ; } while (0)
545#define __audit_inode(n,d) do { ; } while (0) 545#define __audit_inode(n,d) do { ; } while (0)
546#define __audit_inode_child(i,p) do { ; } while (0) 546#define __audit_inode_child(i,p) do { ; } while (0)
547#define audit_inode(n,d) do { ; } while (0) 547#define audit_inode(n,d) do { (void)(d); } while (0)
548#define audit_inode_child(i,p) do { ; } while (0) 548#define audit_inode_child(i,p) do { ; } while (0)
549#define audit_core_dumps(i) do { ; } while (0) 549#define audit_core_dumps(i) do { ; } while (0)
550#define auditsc_get_stamp(c,t,s) (0) 550#define auditsc_get_stamp(c,t,s) (0)
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 7b09c8348fd3..da64e15004b6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -79,6 +79,7 @@ struct autofs_packet_expire {
79#define AUTOFS_IOC_FAIL _IO(0x93,0x61) 79#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) 80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) 81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
82#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
82#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) 83#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
83#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) 84#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
84 85
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index bd0e3c6f323f..7628219e5386 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/fs.h> 15#include <linux/fs.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/timer.h>
17#include <linux/writeback.h> 18#include <linux/writeback.h>
18#include <asm/atomic.h> 19#include <asm/atomic.h>
19 20
@@ -44,22 +45,21 @@ enum bdi_stat_item {
44#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) 45#define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids)))
45 46
46struct bdi_writeback { 47struct bdi_writeback {
47 struct list_head list; /* hangs off the bdi */ 48 struct backing_dev_info *bdi; /* our parent bdi */
48
49 struct backing_dev_info *bdi; /* our parent bdi */
50 unsigned int nr; 49 unsigned int nr;
51 50
52 unsigned long last_old_flush; /* last old data flush */ 51 unsigned long last_old_flush; /* last old data flush */
52 unsigned long last_active; /* last time bdi thread was active */
53 53
54 struct task_struct *task; /* writeback task */ 54 struct task_struct *task; /* writeback thread */
55 struct list_head b_dirty; /* dirty inodes */ 55 struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */
56 struct list_head b_io; /* parked for writeback */ 56 struct list_head b_dirty; /* dirty inodes */
57 struct list_head b_more_io; /* parked for more writeback */ 57 struct list_head b_io; /* parked for writeback */
58 struct list_head b_more_io; /* parked for more writeback */
58}; 59};
59 60
60struct backing_dev_info { 61struct backing_dev_info {
61 struct list_head bdi_list; 62 struct list_head bdi_list;
62 struct rcu_head rcu_head;
63 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ 63 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
64 unsigned long state; /* Always use atomic bitops on this */ 64 unsigned long state; /* Always use atomic bitops on this */
65 unsigned int capabilities; /* Device capabilities */ 65 unsigned int capabilities; /* Device capabilities */
@@ -79,15 +79,14 @@ struct backing_dev_info {
79 unsigned int max_ratio, max_prop_frac; 79 unsigned int max_ratio, max_prop_frac;
80 80
81 struct bdi_writeback wb; /* default writeback info for this bdi */ 81 struct bdi_writeback wb; /* default writeback info for this bdi */
82 spinlock_t wb_lock; /* protects update side of wb_list */ 82 spinlock_t wb_lock; /* protects work_list */
83 struct list_head wb_list; /* the flusher threads hanging off this bdi */
84 unsigned long wb_mask; /* bitmask of registered tasks */
85 unsigned int wb_cnt; /* number of registered tasks */
86 83
87 struct list_head work_list; 84 struct list_head work_list;
88 85
89 struct device *dev; 86 struct device *dev;
90 87
88 struct timer_list laptop_mode_wb_timer;
89
91#ifdef CONFIG_DEBUG_FS 90#ifdef CONFIG_DEBUG_FS
92 struct dentry *debug_dir; 91 struct dentry *debug_dir;
93 struct dentry *debug_stats; 92 struct dentry *debug_stats;
@@ -102,10 +101,12 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
102int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 101int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
103void bdi_unregister(struct backing_dev_info *bdi); 102void bdi_unregister(struct backing_dev_info *bdi);
104int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 103int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
105void bdi_start_writeback(struct backing_dev_info *bdi, struct super_block *sb, 104void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages);
106 long nr_pages); 105void bdi_start_background_writeback(struct backing_dev_info *bdi);
107int bdi_writeback_task(struct bdi_writeback *wb); 106int bdi_writeback_thread(void *data);
108int bdi_has_dirty_io(struct backing_dev_info *bdi); 107int bdi_has_dirty_io(struct backing_dev_info *bdi);
108void bdi_arm_supers_timer(void);
109void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
109 110
110extern spinlock_t bdi_lock; 111extern spinlock_t bdi_lock;
111extern struct list_head bdi_list; 112extern struct list_head bdi_list;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7fc5606e6ea5..5274103434ad 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is distributed in the hope that it will be useful, 10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
@@ -28,6 +28,9 @@
28 28
29#include <asm/io.h> 29#include <asm/io.h>
30 30
31/* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */
32#include <linux/blk_types.h>
33
31#define BIO_DEBUG 34#define BIO_DEBUG
32 35
33#ifdef BIO_DEBUG 36#ifdef BIO_DEBUG
@@ -41,154 +44,6 @@
41#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) 44#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
42 45
43/* 46/*
44 * was unsigned short, but we might as well be ready for > 64kB I/O pages
45 */
46struct bio_vec {
47 struct page *bv_page;
48 unsigned int bv_len;
49 unsigned int bv_offset;
50};
51
52struct bio_set;
53struct bio;
54struct bio_integrity_payload;
55typedef void (bio_end_io_t) (struct bio *, int);
56typedef void (bio_destructor_t) (struct bio *);
57
58/*
59 * main unit of I/O for the block layer and lower layers (ie drivers and
60 * stacking drivers)
61 */
62struct bio {
63 sector_t bi_sector; /* device address in 512 byte
64 sectors */
65 struct bio *bi_next; /* request queue link */
66 struct block_device *bi_bdev;
67 unsigned long bi_flags; /* status, command, etc */
68 unsigned long bi_rw; /* bottom bits READ/WRITE,
69 * top bits priority
70 */
71
72 unsigned short bi_vcnt; /* how many bio_vec's */
73 unsigned short bi_idx; /* current index into bvl_vec */
74
75 /* Number of segments in this BIO after
76 * physical address coalescing is performed.
77 */
78 unsigned int bi_phys_segments;
79
80 unsigned int bi_size; /* residual I/O count */
81
82 /*
83 * To keep track of the max segment size, we account for the
84 * sizes of the first and last mergeable segments in this bio.
85 */
86 unsigned int bi_seg_front_size;
87 unsigned int bi_seg_back_size;
88
89 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
90
91 unsigned int bi_comp_cpu; /* completion CPU */
92
93 atomic_t bi_cnt; /* pin count */
94
95 struct bio_vec *bi_io_vec; /* the actual vec list */
96
97 bio_end_io_t *bi_end_io;
98
99 void *bi_private;
100#if defined(CONFIG_BLK_DEV_INTEGRITY)
101 struct bio_integrity_payload *bi_integrity; /* data integrity */
102#endif
103
104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
112};
113
114/*
115 * bio flags
116 */
117#define BIO_UPTODATE 0 /* ok after I/O completion */
118#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
119#define BIO_EOF 2 /* out-out-bounds error */
120#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
121#define BIO_CLONED 4 /* doesn't own data */
122#define BIO_BOUNCED 5 /* bio is a bounce bio */
123#define BIO_USER_MAPPED 6 /* contains user pages */
124#define BIO_EOPNOTSUPP 7 /* not supported */
125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
130
131/*
132 * top 4 bits of bio flags indicate the pool this bio came from
133 */
134#define BIO_POOL_BITS (4)
135#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
136#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
137#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
138#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
139
140/*
141 * bio bi_rw flags
142 *
143 * bit 0 -- data direction
144 * If not set, bio is a read from device. If set, it's a write to device.
145 * bit 1 -- fail fast device errors
146 * bit 2 -- fail fast transport errors
147 * bit 3 -- fail fast driver errors
148 * bit 4 -- rw-ahead when set
149 * bit 5 -- barrier
150 * Insert a serialization point in the IO queue, forcing previously
151 * submitted IO to be completed before this one is issued.
152 * bit 6 -- synchronous I/O hint.
153 * bit 7 -- Unplug the device immediately after submitting this bio.
154 * bit 8 -- metadata request
155 * Used for tracing to differentiate metadata and data IO. May also
156 * get some preferential treatment in the IO scheduler
157 * bit 9 -- discard sectors
158 * Informs the lower level device that this range of sectors is no longer
159 * used by the file system and may thus be freed by the device. Used
160 * for flash based storage.
161 * Don't want driver retries for any fast fail whatever the reason.
162 * bit 10 -- Tell the IO scheduler not to wait for more requests after this
163 one has been submitted, even if it is a SYNC request.
164 */
165enum bio_rw_flags {
166 BIO_RW,
167 BIO_RW_FAILFAST_DEV,
168 BIO_RW_FAILFAST_TRANSPORT,
169 BIO_RW_FAILFAST_DRIVER,
170 /* above flags must match REQ_* */
171 BIO_RW_AHEAD,
172 BIO_RW_BARRIER,
173 BIO_RW_SYNCIO,
174 BIO_RW_UNPLUG,
175 BIO_RW_META,
176 BIO_RW_DISCARD,
177 BIO_RW_NOIDLE,
178};
179
180/*
181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
182 * that explicit here.
183 */
184#define BIO_RW_RQ_MASK 0xf
185
186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
187{
188 return (bio->bi_rw & (1 << flag)) != 0;
189}
190
191/*
192 * upper 16 bits of bi_rw define the io priority of this bio 47 * upper 16 bits of bi_rw define the io priority of this bio
193 */ 48 */
194#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) 49#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
@@ -211,7 +66,10 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
211#define bio_offset(bio) bio_iovec((bio))->bv_offset 66#define bio_offset(bio) bio_iovec((bio))->bv_offset
212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 67#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
213#define bio_sectors(bio) ((bio)->bi_size >> 9) 68#define bio_sectors(bio) ((bio)->bi_size >> 9)
214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD)) 69#define bio_empty_barrier(bio) \
70 ((bio->bi_rw & REQ_HARDBARRIER) && \
71 !bio_has_data(bio) && \
72 !(bio->bi_rw & REQ_DISCARD))
215 73
216static inline unsigned int bio_cur_bytes(struct bio *bio) 74static inline unsigned int bio_cur_bytes(struct bio *bio)
217{ 75{
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index b796eab5ca75..fc68053378ce 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,11 @@
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w);
16extern unsigned long __sw_hweight64(__u64 w);
17
13/* 18/*
14 * Include this here because some architectures need generic_ffs/fls in 19 * Include this here because some architectures need generic_ffs/fls in
15 * scope 20 * scope
@@ -44,31 +49,6 @@ static inline unsigned long hweight_long(unsigned long w)
44 return sizeof(w) == 4 ? hweight32(w) : hweight64(w); 49 return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
45} 50}
46 51
47/*
48 * Clearly slow versions of the hweightN() functions, their benefit is
49 * of course compile time evaluation of constant arguments.
50 */
51#define HWEIGHT8(w) \
52 ( BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + \
53 (!!((w) & (1ULL << 0))) + \
54 (!!((w) & (1ULL << 1))) + \
55 (!!((w) & (1ULL << 2))) + \
56 (!!((w) & (1ULL << 3))) + \
57 (!!((w) & (1ULL << 4))) + \
58 (!!((w) & (1ULL << 5))) + \
59 (!!((w) & (1ULL << 6))) + \
60 (!!((w) & (1ULL << 7))) )
61
62#define HWEIGHT16(w) (HWEIGHT8(w) + HWEIGHT8((w) >> 8))
63#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16((w) >> 16))
64#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32((w) >> 32))
65
66/*
67 * Type invariant version that simply casts things to the
68 * largest type.
69 */
70#define HWEIGHT(w) HWEIGHT64((u64)(w))
71
72/** 52/**
73 * rol32 - rotate a 32-bit value left 53 * rol32 - rotate a 32-bit value left
74 * @word: value to rotate 54 * @word: value to rotate
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
new file mode 100644
index 000000000000..53691774d34e
--- /dev/null
+++ b/include/linux/blk_types.h
@@ -0,0 +1,194 @@
1/*
2 * Block data types and constants. Directly include this file only to
3 * break include dependency loop.
4 */
5#ifndef __LINUX_BLK_TYPES_H
6#define __LINUX_BLK_TYPES_H
7
8#ifdef CONFIG_BLOCK
9
10#include <linux/types.h>
11
12struct bio_set;
13struct bio;
14struct bio_integrity_payload;
15struct page;
16struct block_device;
17typedef void (bio_end_io_t) (struct bio *, int);
18typedef void (bio_destructor_t) (struct bio *);
19
20/*
21 * was unsigned short, but we might as well be ready for > 64kB I/O pages
22 */
23struct bio_vec {
24 struct page *bv_page;
25 unsigned int bv_len;
26 unsigned int bv_offset;
27};
28
29/*
30 * main unit of I/O for the block layer and lower layers (ie drivers and
31 * stacking drivers)
32 */
33struct bio {
34 sector_t bi_sector; /* device address in 512 byte
35 sectors */
36 struct bio *bi_next; /* request queue link */
37 struct block_device *bi_bdev;
38 unsigned long bi_flags; /* status, command, etc */
39 unsigned long bi_rw; /* bottom bits READ/WRITE,
40 * top bits priority
41 */
42
43 unsigned short bi_vcnt; /* how many bio_vec's */
44 unsigned short bi_idx; /* current index into bvl_vec */
45
46 /* Number of segments in this BIO after
47 * physical address coalescing is performed.
48 */
49 unsigned int bi_phys_segments;
50
51 unsigned int bi_size; /* residual I/O count */
52
53 /*
54 * To keep track of the max segment size, we account for the
55 * sizes of the first and last mergeable segments in this bio.
56 */
57 unsigned int bi_seg_front_size;
58 unsigned int bi_seg_back_size;
59
60 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
61
62 unsigned int bi_comp_cpu; /* completion CPU */
63
64 atomic_t bi_cnt; /* pin count */
65
66 struct bio_vec *bi_io_vec; /* the actual vec list */
67
68 bio_end_io_t *bi_end_io;
69
70 void *bi_private;
71#if defined(CONFIG_BLK_DEV_INTEGRITY)
72 struct bio_integrity_payload *bi_integrity; /* data integrity */
73#endif
74
75 bio_destructor_t *bi_destructor; /* destructor */
76
77 /*
78 * We can inline a number of vecs at the end of the bio, to avoid
79 * double allocations for a small number of bio_vecs. This member
80 * MUST obviously be kept at the very end of the bio.
81 */
82 struct bio_vec bi_inline_vecs[0];
83};
84
85/*
86 * bio flags
87 */
88#define BIO_UPTODATE 0 /* ok after I/O completion */
89#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
90#define BIO_EOF 2 /* out-out-bounds error */
91#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
92#define BIO_CLONED 4 /* doesn't own data */
93#define BIO_BOUNCED 5 /* bio is a bounce bio */
94#define BIO_USER_MAPPED 6 /* contains user pages */
95#define BIO_EOPNOTSUPP 7 /* not supported */
96#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
97#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
98#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
99#define BIO_QUIET 11 /* Make BIO Quiet */
100#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
101
102/*
103 * top 4 bits of bio flags indicate the pool this bio came from
104 */
105#define BIO_POOL_BITS (4)
106#define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1)
107#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
108#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
109#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
110
111#endif /* CONFIG_BLOCK */
112
113/*
114 * Request flags. For use in the cmd_flags field of struct request, and in
115 * bi_rw of struct bio. Note that some flags are only valid in either one.
116 */
117enum rq_flag_bits {
118 /* common flags */
119 __REQ_WRITE, /* not set, read. set, write */
120 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
121 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
122 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
123
124 __REQ_HARDBARRIER, /* may not be passed by drive either */
125 __REQ_SYNC, /* request is sync (sync write or read) */
126 __REQ_META, /* metadata io request */
127 __REQ_DISCARD, /* request to discard sectors */
128 __REQ_NOIDLE, /* don't anticipate more IO after this one */
129
130 /* bio only flags */
131 __REQ_UNPLUG, /* unplug the immediately after submission */
132 __REQ_RAHEAD, /* read ahead, can fail anytime */
133
134 /* request only flags */
135 __REQ_SORTED, /* elevator knows about this request */
136 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
137 __REQ_FUA, /* forced unit access */
138 __REQ_NOMERGE, /* don't touch this for merging */
139 __REQ_STARTED, /* drive already may have started this one */
140 __REQ_DONTPREP, /* don't call prep for this one */
141 __REQ_QUEUED, /* uses queueing */
142 __REQ_ELVPRIV, /* elevator private data attached */
143 __REQ_FAILED, /* set if the request failed */
144 __REQ_QUIET, /* don't worry about errors */
145 __REQ_PREEMPT, /* set for "ide_preempt" requests */
146 __REQ_ORDERED_COLOR, /* is before or after barrier */
147 __REQ_ALLOCED, /* request came from our alloc pool */
148 __REQ_COPY_USER, /* contains copies of user pages */
149 __REQ_INTEGRITY, /* integrity metadata has been remapped */
150 __REQ_FLUSH, /* request for cache flush */
151 __REQ_IO_STAT, /* account I/O stat */
152 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
153 __REQ_NR_BITS, /* stops here */
154};
155
156#define REQ_WRITE (1 << __REQ_WRITE)
157#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
158#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
159#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
160#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
161#define REQ_SYNC (1 << __REQ_SYNC)
162#define REQ_META (1 << __REQ_META)
163#define REQ_DISCARD (1 << __REQ_DISCARD)
164#define REQ_NOIDLE (1 << __REQ_NOIDLE)
165
166#define REQ_FAILFAST_MASK \
167 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
168#define REQ_COMMON_MASK \
169 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \
170 REQ_META| REQ_DISCARD | REQ_NOIDLE)
171
172#define REQ_UNPLUG (1 << __REQ_UNPLUG)
173#define REQ_RAHEAD (1 << __REQ_RAHEAD)
174
175#define REQ_SORTED (1 << __REQ_SORTED)
176#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
177#define REQ_FUA (1 << __REQ_FUA)
178#define REQ_NOMERGE (1 << __REQ_NOMERGE)
179#define REQ_STARTED (1 << __REQ_STARTED)
180#define REQ_DONTPREP (1 << __REQ_DONTPREP)
181#define REQ_QUEUED (1 << __REQ_QUEUED)
182#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
183#define REQ_FAILED (1 << __REQ_FAILED)
184#define REQ_QUIET (1 << __REQ_QUIET)
185#define REQ_PREEMPT (1 << __REQ_PREEMPT)
186#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
187#define REQ_ALLOCED (1 << __REQ_ALLOCED)
188#define REQ_COPY_USER (1 << __REQ_COPY_USER)
189#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
190#define REQ_FLUSH (1 << __REQ_FLUSH)
191#define REQ_IO_STAT (1 << __REQ_IO_STAT)
192#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
193
194#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6690e8bae7bb..89c855c5655c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -60,7 +60,6 @@ enum rq_cmd_type_bits {
60 REQ_TYPE_PM_RESUME, /* resume request */ 60 REQ_TYPE_PM_RESUME, /* resume request */
61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 61 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
62 REQ_TYPE_SPECIAL, /* driver defined type */ 62 REQ_TYPE_SPECIAL, /* driver defined type */
63 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
64 /* 63 /*
65 * for ATA/ATAPI devices. this really doesn't belong here, ide should 64 * for ATA/ATAPI devices. this really doesn't belong here, ide should
66 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 65 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
@@ -70,84 +69,6 @@ enum rq_cmd_type_bits {
70 REQ_TYPE_ATA_PC, 69 REQ_TYPE_ATA_PC,
71}; 70};
72 71
73/*
74 * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
75 * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
76 * SCSI cdb.
77 *
78 * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
79 * typically to differentiate REQ_TYPE_SPECIAL requests.
80 *
81 */
82enum {
83 REQ_LB_OP_EJECT = 0x40, /* eject request */
84 REQ_LB_OP_FLUSH = 0x41, /* flush request */
85};
86
87/*
88 * request type modified bits. first four bits match BIO_RW* bits, important
89 */
90enum rq_flag_bits {
91 __REQ_RW, /* not set, read. set, write */
92 __REQ_FAILFAST_DEV, /* no driver retries of device errors */
93 __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
94 __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */
95 /* above flags must match BIO_RW_* */
96 __REQ_DISCARD, /* request to discard sectors */
97 __REQ_SORTED, /* elevator knows about this request */
98 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
99 __REQ_HARDBARRIER, /* may not be passed by drive either */
100 __REQ_FUA, /* forced unit access */
101 __REQ_NOMERGE, /* don't touch this for merging */
102 __REQ_STARTED, /* drive already may have started this one */
103 __REQ_DONTPREP, /* don't call prep for this one */
104 __REQ_QUEUED, /* uses queueing */
105 __REQ_ELVPRIV, /* elevator private data attached */
106 __REQ_FAILED, /* set if the request failed */
107 __REQ_QUIET, /* don't worry about errors */
108 __REQ_PREEMPT, /* set for "ide_preempt" requests */
109 __REQ_ORDERED_COLOR, /* is before or after barrier */
110 __REQ_RW_SYNC, /* request is sync (sync write or read) */
111 __REQ_ALLOCED, /* request came from our alloc pool */
112 __REQ_RW_META, /* metadata io request */
113 __REQ_COPY_USER, /* contains copies of user pages */
114 __REQ_INTEGRITY, /* integrity metadata has been remapped */
115 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
116 __REQ_IO_STAT, /* account I/O stat */
117 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
118 __REQ_NR_BITS, /* stops here */
119};
120
121#define REQ_RW (1 << __REQ_RW)
122#define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV)
123#define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT)
124#define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER)
125#define REQ_DISCARD (1 << __REQ_DISCARD)
126#define REQ_SORTED (1 << __REQ_SORTED)
127#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
128#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
129#define REQ_FUA (1 << __REQ_FUA)
130#define REQ_NOMERGE (1 << __REQ_NOMERGE)
131#define REQ_STARTED (1 << __REQ_STARTED)
132#define REQ_DONTPREP (1 << __REQ_DONTPREP)
133#define REQ_QUEUED (1 << __REQ_QUEUED)
134#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
135#define REQ_FAILED (1 << __REQ_FAILED)
136#define REQ_QUIET (1 << __REQ_QUIET)
137#define REQ_PREEMPT (1 << __REQ_PREEMPT)
138#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
139#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
140#define REQ_ALLOCED (1 << __REQ_ALLOCED)
141#define REQ_RW_META (1 << __REQ_RW_META)
142#define REQ_COPY_USER (1 << __REQ_COPY_USER)
143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
144#define REQ_NOIDLE (1 << __REQ_NOIDLE)
145#define REQ_IO_STAT (1 << __REQ_IO_STAT)
146#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
147
148#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
149 REQ_FAILFAST_DRIVER)
150
151#define BLK_MAX_CDB 16 72#define BLK_MAX_CDB 16
152 73
153/* 74/*
@@ -186,15 +107,19 @@ struct request {
186 }; 107 };
187 108
188 /* 109 /*
189 * two pointers are available for the IO schedulers, if they need 110 * Three pointers are available for the IO schedulers, if they need
190 * more they have to dynamically allocate it. 111 * more they have to dynamically allocate it.
191 */ 112 */
192 void *elevator_private; 113 void *elevator_private;
193 void *elevator_private2; 114 void *elevator_private2;
115 void *elevator_private3;
194 116
195 struct gendisk *rq_disk; 117 struct gendisk *rq_disk;
196 unsigned long start_time; 118 unsigned long start_time;
197 119#ifdef CONFIG_BLK_CGROUP
120 unsigned long long start_time_ns;
121 unsigned long long io_start_time_ns; /* when passed to hardware */
122#endif
198 /* Number of scatter-gather DMA addr+len pairs after 123 /* Number of scatter-gather DMA addr+len pairs after
199 * physical address coalescing is performed. 124 * physical address coalescing is performed.
200 */ 125 */
@@ -260,6 +185,7 @@ struct request_pm_state
260typedef void (request_fn_proc) (struct request_queue *q); 185typedef void (request_fn_proc) (struct request_queue *q);
261typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 186typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
262typedef int (prep_rq_fn) (struct request_queue *, struct request *); 187typedef int (prep_rq_fn) (struct request_queue *, struct request *);
188typedef void (unprep_rq_fn) (struct request_queue *, struct request *);
263typedef void (unplug_fn) (struct request_queue *); 189typedef void (unplug_fn) (struct request_queue *);
264 190
265struct bio_vec; 191struct bio_vec;
@@ -271,7 +197,6 @@ struct bvec_merge_data {
271}; 197};
272typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, 198typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
273 struct bio_vec *); 199 struct bio_vec *);
274typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
275typedef void (softirq_done_fn)(struct request *); 200typedef void (softirq_done_fn)(struct request *);
276typedef int (dma_drain_needed_fn)(struct request *); 201typedef int (dma_drain_needed_fn)(struct request *);
277typedef int (lld_busy_fn) (struct request_queue *q); 202typedef int (lld_busy_fn) (struct request_queue *q);
@@ -342,9 +267,9 @@ struct request_queue
342 request_fn_proc *request_fn; 267 request_fn_proc *request_fn;
343 make_request_fn *make_request_fn; 268 make_request_fn *make_request_fn;
344 prep_rq_fn *prep_rq_fn; 269 prep_rq_fn *prep_rq_fn;
270 unprep_rq_fn *unprep_rq_fn;
345 unplug_fn *unplug_fn; 271 unplug_fn *unplug_fn;
346 merge_bvec_fn *merge_bvec_fn; 272 merge_bvec_fn *merge_bvec_fn;
347 prepare_flush_fn *prepare_flush_fn;
348 softirq_done_fn *softirq_done_fn; 273 softirq_done_fn *softirq_done_fn;
349 rq_timed_out_fn *rq_timed_out_fn; 274 rq_timed_out_fn *rq_timed_out_fn;
350 dma_drain_needed_fn *dma_drain_needed; 275 dma_drain_needed_fn *dma_drain_needed;
@@ -463,11 +388,13 @@ struct request_queue
463#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ 388#define QUEUE_FLAG_IO_STAT 15 /* do IO stats */
464#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ 389#define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */
465#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ 390#define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */
391#define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */
466 392
467#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 393#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
468 (1 << QUEUE_FLAG_CLUSTER) | \ 394 (1 << QUEUE_FLAG_CLUSTER) | \
469 (1 << QUEUE_FLAG_STACKABLE) | \ 395 (1 << QUEUE_FLAG_STACKABLE) | \
470 (1 << QUEUE_FLAG_SAME_COMP)) 396 (1 << QUEUE_FLAG_SAME_COMP) | \
397 (1 << QUEUE_FLAG_ADD_RANDOM))
471 398
472static inline int queue_is_locked(struct request_queue *q) 399static inline int queue_is_locked(struct request_queue *q)
473{ 400{
@@ -592,38 +519,26 @@ enum {
592 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) 519 test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags)
593#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) 520#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
594#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) 521#define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags)
522#define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags)
595#define blk_queue_flushing(q) ((q)->ordseq) 523#define blk_queue_flushing(q) ((q)->ordseq)
596#define blk_queue_stackable(q) \ 524#define blk_queue_stackable(q) \
597 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) 525 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
598#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) 526#define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags)
599 527
600#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 528#define blk_noretry_request(rq) \
601#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 529 ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \
602#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) 530 REQ_FAILFAST_DRIVER))
603#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) 531
604 532#define blk_account_rq(rq) \
605#define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) 533 (((rq)->cmd_flags & REQ_STARTED) && \
606#define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) 534 ((rq)->cmd_type == REQ_TYPE_FS || \
607#define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) 535 ((rq)->cmd_flags & REQ_DISCARD)))
608#define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ 536
609 blk_failfast_transport(rq) || \
610 blk_failfast_driver(rq))
611#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
612#define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT)
613#define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET)
614
615#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
616
617#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
618#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
619#define blk_pm_request(rq) \ 537#define blk_pm_request(rq) \
620 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 538 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
539 (rq)->cmd_type == REQ_TYPE_PM_RESUME)
621 540
622#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) 541#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
623#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
624#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
625#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
626#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
627#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 542#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
628/* rq->queuelist of dequeued request must be list_empty() */ 543/* rq->queuelist of dequeued request must be list_empty() */
629#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 544#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
@@ -637,7 +552,7 @@ enum {
637 */ 552 */
638static inline bool rw_is_sync(unsigned int rw_flags) 553static inline bool rw_is_sync(unsigned int rw_flags)
639{ 554{
640 return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); 555 return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC);
641} 556}
642 557
643static inline bool rq_is_sync(struct request *rq) 558static inline bool rq_is_sync(struct request *rq)
@@ -645,9 +560,6 @@ static inline bool rq_is_sync(struct request *rq)
645 return rw_is_sync(rq->cmd_flags); 560 return rw_is_sync(rq->cmd_flags);
646} 561}
647 562
648#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
649#define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE)
650
651static inline int blk_queue_full(struct request_queue *q, int sync) 563static inline int blk_queue_full(struct request_queue *q, int sync)
652{ 564{
653 if (sync) 565 if (sync)
@@ -680,7 +592,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync)
680 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 592 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
681#define rq_mergeable(rq) \ 593#define rq_mergeable(rq) \
682 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 594 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
683 (blk_discard_rq(rq) || blk_fs_request((rq)))) 595 (((rq)->cmd_flags & REQ_DISCARD) || \
596 (rq)->cmd_type == REQ_TYPE_FS))
684 597
685/* 598/*
686 * q->prep_rq_fn return values 599 * q->prep_rq_fn return values
@@ -705,7 +618,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn;
705#define BLK_BOUNCE_HIGH -1ULL 618#define BLK_BOUNCE_HIGH -1ULL
706#endif 619#endif
707#define BLK_BOUNCE_ANY (-1ULL) 620#define BLK_BOUNCE_ANY (-1ULL)
708#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) 621#define BLK_BOUNCE_ISA (DMA_BIT_MASK(24))
709 622
710/* 623/*
711 * default timeout for SG_IO if none specified 624 * default timeout for SG_IO if none specified
@@ -777,6 +690,8 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
777 gfp_t); 690 gfp_t);
778extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 691extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
779extern void blk_requeue_request(struct request_queue *, struct request *); 692extern void blk_requeue_request(struct request_queue *, struct request *);
693extern void blk_add_request_payload(struct request *rq, struct page *page,
694 unsigned int len);
780extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 695extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
781extern int blk_lld_busy(struct request_queue *q); 696extern int blk_lld_busy(struct request_queue *q);
782extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 697extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
@@ -911,13 +826,19 @@ extern void blk_complete_request(struct request *);
911extern void __blk_complete_request(struct request *); 826extern void __blk_complete_request(struct request *);
912extern void blk_abort_request(struct request *); 827extern void blk_abort_request(struct request *);
913extern void blk_abort_queue(struct request_queue *); 828extern void blk_abort_queue(struct request_queue *);
829extern void blk_unprep_request(struct request *);
914 830
915/* 831/*
916 * Access functions for manipulating queue properties 832 * Access functions for manipulating queue properties
917 */ 833 */
918extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn, 834extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,
919 spinlock_t *lock, int node_id); 835 spinlock_t *lock, int node_id);
836extern struct request_queue *blk_init_allocated_queue_node(struct request_queue *,
837 request_fn_proc *,
838 spinlock_t *, int node_id);
920extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *); 839extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);
840extern struct request_queue *blk_init_allocated_queue(struct request_queue *,
841 request_fn_proc *, spinlock_t *);
921extern void blk_cleanup_queue(struct request_queue *); 842extern void blk_cleanup_queue(struct request_queue *);
922extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 843extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
923extern void blk_queue_bounce_limit(struct request_queue *, u64); 844extern void blk_queue_bounce_limit(struct request_queue *, u64);
@@ -950,6 +871,7 @@ extern int blk_queue_dma_drain(struct request_queue *q,
950extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); 871extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
951extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 872extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
952extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 873extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
874extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn);
953extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 875extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
954extern void blk_queue_dma_alignment(struct request_queue *, int); 876extern void blk_queue_dma_alignment(struct request_queue *, int);
955extern void blk_queue_update_dma_alignment(struct request_queue *, int); 877extern void blk_queue_update_dma_alignment(struct request_queue *, int);
@@ -957,7 +879,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
957extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); 879extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
958extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 880extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
959extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 881extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
960extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 882extern int blk_queue_ordered(struct request_queue *, unsigned);
961extern bool blk_do_ordered(struct request_queue *, struct request **); 883extern bool blk_do_ordered(struct request_queue *, struct request **);
962extern unsigned blk_ordered_cur_seq(struct request_queue *); 884extern unsigned blk_ordered_cur_seq(struct request_queue *);
963extern unsigned blk_ordered_req_seq(struct request *); 885extern unsigned blk_ordered_req_seq(struct request *);
@@ -994,20 +916,25 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
994 return NULL; 916 return NULL;
995 return bqt->tag_index[tag]; 917 return bqt->tag_index[tag];
996} 918}
997 919enum{
998extern int blkdev_issue_flush(struct block_device *, sector_t *); 920 BLKDEV_WAIT, /* wait for completion */
999#define DISCARD_FL_WAIT 0x01 /* wait for completion */ 921 BLKDEV_BARRIER, /*issue request with barrier */
1000#define DISCARD_FL_BARRIER 0x02 /* issue DISCARD_BARRIER request */ 922};
1001extern int blkdev_issue_discard(struct block_device *, sector_t sector, 923#define BLKDEV_IFL_WAIT (1 << BLKDEV_WAIT)
1002 sector_t nr_sects, gfp_t, int flags); 924#define BLKDEV_IFL_BARRIER (1 << BLKDEV_BARRIER)
1003 925extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
926 unsigned long);
927extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
928 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
929extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
930 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1004static inline int sb_issue_discard(struct super_block *sb, 931static inline int sb_issue_discard(struct super_block *sb,
1005 sector_t block, sector_t nr_blocks) 932 sector_t block, sector_t nr_blocks)
1006{ 933{
1007 block <<= (sb->s_blocksize_bits - 9); 934 block <<= (sb->s_blocksize_bits - 9);
1008 nr_blocks <<= (sb->s_blocksize_bits - 9); 935 nr_blocks <<= (sb->s_blocksize_bits - 9);
1009 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, 936 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
1010 DISCARD_FL_BARRIER); 937 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
1011} 938}
1012 939
1013extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm); 940extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);
@@ -1196,6 +1123,48 @@ static inline void put_dev_sector(Sector p)
1196struct work_struct; 1123struct work_struct;
1197int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 1124int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
1198 1125
1126#ifdef CONFIG_BLK_CGROUP
1127/*
1128 * This should not be using sched_clock(). A real patch is in progress
1129 * to fix this up, until that is in place we need to disable preemption
1130 * around sched_clock() in this function and set_io_start_time_ns().
1131 */
1132static inline void set_start_time_ns(struct request *req)
1133{
1134 preempt_disable();
1135 req->start_time_ns = sched_clock();
1136 preempt_enable();
1137}
1138
1139static inline void set_io_start_time_ns(struct request *req)
1140{
1141 preempt_disable();
1142 req->io_start_time_ns = sched_clock();
1143 preempt_enable();
1144}
1145
1146static inline uint64_t rq_start_time_ns(struct request *req)
1147{
1148 return req->start_time_ns;
1149}
1150
1151static inline uint64_t rq_io_start_time_ns(struct request *req)
1152{
1153 return req->io_start_time_ns;
1154}
1155#else
1156static inline void set_start_time_ns(struct request *req) {}
1157static inline void set_io_start_time_ns(struct request *req) {}
1158static inline uint64_t rq_start_time_ns(struct request *req)
1159{
1160 return 0;
1161}
1162static inline uint64_t rq_io_start_time_ns(struct request *req)
1163{
1164 return 0;
1165}
1166#endif
1167
1199#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 1168#define MODULE_ALIAS_BLOCKDEV(major,minor) \
1200 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 1169 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
1201#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ 1170#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
@@ -1277,16 +1246,16 @@ static inline int blk_integrity_rq(struct request *rq)
1277struct block_device_operations { 1246struct block_device_operations {
1278 int (*open) (struct block_device *, fmode_t); 1247 int (*open) (struct block_device *, fmode_t);
1279 int (*release) (struct gendisk *, fmode_t); 1248 int (*release) (struct gendisk *, fmode_t);
1280 int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1281 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1249 int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1282 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); 1250 int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
1283 int (*direct_access) (struct block_device *, sector_t, 1251 int (*direct_access) (struct block_device *, sector_t,
1284 void **, unsigned long *); 1252 void **, unsigned long *);
1285 int (*media_changed) (struct gendisk *); 1253 int (*media_changed) (struct gendisk *);
1286 unsigned long long (*set_capacity) (struct gendisk *, 1254 void (*unlock_native_capacity) (struct gendisk *);
1287 unsigned long long);
1288 int (*revalidate_disk) (struct gendisk *); 1255 int (*revalidate_disk) (struct gendisk *);
1289 int (*getgeo)(struct block_device *, struct hd_geometry *); 1256 int (*getgeo)(struct block_device *, struct hd_geometry *);
1257 /* this callback is with swap_lock and sometimes page table lock held */
1258 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
1290 struct module *owner; 1259 struct module *owner;
1291}; 1260};
1292 1261
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 416bf62d6d46..3395cf7130f5 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -5,6 +5,7 @@
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6#include <linux/blkdev.h> 6#include <linux/blkdev.h>
7#include <linux/relay.h> 7#include <linux/relay.h>
8#include <linux/compat.h>
8#endif 9#endif
9 10
10/* 11/*
@@ -220,11 +221,26 @@ static inline int blk_trace_init_sysfs(struct device *dev)
220 221
221#endif /* CONFIG_BLK_DEV_IO_TRACE */ 222#endif /* CONFIG_BLK_DEV_IO_TRACE */
222 223
224#ifdef CONFIG_COMPAT
225
226struct compat_blk_user_trace_setup {
227 char name[32];
228 u16 act_mask;
229 u32 buf_size;
230 u32 buf_nr;
231 compat_u64 start_lba;
232 compat_u64 end_lba;
233 u32 pid;
234};
235#define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup)
236
237#endif
238
223#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) 239#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
224 240
225static inline int blk_cmd_buf_len(struct request *rq) 241static inline int blk_cmd_buf_len(struct request *rq)
226{ 242{
227 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; 243 return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1;
228} 244}
229 245
230extern void blk_dump_cmd(char *buf, struct request *rq); 246extern void blk_dump_cmd(char *buf, struct request *rq);
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 7f437ca1ed44..b840a4960282 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -1,6 +1,13 @@
1#define PHY_ID_BCM50610 0x0143bd60 1#define PHY_ID_BCM50610 0x0143bd60
2#define PHY_ID_BCM50610M 0x0143bd70 2#define PHY_ID_BCM50610M 0x0143bd70
3#define PHY_ID_BCM5241 0x0143bc30
3#define PHY_ID_BCMAC131 0x0143bc70 4#define PHY_ID_BCMAC131 0x0143bc70
5#define PHY_ID_BCM5481 0x0143bca0
6#define PHY_ID_BCM5482 0x0143bcb0
7#define PHY_ID_BCM5411 0x00206070
8#define PHY_ID_BCM5421 0x002060e0
9#define PHY_ID_BCM5464 0x002060b0
10#define PHY_ID_BCM5461 0x002060c0
4#define PHY_ID_BCM57780 0x03625d90 11#define PHY_ID_BCM57780 0x03625d90
5 12
6#define PHY_BCM_OUI_MASK 0xfffffc00 13#define PHY_BCM_OUI_MASK 0xfffffc00
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 16ed0284d780..43e649a72529 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -203,9 +203,10 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block,
203int block_read_full_page(struct page*, get_block_t*); 203int block_read_full_page(struct page*, get_block_t*);
204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 204int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
205 unsigned long from); 205 unsigned long from);
206int block_write_begin(struct file *, struct address_space *, 206int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
207 loff_t, unsigned, unsigned, 207 unsigned flags, struct page **pagep, get_block_t *get_block);
208 struct page **, void **, get_block_t*); 208int __block_write_begin(struct page *page, loff_t pos, unsigned len,
209 get_block_t *get_block);
209int block_write_end(struct file *, struct address_space *, 210int block_write_end(struct file *, struct address_space *,
210 loff_t, unsigned, unsigned, 211 loff_t, unsigned, unsigned,
211 struct page *, void *); 212 struct page *, void *);
@@ -224,9 +225,7 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
224void block_sync_page(struct page *); 225void block_sync_page(struct page *);
225sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); 226sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
226int block_truncate_page(struct address_space *, loff_t, get_block_t *); 227int block_truncate_page(struct address_space *, loff_t, get_block_t *);
227int file_fsync(struct file *, struct dentry *, int); 228int nobh_write_begin(struct address_space *, loff_t, unsigned, unsigned,
228int nobh_write_begin(struct file *, struct address_space *,
229 loff_t, unsigned, unsigned,
230 struct page **, void **, get_block_t*); 229 struct page **, void **, get_block_t*);
231int nobh_write_end(struct file *, struct address_space *, 230int nobh_write_end(struct file *, struct address_space *,
232 loff_t, unsigned, unsigned, 231 loff_t, unsigned, unsigned,
@@ -305,15 +304,10 @@ map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
305 bh->b_size = sb->s_blocksize; 304 bh->b_size = sb->s_blocksize;
306} 305}
307 306
308/*
309 * Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
310 * __wait_on_buffer() just to trip a debug check. Because debug code in inline
311 * functions is bloaty.
312 */
313static inline void wait_on_buffer(struct buffer_head *bh) 307static inline void wait_on_buffer(struct buffer_head *bh)
314{ 308{
315 might_sleep(); 309 might_sleep();
316 if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0) 310 if (buffer_locked(bh))
317 __wait_on_buffer(bh); 311 __wait_on_buffer(bh);
318} 312}
319 313
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 97e24881c4c6..4c570653ab84 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -31,7 +31,7 @@
31#ifndef __cacheline_aligned 31#ifndef __cacheline_aligned
32#define __cacheline_aligned \ 32#define __cacheline_aligned \
33 __attribute__((__aligned__(SMP_CACHE_BYTES), \ 33 __attribute__((__aligned__(SMP_CACHE_BYTES), \
34 __section__(".data.cacheline_aligned"))) 34 __section__(".data..cacheline_aligned")))
35#endif /* __cacheline_aligned */ 35#endif /* __cacheline_aligned */
36 36
37#ifndef __cacheline_aligned_in_smp 37#ifndef __cacheline_aligned_in_smp
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h
new file mode 100644
index 000000000000..d9cb19b7cff7
--- /dev/null
+++ b/include/linux/caif/caif_socket.h
@@ -0,0 +1,199 @@
1/* linux/caif_socket.h
2 * CAIF Definitions for CAIF socket and network layer
3 * Copyright (C) ST-Ericsson AB 2010
4 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef _LINUX_CAIF_SOCKET_H
9#define _LINUX_CAIF_SOCKET_H
10
11#include <linux/types.h>
12
13#ifdef __KERNEL__
14#include <linux/socket.h>
15#else
16#include <sys/socket.h>
17#endif
18
19/**
20 * enum caif_link_selector - Physical Link Selection.
21 * @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth
22 * traffic.
23 * @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency
24 * traffic.
25 *
26 * CAIF Link Layers can register their link properties.
27 * This enum is used for choosing between CAIF Link Layers when
28 * setting up CAIF Channels when multiple CAIF Link Layers exists.
29 */
30enum caif_link_selector {
31 CAIF_LINK_HIGH_BANDW,
32 CAIF_LINK_LOW_LATENCY
33};
34
35/**
36 * enum caif_channel_priority - CAIF channel priorities.
37 *
38 * @CAIF_PRIO_MIN: Min priority for a channel.
39 * @CAIF_PRIO_LOW: Low-priority channel.
40 * @CAIF_PRIO_NORMAL: Normal/default priority level.
41 * @CAIF_PRIO_HIGH: High priority level
42 * @CAIF_PRIO_MAX: Max priority for channel
43 *
44 * Priority can be set on CAIF Channels in order to
45 * prioritize between traffic on different CAIF Channels.
46 * These priority levels are recommended, but the priority value
47 * is not restricted to the values defined in this enum, any value
48 * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
49 */
50enum caif_channel_priority {
51 CAIF_PRIO_MIN = 0x01,
52 CAIF_PRIO_LOW = 0x04,
53 CAIF_PRIO_NORMAL = 0x0f,
54 CAIF_PRIO_HIGH = 0x14,
55 CAIF_PRIO_MAX = 0x1F
56};
57
58/**
59 * enum caif_protocol_type - CAIF Channel type.
60 * @CAIFPROTO_AT: Classic AT channel.
61 * @CAIFPROTO_DATAGRAM: Datagram channel.
62 * @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing.
63 * @CAIFPROTO_UTIL: Utility (Psock) channel.
64 * @CAIFPROTO_RFM: Remote File Manager
65 * @CAIFPROTO_DEBUG: Debug link
66 *
67 * This enum defines the CAIF Channel type to be used. This defines
68 * the service to connect to on the modem.
69 */
70enum caif_protocol_type {
71 CAIFPROTO_AT,
72 CAIFPROTO_DATAGRAM,
73 CAIFPROTO_DATAGRAM_LOOP,
74 CAIFPROTO_UTIL,
75 CAIFPROTO_RFM,
76 CAIFPROTO_DEBUG,
77 _CAIFPROTO_MAX
78};
79#define CAIFPROTO_MAX _CAIFPROTO_MAX
80
81/**
82 * enum caif_at_type - AT Service Endpoint
83 * @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel.
84 */
85enum caif_at_type {
86 CAIF_ATTYPE_PLAIN = 2
87};
88 /**
89 * enum caif_debug_type - Content selection for debug connection
90 * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
91 * both trace and interactive debug.
92 * @CAIF_DEBUG_TRACE: Connection contains trace only.
93 * @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug.
94 */
95enum caif_debug_type {
96 CAIF_DEBUG_TRACE_INTERACTIVE = 0,
97 CAIF_DEBUG_TRACE,
98 CAIF_DEBUG_INTERACTIVE,
99};
100
101/**
102 * enum caif_debug_service - Debug Service Endpoint
103 * @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system
104 * @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system
105 */
106enum caif_debug_service {
107 CAIF_RADIO_DEBUG_SERVICE = 1,
108 CAIF_APP_DEBUG_SERVICE
109};
110
111/**
112 * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
113 * @family: Address family number, must be AF_CAIF.
114 * @u: Union of address data 'switched' by family.
115 * :
116 * @u.at: Applies when family = CAIFPROTO_AT.
117 *
118 * @u.at.type: Type of AT link to set up (enum caif_at_type).
119 *
120 * @u.util: Applies when family = CAIFPROTO_UTIL
121 *
122 * @u.util.service: Utility service name.
123 *
124 * @u.dgm: Applies when family = CAIFPROTO_DATAGRAM
125 *
126 * @u.dgm.connection_id: Datagram connection id.
127 *
128 * @u.dgm.nsapi: NSAPI of the PDP-Context.
129 *
130 * @u.rfm: Applies when family = CAIFPROTO_RFM
131 *
132 * @u.rfm.connection_id: Connection ID for RFM.
133 *
134 * @u.rfm.volume: Volume to mount.
135 *
136 * @u.dbg: Applies when family = CAIFPROTO_DEBUG.
137 *
138 * @u.dbg.type: Type of debug connection to set up
139 * (caif_debug_type).
140 *
141 * @u.dbg.service: Service sub-system to connect (caif_debug_service
142 * Description:
143 * This structure holds the connect parameters used for setting up a
144 * CAIF Channel. It defines the service to connect to on the modem.
145 */
146struct sockaddr_caif {
147 sa_family_t family;
148 union {
149 struct {
150 __u8 type; /* type: enum caif_at_type */
151 } at; /* CAIFPROTO_AT */
152 struct {
153 char service[16];
154 } util; /* CAIFPROTO_UTIL */
155 union {
156 __u32 connection_id;
157 __u8 nsapi;
158 } dgm; /* CAIFPROTO_DATAGRAM(_LOOP)*/
159 struct {
160 __u32 connection_id;
161 char volume[16];
162 } rfm; /* CAIFPROTO_RFM */
163 struct {
164 __u8 type; /* type:enum caif_debug_type */
165 __u8 service; /* service:caif_debug_service */
166 } dbg; /* CAIFPROTO_DEBUG */
167 } u;
168};
169
170/**
171 * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
172 *
173 * @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are
174 * available. Either a high bandwidth
175 * link can be selected (CAIF_LINK_HIGH_BANDW) or
176 * or a low latency link (CAIF_LINK_LOW_LATENCY).
177 * This option is of type __u32.
178 * Alternatively SO_BINDTODEVICE can be used.
179 *
180 * @CAIFSO_REQ_PARAM: Used to set the request parameters for a
181 * utility channel. (maximum 256 bytes). This
182 * option must be set before connecting.
183 *
184 * @CAIFSO_RSP_PARAM: Gets the response parameters for a utility
185 * channel. (maximum 256 bytes). This option
186 * is valid after a successful connect.
187 *
188 *
189 * This enum defines the CAIF Socket options to be used on a socket
190 * of type PF_CAIF.
191 *
192 */
193enum caif_socket_opts {
194 CAIFSO_LINK_SELECT = 127,
195 CAIFSO_REQ_PARAM = 128,
196 CAIFSO_RSP_PARAM = 129,
197};
198
199#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h
new file mode 100644
index 000000000000..5e7eed4edf51
--- /dev/null
+++ b/include/linux/caif/if_caif.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2010
3 * Author: Sjur Brendeland/ sjur.brandeland@stericsson.com
4 * License terms: GNU General Public License (GPL) version 2
5 */
6
7#ifndef IF_CAIF_H_
8#define IF_CAIF_H_
9#include <linux/sockios.h>
10#include <linux/types.h>
11#include <linux/socket.h>
12
13/**
14 * enum ifla_caif - CAIF NetlinkRT parameters.
15 * @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context.
16 * The type of attribute is NLA_U32.
17 * @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context.
18 * The type of attribute is NLA_U32.
19 * @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback
20 * The type of attribute is NLA_U8.
21 *
22 * When using RT Netlink to create, destroy or configure a CAIF IP interface,
23 * enum ifla_caif is used to specify the configuration attributes.
24 */
25enum ifla_caif {
26 __IFLA_CAIF_UNSPEC,
27 IFLA_CAIF_IPV4_CONNID,
28 IFLA_CAIF_IPV6_CONNID,
29 IFLA_CAIF_LOOPBACK,
30 __IFLA_CAIF_MAX
31};
32#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
33
34#endif /*IF_CAIF_H_*/
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index 6e5a7f00223d..cc0bb4961669 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -14,6 +14,7 @@
14#ifndef CAN_DEV_H 14#ifndef CAN_DEV_H
15#define CAN_DEV_H 15#define CAN_DEV_H
16 16
17#include <linux/can.h>
17#include <linux/can/netlink.h> 18#include <linux/can/netlink.h>
18#include <linux/can/error.h> 19#include <linux/can/error.h>
19 20
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
new file mode 100644
index 000000000000..72b713ab57e9
--- /dev/null
+++ b/include/linux/can/platform/flexcan.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h
index 1448177d86d5..dba28268e651 100644
--- a/include/linux/can/platform/mcp251x.h
+++ b/include/linux/can/platform/mcp251x.h
@@ -26,8 +26,8 @@
26struct mcp251x_platform_data { 26struct mcp251x_platform_data {
27 unsigned long oscillator_frequency; 27 unsigned long oscillator_frequency;
28 int model; 28 int model;
29#define CAN_MCP251X_MCP2510 0 29#define CAN_MCP251X_MCP2510 0x2510
30#define CAN_MCP251X_MCP2515 1 30#define CAN_MCP251X_MCP2515 0x2515
31 int (*board_specific_setup)(struct spi_device *spi); 31 int (*board_specific_setup)(struct spi_device *spi);
32 int (*transceiver_enable)(int enable); 32 int (*transceiver_enable)(int enable);
33 int (*power_enable) (int enable); 33 int (*power_enable) (int enable);
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
index 01ee2aeb048d..96f8fcc78d78 100644
--- a/include/linux/can/platform/sja1000.h
+++ b/include/linux/can/platform/sja1000.h
@@ -26,7 +26,7 @@
26#define OCR_TX_SHIFT 2 26#define OCR_TX_SHIFT 2
27 27
28struct sja1000_platform_data { 28struct sja1000_platform_data {
29 u32 clock; /* CAN bus oscillator frequency in Hz */ 29 u32 osc_freq; /* CAN bus oscillator frequency in Hz */
30 30
31 u8 ocr; /* output control register */ 31 u8 ocr; /* output control register */
32 u8 cdr; /* clock divider register */ 32 u8 cdr; /* clock divider register */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 39e5ff512fbe..90012b9ddbf3 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -49,9 +49,6 @@ typedef struct __user_cap_data_struct {
49} __user *cap_user_data_t; 49} __user *cap_user_data_t;
50 50
51 51
52#define XATTR_CAPS_SUFFIX "capability"
53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54
55#define VFS_CAP_REVISION_MASK 0xFF000000 52#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_REVISION_SHIFT 24 53#define VFS_CAP_REVISION_SHIFT 24
57#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 8f78073d7caa..ed3e92e41c6e 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -397,7 +397,7 @@ struct cftype {
397 * This callback must be implemented, if you want provide 397 * This callback must be implemented, if you want provide
398 * notification functionality. 398 * notification functionality.
399 */ 399 */
400 int (*unregister_event)(struct cgroup *cgrp, struct cftype *cft, 400 void (*unregister_event)(struct cgroup *cgrp, struct cftype *cft,
401 struct eventfd_ctx *eventfd); 401 struct eventfd_ctx *eventfd);
402}; 402};
403 403
@@ -525,13 +525,21 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(
525 return cgrp->subsys[subsys_id]; 525 return cgrp->subsys[subsys_id];
526} 526}
527 527
528static inline struct cgroup_subsys_state *task_subsys_state( 528/*
529 struct task_struct *task, int subsys_id) 529 * function to get the cgroup_subsys_state which allows for extra
530 * rcu_dereference_check() conditions, such as locks used during the
531 * cgroup_subsys::attach() methods.
532 */
533#define task_subsys_state_check(task, subsys_id, __c) \
534 rcu_dereference_check(task->cgroups->subsys[subsys_id], \
535 rcu_read_lock_held() || \
536 lockdep_is_held(&task->alloc_lock) || \
537 cgroup_lock_is_held() || (__c))
538
539static inline struct cgroup_subsys_state *
540task_subsys_state(struct task_struct *task, int subsys_id)
530{ 541{
531 return rcu_dereference_check(task->cgroups->subsys[subsys_id], 542 return task_subsys_state_check(task, subsys_id, false);
532 rcu_read_lock_held() ||
533 lockdep_is_held(&task->alloc_lock) ||
534 cgroup_lock_is_held());
535} 543}
536 544
537static inline struct cgroup* task_cgroup(struct task_struct *task, 545static inline struct cgroup* task_cgroup(struct task_struct *task,
@@ -570,6 +578,7 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
570void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); 578void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
571int cgroup_scan_tasks(struct cgroup_scanner *scan); 579int cgroup_scan_tasks(struct cgroup_scanner *scan);
572int cgroup_attach_task(struct cgroup *, struct task_struct *); 580int cgroup_attach_task(struct cgroup *, struct task_struct *);
581int cgroup_attach_task_current_cg(struct task_struct *);
573 582
574/* 583/*
575 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works 584 * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works
@@ -626,6 +635,12 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
626 return -EINVAL; 635 return -EINVAL;
627} 636}
628 637
638/* No cgroups - nothing to do */
639static inline int cgroup_attach_task_current_cg(struct task_struct *t)
640{
641 return 0;
642}
643
629#endif /* !CONFIG_CGROUPS */ 644#endif /* !CONFIG_CGROUPS */
630 645
631#endif /* _LINUX_CGROUP_H */ 646#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 4bca8b60cdf7..c37b21ad5a3b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -273,7 +273,6 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
273} 273}
274 274
275 275
276/* used to install a new clocksource */
277extern int clocksource_register(struct clocksource*); 276extern int clocksource_register(struct clocksource*);
278extern void clocksource_unregister(struct clocksource*); 277extern void clocksource_unregister(struct clocksource*);
279extern void clocksource_touch_watchdog(void); 278extern void clocksource_touch_watchdog(void);
@@ -287,6 +286,35 @@ extern void clocksource_mark_unstable(struct clocksource *cs);
287extern void 286extern void
288clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 287clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
289 288
289/*
290 * Don't call __clocksource_register_scale directly, use
291 * clocksource_register_hz/khz
292 */
293extern int
294__clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq);
295extern void
296__clocksource_updatefreq_scale(struct clocksource *cs, u32 scale, u32 freq);
297
298static inline int clocksource_register_hz(struct clocksource *cs, u32 hz)
299{
300 return __clocksource_register_scale(cs, 1, hz);
301}
302
303static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)
304{
305 return __clocksource_register_scale(cs, 1000, khz);
306}
307
308static inline void __clocksource_updatefreq_hz(struct clocksource *cs, u32 hz)
309{
310 __clocksource_updatefreq_scale(cs, 1, hz);
311}
312
313static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
314{
315 __clocksource_updatefreq_scale(cs, 1000, khz);
316}
317
290static inline void 318static inline void
291clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec) 319clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
292{ 320{
@@ -296,11 +324,13 @@ clocksource_calc_mult_shift(struct clocksource *cs, u32 freq, u32 minsec)
296 324
297#ifdef CONFIG_GENERIC_TIME_VSYSCALL 325#ifdef CONFIG_GENERIC_TIME_VSYSCALL
298extern void 326extern void
299update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult); 327update_vsyscall(struct timespec *ts, struct timespec *wtm,
328 struct clocksource *c, u32 mult);
300extern void update_vsyscall_tz(void); 329extern void update_vsyscall_tz(void);
301#else 330#else
302static inline void 331static inline void
303update_vsyscall(struct timespec *ts, struct clocksource *c, u32 mult) 332update_vsyscall(struct timespec *ts, struct timespec *wtm,
333 struct clocksource *c, u32 mult)
304{ 334{
305} 335}
306 336
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 8859e2ede9fe..284b520934a0 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -86,9 +86,9 @@ struct upc_req {
86 wait_queue_head_t uc_sleep; /* process' wait queue */ 86 wait_queue_head_t uc_sleep; /* process' wait queue */
87}; 87};
88 88
89#define REQ_ASYNC 0x1 89#define CODA_REQ_ASYNC 0x1
90#define REQ_READ 0x2 90#define CODA_REQ_READ 0x2
91#define REQ_WRITE 0x4 91#define CODA_REQ_WRITE 0x4
92#define REQ_ABORT 0x8 92#define CODA_REQ_ABORT 0x8
93 93
94#endif 94#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
new file mode 100644
index 000000000000..5ac51552d908
--- /dev/null
+++ b/include/linux/compaction.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_COMPACTION_H
2#define _LINUX_COMPACTION_H
3
4/* Return values for compact_zone() and try_to_compact_pages() */
5/* compaction didn't start as it was not possible or direct reclaim was more suitable */
6#define COMPACT_SKIPPED 0
7/* compaction should continue to another pageblock */
8#define COMPACT_CONTINUE 1
9/* direct compaction partially compacted a zone and there are suitable pages */
10#define COMPACT_PARTIAL 2
11/* The full zone was compacted */
12#define COMPACT_COMPLETE 3
13
14#ifdef CONFIG_COMPACTION
15extern int sysctl_compact_memory;
16extern int sysctl_compaction_handler(struct ctl_table *table, int write,
17 void __user *buffer, size_t *length, loff_t *ppos);
18extern int sysctl_extfrag_threshold;
19extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
20 void __user *buffer, size_t *length, loff_t *ppos);
21
22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask);
25
26/* Do not skip compaction more than 64 times */
27#define COMPACT_MAX_DEFER_SHIFT 6
28
29/*
30 * Compaction is deferred when compaction fails to result in a page
31 * allocation success. 1 << compact_defer_limit compactions are skipped up
32 * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT
33 */
34static inline void defer_compaction(struct zone *zone)
35{
36 zone->compact_considered = 0;
37 zone->compact_defer_shift++;
38
39 if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT)
40 zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT;
41}
42
43/* Returns true if compaction should be skipped this time */
44static inline bool compaction_deferred(struct zone *zone)
45{
46 unsigned long defer_limit = 1UL << zone->compact_defer_shift;
47
48 /* Avoid possible overflow */
49 if (++zone->compact_considered > defer_limit)
50 zone->compact_considered = defer_limit;
51
52 return zone->compact_considered < (1UL << zone->compact_defer_shift);
53}
54
55#else
56static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
57 int order, gfp_t gfp_mask, nodemask_t *nodemask)
58{
59 return COMPACT_CONTINUE;
60}
61
62static inline void defer_compaction(struct zone *zone)
63{
64}
65
66static inline bool compaction_deferred(struct zone *zone)
67{
68 return 1;
69}
70
71#endif /* CONFIG_COMPACTION */
72
73#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
74extern int compaction_register_node(struct node *node);
75extern void compaction_unregister_node(struct node *node);
76
77#else
78
79static inline int compaction_register_node(struct node *node)
80{
81 return 0;
82}
83
84static inline void compaction_unregister_node(struct node *node)
85{
86}
87#endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
88
89#endif /* _LINUX_COMPACTION_H */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 717c691ecd8e..168f7daa7bde 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -356,5 +356,9 @@ asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename, 356asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
357 int flags, int mode); 357 int flags, int mode);
358 358
359extern ssize_t compat_rw_copy_check_uvector(int type,
360 const struct compat_iovec __user *uvector, unsigned long nr_segs,
361 unsigned long fast_segs, struct iovec *fast_pointer,
362 struct iovec **ret_pointer);
359#endif /* CONFIG_COMPAT */ 363#endif /* CONFIG_COMPAT */
360#endif /* _LINUX_COMPAT_H */ 364#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 73dcf804bc94..16508bcddacc 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -35,8 +35,7 @@
35 (typeof(ptr)) (__ptr + (off)); }) 35 (typeof(ptr)) (__ptr + (off)); })
36 36
37/* &a[0] degrades to a pointer: a different type from an array */ 37/* &a[0] degrades to a pointer: a different type from an array */
38#define __must_be_array(a) \ 38#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
39 BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0])))
40 39
41/* 40/*
42 * Force always-inline if the user requests it so via the .config, 41 * Force always-inline if the user requests it so via the .config,
@@ -58,8 +57,12 @@
58 * naked functions because then mcount is called without stack and frame pointer 57 * naked functions because then mcount is called without stack and frame pointer
59 * being set up and there is no chance to restore the lr register to the value 58 * being set up and there is no chance to restore the lr register to the value
60 * before mcount was called. 59 * before mcount was called.
60 *
61 * The asm() bodies of naked functions often depend on standard calling conventions,
62 * therefore they must be noinline and noclone. GCC 4.[56] currently fail to enforce
63 * this, so we must do so ourselves. See GCC PR44290.
61 */ 64 */
62#define __naked __attribute__((naked)) notrace 65#define __naked __attribute__((naked)) noinline __noclone notrace
63 66
64#define __noreturn __attribute__((noreturn)) 67#define __noreturn __attribute__((noreturn))
65 68
@@ -85,3 +88,7 @@
85#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) 88#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
86#define gcc_header(x) _gcc_header(x) 89#define gcc_header(x) _gcc_header(x)
87#include gcc_header(__GNUC__) 90#include gcc_header(__GNUC__)
91
92#if !defined(__noclone)
93#define __noclone /* not needed */
94#endif
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 94dea3ffbfa1..fcfa5b9a4317 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -48,6 +48,10 @@
48 * unreleased. Really, we need to have autoconf for the kernel. 48 * unreleased. Really, we need to have autoconf for the kernel.
49 */ 49 */
50#define unreachable() __builtin_unreachable() 50#define unreachable() __builtin_unreachable()
51
52/* Mark a function definition as prohibited from being cloned. */
53#define __noclone __attribute__((__noclone__))
54
51#endif 55#endif
52 56
53#endif 57#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index a5a472b10746..c1a62c56a660 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -16,6 +16,7 @@
16# define __release(x) __context__(x,-1) 16# define __release(x) __context__(x,-1)
17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0) 17# define __cond_lock(x,c) ((c) ? ({ __acquire(x); 1; }) : 0)
18# define __percpu __attribute__((noderef, address_space(3))) 18# define __percpu __attribute__((noderef, address_space(3)))
19# define __rcu
19extern void __chk_user_ptr(const volatile void __user *); 20extern void __chk_user_ptr(const volatile void __user *);
20extern void __chk_io_ptr(const volatile void __iomem *); 21extern void __chk_io_ptr(const volatile void __iomem *);
21#else 22#else
@@ -34,6 +35,7 @@ extern void __chk_io_ptr(const volatile void __iomem *);
34# define __release(x) (void)0 35# define __release(x) (void)0
35# define __cond_lock(x,c) (c) 36# define __cond_lock(x,c) (c)
36# define __percpu 37# define __percpu
38# define __rcu
37#endif 39#endif
38 40
39#ifdef __KERNEL__ 41#ifdef __KERNEL__
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 4a6b604ef7e4..51e3145196f6 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -83,6 +83,8 @@ extern unsigned long wait_for_completion_timeout(struct completion *x,
83 unsigned long timeout); 83 unsigned long timeout);
84extern unsigned long wait_for_completion_interruptible_timeout( 84extern unsigned long wait_for_completion_interruptible_timeout(
85 struct completion *x, unsigned long timeout); 85 struct completion *x, unsigned long timeout);
86extern unsigned long wait_for_completion_killable_timeout(
87 struct completion *x, unsigned long timeout);
86extern bool try_wait_for_completion(struct completion *x); 88extern bool try_wait_for_completion(struct completion *x);
87extern bool completion_done(struct completion *x); 89extern bool completion_done(struct completion *x);
88 90
diff --git a/include/linux/console.h b/include/linux/console.h
index dcca5339ceb3..95cf6f08a59d 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -55,6 +55,16 @@ struct consw {
55 void (*con_invert_region)(struct vc_data *, u16 *, int); 55 void (*con_invert_region)(struct vc_data *, u16 *, int);
56 u16 *(*con_screen_pos)(struct vc_data *, int); 56 u16 *(*con_screen_pos)(struct vc_data *, int);
57 unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *); 57 unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *);
58 /*
59 * Prepare the console for the debugger. This includes, but is not
60 * limited to, unblanking the console, loading an appropriate
61 * palette, and allowing debugger generated output.
62 */
63 int (*con_debug_enter)(struct vc_data *);
64 /*
65 * Restore the console to its pre-debug state as closely as possible.
66 */
67 int (*con_debug_leave)(struct vc_data *);
58}; 68};
59 69
60extern const struct consw *conswitchp; 70extern const struct consw *conswitchp;
@@ -69,6 +79,14 @@ int register_con_driver(const struct consw *csw, int first, int last);
69int unregister_con_driver(const struct consw *csw); 79int unregister_con_driver(const struct consw *csw);
70int take_over_console(const struct consw *sw, int first, int last, int deflt); 80int take_over_console(const struct consw *sw, int first, int last, int deflt);
71void give_up_console(const struct consw *sw); 81void give_up_console(const struct consw *sw);
82#ifdef CONFIG_HW_CONSOLE
83int con_debug_enter(struct vc_data *vc);
84int con_debug_leave(void);
85#else
86#define con_debug_enter(vc) (0)
87#define con_debug_leave() (0)
88#endif
89
72/* scroll */ 90/* scroll */
73#define SM_UP (1) 91#define SM_UP (1)
74#define SM_DOWN (2) 92#define SM_DOWN (2)
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 38fe59dc89ae..7f0c32908568 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -21,6 +21,8 @@ struct vt_struct;
21#define NPAR 16 21#define NPAR 16
22 22
23struct vc_data { 23struct vc_data {
24 struct tty_port port; /* Upper level data */
25
24 unsigned short vc_num; /* Console number */ 26 unsigned short vc_num; /* Console number */
25 unsigned int vc_cols; /* [#] Console size */ 27 unsigned int vc_cols; /* [#] Console size */
26 unsigned int vc_rows; 28 unsigned int vc_rows;
@@ -56,7 +58,6 @@ struct vc_data {
56 /* VT terminal data */ 58 /* VT terminal data */
57 unsigned int vc_state; /* Escape sequence parser state */ 59 unsigned int vc_state; /* Escape sequence parser state */
58 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ 60 unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */
59 struct tty_struct *vc_tty; /* TTY we are attached to */
60 /* data for manual vt switching */ 61 /* data for manual vt switching */
61 struct vt_mode vt_mode; 62 struct vt_mode vt_mode;
62 struct pid *vt_pid; 63 struct pid *vt_pid;
@@ -105,6 +106,7 @@ struct vc_data {
105 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ 106 struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */
106 unsigned long vc_uni_pagedir; 107 unsigned long vc_uni_pagedir;
107 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ 108 unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */
109 bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */
108 /* additional information is in vt_kern.h */ 110 /* additional information is in vt_kern.h */
109}; 111};
110 112
diff --git a/include/linux/cper.h b/include/linux/cper.h
new file mode 100644
index 000000000000..4b38f905b705
--- /dev/null
+++ b/include/linux/cper.h
@@ -0,0 +1,314 @@
1/*
2 * UEFI Common Platform Error Record
3 *
4 * Copyright (C) 2010, Intel Corp.
5 * Author: Huang Ying <ying.huang@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef LINUX_CPER_H
22#define LINUX_CPER_H
23
24#include <linux/uuid.h>
25
26/* CPER record signature and the size */
27#define CPER_SIG_RECORD "CPER"
28#define CPER_SIG_SIZE 4
29/* Used in signature_end field in struct cper_record_header */
30#define CPER_SIG_END 0xffffffff
31
32/*
33 * CPER record header revision, used in revision field in struct
34 * cper_record_header
35 */
36#define CPER_RECORD_REV 0x0100
37
38/*
39 * Severity difinition for error_severity in struct cper_record_header
40 * and section_severity in struct cper_section_descriptor
41 */
42#define CPER_SER_RECOVERABLE 0x0
43#define CPER_SER_FATAL 0x1
44#define CPER_SER_CORRECTED 0x2
45#define CPER_SER_INFORMATIONAL 0x3
46
47/*
48 * Validation bits difinition for validation_bits in struct
49 * cper_record_header. If set, corresponding fields in struct
50 * cper_record_header contain valid information.
51 *
52 * corresponds platform_id
53 */
54#define CPER_VALID_PLATFORM_ID 0x0001
55/* corresponds timestamp */
56#define CPER_VALID_TIMESTAMP 0x0002
57/* corresponds partition_id */
58#define CPER_VALID_PARTITION_ID 0x0004
59
60/*
61 * Notification type used to generate error record, used in
62 * notification_type in struct cper_record_header
63 *
64 * Corrected Machine Check
65 */
66#define CPER_NOTIFY_CMC \
67 UUID_LE(0x2DCE8BB1, 0xBDD7, 0x450e, 0xB9, 0xAD, 0x9C, 0xF4, \
68 0xEB, 0xD4, 0xF8, 0x90)
69/* Corrected Platform Error */
70#define CPER_NOTIFY_CPE \
71 UUID_LE(0x4E292F96, 0xD843, 0x4a55, 0xA8, 0xC2, 0xD4, 0x81, \
72 0xF2, 0x7E, 0xBE, 0xEE)
73/* Machine Check Exception */
74#define CPER_NOTIFY_MCE \
75 UUID_LE(0xE8F56FFE, 0x919C, 0x4cc5, 0xBA, 0x88, 0x65, 0xAB, \
76 0xE1, 0x49, 0x13, 0xBB)
77/* PCI Express Error */
78#define CPER_NOTIFY_PCIE \
79 UUID_LE(0xCF93C01F, 0x1A16, 0x4dfc, 0xB8, 0xBC, 0x9C, 0x4D, \
80 0xAF, 0x67, 0xC1, 0x04)
81/* INIT Record (for IPF) */
82#define CPER_NOTIFY_INIT \
83 UUID_LE(0xCC5263E8, 0x9308, 0x454a, 0x89, 0xD0, 0x34, 0x0B, \
84 0xD3, 0x9B, 0xC9, 0x8E)
85/* Non-Maskable Interrupt */
86#define CPER_NOTIFY_NMI \
87 UUID_LE(0x5BAD89FF, 0xB7E6, 0x42c9, 0x81, 0x4A, 0xCF, 0x24, \
88 0x85, 0xD6, 0xE9, 0x8A)
89/* BOOT Error Record */
90#define CPER_NOTIFY_BOOT \
91 UUID_LE(0x3D61A466, 0xAB40, 0x409a, 0xA6, 0x98, 0xF3, 0x62, \
92 0xD4, 0x64, 0xB3, 0x8F)
93/* DMA Remapping Error */
94#define CPER_NOTIFY_DMAR \
95 UUID_LE(0x667DD791, 0xC6B3, 0x4c27, 0x8A, 0x6B, 0x0F, 0x8E, \
96 0x72, 0x2D, 0xEB, 0x41)
97
98/*
99 * Flags bits definitions for flags in struct cper_record_header
100 * If set, the error has been recovered
101 */
102#define CPER_HW_ERROR_FLAGS_RECOVERED 0x1
103/* If set, the error is for previous boot */
104#define CPER_HW_ERROR_FLAGS_PREVERR 0x2
105/* If set, the error is injected for testing */
106#define CPER_HW_ERROR_FLAGS_SIMULATED 0x4
107
108/*
109 * CPER section header revision, used in revision field in struct
110 * cper_section_descriptor
111 */
112#define CPER_SEC_REV 0x0100
113
114/*
115 * Validation bits difinition for validation_bits in struct
116 * cper_section_descriptor. If set, corresponding fields in struct
117 * cper_section_descriptor contain valid information.
118 *
119 * corresponds fru_id
120 */
121#define CPER_SEC_VALID_FRU_ID 0x1
122/* corresponds fru_text */
123#define CPER_SEC_VALID_FRU_TEXT 0x2
124
125/*
126 * Flags bits definitions for flags in struct cper_section_descriptor
127 *
128 * If set, the section is associated with the error condition
129 * directly, and should be focused on
130 */
131#define CPER_SEC_PRIMARY 0x0001
132/*
133 * If set, the error was not contained within the processor or memory
134 * hierarchy and the error may have propagated to persistent storage
135 * or network
136 */
137#define CPER_SEC_CONTAINMENT_WARNING 0x0002
138/* If set, the component must be re-initialized or re-enabled prior to use */
139#define CPER_SEC_RESET 0x0004
140/* If set, Linux may choose to discontinue use of the resource */
141#define CPER_SEC_ERROR_THRESHOLD_EXCEEDED 0x0008
142/*
143 * If set, resource could not be queried for error information due to
144 * conflicts with other system software or resources. Some fields of
145 * the section will be invalid
146 */
147#define CPER_SEC_RESOURCE_NOT_ACCESSIBLE 0x0010
148/*
149 * If set, action has been taken to ensure error containment (such as
150 * poisoning data), but the error has not been fully corrected and the
151 * data has not been consumed. Linux may choose to take further
152 * corrective action before the data is consumed
153 */
154#define CPER_SEC_LATENT_ERROR 0x0020
155
156/*
157 * Section type definitions, used in section_type field in struct
158 * cper_section_descriptor
159 *
160 * Processor Generic
161 */
162#define CPER_SEC_PROC_GENERIC \
163 UUID_LE(0x9876CCAD, 0x47B4, 0x4bdb, 0xB6, 0x5E, 0x16, 0xF1, \
164 0x93, 0xC4, 0xF3, 0xDB)
165/* Processor Specific: X86/X86_64 */
166#define CPER_SEC_PROC_IA \
167 UUID_LE(0xDC3EA0B0, 0xA144, 0x4797, 0xB9, 0x5B, 0x53, 0xFA, \
168 0x24, 0x2B, 0x6E, 0x1D)
169/* Processor Specific: IA64 */
170#define CPER_SEC_PROC_IPF \
171 UUID_LE(0xE429FAF1, 0x3CB7, 0x11D4, 0x0B, 0xCA, 0x07, 0x00, \
172 0x80, 0xC7, 0x3C, 0x88, 0x81)
173/* Platform Memory */
174#define CPER_SEC_PLATFORM_MEM \
175 UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \
176 0xED, 0x7C, 0x83, 0xB1)
177#define CPER_SEC_PCIE \
178 UUID_LE(0xD995E954, 0xBBC1, 0x430F, 0xAD, 0x91, 0xB4, 0x4D, \
179 0xCB, 0x3C, 0x6F, 0x35)
180/* Firmware Error Record Reference */
181#define CPER_SEC_FW_ERR_REC_REF \
182 UUID_LE(0x81212A96, 0x09ED, 0x4996, 0x94, 0x71, 0x8D, 0x72, \
183 0x9C, 0x8E, 0x69, 0xED)
184/* PCI/PCI-X Bus */
185#define CPER_SEC_PCI_X_BUS \
186 UUID_LE(0xC5753963, 0x3B84, 0x4095, 0xBF, 0x78, 0xED, 0xDA, \
187 0xD3, 0xF9, 0xC9, 0xDD)
188/* PCI Component/Device */
189#define CPER_SEC_PCI_DEV \
190 UUID_LE(0xEB5E4685, 0xCA66, 0x4769, 0xB6, 0xA2, 0x26, 0x06, \
191 0x8B, 0x00, 0x13, 0x26)
192#define CPER_SEC_DMAR_GENERIC \
193 UUID_LE(0x5B51FEF7, 0xC79D, 0x4434, 0x8F, 0x1B, 0xAA, 0x62, \
194 0xDE, 0x3E, 0x2C, 0x64)
195/* Intel VT for Directed I/O specific DMAr */
196#define CPER_SEC_DMAR_VT \
197 UUID_LE(0x71761D37, 0x32B2, 0x45cd, 0xA7, 0xD0, 0xB0, 0xFE, \
198 0xDD, 0x93, 0xE8, 0xCF)
199/* IOMMU specific DMAr */
200#define CPER_SEC_DMAR_IOMMU \
201 UUID_LE(0x036F84E1, 0x7F37, 0x428c, 0xA7, 0x9E, 0x57, 0x5F, \
202 0xDF, 0xAA, 0x84, 0xEC)
203
204/*
205 * All tables and structs must be byte-packed to match CPER
206 * specification, since the tables are provided by the system BIOS
207 */
208#pragma pack(1)
209
210struct cper_record_header {
211 char signature[CPER_SIG_SIZE]; /* must be CPER_SIG_RECORD */
212 __u16 revision; /* must be CPER_RECORD_REV */
213 __u32 signature_end; /* must be CPER_SIG_END */
214 __u16 section_count;
215 __u32 error_severity;
216 __u32 validation_bits;
217 __u32 record_length;
218 __u64 timestamp;
219 uuid_le platform_id;
220 uuid_le partition_id;
221 uuid_le creator_id;
222 uuid_le notification_type;
223 __u64 record_id;
224 __u32 flags;
225 __u64 persistence_information;
226 __u8 reserved[12]; /* must be zero */
227};
228
229struct cper_section_descriptor {
230 __u32 section_offset; /* Offset in bytes of the
231 * section body from the base
232 * of the record header */
233 __u32 section_length;
234 __u16 revision; /* must be CPER_RECORD_REV */
235 __u8 validation_bits;
236 __u8 reserved; /* must be zero */
237 __u32 flags;
238 uuid_le section_type;
239 uuid_le fru_id;
240 __u32 section_severity;
241 __u8 fru_text[20];
242};
243
244/* Generic Processor Error Section */
245struct cper_sec_proc_generic {
246 __u64 validation_bits;
247 __u8 proc_type;
248 __u8 proc_isa;
249 __u8 proc_error_type;
250 __u8 operation;
251 __u8 flags;
252 __u8 level;
253 __u16 reserved;
254 __u64 cpu_version;
255 char cpu_brand[128];
256 __u64 proc_id;
257 __u64 target_addr;
258 __u64 requestor_id;
259 __u64 responder_id;
260 __u64 ip;
261};
262
263/* IA32/X64 Processor Error Section */
264struct cper_sec_proc_ia {
265 __u64 validation_bits;
266 __u8 lapic_id;
267 __u8 cpuid[48];
268};
269
270/* IA32/X64 Processor Error Infomation Structure */
271struct cper_ia_err_info {
272 uuid_le err_type;
273 __u64 validation_bits;
274 __u64 check_info;
275 __u64 target_id;
276 __u64 requestor_id;
277 __u64 responder_id;
278 __u64 ip;
279};
280
281/* IA32/X64 Processor Context Information Structure */
282struct cper_ia_proc_ctx {
283 __u16 reg_ctx_type;
284 __u16 reg_arr_size;
285 __u32 msr_addr;
286 __u64 mm_reg_addr;
287};
288
289/* Memory Error Section */
290struct cper_sec_mem_err {
291 __u64 validation_bits;
292 __u64 error_status;
293 __u64 physical_addr;
294 __u64 physical_addr_mask;
295 __u16 node;
296 __u16 card;
297 __u16 module;
298 __u16 bank;
299 __u16 device;
300 __u16 row;
301 __u16 column;
302 __u16 bit_pos;
303 __u64 requestor_id;
304 __u64 responder_id;
305 __u64 target_id;
306 __u8 error_type;
307};
308
309/* Reset to default packing */
310#pragma pack()
311
312u64 cper_next_record_id(void);
313
314#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index e287863ac053..4823af64e9db 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -48,6 +48,33 @@ extern ssize_t arch_cpu_release(const char *, size_t);
48#endif 48#endif
49struct notifier_block; 49struct notifier_block;
50 50
51/*
52 * CPU notifier priorities.
53 */
54enum {
55 /*
56 * SCHED_ACTIVE marks a cpu which is coming up active during
57 * CPU_ONLINE and CPU_DOWN_FAILED and must be the first
58 * notifier. CPUSET_ACTIVE adjusts cpuset according to
59 * cpu_active mask right after SCHED_ACTIVE. During
60 * CPU_DOWN_PREPARE, SCHED_INACTIVE and CPUSET_INACTIVE are
61 * ordered in the similar way.
62 *
63 * This ordering guarantees consistent cpu_active mask and
64 * migration behavior to all cpu notifiers.
65 */
66 CPU_PRI_SCHED_ACTIVE = INT_MAX,
67 CPU_PRI_CPUSET_ACTIVE = INT_MAX - 1,
68 CPU_PRI_SCHED_INACTIVE = INT_MIN + 1,
69 CPU_PRI_CPUSET_INACTIVE = INT_MIN,
70
71 /* migration should happen before other stuff but after perf */
72 CPU_PRI_PERF = 20,
73 CPU_PRI_MIGRATION = 10,
74 /* prepare workqueues for other notifiers */
75 CPU_PRI_WORKQUEUE = 5,
76};
77
51#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
52/* Need to know about CPUs going up/down? */ 79/* Need to know about CPUs going up/down? */
53#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) 80#if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE)
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4de02b10007f..c3e9de8321c6 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -196,11 +196,6 @@ extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
196int cpufreq_register_governor(struct cpufreq_governor *governor); 196int cpufreq_register_governor(struct cpufreq_governor *governor);
197void cpufreq_unregister_governor(struct cpufreq_governor *governor); 197void cpufreq_unregister_governor(struct cpufreq_governor *governor);
198 198
199int lock_policy_rwsem_read(int cpu);
200int lock_policy_rwsem_write(int cpu);
201void unlock_policy_rwsem_read(int cpu);
202void unlock_policy_rwsem_write(int cpu);
203
204 199
205/********************************************************************* 200/*********************************************************************
206 * CPUFREQ DRIVER INTERFACE * 201 * CPUFREQ DRIVER INTERFACE *
@@ -278,6 +273,27 @@ struct freq_attr {
278 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count); 273 ssize_t (*store)(struct cpufreq_policy *, const char *, size_t count);
279}; 274};
280 275
276#define cpufreq_freq_attr_ro(_name) \
277static struct freq_attr _name = \
278__ATTR(_name, 0444, show_##_name, NULL)
279
280#define cpufreq_freq_attr_ro_perm(_name, _perm) \
281static struct freq_attr _name = \
282__ATTR(_name, _perm, show_##_name, NULL)
283
284#define cpufreq_freq_attr_ro_old(_name) \
285static struct freq_attr _name##_old = \
286__ATTR(_name, 0444, show_##_name##_old, NULL)
287
288#define cpufreq_freq_attr_rw(_name) \
289static struct freq_attr _name = \
290__ATTR(_name, 0644, show_##_name, store_##_name)
291
292#define cpufreq_freq_attr_rw_old(_name) \
293static struct freq_attr _name##_old = \
294__ATTR(_name, 0644, show_##_name##_old, store_##_name##_old)
295
296
281struct global_attr { 297struct global_attr {
282 struct attribute attr; 298 struct attribute attr;
283 ssize_t (*show)(struct kobject *kobj, 299 ssize_t (*show)(struct kobject *kobj,
@@ -286,6 +302,15 @@ struct global_attr {
286 const char *c, size_t count); 302 const char *c, size_t count);
287}; 303};
288 304
305#define define_one_global_ro(_name) \
306static struct global_attr _name = \
307__ATTR(_name, 0444, show_##_name, NULL)
308
309#define define_one_global_rw(_name) \
310static struct global_attr _name = \
311__ATTR(_name, 0644, show_##_name, store_##_name)
312
313
289/********************************************************************* 314/*********************************************************************
290 * CPUFREQ 2.6. INTERFACE * 315 * CPUFREQ 2.6. INTERFACE *
291 *********************************************************************/ 316 *********************************************************************/
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index dcf77fa826b5..36ca9721a0c2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -52,6 +52,7 @@ struct cpuidle_state {
52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */ 52#define CPUIDLE_FLAG_SHALLOW (0x20) /* low latency, minimal savings */
53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */ 53#define CPUIDLE_FLAG_BALANCED (0x40) /* medium latency, moderate savings */
54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */ 54#define CPUIDLE_FLAG_DEEP (0x80) /* high latency, large savings */
55#define CPUIDLE_FLAG_IGNORE (0x100) /* ignore during this idle period */
55 56
56#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) 57#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
57 58
@@ -84,6 +85,7 @@ struct cpuidle_state_kobj {
84struct cpuidle_device { 85struct cpuidle_device {
85 unsigned int registered:1; 86 unsigned int registered:1;
86 unsigned int enabled:1; 87 unsigned int enabled:1;
88 unsigned int power_specified:1;
87 unsigned int cpu; 89 unsigned int cpu;
88 90
89 int last_residency; 91 int last_residency;
@@ -97,6 +99,8 @@ struct cpuidle_device {
97 struct completion kobj_unregister; 99 struct completion kobj_unregister;
98 void *governor_data; 100 void *governor_data;
99 struct cpuidle_state *safe_state; 101 struct cpuidle_state *safe_state;
102
103 int (*prepare) (struct cpuidle_device *dev);
100}; 104};
101 105
102DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 106DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
@@ -125,6 +129,7 @@ struct cpuidle_driver {
125#ifdef CONFIG_CPU_IDLE 129#ifdef CONFIG_CPU_IDLE
126 130
127extern int cpuidle_register_driver(struct cpuidle_driver *drv); 131extern int cpuidle_register_driver(struct cpuidle_driver *drv);
132struct cpuidle_driver *cpuidle_get_driver(void);
128extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); 133extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
129extern int cpuidle_register_device(struct cpuidle_device *dev); 134extern int cpuidle_register_device(struct cpuidle_device *dev);
130extern void cpuidle_unregister_device(struct cpuidle_device *dev); 135extern void cpuidle_unregister_device(struct cpuidle_device *dev);
@@ -137,16 +142,17 @@ extern void cpuidle_disable_device(struct cpuidle_device *dev);
137#else 142#else
138 143
139static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 144static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
140{return 0;} 145{return -ENODEV; }
146static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
141static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } 147static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
142static inline int cpuidle_register_device(struct cpuidle_device *dev) 148static inline int cpuidle_register_device(struct cpuidle_device *dev)
143{return 0;} 149{return -ENODEV; }
144static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } 150static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
145 151
146static inline void cpuidle_pause_and_lock(void) { } 152static inline void cpuidle_pause_and_lock(void) { }
147static inline void cpuidle_resume_and_unlock(void) { } 153static inline void cpuidle_resume_and_unlock(void) { }
148static inline int cpuidle_enable_device(struct cpuidle_device *dev) 154static inline int cpuidle_enable_device(struct cpuidle_device *dev)
149{return 0;} 155{return -ENODEV; }
150static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 156static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
151 157
152#endif 158#endif
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index a5740fc4d04b..f20eb8f16025 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,9 +20,9 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20 20
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_update_active_cpus(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, 25extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
25 struct cpumask *mask);
26extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
27#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
28void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
@@ -69,10 +69,8 @@ struct seq_file;
69extern void cpuset_task_status_allowed(struct seq_file *m, 69extern void cpuset_task_status_allowed(struct seq_file *m,
70 struct task_struct *task); 70 struct task_struct *task);
71 71
72extern void cpuset_lock(void);
73extern void cpuset_unlock(void);
74
75extern int cpuset_mem_spread_node(void); 72extern int cpuset_mem_spread_node(void);
73extern int cpuset_slab_spread_node(void);
76 74
77static inline int cpuset_do_page_mem_spread(void) 75static inline int cpuset_do_page_mem_spread(void)
78{ 76{
@@ -90,9 +88,44 @@ extern void rebuild_sched_domains(void);
90 88
91extern void cpuset_print_task_mems_allowed(struct task_struct *p); 89extern void cpuset_print_task_mems_allowed(struct task_struct *p);
92 90
91/*
92 * reading current mems_allowed and mempolicy in the fastpath must protected
93 * by get_mems_allowed()
94 */
95static inline void get_mems_allowed(void)
96{
97 current->mems_allowed_change_disable++;
98
99 /*
100 * ensure that reading mems_allowed and mempolicy happens after the
101 * update of ->mems_allowed_change_disable.
102 *
103 * the write-side task finds ->mems_allowed_change_disable is not 0,
104 * and knows the read-side task is reading mems_allowed or mempolicy,
105 * so it will clear old bits lazily.
106 */
107 smp_mb();
108}
109
110static inline void put_mems_allowed(void)
111{
112 /*
113 * ensure that reading mems_allowed and mempolicy before reducing
114 * mems_allowed_change_disable.
115 *
116 * the write-side task will know that the read-side task is still
117 * reading mems_allowed or mempolicy, don't clears old bits in the
118 * nodemask.
119 */
120 smp_mb();
121 --ACCESS_ONCE(current->mems_allowed_change_disable);
122}
123
93static inline void set_mems_allowed(nodemask_t nodemask) 124static inline void set_mems_allowed(nodemask_t nodemask)
94{ 125{
126 task_lock(current);
95 current->mems_allowed = nodemask; 127 current->mems_allowed = nodemask;
128 task_unlock(current);
96} 129}
97 130
98#else /* !CONFIG_CPUSETS */ 131#else /* !CONFIG_CPUSETS */
@@ -100,15 +133,21 @@ static inline void set_mems_allowed(nodemask_t nodemask)
100static inline int cpuset_init(void) { return 0; } 133static inline int cpuset_init(void) { return 0; }
101static inline void cpuset_init_smp(void) {} 134static inline void cpuset_init_smp(void) {}
102 135
136static inline void cpuset_update_active_cpus(void)
137{
138 partition_sched_domains(1, NULL, NULL);
139}
140
103static inline void cpuset_cpus_allowed(struct task_struct *p, 141static inline void cpuset_cpus_allowed(struct task_struct *p,
104 struct cpumask *mask) 142 struct cpumask *mask)
105{ 143{
106 cpumask_copy(mask, cpu_possible_mask); 144 cpumask_copy(mask, cpu_possible_mask);
107} 145}
108static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 146
109 struct cpumask *mask) 147static inline int cpuset_cpus_allowed_fallback(struct task_struct *p)
110{ 148{
111 cpumask_copy(mask, cpu_possible_mask); 149 cpumask_copy(&p->cpus_allowed, cpu_possible_mask);
150 return cpumask_any(cpu_active_mask);
112} 151}
113 152
114static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 153static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
@@ -157,14 +196,16 @@ static inline void cpuset_task_status_allowed(struct seq_file *m,
157{ 196{
158} 197}
159 198
160static inline void cpuset_lock(void) {}
161static inline void cpuset_unlock(void) {}
162
163static inline int cpuset_mem_spread_node(void) 199static inline int cpuset_mem_spread_node(void)
164{ 200{
165 return 0; 201 return 0;
166} 202}
167 203
204static inline int cpuset_slab_spread_node(void)
205{
206 return 0;
207}
208
168static inline int cpuset_do_page_mem_spread(void) 209static inline int cpuset_do_page_mem_spread(void)
169{ 210{
170 return 0; 211 return 0;
@@ -193,6 +234,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
193{ 234{
194} 235}
195 236
237static inline void get_mems_allowed(void)
238{
239}
240
241static inline void put_mems_allowed(void)
242{
243}
244
196#endif /* !CONFIG_CPUSETS */ 245#endif /* !CONFIG_CPUSETS */
197 246
198#endif /* _LINUX_CPUSET_H */ 247#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 52507c3e1387..4d2c39573f36 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -153,10 +153,10 @@ struct cred {
153extern void __put_cred(struct cred *); 153extern void __put_cred(struct cred *);
154extern void exit_creds(struct task_struct *); 154extern void exit_creds(struct task_struct *);
155extern int copy_creds(struct task_struct *, unsigned long); 155extern int copy_creds(struct task_struct *, unsigned long);
156extern const struct cred *get_task_cred(struct task_struct *);
156extern struct cred *cred_alloc_blank(void); 157extern struct cred *cred_alloc_blank(void);
157extern struct cred *prepare_creds(void); 158extern struct cred *prepare_creds(void);
158extern struct cred *prepare_exec_creds(void); 159extern struct cred *prepare_exec_creds(void);
159extern struct cred *prepare_usermodehelper_creds(void);
160extern int commit_creds(struct cred *); 160extern int commit_creds(struct cred *);
161extern void abort_creds(struct cred *); 161extern void abort_creds(struct cred *);
162extern const struct cred *override_creds(const struct cred *); 162extern const struct cred *override_creds(const struct cred *);
@@ -274,33 +274,18 @@ static inline void put_cred(const struct cred *_cred)
274 * @task: The task to query 274 * @task: The task to query
275 * 275 *
276 * Access the objective credentials of a task. The caller must hold the RCU 276 * Access the objective credentials of a task. The caller must hold the RCU
277 * readlock. 277 * readlock or the task must be dead and unable to change its own credentials.
278 * 278 *
279 * The caller must make sure task doesn't go away, either by holding a ref on 279 * The result of this function should not be passed directly to get_cred();
280 * task or by holding tasklist_lock to prevent it from being unlinked. 280 * rather get_task_cred() should be used instead.
281 */ 281 */
282#define __task_cred(task) \ 282#define __task_cred(task) \
283 ((const struct cred *)(rcu_dereference_check((task)->real_cred, rcu_read_lock_held() || lockdep_tasklist_lock_is_held()))) 283 ({ \
284 284 const struct task_struct *__t = (task); \
285/** 285 rcu_dereference_check(__t->real_cred, \
286 * get_task_cred - Get another task's objective credentials 286 rcu_read_lock_held() || \
287 * @task: The task to query 287 task_is_dead(__t)); \
288 * 288 })
289 * Get the objective credentials of a task, pinning them so that they can't go
290 * away. Accessing a task's credentials directly is not permitted.
291 *
292 * The caller must make sure task doesn't go away, either by holding a ref on
293 * task or by holding tasklist_lock to prevent it from being unlinked.
294 */
295#define get_task_cred(task) \
296({ \
297 struct cred *__cred; \
298 rcu_read_lock(); \
299 __cred = (struct cred *) __task_cred((task)); \
300 get_cred(__cred); \
301 rcu_read_unlock(); \
302 __cred; \
303})
304 289
305/** 290/**
306 * get_current_cred - Get the current task's subjective credentials 291 * get_current_cred - Get the current task's subjective credentials
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 24d2e30f1b46..a6a7a1c83f54 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -99,13 +99,7 @@
99 * as arm where pointers are 32-bit aligned but there are data types such as 99 * as arm where pointers are 32-bit aligned but there are data types such as
100 * u64 which require 64-bit alignment. 100 * u64 which require 64-bit alignment.
101 */ 101 */
102#if defined(ARCH_KMALLOC_MINALIGN)
103#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN 102#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
104#elif defined(ARCH_SLAB_MINALIGN)
105#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
106#else
107#define CRYPTO_MINALIGN __alignof__(unsigned long long)
108#endif
109 103
110#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) 104#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
111 105
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 30b93b2a01a4..d23be0386e2d 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -186,6 +186,8 @@ d_iput: no no no yes
186 186
187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */ 187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */
188 188
189#define DCACHE_CANT_MOUNT 0x0100
190
189extern spinlock_t dcache_lock; 191extern spinlock_t dcache_lock;
190extern seqlock_t rename_lock; 192extern seqlock_t rename_lock;
191 193
@@ -313,6 +315,7 @@ extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...);
313 315
314extern char *__d_path(const struct path *path, struct path *root, char *, int); 316extern char *__d_path(const struct path *path, struct path *root, char *, int);
315extern char *d_path(const struct path *, char *, int); 317extern char *d_path(const struct path *, char *, int);
318extern char *__dentry_path(struct dentry *, char *, int);
316extern char *dentry_path(struct dentry *, char *, int); 319extern char *dentry_path(struct dentry *, char *, int);
317 320
318/* Allocation counts.. */ 321/* Allocation counts.. */
@@ -358,6 +361,18 @@ static inline int d_unlinked(struct dentry *dentry)
358 return d_unhashed(dentry) && !IS_ROOT(dentry); 361 return d_unhashed(dentry) && !IS_ROOT(dentry);
359} 362}
360 363
364static inline int cant_mount(struct dentry *dentry)
365{
366 return (dentry->d_flags & DCACHE_CANT_MOUNT);
367}
368
369static inline void dont_mount(struct dentry *dentry)
370{
371 spin_lock(&dentry->d_lock);
372 dentry->d_flags |= DCACHE_CANT_MOUNT;
373 spin_unlock(&dentry->d_lock);
374}
375
361static inline struct dentry *dget_parent(struct dentry *dentry) 376static inline struct dentry *dget_parent(struct dentry *dentry)
362{ 377{
363 struct dentry *ret; 378 struct dentry *ret;
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index b7cdbb4373df..8723491f7dfd 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -22,8 +22,6 @@
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25#define DCB_PROTO_VERSION 1
26
27struct dcbmsg { 25struct dcbmsg {
28 __u8 dcb_family; 26 __u8 dcb_family;
29 __u8 cmd; 27 __u8 cmd;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index fc1b930f246c..e7d9b20ddc5b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -63,6 +63,8 @@ struct dentry *debugfs_create_x16(const char *name, mode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, mode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_x64(const char *name, mode_t mode,
67 struct dentry *parent, u64 *value);
66struct dentry *debugfs_create_size_t(const char *name, mode_t mode, 68struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
67 struct dentry *parent, size_t *value); 69 struct dentry *parent, size_t *value);
68struct dentry *debugfs_create_bool(const char *name, mode_t mode, 70struct dentry *debugfs_create_bool(const char *name, mode_t mode,
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 8c243aaa86a7..597692f1fc8d 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -20,12 +20,14 @@ struct debug_obj_descr;
20 * struct debug_obj - representaion of an tracked object 20 * struct debug_obj - representaion of an tracked object
21 * @node: hlist node to link the object into the tracker list 21 * @node: hlist node to link the object into the tracker list
22 * @state: tracked object state 22 * @state: tracked object state
23 * @astate: current active state
23 * @object: pointer to the real object 24 * @object: pointer to the real object
24 * @descr: pointer to an object type specific debug description structure 25 * @descr: pointer to an object type specific debug description structure
25 */ 26 */
26struct debug_obj { 27struct debug_obj {
27 struct hlist_node node; 28 struct hlist_node node;
28 enum debug_obj_state state; 29 enum debug_obj_state state;
30 unsigned int astate;
29 void *object; 31 void *object;
30 struct debug_obj_descr *descr; 32 struct debug_obj_descr *descr;
31}; 33};
@@ -60,6 +62,15 @@ extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
60extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr); 62extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
61extern void debug_object_free (void *addr, struct debug_obj_descr *descr); 63extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
62 64
65/*
66 * Active state:
67 * - Set at 0 upon initialization.
68 * - Must return to 0 before deactivation.
69 */
70extern void
71debug_object_active_state(void *addr, struct debug_obj_descr *descr,
72 unsigned int expect, unsigned int next);
73
63extern void debug_objects_early_init(void); 74extern void debug_objects_early_init(void);
64extern void debug_objects_mem_init(void); 75extern void debug_objects_mem_init(void);
65#else 76#else
diff --git a/include/linux/delay.h b/include/linux/delay.h
index fd832c6d419e..a6ecb34cf547 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -45,6 +45,7 @@ extern unsigned long lpj_fine;
45void calibrate_delay(void); 45void calibrate_delay(void);
46void msleep(unsigned int msecs); 46void msleep(unsigned int msecs);
47unsigned long msleep_interruptible(unsigned int msecs); 47unsigned long msleep_interruptible(unsigned int msecs);
48void usleep_range(unsigned long min, unsigned long max);
48 49
49static inline void ssleep(unsigned int seconds) 50static inline void ssleep(unsigned int seconds)
50{ 51{
diff --git a/include/linux/device.h b/include/linux/device.h
index 182192892d45..516fecacf27b 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -22,7 +22,6 @@
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/semaphore.h>
26#include <asm/atomic.h> 25#include <asm/atomic.h>
27#include <asm/device.h> 26#include <asm/device.h>
28 27
@@ -34,6 +33,7 @@ struct class;
34struct class_private; 33struct class_private;
35struct bus_type; 34struct bus_type;
36struct bus_type_private; 35struct bus_type_private;
36struct device_node;
37 37
38struct bus_attribute { 38struct bus_attribute {
39 struct attribute attr; 39 struct attribute attr;
@@ -84,9 +84,8 @@ struct device *bus_find_device_by_name(struct bus_type *bus,
84 struct device *start, 84 struct device *start,
85 const char *name); 85 const char *name);
86 86
87int __must_check bus_for_each_drv(struct bus_type *bus, 87int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
88 struct device_driver *start, void *data, 88 void *data, int (*fn)(struct device_driver *, void *));
89 int (*fn)(struct device_driver *, void *));
90 89
91void bus_sort_breadthfirst(struct bus_type *bus, 90void bus_sort_breadthfirst(struct bus_type *bus,
92 int (*compare)(const struct device *a, 91 int (*compare)(const struct device *a,
@@ -110,10 +109,12 @@ extern int bus_unregister_notifier(struct bus_type *bus,
110 */ 109 */
111#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ 110#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
112#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */ 111#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
113#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 112#define BUS_NOTIFY_BIND_DRIVER 0x00000003 /* driver about to be
114#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 113 bound */
114#define BUS_NOTIFY_BOUND_DRIVER 0x00000004 /* driver bound to device */
115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000005 /* driver about to be
115 unbound */ 116 unbound */
116#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound 117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000006 /* driver is unbound
117 from the device */ 118 from the device */
118 119
119extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
@@ -128,6 +129,10 @@ struct device_driver {
128 129
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 130 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
130 131
132#if defined(CONFIG_OF)
133 const struct of_device_id *of_match_table;
134#endif
135
131 int (*probe) (struct device *dev); 136 int (*probe) (struct device *dev);
132 int (*remove) (struct device *dev); 137 int (*remove) (struct device *dev);
133 void (*shutdown) (struct device *dev); 138 void (*shutdown) (struct device *dev);
@@ -203,6 +208,9 @@ struct class {
203 int (*suspend)(struct device *dev, pm_message_t state); 208 int (*suspend)(struct device *dev, pm_message_t state);
204 int (*resume)(struct device *dev); 209 int (*resume)(struct device *dev);
205 210
211 const struct kobj_ns_type_operations *ns_type;
212 const void *(*namespace)(struct device *dev);
213
206 const struct dev_pm_ops *pm; 214 const struct dev_pm_ops *pm;
207 215
208 struct class_private *p; 216 struct class_private *p;
@@ -404,7 +412,7 @@ struct device {
404 const char *init_name; /* initial name of the device */ 412 const char *init_name; /* initial name of the device */
405 struct device_type *type; 413 struct device_type *type;
406 414
407 struct semaphore sem; /* semaphore to synchronize calls to 415 struct mutex mutex; /* mutex to synchronize calls to
408 * its driver. 416 * its driver.
409 */ 417 */
410 418
@@ -433,6 +441,9 @@ struct device {
433 override */ 441 override */
434 /* arch specific additions */ 442 /* arch specific additions */
435 struct dev_archdata archdata; 443 struct dev_archdata archdata;
444#ifdef CONFIG_OF
445 struct device_node *of_node;
446#endif
436 447
437 dev_t devt; /* dev_t, creates the sysfs "dev" */ 448 dev_t devt; /* dev_t, creates the sysfs "dev" */
438 449
@@ -451,6 +462,10 @@ struct device {
451 462
452static inline const char *dev_name(const struct device *dev) 463static inline const char *dev_name(const struct device *dev)
453{ 464{
465 /* Use the init name until the kobject becomes available */
466 if (dev->init_name)
467 return dev->init_name;
468
454 return kobject_name(&dev->kobj); 469 return kobject_name(&dev->kobj);
455} 470}
456 471
@@ -510,17 +525,17 @@ static inline bool device_async_suspend_enabled(struct device *dev)
510 525
511static inline void device_lock(struct device *dev) 526static inline void device_lock(struct device *dev)
512{ 527{
513 down(&dev->sem); 528 mutex_lock(&dev->mutex);
514} 529}
515 530
516static inline int device_trylock(struct device *dev) 531static inline int device_trylock(struct device *dev)
517{ 532{
518 return down_trylock(&dev->sem); 533 return mutex_trylock(&dev->mutex);
519} 534}
520 535
521static inline void device_unlock(struct device *dev) 536static inline void device_unlock(struct device *dev)
522{ 537{
523 up(&dev->sem); 538 mutex_unlock(&dev->mutex);
524} 539}
525 540
526void driver_init(void); 541void driver_init(void);
@@ -537,7 +552,7 @@ extern int device_for_each_child(struct device *dev, void *data,
537 int (*fn)(struct device *dev, void *data)); 552 int (*fn)(struct device *dev, void *data));
538extern struct device *device_find_child(struct device *dev, void *data, 553extern struct device *device_find_child(struct device *dev, void *data,
539 int (*match)(struct device *dev, void *data)); 554 int (*match)(struct device *dev, void *data));
540extern int device_rename(struct device *dev, char *new_name); 555extern int device_rename(struct device *dev, const char *new_name);
541extern int device_move(struct device *dev, struct device *new_parent, 556extern int device_move(struct device *dev, struct device *new_parent,
542 enum dpm_order dpm_order); 557 enum dpm_order dpm_order);
543extern const char *device_get_devnode(struct device *dev, 558extern const char *device_get_devnode(struct device *dev,
@@ -624,43 +639,103 @@ extern void sysdev_shutdown(void);
624 639
625/* debugging and troubleshooting/diagnostic helpers. */ 640/* debugging and troubleshooting/diagnostic helpers. */
626extern const char *dev_driver_string(const struct device *dev); 641extern const char *dev_driver_string(const struct device *dev);
627#define dev_printk(level, dev, format, arg...) \ 642
628 printk(level "%s %s: " format , dev_driver_string(dev) , \ 643
629 dev_name(dev) , ## arg) 644#ifdef CONFIG_PRINTK
630 645
631#define dev_emerg(dev, format, arg...) \ 646extern int dev_printk(const char *level, const struct device *dev,
632 dev_printk(KERN_EMERG , dev , format , ## arg) 647 const char *fmt, ...)
633#define dev_alert(dev, format, arg...) \ 648 __attribute__ ((format (printf, 3, 4)));
634 dev_printk(KERN_ALERT , dev , format , ## arg) 649extern int dev_emerg(const struct device *dev, const char *fmt, ...)
635#define dev_crit(dev, format, arg...) \ 650 __attribute__ ((format (printf, 2, 3)));
636 dev_printk(KERN_CRIT , dev , format , ## arg) 651extern int dev_alert(const struct device *dev, const char *fmt, ...)
637#define dev_err(dev, format, arg...) \ 652 __attribute__ ((format (printf, 2, 3)));
638 dev_printk(KERN_ERR , dev , format , ## arg) 653extern int dev_crit(const struct device *dev, const char *fmt, ...)
639#define dev_warn(dev, format, arg...) \ 654 __attribute__ ((format (printf, 2, 3)));
640 dev_printk(KERN_WARNING , dev , format , ## arg) 655extern int dev_err(const struct device *dev, const char *fmt, ...)
641#define dev_notice(dev, format, arg...) \ 656 __attribute__ ((format (printf, 2, 3)));
642 dev_printk(KERN_NOTICE , dev , format , ## arg) 657extern int dev_warn(const struct device *dev, const char *fmt, ...)
643#define dev_info(dev, format, arg...) \ 658 __attribute__ ((format (printf, 2, 3)));
644 dev_printk(KERN_INFO , dev , format , ## arg) 659extern int dev_notice(const struct device *dev, const char *fmt, ...)
660 __attribute__ ((format (printf, 2, 3)));
661extern int _dev_info(const struct device *dev, const char *fmt, ...)
662 __attribute__ ((format (printf, 2, 3)));
663
664#else
665
666static inline int dev_printk(const char *level, const struct device *dev,
667 const char *fmt, ...)
668 __attribute__ ((format (printf, 3, 4)));
669static inline int dev_printk(const char *level, const struct device *dev,
670 const char *fmt, ...)
671 { return 0; }
672
673static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
674 __attribute__ ((format (printf, 2, 3)));
675static inline int dev_emerg(const struct device *dev, const char *fmt, ...)
676 { return 0; }
677static inline int dev_crit(const struct device *dev, const char *fmt, ...)
678 __attribute__ ((format (printf, 2, 3)));
679static inline int dev_crit(const struct device *dev, const char *fmt, ...)
680 { return 0; }
681static inline int dev_alert(const struct device *dev, const char *fmt, ...)
682 __attribute__ ((format (printf, 2, 3)));
683static inline int dev_alert(const struct device *dev, const char *fmt, ...)
684 { return 0; }
685static inline int dev_err(const struct device *dev, const char *fmt, ...)
686 __attribute__ ((format (printf, 2, 3)));
687static inline int dev_err(const struct device *dev, const char *fmt, ...)
688 { return 0; }
689static inline int dev_warn(const struct device *dev, const char *fmt, ...)
690 __attribute__ ((format (printf, 2, 3)));
691static inline int dev_warn(const struct device *dev, const char *fmt, ...)
692 { return 0; }
693static inline int dev_notice(const struct device *dev, const char *fmt, ...)
694 __attribute__ ((format (printf, 2, 3)));
695static inline int dev_notice(const struct device *dev, const char *fmt, ...)
696 { return 0; }
697static inline int _dev_info(const struct device *dev, const char *fmt, ...)
698 __attribute__ ((format (printf, 2, 3)));
699static inline int _dev_info(const struct device *dev, const char *fmt, ...)
700 { return 0; }
701
702#endif
703
704/*
705 * Stupid hackaround for existing uses of non-printk uses dev_info
706 *
707 * Note that the definition of dev_info below is actually _dev_info
708 * and a macro is used to avoid redefining dev_info
709 */
710
711#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
645 712
646#if defined(DEBUG) 713#if defined(DEBUG)
647#define dev_dbg(dev, format, arg...) \ 714#define dev_dbg(dev, format, arg...) \
648 dev_printk(KERN_DEBUG , dev , format , ## arg) 715 dev_printk(KERN_DEBUG, dev, format, ##arg)
649#elif defined(CONFIG_DYNAMIC_DEBUG) 716#elif defined(CONFIG_DYNAMIC_DEBUG)
650#define dev_dbg(dev, format, ...) do { \ 717#define dev_dbg(dev, format, ...) \
718do { \
651 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 719 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
652 } while (0) 720} while (0)
653#else 721#else
654#define dev_dbg(dev, format, arg...) \ 722#define dev_dbg(dev, format, arg...) \
655 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 723({ \
724 if (0) \
725 dev_printk(KERN_DEBUG, dev, format, ##arg); \
726 0; \
727})
656#endif 728#endif
657 729
658#ifdef VERBOSE_DEBUG 730#ifdef VERBOSE_DEBUG
659#define dev_vdbg dev_dbg 731#define dev_vdbg dev_dbg
660#else 732#else
661 733#define dev_vdbg(dev, format, arg...) \
662#define dev_vdbg(dev, format, arg...) \ 734({ \
663 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 735 if (0) \
736 dev_printk(KERN_DEBUG, dev, format, ##arg); \
737 0; \
738})
664#endif 739#endif
665 740
666/* 741/*
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ca32ed78b057..e0670a512056 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -40,16 +40,6 @@ struct dma_map_ops {
40 void (*sync_single_for_device)(struct device *dev, 40 void (*sync_single_for_device)(struct device *dev,
41 dma_addr_t dma_handle, size_t size, 41 dma_addr_t dma_handle, size_t size,
42 enum dma_data_direction dir); 42 enum dma_data_direction dir);
43 void (*sync_single_range_for_cpu)(struct device *dev,
44 dma_addr_t dma_handle,
45 unsigned long offset,
46 size_t size,
47 enum dma_data_direction dir);
48 void (*sync_single_range_for_device)(struct device *dev,
49 dma_addr_t dma_handle,
50 unsigned long offset,
51 size_t size,
52 enum dma_data_direction dir);
53 void (*sync_sg_for_cpu)(struct device *dev, 43 void (*sync_sg_for_cpu)(struct device *dev,
54 struct scatterlist *sg, int nents, 44 struct scatterlist *sg, int nents,
55 enum dma_data_direction dir); 45 enum dma_data_direction dir);
@@ -105,21 +95,6 @@ static inline int is_device_dma_capable(struct device *dev)
105#include <asm-generic/dma-mapping-broken.h> 95#include <asm-generic/dma-mapping-broken.h>
106#endif 96#endif
107 97
108/* for backwards compatibility, removed soon */
109static inline void __deprecated dma_sync_single(struct device *dev,
110 dma_addr_t addr, size_t size,
111 enum dma_data_direction dir)
112{
113 dma_sync_single_for_cpu(dev, addr, size, dir);
114}
115
116static inline void __deprecated dma_sync_sg(struct device *dev,
117 struct scatterlist *sg, int nelems,
118 enum dma_data_direction dir)
119{
120 dma_sync_sg_for_cpu(dev, sg, nelems, dir);
121}
122
123static inline u64 dma_get_mask(struct device *dev) 98static inline u64 dma_get_mask(struct device *dev)
124{ 99{
125 if (dev && dev->dma_mask && *dev->dma_mask) 100 if (dev && dev->dma_mask && *dev->dma_mask)
@@ -167,6 +142,14 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask)
167 return -EIO; 142 return -EIO;
168} 143}
169 144
145static inline int dma_get_cache_alignment(void)
146{
147#ifdef ARCH_DMA_MINALIGN
148 return ARCH_DMA_MINALIGN;
149#endif
150 return 1;
151}
152
170/* flags for the coherent memory api */ 153/* flags for the coherent memory api */
171#define DMA_MEMORY_MAP 0x01 154#define DMA_MEMORY_MAP 0x01
172#define DMA_MEMORY_IO 0x02 155#define DMA_MEMORY_IO 0x02
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 20ea12c86fd0..c61d4ca27bcc 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -40,11 +40,13 @@ typedef s32 dma_cookie_t;
40 * enum dma_status - DMA transaction status 40 * enum dma_status - DMA transaction status
41 * @DMA_SUCCESS: transaction completed successfully 41 * @DMA_SUCCESS: transaction completed successfully
42 * @DMA_IN_PROGRESS: transaction not yet processed 42 * @DMA_IN_PROGRESS: transaction not yet processed
43 * @DMA_PAUSED: transaction is paused
43 * @DMA_ERROR: transaction failed 44 * @DMA_ERROR: transaction failed
44 */ 45 */
45enum dma_status { 46enum dma_status {
46 DMA_SUCCESS, 47 DMA_SUCCESS,
47 DMA_IN_PROGRESS, 48 DMA_IN_PROGRESS,
49 DMA_PAUSED,
48 DMA_ERROR, 50 DMA_ERROR,
49}; 51};
50 52
@@ -107,6 +109,25 @@ enum dma_ctrl_flags {
107}; 109};
108 110
109/** 111/**
112 * enum dma_ctrl_cmd - DMA operations that can optionally be exercised
113 * on a running channel.
114 * @DMA_TERMINATE_ALL: terminate all ongoing transfers
115 * @DMA_PAUSE: pause ongoing transfers
116 * @DMA_RESUME: resume paused transfer
117 * @DMA_SLAVE_CONFIG: this command is only implemented by DMA controllers
118 * that need to runtime reconfigure the slave channels (as opposed to passing
119 * configuration data in statically from the platform). An additional
120 * argument of struct dma_slave_config must be passed in with this
121 * command.
122 */
123enum dma_ctrl_cmd {
124 DMA_TERMINATE_ALL,
125 DMA_PAUSE,
126 DMA_RESUME,
127 DMA_SLAVE_CONFIG,
128};
129
130/**
110 * enum sum_check_bits - bit position of pq_check_flags 131 * enum sum_check_bits - bit position of pq_check_flags
111 */ 132 */
112enum sum_check_bits { 133enum sum_check_bits {
@@ -184,6 +205,71 @@ struct dma_chan_dev {
184 atomic_t *idr_ref; 205 atomic_t *idr_ref;
185}; 206};
186 207
208/**
209 * enum dma_slave_buswidth - defines bus with of the DMA slave
210 * device, source or target buses
211 */
212enum dma_slave_buswidth {
213 DMA_SLAVE_BUSWIDTH_UNDEFINED = 0,
214 DMA_SLAVE_BUSWIDTH_1_BYTE = 1,
215 DMA_SLAVE_BUSWIDTH_2_BYTES = 2,
216 DMA_SLAVE_BUSWIDTH_4_BYTES = 4,
217 DMA_SLAVE_BUSWIDTH_8_BYTES = 8,
218};
219
220/**
221 * struct dma_slave_config - dma slave channel runtime config
222 * @direction: whether the data shall go in or out on this slave
223 * channel, right now. DMA_TO_DEVICE and DMA_FROM_DEVICE are
224 * legal values, DMA_BIDIRECTIONAL is not acceptable since we
225 * need to differentiate source and target addresses.
226 * @src_addr: this is the physical address where DMA slave data
227 * should be read (RX), if the source is memory this argument is
228 * ignored.
229 * @dst_addr: this is the physical address where DMA slave data
230 * should be written (TX), if the source is memory this argument
231 * is ignored.
232 * @src_addr_width: this is the width in bytes of the source (RX)
233 * register where DMA data shall be read. If the source
234 * is memory this may be ignored depending on architecture.
235 * Legal values: 1, 2, 4, 8.
236 * @dst_addr_width: same as src_addr_width but for destination
237 * target (TX) mutatis mutandis.
238 * @src_maxburst: the maximum number of words (note: words, as in
239 * units of the src_addr_width member, not bytes) that can be sent
240 * in one burst to the device. Typically something like half the
241 * FIFO depth on I/O peripherals so you don't overflow it. This
242 * may or may not be applicable on memory sources.
243 * @dst_maxburst: same as src_maxburst but for destination target
244 * mutatis mutandis.
245 *
246 * This struct is passed in as configuration data to a DMA engine
247 * in order to set up a certain channel for DMA transport at runtime.
248 * The DMA device/engine has to provide support for an additional
249 * command in the channel config interface, DMA_SLAVE_CONFIG
250 * and this struct will then be passed in as an argument to the
251 * DMA engine device_control() function.
252 *
253 * The rationale for adding configuration information to this struct
254 * is as follows: if it is likely that most DMA slave controllers in
255 * the world will support the configuration option, then make it
256 * generic. If not: if it is fixed so that it be sent in static from
257 * the platform data, then prefer to do that. Else, if it is neither
258 * fixed at runtime, nor generic enough (such as bus mastership on
259 * some CPU family and whatnot) then create a custom slave config
260 * struct and pass that, then make this config a member of that
261 * struct, if applicable.
262 */
263struct dma_slave_config {
264 enum dma_data_direction direction;
265 dma_addr_t src_addr;
266 dma_addr_t dst_addr;
267 enum dma_slave_buswidth src_addr_width;
268 enum dma_slave_buswidth dst_addr_width;
269 u32 src_maxburst;
270 u32 dst_maxburst;
271};
272
187static inline const char *dma_chan_name(struct dma_chan *chan) 273static inline const char *dma_chan_name(struct dma_chan *chan)
188{ 274{
189 return dev_name(&chan->dev->device); 275 return dev_name(&chan->dev->device);
@@ -230,9 +316,84 @@ struct dma_async_tx_descriptor {
230 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx); 316 dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *tx);
231 dma_async_tx_callback callback; 317 dma_async_tx_callback callback;
232 void *callback_param; 318 void *callback_param;
319#ifndef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
233 struct dma_async_tx_descriptor *next; 320 struct dma_async_tx_descriptor *next;
234 struct dma_async_tx_descriptor *parent; 321 struct dma_async_tx_descriptor *parent;
235 spinlock_t lock; 322 spinlock_t lock;
323#endif
324};
325
326#ifdef CONFIG_ASYNC_TX_DISABLE_CHANNEL_SWITCH
327static inline void txd_lock(struct dma_async_tx_descriptor *txd)
328{
329}
330static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
331{
332}
333static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
334{
335 BUG();
336}
337static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
338{
339}
340static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
341{
342}
343static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
344{
345 return NULL;
346}
347static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
348{
349 return NULL;
350}
351
352#else
353static inline void txd_lock(struct dma_async_tx_descriptor *txd)
354{
355 spin_lock_bh(&txd->lock);
356}
357static inline void txd_unlock(struct dma_async_tx_descriptor *txd)
358{
359 spin_unlock_bh(&txd->lock);
360}
361static inline void txd_chain(struct dma_async_tx_descriptor *txd, struct dma_async_tx_descriptor *next)
362{
363 txd->next = next;
364 next->parent = txd;
365}
366static inline void txd_clear_parent(struct dma_async_tx_descriptor *txd)
367{
368 txd->parent = NULL;
369}
370static inline void txd_clear_next(struct dma_async_tx_descriptor *txd)
371{
372 txd->next = NULL;
373}
374static inline struct dma_async_tx_descriptor *txd_parent(struct dma_async_tx_descriptor *txd)
375{
376 return txd->parent;
377}
378static inline struct dma_async_tx_descriptor *txd_next(struct dma_async_tx_descriptor *txd)
379{
380 return txd->next;
381}
382#endif
383
384/**
385 * struct dma_tx_state - filled in to report the status of
386 * a transfer.
387 * @last: last completed DMA cookie
388 * @used: last issued DMA cookie (i.e. the one in progress)
389 * @residue: the remaining number of bytes left to transmit
390 * on the selected transfer for states DMA_IN_PROGRESS and
391 * DMA_PAUSED if this is implemented in the driver, else 0
392 */
393struct dma_tx_state {
394 dma_cookie_t last;
395 dma_cookie_t used;
396 u32 residue;
236}; 397};
237 398
238/** 399/**
@@ -261,8 +422,12 @@ struct dma_async_tx_descriptor {
261 * @device_prep_dma_memset: prepares a memset operation 422 * @device_prep_dma_memset: prepares a memset operation
262 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation 423 * @device_prep_dma_interrupt: prepares an end of chain interrupt operation
263 * @device_prep_slave_sg: prepares a slave dma operation 424 * @device_prep_slave_sg: prepares a slave dma operation
264 * @device_terminate_all: terminate all pending operations 425 * @device_control: manipulate all pending operations on a channel, returns
265 * @device_is_tx_complete: poll for transaction completion 426 * zero or error code
427 * @device_tx_status: poll for transaction completion, the optional
428 * txstate parameter can be supplied with a pointer to get a
429 * struct with auxilary transfer status information, otherwise the call
430 * will just return a simple status code
266 * @device_issue_pending: push pending transactions to hardware 431 * @device_issue_pending: push pending transactions to hardware
267 */ 432 */
268struct dma_device { 433struct dma_device {
@@ -313,11 +478,12 @@ struct dma_device {
313 struct dma_chan *chan, struct scatterlist *sgl, 478 struct dma_chan *chan, struct scatterlist *sgl,
314 unsigned int sg_len, enum dma_data_direction direction, 479 unsigned int sg_len, enum dma_data_direction direction,
315 unsigned long flags); 480 unsigned long flags);
316 void (*device_terminate_all)(struct dma_chan *chan); 481 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
482 unsigned long arg);
317 483
318 enum dma_status (*device_is_tx_complete)(struct dma_chan *chan, 484 enum dma_status (*device_tx_status)(struct dma_chan *chan,
319 dma_cookie_t cookie, dma_cookie_t *last, 485 dma_cookie_t cookie,
320 dma_cookie_t *used); 486 struct dma_tx_state *txstate);
321 void (*device_issue_pending)(struct dma_chan *chan); 487 void (*device_issue_pending)(struct dma_chan *chan);
322}; 488};
323 489
@@ -558,7 +724,15 @@ static inline void dma_async_issue_pending(struct dma_chan *chan)
558static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan, 724static inline enum dma_status dma_async_is_tx_complete(struct dma_chan *chan,
559 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used) 725 dma_cookie_t cookie, dma_cookie_t *last, dma_cookie_t *used)
560{ 726{
561 return chan->device->device_is_tx_complete(chan, cookie, last, used); 727 struct dma_tx_state state;
728 enum dma_status status;
729
730 status = chan->device->device_tx_status(chan, cookie, &state);
731 if (last)
732 *last = state.last;
733 if (used)
734 *used = state.used;
735 return status;
562} 736}
563 737
564#define dma_async_memcpy_complete(chan, cookie, last, used)\ 738#define dma_async_memcpy_complete(chan, cookie, last, used)\
@@ -586,6 +760,16 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
586 return DMA_IN_PROGRESS; 760 return DMA_IN_PROGRESS;
587} 761}
588 762
763static inline void
764dma_set_tx_state(struct dma_tx_state *st, dma_cookie_t last, dma_cookie_t used, u32 residue)
765{
766 if (st) {
767 st->last = last;
768 st->used = used;
769 st->residue = residue;
770 }
771}
772
589enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 773enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
590#ifdef CONFIG_DMA_ENGINE 774#ifdef CONFIG_DMA_ENGINE
591enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 775enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index a8a3e1ac281d..90e087f8d951 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -20,6 +20,7 @@ enum dmi_device_type {
20 DMI_DEV_TYPE_SAS, 20 DMI_DEV_TYPE_SAS,
21 DMI_DEV_TYPE_IPMI = -1, 21 DMI_DEV_TYPE_IPMI = -1,
22 DMI_DEV_TYPE_OEM_STRING = -2, 22 DMI_DEV_TYPE_OEM_STRING = -2,
23 DMI_DEV_TYPE_DEV_ONBOARD = -3,
23}; 24};
24 25
25struct dmi_header { 26struct dmi_header {
@@ -37,6 +38,14 @@ struct dmi_device {
37 38
38#ifdef CONFIG_DMI 39#ifdef CONFIG_DMI
39 40
41struct dmi_dev_onboard {
42 struct dmi_device dev;
43 int instance;
44 int segment;
45 int bus;
46 int devfn;
47};
48
40extern int dmi_check_system(const struct dmi_system_id *list); 49extern int dmi_check_system(const struct dmi_system_id *list);
41const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list); 50const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list);
42extern const char * dmi_get_system_info(int field); 51extern const char * dmi_get_system_info(int field);
diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h
index ecc06286226d..3290555a52ee 100644
--- a/include/linux/dnotify.h
+++ b/include/linux/dnotify.h
@@ -28,6 +28,7 @@ struct dnotify_struct {
28 FS_CREATE | FS_DN_RENAME |\ 28 FS_CREATE | FS_DN_RENAME |\
29 FS_MOVED_FROM | FS_MOVED_TO) 29 FS_MOVED_FROM | FS_MOVED_TO)
30 30
31extern int dir_notify_enable;
31extern void dnotify_flush(struct file *, fl_owner_t); 32extern void dnotify_flush(struct file *, fl_owner_t);
32extern int fcntl_dirnotify(int, struct file *, unsigned long); 33extern int fcntl_dirnotify(int, struct file *, unsigned long);
33 34
diff --git a/include/linux/dns_resolver.h b/include/linux/dns_resolver.h
new file mode 100644
index 000000000000..cc92268af89a
--- /dev/null
+++ b/include/linux/dns_resolver.h
@@ -0,0 +1,34 @@
1/*
2 * DNS Resolver upcall management for CIFS DFS and AFS
3 * Handles host name to IP address resolution and DNS query for AFSDB RR.
4 *
5 * Copyright (c) International Business Machines Corp., 2008
6 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Wang Lei (wang840925@gmail.com)
8 *
9 * This library is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#ifndef _LINUX_DNS_RESOLVER_H
25#define _LINUX_DNS_RESOLVER_H
26
27#ifdef __KERNEL__
28
29extern int dns_query(const char *type, const char *name, size_t namelen,
30 const char *options, char **_result, time_t *_expiry);
31
32#endif /* KERNEL */
33
34#endif /* _LINUX_DNS_RESOLVER_H */
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index 527504c11c5e..86552807aed9 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -49,7 +49,7 @@
49#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ 49#define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */
50typedef struct fs_disk_quota { 50typedef struct fs_disk_quota {
51 __s8 d_version; /* version of this structure */ 51 __s8 d_version; /* version of this structure */
52 __s8 d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ 52 __s8 d_flags; /* FS_{USER,PROJ,GROUP}_QUOTA */
53 __u16 d_fieldmask; /* field specifier */ 53 __u16 d_fieldmask; /* field specifier */
54 __u32 d_id; /* user, project, or group ID */ 54 __u32 d_id; /* user, project, or group ID */
55 __u64 d_blk_hardlimit;/* absolute limit on disk blks */ 55 __u64 d_blk_hardlimit;/* absolute limit on disk blks */
@@ -110,18 +110,27 @@ typedef struct fs_disk_quota {
110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS) 110#define FS_DQ_WARNS_MASK (FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
111 111
112/* 112/*
113 * Various flags related to quotactl(2). Only relevant to XFS filesystems. 113 * Accounting values. These can only be set for filesystem with
114 * non-transactional quotas that require quotacheck(8) in userspace.
114 */ 115 */
115#define XFS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */ 116#define FS_DQ_BCOUNT (1<<12)
116#define XFS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */ 117#define FS_DQ_ICOUNT (1<<13)
117#define XFS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */ 118#define FS_DQ_RTBCOUNT (1<<14)
118#define XFS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */ 119#define FS_DQ_ACCT_MASK (FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
119#define XFS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */
120#define XFS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */
121 120
122#define XFS_USER_QUOTA (1<<0) /* user quota type */ 121/*
123#define XFS_PROJ_QUOTA (1<<1) /* project quota type */ 122 * Various flags related to quotactl(2).
124#define XFS_GROUP_QUOTA (1<<2) /* group quota type */ 123 */
124#define FS_QUOTA_UDQ_ACCT (1<<0) /* user quota accounting */
125#define FS_QUOTA_UDQ_ENFD (1<<1) /* user quota limits enforcement */
126#define FS_QUOTA_GDQ_ACCT (1<<2) /* group quota accounting */
127#define FS_QUOTA_GDQ_ENFD (1<<3) /* group quota limits enforcement */
128#define FS_QUOTA_PDQ_ACCT (1<<4) /* project quota accounting */
129#define FS_QUOTA_PDQ_ENFD (1<<5) /* project quota limits enforcement */
130
131#define FS_USER_QUOTA (1<<0) /* user quota type */
132#define FS_PROJ_QUOTA (1<<1) /* project quota type */
133#define FS_GROUP_QUOTA (1<<2) /* group quota type */
125 134
126/* 135/*
127 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system. 136 * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
@@ -142,7 +151,7 @@ typedef struct fs_qfilestat {
142 151
143typedef struct fs_quota_stat { 152typedef struct fs_quota_stat {
144 __s8 qs_version; /* version number for future changes */ 153 __s8 qs_version; /* version number for future changes */
145 __u16 qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ 154 __u16 qs_flags; /* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
146 __s8 qs_pad; /* unused */ 155 __s8 qs_pad; /* unused */
147 fs_qfilestat_t qs_uquota; /* user quota storage information */ 156 fs_qfilestat_t qs_uquota; /* user quota storage information */
148 fs_qfilestat_t qs_gquota; /* group quota storage information */ 157 fs_qfilestat_t qs_gquota; /* group quota storage information */
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 4341b1a97a34..479ee3a1d901 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -53,10 +53,10 @@
53 53
54 54
55extern const char *drbd_buildtag(void); 55extern const char *drbd_buildtag(void);
56#define REL_VERSION "8.3.7" 56#define REL_VERSION "8.3.8.1"
57#define API_VERSION 88 57#define API_VERSION 88
58#define PRO_VERSION_MIN 86 58#define PRO_VERSION_MIN 86
59#define PRO_VERSION_MAX 92 59#define PRO_VERSION_MAX 94
60 60
61 61
62enum drbd_io_error_p { 62enum drbd_io_error_p {
@@ -139,6 +139,7 @@ enum drbd_ret_codes {
139 ERR_DATA_NOT_CURRENT = 150, 139 ERR_DATA_NOT_CURRENT = 150,
140 ERR_CONNECTED = 151, /* DRBD 8.3 only */ 140 ERR_CONNECTED = 151, /* DRBD 8.3 only */
141 ERR_PERM = 152, 141 ERR_PERM = 152,
142 ERR_NEED_APV_93 = 153,
142 143
143 /* insert new ones above this line */ 144 /* insert new ones above this line */
144 AFTER_LAST_ERR_CODE 145 AFTER_LAST_ERR_CODE
diff --git a/include/linux/drbd_limits.h b/include/linux/drbd_limits.h
index 51f47a586ad8..440b42e38e89 100644
--- a/include/linux/drbd_limits.h
+++ b/include/linux/drbd_limits.h
@@ -133,5 +133,21 @@
133#define DRBD_MAX_BIO_BVECS_MAX 128 133#define DRBD_MAX_BIO_BVECS_MAX 128
134#define DRBD_MAX_BIO_BVECS_DEF 0 134#define DRBD_MAX_BIO_BVECS_DEF 0
135 135
136#define DRBD_DP_VOLUME_MIN 4
137#define DRBD_DP_VOLUME_MAX 1048576
138#define DRBD_DP_VOLUME_DEF 16384
139
140#define DRBD_DP_INTERVAL_MIN 1
141#define DRBD_DP_INTERVAL_MAX 600
142#define DRBD_DP_INTERVAL_DEF 5
143
144#define DRBD_RS_THROTTLE_TH_MIN 1
145#define DRBD_RS_THROTTLE_TH_MAX 600
146#define DRBD_RS_THROTTLE_TH_DEF 20
147
148#define DRBD_RS_HOLD_OFF_TH_MIN 1
149#define DRBD_RS_HOLD_OFF_TH_MAX 6000
150#define DRBD_RS_HOLD_OFF_TH_DEF 100
151
136#undef RANGE 152#undef RANGE
137#endif 153#endif
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h
index f7431a4ca608..5f042810a56c 100644
--- a/include/linux/drbd_nl.h
+++ b/include/linux/drbd_nl.h
@@ -71,12 +71,18 @@ NL_PACKET(disconnect, 6, )
71NL_PACKET(resize, 7, 71NL_PACKET(resize, 7,
72 NL_INT64( 29, T_MAY_IGNORE, resize_size) 72 NL_INT64( 29, T_MAY_IGNORE, resize_size)
73 NL_BIT( 68, T_MAY_IGNORE, resize_force) 73 NL_BIT( 68, T_MAY_IGNORE, resize_force)
74 NL_BIT( 69, T_MANDATORY, no_resync)
74) 75)
75 76
76NL_PACKET(syncer_conf, 8, 77NL_PACKET(syncer_conf, 8,
77 NL_INTEGER( 30, T_MAY_IGNORE, rate) 78 NL_INTEGER( 30, T_MAY_IGNORE, rate)
78 NL_INTEGER( 31, T_MAY_IGNORE, after) 79 NL_INTEGER( 31, T_MAY_IGNORE, after)
79 NL_INTEGER( 32, T_MAY_IGNORE, al_extents) 80 NL_INTEGER( 32, T_MAY_IGNORE, al_extents)
81/* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume)
82 * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval)
83 * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th)
84 * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th)
85 * feature will be reimplemented differently with 8.3.9 */
80 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) 86 NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX)
81 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) 87 NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32)
82 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) 88 NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX)
diff --git a/include/linux/ds2782_battery.h b/include/linux/ds2782_battery.h
new file mode 100644
index 000000000000..b4e281f65c15
--- /dev/null
+++ b/include/linux/ds2782_battery.h
@@ -0,0 +1,8 @@
1#ifndef __LINUX_DS2782_BATTERY_H
2#define __LINUX_DS2782_BATTERY_H
3
4struct ds278x_platform_data {
5 int rsns;
6};
7
8#endif
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index b6cb5425cde3..493a2bf85f62 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_8VSB = 0x200000, 62 FE_CAN_8VSB = 0x200000,
63 FE_CAN_16VSB = 0x400000, 63 FE_CAN_16VSB = 0x400000,
64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ 64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
65 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */
65 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ 66 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
66 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ 67 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
67 FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ 68 FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 540b0583d9fb..5a7546c12688 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 1 27#define DVB_API_VERSION_MINOR 2
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index f8c2e1767500..52c0da4bdd18 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -28,7 +28,7 @@ struct _ddebug {
28 /* 28 /*
29 * The flags field controls the behaviour at the callsite. 29 * The flags field controls the behaviour at the callsite.
30 * The bits here are changed dynamically when the user 30 * The bits here are changed dynamically when the user
31 * writes commands to <debugfs>/dynamic_debug/ddebug 31 * writes commands to <debugfs>/dynamic_debug/control
32 */ 32 */
33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ 33#define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */
34#define _DPRINTK_FLAGS_DEFAULT 0 34#define _DPRINTK_FLAGS_DEFAULT 0
@@ -40,7 +40,7 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
40 const char *modname); 40 const char *modname);
41 41
42#if defined(CONFIG_DYNAMIC_DEBUG) 42#if defined(CONFIG_DYNAMIC_DEBUG)
43extern int ddebug_remove_module(char *mod_name); 43extern int ddebug_remove_module(const char *mod_name);
44 44
45#define __dynamic_dbg_enabled(dd) ({ \ 45#define __dynamic_dbg_enabled(dd) ({ \
46 int __ret = 0; \ 46 int __ret = 0; \
@@ -73,7 +73,7 @@ extern int ddebug_remove_module(char *mod_name);
73 73
74#else 74#else
75 75
76static inline int ddebug_remove_module(char *mod) 76static inline int ddebug_remove_module(const char *mod)
77{ 77{
78 return 0; 78 return 0;
79} 79}
diff --git a/include/linux/edac_mce.h b/include/linux/edac_mce.h
new file mode 100644
index 000000000000..f974fc035363
--- /dev/null
+++ b/include/linux/edac_mce.h
@@ -0,0 +1,31 @@
1/* Provides edac interface to mcelog events
2 *
3 * This file may be distributed under the terms of the
4 * GNU General Public License version 2.
5 *
6 * Copyright (c) 2009 by:
7 * Mauro Carvalho Chehab <mchehab@redhat.com>
8 *
9 * Red Hat Inc. http://www.redhat.com
10 */
11
12#if defined(CONFIG_EDAC_MCE) || \
13 (defined(CONFIG_EDAC_MCE_MODULE) && defined(MODULE))
14
15#include <asm/mce.h>
16#include <linux/list.h>
17
18struct edac_mce {
19 struct list_head list;
20
21 void *priv;
22 int (*check_error)(void *priv, struct mce *mce);
23};
24
25int edac_mce_register(struct edac_mce *edac_mce);
26void edac_mce_unregister(struct edac_mce *edac_mce);
27int edac_mce_parse(struct mce *mce);
28
29#else
30#define edac_mce_parse(mce) (0)
31#endif
diff --git a/include/linux/eeprom_93cx6.h b/include/linux/eeprom_93cx6.h
index a55c873e8b66..c4627cbdb8e0 100644
--- a/include/linux/eeprom_93cx6.h
+++ b/include/linux/eeprom_93cx6.h
@@ -30,6 +30,7 @@
30#define PCI_EEPROM_WIDTH_93C46 6 30#define PCI_EEPROM_WIDTH_93C46 6
31#define PCI_EEPROM_WIDTH_93C56 8 31#define PCI_EEPROM_WIDTH_93C56 8
32#define PCI_EEPROM_WIDTH_93C66 8 32#define PCI_EEPROM_WIDTH_93C66 8
33#define PCI_EEPROM_WIDTH_93C86 8
33#define PCI_EEPROM_WIDTH_OPCODE 3 34#define PCI_EEPROM_WIDTH_OPCODE 3
34#define PCI_EEPROM_WRITE_OPCODE 0x05 35#define PCI_EEPROM_WRITE_OPCODE 0x05
35#define PCI_EEPROM_READ_OPCODE 0x06 36#define PCI_EEPROM_READ_OPCODE 0x06
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 1cb3372e65d8..2c958f4fce1e 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -14,6 +14,9 @@ typedef void (elevator_merged_fn) (struct request_queue *, struct request *, int
14 14
15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *); 15typedef int (elevator_allow_merge_fn) (struct request_queue *, struct request *, struct bio *);
16 16
17typedef void (elevator_bio_merged_fn) (struct request_queue *,
18 struct request *, struct bio *);
19
17typedef int (elevator_dispatch_fn) (struct request_queue *, int); 20typedef int (elevator_dispatch_fn) (struct request_queue *, int);
18 21
19typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); 22typedef void (elevator_add_req_fn) (struct request_queue *, struct request *);
@@ -36,6 +39,7 @@ struct elevator_ops
36 elevator_merged_fn *elevator_merged_fn; 39 elevator_merged_fn *elevator_merged_fn;
37 elevator_merge_req_fn *elevator_merge_req_fn; 40 elevator_merge_req_fn *elevator_merge_req_fn;
38 elevator_allow_merge_fn *elevator_allow_merge_fn; 41 elevator_allow_merge_fn *elevator_allow_merge_fn;
42 elevator_bio_merged_fn *elevator_bio_merged_fn;
39 43
40 elevator_dispatch_fn *elevator_dispatch_fn; 44 elevator_dispatch_fn *elevator_dispatch_fn;
41 elevator_add_req_fn *elevator_add_req_fn; 45 elevator_add_req_fn *elevator_add_req_fn;
@@ -103,6 +107,8 @@ extern int elv_merge(struct request_queue *, struct request **, struct bio *);
103extern void elv_merge_requests(struct request_queue *, struct request *, 107extern void elv_merge_requests(struct request_queue *, struct request *,
104 struct request *); 108 struct request *);
105extern void elv_merged_request(struct request_queue *, struct request *, int); 109extern void elv_merged_request(struct request_queue *, struct request *, int);
110extern void elv_bio_merged(struct request_queue *q, struct request *,
111 struct bio *);
106extern void elv_requeue_request(struct request_queue *, struct request *); 112extern void elv_requeue_request(struct request_queue *, struct request *);
107extern int elv_queue_empty(struct request_queue *); 113extern int elv_queue_empty(struct request_queue *);
108extern struct request *elv_former_request(struct request_queue *, struct request *); 114extern struct request *elv_former_request(struct request_queue *, struct request *);
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 597858418051..4d608014753a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -394,6 +394,7 @@ typedef struct elf64_shdr {
394#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 394#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
395#define NT_S390_CTRS 0x304 /* s390 control registers */ 395#define NT_S390_CTRS 0x304 /* s390 control registers */
396#define NT_S390_PREFIX 0x305 /* s390 prefix register */ 396#define NT_S390_PREFIX 0x305 /* s390 prefix register */
397#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
397 398
398 399
399/* Note header in a PT_NOTE section */ 400/* Note header in a PT_NOTE section */
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index e687bc3ba4da..394a3e0e4a6b 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -150,8 +150,6 @@ static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregse
150} 150}
151#endif 151#endif
152 152
153#endif /* __KERNEL__ */
154
155/* 153/*
156 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out 154 * These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
157 * extra segments containing the gate DSO contents. Dumping its 155 * extra segments containing the gate DSO contents. Dumping its
@@ -168,4 +166,6 @@ extern int
168elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); 166elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit);
169extern size_t elf_core_extra_data_size(void); 167extern size_t elf_core_extra_data_size(void);
170 168
169#endif /* __KERNEL__ */
170
171#endif /* _LINUX_ELFCORE_H */ 171#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/err.h b/include/linux/err.h
index 1b12642636c7..448afc12c78a 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -19,22 +19,22 @@
19 19
20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO) 20#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
21 21
22static inline void *ERR_PTR(long error) 22static inline void * __must_check ERR_PTR(long error)
23{ 23{
24 return (void *) error; 24 return (void *) error;
25} 25}
26 26
27static inline long PTR_ERR(const void *ptr) 27static inline long __must_check PTR_ERR(const void *ptr)
28{ 28{
29 return (long) ptr; 29 return (long) ptr;
30} 30}
31 31
32static inline long IS_ERR(const void *ptr) 32static inline long __must_check IS_ERR(const void *ptr)
33{ 33{
34 return IS_ERR_VALUE((unsigned long)ptr); 34 return IS_ERR_VALUE((unsigned long)ptr);
35} 35}
36 36
37static inline long IS_ERR_OR_NULL(const void *ptr) 37static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
38{ 38{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 39 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 40}
@@ -46,7 +46,7 @@ static inline long IS_ERR_OR_NULL(const void *ptr)
46 * Explicitly cast an error-valued pointer to another pointer type in such a 46 * Explicitly cast an error-valued pointer to another pointer type in such a
47 * way as to make it clear that's what's going on. 47 * way as to make it clear that's what's going on.
48 */ 48 */
49static inline void *ERR_CAST(const void *ptr) 49static inline void * __must_check ERR_CAST(const void *ptr)
50{ 50{
51 /* cast away the const */ 51 /* cast away the const */
52 return (void *) ptr; 52 return (void *) ptr;
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 3d7a6687d247..848480bc2bf9 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -127,6 +127,20 @@ static inline void random_ether_addr(u8 *addr)
127} 127}
128 128
129/** 129/**
130 * dev_hw_addr_random - Create random MAC and set device flag
131 * @dev: pointer to net_device structure
132 * @addr: Pointer to a six-byte array containing the Ethernet address
133 *
134 * Generate random MAC to be used by a device and set addr_assign_type
135 * so the state can be read by sysfs and be used by udev.
136 */
137static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr)
138{
139 dev->addr_assign_type |= NET_ADDR_RANDOM;
140 random_ether_addr(hwaddr);
141}
142
143/**
130 * compare_ether_addr - Compare two Ethernet addresses 144 * compare_ether_addr - Compare two Ethernet addresses
131 * @addr1: Pointer to a six-byte array containing the Ethernet address 145 * @addr1: Pointer to a six-byte array containing the Ethernet address
132 * @addr2: Pointer other six-byte array containing the Ethernet address 146 * @addr2: Pointer other six-byte array containing the Ethernet address
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b33f316bb92e..991269e5b152 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -310,6 +310,7 @@ struct ethtool_perm_addr {
310enum ethtool_flags { 310enum ethtool_flags {
311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */ 311 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */ 312 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
313 ETH_FLAG_RXHASH = (1 << 28),
313}; 314};
314 315
315/* The following structures are for supporting RX network flow 316/* The following structures are for supporting RX network flow
@@ -378,11 +379,22 @@ struct ethtool_rxnfc {
378 __u32 flow_type; 379 __u32 flow_type;
379 /* The rx flow hash value or the rule DB size */ 380 /* The rx flow hash value or the rule DB size */
380 __u64 data; 381 __u64 data;
382 /* The following fields are not valid and must not be used for
383 * the ETHTOOL_{G,X}RXFH commands. */
381 struct ethtool_rx_flow_spec fs; 384 struct ethtool_rx_flow_spec fs;
382 __u32 rule_cnt; 385 __u32 rule_cnt;
383 __u32 rule_locs[0]; 386 __u32 rule_locs[0];
384}; 387};
385 388
389struct ethtool_rxfh_indir {
390 __u32 cmd;
391 /* On entry, this is the array size of the user buffer. On
392 * return from ETHTOOL_GRXFHINDIR, this is the array size of
393 * the hardware indirection table. */
394 __u32 size;
395 __u32 ring_index[0]; /* ring/queue index for each hash value */
396};
397
386struct ethtool_rx_ntuple_flow_spec { 398struct ethtool_rx_ntuple_flow_spec {
387 __u32 flow_type; 399 __u32 flow_type;
388 union { 400 union {
@@ -456,7 +468,7 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data);
456u32 ethtool_op_get_ufo(struct net_device *dev); 468u32 ethtool_op_get_ufo(struct net_device *dev);
457int ethtool_op_set_ufo(struct net_device *dev, u32 data); 469int ethtool_op_set_ufo(struct net_device *dev, u32 data);
458u32 ethtool_op_get_flags(struct net_device *dev); 470u32 ethtool_op_get_flags(struct net_device *dev);
459int ethtool_op_set_flags(struct net_device *dev, u32 data); 471int ethtool_op_set_flags(struct net_device *dev, u32 data, u32 supported);
460void ethtool_ntuple_flush(struct net_device *dev); 472void ethtool_ntuple_flush(struct net_device *dev);
461 473
462/** 474/**
@@ -490,12 +502,12 @@ void ethtool_ntuple_flush(struct net_device *dev);
490 * get_ufo: Report whether UDP fragmentation offload is enabled 502 * get_ufo: Report whether UDP fragmentation offload is enabled
491 * set_ufo: Turn UDP fragmentation offload on or off 503 * set_ufo: Turn UDP fragmentation offload on or off
492 * self_test: Run specified self-tests 504 * self_test: Run specified self-tests
493 * get_strings: Return a set of strings that describe the requested objects 505 * get_strings: Return a set of strings that describe the requested objects
494 * phys_id: Identify the device 506 * phys_id: Identify the device
495 * get_stats: Return statistics about the device 507 * get_stats: Return statistics about the device
496 * get_flags: get 32-bit flags bitmap 508 * get_flags: get 32-bit flags bitmap
497 * set_flags: set 32-bit flags bitmap 509 * set_flags: set 32-bit flags bitmap
498 * 510 *
499 * Description: 511 * Description:
500 * 512 *
501 * get_settings: 513 * get_settings:
@@ -531,14 +543,20 @@ struct ethtool_ops {
531 int (*nway_reset)(struct net_device *); 543 int (*nway_reset)(struct net_device *);
532 u32 (*get_link)(struct net_device *); 544 u32 (*get_link)(struct net_device *);
533 int (*get_eeprom_len)(struct net_device *); 545 int (*get_eeprom_len)(struct net_device *);
534 int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 546 int (*get_eeprom)(struct net_device *,
535 int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); 547 struct ethtool_eeprom *, u8 *);
548 int (*set_eeprom)(struct net_device *,
549 struct ethtool_eeprom *, u8 *);
536 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); 550 int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
537 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); 551 int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
538 void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); 552 void (*get_ringparam)(struct net_device *,
539 int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); 553 struct ethtool_ringparam *);
540 void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 554 int (*set_ringparam)(struct net_device *,
541 int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); 555 struct ethtool_ringparam *);
556 void (*get_pauseparam)(struct net_device *,
557 struct ethtool_pauseparam*);
558 int (*set_pauseparam)(struct net_device *,
559 struct ethtool_pauseparam*);
542 u32 (*get_rx_csum)(struct net_device *); 560 u32 (*get_rx_csum)(struct net_device *);
543 int (*set_rx_csum)(struct net_device *, u32); 561 int (*set_rx_csum)(struct net_device *, u32);
544 u32 (*get_tx_csum)(struct net_device *); 562 u32 (*get_tx_csum)(struct net_device *);
@@ -550,22 +568,29 @@ struct ethtool_ops {
550 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); 568 void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
551 void (*get_strings)(struct net_device *, u32 stringset, u8 *); 569 void (*get_strings)(struct net_device *, u32 stringset, u8 *);
552 int (*phys_id)(struct net_device *, u32); 570 int (*phys_id)(struct net_device *, u32);
553 void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); 571 void (*get_ethtool_stats)(struct net_device *,
572 struct ethtool_stats *, u64 *);
554 int (*begin)(struct net_device *); 573 int (*begin)(struct net_device *);
555 void (*complete)(struct net_device *); 574 void (*complete)(struct net_device *);
556 u32 (*get_ufo)(struct net_device *); 575 u32 (*get_ufo)(struct net_device *);
557 int (*set_ufo)(struct net_device *, u32); 576 int (*set_ufo)(struct net_device *, u32);
558 u32 (*get_flags)(struct net_device *); 577 u32 (*get_flags)(struct net_device *);
559 int (*set_flags)(struct net_device *, u32); 578 int (*set_flags)(struct net_device *, u32);
560 u32 (*get_priv_flags)(struct net_device *); 579 u32 (*get_priv_flags)(struct net_device *);
561 int (*set_priv_flags)(struct net_device *, u32); 580 int (*set_priv_flags)(struct net_device *, u32);
562 int (*get_sset_count)(struct net_device *, int); 581 int (*get_sset_count)(struct net_device *, int);
563 int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); 582 int (*get_rxnfc)(struct net_device *,
583 struct ethtool_rxnfc *, void *);
564 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); 584 int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
565 int (*flash_device)(struct net_device *, struct ethtool_flash *); 585 int (*flash_device)(struct net_device *, struct ethtool_flash *);
566 int (*reset)(struct net_device *, u32 *); 586 int (*reset)(struct net_device *, u32 *);
567 int (*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); 587 int (*set_rx_ntuple)(struct net_device *,
588 struct ethtool_rx_ntuple *);
568 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *); 589 int (*get_rx_ntuple)(struct net_device *, u32 stringset, void *);
590 int (*get_rxfh_indir)(struct net_device *,
591 struct ethtool_rxfh_indir *);
592 int (*set_rxfh_indir)(struct net_device *,
593 const struct ethtool_rxfh_indir *);
569}; 594};
570#endif /* __KERNEL__ */ 595#endif /* __KERNEL__ */
571 596
@@ -612,21 +637,23 @@ struct ethtool_ops {
612#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */ 637#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
613#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */ 638#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
614 639
615#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 640#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
616#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 641#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
617#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ 642#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
618#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ 643#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
619#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ 644#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
620#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ 645#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
621#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ 646#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
622#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ 647#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
623#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ 648#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
624#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ 649#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
625#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ 650#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
626#define ETHTOOL_RESET 0x00000034 /* Reset hardware */ 651#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
627#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */ 652#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
628#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */ 653#define ETHTOOL_GRXNTUPLE 0x00000036 /* Get n-tuple filters from device */
629#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */ 654#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
655#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
656#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
630 657
631/* compatibility with older code */ 658/* compatibility with older code */
632#define SPARC_ETH_GSET ETHTOOL_GSET 659#define SPARC_ETH_GSET ETHTOOL_GSET
@@ -746,8 +773,8 @@ struct ethtool_ops {
746#define AH_V6_FLOW 0x0b 773#define AH_V6_FLOW 0x0b
747#define ESP_V6_FLOW 0x0c 774#define ESP_V6_FLOW 0x0c
748#define IP_USER_FLOW 0x0d 775#define IP_USER_FLOW 0x0d
749#define IPV4_FLOW 0x10 776#define IPV4_FLOW 0x10
750#define IPV6_FLOW 0x11 777#define IPV6_FLOW 0x11
751 778
752/* L3-L4 network traffic flow hash options */ 779/* L3-L4 network traffic flow hash options */
753#define RXH_L2DA (1 << 1) 780#define RXH_L2DA (1 << 1)
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index 1cdb66367c98..db4d9f586bb6 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -106,6 +106,15 @@ struct ext2_sb_info {
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head; 108 struct ext2_reserve_window_node s_rsv_window_head;
109 /*
110 * s_lock protects against concurrent modifications of s_mount_state,
111 * s_blocks_last, s_overhead_last and the content of superblock's
112 * buffer pointed to by sbi->s_es.
113 *
114 * Note: It is used in ext2_show_options() to provide a consistent view
115 * of the mount options.
116 */
117 spinlock_t s_lock;
109}; 118};
110 119
111static inline spinlock_t * 120static inline spinlock_t *
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 5f494b465097..6ce1bca01724 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -400,7 +400,6 @@ struct ext3_inode {
400#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */ 400#define EXT3_MOUNT_POSIX_ACL 0x08000 /* POSIX Access Control Lists */
401#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */ 401#define EXT3_MOUNT_RESERVATION 0x10000 /* Preallocation */
402#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */ 402#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
403#define EXT3_MOUNT_NOBH 0x40000 /* No bufferheads */
404#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */ 403#define EXT3_MOUNT_QUOTA 0x80000 /* Some quota option set */
405#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 404#define EXT3_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
406#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 405#define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
@@ -868,7 +867,7 @@ extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
868extern void ext3_htree_free_dir_info(struct dir_private_info *p); 867extern void ext3_htree_free_dir_info(struct dir_private_info *p);
869 868
870/* fsync.c */ 869/* fsync.c */
871extern int ext3_sync_file (struct file *, struct dentry *, int); 870extern int ext3_sync_file(struct file *, int);
872 871
873/* hash.c */ 872/* hash.c */
874extern int ext3fs_dirhash(const char *name, int len, struct 873extern int ext3fs_dirhash(const char *name, int len, struct
@@ -896,7 +895,7 @@ int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
896extern struct inode *ext3_iget(struct super_block *, unsigned long); 895extern struct inode *ext3_iget(struct super_block *, unsigned long);
897extern int ext3_write_inode (struct inode *, struct writeback_control *); 896extern int ext3_write_inode (struct inode *, struct writeback_control *);
898extern int ext3_setattr (struct dentry *, struct iattr *); 897extern int ext3_setattr (struct dentry *, struct iattr *);
899extern void ext3_delete_inode (struct inode *); 898extern void ext3_evict_inode (struct inode *);
900extern int ext3_sync_inode (handle_t *, struct inode *); 899extern int ext3_sync_inode (handle_t *, struct inode *);
901extern void ext3_discard_reservation (struct inode *); 900extern void ext3_discard_reservation (struct inode *);
902extern void ext3_dirty_inode(struct inode *); 901extern void ext3_dirty_inode(struct inode *);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
new file mode 100644
index 000000000000..f0949a57ca9d
--- /dev/null
+++ b/include/linux/fanotify.h
@@ -0,0 +1,105 @@
1#ifndef _LINUX_FANOTIFY_H
2#define _LINUX_FANOTIFY_H
3
4#include <linux/types.h>
5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Unwrittable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Writtable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
14
15/* FIXME currently Q's have no limit.... */
16#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
17
18#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
19#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
20
21/* helper events */
22#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
23
24/* flags used for fanotify_init() */
25#define FAN_CLOEXEC 0x00000001
26#define FAN_NONBLOCK 0x00000002
27
28#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK)
29
30/* flags used for fanotify_modify_mark() */
31#define FAN_MARK_ADD 0x00000001
32#define FAN_MARK_REMOVE 0x00000002
33#define FAN_MARK_DONT_FOLLOW 0x00000004
34#define FAN_MARK_ONLYDIR 0x00000008
35#define FAN_MARK_MOUNT 0x00000010
36#define FAN_MARK_IGNORED_MASK 0x00000020
37#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
38#define FAN_MARK_FLUSH 0x00000080
39
40#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
41 FAN_MARK_REMOVE |\
42 FAN_MARK_DONT_FOLLOW |\
43 FAN_MARK_ONLYDIR |\
44 FAN_MARK_MOUNT |\
45 FAN_MARK_IGNORED_MASK |\
46 FAN_MARK_IGNORED_SURV_MODIFY)
47
48/*
49 * All of the events - we build the list by hand so that we can add flags in
50 * the future and not break backward compatibility. Apps will get only the
51 * events that they originally wanted. Be sure to add new events here!
52 */
53#define FAN_ALL_EVENTS (FAN_ACCESS |\
54 FAN_MODIFY |\
55 FAN_CLOSE |\
56 FAN_OPEN)
57
58/*
59 * All events which require a permission response from userspace
60 */
61#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
62 FAN_ACCESS_PERM)
63
64#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
65 FAN_ALL_PERM_EVENTS |\
66 FAN_Q_OVERFLOW)
67
68#define FANOTIFY_METADATA_VERSION 1
69
70struct fanotify_event_metadata {
71 __u32 event_len;
72 __u32 vers;
73 __s32 fd;
74 __u64 mask;
75 __s64 pid;
76} __attribute__ ((packed));
77
78struct fanotify_response {
79 __s32 fd;
80 __u32 response;
81} __attribute__ ((packed));
82
83/* Legit userspace responses to a _PERM event */
84#define FAN_ALLOW 0x01
85#define FAN_DENY 0x02
86
87/* Helper functions to deal with fanotify_event_metadata buffers */
88#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
89
90#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
91 (struct fanotify_event_metadata*)(((char *)(meta)) + \
92 (meta)->event_len))
93
94#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
95 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
96 (long)(meta)->event_len <= (long)(len))
97
98#ifdef __KERNEL__
99
100struct fanotify_wait {
101 struct fsnotify_event *event;
102 __s32 fd;
103};
104#endif /* __KERNEL__ */
105#endif /* _LINUX_FANOTIFY_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c10163b4c40e..f0268deca658 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -3,8 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/i2c.h> 5#include <linux/i2c.h>
6 6#ifdef __KERNEL__
7struct dentry; 7#include <linux/kgdb.h>
8#endif /* __KERNEL__ */
8 9
9/* Definitions of frame buffers */ 10/* Definitions of frame buffers */
10 11
@@ -37,7 +38,7 @@ struct dentry;
37#define FBIOGET_HWCINFO 0x4616 38#define FBIOGET_HWCINFO 0x4616
38#define FBIOPUT_MODEINFO 0x4617 39#define FBIOPUT_MODEINFO 0x4617
39#define FBIOGET_DISPINFO 0x4618 40#define FBIOGET_DISPINFO 0x4618
40 41#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41 42
42#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ 43#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
43#define FB_TYPE_PLANES 1 /* Non interleaved planes */ 44#define FB_TYPE_PLANES 1 /* Non interleaved planes */
@@ -403,6 +404,7 @@ struct fb_cursor {
403#include <linux/notifier.h> 404#include <linux/notifier.h>
404#include <linux/list.h> 405#include <linux/list.h>
405#include <linux/backlight.h> 406#include <linux/backlight.h>
407#include <linux/slab.h>
406#include <asm/io.h> 408#include <asm/io.h>
407 409
408struct vm_area_struct; 410struct vm_area_struct;
@@ -608,6 +610,12 @@ struct fb_deferred_io {
608 * LOCKING NOTE: those functions must _ALL_ be called with the console 610 * LOCKING NOTE: those functions must _ALL_ be called with the console
609 * semaphore held, this is the only suitable locking mechanism we have 611 * semaphore held, this is the only suitable locking mechanism we have
610 * in 2.6. Some may be called at interrupt time at this point though. 612 * in 2.6. Some may be called at interrupt time at this point though.
613 *
614 * The exception to this is the debug related hooks. Putting the fb
615 * into a debug state (e.g. flipping to the kernel console) and restoring
616 * it must be done in a lock-free manner, so low level drivers should
617 * keep track of the initial console (if applicable) and may need to
618 * perform direct, unlocked hardware writes in these hooks.
611 */ 619 */
612 620
613struct fb_ops { 621struct fb_ops {
@@ -677,6 +685,10 @@ struct fb_ops {
677 685
678 /* teardown any resources to do with this framebuffer */ 686 /* teardown any resources to do with this framebuffer */
679 void (*fb_destroy)(struct fb_info *info); 687 void (*fb_destroy)(struct fb_info *info);
688
689 /* called at KDB enter and leave time to prepare the console */
690 int (*fb_debug_enter)(struct fb_info *info);
691 int (*fb_debug_leave)(struct fb_info *info);
680}; 692};
681 693
682#ifdef CONFIG_FB_TILEBLITTING 694#ifdef CONFIG_FB_TILEBLITTING
@@ -787,8 +799,6 @@ struct fb_tile_ops {
787#define FBINFO_MISC_USEREVENT 0x10000 /* event request 799#define FBINFO_MISC_USEREVENT 0x10000 /* event request
788 from userspace */ 800 from userspace */
789#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 801#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
790#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
791 inited framebuffer */
792 802
793/* A driver may set this flag to indicate that it does want a set_par to be 803/* A driver may set this flag to indicate that it does want a set_par to be
794 * called every time when fbcon_switch is executed. The advantage is that with 804 * called every time when fbcon_switch is executed. The advantage is that with
@@ -802,6 +812,8 @@ struct fb_tile_ops {
802 */ 812 */
803#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 813#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
804 814
815/* where the fb is a firmware driver, and can be replaced with a proper one */
816#define FBINFO_MISC_FIRMWARE 0x80000
805/* 817/*
806 * Host and GPU endianness differ. 818 * Host and GPU endianness differ.
807 */ 819 */
@@ -813,6 +825,10 @@ struct fb_tile_ops {
813 */ 825 */
814#define FBINFO_BE_MATH 0x100000 826#define FBINFO_BE_MATH 0x100000
815 827
828/* report to the VT layer that this fb driver can accept forced console
829 output like oopses */
830#define FBINFO_CAN_FORCE_OUTPUT 0x200000
831
816struct fb_info { 832struct fb_info {
817 int node; 833 int node;
818 int flags; 834 int flags;
@@ -862,10 +878,24 @@ struct fb_info {
862 /* we need the PCI or similiar aperture base/size not 878 /* we need the PCI or similiar aperture base/size not
863 smem_start/size as smem_start may just be an object 879 smem_start/size as smem_start may just be an object
864 allocated inside the aperture so may not actually overlap */ 880 allocated inside the aperture so may not actually overlap */
865 resource_size_t aperture_base; 881 struct apertures_struct {
866 resource_size_t aperture_size; 882 unsigned int count;
883 struct aperture {
884 resource_size_t base;
885 resource_size_t size;
886 } ranges[0];
887 } *apertures;
867}; 888};
868 889
890static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
891 struct apertures_struct *a = kzalloc(sizeof(struct apertures_struct)
892 + max_num * sizeof(struct aperture), GFP_KERNEL);
893 if (!a)
894 return NULL;
895 a->count = max_num;
896 return a;
897}
898
869#ifdef MODULE 899#ifdef MODULE
870#define FBINFO_DEFAULT FBINFO_MODULE 900#define FBINFO_DEFAULT FBINFO_MODULE
871#else 901#else
@@ -958,6 +988,8 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
958/* drivers/video/fbmem.c */ 988/* drivers/video/fbmem.c */
959extern int register_framebuffer(struct fb_info *fb_info); 989extern int register_framebuffer(struct fb_info *fb_info);
960extern int unregister_framebuffer(struct fb_info *fb_info); 990extern int unregister_framebuffer(struct fb_info *fb_info);
991extern void remove_conflicting_framebuffers(struct apertures_struct *a,
992 const char *name, bool primary);
961extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); 993extern int fb_prepare_logo(struct fb_info *fb_info, int rotate);
962extern int fb_show_logo(struct fb_info *fb_info, int rotate); 994extern int fb_show_logo(struct fb_info *fb_info, int rotate);
963extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size); 995extern char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size);
@@ -1002,8 +1034,7 @@ extern void fb_deferred_io_open(struct fb_info *info,
1002 struct inode *inode, 1034 struct inode *inode,
1003 struct file *file); 1035 struct file *file);
1004extern void fb_deferred_io_cleanup(struct fb_info *info); 1036extern void fb_deferred_io_cleanup(struct fb_info *info);
1005extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 1037extern int fb_deferred_io_fsync(struct file *file, int datasync);
1006 int datasync);
1007 1038
1008static inline bool fb_be_math(struct fb_info *info) 1039static inline bool fb_be_math(struct fb_info *info)
1009{ 1040{
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index 86037400a6e3..afc00af3229b 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -22,6 +22,12 @@
22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2) 22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23 23
24/* 24/*
25 * Set and get of pipe page size array
26 */
27#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29
30/*
25 * Types of directory notifications that may be requested. 31 * Types of directory notifications that may be requested.
26 */ 32 */
27#define DN_ACCESS 0x00000001 /* File accessed */ 33#define DN_ACCESS 0x00000001 /* File accessed */
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 013dc529e95f..f59ed297b661 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -11,6 +11,7 @@
11#include <linux/rcupdate.h> 11#include <linux/rcupdate.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/fs.h>
14 15
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16 17
@@ -61,7 +62,8 @@ struct files_struct {
61 (rcu_dereference_check((fdtfd), \ 62 (rcu_dereference_check((fdtfd), \
62 rcu_read_lock_held() || \ 63 rcu_read_lock_held() || \
63 lockdep_is_held(&(files)->file_lock) || \ 64 lockdep_is_held(&(files)->file_lock) || \
64 atomic_read(&(files)->count) == 1)) 65 atomic_read(&(files)->count) == 1 || \
66 rcu_my_thread_group_empty()))
65 67
66#define files_fdtable(files) \ 68#define files_fdtable(files) \
67 (rcu_dereference_check_fdtable((files), (files)->fdt)) 69 (rcu_dereference_check_fdtable((files), (files)->fdt))
diff --git a/include/linux/fec.h b/include/linux/fec.h
new file mode 100644
index 000000000000..5d3523d8dd0c
--- /dev/null
+++ b/include/linux/fec.h
@@ -0,0 +1,21 @@
1/* include/linux/fec.h
2 *
3 * Copyright (c) 2009 Orex Computed Radiography
4 * Baruch Siach <baruch@tkos.co.il>
5 *
6 * Header file for the FEC platform data
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __LINUX_FEC_H__
13#define __LINUX_FEC_H__
14
15#include <linux/phy.h>
16
17struct fec_platform_data {
18 phy_interface_t phy;
19};
20
21#endif
diff --git a/include/linux/file.h b/include/linux/file.h
index 5555508fd517..b1e12970f617 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -11,7 +11,6 @@
11 11
12struct file; 12struct file;
13 13
14extern void __fput(struct file *);
15extern void fput(struct file *); 14extern void fput(struct file *);
16extern void drop_file_write_access(struct file *file); 15extern void drop_file_write_access(struct file *file);
17 16
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 29a0e3db9f43..69b43dbea6c6 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -91,6 +91,54 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
91#define BPF_TAX 0x00 91#define BPF_TAX 0x00
92#define BPF_TXA 0x80 92#define BPF_TXA 0x80
93 93
94enum {
95 BPF_S_RET_K = 0,
96 BPF_S_RET_A,
97 BPF_S_ALU_ADD_K,
98 BPF_S_ALU_ADD_X,
99 BPF_S_ALU_SUB_K,
100 BPF_S_ALU_SUB_X,
101 BPF_S_ALU_MUL_K,
102 BPF_S_ALU_MUL_X,
103 BPF_S_ALU_DIV_X,
104 BPF_S_ALU_AND_K,
105 BPF_S_ALU_AND_X,
106 BPF_S_ALU_OR_K,
107 BPF_S_ALU_OR_X,
108 BPF_S_ALU_LSH_K,
109 BPF_S_ALU_LSH_X,
110 BPF_S_ALU_RSH_K,
111 BPF_S_ALU_RSH_X,
112 BPF_S_ALU_NEG,
113 BPF_S_LD_W_ABS,
114 BPF_S_LD_H_ABS,
115 BPF_S_LD_B_ABS,
116 BPF_S_LD_W_LEN,
117 BPF_S_LD_W_IND,
118 BPF_S_LD_H_IND,
119 BPF_S_LD_B_IND,
120 BPF_S_LD_IMM,
121 BPF_S_LDX_W_LEN,
122 BPF_S_LDX_B_MSH,
123 BPF_S_LDX_IMM,
124 BPF_S_MISC_TAX,
125 BPF_S_MISC_TXA,
126 BPF_S_ALU_DIV_K,
127 BPF_S_LD_MEM,
128 BPF_S_LDX_MEM,
129 BPF_S_ST,
130 BPF_S_STX,
131 BPF_S_JMP_JA,
132 BPF_S_JMP_JEQ_K,
133 BPF_S_JMP_JEQ_X,
134 BPF_S_JMP_JGE_K,
135 BPF_S_JMP_JGE_X,
136 BPF_S_JMP_JGT_K,
137 BPF_S_JMP_JGT_X,
138 BPF_S_JMP_JSET_K,
139 BPF_S_JMP_JSET_X,
140};
141
94#ifndef BPF_MAXINSNS 142#ifndef BPF_MAXINSNS
95#define BPF_MAXINSNS 4096 143#define BPF_MAXINSNS 4096
96#endif 144#endif
@@ -123,7 +171,8 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
123#define SKF_AD_NLATTR_NEST 16 171#define SKF_AD_NLATTR_NEST 16
124#define SKF_AD_MARK 20 172#define SKF_AD_MARK 20
125#define SKF_AD_QUEUE 24 173#define SKF_AD_QUEUE 24
126#define SKF_AD_MAX 28 174#define SKF_AD_HATYPE 28
175#define SKF_AD_MAX 32
127#define SKF_NET_OFF (-0x100000) 176#define SKF_NET_OFF (-0x100000)
128#define SKF_LL_OFF (-0x200000) 177#define SKF_LL_OFF (-0x200000)
129 178
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h
index 68f883b30a53..68c642d8843d 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/linux/firewire-cdev.h
@@ -30,12 +30,18 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/firewire-constants.h> 31#include <linux/firewire-constants.h>
32 32
33#define FW_CDEV_EVENT_BUS_RESET 0x00 33#define FW_CDEV_EVENT_BUS_RESET 0x00
34#define FW_CDEV_EVENT_RESPONSE 0x01 34#define FW_CDEV_EVENT_RESPONSE 0x01
35#define FW_CDEV_EVENT_REQUEST 0x02 35#define FW_CDEV_EVENT_REQUEST 0x02
36#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03 36#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
37#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 37#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
38#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 38#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
39
40/* available since kernel version 2.6.36 */
41#define FW_CDEV_EVENT_REQUEST2 0x06
42#define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07
43#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08
44#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09
39 45
40/** 46/**
41 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types 47 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
@@ -68,6 +74,10 @@ struct fw_cdev_event_common {
68 * This event is sent when the bus the device belongs to goes through a bus 74 * This event is sent when the bus the device belongs to goes through a bus
69 * reset. It provides information about the new bus configuration, such as 75 * reset. It provides information about the new bus configuration, such as
70 * new node ID for this device, new root ID, and others. 76 * new node ID for this device, new root ID, and others.
77 *
78 * If @bm_node_id is 0xffff right after bus reset it can be reread by an
79 * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
80 * Kernels with ABI version < 4 do not set @bm_node_id.
71 */ 81 */
72struct fw_cdev_event_bus_reset { 82struct fw_cdev_event_bus_reset {
73 __u64 closure; 83 __u64 closure;
@@ -82,8 +92,9 @@ struct fw_cdev_event_bus_reset {
82 92
83/** 93/**
84 * struct fw_cdev_event_response - Sent when a response packet was received 94 * struct fw_cdev_event_response - Sent when a response packet was received
85 * @closure: See &fw_cdev_event_common; 95 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
86 * set by %FW_CDEV_IOC_SEND_REQUEST ioctl 96 * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
97 * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
87 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE 98 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
88 * @rcode: Response code returned by the remote node 99 * @rcode: Response code returned by the remote node
89 * @length: Data length, i.e. the response's payload size in bytes 100 * @length: Data length, i.e. the response's payload size in bytes
@@ -93,6 +104,11 @@ struct fw_cdev_event_bus_reset {
93 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses 104 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
94 * carrying data (read and lock responses) follows immediately and can be 105 * carrying data (read and lock responses) follows immediately and can be
95 * accessed through the @data field. 106 * accessed through the @data field.
107 *
108 * The event is also generated after conclusions of transactions that do not
109 * involve response packets. This includes unified write transactions,
110 * broadcast write transactions, and transmission of asynchronous stream
111 * packets. @rcode indicates success or failure of such transmissions.
96 */ 112 */
97struct fw_cdev_event_response { 113struct fw_cdev_event_response {
98 __u64 closure; 114 __u64 closure;
@@ -103,11 +119,46 @@ struct fw_cdev_event_response {
103}; 119};
104 120
105/** 121/**
106 * struct fw_cdev_event_request - Sent on incoming request to an address region 122 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
107 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl 123 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
108 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST 124 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
125 * @tcode: See &fw_cdev_event_request2
126 * @offset: See &fw_cdev_event_request2
127 * @handle: See &fw_cdev_event_request2
128 * @length: See &fw_cdev_event_request2
129 * @data: See &fw_cdev_event_request2
130 *
131 * This event is sent instead of &fw_cdev_event_request2 if the kernel or
132 * the client implements ABI version <= 3.
133 *
134 * Unlike &fw_cdev_event_request2, the sender identity cannot be established,
135 * broadcast write requests cannot be distinguished from unicast writes, and
136 * @tcode of lock requests is %TCODE_LOCK_REQUEST.
137 *
138 * Requests to the FCP_REQUEST or FCP_RESPONSE register are responded to as
139 * with &fw_cdev_event_request2, except in kernel 2.6.32 and older which send
140 * the response packet of the client's %FW_CDEV_IOC_SEND_RESPONSE ioctl.
141 */
142struct fw_cdev_event_request {
143 __u64 closure;
144 __u32 type;
145 __u32 tcode;
146 __u64 offset;
147 __u32 handle;
148 __u32 length;
149 __u32 data[0];
150};
151
152/**
153 * struct fw_cdev_event_request2 - Sent on incoming request to an address region
154 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
155 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
109 * @tcode: Transaction code of the incoming request 156 * @tcode: Transaction code of the incoming request
110 * @offset: The offset into the 48-bit per-node address space 157 * @offset: The offset into the 48-bit per-node address space
158 * @source_node_id: Sender node ID
159 * @destination_node_id: Destination node ID
160 * @card: The index of the card from which the request came
161 * @generation: Bus generation in which the request is valid
111 * @handle: Reference to the kernel-side pending request 162 * @handle: Reference to the kernel-side pending request
112 * @length: Data length, i.e. the request's payload size in bytes 163 * @length: Data length, i.e. the request's payload size in bytes
113 * @data: Incoming data, if any 164 * @data: Incoming data, if any
@@ -120,12 +171,42 @@ struct fw_cdev_event_response {
120 * 171 *
121 * The payload data for requests carrying data (write and lock requests) 172 * The payload data for requests carrying data (write and lock requests)
122 * follows immediately and can be accessed through the @data field. 173 * follows immediately and can be accessed through the @data field.
174 *
175 * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
176 * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
177 * i.e. encodes the extended transaction code.
178 *
179 * @card may differ from &fw_cdev_get_info.card because requests are received
180 * from all cards of the Linux host. @source_node_id, @destination_node_id, and
181 * @generation pertain to that card. Destination node ID and bus generation may
182 * therefore differ from the corresponding fields of the last
183 * &fw_cdev_event_bus_reset.
184 *
185 * @destination_node_id may also differ from the current node ID because of a
186 * non-local bus ID part or in case of a broadcast write request. Note, a
187 * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
188 * broadcast write request; the kernel will then release the kernel-side pending
189 * request but will not actually send a response packet.
190 *
191 * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
192 * sent a write response immediately after the request was received; in this
193 * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
194 * release the kernel-side pending request, though another response won't be
195 * sent.
196 *
197 * If the client subsequently needs to initiate requests to the sender node of
198 * an &fw_cdev_event_request2, it needs to use a device file with matching
199 * card index, node ID, and generation for outbound requests.
123 */ 200 */
124struct fw_cdev_event_request { 201struct fw_cdev_event_request2 {
125 __u64 closure; 202 __u64 closure;
126 __u32 type; 203 __u32 type;
127 __u32 tcode; 204 __u32 tcode;
128 __u64 offset; 205 __u64 offset;
206 __u32 source_node_id;
207 __u32 destination_node_id;
208 __u32 card;
209 __u32 generation;
129 __u32 handle; 210 __u32 handle;
130 __u32 length; 211 __u32 length;
131 __u32 data[0]; 212 __u32 data[0];
@@ -141,26 +222,43 @@ struct fw_cdev_event_request {
141 * @header: Stripped headers, if any 222 * @header: Stripped headers, if any
142 * 223 *
143 * This event is sent when the controller has completed an &fw_cdev_iso_packet 224 * This event is sent when the controller has completed an &fw_cdev_iso_packet
144 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers 225 * with the %FW_CDEV_ISO_INTERRUPT bit set.
145 * stripped of all packets up until and including the interrupt packet are
146 * returned in the @header field. The amount of header data per packet is as
147 * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
148 * 226 *
149 * In version 1 of this ABI, header data consisted of the 1394 isochronous 227 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
150 * packet header, followed by quadlets from the packet payload if
151 * &fw_cdev_create_iso_context.header_size > 4.
152 * 228 *
153 * In version 2 of this ABI, header data consist of the 1394 isochronous 229 * In version 3 and some implementations of version 2 of the ABI, &header_length
154 * packet header, followed by a timestamp quadlet if 230 * is a multiple of 4 and &header contains timestamps of all packets up until
155 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the 231 * the interrupt packet. The format of the timestamps is as described below for
156 * packet payload if &fw_cdev_create_iso_context.header_size > 8. 232 * isochronous reception. In version 1 of the ABI, &header_length was 0.
157 * 233 *
158 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2. 234 * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
235 *
236 * The headers stripped of all packets up until and including the interrupt
237 * packet are returned in the @header field. The amount of header data per
238 * packet is as specified at iso context creation by
239 * &fw_cdev_create_iso_context.header_size.
240 *
241 * Hence, _interrupt.header_length / _context.header_size is the number of
242 * packets received in this interrupt event. The client can now iterate
243 * through the mmap()'ed DMA buffer according to this number of packets and
244 * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
245 *
246 * Since version 2 of this ABI, the portion for each packet in _interrupt.header
247 * consists of the 1394 isochronous packet header, followed by a timestamp
248 * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
249 * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
159 * 250 *
160 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel, 251 * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits
161 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp: 252 * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
162 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte 253 * data_length is the actual received size of the packet without the four
163 * order. 254 * 1394 iso packet header bytes.
255 *
256 * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits
257 * cycleCount, in big endian byte order.
258 *
259 * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
260 * data followed directly after the 1394 is header if header_size > 4.
261 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
164 */ 262 */
165struct fw_cdev_event_iso_interrupt { 263struct fw_cdev_event_iso_interrupt {
166 __u64 closure; 264 __u64 closure;
@@ -171,6 +269,43 @@ struct fw_cdev_event_iso_interrupt {
171}; 269};
172 270
173/** 271/**
272 * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
273 * @closure: See &fw_cdev_event_common;
274 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
275 * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
276 * @completed: Offset into the receive buffer; data before this offest is valid
277 *
278 * This event is sent in multichannel contexts (context type
279 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
280 * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set. Whether this happens
281 * when a packet is completed and/or when a buffer chunk is completed depends
282 * on the hardware implementation.
283 *
284 * The buffer is continuously filled with the following data, per packet:
285 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
286 * but in little endian byte order,
287 * - packet payload (as many bytes as specified in the data_length field of
288 * the 1394 iso packet header) in big endian byte order,
289 * - 0...3 padding bytes as needed to align the following trailer quadlet,
290 * - trailer quadlet, containing the reception timestamp as described at
291 * &fw_cdev_event_iso_interrupt, but in little endian byte order.
292 *
293 * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
294 * When processing the data, stop before a packet that would cross the
295 * @completed offset.
296 *
297 * A packet near the end of a buffer chunk will typically spill over into the
298 * next queued buffer chunk. It is the responsibility of the client to check
299 * for this condition, assemble a broken-up packet from its parts, and not to
300 * re-queue any buffer chunks in which as yet unread packet parts reside.
301 */
302struct fw_cdev_event_iso_interrupt_mc {
303 __u64 closure;
304 __u32 type;
305 __u32 completed;
306};
307
308/**
174 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed 309 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
175 * @closure: See &fw_cdev_event_common; 310 * @closure: See &fw_cdev_event_common;
176 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl 311 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
@@ -200,15 +335,45 @@ struct fw_cdev_event_iso_resource {
200}; 335};
201 336
202/** 337/**
338 * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
339 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
340 * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
341 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
342 * @rcode: %RCODE_..., indicates success or failure of transmission
343 * @length: Data length in bytes
344 * @data: Incoming data
345 *
346 * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
347 * except in case of a ping packet: Then, @length is 4, and @data[0] is the
348 * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
349 *
350 * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
351 * consists of the two PHY packet quadlets, in host byte order.
352 */
353struct fw_cdev_event_phy_packet {
354 __u64 closure;
355 __u32 type;
356 __u32 rcode;
357 __u32 length;
358 __u32 data[0];
359};
360
361/**
203 * union fw_cdev_event - Convenience union of fw_cdev_event_ types 362 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
204 * @common: Valid for all types 363 * @common: Valid for all types
205 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET 364 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
206 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE 365 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
207 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST 366 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
208 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT 367 * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
209 * @iso_resource: Valid if @common.type == 368 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
369 * @iso_interrupt_mc: Valid if @common.type ==
370 * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
371 * @iso_resource: Valid if @common.type ==
210 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or 372 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
211 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 373 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
374 * @phy_packet: Valid if @common.type ==
375 * %FW_CDEV_EVENT_PHY_PACKET_SENT or
376 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
212 * 377 *
213 * Convenience union for userspace use. Events could be read(2) into an 378 * Convenience union for userspace use. Events could be read(2) into an
214 * appropriately aligned char buffer and then cast to this union for further 379 * appropriately aligned char buffer and then cast to this union for further
@@ -223,8 +388,11 @@ union fw_cdev_event {
223 struct fw_cdev_event_bus_reset bus_reset; 388 struct fw_cdev_event_bus_reset bus_reset;
224 struct fw_cdev_event_response response; 389 struct fw_cdev_event_response response;
225 struct fw_cdev_event_request request; 390 struct fw_cdev_event_request request;
391 struct fw_cdev_event_request2 request2; /* added in 2.6.36 */
226 struct fw_cdev_event_iso_interrupt iso_interrupt; 392 struct fw_cdev_event_iso_interrupt iso_interrupt;
227 struct fw_cdev_event_iso_resource iso_resource; 393 struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */
394 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
395 struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */
228}; 396};
229 397
230/* available since kernel version 2.6.22 */ 398/* available since kernel version 2.6.22 */
@@ -256,23 +424,46 @@ union fw_cdev_event {
256/* available since kernel version 2.6.34 */ 424/* available since kernel version 2.6.34 */
257#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) 425#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
258 426
427/* available since kernel version 2.6.36 */
428#define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
429#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
430#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
431
259/* 432/*
260 * FW_CDEV_VERSION History 433 * ABI version history
261 * 1 (2.6.22) - initial version 434 * 1 (2.6.22) - initial version
435 * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER
262 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if 436 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
263 * &fw_cdev_create_iso_context.header_size is 8 or more 437 * &fw_cdev_create_iso_context.header_size is 8 or more
438 * - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
439 * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
440 * %FW_CDEV_IOC_SEND_STREAM_PACKET
264 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt 441 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
265 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of 442 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
266 * dual-buffer or packet-per-buffer depending on hardware 443 * dual-buffer or packet-per-buffer depending on hardware
444 * - shared use and auto-response for FCP registers
267 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable 445 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
446 * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
447 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
448 * and &fw_cdev_allocate.region_end
449 * - implemented &fw_cdev_event_bus_reset.bm_node_id
450 * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
451 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
452 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
453 * %FW_CDEV_IOC_SET_ISO_CHANNELS
268 */ 454 */
269#define FW_CDEV_VERSION 3 455#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
270 456
271/** 457/**
272 * struct fw_cdev_get_info - General purpose information ioctl 458 * struct fw_cdev_get_info - General purpose information ioctl
273 * @version: The version field is just a running serial number. 459 * @version: The version field is just a running serial number. Both an
274 * We never break backwards compatibility, but may add more 460 * input parameter (ABI version implemented by the client) and
275 * structs and ioctls in later revisions. 461 * output parameter (ABI version implemented by the kernel).
462 * A client must not fill in an %FW_CDEV_VERSION defined from an
463 * included kernel header file but the actual version for which
464 * the client was implemented. This is necessary for forward
465 * compatibility. We never break backwards compatibility, but
466 * may add more structs, events, and ioctls in later revisions.
276 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration 467 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
277 * ROM will be copied into that user space address. In either 468 * ROM will be copied into that user space address. In either
278 * case, @rom_length is updated with the actual length of the 469 * case, @rom_length is updated with the actual length of the
@@ -339,28 +530,48 @@ struct fw_cdev_send_response {
339}; 530};
340 531
341/** 532/**
342 * struct fw_cdev_allocate - Allocate a CSR address range 533 * struct fw_cdev_allocate - Allocate a CSR in an address range
343 * @offset: Start offset of the address range 534 * @offset: Start offset of the address range
344 * @closure: To be passed back to userspace in request events 535 * @closure: To be passed back to userspace in request events
345 * @length: Length of the address range, in bytes 536 * @length: Length of the CSR, in bytes
346 * @handle: Handle to the allocation, written by the kernel 537 * @handle: Handle to the allocation, written by the kernel
538 * @region_end: First address above the address range (added in ABI v4, 2.6.36)
347 * 539 *
348 * Allocate an address range in the 48-bit address space on the local node 540 * Allocate an address range in the 48-bit address space on the local node
349 * (the controller). This allows userspace to listen for requests with an 541 * (the controller). This allows userspace to listen for requests with an
350 * offset within that address range. When the kernel receives a request 542 * offset within that address range. Every time when the kernel receives a
351 * within the range, an &fw_cdev_event_request event will be written back. 543 * request within the range, an &fw_cdev_event_request2 event will be emitted.
352 * The @closure field is passed back to userspace in the response event. 544 * (If the kernel or the client implements ABI version <= 3, an
545 * &fw_cdev_event_request will be generated instead.)
546 *
547 * The @closure field is passed back to userspace in these request events.
353 * The @handle field is an out parameter, returning a handle to the allocated 548 * The @handle field is an out parameter, returning a handle to the allocated
354 * range to be used for later deallocation of the range. 549 * range to be used for later deallocation of the range.
355 * 550 *
356 * The address range is allocated on all local nodes. The address allocation 551 * The address range is allocated on all local nodes. The address allocation
357 * is exclusive except for the FCP command and response registers. 552 * is exclusive except for the FCP command and response registers. If an
553 * exclusive address region is already in use, the ioctl fails with errno set
554 * to %EBUSY.
555 *
556 * If kernel and client implement ABI version >= 4, the kernel looks up a free
557 * spot of size @length inside [@offset..@region_end) and, if found, writes
558 * the start address of the new CSR back in @offset. I.e. @offset is an
559 * in and out parameter. If this automatic placement of a CSR in a bigger
560 * address range is not desired, the client simply needs to set @region_end
561 * = @offset + @length.
562 *
563 * If the kernel or the client implements ABI version <= 3, @region_end is
564 * ignored and effectively assumed to be @offset + @length.
565 *
566 * @region_end is only present in a kernel header >= 2.6.36. If necessary,
567 * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
358 */ 568 */
359struct fw_cdev_allocate { 569struct fw_cdev_allocate {
360 __u64 offset; 570 __u64 offset;
361 __u64 closure; 571 __u64 closure;
362 __u32 length; 572 __u32 length;
363 __u32 handle; 573 __u32 handle;
574 __u64 region_end; /* available since kernel version 2.6.36 */
364}; 575};
365 576
366/** 577/**
@@ -382,9 +593,14 @@ struct fw_cdev_deallocate {
382 * Initiate a bus reset for the bus this device is on. The bus reset can be 593 * Initiate a bus reset for the bus this device is on. The bus reset can be
383 * either the original (long) bus reset or the arbitrated (short) bus reset 594 * either the original (long) bus reset or the arbitrated (short) bus reset
384 * introduced in 1394a-2000. 595 * introduced in 1394a-2000.
596 *
597 * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset
598 * indicates when the reset actually happened. Since ABI v4, this may be
599 * considerably later than the ioctl because the kernel ensures a grace period
600 * between subsequent bus resets as per IEEE 1394 bus management specification.
385 */ 601 */
386struct fw_cdev_initiate_bus_reset { 602struct fw_cdev_initiate_bus_reset {
387 __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */ 603 __u32 type;
388}; 604};
389 605
390/** 606/**
@@ -408,9 +624,10 @@ struct fw_cdev_initiate_bus_reset {
408 * 624 *
409 * @immediate, @key, and @data array elements are CPU-endian quadlets. 625 * @immediate, @key, and @data array elements are CPU-endian quadlets.
410 * 626 *
411 * If successful, the kernel adds the descriptor and writes back a handle to the 627 * If successful, the kernel adds the descriptor and writes back a @handle to
412 * kernel-side object to be used for later removal of the descriptor block and 628 * the kernel-side object to be used for later removal of the descriptor block
413 * immediate key. 629 * and immediate key. The kernel will also generate a bus reset to signal the
630 * change of the configuration ROM to other nodes.
414 * 631 *
415 * This ioctl affects the configuration ROMs of all local nodes. 632 * This ioctl affects the configuration ROMs of all local nodes.
416 * The ioctl only succeeds on device files which represent a local node. 633 * The ioctl only succeeds on device files which represent a local node.
@@ -429,38 +646,50 @@ struct fw_cdev_add_descriptor {
429 * descriptor was added 646 * descriptor was added
430 * 647 *
431 * Remove a descriptor block and accompanying immediate key from the local 648 * Remove a descriptor block and accompanying immediate key from the local
432 * nodes' configuration ROMs. 649 * nodes' configuration ROMs. The kernel will also generate a bus reset to
650 * signal the change of the configuration ROM to other nodes.
433 */ 651 */
434struct fw_cdev_remove_descriptor { 652struct fw_cdev_remove_descriptor {
435 __u32 handle; 653 __u32 handle;
436}; 654};
437 655
438#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0 656#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
439#define FW_CDEV_ISO_CONTEXT_RECEIVE 1 657#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
658#define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */
440 659
441/** 660/**
442 * struct fw_cdev_create_iso_context - Create a context for isochronous IO 661 * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
443 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE 662 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
444 * @header_size: Header size to strip for receive contexts 663 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
445 * @channel: Channel to bind to 664 * @header_size: Header size to strip in single-channel reception
446 * @speed: Speed for transmit contexts 665 * @channel: Channel to bind to in single-channel reception or transmission
447 * @closure: To be returned in &fw_cdev_event_iso_interrupt 666 * @speed: Transmission speed
667 * @closure: To be returned in &fw_cdev_event_iso_interrupt or
668 * &fw_cdev_event_iso_interrupt_multichannel
448 * @handle: Handle to context, written back by kernel 669 * @handle: Handle to context, written back by kernel
449 * 670 *
450 * Prior to sending or receiving isochronous I/O, a context must be created. 671 * Prior to sending or receiving isochronous I/O, a context must be created.
451 * The context records information about the transmit or receive configuration 672 * The context records information about the transmit or receive configuration
452 * and typically maps to an underlying hardware resource. A context is set up 673 * and typically maps to an underlying hardware resource. A context is set up
453 * for either sending or receiving. It is bound to a specific isochronous 674 * for either sending or receiving. It is bound to a specific isochronous
454 * channel. 675 * @channel.
676 *
677 * In case of multichannel reception, @header_size and @channel are ignored
678 * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
679 *
680 * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
681 * and must be a multiple of 4. It is ignored in other context types.
682 *
683 * @speed is ignored in receive context types.
455 * 684 *
456 * If a context was successfully created, the kernel writes back a handle to the 685 * If a context was successfully created, the kernel writes back a handle to the
457 * context, which must be passed in for subsequent operations on that context. 686 * context, which must be passed in for subsequent operations on that context.
458 * 687 *
459 * For receive contexts, @header_size must be at least 4 and must be a multiple 688 * Limitations:
460 * of 4. 689 * No more than one iso context can be created per fd.
461 * 690 * The total number of contexts that all userspace and kernelspace drivers can
462 * Note that the effect of a @header_size > 4 depends on 691 * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
463 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt. 692 * direction, and of them at most one multichannel receive context.
464 */ 693 */
465struct fw_cdev_create_iso_context { 694struct fw_cdev_create_iso_context {
466 __u32 type; 695 __u32 type;
@@ -471,6 +700,22 @@ struct fw_cdev_create_iso_context {
471 __u32 handle; 700 __u32 handle;
472}; 701};
473 702
703/**
704 * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
705 * @channels: Bitmask of channels to listen to
706 * @handle: Handle of the mutichannel receive context
707 *
708 * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
709 *
710 * The ioctl fails with errno %EBUSY if there is already another receive context
711 * on a channel in @channels. In that case, the bitmask of all unoccupied
712 * channels is returned in @channels.
713 */
714struct fw_cdev_set_iso_channels {
715 __u64 channels;
716 __u32 handle;
717};
718
474#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v) 719#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
475#define FW_CDEV_ISO_INTERRUPT (1 << 16) 720#define FW_CDEV_ISO_INTERRUPT (1 << 16)
476#define FW_CDEV_ISO_SKIP (1 << 17) 721#define FW_CDEV_ISO_SKIP (1 << 17)
@@ -481,42 +726,72 @@ struct fw_cdev_create_iso_context {
481 726
482/** 727/**
483 * struct fw_cdev_iso_packet - Isochronous packet 728 * struct fw_cdev_iso_packet - Isochronous packet
484 * @control: Contains the header length (8 uppermost bits), the sy field 729 * @control: Contains the header length (8 uppermost bits),
485 * (4 bits), the tag field (2 bits), a sync flag (1 bit), 730 * the sy field (4 bits), the tag field (2 bits), a sync flag
486 * a skip flag (1 bit), an interrupt flag (1 bit), and the 731 * or a skip flag (1 bit), an interrupt flag (1 bit), and the
487 * payload length (16 lowermost bits) 732 * payload length (16 lowermost bits)
488 * @header: Header and payload 733 * @header: Header and payload in case of a transmit context.
489 * 734 *
490 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues. 735 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
491 *
492 * Use the FW_CDEV_ISO_ macros to fill in @control. 736 * Use the FW_CDEV_ISO_ macros to fill in @control.
737 * The @header array is empty in case of receive contexts.
738 *
739 * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
740 *
741 * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of
742 * bytes in @header that will be prepended to the packet's payload. These bytes
743 * are copied into the kernel and will not be accessed after the ioctl has
744 * returned.
745 *
746 * The @control.SY and TAG fields are copied to the iso packet header. These
747 * fields are specified by IEEE 1394a and IEC 61883-1.
748 *
749 * The @control.SKIP flag specifies that no packet is to be sent in a frame.
750 * When using this, all other fields except @control.INTERRUPT must be zero.
751 *
752 * When a packet with the @control.INTERRUPT flag set has been completed, an
753 * &fw_cdev_event_iso_interrupt event will be sent.
754 *
755 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
756 *
757 * @control.HEADER_LENGTH must be a multiple of the context's header_size.
758 * If the HEADER_LENGTH is larger than the context's header_size, multiple
759 * packets are queued for this entry.
760 *
761 * The @control.SY and TAG fields are ignored.
762 *
763 * If the @control.SYNC flag is set, the context drops all packets until a
764 * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
765 *
766 * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
767 * one packet (in addition to payload quadlets that have been defined as headers
768 * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
769 * If more bytes are received, the additional bytes are dropped. If less bytes
770 * are received, the remaining bytes in this part of the payload buffer will not
771 * be written to, not even by the next packet. I.e., packets received in
772 * consecutive frames will not necessarily be consecutive in memory. If an
773 * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
774 * among them.
493 * 775 *
494 * For transmit packets, the header length must be a multiple of 4 and specifies 776 * When a packet with the @control.INTERRUPT flag set has been completed, an
495 * the numbers of bytes in @header that will be prepended to the packet's
496 * payload; these bytes are copied into the kernel and will not be accessed
497 * after the ioctl has returned. The sy and tag fields are copied to the iso
498 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
499 * The skip flag specifies that no packet is to be sent in a frame; when using
500 * this, all other fields except the interrupt flag must be zero.
501 *
502 * For receive packets, the header length must be a multiple of the context's
503 * header size; if the header length is larger than the context's header size,
504 * multiple packets are queued for this entry. The sy and tag fields are
505 * ignored. If the sync flag is set, the context drops all packets until
506 * a packet with a matching sy field is received (the sync value to wait for is
507 * specified in the &fw_cdev_start_iso structure). The payload length defines
508 * how many payload bytes can be received for one packet (in addition to payload
509 * quadlets that have been defined as headers and are stripped and returned in
510 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
511 * additional bytes are dropped. If less bytes are received, the remaining
512 * bytes in this part of the payload buffer will not be written to, not even by
513 * the next packet, i.e., packets received in consecutive frames will not
514 * necessarily be consecutive in memory. If an entry has queued multiple
515 * packets, the payload length is divided equally among them.
516 *
517 * When a packet with the interrupt flag set has been completed, the
518 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued 777 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
519 * multiple receive packets is completed when its last packet is completed. 778 * multiple receive packets is completed when its last packet is completed.
779 *
780 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
781 *
782 * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
783 * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
784 * of packets to be placed into the buffer chunk is not known beforehand.
785 *
786 * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
787 * for header, payload, padding, and trailer bytes of one or more packets.
788 * It must be a multiple of 4.
789 *
790 * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described
791 * for single-channel reception.
792 *
793 * When a buffer chunk with the @control.INTERRUPT flag set has been filled
794 * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
520 */ 795 */
521struct fw_cdev_iso_packet { 796struct fw_cdev_iso_packet {
522 __u32 control; 797 __u32 control;
@@ -525,9 +800,9 @@ struct fw_cdev_iso_packet {
525 800
526/** 801/**
527 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O 802 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
528 * @packets: Userspace pointer to packet data 803 * @packets: Userspace pointer to an array of &fw_cdev_iso_packet
529 * @data: Pointer into mmap()'ed payload buffer 804 * @data: Pointer into mmap()'ed payload buffer
530 * @size: Size of packet data in bytes 805 * @size: Size of the @packets array, in bytes
531 * @handle: Isochronous context handle 806 * @handle: Isochronous context handle
532 * 807 *
533 * Queue a number of isochronous packets for reception or transmission. 808 * Queue a number of isochronous packets for reception or transmission.
@@ -540,6 +815,9 @@ struct fw_cdev_iso_packet {
540 * The kernel may or may not queue all packets, but will write back updated 815 * The kernel may or may not queue all packets, but will write back updated
541 * values of the @packets, @data and @size fields, so the ioctl can be 816 * values of the @packets, @data and @size fields, so the ioctl can be
542 * resubmitted easily. 817 * resubmitted easily.
818 *
819 * In case of a multichannel receive context, @data must be quadlet-aligned
820 * relative to the buffer start.
543 */ 821 */
544struct fw_cdev_queue_iso { 822struct fw_cdev_queue_iso {
545 __u64 packets; 823 __u64 packets;
@@ -698,4 +976,39 @@ struct fw_cdev_send_stream_packet {
698 __u32 speed; 976 __u32 speed;
699}; 977};
700 978
979/**
980 * struct fw_cdev_send_phy_packet - send a PHY packet
981 * @closure: Passed back to userspace in the PHY-packet-sent event
982 * @data: First and second quadlet of the PHY packet
983 * @generation: The bus generation where packet is valid
984 *
985 * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
986 * on the same card as this device. After transmission, an
987 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
988 *
989 * The payload @data[] shall be specified in host byte order. Usually,
990 * @data[1] needs to be the bitwise inverse of @data[0]. VersaPHY packets
991 * are an exception to this rule.
992 *
993 * The ioctl is only permitted on device files which represent a local node.
994 */
995struct fw_cdev_send_phy_packet {
996 __u64 closure;
997 __u32 data[2];
998 __u32 generation;
999};
1000
1001/**
1002 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
1003 * @closure: Passed back to userspace in phy packet events
1004 *
1005 * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1006 * incoming PHY packets from any node on the same bus as the device.
1007 *
1008 * The ioctl is only permitted on device files which represent a local node.
1009 */
1010struct fw_cdev_receive_phy_packets {
1011 __u64 closure;
1012};
1013
701#endif /* _LINUX_FIREWIRE_CDEV_H */ 1014#endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 4bd94bf5e739..1cd637ef62d2 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -32,11 +32,13 @@
32#define CSR_CYCLE_TIME 0x200 32#define CSR_CYCLE_TIME 0x200
33#define CSR_BUS_TIME 0x204 33#define CSR_BUS_TIME 0x204
34#define CSR_BUSY_TIMEOUT 0x210 34#define CSR_BUSY_TIMEOUT 0x210
35#define CSR_PRIORITY_BUDGET 0x218
35#define CSR_BUS_MANAGER_ID 0x21c 36#define CSR_BUS_MANAGER_ID 0x21c
36#define CSR_BANDWIDTH_AVAILABLE 0x220 37#define CSR_BANDWIDTH_AVAILABLE 0x220
37#define CSR_CHANNELS_AVAILABLE 0x224 38#define CSR_CHANNELS_AVAILABLE 0x224
38#define CSR_CHANNELS_AVAILABLE_HI 0x224 39#define CSR_CHANNELS_AVAILABLE_HI 0x224
39#define CSR_CHANNELS_AVAILABLE_LO 0x228 40#define CSR_CHANNELS_AVAILABLE_LO 0x228
41#define CSR_MAINT_UTILITY 0x230
40#define CSR_BROADCAST_CHANNEL 0x234 42#define CSR_BROADCAST_CHANNEL 0x234
41#define CSR_CONFIG_ROM 0x400 43#define CSR_CONFIG_ROM 0x400
42#define CSR_CONFIG_ROM_END 0x800 44#define CSR_CONFIG_ROM_END 0x800
@@ -55,13 +57,11 @@
55#define CSR_DESCRIPTOR 0x01 57#define CSR_DESCRIPTOR 0x01
56#define CSR_VENDOR 0x03 58#define CSR_VENDOR 0x03
57#define CSR_HARDWARE_VERSION 0x04 59#define CSR_HARDWARE_VERSION 0x04
58#define CSR_NODE_CAPABILITIES 0x0c
59#define CSR_UNIT 0x11 60#define CSR_UNIT 0x11
60#define CSR_SPECIFIER_ID 0x12 61#define CSR_SPECIFIER_ID 0x12
61#define CSR_VERSION 0x13 62#define CSR_VERSION 0x13
62#define CSR_DEPENDENT_INFO 0x14 63#define CSR_DEPENDENT_INFO 0x14
63#define CSR_MODEL 0x17 64#define CSR_MODEL 0x17
64#define CSR_INSTANCE 0x18
65#define CSR_DIRECTORY_ID 0x20 65#define CSR_DIRECTORY_ID 0x20
66 66
67struct fw_csr_iterator { 67struct fw_csr_iterator {
@@ -89,9 +89,13 @@ struct fw_card {
89 int current_tlabel; 89 int current_tlabel;
90 u64 tlabel_mask; 90 u64 tlabel_mask;
91 struct list_head transaction_list; 91 struct list_head transaction_list;
92 struct timer_list flush_timer;
93 unsigned long reset_jiffies; 92 unsigned long reset_jiffies;
94 93
94 u32 split_timeout_hi;
95 u32 split_timeout_lo;
96 unsigned int split_timeout_cycles;
97 unsigned int split_timeout_jiffies;
98
95 unsigned long long guid; 99 unsigned long long guid;
96 unsigned max_receive; 100 unsigned max_receive;
97 int link_speed; 101 int link_speed;
@@ -107,18 +111,28 @@ struct fw_card {
107 bool beta_repeaters_present; 111 bool beta_repeaters_present;
108 112
109 int index; 113 int index;
110
111 struct list_head link; 114 struct list_head link;
112 115
113 /* Work struct for BM duties. */ 116 struct list_head phy_receiver_list;
114 struct delayed_work work; 117
118 struct delayed_work br_work; /* bus reset job */
119 bool br_short;
120
121 struct delayed_work bm_work; /* bus manager job */
115 int bm_retries; 122 int bm_retries;
116 int bm_generation; 123 int bm_generation;
117 __be32 bm_transaction_data[2]; 124 __be32 bm_transaction_data[2];
125 int bm_node_id;
126 bool bm_abdicate;
127
128 bool priority_budget_implemented; /* controller feature */
129 bool broadcast_channel_auto_allocated; /* controller feature */
118 130
119 bool broadcast_channel_allocated; 131 bool broadcast_channel_allocated;
120 u32 broadcast_channel; 132 u32 broadcast_channel;
121 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; 133 __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
134
135 __be32 maint_utility_register;
122}; 136};
123 137
124struct fw_attribute_group { 138struct fw_attribute_group {
@@ -255,7 +269,7 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
255typedef void (*fw_address_callback_t)(struct fw_card *card, 269typedef void (*fw_address_callback_t)(struct fw_card *card,
256 struct fw_request *request, 270 struct fw_request *request,
257 int tcode, int destination, int source, 271 int tcode, int destination, int source,
258 int generation, int speed, 272 int generation,
259 unsigned long long offset, 273 unsigned long long offset,
260 void *data, size_t length, 274 void *data, size_t length,
261 void *callback_data); 275 void *callback_data);
@@ -272,10 +286,10 @@ struct fw_packet {
272 u32 timestamp; 286 u32 timestamp;
273 287
274 /* 288 /*
275 * This callback is called when the packet transmission has 289 * This callback is called when the packet transmission has completed.
276 * completed; for successful transmission, the status code is 290 * For successful transmission, the status code is the ack received
277 * the ack received from the destination, otherwise it's a 291 * from the destination. Otherwise it is one of the juju-specific
278 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO. 292 * rcodes: RCODE_SEND_ERROR, _CANCELLED, _BUSY, _GENERATION, _NO_ACK.
279 * The callback can be called from tasklet context and thus 293 * The callback can be called from tasklet context and thus
280 * must never block. 294 * must never block.
281 */ 295 */
@@ -290,6 +304,8 @@ struct fw_transaction {
290 int tlabel; 304 int tlabel;
291 int timestamp; 305 int timestamp;
292 struct list_head link; 306 struct list_head link;
307 struct fw_card *card;
308 struct timer_list split_timeout_timer;
293 309
294 struct fw_packet packet; 310 struct fw_packet packet;
295 311
@@ -356,17 +372,19 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc);
356 * scatter-gather streaming (e.g. assembling video frame automatically). 372 * scatter-gather streaming (e.g. assembling video frame automatically).
357 */ 373 */
358struct fw_iso_packet { 374struct fw_iso_packet {
359 u16 payload_length; /* Length of indirect payload. */ 375 u16 payload_length; /* Length of indirect payload */
360 u32 interrupt:1; /* Generate interrupt on this packet */ 376 u32 interrupt:1; /* Generate interrupt on this packet */
361 u32 skip:1; /* Set to not send packet at all. */ 377 u32 skip:1; /* tx: Set to not send packet at all */
362 u32 tag:2; 378 /* rx: Sync bit, wait for matching sy */
363 u32 sy:4; 379 u32 tag:2; /* tx: Tag in packet header */
364 u32 header_length:8; /* Length of immediate header. */ 380 u32 sy:4; /* tx: Sy in packet header */
365 u32 header[0]; 381 u32 header_length:8; /* Length of immediate header */
382 u32 header[0]; /* tx: Top of 1394 isoch. data_block */
366}; 383};
367 384
368#define FW_ISO_CONTEXT_TRANSMIT 0 385#define FW_ISO_CONTEXT_TRANSMIT 0
369#define FW_ISO_CONTEXT_RECEIVE 1 386#define FW_ISO_CONTEXT_RECEIVE 1
387#define FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2
370 388
371#define FW_ISO_CONTEXT_MATCH_TAG0 1 389#define FW_ISO_CONTEXT_MATCH_TAG0 1
372#define FW_ISO_CONTEXT_MATCH_TAG1 2 390#define FW_ISO_CONTEXT_MATCH_TAG1 2
@@ -390,24 +408,31 @@ struct fw_iso_buffer {
390int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, 408int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
391 int page_count, enum dma_data_direction direction); 409 int page_count, enum dma_data_direction direction);
392void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); 410void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
411size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed);
393 412
394struct fw_iso_context; 413struct fw_iso_context;
395typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, 414typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
396 u32 cycle, size_t header_length, 415 u32 cycle, size_t header_length,
397 void *header, void *data); 416 void *header, void *data);
417typedef void (*fw_iso_mc_callback_t)(struct fw_iso_context *context,
418 dma_addr_t completed, void *data);
398struct fw_iso_context { 419struct fw_iso_context {
399 struct fw_card *card; 420 struct fw_card *card;
400 int type; 421 int type;
401 int channel; 422 int channel;
402 int speed; 423 int speed;
403 size_t header_size; 424 size_t header_size;
404 fw_iso_callback_t callback; 425 union {
426 fw_iso_callback_t sc;
427 fw_iso_mc_callback_t mc;
428 } callback;
405 void *callback_data; 429 void *callback_data;
406}; 430};
407 431
408struct fw_iso_context *fw_iso_context_create(struct fw_card *card, 432struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
409 int type, int channel, int speed, size_t header_size, 433 int type, int channel, int speed, size_t header_size,
410 fw_iso_callback_t callback, void *callback_data); 434 fw_iso_callback_t callback, void *callback_data);
435int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels);
411int fw_iso_context_queue(struct fw_iso_context *ctx, 436int fw_iso_context_queue(struct fw_iso_context *ctx,
412 struct fw_iso_packet *packet, 437 struct fw_iso_packet *packet,
413 struct fw_iso_buffer *buffer, 438 struct fw_iso_buffer *buffer,
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 043811f0d277..53d1e6c4f848 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -12,6 +12,7 @@
12struct firmware { 12struct firmware {
13 size_t size; 13 size_t size;
14 const u8 *data; 14 const u8 *data;
15 struct page **pages;
15}; 16};
16 17
17struct device; 18struct device;
diff --git a/include/linux/flex_array.h b/include/linux/flex_array.h
index 1d747f72298b..631b77f2ac70 100644
--- a/include/linux/flex_array.h
+++ b/include/linux/flex_array.h
@@ -70,4 +70,9 @@ int flex_array_clear(struct flex_array *fa, unsigned int element_nr);
70void *flex_array_get(struct flex_array *fa, unsigned int element_nr); 70void *flex_array_get(struct flex_array *fa, unsigned int element_nr);
71int flex_array_shrink(struct flex_array *fa); 71int flex_array_shrink(struct flex_array *fa);
72 72
73#define flex_array_put_ptr(fa, nr, src, gfp) \
74 flex_array_put(fa, nr, &(void *)(src), gfp)
75
76void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr);
77
73#endif /* _FLEX_ARRAY_H */ 78#endif /* _FLEX_ARRAY_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 44f35aea2f1f..267d02630517 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
11 12
12/* 13/*
13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -53,6 +54,7 @@ struct inodes_stat_t {
53#define MAY_APPEND 8 54#define MAY_APPEND 8
54#define MAY_ACCESS 16 55#define MAY_ACCESS 16
55#define MAY_OPEN 32 56#define MAY_OPEN 32
57#define MAY_CHDIR 64
56 58
57/* 59/*
58 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 60 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
@@ -90,6 +92,9 @@ struct inodes_stat_t {
90/* Expect random access pattern */ 92/* Expect random access pattern */
91#define FMODE_RANDOM ((__force fmode_t)0x1000) 93#define FMODE_RANDOM ((__force fmode_t)0x1000)
92 94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
97
93/* 98/*
94 * The below are the various read and write types that we support. Some of 99 * The below are the various read and write types that we support. Some of
95 * them include behavioral modifiers that send information down to the 100 * them include behavioral modifiers that send information down to the
@@ -117,7 +122,7 @@ struct inodes_stat_t {
117 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
118 * unplugging. 123 * unplugging.
119 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
120 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
121 * request if it runs into resource problems. 126 * request if it runs into resource problems.
122 * WRITE A normal async write. Device will be plugged. 127 * WRITE A normal async write. Device will be plugged.
123 * SWRITE Like WRITE, but a special case for ll_rw_block() that 128 * SWRITE Like WRITE, but a special case for ll_rw_block() that
@@ -136,7 +141,7 @@ struct inodes_stat_t {
136 * SWRITE_SYNC 141 * SWRITE_SYNC
137 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. 142 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
138 * See SWRITE. 143 * See SWRITE.
139 * WRITE_BARRIER Like WRITE, but tells the block layer that all 144 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
140 * previously submitted writes must be safely on storage 145 * previously submitted writes must be safely on storage
141 * before this one is started. Also guarantees that when 146 * before this one is started. Also guarantees that when
142 * this write is complete, it itself is also safely on 147 * this write is complete, it itself is also safely on
@@ -144,29 +149,31 @@ struct inodes_stat_t {
144 * of this IO. 149 * of this IO.
145 * 150 *
146 */ 151 */
147#define RW_MASK 1 152#define RW_MASK REQ_WRITE
148#define RWA_MASK 2 153#define RWA_MASK REQ_RAHEAD
149#define READ 0 154
150#define WRITE 1 155#define READ 0
151#define READA 2 /* read-ahead - don't block if no resources */ 156#define WRITE RW_MASK
152#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 157#define READA RWA_MASK
153#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 158#define SWRITE (WRITE | READA)
154#define READ_META (READ | (1 << BIO_RW_META)) 159
155#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 160#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
156#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 161#define READ_META (READ | REQ_META)
157#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 162#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
158#define WRITE_META (WRITE | (1 << BIO_RW_META)) 163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
159#define SWRITE_SYNC_PLUG \ 164#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
160 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 165#define WRITE_META (WRITE | REQ_META)
161#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 166#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
162#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 167 REQ_HARDBARRIER)
168#define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE)
169#define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
163 170
164/* 171/*
165 * These aren't really reads or writes, they pass down information about 172 * These aren't really reads or writes, they pass down information about
166 * parts of device that are now unused by the file system. 173 * parts of device that are now unused by the file system.
167 */ 174 */
168#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 175#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
169#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 176#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
170 177
171#define SEL_IN 1 178#define SEL_IN 1
172#define SEL_OUT 2 179#define SEL_OUT 2
@@ -209,6 +216,7 @@ struct inodes_stat_t {
209#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 216#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
210#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 217#define MS_I_VERSION (1<<23) /* Update inode I_version field */
211#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 218#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
219#define MS_BORN (1<<29)
212#define MS_ACTIVE (1<<30) 220#define MS_ACTIVE (1<<30)
213#define MS_NOUSER (1<<31) 221#define MS_NOUSER (1<<31)
214 222
@@ -407,15 +415,13 @@ extern int get_max_files(void);
407extern int sysctl_nr_open; 415extern int sysctl_nr_open;
408extern struct inodes_stat_t inodes_stat; 416extern struct inodes_stat_t inodes_stat;
409extern int leases_enable, lease_break_time; 417extern int leases_enable, lease_break_time;
410#ifdef CONFIG_DNOTIFY
411extern int dir_notify_enable;
412#endif
413 418
414struct buffer_head; 419struct buffer_head;
415typedef int (get_block_t)(struct inode *inode, sector_t iblock, 420typedef int (get_block_t)(struct inode *inode, sector_t iblock,
416 struct buffer_head *bh_result, int create); 421 struct buffer_head *bh_result, int create);
417typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 422typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
418 ssize_t bytes, void *private); 423 ssize_t bytes, void *private, int ret,
424 bool is_async);
419 425
420/* 426/*
421 * Attribute flags. These should be or-ed together to figure out what 427 * Attribute flags. These should be or-ed together to figure out what
@@ -651,6 +657,7 @@ struct block_device {
651 int bd_openers; 657 int bd_openers;
652 struct mutex bd_mutex; /* open/close mutex */ 658 struct mutex bd_mutex; /* open/close mutex */
653 struct list_head bd_inodes; 659 struct list_head bd_inodes;
660 void * bd_claiming;
654 void * bd_holder; 661 void * bd_holder;
655 int bd_holders; 662 int bd_holders;
656#ifdef CONFIG_SYSFS 663#ifdef CONFIG_SYSFS
@@ -684,6 +691,7 @@ struct block_device {
684 */ 691 */
685#define PAGECACHE_TAG_DIRTY 0 692#define PAGECACHE_TAG_DIRTY 0
686#define PAGECACHE_TAG_WRITEBACK 1 693#define PAGECACHE_TAG_WRITEBACK 1
694#define PAGECACHE_TAG_TOWRITE 2
687 695
688int mapping_tagged(struct address_space *mapping, int tag); 696int mapping_tagged(struct address_space *mapping, int tag);
689 697
@@ -767,12 +775,7 @@ struct inode {
767 775
768#ifdef CONFIG_FSNOTIFY 776#ifdef CONFIG_FSNOTIFY
769 __u32 i_fsnotify_mask; /* all events this inode cares about */ 777 __u32 i_fsnotify_mask; /* all events this inode cares about */
770 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 778 struct hlist_head i_fsnotify_marks;
771#endif
772
773#ifdef CONFIG_INOTIFY
774 struct list_head inotify_watches; /* watches on this inode */
775 struct mutex inotify_mutex; /* protects the watches list */
776#endif 779#endif
777 780
778 unsigned long i_state; 781 unsigned long i_state;
@@ -953,6 +956,7 @@ extern spinlock_t files_lock;
953#define file_list_unlock() spin_unlock(&files_lock); 956#define file_list_unlock() spin_unlock(&files_lock);
954 957
955#define get_file(x) atomic_long_inc(&(x)->f_count) 958#define get_file(x) atomic_long_inc(&(x)->f_count)
959#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
956#define file_count(x) atomic_long_read(&(x)->f_count) 960#define file_count(x) atomic_long_read(&(x)->f_count)
957 961
958#ifdef CONFIG_DEBUG_WRITECOUNT 962#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1280,10 +1284,12 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1280 1284
1281 1285
1282struct fasync_struct { 1286struct fasync_struct {
1283 int magic; 1287 spinlock_t fa_lock;
1284 int fa_fd; 1288 int magic;
1285 struct fasync_struct *fa_next; /* singly linked list */ 1289 int fa_fd;
1286 struct file *fa_file; 1290 struct fasync_struct *fa_next; /* singly linked list */
1291 struct file *fa_file;
1292 struct rcu_head fa_rcu;
1287}; 1293};
1288 1294
1289#define FASYNC_MAGIC 0x4601 1295#define FASYNC_MAGIC 0x4601
@@ -1292,8 +1298,6 @@ struct fasync_struct {
1292extern int fasync_helper(int, struct file *, int, struct fasync_struct **); 1298extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1293/* can be called from interrupts */ 1299/* can be called from interrupts */
1294extern void kill_fasync(struct fasync_struct **, int, int); 1300extern void kill_fasync(struct fasync_struct **, int, int);
1295/* only for net: no internal synchronization */
1296extern void __kill_fasync(struct fasync_struct *, int, int);
1297 1301
1298extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1302extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1299extern int f_setown(struct file *filp, unsigned long arg, int force); 1303extern int f_setown(struct file *filp, unsigned long arg, int force);
@@ -1314,8 +1318,6 @@ extern int send_sigurg(struct fown_struct *fown);
1314extern struct list_head super_blocks; 1318extern struct list_head super_blocks;
1315extern spinlock_t sb_lock; 1319extern spinlock_t sb_lock;
1316 1320
1317#define sb_entry(list) list_entry((list), struct super_block, s_list)
1318#define S_BIAS (1<<30)
1319struct super_block { 1321struct super_block {
1320 struct list_head s_list; /* Keep this first */ 1322 struct list_head s_list; /* Keep this first */
1321 dev_t s_dev; /* search index; _not_ kdev_t */ 1323 dev_t s_dev; /* search index; _not_ kdev_t */
@@ -1334,12 +1336,11 @@ struct super_block {
1334 struct rw_semaphore s_umount; 1336 struct rw_semaphore s_umount;
1335 struct mutex s_lock; 1337 struct mutex s_lock;
1336 int s_count; 1338 int s_count;
1337 int s_need_sync;
1338 atomic_t s_active; 1339 atomic_t s_active;
1339#ifdef CONFIG_SECURITY 1340#ifdef CONFIG_SECURITY
1340 void *s_security; 1341 void *s_security;
1341#endif 1342#endif
1342 struct xattr_handler **s_xattr; 1343 const struct xattr_handler **s_xattr;
1343 1344
1344 struct list_head s_inodes; /* all inodes */ 1345 struct list_head s_inodes; /* all inodes */
1345 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1346 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
@@ -1431,7 +1432,8 @@ extern void dentry_unhash(struct dentry *dentry);
1431 * VFS file helper functions. 1432 * VFS file helper functions.
1432 */ 1433 */
1433extern int file_permission(struct file *, int); 1434extern int file_permission(struct file *, int);
1434 1435extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1436 mode_t mode);
1435/* 1437/*
1436 * VFS FS_IOC_FIEMAP helper definitions. 1438 * VFS FS_IOC_FIEMAP helper definitions.
1437 */ 1439 */
@@ -1498,7 +1500,7 @@ struct file_operations {
1498 int (*open) (struct inode *, struct file *); 1500 int (*open) (struct inode *, struct file *);
1499 int (*flush) (struct file *, fl_owner_t id); 1501 int (*flush) (struct file *, fl_owner_t id);
1500 int (*release) (struct inode *, struct file *); 1502 int (*release) (struct inode *, struct file *);
1501 int (*fsync) (struct file *, struct dentry *, int datasync); 1503 int (*fsync) (struct file *, int datasync);
1502 int (*aio_fsync) (struct kiocb *, int datasync); 1504 int (*aio_fsync) (struct kiocb *, int datasync);
1503 int (*fasync) (int, struct file *, int); 1505 int (*fasync) (int, struct file *, int);
1504 int (*lock) (struct file *, int, struct file_lock *); 1506 int (*lock) (struct file *, int, struct file_lock *);
@@ -1561,8 +1563,8 @@ struct super_operations {
1561 1563
1562 void (*dirty_inode) (struct inode *); 1564 void (*dirty_inode) (struct inode *);
1563 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1565 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1564 void (*drop_inode) (struct inode *); 1566 int (*drop_inode) (struct inode *);
1565 void (*delete_inode) (struct inode *); 1567 void (*evict_inode) (struct inode *);
1566 void (*put_super) (struct super_block *); 1568 void (*put_super) (struct super_block *);
1567 void (*write_super) (struct super_block *); 1569 void (*write_super) (struct super_block *);
1568 int (*sync_fs)(struct super_block *sb, int wait); 1570 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1570,7 +1572,6 @@ struct super_operations {
1570 int (*unfreeze_fs) (struct super_block *); 1572 int (*unfreeze_fs) (struct super_block *);
1571 int (*statfs) (struct dentry *, struct kstatfs *); 1573 int (*statfs) (struct dentry *, struct kstatfs *);
1572 int (*remount_fs) (struct super_block *, int *, char *); 1574 int (*remount_fs) (struct super_block *, int *, char *);
1573 void (*clear_inode) (struct inode *);
1574 void (*umount_begin) (struct super_block *); 1575 void (*umount_begin) (struct super_block *);
1575 1576
1576 int (*show_options)(struct seq_file *, struct vfsmount *); 1577 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1615,8 +1616,8 @@ struct super_operations {
1615 * I_FREEING Set when inode is about to be freed but still has dirty 1616 * I_FREEING Set when inode is about to be freed but still has dirty
1616 * pages or buffers attached or the inode itself is still 1617 * pages or buffers attached or the inode itself is still
1617 * dirty. 1618 * dirty.
1618 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1619 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1619 * and can be destroyed. 1620 * and can be destroyed. Inode keeps I_FREEING.
1620 * 1621 *
1621 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1622 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1622 * prohibited for many purposes. iget() must wait for 1623 * prohibited for many purposes. iget() must wait for
@@ -1744,6 +1745,7 @@ struct file_system_type {
1744 1745
1745 struct lock_class_key s_lock_key; 1746 struct lock_class_key s_lock_key;
1746 struct lock_class_key s_umount_key; 1747 struct lock_class_key s_umount_key;
1748 struct lock_class_key s_vfs_rename_key;
1747 1749
1748 struct lock_class_key i_lock_key; 1750 struct lock_class_key i_lock_key;
1749 struct lock_class_key i_mutex_key; 1751 struct lock_class_key i_mutex_key;
@@ -1781,8 +1783,19 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1781 const struct super_operations *ops, unsigned long, 1783 const struct super_operations *ops, unsigned long,
1782 struct vfsmount *mnt); 1784 struct vfsmount *mnt);
1783extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1785extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1784int __put_super_and_need_restart(struct super_block *sb); 1786
1785void put_super(struct super_block *sb); 1787static inline void sb_mark_dirty(struct super_block *sb)
1788{
1789 sb->s_dirt = 1;
1790}
1791static inline void sb_mark_clean(struct super_block *sb)
1792{
1793 sb->s_dirt = 0;
1794}
1795static inline int sb_is_dirty(struct super_block *sb)
1796{
1797 return sb->s_dirt;
1798}
1786 1799
1787/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1800/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1788#define fops_get(fops) \ 1801#define fops_get(fops) \
@@ -1801,7 +1814,10 @@ extern struct vfsmount *collect_mounts(struct path *);
1801extern void drop_collected_mounts(struct vfsmount *); 1814extern void drop_collected_mounts(struct vfsmount *);
1802extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1815extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1803 struct vfsmount *); 1816 struct vfsmount *);
1804extern int vfs_statfs(struct dentry *, struct kstatfs *); 1817extern int vfs_statfs(struct path *, struct kstatfs *);
1818extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1819extern int freeze_super(struct super_block *super);
1820extern int thaw_super(struct super_block *super);
1805 1821
1806extern int current_umask(void); 1822extern int current_umask(void);
1807 1823
@@ -2087,9 +2103,9 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2087extern int filemap_fdatawrite_range(struct address_space *mapping, 2103extern int filemap_fdatawrite_range(struct address_space *mapping,
2088 loff_t start, loff_t end); 2104 loff_t start, loff_t end);
2089 2105
2090extern int vfs_fsync_range(struct file *file, struct dentry *dentry, 2106extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2091 loff_t start, loff_t end, int datasync); 2107 int datasync);
2092extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2108extern int vfs_fsync(struct file *file, int datasync);
2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2109extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2094extern void sync_supers(void); 2110extern void sync_supers(void);
2095extern void emergency_sync(void); 2111extern void emergency_sync(void);
@@ -2149,9 +2165,8 @@ extern void iput(struct inode *);
2149extern struct inode * igrab(struct inode *); 2165extern struct inode * igrab(struct inode *);
2150extern ino_t iunique(struct super_block *, ino_t); 2166extern ino_t iunique(struct super_block *, ino_t);
2151extern int inode_needs_sync(struct inode *inode); 2167extern int inode_needs_sync(struct inode *inode);
2152extern void generic_delete_inode(struct inode *inode); 2168extern int generic_delete_inode(struct inode *inode);
2153extern void generic_drop_inode(struct inode *inode); 2169extern int generic_drop_inode(struct inode *inode);
2154extern int generic_detach_inode(struct inode *inode);
2155 2170
2156extern struct inode *ilookup5_nowait(struct super_block *sb, 2171extern struct inode *ilookup5_nowait(struct super_block *sb,
2157 unsigned long hashval, int (*test)(struct inode *, void *), 2172 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2168,7 +2183,7 @@ extern void unlock_new_inode(struct inode *);
2168 2183
2169extern void __iget(struct inode * inode); 2184extern void __iget(struct inode * inode);
2170extern void iget_failed(struct inode *); 2185extern void iget_failed(struct inode *);
2171extern void clear_inode(struct inode *); 2186extern void end_writeback(struct inode *);
2172extern void destroy_inode(struct inode *); 2187extern void destroy_inode(struct inode *);
2173extern void __destroy_inode(struct inode *); 2188extern void __destroy_inode(struct inode *);
2174extern struct inode *new_inode(struct super_block *); 2189extern struct inode *new_inode(struct super_block *);
@@ -2184,7 +2199,6 @@ static inline void insert_inode_hash(struct inode *inode) {
2184extern void file_move(struct file *f, struct list_head *list); 2199extern void file_move(struct file *f, struct list_head *list);
2185extern void file_kill(struct file *f); 2200extern void file_kill(struct file *f);
2186#ifdef CONFIG_BLOCK 2201#ifdef CONFIG_BLOCK
2187struct bio;
2188extern void submit_bio(int, struct bio *); 2202extern void submit_bio(int, struct bio *);
2189extern int bdev_read_only(struct block_device *); 2203extern int bdev_read_only(struct block_device *);
2190#endif 2204#endif
@@ -2212,7 +2226,7 @@ extern int generic_segment_checks(const struct iovec *iov,
2212/* fs/block_dev.c */ 2226/* fs/block_dev.c */
2213extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2227extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2214 unsigned long nr_segs, loff_t pos); 2228 unsigned long nr_segs, loff_t pos);
2215extern int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync); 2229extern int blkdev_fsync(struct file *filp, int datasync);
2216 2230
2217/* fs/splice.c */ 2231/* fs/splice.c */
2218extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2232extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2228,6 +2242,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2228 2242
2229extern void 2243extern void
2230file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2244file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2245extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
2231extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2246extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2232extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2247extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2233extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, 2248extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
@@ -2250,10 +2265,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2250#endif 2265#endif
2251 2266
2252#ifdef CONFIG_BLOCK 2267#ifdef CONFIG_BLOCK
2253ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2268typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2254 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2269 loff_t file_offset);
2255 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2256 int lock_type);
2257 2270
2258enum { 2271enum {
2259 /* need locking between buffered and direct access */ 2272 /* need locking between buffered and direct access */
@@ -2263,24 +2276,22 @@ enum {
2263 DIO_SKIP_HOLES = 0x02, 2276 DIO_SKIP_HOLES = 0x02,
2264}; 2277};
2265 2278
2279void dio_end_io(struct bio *bio, int error);
2280
2281ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2282 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2283 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2284 dio_submit_t submit_io, int flags);
2285
2266static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2286static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2267 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2287 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2268 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2288 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2269 dio_iodone_t end_io) 2289 dio_iodone_t end_io)
2270{ 2290{
2271 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2291 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2272 nr_segs, get_block, end_io, 2292 nr_segs, get_block, end_io, NULL,
2273 DIO_LOCKING | DIO_SKIP_HOLES); 2293 DIO_LOCKING | DIO_SKIP_HOLES);
2274} 2294}
2275
2276static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2277 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2278 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2279 dio_iodone_t end_io)
2280{
2281 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2282 nr_segs, get_block, end_io, 0);
2283}
2284#endif 2295#endif
2285 2296
2286extern const struct file_operations generic_ro_fops; 2297extern const struct file_operations generic_ro_fops;
@@ -2329,18 +2340,20 @@ extern struct super_block *get_super(struct block_device *);
2329extern struct super_block *get_active_super(struct block_device *bdev); 2340extern struct super_block *get_active_super(struct block_device *bdev);
2330extern struct super_block *user_get_super(dev_t); 2341extern struct super_block *user_get_super(dev_t);
2331extern void drop_super(struct super_block *sb); 2342extern void drop_super(struct super_block *sb);
2343extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2332 2344
2333extern int dcache_dir_open(struct inode *, struct file *); 2345extern int dcache_dir_open(struct inode *, struct file *);
2334extern int dcache_dir_close(struct inode *, struct file *); 2346extern int dcache_dir_close(struct inode *, struct file *);
2335extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2347extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2336extern int dcache_readdir(struct file *, void *, filldir_t); 2348extern int dcache_readdir(struct file *, void *, filldir_t);
2349extern int simple_setattr(struct dentry *, struct iattr *);
2337extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2350extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2338extern int simple_statfs(struct dentry *, struct kstatfs *); 2351extern int simple_statfs(struct dentry *, struct kstatfs *);
2339extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2352extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2340extern int simple_unlink(struct inode *, struct dentry *); 2353extern int simple_unlink(struct inode *, struct dentry *);
2341extern int simple_rmdir(struct inode *, struct dentry *); 2354extern int simple_rmdir(struct inode *, struct dentry *);
2342extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2355extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2343extern int simple_sync_file(struct file *, struct dentry *, int); 2356extern int noop_fsync(struct file *, int);
2344extern int simple_empty(struct dentry *); 2357extern int simple_empty(struct dentry *);
2345extern int simple_readpage(struct file *file, struct page *page); 2358extern int simple_readpage(struct file *file, struct page *page);
2346extern int simple_write_begin(struct file *file, struct address_space *mapping, 2359extern int simple_write_begin(struct file *file, struct address_space *mapping,
@@ -2356,14 +2369,16 @@ extern const struct file_operations simple_dir_operations;
2356extern const struct inode_operations simple_dir_inode_operations; 2369extern const struct inode_operations simple_dir_inode_operations;
2357struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 2370struct tree_descr { char *name; const struct file_operations *ops; int mode; };
2358struct dentry *d_alloc_name(struct dentry *, const char *); 2371struct dentry *d_alloc_name(struct dentry *, const char *);
2359extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 2372extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *);
2360extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 2373extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2361extern void simple_release_fs(struct vfsmount **mount, int *count); 2374extern void simple_release_fs(struct vfsmount **mount, int *count);
2362 2375
2363extern ssize_t simple_read_from_buffer(void __user *to, size_t count, 2376extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2364 loff_t *ppos, const void *from, size_t available); 2377 loff_t *ppos, const void *from, size_t available);
2378extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2379 const void __user *from, size_t count);
2365 2380
2366extern int simple_fsync(struct file *, struct dentry *, int); 2381extern int generic_file_fsync(struct file *, int);
2367 2382
2368#ifdef CONFIG_MIGRATION 2383#ifdef CONFIG_MIGRATION
2369extern int buffer_migrate_page(struct address_space *, 2384extern int buffer_migrate_page(struct address_space *,
@@ -2374,7 +2389,7 @@ extern int buffer_migrate_page(struct address_space *,
2374 2389
2375extern int inode_change_ok(const struct inode *, struct iattr *); 2390extern int inode_change_ok(const struct inode *, struct iattr *);
2376extern int inode_newsize_ok(const struct inode *, loff_t offset); 2391extern int inode_newsize_ok(const struct inode *, loff_t offset);
2377extern int __must_check inode_setattr(struct inode *, struct iattr *); 2392extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2378 2393
2379extern void file_update_time(struct file *file); 2394extern void file_update_time(struct file *file);
2380 2395
@@ -2465,7 +2480,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2465int __init get_filesystem_list(char *buf); 2480int __init get_filesystem_list(char *buf);
2466 2481
2467#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2482#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2468#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2483#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2484 (flag & FMODE_NONOTIFY)))
2469 2485
2470#endif /* __KERNEL__ */ 2486#endif /* __KERNEL__ */
2471#endif /* _LINUX_FS_H */ 2487#endif /* _LINUX_FS_H */
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index c57db27ac861..b8581c09d19f 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -20,7 +20,7 @@
20 20
21#include <linux/fscache.h> 21#include <linux/fscache.h>
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/slow-work.h> 23#include <linux/workqueue.h>
24 24
25#define NR_MAXCACHES BITS_PER_LONG 25#define NR_MAXCACHES BITS_PER_LONG
26 26
@@ -76,18 +76,14 @@ typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); 76typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
77 77
78struct fscache_operation { 78struct fscache_operation {
79 union { 79 struct work_struct work; /* record for async ops */
80 struct work_struct fast_work; /* record for fast ops */
81 struct slow_work slow_work; /* record for (very) slow ops */
82 };
83 struct list_head pend_link; /* link in object->pending_ops */ 80 struct list_head pend_link; /* link in object->pending_ops */
84 struct fscache_object *object; /* object to be operated upon */ 81 struct fscache_object *object; /* object to be operated upon */
85 82
86 unsigned long flags; 83 unsigned long flags;
87#define FSCACHE_OP_TYPE 0x000f /* operation type */ 84#define FSCACHE_OP_TYPE 0x000f /* operation type */
88#define FSCACHE_OP_FAST 0x0001 /* - fast op, processor may not sleep for disk */ 85#define FSCACHE_OP_ASYNC 0x0001 /* - async op, processor may sleep for disk */
89#define FSCACHE_OP_SLOW 0x0002 /* - (very) slow op, processor may sleep for disk */ 86#define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */
90#define FSCACHE_OP_MYTHREAD 0x0003 /* - processing is done be issuing thread, not pool */
91#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ 87#define FSCACHE_OP_WAITING 4 /* cleared when op is woken */
92#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ 88#define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */
93#define FSCACHE_OP_DEAD 6 /* op is now dead */ 89#define FSCACHE_OP_DEAD 6 /* op is now dead */
@@ -105,7 +101,8 @@ struct fscache_operation {
105 /* operation releaser */ 101 /* operation releaser */
106 fscache_operation_release_t release; 102 fscache_operation_release_t release;
107 103
108#ifdef CONFIG_SLOW_WORK_DEBUG 104#ifdef CONFIG_WORKQUEUE_DEBUGFS
105 struct work_struct put_work; /* work to delay operation put */
109 const char *name; /* operation name */ 106 const char *name; /* operation name */
110 const char *state; /* operation state */ 107 const char *state; /* operation state */
111#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) 108#define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0)
@@ -117,7 +114,7 @@ struct fscache_operation {
117}; 114};
118 115
119extern atomic_t fscache_op_debug_id; 116extern atomic_t fscache_op_debug_id;
120extern const struct slow_work_ops fscache_op_slow_work_ops; 117extern void fscache_op_work_func(struct work_struct *work);
121 118
122extern void fscache_enqueue_operation(struct fscache_operation *); 119extern void fscache_enqueue_operation(struct fscache_operation *);
123extern void fscache_put_operation(struct fscache_operation *); 120extern void fscache_put_operation(struct fscache_operation *);
@@ -128,33 +125,21 @@ extern void fscache_put_operation(struct fscache_operation *);
128 * @release: The release function to assign 125 * @release: The release function to assign
129 * 126 *
130 * Do basic initialisation of an operation. The caller must still set flags, 127 * Do basic initialisation of an operation. The caller must still set flags,
131 * object, either fast_work or slow_work if necessary, and processor if needed. 128 * object and processor if needed.
132 */ 129 */
133static inline void fscache_operation_init(struct fscache_operation *op, 130static inline void fscache_operation_init(struct fscache_operation *op,
134 fscache_operation_release_t release) 131 fscache_operation_processor_t processor,
132 fscache_operation_release_t release)
135{ 133{
134 INIT_WORK(&op->work, fscache_op_work_func);
136 atomic_set(&op->usage, 1); 135 atomic_set(&op->usage, 1);
137 op->debug_id = atomic_inc_return(&fscache_op_debug_id); 136 op->debug_id = atomic_inc_return(&fscache_op_debug_id);
137 op->processor = processor;
138 op->release = release; 138 op->release = release;
139 INIT_LIST_HEAD(&op->pend_link); 139 INIT_LIST_HEAD(&op->pend_link);
140 fscache_set_op_state(op, "Init"); 140 fscache_set_op_state(op, "Init");
141} 141}
142 142
143/**
144 * fscache_operation_init_slow - Do additional initialisation of a slow op
145 * @op: The operation to initialise
146 * @processor: The processor function to assign
147 *
148 * Do additional initialisation of an operation as required for slow work.
149 */
150static inline
151void fscache_operation_init_slow(struct fscache_operation *op,
152 fscache_operation_processor_t processor)
153{
154 op->processor = processor;
155 slow_work_init(&op->slow_work, &fscache_op_slow_work_ops);
156}
157
158/* 143/*
159 * data read operation 144 * data read operation
160 */ 145 */
@@ -389,7 +374,7 @@ struct fscache_object {
389 struct fscache_cache *cache; /* cache that supplied this object */ 374 struct fscache_cache *cache; /* cache that supplied this object */
390 struct fscache_cookie *cookie; /* netfs's file/index object */ 375 struct fscache_cookie *cookie; /* netfs's file/index object */
391 struct fscache_object *parent; /* parent object */ 376 struct fscache_object *parent; /* parent object */
392 struct slow_work work; /* attention scheduling record */ 377 struct work_struct work; /* attention scheduling record */
393 struct list_head dependents; /* FIFO of dependent objects */ 378 struct list_head dependents; /* FIFO of dependent objects */
394 struct list_head dep_link; /* link in parent's dependents list */ 379 struct list_head dep_link; /* link in parent's dependents list */
395 struct list_head pending_ops; /* unstarted operations on this object */ 380 struct list_head pending_ops; /* unstarted operations on this object */
@@ -411,7 +396,7 @@ extern const char *fscache_object_states[];
411 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ 396 (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \
412 (obj)->state >= FSCACHE_OBJECT_DYING) 397 (obj)->state >= FSCACHE_OBJECT_DYING)
413 398
414extern const struct slow_work_ops fscache_object_slow_work_ops; 399extern void fscache_object_work_func(struct work_struct *work);
415 400
416/** 401/**
417 * fscache_object_init - Initialise a cache object description 402 * fscache_object_init - Initialise a cache object description
@@ -433,7 +418,7 @@ void fscache_object_init(struct fscache_object *object,
433 spin_lock_init(&object->lock); 418 spin_lock_init(&object->lock);
434 INIT_LIST_HEAD(&object->cache_link); 419 INIT_LIST_HEAD(&object->cache_link);
435 INIT_HLIST_NODE(&object->cookie_link); 420 INIT_HLIST_NODE(&object->cookie_link);
436 vslow_work_init(&object->work, &fscache_object_slow_work_ops); 421 INIT_WORK(&object->work, fscache_object_work_func);
437 INIT_LIST_HEAD(&object->dependents); 422 INIT_LIST_HEAD(&object->dependents);
438 INIT_LIST_HEAD(&object->dep_link); 423 INIT_LIST_HEAD(&object->dep_link);
439 INIT_LIST_HEAD(&object->pending_ops); 424 INIT_LIST_HEAD(&object->pending_ops);
@@ -534,6 +519,8 @@ extern void fscache_io_error(struct fscache_cache *cache);
534extern void fscache_mark_pages_cached(struct fscache_retrieval *op, 519extern void fscache_mark_pages_cached(struct fscache_retrieval *op,
535 struct pagevec *pagevec); 520 struct pagevec *pagevec);
536 521
522extern bool fscache_object_sleep_till_congested(signed long *timeoutp);
523
537extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object, 524extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object,
538 const void *data, 525 const void *data,
539 uint16_t datalen); 526 uint16_t datalen);
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 595ce49288b7..ec0dad5ab90f 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -85,7 +85,7 @@ struct fscache_cookie_def {
85 85
86 /* get an index key 86 /* get an index key
87 * - should store the key data in the buffer 87 * - should store the key data in the buffer
88 * - should return the amount of amount stored 88 * - should return the amount of data stored
89 * - not permitted to return an error 89 * - not permitted to return an error
90 * - the netfs data from the cookie being used as the source is 90 * - the netfs data from the cookie being used as the source is
91 * presented 91 * presented
@@ -454,6 +454,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
454 * @cookie: The cookie representing the cache object 454 * @cookie: The cookie representing the cache object
455 * @mapping: The netfs inode mapping to which the pages will be attached 455 * @mapping: The netfs inode mapping to which the pages will be attached
456 * @pages: A list of potential netfs pages to be filled 456 * @pages: A list of potential netfs pages to be filled
457 * @nr_pages: Number of pages to be read and/or allocated
457 * @end_io_func: The callback to invoke when and if each page is filled 458 * @end_io_func: The callback to invoke when and if each page is filled
458 * @context: An arbitrary piece of data to pass on to end_io_func() 459 * @context: An arbitrary piece of data to pass on to end_io_func()
459 * @gfp: The conditions under which memory allocation should be made 460 * @gfp: The conditions under which memory allocation should be made
diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h
new file mode 100644
index 000000000000..fc295d7ea463
--- /dev/null
+++ b/include/linux/fsl-diu-fb.h
@@ -0,0 +1,223 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * Freescale DIU Frame Buffer device driver
5 *
6 * Authors: Hongjun Chen <hong-jun.chen@freescale.com>
7 * Paul Widmer <paul.widmer@freescale.com>
8 * Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
9 * York Sun <yorksun@freescale.com>
10 *
11 * Based on imxfb.c Copyright (C) 2004 S.Hauer, Pengutronix
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 */
19
20#ifndef __FSL_DIU_FB_H__
21#define __FSL_DIU_FB_H__
22
23/* Arbitrary threshold to determine the allocation method
24 * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory()
25 */
26#define MEM_ALLOC_THRESHOLD (1024*768*4+32)
27/* Minimum value that the pixel clock can be set to in pico seconds
28 * This is determined by platform clock/3 where the minimum platform
29 * clock is 533MHz. This gives 5629 pico seconds.
30 */
31#define MIN_PIX_CLK 5629
32#define MAX_PIX_CLK 96096
33
34#include <linux/types.h>
35
36struct mfb_alpha {
37 int enable;
38 int alpha;
39};
40
41struct mfb_chroma_key {
42 int enable;
43 __u8 red_max;
44 __u8 green_max;
45 __u8 blue_max;
46 __u8 red_min;
47 __u8 green_min;
48 __u8 blue_min;
49};
50
51struct aoi_display_offset {
52 int x_aoi_d;
53 int y_aoi_d;
54};
55
56#define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key)
57#define MFB_WAIT_FOR_VSYNC _IOW('F', 0x20, u_int32_t)
58#define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8)
59
60#define MFB_SET_ALPHA 0x80014d00
61#define MFB_GET_ALPHA 0x40014d00
62#define MFB_SET_AOID 0x80084d04
63#define MFB_GET_AOID 0x40084d04
64#define MFB_SET_PIXFMT 0x80014d08
65#define MFB_GET_PIXFMT 0x40014d08
66
67#define FBIOGET_GWINFO 0x46E0
68#define FBIOPUT_GWINFO 0x46E1
69
70#ifdef __KERNEL__
71#include <linux/spinlock.h>
72
73/*
74 * These are the fields of area descriptor(in DDR memory) for every plane
75 */
76struct diu_ad {
77 /* Word 0(32-bit) in DDR memory */
78/* __u16 comp; */
79/* __u16 pixel_s:2; */
80/* __u16 pallete:1; */
81/* __u16 red_c:2; */
82/* __u16 green_c:2; */
83/* __u16 blue_c:2; */
84/* __u16 alpha_c:3; */
85/* __u16 byte_f:1; */
86/* __u16 res0:3; */
87
88 __be32 pix_fmt; /* hard coding pixel format */
89
90 /* Word 1(32-bit) in DDR memory */
91 __le32 addr;
92
93 /* Word 2(32-bit) in DDR memory */
94/* __u32 delta_xs:11; */
95/* __u32 res1:1; */
96/* __u32 delta_ys:11; */
97/* __u32 res2:1; */
98/* __u32 g_alpha:8; */
99 __le32 src_size_g_alpha;
100
101 /* Word 3(32-bit) in DDR memory */
102/* __u32 delta_xi:11; */
103/* __u32 res3:5; */
104/* __u32 delta_yi:11; */
105/* __u32 res4:3; */
106/* __u32 flip:2; */
107 __le32 aoi_size;
108
109 /* Word 4(32-bit) in DDR memory */
110 /*__u32 offset_xi:11;
111 __u32 res5:5;
112 __u32 offset_yi:11;
113 __u32 res6:5;
114 */
115 __le32 offset_xyi;
116
117 /* Word 5(32-bit) in DDR memory */
118 /*__u32 offset_xd:11;
119 __u32 res7:5;
120 __u32 offset_yd:11;
121 __u32 res8:5; */
122 __le32 offset_xyd;
123
124
125 /* Word 6(32-bit) in DDR memory */
126 __u8 ckmax_r;
127 __u8 ckmax_g;
128 __u8 ckmax_b;
129 __u8 res9;
130
131 /* Word 7(32-bit) in DDR memory */
132 __u8 ckmin_r;
133 __u8 ckmin_g;
134 __u8 ckmin_b;
135 __u8 res10;
136/* __u32 res10:8; */
137
138 /* Word 8(32-bit) in DDR memory */
139 __le32 next_ad;
140
141 /* Word 9(32-bit) in DDR memory, just for 64-bit aligned */
142 __u32 paddr;
143} __attribute__ ((packed));
144
145/* DIU register map */
146struct diu {
147 __be32 desc[3];
148 __be32 gamma;
149 __be32 pallete;
150 __be32 cursor;
151 __be32 curs_pos;
152 __be32 diu_mode;
153 __be32 bgnd;
154 __be32 bgnd_wb;
155 __be32 disp_size;
156 __be32 wb_size;
157 __be32 wb_mem_addr;
158 __be32 hsyn_para;
159 __be32 vsyn_para;
160 __be32 syn_pol;
161 __be32 thresholds;
162 __be32 int_status;
163 __be32 int_mask;
164 __be32 colorbar[8];
165 __be32 filling;
166 __be32 plut;
167} __attribute__ ((packed));
168
169struct diu_hw {
170 struct diu *diu_reg;
171 spinlock_t reg_lock;
172
173 __u32 mode; /* DIU operation mode */
174};
175
176struct diu_addr {
177 __u8 __iomem *vaddr; /* Virtual address */
178 dma_addr_t paddr; /* Physical address */
179 __u32 offset;
180};
181
182struct diu_pool {
183 struct diu_addr ad;
184 struct diu_addr gamma;
185 struct diu_addr pallete;
186 struct diu_addr cursor;
187};
188
189#define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */
190#define INT_LCDC 64 /* DIU interrupt number */
191
192#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */
193 /* 1 for plane 0, 2 for plane 1&2 each */
194
195/* Minimum X and Y resolutions */
196#define MIN_XRES 64
197#define MIN_YRES 64
198
199/* HW cursor parameters */
200#define MAX_CURS 32
201
202/* Modes of operation of DIU */
203#define MFB_MODE0 0 /* DIU off */
204#define MFB_MODE1 1 /* All three planes output to display */
205#define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/
206#define MFB_MODE3 3 /* All three planes written back to memory */
207#define MFB_MODE4 4 /* Color bar generation */
208
209/* INT_STATUS/INT_MASK field descriptions */
210#define INT_VSYNC 0x01 /* Vsync interrupt */
211#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */
212#define INT_UNDRUN 0x04 /* Under run exception interrupt */
213#define INT_PARERR 0x08 /* Display parameters error interrupt */
214#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */
215
216/* Panels'operation modes */
217#define MFB_TYPE_OUTPUT 0 /* Panel output to display */
218#define MFB_TYPE_OFF 1 /* Panel off */
219#define MFB_TYPE_WB 2 /* Panel written back to memory */
220#define MFB_TYPE_TEST 3 /* Panel generate color bar */
221
222#endif /* __KERNEL__ */
223#endif /* __FSL_DIU_FB_H__ */
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 01755909ce81..e4e2204187ee 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -11,8 +11,6 @@
11 * (C) Copyright 2005 Robert Love 11 * (C) Copyright 2005 Robert Love
12 */ 12 */
13 13
14#include <linux/dnotify.h>
15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 14#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 15#include <linux/audit.h>
18#include <linux/slab.h> 16#include <linux/slab.h>
@@ -21,35 +19,52 @@
21 * fsnotify_d_instantiate - instantiate a dentry for inode 19 * fsnotify_d_instantiate - instantiate a dentry for inode
22 * Called with dcache_lock held. 20 * Called with dcache_lock held.
23 */ 21 */
24static inline void fsnotify_d_instantiate(struct dentry *entry, 22static inline void fsnotify_d_instantiate(struct dentry *dentry,
25 struct inode *inode) 23 struct inode *inode)
26{ 24{
27 __fsnotify_d_instantiate(entry, inode); 25 __fsnotify_d_instantiate(dentry, inode);
28
29 inotify_d_instantiate(entry, inode);
30} 26}
31 27
32/* Notify this dentry's parent about a child's events. */ 28/* Notify this dentry's parent about a child's events. */
33static inline void fsnotify_parent(struct dentry *dentry, __u32 mask) 29static inline void fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
34{ 30{
35 __fsnotify_parent(dentry, mask); 31 if (!dentry)
32 dentry = file->f_path.dentry;
33
34 __fsnotify_parent(file, dentry, mask);
35}
36 36
37 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name); 37/* simple call site for access decisions */
38static inline int fsnotify_perm(struct file *file, int mask)
39{
40 struct inode *inode = file->f_path.dentry->d_inode;
41 __u32 fsnotify_mask = 0;
42
43 if (file->f_mode & FMODE_NONOTIFY)
44 return 0;
45 if (!(mask & (MAY_READ | MAY_OPEN)))
46 return 0;
47 if (mask & MAY_OPEN)
48 fsnotify_mask = FS_OPEN_PERM;
49 else if (mask & MAY_READ)
50 fsnotify_mask = FS_ACCESS_PERM;
51 else
52 BUG();
53
54 return fsnotify(inode, fsnotify_mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
38} 55}
39 56
40/* 57/*
41 * fsnotify_d_move - entry has been moved 58 * fsnotify_d_move - dentry has been moved
42 * Called with dcache_lock and entry->d_lock held. 59 * Called with dcache_lock and dentry->d_lock held.
43 */ 60 */
44static inline void fsnotify_d_move(struct dentry *entry) 61static inline void fsnotify_d_move(struct dentry *dentry)
45{ 62{
46 /* 63 /*
47 * On move we need to update entry->d_flags to indicate if the new parent 64 * On move we need to update dentry->d_flags to indicate if the new parent
48 * cares about events from this entry. 65 * cares about events from this dentry.
49 */ 66 */
50 __fsnotify_update_dcache_flags(entry); 67 __fsnotify_update_dcache_flags(dentry);
51
52 inotify_d_move(entry);
53} 68}
54 69
55/* 70/*
@@ -57,8 +72,6 @@ static inline void fsnotify_d_move(struct dentry *entry)
57 */ 72 */
58static inline void fsnotify_link_count(struct inode *inode) 73static inline void fsnotify_link_count(struct inode *inode)
59{ 74{
60 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
61
62 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 75 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
63} 76}
64 77
@@ -66,45 +79,31 @@ static inline void fsnotify_link_count(struct inode *inode)
66 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 79 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
67 */ 80 */
68static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 81static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
69 const char *old_name, 82 const unsigned char *old_name,
70 int isdir, struct inode *target, struct dentry *moved) 83 int isdir, struct inode *target, struct dentry *moved)
71{ 84{
72 struct inode *source = moved->d_inode; 85 struct inode *source = moved->d_inode;
73 u32 in_cookie = inotify_get_cookie();
74 u32 fs_cookie = fsnotify_get_cookie(); 86 u32 fs_cookie = fsnotify_get_cookie();
75 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 87 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
76 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 88 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
77 const char *new_name = moved->d_name.name; 89 const unsigned char *new_name = moved->d_name.name;
78 90
79 if (old_dir == new_dir) 91 if (old_dir == new_dir)
80 old_dir_mask |= FS_DN_RENAME; 92 old_dir_mask |= FS_DN_RENAME;
81 93
82 if (isdir) { 94 if (isdir) {
83 isdir = IN_ISDIR;
84 old_dir_mask |= FS_IN_ISDIR; 95 old_dir_mask |= FS_IN_ISDIR;
85 new_dir_mask |= FS_IN_ISDIR; 96 new_dir_mask |= FS_IN_ISDIR;
86 } 97 }
87 98
88 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
89 source);
90 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
91 source);
92
93 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); 99 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
94 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); 100 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
95 101
96 if (target) { 102 if (target)
97 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
98 inotify_inode_is_dead(target);
99
100 /* this is really a link_count change not a removal */
101 fsnotify_link_count(target); 103 fsnotify_link_count(target);
102 }
103 104
104 if (source) { 105 if (source)
105 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 106 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
107 }
108 audit_inode_child(moved, new_dir); 107 audit_inode_child(moved, new_dir);
109} 108}
110 109
@@ -117,6 +116,14 @@ static inline void fsnotify_inode_delete(struct inode *inode)
117} 116}
118 117
119/* 118/*
119 * fsnotify_vfsmount_delete - a vfsmount is being destroyed, clean up is needed
120 */
121static inline void fsnotify_vfsmount_delete(struct vfsmount *mnt)
122{
123 __fsnotify_vfsmount_delete(mnt);
124}
125
126/*
120 * fsnotify_nameremove - a filename was removed from a directory 127 * fsnotify_nameremove - a filename was removed from a directory
121 */ 128 */
122static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 129static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
@@ -126,7 +133,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
126 if (isdir) 133 if (isdir)
127 mask |= FS_IN_ISDIR; 134 mask |= FS_IN_ISDIR;
128 135
129 fsnotify_parent(dentry, mask); 136 fsnotify_parent(NULL, dentry, mask);
130} 137}
131 138
132/* 139/*
@@ -134,9 +141,6 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
134 */ 141 */
135static inline void fsnotify_inoderemove(struct inode *inode) 142static inline void fsnotify_inoderemove(struct inode *inode)
136{ 143{
137 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
138 inotify_inode_is_dead(inode);
139
140 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 144 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
141 __fsnotify_inode_delete(inode); 145 __fsnotify_inode_delete(inode);
142} 146}
@@ -146,8 +150,6 @@ static inline void fsnotify_inoderemove(struct inode *inode)
146 */ 150 */
147static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 151static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
148{ 152{
149 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
150 dentry->d_inode);
151 audit_inode_child(dentry, inode); 153 audit_inode_child(dentry, inode);
152 154
153 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 155 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -160,8 +162,6 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
160 */ 162 */
161static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 163static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
162{ 164{
163 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
164 inode);
165 fsnotify_link_count(inode); 165 fsnotify_link_count(inode);
166 audit_inode_child(new_dentry, dir); 166 audit_inode_child(new_dentry, dir);
167 167
@@ -176,7 +176,6 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
176 __u32 mask = (FS_CREATE | FS_IN_ISDIR); 176 __u32 mask = (FS_CREATE | FS_IN_ISDIR);
177 struct inode *d_inode = dentry->d_inode; 177 struct inode *d_inode = dentry->d_inode;
178 178
179 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
180 audit_inode_child(dentry, inode); 179 audit_inode_child(dentry, inode);
181 180
182 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 181 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
@@ -185,52 +184,52 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
185/* 184/*
186 * fsnotify_access - file was read 185 * fsnotify_access - file was read
187 */ 186 */
188static inline void fsnotify_access(struct dentry *dentry) 187static inline void fsnotify_access(struct file *file)
189{ 188{
190 struct inode *inode = dentry->d_inode; 189 struct inode *inode = file->f_path.dentry->d_inode;
191 __u32 mask = FS_ACCESS; 190 __u32 mask = FS_ACCESS;
192 191
193 if (S_ISDIR(inode->i_mode)) 192 if (S_ISDIR(inode->i_mode))
194 mask |= FS_IN_ISDIR; 193 mask |= FS_IN_ISDIR;
195 194
196 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 195 if (!(file->f_mode & FMODE_NONOTIFY)) {
197 196 fsnotify_parent(file, NULL, mask);
198 fsnotify_parent(dentry, mask); 197 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
199 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 198 }
200} 199}
201 200
202/* 201/*
203 * fsnotify_modify - file was modified 202 * fsnotify_modify - file was modified
204 */ 203 */
205static inline void fsnotify_modify(struct dentry *dentry) 204static inline void fsnotify_modify(struct file *file)
206{ 205{
207 struct inode *inode = dentry->d_inode; 206 struct inode *inode = file->f_path.dentry->d_inode;
208 __u32 mask = FS_MODIFY; 207 __u32 mask = FS_MODIFY;
209 208
210 if (S_ISDIR(inode->i_mode)) 209 if (S_ISDIR(inode->i_mode))
211 mask |= FS_IN_ISDIR; 210 mask |= FS_IN_ISDIR;
212 211
213 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 212 if (!(file->f_mode & FMODE_NONOTIFY)) {
214 213 fsnotify_parent(file, NULL, mask);
215 fsnotify_parent(dentry, mask); 214 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
216 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 215 }
217} 216}
218 217
219/* 218/*
220 * fsnotify_open - file was opened 219 * fsnotify_open - file was opened
221 */ 220 */
222static inline void fsnotify_open(struct dentry *dentry) 221static inline void fsnotify_open(struct file *file)
223{ 222{
224 struct inode *inode = dentry->d_inode; 223 struct inode *inode = file->f_path.dentry->d_inode;
225 __u32 mask = FS_OPEN; 224 __u32 mask = FS_OPEN;
226 225
227 if (S_ISDIR(inode->i_mode)) 226 if (S_ISDIR(inode->i_mode))
228 mask |= FS_IN_ISDIR; 227 mask |= FS_IN_ISDIR;
229 228
230 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 229 if (!(file->f_mode & FMODE_NONOTIFY)) {
231 230 fsnotify_parent(file, NULL, mask);
232 fsnotify_parent(dentry, mask); 231 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
233 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 232 }
234} 233}
235 234
236/* 235/*
@@ -238,18 +237,17 @@ static inline void fsnotify_open(struct dentry *dentry)
238 */ 237 */
239static inline void fsnotify_close(struct file *file) 238static inline void fsnotify_close(struct file *file)
240{ 239{
241 struct dentry *dentry = file->f_path.dentry; 240 struct inode *inode = file->f_path.dentry->d_inode;
242 struct inode *inode = dentry->d_inode;
243 fmode_t mode = file->f_mode; 241 fmode_t mode = file->f_mode;
244 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE; 242 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
245 243
246 if (S_ISDIR(inode->i_mode)) 244 if (S_ISDIR(inode->i_mode))
247 mask |= FS_IN_ISDIR; 245 mask |= FS_IN_ISDIR;
248 246
249 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 247 if (!(file->f_mode & FMODE_NONOTIFY)) {
250 248 fsnotify_parent(file, NULL, mask);
251 fsnotify_parent(dentry, mask); 249 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
252 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0); 250 }
253} 251}
254 252
255/* 253/*
@@ -263,9 +261,7 @@ static inline void fsnotify_xattr(struct dentry *dentry)
263 if (S_ISDIR(inode->i_mode)) 261 if (S_ISDIR(inode->i_mode))
264 mask |= FS_IN_ISDIR; 262 mask |= FS_IN_ISDIR;
265 263
266 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 264 fsnotify_parent(NULL, dentry, mask);
267
268 fsnotify_parent(dentry, mask);
269 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 265 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
270} 266}
271 267
@@ -299,19 +295,18 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
299 if (mask) { 295 if (mask) {
300 if (S_ISDIR(inode->i_mode)) 296 if (S_ISDIR(inode->i_mode))
301 mask |= FS_IN_ISDIR; 297 mask |= FS_IN_ISDIR;
302 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
303 298
304 fsnotify_parent(dentry, mask); 299 fsnotify_parent(NULL, dentry, mask);
305 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); 300 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
306 } 301 }
307} 302}
308 303
309#if defined(CONFIG_INOTIFY) || defined(CONFIG_FSNOTIFY) /* notify helpers */ 304#if defined(CONFIG_FSNOTIFY) /* notify helpers */
310 305
311/* 306/*
312 * fsnotify_oldname_init - save off the old filename before we change it 307 * fsnotify_oldname_init - save off the old filename before we change it
313 */ 308 */
314static inline const char *fsnotify_oldname_init(const char *name) 309static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name)
315{ 310{
316 return kstrdup(name, GFP_KERNEL); 311 return kstrdup(name, GFP_KERNEL);
317} 312}
@@ -319,22 +314,22 @@ static inline const char *fsnotify_oldname_init(const char *name)
319/* 314/*
320 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init 315 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init
321 */ 316 */
322static inline void fsnotify_oldname_free(const char *old_name) 317static inline void fsnotify_oldname_free(const unsigned char *old_name)
323{ 318{
324 kfree(old_name); 319 kfree(old_name);
325} 320}
326 321
327#else /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */ 322#else /* CONFIG_FSNOTIFY */
328 323
329static inline const char *fsnotify_oldname_init(const char *name) 324static inline const char *fsnotify_oldname_init(const unsigned char *name)
330{ 325{
331 return NULL; 326 return NULL;
332} 327}
333 328
334static inline void fsnotify_oldname_free(const char *old_name) 329static inline void fsnotify_oldname_free(const unsigned char *old_name)
335{ 330{
336} 331}
337 332
338#endif /* ! CONFIG_INOTIFY */ 333#endif /* CONFIG_FSNOTIFY */
339 334
340#endif /* _LINUX_FS_NOTIFY_H */ 335#endif /* _LINUX_FS_NOTIFY_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 4d6f47b51189..9bbfd7204b04 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -41,6 +41,10 @@
41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */ 41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */ 42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */
43 43
44#define FS_OPEN_PERM 0x00010000 /* open event in an permission hook */
45#define FS_ACCESS_PERM 0x00020000 /* access event in a permissions hook */
46
47#define FS_EXCL_UNLINK 0x04000000 /* do not send events if object is unlinked */
44#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */ 48#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */
45#define FS_IN_ONESHOT 0x80000000 /* only send event once */ 49#define FS_IN_ONESHOT 0x80000000 /* only send event once */
46 50
@@ -58,13 +62,20 @@
58 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ 62 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
59 FS_DELETE) 63 FS_DELETE)
60 64
61/* listeners that hard code group numbers near the top */ 65#define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO)
62#define DNOTIFY_GROUP_NUM UINT_MAX 66
63#define INOTIFY_GROUP_NUM (DNOTIFY_GROUP_NUM-1) 67#define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \
68 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \
69 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \
70 FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \
71 FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \
72 FS_OPEN_PERM | FS_ACCESS_PERM | FS_EXCL_UNLINK | \
73 FS_IN_ISDIR | FS_IN_ONESHOT | FS_DN_RENAME | \
74 FS_DN_MULTISHOT | FS_EVENT_ON_CHILD)
64 75
65struct fsnotify_group; 76struct fsnotify_group;
66struct fsnotify_event; 77struct fsnotify_event;
67struct fsnotify_mark_entry; 78struct fsnotify_mark;
68struct fsnotify_event_private_data; 79struct fsnotify_event_private_data;
69 80
70/* 81/*
@@ -80,10 +91,16 @@ struct fsnotify_event_private_data;
80 * valid group and inode to use to clean up. 91 * valid group and inode to use to clean up.
81 */ 92 */
82struct fsnotify_ops { 93struct fsnotify_ops {
83 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask); 94 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode,
84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event); 95 struct fsnotify_mark *inode_mark,
96 struct fsnotify_mark *vfsmount_mark,
97 __u32 mask, void *data, int data_type);
98 int (*handle_event)(struct fsnotify_group *group,
99 struct fsnotify_mark *inode_mark,
100 struct fsnotify_mark *vfsmount_mark,
101 struct fsnotify_event *event);
85 void (*free_group_priv)(struct fsnotify_group *group); 102 void (*free_group_priv)(struct fsnotify_group *group);
86 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group); 103 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
87 void (*free_event_priv)(struct fsnotify_event_private_data *priv); 104 void (*free_event_priv)(struct fsnotify_event_private_data *priv);
88}; 105};
89 106
@@ -95,22 +112,6 @@ struct fsnotify_ops {
95 */ 112 */
96struct fsnotify_group { 113struct fsnotify_group {
97 /* 114 /*
98 * global list of all groups receiving events from fsnotify.
99 * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex
100 * or fsnotify_grp_srcu depending on write vs read.
101 */
102 struct list_head group_list;
103
104 /*
105 * Defines all of the event types in which this group is interested.
106 * This mask is a bitwise OR of the FS_* events from above. Each time
107 * this mask changes for a group (if it changes) the correct functions
108 * must be called to update the global structures which indicate global
109 * interest in event types.
110 */
111 __u32 mask;
112
113 /*
114 * How the refcnt is used is up to each group. When the refcnt hits 0 115 * How the refcnt is used is up to each group. When the refcnt hits 0
115 * fsnotify will clean up all of the resources associated with this group. 116 * fsnotify will clean up all of the resources associated with this group.
116 * As an example, the dnotify group will always have a refcnt=1 and that 117 * As an example, the dnotify group will always have a refcnt=1 and that
@@ -119,7 +120,6 @@ struct fsnotify_group {
119 * closed. 120 * closed.
120 */ 121 */
121 atomic_t refcnt; /* things with interest in this group */ 122 atomic_t refcnt; /* things with interest in this group */
122 unsigned int group_num; /* simply prevents accidental group collision */
123 123
124 const struct fsnotify_ops *ops; /* how this group handles things */ 124 const struct fsnotify_ops *ops; /* how this group handles things */
125 125
@@ -130,15 +130,12 @@ struct fsnotify_group {
130 unsigned int q_len; /* events on the queue */ 130 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */ 131 unsigned int max_events; /* maximum events allowed on the list */
132 132
133 /* stores all fastapth entries assoc with this group so they can be cleaned on unregister */ 133 /* stores all fastpath marks assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect mark_entries list */ 134 spinlock_t mark_lock; /* protect marks_list */
135 atomic_t num_marks; /* 1 for each mark entry and 1 for not being 135 atomic_t num_marks; /* 1 for each mark and 1 for not being
136 * past the point of no return when freeing 136 * past the point of no return when freeing
137 * a group */ 137 * a group */
138 struct list_head mark_entries; /* all inode mark entries for this group */ 138 struct list_head marks_list; /* all inode marks for this group */
139
140 /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */
141 bool on_group_list;
142 139
143 /* groups can define private fields here or use the void *private */ 140 /* groups can define private fields here or use the void *private */
144 union { 141 union {
@@ -152,6 +149,17 @@ struct fsnotify_group {
152 struct user_struct *user; 149 struct user_struct *user;
153 } inotify_data; 150 } inotify_data;
154#endif 151#endif
152#ifdef CONFIG_FANOTIFY
153 struct fanotify_group_private_data {
154#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
155 /* allows a group to block waiting for a userspace response */
156 struct mutex access_mutex;
157 struct list_head access_list;
158 wait_queue_head_t access_waitq;
159#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
160 int f_flags;
161 } fanotify_data;
162#endif /* CONFIG_FANOTIFY */
155 }; 163 };
156}; 164};
157 165
@@ -195,35 +203,57 @@ struct fsnotify_event {
195 /* to_tell may ONLY be dereferenced during handle_event(). */ 203 /* to_tell may ONLY be dereferenced during handle_event(). */
196 struct inode *to_tell; /* either the inode the event happened to or its parent */ 204 struct inode *to_tell; /* either the inode the event happened to or its parent */
197 /* 205 /*
198 * depending on the event type we should have either a path or inode 206 * depending on the event type we should have either a file or inode
199 * We hold a reference on path, but NOT on inode. Since we have the ref on 207 * We hold a reference on file, but NOT on inode. Since we have the ref on
200 * the path, it may be dereferenced at any point during this object's 208 * the file, it may be dereferenced at any point during this object's
201 * lifetime. That reference is dropped when this object's refcnt hits 209 * lifetime. That reference is dropped when this object's refcnt hits
202 * 0. If this event contains an inode instead of a path, the inode may 210 * 0. If this event contains an inode instead of a file, the inode may
203 * ONLY be used during handle_event(). 211 * ONLY be used during handle_event().
204 */ 212 */
205 union { 213 union {
206 struct path path; 214 struct file *file;
207 struct inode *inode; 215 struct inode *inode;
208 }; 216 };
209/* when calling fsnotify tell it if the data is a path or inode */ 217/* when calling fsnotify tell it if the data is a path or inode */
210#define FSNOTIFY_EVENT_NONE 0 218#define FSNOTIFY_EVENT_NONE 0
211#define FSNOTIFY_EVENT_PATH 1 219#define FSNOTIFY_EVENT_FILE 1
212#define FSNOTIFY_EVENT_INODE 2 220#define FSNOTIFY_EVENT_INODE 2
213#define FSNOTIFY_EVENT_FILE 3
214 int data_type; /* which of the above union we have */ 221 int data_type; /* which of the above union we have */
215 atomic_t refcnt; /* how many groups still are using/need to send this event */ 222 atomic_t refcnt; /* how many groups still are using/need to send this event */
216 __u32 mask; /* the type of access, bitwise OR for FS_* event types */ 223 __u32 mask; /* the type of access, bitwise OR for FS_* event types */
217 224
218 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 225 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
219 char *file_name; 226 const unsigned char *file_name;
220 size_t name_len; 227 size_t name_len;
228 struct pid *tgid;
229
230#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
231 __u32 response; /* userspace answer to question */
232#endif /* CONFIG_FANOTIFY_ACCESS_PERMISSIONS */
221 233
222 struct list_head private_data_list; /* groups can store private data here */ 234 struct list_head private_data_list; /* groups can store private data here */
223}; 235};
224 236
225/* 237/*
226 * a mark is simply an entry attached to an in core inode which allows an 238 * Inode specific fields in an fsnotify_mark
239 */
240struct fsnotify_inode_mark {
241 struct inode *inode; /* inode this mark is associated with */
242 struct hlist_node i_list; /* list of marks by inode->i_fsnotify_marks */
243 struct list_head free_i_list; /* tmp list used when freeing this mark */
244};
245
246/*
247 * Mount point specific fields in an fsnotify_mark
248 */
249struct fsnotify_vfsmount_mark {
250 struct vfsmount *mnt; /* vfsmount this mark is associated with */
251 struct hlist_node m_list; /* list of marks by inode->i_fsnotify_marks */
252 struct list_head free_m_list; /* tmp list used when freeing this mark */
253};
254
255/*
256 * a mark is simply an object attached to an in core inode which allows an
227 * fsnotify listener to indicate they are either no longer interested in events 257 * fsnotify listener to indicate they are either no longer interested in events
228 * of a type matching mask or only interested in those events. 258 * of a type matching mask or only interested in those events.
229 * 259 *
@@ -232,19 +262,28 @@ struct fsnotify_event {
232 * (such as dnotify) will flush these when the open fd is closed and not at 262 * (such as dnotify) will flush these when the open fd is closed and not at
233 * inode eviction or modification. 263 * inode eviction or modification.
234 */ 264 */
235struct fsnotify_mark_entry { 265struct fsnotify_mark {
236 __u32 mask; /* mask this mark entry is for */ 266 __u32 mask; /* mask this mark is for */
237 /* we hold ref for each i_list and g_list. also one ref for each 'thing' 267 /* we hold ref for each i_list and g_list. also one ref for each 'thing'
238 * in kernel that found and may be using this mark. */ 268 * in kernel that found and may be using this mark. */
239 atomic_t refcnt; /* active things looking at this mark */ 269 atomic_t refcnt; /* active things looking at this mark */
240 struct inode *inode; /* inode this entry is associated with */ 270 struct fsnotify_group *group; /* group this mark is for */
241 struct fsnotify_group *group; /* group this mark entry is for */ 271 struct list_head g_list; /* list of marks by group->i_fsnotify_marks */
242 struct hlist_node i_list; /* list of mark_entries by inode->i_fsnotify_mark_entries */ 272 spinlock_t lock; /* protect group and inode */
243 struct list_head g_list; /* list of mark_entries by group->i_fsnotify_mark_entries */ 273 union {
244 spinlock_t lock; /* protect group, inode, and killme */ 274 struct fsnotify_inode_mark i;
245 struct list_head free_i_list; /* tmp list used when freeing this mark */ 275 struct fsnotify_vfsmount_mark m;
276 };
277 __u32 ignored_mask; /* events types to ignore */
246 struct list_head free_g_list; /* tmp list used when freeing this mark */ 278 struct list_head free_g_list; /* tmp list used when freeing this mark */
247 void (*free_mark)(struct fsnotify_mark_entry *entry); /* called on final put+free */ 279#define FSNOTIFY_MARK_FLAG_INODE 0x01
280#define FSNOTIFY_MARK_FLAG_VFSMOUNT 0x02
281#define FSNOTIFY_MARK_FLAG_OBJECT_PINNED 0x04
282#define FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY 0x08
283#define FSNOTIFY_MARK_FLAG_ALIVE 0x10
284 unsigned int flags; /* vfsmount or inode mark? */
285 struct list_head destroy_list;
286 void (*free_mark)(struct fsnotify_mark *mark); /* called on final put+free */
248}; 287};
249 288
250#ifdef CONFIG_FSNOTIFY 289#ifdef CONFIG_FSNOTIFY
@@ -252,10 +291,11 @@ struct fsnotify_mark_entry {
252/* called from the vfs helpers */ 291/* called from the vfs helpers */
253 292
254/* main fsnotify call to send events */ 293/* main fsnotify call to send events */
255extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 294extern int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
256 const char *name, u32 cookie); 295 const unsigned char *name, u32 cookie);
257extern void __fsnotify_parent(struct dentry *dentry, __u32 mask); 296extern void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask);
258extern void __fsnotify_inode_delete(struct inode *inode); 297extern void __fsnotify_inode_delete(struct inode *inode);
298extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
259extern u32 fsnotify_get_cookie(void); 299extern u32 fsnotify_get_cookie(void);
260 300
261static inline int fsnotify_inode_watches_children(struct inode *inode) 301static inline int fsnotify_inode_watches_children(struct inode *inode)
@@ -304,15 +344,9 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
304 344
305/* called from fsnotify listeners, such as fanotify or dnotify */ 345/* called from fsnotify listeners, such as fanotify or dnotify */
306 346
307/* must call when a group changes its ->mask */
308extern void fsnotify_recalc_global_mask(void);
309/* get a reference to an existing or create a new group */ 347/* get a reference to an existing or create a new group */
310extern struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, 348extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
311 __u32 mask, 349/* drop reference on a group from fsnotify_alloc_group */
312 const struct fsnotify_ops *ops);
313/* run all marks associated with this group and update group->mask */
314extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
315/* drop reference on a group from fsnotify_obtain_group */
316extern void fsnotify_put_group(struct fsnotify_group *group); 350extern void fsnotify_put_group(struct fsnotify_group *group);
317 351
318/* take a reference to an event */ 352/* take a reference to an event */
@@ -323,8 +357,11 @@ extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struc
323 struct fsnotify_event *event); 357 struct fsnotify_event *event);
324 358
325/* attach the event to the group notification queue */ 359/* attach the event to the group notification queue */
326extern int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_event *event, 360extern struct fsnotify_event *fsnotify_add_notify_event(struct fsnotify_group *group,
327 struct fsnotify_event_private_data *priv); 361 struct fsnotify_event *event,
362 struct fsnotify_event_private_data *priv,
363 struct fsnotify_event *(*merge)(struct list_head *,
364 struct fsnotify_event *));
328/* true if the group notification queue is empty */ 365/* true if the group notification queue is empty */
329extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group); 366extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
330/* return, but do not dequeue the first event on the notification queue */ 367/* return, but do not dequeue the first event on the notification queue */
@@ -334,38 +371,66 @@ extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group
334 371
335/* functions used to manipulate the marks attached to inodes */ 372/* functions used to manipulate the marks attached to inodes */
336 373
374/* run all marks associated with a vfsmount and update mnt->mnt_fsnotify_mask */
375extern void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt);
337/* run all marks associated with an inode and update inode->i_fsnotify_mask */ 376/* run all marks associated with an inode and update inode->i_fsnotify_mask */
338extern void fsnotify_recalc_inode_mask(struct inode *inode); 377extern void fsnotify_recalc_inode_mask(struct inode *inode);
339extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry)); 378extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
340/* find (and take a reference) to a mark associated with group and inode */ 379/* find (and take a reference) to a mark associated with group and inode */
341extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode); 380extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
381/* find (and take a reference) to a mark associated with group and vfsmount */
382extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
383/* copy the values from old into new */
384extern void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old);
385/* set the ignored_mask of a mark */
386extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
387/* set the mask of a mark (might pin the object into memory */
388extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
342/* attach the mark to both the group and the inode */ 389/* attach the mark to both the group and the inode */
343extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode); 390extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
391 struct inode *inode, struct vfsmount *mnt, int allow_dups);
344/* given a mark, flag it to be freed when all references are dropped */ 392/* given a mark, flag it to be freed when all references are dropped */
345extern void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry); 393extern void fsnotify_destroy_mark(struct fsnotify_mark *mark);
394/* run all the marks in a group, and clear all of the vfsmount marks */
395extern void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group);
396/* run all the marks in a group, and clear all of the inode marks */
397extern void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group);
398/* run all the marks in a group, and clear all of the marks where mark->flags & flags is true*/
399extern void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, unsigned int flags);
346/* run all the marks in a group, and flag them to be freed */ 400/* run all the marks in a group, and flag them to be freed */
347extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group); 401extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
348extern void fsnotify_get_mark(struct fsnotify_mark_entry *entry); 402extern void fsnotify_get_mark(struct fsnotify_mark *mark);
349extern void fsnotify_put_mark(struct fsnotify_mark_entry *entry); 403extern void fsnotify_put_mark(struct fsnotify_mark *mark);
350extern void fsnotify_unmount_inodes(struct list_head *list); 404extern void fsnotify_unmount_inodes(struct list_head *list);
351 405
352/* put here because inotify does some weird stuff when destroying watches */ 406/* put here because inotify does some weird stuff when destroying watches */
353extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, 407extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
354 void *data, int data_is, const char *name, 408 void *data, int data_is,
409 const unsigned char *name,
355 u32 cookie, gfp_t gfp); 410 u32 cookie, gfp_t gfp);
356 411
412/* fanotify likes to change events after they are on lists... */
413extern struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event);
414extern int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
415 struct fsnotify_event *new_event);
416
357#else 417#else
358 418
359static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 419static inline int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
360 const char *name, u32 cookie) 420 const unsigned char *name, u32 cookie)
361{} 421{
422 return 0;
423}
362 424
363static inline void __fsnotify_parent(struct dentry *dentry, __u32 mask) 425static inline void __fsnotify_parent(struct file *file, struct dentry *dentry, __u32 mask)
364{} 426{}
365 427
366static inline void __fsnotify_inode_delete(struct inode *inode) 428static inline void __fsnotify_inode_delete(struct inode *inode)
367{} 429{}
368 430
431static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt)
432{}
433
369static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) 434static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
370{} 435{}
371 436
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 01e6adea07ec..dcd6a7c3a435 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -1,3 +1,8 @@
1/*
2 * Ftrace header. For implementation details beyond the random comments
3 * scattered below, see: Documentation/trace/ftrace-design.txt
4 */
5
1#ifndef _LINUX_FTRACE_H 6#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H 7#define _LINUX_FTRACE_H
3 8
@@ -82,9 +87,13 @@ void clear_ftrace_function(void);
82extern void ftrace_stub(unsigned long a0, unsigned long a1); 87extern void ftrace_stub(unsigned long a0, unsigned long a1);
83 88
84#else /* !CONFIG_FUNCTION_TRACER */ 89#else /* !CONFIG_FUNCTION_TRACER */
85# define register_ftrace_function(ops) do { } while (0) 90/*
86# define unregister_ftrace_function(ops) do { } while (0) 91 * (un)register_ftrace_function must be a macro since the ops parameter
87# define clear_ftrace_function(ops) do { } while (0) 92 * must not be evaluated.
93 */
94#define register_ftrace_function(ops) ({ 0; })
95#define unregister_ftrace_function(ops) ({ 0; })
96static inline void clear_ftrace_function(void) { }
88static inline void ftrace_kill(void) { } 97static inline void ftrace_kill(void) { }
89static inline void ftrace_stop(void) { } 98static inline void ftrace_stop(void) { }
90static inline void ftrace_start(void) { } 99static inline void ftrace_start(void) { }
@@ -237,11 +246,13 @@ extern int skip_trace(unsigned long ip);
237extern void ftrace_disable_daemon(void); 246extern void ftrace_disable_daemon(void);
238extern void ftrace_enable_daemon(void); 247extern void ftrace_enable_daemon(void);
239#else 248#else
240# define skip_trace(ip) ({ 0; }) 249static inline int skip_trace(unsigned long ip) { return 0; }
241# define ftrace_force_update() ({ 0; }) 250static inline int ftrace_force_update(void) { return 0; }
242# define ftrace_set_filter(buf, len, reset) do { } while (0) 251static inline void ftrace_set_filter(unsigned char *buf, int len, int reset)
243# define ftrace_disable_daemon() do { } while (0) 252{
244# define ftrace_enable_daemon() do { } while (0) 253}
254static inline void ftrace_disable_daemon(void) { }
255static inline void ftrace_enable_daemon(void) { }
245static inline void ftrace_release_mod(struct module *mod) {} 256static inline void ftrace_release_mod(struct module *mod) {}
246static inline int register_ftrace_command(struct ftrace_func_command *cmd) 257static inline int register_ftrace_command(struct ftrace_func_command *cmd)
247{ 258{
@@ -314,16 +325,16 @@ static inline void __ftrace_enabled_restore(int enabled)
314 extern void time_hardirqs_on(unsigned long a0, unsigned long a1); 325 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
315 extern void time_hardirqs_off(unsigned long a0, unsigned long a1); 326 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
316#else 327#else
317# define time_hardirqs_on(a0, a1) do { } while (0) 328 static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { }
318# define time_hardirqs_off(a0, a1) do { } while (0) 329 static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }
319#endif 330#endif
320 331
321#ifdef CONFIG_PREEMPT_TRACER 332#ifdef CONFIG_PREEMPT_TRACER
322 extern void trace_preempt_on(unsigned long a0, unsigned long a1); 333 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
323 extern void trace_preempt_off(unsigned long a0, unsigned long a1); 334 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
324#else 335#else
325# define trace_preempt_on(a0, a1) do { } while (0) 336 static inline void trace_preempt_on(unsigned long a0, unsigned long a1) { }
326# define trace_preempt_off(a0, a1) do { } while (0) 337 static inline void trace_preempt_off(unsigned long a0, unsigned long a1) { }
327#endif 338#endif
328 339
329#ifdef CONFIG_FTRACE_MCOUNT_RECORD 340#ifdef CONFIG_FTRACE_MCOUNT_RECORD
@@ -352,6 +363,10 @@ struct ftrace_graph_ret {
352 int depth; 363 int depth;
353}; 364};
354 365
366/* Type of the callback handlers for tracing function graph*/
367typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
368typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
369
355#ifdef CONFIG_FUNCTION_GRAPH_TRACER 370#ifdef CONFIG_FUNCTION_GRAPH_TRACER
356 371
357/* for init task */ 372/* for init task */
@@ -400,10 +415,6 @@ extern char __irqentry_text_end[];
400 415
401#define FTRACE_RETFUNC_DEPTH 50 416#define FTRACE_RETFUNC_DEPTH 50
402#define FTRACE_RETSTACK_ALLOC_SIZE 32 417#define FTRACE_RETSTACK_ALLOC_SIZE 32
403/* Type of the callback handlers for tracing function graph*/
404typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
405typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
406
407extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, 418extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
408 trace_func_graph_ent_t entryfunc); 419 trace_func_graph_ent_t entryfunc);
409 420
@@ -441,6 +452,13 @@ static inline void unpause_graph_tracing(void)
441static inline void ftrace_graph_init_task(struct task_struct *t) { } 452static inline void ftrace_graph_init_task(struct task_struct *t) { }
442static inline void ftrace_graph_exit_task(struct task_struct *t) { } 453static inline void ftrace_graph_exit_task(struct task_struct *t) { }
443 454
455static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
456 trace_func_graph_ent_t entryfunc)
457{
458 return -1;
459}
460static inline void unregister_ftrace_graph(void) { }
461
444static inline int task_curr_ret_stack(struct task_struct *tsk) 462static inline int task_curr_ret_stack(struct task_struct *tsk)
445{ 463{
446 return -1; 464 return -1;
@@ -492,7 +510,9 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
492 return tsk->trace & TSK_TRACE_FL_GRAPH; 510 return tsk->trace & TSK_TRACE_FL_GRAPH;
493} 511}
494 512
495extern int ftrace_dump_on_oops; 513enum ftrace_dump_mode;
514
515extern enum ftrace_dump_mode ftrace_dump_on_oops;
496 516
497#ifdef CONFIG_PREEMPT 517#ifdef CONFIG_PREEMPT
498#define INIT_TRACE_RECURSION .trace_recursion = 0, 518#define INIT_TRACE_RECURSION .trace_recursion = 0,
@@ -504,18 +524,6 @@ extern int ftrace_dump_on_oops;
504#define INIT_TRACE_RECURSION 524#define INIT_TRACE_RECURSION
505#endif 525#endif
506 526
507#ifdef CONFIG_HW_BRANCH_TRACER
508
509void trace_hw_branch(u64 from, u64 to);
510void trace_hw_branch_oops(void);
511
512#else /* CONFIG_HW_BRANCH_TRACER */
513
514static inline void trace_hw_branch(u64 from, u64 to) {}
515static inline void trace_hw_branch_oops(void) {}
516
517#endif /* CONFIG_HW_BRANCH_TRACER */
518
519#ifdef CONFIG_FTRACE_SYSCALLS 527#ifdef CONFIG_FTRACE_SYSCALLS
520 528
521unsigned long arch_syscall_addr(int nr); 529unsigned long arch_syscall_addr(int nr);
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index c0f4b364c711..02b8b24f8f51 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -11,8 +11,6 @@ struct trace_array;
11struct tracer; 11struct tracer;
12struct dentry; 12struct dentry;
13 13
14DECLARE_PER_CPU(struct trace_seq, ftrace_event_seq);
15
16struct trace_print_flags { 14struct trace_print_flags {
17 unsigned long mask; 15 unsigned long mask;
18 const char *name; 16 const char *name;
@@ -25,6 +23,9 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
25const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, 23const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
26 const struct trace_print_flags *symbol_array); 24 const struct trace_print_flags *symbol_array);
27 25
26const char *ftrace_print_hex_seq(struct trace_seq *p,
27 const unsigned char *buf, int len);
28
28/* 29/*
29 * The trace entry - the most basic unit of tracing. This is what 30 * The trace entry - the most basic unit of tracing. This is what
30 * is printed in the end as a single line in the trace output, such as: 31 * is printed in the end as a single line in the trace output, such as:
@@ -55,9 +56,13 @@ struct trace_iterator {
55 struct ring_buffer_iter *buffer_iter[NR_CPUS]; 56 struct ring_buffer_iter *buffer_iter[NR_CPUS];
56 unsigned long iter_flags; 57 unsigned long iter_flags;
57 58
59 /* trace_seq for __print_flags() and __print_symbolic() etc. */
60 struct trace_seq tmp_seq;
61
58 /* The below is zeroed out in pipe_read */ 62 /* The below is zeroed out in pipe_read */
59 struct trace_seq seq; 63 struct trace_seq seq;
60 struct trace_entry *ent; 64 struct trace_entry *ent;
65 unsigned long lost_events;
61 int leftover; 66 int leftover;
62 int cpu; 67 int cpu;
63 u64 ts; 68 u64 ts;
@@ -69,18 +74,25 @@ struct trace_iterator {
69}; 74};
70 75
71 76
77struct trace_event;
78
72typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, 79typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
73 int flags); 80 int flags, struct trace_event *event);
74struct trace_event { 81
75 struct hlist_node node; 82struct trace_event_functions {
76 struct list_head list;
77 int type;
78 trace_print_func trace; 83 trace_print_func trace;
79 trace_print_func raw; 84 trace_print_func raw;
80 trace_print_func hex; 85 trace_print_func hex;
81 trace_print_func binary; 86 trace_print_func binary;
82}; 87};
83 88
89struct trace_event {
90 struct hlist_node node;
91 struct list_head list;
92 int type;
93 struct trace_event_functions *funcs;
94};
95
84extern int register_ftrace_event(struct trace_event *event); 96extern int register_ftrace_event(struct trace_event *event);
85extern int unregister_ftrace_event(struct trace_event *event); 97extern int unregister_ftrace_event(struct trace_event *event);
86 98
@@ -112,28 +124,76 @@ void tracing_record_cmdline(struct task_struct *tsk);
112 124
113struct event_filter; 125struct event_filter;
114 126
127enum trace_reg {
128 TRACE_REG_REGISTER,
129 TRACE_REG_UNREGISTER,
130 TRACE_REG_PERF_REGISTER,
131 TRACE_REG_PERF_UNREGISTER,
132};
133
134struct ftrace_event_call;
135
136struct ftrace_event_class {
137 char *system;
138 void *probe;
139#ifdef CONFIG_PERF_EVENTS
140 void *perf_probe;
141#endif
142 int (*reg)(struct ftrace_event_call *event,
143 enum trace_reg type);
144 int (*define_fields)(struct ftrace_event_call *);
145 struct list_head *(*get_fields)(struct ftrace_event_call *);
146 struct list_head fields;
147 int (*raw_init)(struct ftrace_event_call *);
148};
149
150extern int ftrace_event_reg(struct ftrace_event_call *event,
151 enum trace_reg type);
152
153enum {
154 TRACE_EVENT_FL_ENABLED_BIT,
155 TRACE_EVENT_FL_FILTERED_BIT,
156 TRACE_EVENT_FL_RECORDED_CMD_BIT,
157};
158
159enum {
160 TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT),
161 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
162 TRACE_EVENT_FL_RECORDED_CMD = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
163};
164
115struct ftrace_event_call { 165struct ftrace_event_call {
116 struct list_head list; 166 struct list_head list;
167 struct ftrace_event_class *class;
117 char *name; 168 char *name;
118 char *system;
119 struct dentry *dir; 169 struct dentry *dir;
120 struct trace_event *event; 170 struct trace_event event;
121 int enabled;
122 int (*regfunc)(struct ftrace_event_call *);
123 void (*unregfunc)(struct ftrace_event_call *);
124 int id;
125 const char *print_fmt; 171 const char *print_fmt;
126 int (*raw_init)(struct ftrace_event_call *);
127 int (*define_fields)(struct ftrace_event_call *);
128 struct list_head fields;
129 int filter_active;
130 struct event_filter *filter; 172 struct event_filter *filter;
131 void *mod; 173 void *mod;
132 void *data; 174 void *data;
133 175
176 /*
177 * 32 bit flags:
178 * bit 1: enabled
179 * bit 2: filter_active
180 * bit 3: enabled cmd record
181 *
182 * Changes to flags must hold the event_mutex.
183 *
184 * Note: Reads of flags do not hold the event_mutex since
185 * they occur in critical sections. But the way flags
186 * is currently used, these changes do no affect the code
187 * except that when a change is made, it may have a slight
188 * delay in propagating the changes to other CPUs due to
189 * caching and such.
190 */
191 unsigned int flags;
192
193#ifdef CONFIG_PERF_EVENTS
134 int perf_refcount; 194 int perf_refcount;
135 int (*perf_event_enable)(struct ftrace_event_call *); 195 struct hlist_head *perf_events;
136 void (*perf_event_disable)(struct ftrace_event_call *); 196#endif
137}; 197};
138 198
139#define PERF_MAX_TRACE_SIZE 2048 199#define PERF_MAX_TRACE_SIZE 2048
@@ -190,24 +250,21 @@ struct perf_event;
190 250
191DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); 251DECLARE_PER_CPU(struct pt_regs, perf_trace_regs);
192 252
193extern int perf_trace_enable(int event_id); 253extern int perf_trace_init(struct perf_event *event);
194extern void perf_trace_disable(int event_id); 254extern void perf_trace_destroy(struct perf_event *event);
195extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, 255extern int perf_trace_enable(struct perf_event *event);
256extern void perf_trace_disable(struct perf_event *event);
257extern int ftrace_profile_set_filter(struct perf_event *event, int event_id,
196 char *filter_str); 258 char *filter_str);
197extern void ftrace_profile_free_filter(struct perf_event *event); 259extern void ftrace_profile_free_filter(struct perf_event *event);
198extern void * 260extern void *perf_trace_buf_prepare(int size, unsigned short type,
199perf_trace_buf_prepare(int size, unsigned short type, int *rctxp, 261 struct pt_regs *regs, int *rctxp);
200 unsigned long *irq_flags);
201 262
202static inline void 263static inline void
203perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, 264perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
204 u64 count, unsigned long irq_flags, struct pt_regs *regs) 265 u64 count, struct pt_regs *regs, void *head)
205{ 266{
206 struct trace_entry *entry = raw_data; 267 perf_tp_event(addr, count, raw_data, size, regs, head, rctx);
207
208 perf_tp_event(entry->type, addr, count, raw_data, size, regs);
209 perf_swevent_put_recursion_context(rctx);
210 local_irq_restore(irq_flags);
211} 268}
212#endif 269#endif
213 270
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 3e2925a34bf0..c3c578e09833 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -34,6 +34,13 @@
34 * 7.13 34 * 7.13
35 * - make max number of background requests and congestion threshold 35 * - make max number of background requests and congestion threshold
36 * tunables 36 * tunables
37 *
38 * 7.14
39 * - add splice support to fuse device
40 *
41 * 7.15
42 * - add store notify
43 * - add retrieve notify
37 */ 44 */
38 45
39#ifndef _LINUX_FUSE_H 46#ifndef _LINUX_FUSE_H
@@ -65,7 +72,7 @@
65#define FUSE_KERNEL_VERSION 7 72#define FUSE_KERNEL_VERSION 7
66 73
67/** Minor version number of this interface */ 74/** Minor version number of this interface */
68#define FUSE_KERNEL_MINOR_VERSION 13 75#define FUSE_KERNEL_MINOR_VERSION 15
69 76
70/** The node ID of the root inode */ 77/** The node ID of the root inode */
71#define FUSE_ROOT_ID 1 78#define FUSE_ROOT_ID 1
@@ -248,6 +255,7 @@ enum fuse_opcode {
248 FUSE_DESTROY = 38, 255 FUSE_DESTROY = 38,
249 FUSE_IOCTL = 39, 256 FUSE_IOCTL = 39,
250 FUSE_POLL = 40, 257 FUSE_POLL = 40,
258 FUSE_NOTIFY_REPLY = 41,
251 259
252 /* CUSE specific operations */ 260 /* CUSE specific operations */
253 CUSE_INIT = 4096, 261 CUSE_INIT = 4096,
@@ -257,6 +265,8 @@ enum fuse_notify_code {
257 FUSE_NOTIFY_POLL = 1, 265 FUSE_NOTIFY_POLL = 1,
258 FUSE_NOTIFY_INVAL_INODE = 2, 266 FUSE_NOTIFY_INVAL_INODE = 2,
259 FUSE_NOTIFY_INVAL_ENTRY = 3, 267 FUSE_NOTIFY_INVAL_ENTRY = 3,
268 FUSE_NOTIFY_STORE = 4,
269 FUSE_NOTIFY_RETRIEVE = 5,
260 FUSE_NOTIFY_CODE_MAX, 270 FUSE_NOTIFY_CODE_MAX,
261}; 271};
262 272
@@ -565,4 +575,29 @@ struct fuse_notify_inval_entry_out {
565 __u32 padding; 575 __u32 padding;
566}; 576};
567 577
578struct fuse_notify_store_out {
579 __u64 nodeid;
580 __u64 offset;
581 __u32 size;
582 __u32 padding;
583};
584
585struct fuse_notify_retrieve_out {
586 __u64 notify_unique;
587 __u64 nodeid;
588 __u64 offset;
589 __u32 size;
590 __u32 padding;
591};
592
593/* Matches the size of fuse_write_in */
594struct fuse_notify_retrieve_in {
595 __u64 dummy1;
596 __u64 offset;
597 __u32 size;
598 __u32 dummy2;
599 __u64 dummy3;
600 __u64 dummy4;
601};
602
568#endif /* _LINUX_FUSE_H */ 603#endif /* _LINUX_FUSE_H */
diff --git a/include/linux/generic_acl.h b/include/linux/generic_acl.h
index ca666d18ed67..574bea4013b6 100644
--- a/include/linux/generic_acl.h
+++ b/include/linux/generic_acl.h
@@ -5,8 +5,8 @@
5 5
6struct inode; 6struct inode;
7 7
8extern struct xattr_handler generic_acl_access_handler; 8extern const struct xattr_handler generic_acl_access_handler;
9extern struct xattr_handler generic_acl_default_handler; 9extern const struct xattr_handler generic_acl_default_handler;
10 10
11int generic_acl_init(struct inode *, struct inode *); 11int generic_acl_init(struct inode *, struct inode *);
12int generic_acl_chmod(struct inode *); 12int generic_acl_chmod(struct inode *);
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index b834ef6d59fa..61549b26ad6f 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -80,4 +80,12 @@ enum {
80 80
81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
82 82
83#ifdef __KERNEL__
84
85/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void);
87extern void genl_unlock(void);
88
89#endif /* __KERNEL__ */
90
83#endif /* __LINUX_GENERIC_NETLINK_H */ 91#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4c6d41333f98..975609cb8548 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -15,7 +15,7 @@ struct vm_area_struct;
15 * Zone modifiers (see linux/mmzone.h - low three bits) 15 * Zone modifiers (see linux/mmzone.h - low three bits)
16 * 16 *
17 * Do not put any conditional on these. If necessary modify the definitions 17 * Do not put any conditional on these. If necessary modify the definitions
18 * without the underscores and use the consistently. The definitions here may 18 * without the underscores and use them consistently. The definitions here may
19 * be used in bit comparisons. 19 * be used in bit comparisons.
20 */ 20 */
21#define __GFP_DMA ((__force gfp_t)0x01u) 21#define __GFP_DMA ((__force gfp_t)0x01u)
@@ -101,7 +101,7 @@ struct vm_area_struct;
101 __GFP_NORETRY|__GFP_NOMEMALLOC) 101 __GFP_NORETRY|__GFP_NOMEMALLOC)
102 102
103/* Control slab gfp mask during early boot */ 103/* Control slab gfp mask during early boot */
104#define GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS) 104#define GFP_BOOT_MASK (__GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS))
105 105
106/* Control allocation constraints */ 106/* Control allocation constraints */
107#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) 107#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
@@ -152,12 +152,12 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
152 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the 152 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
153 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long 153 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
154 * and there are 16 of them to cover all possible combinations of 154 * and there are 16 of them to cover all possible combinations of
155 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM 155 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM.
156 * 156 *
157 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA. 157 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
158 * But GFP_MOVABLE is not only a zone specifier but also an allocation 158 * But GFP_MOVABLE is not only a zone specifier but also an allocation
159 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid. 159 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
160 * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1". 160 * Only 1 bit of the lowest 3 bits (DMA,DMA32,HIGHMEM) can be set to "1".
161 * 161 *
162 * bit result 162 * bit result
163 * ================= 163 * =================
@@ -187,7 +187,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
187 187
188#define GFP_ZONE_TABLE ( \ 188#define GFP_ZONE_TABLE ( \
189 (ZONE_NORMAL << 0 * ZONES_SHIFT) \ 189 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \ 190 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
191 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \ 191 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
192 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \ 192 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
193 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \ 193 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
@@ -197,7 +197,7 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
197) 197)
198 198
199/* 199/*
200 * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32 200 * GFP_ZONE_BAD is a bitmap for all combinations of __GFP_DMA, __GFP_DMA32
201 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per 201 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
202 * entry starting with bit 0. Bit is set if the combination is not 202 * entry starting with bit 0. Bit is set if the combination is not
203 * allowed. 203 * allowed.
@@ -320,17 +320,17 @@ void *alloc_pages_exact(size_t size, gfp_t gfp_mask);
320void free_pages_exact(void *virt, size_t size); 320void free_pages_exact(void *virt, size_t size);
321 321
322#define __get_free_page(gfp_mask) \ 322#define __get_free_page(gfp_mask) \
323 __get_free_pages((gfp_mask),0) 323 __get_free_pages((gfp_mask), 0)
324 324
325#define __get_dma_pages(gfp_mask, order) \ 325#define __get_dma_pages(gfp_mask, order) \
326 __get_free_pages((gfp_mask) | GFP_DMA,(order)) 326 __get_free_pages((gfp_mask) | GFP_DMA, (order))
327 327
328extern void __free_pages(struct page *page, unsigned int order); 328extern void __free_pages(struct page *page, unsigned int order);
329extern void free_pages(unsigned long addr, unsigned int order); 329extern void free_pages(unsigned long addr, unsigned int order);
330extern void free_hot_cold_page(struct page *page, int cold); 330extern void free_hot_cold_page(struct page *page, int cold);
331 331
332#define __free_page(page) __free_pages((page), 0) 332#define __free_page(page) __free_pages((page), 0)
333#define free_page(addr) free_pages((addr),0) 333#define free_page(addr) free_pages((addr), 0)
334 334
335void page_alloc_init(void); 335void page_alloc_init(void);
336void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp); 336void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 4e949a5b5b85..03f616b78cfa 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -51,6 +51,11 @@ static inline int gpio_direction_output(unsigned gpio, int value)
51 return -ENOSYS; 51 return -ENOSYS;
52} 52}
53 53
54static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
55{
56 return -ENOSYS;
57}
58
54static inline int gpio_get_value(unsigned gpio) 59static inline int gpio_get_value(unsigned gpio)
55{ 60{
56 /* GPIO can never have been requested or set as {in,out}put */ 61 /* GPIO can never have been requested or set as {in,out}put */
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index cd0b3f30f48e..ce73a30113b4 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -17,6 +17,8 @@ struct gpio_keys_platform_data {
17 struct gpio_keys_button *buttons; 17 struct gpio_keys_button *buttons;
18 int nbuttons; 18 int nbuttons;
19 unsigned int rep:1; /* enable input subsystem auto repeat */ 19 unsigned int rep:1; /* enable input subsystem auto repeat */
20 int (*enable)(struct device *dev);
21 void (*disable)(struct device *dev);
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/gsmmux.h b/include/linux/gsmmux.h
new file mode 100644
index 000000000000..378de4195caf
--- /dev/null
+++ b/include/linux/gsmmux.h
@@ -0,0 +1,25 @@
1#ifndef _LINUX_GSMMUX_H
2#define _LINUX_GSMMUX_H
3
4struct gsm_config
5{
6 unsigned int adaption;
7 unsigned int encapsulation;
8 unsigned int initiator;
9 unsigned int t1;
10 unsigned int t2;
11 unsigned int t3;
12 unsigned int n2;
13 unsigned int mru;
14 unsigned int mtu;
15 unsigned int k;
16 unsigned int i;
17 unsigned int unused[8]; /* Padding for expansion without
18 breaking stuff */
19};
20
21#define GSMIOC_GETCONF _IOR('G', 0, struct gsm_config)
22#define GSMIOC_SETCONF _IOW('G', 1, struct gsm_config)
23
24
25#endif
diff --git a/include/linux/hdpu_features.h b/include/linux/hdpu_features.h
deleted file mode 100644
index 6a8715431ae4..000000000000
--- a/include/linux/hdpu_features.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#include <linux/spinlock.h>
2
3struct cpustate_t {
4 spinlock_t lock;
5 int excl;
6 int open_count;
7 unsigned char cached_val;
8 int inited;
9 unsigned long *set_addr;
10 unsigned long *clr_addr;
11};
12
13
14#define HDPU_CPUSTATE_NAME "hdpu cpustate"
15#define HDPU_NEXUS_NAME "hdpu nexus"
16
17#define CPUSTATE_KERNEL_MAJOR 0x10
18
19#define CPUSTATE_KERNEL_INIT_DRV 0 /* CPU State Driver Initialized */
20#define CPUSTATE_KERNEL_INIT_PCI 1 /* 64360 PCI Busses Init */
21#define CPUSTATE_KERNEL_INIT_REG 2 /* 64360 Bridge Init */
22#define CPUSTATE_KERNEL_CPU1_KICK 3 /* Boot cpu 1 */
23#define CPUSTATE_KERNEL_CPU1_OK 4 /* Cpu 1 has checked in */
24#define CPUSTATE_KERNEL_OK 5 /* Terminal state */
25#define CPUSTATE_KERNEL_RESET 14 /* Board reset via SW*/
26#define CPUSTATE_KERNEL_HALT 15 /* Board halted via SW*/
diff --git a/include/linux/hid.h b/include/linux/hid.h
index b1344ec4b7fc..42a0f1d11365 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -308,11 +308,14 @@ struct hid_item {
308#define HID_QUIRK_NOTOUCH 0x00000002 308#define HID_QUIRK_NOTOUCH 0x00000002
309#define HID_QUIRK_IGNORE 0x00000004 309#define HID_QUIRK_IGNORE 0x00000004
310#define HID_QUIRK_NOGET 0x00000008 310#define HID_QUIRK_NOGET 0x00000008
311#define HID_QUIRK_HIDDEV_FORCE 0x00000010
311#define HID_QUIRK_BADPAD 0x00000020 312#define HID_QUIRK_BADPAD 0x00000020
312#define HID_QUIRK_MULTI_INPUT 0x00000040 313#define HID_QUIRK_MULTI_INPUT 0x00000040
314#define HID_QUIRK_HIDINPUT_FORCE 0x00000080
313#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 315#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
314#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 316#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
315#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 317#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
318#define HID_QUIRK_NO_IGNORE 0x40000000
316 319
317/* 320/*
318 * This is the global environment of the parser. This information is 321 * This is the global environment of the parser. This information is
@@ -589,6 +592,9 @@ struct hid_usage_id {
589 * @report_fixup: called before report descriptor parsing (NULL means nop) 592 * @report_fixup: called before report descriptor parsing (NULL means nop)
590 * @input_mapping: invoked on input registering before mapping an usage 593 * @input_mapping: invoked on input registering before mapping an usage
591 * @input_mapped: invoked on input registering after mapping an usage 594 * @input_mapped: invoked on input registering after mapping an usage
595 * @suspend: invoked on suspend (NULL means nop)
596 * @resume: invoked on resume if device was not reset (NULL means nop)
597 * @reset_resume: invoked on resume if device was reset (NULL means nop)
592 * 598 *
593 * raw_event and event should return 0 on no action performed, 1 when no 599 * raw_event and event should return 0 on no action performed, 1 when no
594 * further processing should be done and negative on error 600 * further processing should be done and negative on error
@@ -629,6 +635,11 @@ struct hid_driver {
629 int (*input_mapped)(struct hid_device *hdev, 635 int (*input_mapped)(struct hid_device *hdev,
630 struct hid_input *hidinput, struct hid_field *field, 636 struct hid_input *hidinput, struct hid_field *field,
631 struct hid_usage *usage, unsigned long **bit, int *max); 637 struct hid_usage *usage, unsigned long **bit, int *max);
638#ifdef CONFIG_PM
639 int (*suspend)(struct hid_device *hdev, pm_message_t message);
640 int (*resume)(struct hid_device *hdev);
641 int (*reset_resume)(struct hid_device *hdev);
642#endif
632/* private: */ 643/* private: */
633 struct device_driver driver; 644 struct device_driver driver;
634}; 645};
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 74152c08ad07..e3060ef85b6d 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -2,6 +2,7 @@
2#define _LINUX_HIGHMEM_H 2#define _LINUX_HIGHMEM_H
3 3
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <linux/kernel.h>
5#include <linux/mm.h> 6#include <linux/mm.h>
6#include <linux/uaccess.h> 7#include <linux/uaccess.h>
7 8
@@ -27,7 +28,7 @@ static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
27 28
28#include <asm/kmap_types.h> 29#include <asm/kmap_types.h>
29 30
30#if defined(CONFIG_DEBUG_HIGHMEM) && defined(CONFIG_TRACE_IRQFLAGS_SUPPORT) 31#ifdef CONFIG_DEBUG_HIGHMEM
31 32
32void debug_kmap_atomic(enum km_type type); 33void debug_kmap_atomic(enum km_type type);
33 34
@@ -72,7 +73,11 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
72} 73}
73#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 74#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx)
74 75
75#define kunmap_atomic(addr, idx) do { pagefault_enable(); } while (0) 76static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx)
77{
78 pagefault_enable();
79}
80
76#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 81#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx))
77#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 82#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
78 83
@@ -81,6 +86,13 @@ static inline void *kmap_atomic(struct page *page, enum km_type idx)
81 86
82#endif /* CONFIG_HIGHMEM */ 87#endif /* CONFIG_HIGHMEM */
83 88
89/* Prevent people trying to call kunmap_atomic() as if it were kunmap() */
90/* kunmap_atomic() should get the return value of kmap_atomic, not the page. */
91#define kunmap_atomic(addr, idx) do { \
92 BUILD_BUG_ON(__same_type((addr), struct page *)); \
93 kunmap_atomic_notypecheck((addr), (idx)); \
94 } while (0)
95
84/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */ 96/* when CONFIG_HIGHMEM is not set these will be plain clear/copy_page */
85#ifndef clear_user_highpage 97#ifndef clear_user_highpage
86static inline void clear_user_highpage(struct page *page, unsigned long vaddr) 98static inline void clear_user_highpage(struct page *page, unsigned long vaddr)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 5d86fb2309d2..fd0c1b857d3d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -422,6 +422,8 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
422 422
423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, 423extern int schedule_hrtimeout_range(ktime_t *expires, unsigned long delta,
424 const enum hrtimer_mode mode); 424 const enum hrtimer_mode mode);
425extern int schedule_hrtimeout_range_clock(ktime_t *expires,
426 unsigned long delta, const enum hrtimer_mode mode, int clock);
425extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode); 427extern int schedule_hrtimeout(ktime_t *expires, const enum hrtimer_mode mode);
426 428
427/* Soft interrupt function to run the hrtimer queues: */ 429/* Soft interrupt function to run the hrtimer queues: */
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index c70d27af03f9..a2d6ea49ec56 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -9,9 +9,22 @@ enum {
9}; 9};
10 10
11enum { 11enum {
12 HW_BREAKPOINT_R = 1, 12 HW_BREAKPOINT_EMPTY = 0,
13 HW_BREAKPOINT_W = 2, 13 HW_BREAKPOINT_R = 1,
14 HW_BREAKPOINT_X = 4, 14 HW_BREAKPOINT_W = 2,
15 HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
16 HW_BREAKPOINT_X = 4,
17 HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
18};
19
20enum bp_type_idx {
21 TYPE_INST = 0,
22#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
23 TYPE_DATA = 0,
24#else
25 TYPE_DATA = 1,
26#endif
27 TYPE_MAX
15}; 28};
16 29
17#ifdef __KERNEL__ 30#ifdef __KERNEL__
@@ -34,6 +47,12 @@ static inline void hw_breakpoint_init(struct perf_event_attr *attr)
34 attr->sample_period = 1; 47 attr->sample_period = 1;
35} 48}
36 49
50static inline void ptrace_breakpoint_init(struct perf_event_attr *attr)
51{
52 hw_breakpoint_init(attr);
53 attr->exclude_kernel = 1;
54}
55
37static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) 56static inline unsigned long hw_breakpoint_addr(struct perf_event *bp)
38{ 57{
39 return bp->attr.bp_addr; 58 return bp->attr.bp_addr;
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
new file mode 100644
index 000000000000..78ebf507ce56
--- /dev/null
+++ b/include/linux/i2c-omap.h
@@ -0,0 +1,9 @@
1#ifndef __I2C_OMAP_H__
2#define __I2C_OMAP_H__
3
4struct omap_i2c_bus_platform_data {
5 u32 clkrate;
6 void (*set_mpu_wkup_lat)(struct device *dev, long set);
7};
8
9#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 6ed1d59bfb1e..38dd4025aa4e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -34,6 +34,7 @@
34#include <linux/device.h> /* for struct device */ 34#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/of.h> /* for struct device_node */
37 38
38extern struct bus_type i2c_bus_type; 39extern struct bus_type i2c_bus_type;
39 40
@@ -107,6 +108,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
107 * @shutdown: Callback for device shutdown 108 * @shutdown: Callback for device shutdown
108 * @suspend: Callback for device suspend 109 * @suspend: Callback for device suspend
109 * @resume: Callback for device resume 110 * @resume: Callback for device resume
111 * @alert: Alert callback, for example for the SMBus alert protocol
110 * @command: Callback for bus-wide signaling (optional) 112 * @command: Callback for bus-wide signaling (optional)
111 * @driver: Device driver model driver 113 * @driver: Device driver model driver
112 * @id_table: List of I2C devices supported by this driver 114 * @id_table: List of I2C devices supported by this driver
@@ -232,6 +234,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
232 * @addr: stored in i2c_client.addr 234 * @addr: stored in i2c_client.addr
233 * @platform_data: stored in i2c_client.dev.platform_data 235 * @platform_data: stored in i2c_client.dev.platform_data
234 * @archdata: copied into i2c_client.dev.archdata 236 * @archdata: copied into i2c_client.dev.archdata
237 * @of_node: pointer to OpenFirmware device node
235 * @irq: stored in i2c_client.irq 238 * @irq: stored in i2c_client.irq
236 * 239 *
237 * I2C doesn't actually support hardware probing, although controllers and 240 * I2C doesn't actually support hardware probing, although controllers and
@@ -251,6 +254,9 @@ struct i2c_board_info {
251 unsigned short addr; 254 unsigned short addr;
252 void *platform_data; 255 void *platform_data;
253 struct dev_archdata *archdata; 256 struct dev_archdata *archdata;
257#ifdef CONFIG_OF
258 struct device_node *of_node;
259#endif
254 int irq; 260 int irq;
255}; 261};
256 262
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index 02c9af374741..269181b8f623 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -78,6 +78,40 @@
78 78
79#define ADP5588_KEYMAPSIZE 80 79#define ADP5588_KEYMAPSIZE 80
80 80
81#define GPI_PIN_ROW0 97
82#define GPI_PIN_ROW1 98
83#define GPI_PIN_ROW2 99
84#define GPI_PIN_ROW3 100
85#define GPI_PIN_ROW4 101
86#define GPI_PIN_ROW5 102
87#define GPI_PIN_ROW6 103
88#define GPI_PIN_ROW7 104
89#define GPI_PIN_COL0 105
90#define GPI_PIN_COL1 106
91#define GPI_PIN_COL2 107
92#define GPI_PIN_COL3 108
93#define GPI_PIN_COL4 109
94#define GPI_PIN_COL5 110
95#define GPI_PIN_COL6 111
96#define GPI_PIN_COL7 112
97#define GPI_PIN_COL8 113
98#define GPI_PIN_COL9 114
99
100#define GPI_PIN_ROW_BASE GPI_PIN_ROW0
101#define GPI_PIN_ROW_END GPI_PIN_ROW7
102#define GPI_PIN_COL_BASE GPI_PIN_COL0
103#define GPI_PIN_COL_END GPI_PIN_COL9
104
105#define GPI_PIN_BASE GPI_PIN_ROW_BASE
106#define GPI_PIN_END GPI_PIN_COL_END
107
108#define ADP5588_GPIMAPSIZE_MAX (GPI_PIN_END - GPI_PIN_BASE + 1)
109
110struct adp5588_gpi_map {
111 unsigned short pin;
112 unsigned short sw_evt;
113};
114
81struct adp5588_kpad_platform_data { 115struct adp5588_kpad_platform_data {
82 int rows; /* Number of rows */ 116 int rows; /* Number of rows */
83 int cols; /* Number of columns */ 117 int cols; /* Number of columns */
@@ -87,6 +121,9 @@ struct adp5588_kpad_platform_data {
87 unsigned en_keylock:1; /* Enable Key Lock feature */ 121 unsigned en_keylock:1; /* Enable Key Lock feature */
88 unsigned short unlock_key1; /* Unlock Key 1 */ 122 unsigned short unlock_key1; /* Unlock Key 1 */
89 unsigned short unlock_key2; /* Unlock Key 2 */ 123 unsigned short unlock_key2; /* Unlock Key 2 */
124 const struct adp5588_gpi_map *gpimap;
125 unsigned short gpimapsize;
126 const struct adp5588_gpio_platform_data *gpio_data;
90}; 127};
91 128
92struct adp5588_gpio_platform_data { 129struct adp5588_gpio_platform_data {
diff --git a/include/linux/i2c/adp8860.h b/include/linux/i2c/adp8860.h
new file mode 100644
index 000000000000..0b4d39855c91
--- /dev/null
+++ b/include/linux/i2c/adp8860.h
@@ -0,0 +1,154 @@
1/*
2 * Definitions and platform data for Analog Devices
3 * Backlight drivers ADP8860
4 *
5 * Copyright 2009-2010 Analog Devices Inc.
6 *
7 * Licensed under the GPL-2 or later.
8 */
9
10#ifndef __LINUX_I2C_ADP8860_H
11#define __LINUX_I2C_ADP8860_H
12
13#include <linux/leds.h>
14#include <linux/types.h>
15
16#define ID_ADP8860 8860
17
18#define ADP8860_MAX_BRIGHTNESS 0x7F
19#define FLAG_OFFT_SHIFT 8
20
21/*
22 * LEDs subdevice platform data
23 */
24
25#define ADP8860_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT)
26#define ADP8860_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT)
27#define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
28#define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
29
30#define ADP8860_LED_ONT_200ms 0
31#define ADP8860_LED_ONT_600ms 1
32#define ADP8860_LED_ONT_800ms 2
33#define ADP8860_LED_ONT_1200ms 3
34
35#define ADP8860_LED_D7 (7)
36#define ADP8860_LED_D6 (6)
37#define ADP8860_LED_D5 (5)
38#define ADP8860_LED_D4 (4)
39#define ADP8860_LED_D3 (3)
40#define ADP8860_LED_D2 (2)
41#define ADP8860_LED_D1 (1)
42
43/*
44 * Backlight subdevice platform data
45 */
46
47#define ADP8860_BL_D7 (1 << 6)
48#define ADP8860_BL_D6 (1 << 5)
49#define ADP8860_BL_D5 (1 << 4)
50#define ADP8860_BL_D4 (1 << 3)
51#define ADP8860_BL_D3 (1 << 2)
52#define ADP8860_BL_D2 (1 << 1)
53#define ADP8860_BL_D1 (1 << 0)
54
55#define ADP8860_FADE_T_DIS 0 /* Fade Timer Disabled */
56#define ADP8860_FADE_T_300ms 1 /* 0.3 Sec */
57#define ADP8860_FADE_T_600ms 2
58#define ADP8860_FADE_T_900ms 3
59#define ADP8860_FADE_T_1200ms 4
60#define ADP8860_FADE_T_1500ms 5
61#define ADP8860_FADE_T_1800ms 6
62#define ADP8860_FADE_T_2100ms 7
63#define ADP8860_FADE_T_2400ms 8
64#define ADP8860_FADE_T_2700ms 9
65#define ADP8860_FADE_T_3000ms 10
66#define ADP8860_FADE_T_3500ms 11
67#define ADP8860_FADE_T_4000ms 12
68#define ADP8860_FADE_T_4500ms 13
69#define ADP8860_FADE_T_5000ms 14
70#define ADP8860_FADE_T_5500ms 15 /* 5.5 Sec */
71
72#define ADP8860_FADE_LAW_LINEAR 0
73#define ADP8860_FADE_LAW_SQUARE 1
74#define ADP8860_FADE_LAW_CUBIC1 2
75#define ADP8860_FADE_LAW_CUBIC2 3
76
77#define ADP8860_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */
78#define ADP8860_BL_AMBL_FILT_160ms 1
79#define ADP8860_BL_AMBL_FILT_320ms 2
80#define ADP8860_BL_AMBL_FILT_640ms 3
81#define ADP8860_BL_AMBL_FILT_1280ms 4
82#define ADP8860_BL_AMBL_FILT_2560ms 5
83#define ADP8860_BL_AMBL_FILT_5120ms 6
84#define ADP8860_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */
85
86/*
87 * Blacklight current 0..30mA
88 */
89#define ADP8860_BL_CUR_mA(I) ((I * 127) / 30)
90
91/*
92 * L2 comparator current 0..1106uA
93 */
94#define ADP8860_L2_COMP_CURR_uA(I) ((I * 255) / 1106)
95
96/*
97 * L3 comparator current 0..138uA
98 */
99#define ADP8860_L3_COMP_CURR_uA(I) ((I * 255) / 138)
100
101struct adp8860_backlight_platform_data {
102 u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */
103
104 u8 bl_fade_in; /* Backlight Fade-In Timer */
105 u8 bl_fade_out; /* Backlight Fade-Out Timer */
106 u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */
107
108 u8 en_ambl_sens; /* 1 = enable ambient light sensor */
109 u8 abml_filt; /* Light sensor filter time */
110
111 u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
112 u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
113 u8 l2_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
114 u8 l2_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
115 u8 l3_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
116 u8 l3_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
117
118 u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
119 u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
120 u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
121 u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
122
123 /**
124 * Independent Current Sinks / LEDS
125 * Sinks not assigned to the Backlight can be exposed to
126 * user space using the LEDS CLASS interface
127 */
128
129 int num_leds;
130 struct led_info *leds;
131 u8 led_fade_in; /* LED Fade-In Timer */
132 u8 led_fade_out; /* LED Fade-Out Timer */
133 u8 led_fade_law; /* fade-on/fade-off transfer characteristic */
134 u8 led_on_time;
135
136 /**
137 * Gain down disable. Setting this option does not allow the
138 * charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
139 * 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
140 * The charge pump switches up in gain as needed. This feature is
141 * useful if the ADP8863 charge pump is used to drive an external load.
142 * This feature must be used when utilizing small fly capacitors
143 * (0402 or smaller).
144 * 0 = the charge pump automatically switches up and down in gain.
145 * This provides optimal efficiency, but is not suitable for driving
146 * loads that are not connected through the ADP8863 diode drivers.
147 * Additionally, the charge pump fly capacitors should be low ESR
148 * and sized 0603 or greater.
149 */
150
151 u8 gdwn_dis;
152};
153
154#endif /* __LINUX_I2C_ADP8860_H */
diff --git a/include/linux/i2c/max732x.h b/include/linux/i2c/max732x.h
index e10336631c62..c04bac8bf2fe 100644
--- a/include/linux/i2c/max732x.h
+++ b/include/linux/i2c/max732x.h
@@ -7,6 +7,9 @@ struct max732x_platform_data {
7 /* number of the first GPIO */ 7 /* number of the first GPIO */
8 unsigned gpio_base; 8 unsigned gpio_base;
9 9
10 /* interrupt base */
11 int irq_base;
12
10 void *context; /* param to setup/teardown */ 13 void *context; /* param to setup/teardown */
11 14
12 int (*setup)(struct i2c_client *client, 15 int (*setup)(struct i2c_client *client,
diff --git a/include/linux/i2c/mcs.h b/include/linux/i2c/mcs.h
new file mode 100644
index 000000000000..725ae7c313ff
--- /dev/null
+++ b/include/linux/i2c/mcs.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009 - 2010 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 * Author: HeungJun Kim <riverful.kim@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __LINUX_MCS_H
14#define __LINUX_MCS_H
15
16#define MCS_KEY_MAP(v, c) ((((v) & 0xff) << 16) | ((c) & 0xffff))
17#define MCS_KEY_VAL(v) (((v) >> 16) & 0xff)
18#define MCS_KEY_CODE(v) ((v) & 0xffff)
19
20struct mcs_platform_data {
21 void (*cfg_pin)(void);
22
23 /* touchscreen */
24 unsigned int x_size;
25 unsigned int y_size;
26
27 /* touchkey */
28 const u32 *keymap;
29 unsigned int keymap_size;
30 unsigned int key_maxval;
31 bool no_autorepeat;
32};
33
34#endif /* __LINUX_MCS_H */
diff --git a/include/linux/i2c/mcs5000_ts.h b/include/linux/i2c/mcs5000_ts.h
deleted file mode 100644
index 5a117b5ca15e..000000000000
--- a/include/linux/i2c/mcs5000_ts.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * mcs5000_ts.h
3 *
4 * Copyright (C) 2009 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MCS5000_TS_H
15#define __LINUX_MCS5000_TS_H
16
17/* platform data for the MELFAS MCS-5000 touchscreen driver */
18struct mcs5000_ts_platform_data {
19 void (*cfg_pin)(void);
20 int x_size;
21 int y_size;
22};
23
24#endif /* __LINUX_MCS5000_TS_H */
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index d5c5a60c8a0b..139ba52667c8 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -24,7 +24,7 @@ struct pca953x_platform_data {
24 int (*teardown)(struct i2c_client *client, 24 int (*teardown)(struct i2c_client *client,
25 unsigned gpio, unsigned ngpio, 25 unsigned gpio, unsigned ngpio,
26 void *context); 26 void *context);
27 char **names; 27 const char *const *names;
28}; 28};
29 29
30#endif /* _LINUX_PCA953X_H */ 30#endif /* _LINUX_PCA953X_H */
diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/qt602240_ts.h
new file mode 100644
index 000000000000..c5033e101094
--- /dev/null
+++ b/include/linux/i2c/qt602240_ts.h
@@ -0,0 +1,38 @@
1/*
2 * AT42QT602240/ATMXT224 Touchscreen driver
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __LINUX_QT602240_TS_H
14#define __LINUX_QT602240_TS_H
15
16/* Orient */
17#define QT602240_NORMAL 0x0
18#define QT602240_DIAGONAL 0x1
19#define QT602240_HORIZONTAL_FLIP 0x2
20#define QT602240_ROTATED_90_COUNTER 0x3
21#define QT602240_VERTICAL_FLIP 0x4
22#define QT602240_ROTATED_90 0x5
23#define QT602240_ROTATED_180 0x6
24#define QT602240_DIAGONAL_COUNTER 0x7
25
26/* The platform data for the AT42QT602240/ATMXT224 touchscreen driver */
27struct qt602240_platform_data {
28 unsigned int x_line;
29 unsigned int y_line;
30 unsigned int x_size;
31 unsigned int y_size;
32 unsigned int blen;
33 unsigned int threshold;
34 unsigned int voltage;
35 unsigned char orient;
36};
37
38#endif /* __LINUX_QT602240_TS_H */
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h
new file mode 100644
index 000000000000..ee3049cb9ba5
--- /dev/null
+++ b/include/linux/i2c/sx150x.h
@@ -0,0 +1,78 @@
1/*
2 * Driver for the Semtech SX150x I2C GPIO Expanders
3 *
4 * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 and
8 * only version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20#ifndef __LINUX_I2C_SX150X_H
21#define __LINUX_I2C_SX150X_H
22
23/**
24 * struct sx150x_platform_data - config data for SX150x driver
25 * @gpio_base: The index number of the first GPIO assigned to this
26 * GPIO expander. The expander will create a block of
27 * consecutively numbered gpios beginning at the given base,
28 * with the size of the block depending on the model of the
29 * expander chip.
30 * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
31 * instead of as an oscillator, increasing the size of the
32 * GP(I)O pool created by this expander by one. The
33 * output-only GPO pin will be added at the end of the block.
34 * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
35 * for each IO line in the expander. Setting the bit at
36 * position n will enable the pull-up for the IO at
37 * the corresponding offset. For chips with fewer than
38 * 16 IO pins, high-end bits are ignored.
39 * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
40 * resistor for each IO line in the expander. Setting the
41 * bit at position n will enable the pull-down for the IO at
42 * the corresponding offset. For chips with fewer than
43 * 16 IO pins, high-end bits are ignored.
44 * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
45 * operation for each IO line in the expander. Setting the
46 * bit at position n enables open-drain operation for
47 * the IO at the corresponding offset. Clearing the bit
48 * enables regular push-pull operation for that IO.
49 * For chips with fewer than 16 IO pins, high-end bits
50 * are ignored.
51 * @io_polarity: A bit-mask which enables polarity inversion for each IO line
52 * in the expander. Setting the bit at position n inverts
53 * the polarity of that IO line, while clearing it results
54 * in normal polarity. For chips with fewer than 16 IO pins,
55 * high-end bits are ignored.
56 * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
57 * is connected, via which it reports interrupt events
58 * across all GPIO lines. This must be a real,
59 * pre-existing IRQ line.
60 * Setting this value < 0 disables the irq_chip functionality
61 * of the driver.
62 * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
63 * IRQ lines will appear. Similarly to gpio_base, the expander
64 * will create a block of irqs beginning at this number.
65 * This value is ignored if irq_summary is < 0.
66 */
67struct sx150x_platform_data {
68 unsigned gpio_base;
69 bool oscio_is_gpo;
70 u16 io_pullup_ena;
71 u16 io_pulldn_ena;
72 u16 io_open_drain_ena;
73 u16 io_polarity;
74 int irq_summary;
75 unsigned irq_base;
76};
77
78#endif /* __LINUX_I2C_SX150X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index fb6784e86d5f..6de90bfc6acd 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -496,7 +496,7 @@ struct twl4030_madc_platform_data {
496 int irq_line; 496 int irq_line;
497}; 497};
498 498
499/* Boards have uniqe mappings of {row, col} --> keycode. 499/* Boards have unique mappings of {row, col} --> keycode.
500 * Column and row are 8 bits each, but range only from 0..7. 500 * Column and row are 8 bits each, but range only from 0..7.
501 * a PERSISTENT_KEY is "always on" and never reported. 501 * a PERSISTENT_KEY is "always on" and never reported.
502 */ 502 */
@@ -569,9 +569,9 @@ struct twl4030_codec_data {
569 struct twl4030_codec_audio_data *audio; 569 struct twl4030_codec_audio_data *audio;
570 struct twl4030_codec_vibra_data *vibra; 570 struct twl4030_codec_vibra_data *vibra;
571 571
572 /* twl6030 */ 572 /* twl6040 */
573 int audpwron_gpio; /* audio power-on gpio */ 573 int audpwron_gpio; /* audio power-on gpio */
574 int naudint_irq; /* audio interrupt */ 574 int naudint_irq; /* audio interrupt */
575}; 575};
576 576
577struct twl4030_platform_data { 577struct twl4030_platform_data {
@@ -664,15 +664,15 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
664#define TWL4030_REG_VUSB3V1 19 664#define TWL4030_REG_VUSB3V1 19
665 665
666/* TWL6030 SMPS/LDO's */ 666/* TWL6030 SMPS/LDO's */
667/* EXTERNAL dc-to-dc buck convertor contollable via SR */ 667/* EXTERNAL dc-to-dc buck convertor controllable via SR */
668#define TWL6030_REG_VDD1 30 668#define TWL6030_REG_VDD1 30
669#define TWL6030_REG_VDD2 31 669#define TWL6030_REG_VDD2 31
670#define TWL6030_REG_VDD3 32 670#define TWL6030_REG_VDD3 32
671 671
672/* Non SR compliant dc-to-dc buck convertors */ 672/* Non SR compliant dc-to-dc buck convertors */
673#define TWL6030_REG_VMEM 33 673#define TWL6030_REG_VMEM 33
674#define TWL6030_REG_V2V1 34 674#define TWL6030_REG_V2V1 34
675#define TWL6030_REG_V1V29 35 675#define TWL6030_REG_V1V29 35
676#define TWL6030_REG_V1V8 36 676#define TWL6030_REG_V1V8 36
677 677
678/* EXTERNAL LDOs */ 678/* EXTERNAL LDOs */
diff --git a/include/linux/i8042.h b/include/linux/i8042.h
index 9bf6870ee5f4..a986ff588944 100644
--- a/include/linux/i8042.h
+++ b/include/linux/i8042.h
@@ -46,31 +46,31 @@ int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
46 46
47#else 47#else
48 48
49void i8042_lock_chip(void) 49static inline void i8042_lock_chip(void)
50{ 50{
51} 51}
52 52
53void i8042_unlock_chip(void) 53static inline void i8042_unlock_chip(void)
54{ 54{
55} 55}
56 56
57int i8042_command(unsigned char *param, int command) 57static inline int i8042_command(unsigned char *param, int command)
58{ 58{
59 return -ENODEV; 59 return -ENODEV;
60} 60}
61 61
62bool i8042_check_port_owner(const struct serio *serio) 62static inline bool i8042_check_port_owner(const struct serio *serio)
63{ 63{
64 return false; 64 return false;
65} 65}
66 66
67int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str, 67static inline int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
68 struct serio *serio)) 68 struct serio *serio))
69{ 69{
70 return -ENODEV; 70 return -ENODEV;
71} 71}
72 72
73int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str, 73static inline int i8042_remove_filter(bool (*filter)(unsigned char data, unsigned char str,
74 struct serio *serio)) 74 struct serio *serio))
75{ 75{
76 return -ENODEV; 76 return -ENODEV;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 3239d1c10acb..072fe8c93e6f 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -362,7 +362,7 @@ struct ide_drive_s;
362struct ide_disk_ops { 362struct ide_disk_ops {
363 int (*check)(struct ide_drive_s *, const char *); 363 int (*check)(struct ide_drive_s *, const char *);
364 int (*get_capacity)(struct ide_drive_s *); 364 int (*get_capacity)(struct ide_drive_s *);
365 u64 (*set_capacity)(struct ide_drive_s *, u64); 365 void (*unlock_native_capacity)(struct ide_drive_s *);
366 void (*setup)(struct ide_drive_s *); 366 void (*setup)(struct ide_drive_s *);
367 void (*flush)(struct ide_drive_s *); 367 void (*flush)(struct ide_drive_s *);
368 int (*init_media)(struct ide_drive_s *, struct gendisk *); 368 int (*init_media)(struct ide_drive_s *, struct gendisk *);
@@ -458,7 +458,7 @@ enum {
458 IDE_DFLAG_DOORLOCKING = (1 << 15), 458 IDE_DFLAG_DOORLOCKING = (1 << 15),
459 /* disallow DMA */ 459 /* disallow DMA */
460 IDE_DFLAG_NODMA = (1 << 16), 460 IDE_DFLAG_NODMA = (1 << 16),
461 /* powermanagment told us not to do anything, so sleep nicely */ 461 /* powermanagement told us not to do anything, so sleep nicely */
462 IDE_DFLAG_BLOCKED = (1 << 17), 462 IDE_DFLAG_BLOCKED = (1 << 17),
463 /* sleeping & sleep field valid */ 463 /* sleeping & sleep field valid */
464 IDE_DFLAG_SLEEPING = (1 << 18), 464 IDE_DFLAG_SLEEPING = (1 << 18),
@@ -516,8 +516,8 @@ struct ide_drive_s {
516 u8 current_speed; /* current transfer rate set */ 516 u8 current_speed; /* current transfer rate set */
517 u8 desired_speed; /* desired transfer rate set */ 517 u8 desired_speed; /* desired transfer rate set */
518 u8 pio_mode; /* for ->set_pio_mode _only_ */ 518 u8 pio_mode; /* for ->set_pio_mode _only_ */
519 u8 dma_mode; /* for ->dma_pio_mode _only_ */ 519 u8 dma_mode; /* for ->set_dma_mode _only_ */
520 u8 dn; /* now wide spread use */ 520 u8 dn; /* now wide spread use */
521 u8 acoustic; /* acoustic management */ 521 u8 acoustic; /* acoustic management */
522 u8 media; /* disk, cdrom, tape, floppy, ... */ 522 u8 media; /* disk, cdrom, tape, floppy, ... */
523 u8 ready_stat; /* min status value for drive ready */ 523 u8 ready_stat; /* min status value for drive ready */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 19984958ab7b..97b2eae6a22c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -876,6 +876,7 @@ struct ieee80211_ht_cap {
876#define IEEE80211_HT_CAP_SGI_40 0x0040 876#define IEEE80211_HT_CAP_SGI_40 0x0040
877#define IEEE80211_HT_CAP_TX_STBC 0x0080 877#define IEEE80211_HT_CAP_TX_STBC 0x0080
878#define IEEE80211_HT_CAP_RX_STBC 0x0300 878#define IEEE80211_HT_CAP_RX_STBC 0x0300
879#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8
879#define IEEE80211_HT_CAP_DELAY_BA 0x0400 880#define IEEE80211_HT_CAP_DELAY_BA 0x0400
880#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 881#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
881#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 882#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
@@ -1211,6 +1212,8 @@ enum ieee80211_category {
1211 WLAN_CATEGORY_SA_QUERY = 8, 1212 WLAN_CATEGORY_SA_QUERY = 8,
1212 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1213 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1213 WLAN_CATEGORY_WMM = 17, 1214 WLAN_CATEGORY_WMM = 17,
1215 WLAN_CATEGORY_MESH_PLINK = 30, /* Pending ANA approval */
1216 WLAN_CATEGORY_MESH_PATH_SEL = 32, /* Pending ANA approval */
1214 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1217 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1215 WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1218 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1216}; 1219};
@@ -1324,7 +1327,6 @@ enum ieee80211_back_actioncode {
1324enum ieee80211_back_parties { 1327enum ieee80211_back_parties {
1325 WLAN_BACK_RECIPIENT = 0, 1328 WLAN_BACK_RECIPIENT = 0,
1326 WLAN_BACK_INITIATOR = 1, 1329 WLAN_BACK_INITIATOR = 1,
1327 WLAN_BACK_TIMER = 2,
1328}; 1330};
1329 1331
1330/* SA Query action */ 1332/* SA Query action */
diff --git a/include/linux/if.h b/include/linux/if.h
index 3a9f410a296b..53558ec59e1b 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,6 +71,10 @@
71 * release skb->dst 71 * release skb->dst
72 */ 72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ 73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_IN_NETPOLL 0x1000 /* whether we are processing netpoll */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */
76#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */
77#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */
74 78
75#define IF_GET_IFACE 0x0001 /* for querying only */ 79#define IF_GET_IFACE 0x0001 /* for querying only */
76#define IF_GET_PROTO 0x0002 80#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index e80b7f88f7c6..6d722f41ee7c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -90,6 +90,7 @@
90 90
91#define ARPHRD_PHONET 820 /* PhoNet media type */ 91#define ARPHRD_PHONET 820 /* PhoNet media type */
92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 92#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
93#define ARPHRD_CAIF 822 /* CAIF media type */
93 94
94#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 95#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
95#define ARPHRD_NONE 0xFFFE /* zero header length */ 96#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h
index cd525fae3c98..2c7994372bde 100644
--- a/include/linux/if_bonding.h
+++ b/include/linux/if_bonding.h
@@ -83,6 +83,7 @@
83 83
84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */ 84#define BOND_DEFAULT_MAX_BONDS 1 /* Default maximum number of devices to support */
85 85
86#define BOND_DEFAULT_TX_QUEUES 16 /* Default number of tx queues per device */
86/* hashing types */ 87/* hashing types */
87#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ 88#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
88#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */ 89#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 938b7e81df95..0d241a5c4909 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -102,8 +102,6 @@ struct __fdb_entry {
102#include <linux/netdevice.h> 102#include <linux/netdevice.h>
103 103
104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
105extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
106 struct sk_buff *skb);
107extern int (*br_should_route_hook)(struct sk_buff *skb); 105extern int (*br_should_route_hook)(struct sk_buff *skb);
108 106
109#endif 107#endif
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 299b4121f914..c831467774d0 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -109,6 +109,7 @@
109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ 109#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 110#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ 111#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
112#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
112 113
113/* 114/*
114 * This is an Ethernet frame header. 115 * This is an Ethernet frame header.
@@ -118,7 +119,7 @@ struct ethhdr {
118 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
119 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 120 unsigned char h_source[ETH_ALEN]; /* source ether addr */
120 __be16 h_proto; /* packet type ID field */ 121 __be16 h_proto; /* packet type ID field */
121} __attribute__((packed)); 122} __packed;
122 123
123#ifdef __KERNEL__ 124#ifdef __KERNEL__
124#include <linux/skbuff.h> 125#include <linux/skbuff.h>
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index 5459c5c09930..9947c39e62f6 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */ 67 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */ 68 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */ 69 __u8 ctrl; /* control byte #1 */
70} __attribute__ ((packed)); 70} __packed;
71 71
72/* Define 802.2 Type 2 header */ 72/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr { 73struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr {
75 __u8 ssap; /* source service access point */ 75 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */ 76 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */ 77 __u8 ctrl_2; /* control byte #2 */
78} __attribute__ ((packed)); 78} __packed;
79 79
80/* Define 802.2 SNAP header */ 80/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3 81#define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr {
85 __u8 ctrl; /* always 0x03 */ 85 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */ 86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */ 87 __be16 ethertype; /* packet type ID field */
88} __attribute__ ((packed)); 88} __packed;
89 89
90/* Define FDDI LLC frame header */ 90/* Define FDDI LLC frame header */
91struct fddihdr { 91struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr {
98 struct fddi_8022_2_hdr llc_8022_2; 98 struct fddi_8022_2_hdr llc_8022_2;
99 struct fddi_snap_hdr llc_snap; 99 struct fddi_snap_hdr llc_snap;
100 } hdr; 100 } hdr;
101} __attribute__ ((packed)); 101} __packed;
102 102
103#ifdef __KERNEL__ 103#ifdef __KERNEL__
104#include <linux/netdevice.h> 104#include <linux/netdevice.h>
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 80b3a1056a5f..191ee0869bc1 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -135,7 +135,7 @@ struct frhdr
135 __be16 PID; 135 __be16 PID;
136 136
137#define IP_NLPID pad 137#define IP_NLPID pad
138} __attribute__((packed)); 138} __packed;
139 139
140/* see RFC 1490 for the definition of the following */ 140/* see RFC 1490 for the definition of the following */
141#define FRAD_I_UI 0x03 141#define FRAD_I_UI 0x03
diff --git a/include/linux/if_hippi.h b/include/linux/if_hippi.h
index 8d038eb8db5c..5fe5f307c6f5 100644
--- a/include/linux/if_hippi.h
+++ b/include/linux/if_hippi.h
@@ -104,7 +104,7 @@ struct hippi_fp_hdr {
104 __be32 fixed; 104 __be32 fixed;
105#endif 105#endif
106 __be32 d2_size; 106 __be32 d2_size;
107} __attribute__ ((packed)); 107} __packed;
108 108
109struct hippi_le_hdr { 109struct hippi_le_hdr {
110#if defined (__BIG_ENDIAN_BITFIELD) 110#if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr {
129 __u8 daddr[HIPPI_ALEN]; 129 __u8 daddr[HIPPI_ALEN];
130 __u16 locally_administered; 130 __u16 locally_administered;
131 __u8 saddr[HIPPI_ALEN]; 131 __u8 saddr[HIPPI_ALEN];
132} __attribute__ ((packed)); 132} __packed;
133 133
134#define HIPPI_OUI_LEN 3 134#define HIPPI_OUI_LEN 3
135/* 135/*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr {
142 __u8 ctrl; /* always 0x03 */ 142 __u8 ctrl; /* always 0x03 */
143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/ 143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
144 __be16 ethertype; /* packet type ID field */ 144 __be16 ethertype; /* packet type ID field */
145} __attribute__ ((packed)); 145} __packed;
146 146
147struct hippi_hdr { 147struct hippi_hdr {
148 struct hippi_fp_hdr fp; 148 struct hippi_fp_hdr fp;
149 struct hippi_le_hdr le; 149 struct hippi_le_hdr le;
150 struct hippi_snap_hdr snap; 150 struct hippi_snap_hdr snap;
151} __attribute__ ((packed)); 151} __packed;
152 152
153#endif /* _LINUX_IF_HIPPI_H */ 153#endif /* _LINUX_IF_HIPPI_H */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c9bf92cd7653..2fc66dd783ee 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -4,7 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6 6
7/* The struct should be in sync with struct net_device_stats */ 7/* This struct should be in sync with struct rtnl_link_stats64 */
8struct rtnl_link_stats { 8struct rtnl_link_stats {
9 __u32 rx_packets; /* total packets received */ 9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */ 10 __u32 tx_packets; /* total packets transmitted */
@@ -37,6 +37,39 @@ struct rtnl_link_stats {
37 __u32 tx_compressed; 37 __u32 tx_compressed;
38}; 38};
39 39
40/* The main device statistics structure */
41struct rtnl_link_stats64 {
42 __u64 rx_packets; /* total packets received */
43 __u64 tx_packets; /* total packets transmitted */
44 __u64 rx_bytes; /* total bytes received */
45 __u64 tx_bytes; /* total bytes transmitted */
46 __u64 rx_errors; /* bad packets received */
47 __u64 tx_errors; /* packet transmit problems */
48 __u64 rx_dropped; /* no space in linux buffers */
49 __u64 tx_dropped; /* no space available in linux */
50 __u64 multicast; /* multicast packets received */
51 __u64 collisions;
52
53 /* detailed rx_errors: */
54 __u64 rx_length_errors;
55 __u64 rx_over_errors; /* receiver ring buff overflow */
56 __u64 rx_crc_errors; /* recved pkt with crc error */
57 __u64 rx_frame_errors; /* recv'd frame alignment error */
58 __u64 rx_fifo_errors; /* recv'r fifo overrun */
59 __u64 rx_missed_errors; /* receiver missed packet */
60
61 /* detailed tx_errors */
62 __u64 tx_aborted_errors;
63 __u64 tx_carrier_errors;
64 __u64 tx_fifo_errors;
65 __u64 tx_heartbeat_errors;
66 __u64 tx_window_errors;
67
68 /* for cslip etc */
69 __u64 rx_compressed;
70 __u64 tx_compressed;
71};
72
40/* The struct should be in sync with struct ifmap */ 73/* The struct should be in sync with struct ifmap */
41struct rtnl_link_ifmap { 74struct rtnl_link_ifmap {
42 __u64 mem_start; 75 __u64 mem_start;
@@ -79,10 +112,10 @@ enum {
79 IFLA_NET_NS_PID, 112 IFLA_NET_NS_PID,
80 IFLA_IFALIAS, 113 IFLA_IFALIAS,
81 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ 114 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
82 IFLA_VF_MAC, /* Hardware queue specific attributes */ 115 IFLA_VFINFO_LIST,
83 IFLA_VF_VLAN, 116 IFLA_STATS64,
84 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ 117 IFLA_VF_PORTS,
85 IFLA_VFINFO, 118 IFLA_PORT_SELF,
86 __IFLA_MAX 119 __IFLA_MAX
87}; 120};
88 121
@@ -201,7 +234,25 @@ enum macvlan_mode {
201 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */ 234 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
202}; 235};
203 236
204/* SR-IOV virtual function managment section */ 237/* SR-IOV virtual function management section */
238
239enum {
240 IFLA_VF_INFO_UNSPEC,
241 IFLA_VF_INFO,
242 __IFLA_VF_INFO_MAX,
243};
244
245#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
246
247enum {
248 IFLA_VF_UNSPEC,
249 IFLA_VF_MAC, /* Hardware queue specific attributes */
250 IFLA_VF_VLAN,
251 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
252 __IFLA_VF_MAX,
253};
254
255#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
205 256
206struct ifla_vf_mac { 257struct ifla_vf_mac {
207 __u32 vf; 258 __u32 vf;
@@ -226,4 +277,77 @@ struct ifla_vf_info {
226 __u32 qos; 277 __u32 qos;
227 __u32 tx_rate; 278 __u32 tx_rate;
228}; 279};
280
281/* VF ports management section
282 *
283 * Nested layout of set/get msg is:
284 *
285 * [IFLA_NUM_VF]
286 * [IFLA_VF_PORTS]
287 * [IFLA_VF_PORT]
288 * [IFLA_PORT_*], ...
289 * [IFLA_VF_PORT]
290 * [IFLA_PORT_*], ...
291 * ...
292 * [IFLA_PORT_SELF]
293 * [IFLA_PORT_*], ...
294 */
295
296enum {
297 IFLA_VF_PORT_UNSPEC,
298 IFLA_VF_PORT, /* nest */
299 __IFLA_VF_PORT_MAX,
300};
301
302#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
303
304enum {
305 IFLA_PORT_UNSPEC,
306 IFLA_PORT_VF, /* __u32 */
307 IFLA_PORT_PROFILE, /* string */
308 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
309 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
310 IFLA_PORT_HOST_UUID, /* binary UUID */
311 IFLA_PORT_REQUEST, /* __u8 */
312 IFLA_PORT_RESPONSE, /* __u16, output only */
313 __IFLA_PORT_MAX,
314};
315
316#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
317
318#define PORT_PROFILE_MAX 40
319#define PORT_UUID_MAX 16
320#define PORT_SELF_VF -1
321
322enum {
323 PORT_REQUEST_PREASSOCIATE = 0,
324 PORT_REQUEST_PREASSOCIATE_RR,
325 PORT_REQUEST_ASSOCIATE,
326 PORT_REQUEST_DISASSOCIATE,
327};
328
329enum {
330 PORT_VDP_RESPONSE_SUCCESS = 0,
331 PORT_VDP_RESPONSE_INVALID_FORMAT,
332 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
333 PORT_VDP_RESPONSE_UNUSED_VTID,
334 PORT_VDP_RESPONSE_VTID_VIOLATION,
335 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
336 PORT_VDP_RESPONSE_OUT_OF_SYNC,
337 /* 0x08-0xFF reserved for future VDP use */
338 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
339 PORT_PROFILE_RESPONSE_INPROGRESS,
340 PORT_PROFILE_RESPONSE_INVALID,
341 PORT_PROFILE_RESPONSE_BADSTATE,
342 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
343 PORT_PROFILE_RESPONSE_ERROR,
344};
345
346struct ifla_port_vsi {
347 __u8 vsi_mgr_id;
348 __u8 vsi_type_id[3];
349 __u8 vsi_type_version;
350 __u8 pad[3];
351};
352
229#endif /* _LINUX_IF_LINK_H */ 353#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index b78a712247da..35280b302290 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -6,6 +6,7 @@
6#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <linux/netlink.h> 7#include <linux/netlink.h>
8#include <net/netlink.h> 8#include <net/netlink.h>
9#include <linux/u64_stats_sync.h>
9 10
10#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) 11#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE)
11struct socket *macvtap_get_socket(struct file *); 12struct socket *macvtap_get_socket(struct file *);
@@ -27,14 +28,16 @@ struct macvtap_queue;
27 * struct macvlan_rx_stats - MACVLAN percpu rx stats 28 * struct macvlan_rx_stats - MACVLAN percpu rx stats
28 * @rx_packets: number of received packets 29 * @rx_packets: number of received packets
29 * @rx_bytes: number of received bytes 30 * @rx_bytes: number of received bytes
30 * @multicast: number of received multicast packets 31 * @rx_multicast: number of received multicast packets
32 * @syncp: synchronization point for 64bit counters
31 * @rx_errors: number of errors 33 * @rx_errors: number of errors
32 */ 34 */
33struct macvlan_rx_stats { 35struct macvlan_rx_stats {
34 unsigned long rx_packets; 36 u64 rx_packets;
35 unsigned long rx_bytes; 37 u64 rx_bytes;
36 unsigned long multicast; 38 u64 rx_multicast;
37 unsigned long rx_errors; 39 struct u64_stats_sync syncp;
40 unsigned long rx_errors;
38}; 41};
39 42
40struct macvlan_dev { 43struct macvlan_dev {
@@ -56,17 +59,21 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
56{ 59{
57 struct macvlan_rx_stats *rx_stats; 60 struct macvlan_rx_stats *rx_stats;
58 61
59 rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id()); 62 rx_stats = this_cpu_ptr(vlan->rx_stats);
60 if (likely(success)) { 63 if (likely(success)) {
64 u64_stats_update_begin(&rx_stats->syncp);
61 rx_stats->rx_packets++;; 65 rx_stats->rx_packets++;;
62 rx_stats->rx_bytes += len; 66 rx_stats->rx_bytes += len;
63 if (multicast) 67 if (multicast)
64 rx_stats->multicast++; 68 rx_stats->rx_multicast++;
69 u64_stats_update_end(&rx_stats->syncp);
65 } else { 70 } else {
66 rx_stats->rx_errors++; 71 rx_stats->rx_errors++;
67 } 72 }
68} 73}
69 74
75extern void macvlan_common_setup(struct net_device *dev);
76
70extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, 77extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
71 struct nlattr *tb[], struct nlattr *data[], 78 struct nlattr *tb[], struct nlattr *data[],
72 int (*receive)(struct sk_buff *skb), 79 int (*receive)(struct sk_buff *skb),
@@ -84,7 +91,4 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops);
84extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, 91extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
85 struct net_device *dev); 92 struct net_device *dev);
86 93
87
88extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *);
89
90#endif /* _LINUX_IF_MACVLAN_H */ 94#endif /* _LINUX_IF_MACVLAN_H */
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index aa57a5f993fc..72bfa5a034dd 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -47,6 +47,8 @@ struct sockaddr_ll {
47#define PACKET_TX_RING 13 47#define PACKET_TX_RING 13
48#define PACKET_LOSS 14 48#define PACKET_LOSS 14
49#define PACKET_VNET_HDR 15 49#define PACKET_VNET_HDR 15
50#define PACKET_TX_TIMESTAMP 16
51#define PACKET_TIMESTAMP 17
50 52
51struct tpacket_stats { 53struct tpacket_stats {
52 unsigned int tp_packets; 54 unsigned int tp_packets;
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index c58baea4a25b..184bc5566207 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -2,7 +2,7 @@
2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661) 2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
3 * 3 *
4 * This file supplies definitions required by the PPP over L2TP driver 4 * This file supplies definitions required by the PPP over L2TP driver
5 * (pppol2tp.c). All version information wrt this file is located in pppol2tp.c 5 * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c
6 * 6 *
7 * License: 7 * License:
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
@@ -35,6 +35,20 @@ struct pppol2tp_addr {
35 __u16 d_tunnel, d_session; /* For sending outgoing packets */ 35 __u16 d_tunnel, d_session; /* For sending outgoing packets */
36}; 36};
37 37
38/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
39 * bits. So we need a different sockaddr structure.
40 */
41struct pppol2tpv3_addr {
42 pid_t pid; /* pid that owns the fd.
43 * 0 => current */
44 int fd; /* FD of UDP or IP socket to use */
45
46 struct sockaddr_in addr; /* IP address and port to send to */
47
48 __u32 s_tunnel, s_session; /* For matching incoming packets */
49 __u32 d_tunnel, d_session; /* For sending outgoing packets */
50};
51
38/* Socket options: 52/* Socket options:
39 * DEBUG - bitmask of debug message categories 53 * DEBUG - bitmask of debug message categories
40 * SENDSEQ - 0 => don't send packets with sequence numbers 54 * SENDSEQ - 0 => don't send packets with sequence numbers
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 90b5fae5d714..1925e0c3f162 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -59,7 +59,7 @@ struct sockaddr_pppox {
59 union{ 59 union{
60 struct pppoe_addr pppoe; 60 struct pppoe_addr pppoe;
61 }sa_addr; 61 }sa_addr;
62}__attribute__ ((packed)); 62} __packed;
63 63
64/* The use of the above union isn't viable because the size of this 64/* The use of the above union isn't viable because the size of this
65 * struct must stay fixed over time -- applications use sizeof(struct 65 * struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,16 @@ struct sockaddr_pppol2tp {
70 sa_family_t sa_family; /* address family, AF_PPPOX */ 70 sa_family_t sa_family; /* address family, AF_PPPOX */
71 unsigned int sa_protocol; /* protocol identifier */ 71 unsigned int sa_protocol; /* protocol identifier */
72 struct pppol2tp_addr pppol2tp; 72 struct pppol2tp_addr pppol2tp;
73}__attribute__ ((packed)); 73} __packed;
74
75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
76 * bits. So we need a different sockaddr structure.
77 */
78struct sockaddr_pppol2tpv3 {
79 sa_family_t sa_family; /* address family, AF_PPPOX */
80 unsigned int sa_protocol; /* protocol identifier */
81 struct pppol2tpv3_addr pppol2tp;
82} __packed;
74 83
75/********************************************************************* 84/*********************************************************************
76 * 85 *
@@ -120,7 +129,7 @@ struct pppoe_hdr {
120 __be16 sid; 129 __be16 sid;
121 __be16 length; 130 __be16 length;
122 struct pppoe_tag tag[0]; 131 struct pppoe_tag tag[0];
123} __attribute__ ((packed)); 132} __packed;
124 133
125/* Length of entire PPPoE + PPP header */ 134/* Length of entire PPPoE + PPP header */
126#define PPPOE_SES_HLEN 8 135#define PPPOE_SES_HLEN 8
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 1350a246893a..06b1829731fd 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -51,6 +51,8 @@
51#define TUNSETSNDBUF _IOW('T', 212, int) 51#define TUNSETSNDBUF _IOW('T', 212, int)
52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog) 52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog) 53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int)
54 56
55/* TUNSETIFF ifr flags */ 57/* TUNSETIFF ifr flags */
56#define IFF_TUN 0x0001 58#define IFF_TUN 0x0001
diff --git a/include/linux/if_x25.h b/include/linux/if_x25.h
new file mode 100644
index 000000000000..897765f5feb8
--- /dev/null
+++ b/include/linux/if_x25.h
@@ -0,0 +1,26 @@
1/*
2 * Linux X.25 packet to device interface
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _IF_X25_H
16#define _IF_X25_H
17
18#include <linux/types.h>
19
20/* Documentation/networking/x25-iface.txt */
21#define X25_IFACE_DATA 0x00
22#define X25_IFACE_CONNECT 0x01
23#define X25_IFACE_DISCONNECT 0x02
24#define X25_IFACE_PARAMS 0x03
25
26#endif /* _IF_X25_H */
diff --git a/include/linux/in.h b/include/linux/in.h
index 583c76f9c30f..41d88a4689af 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -85,6 +85,7 @@ struct in_addr {
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR 85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86 86
87#define IP_MINTTL 21 87#define IP_MINTTL 21
88#define IP_NODEFRAG 22
88 89
89/* IP_MTU_DISCOVER values */ 90/* IP_MTU_DISCOVER values */
90#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 91#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index bd55c6e46b2e..c4bf46f764bf 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -221,10 +221,10 @@ struct in6_flowlabel_req {
221#define IPV6_RTHDR 57 221#define IPV6_RTHDR 57
222#define IPV6_RECVDSTOPTS 58 222#define IPV6_RECVDSTOPTS 58
223#define IPV6_DSTOPTS 59 223#define IPV6_DSTOPTS 59
224#if 0 /* not yet */
225#define IPV6_RECVPATHMTU 60 224#define IPV6_RECVPATHMTU 60
226#define IPV6_PATHMTU 61 225#define IPV6_PATHMTU 61
227#define IPV6_DONTFRAG 62 226#define IPV6_DONTFRAG 62
227#if 0 /* not yet */
228#define IPV6_USE_MIN_MTU 63 228#define IPV6_USE_MIN_MTU 63
229#endif 229#endif
230 230
@@ -265,6 +265,9 @@ struct in6_flowlabel_req {
265#define IPV6_PREFER_SRC_CGA 0x0008 265#define IPV6_PREFER_SRC_CGA 0x0008
266#define IPV6_PREFER_SRC_NONCGA 0x0800 266#define IPV6_PREFER_SRC_NONCGA 0x0800
267 267
268/* RFC5082: Generalized Ttl Security Mechanism */
269#define IPV6_MINHOPCOUNT 73
270
268/* 271/*
269 * Multicast Routing: 272 * Multicast Routing:
270 * see include/linux/mroute6.h. 273 * see include/linux/mroute6.h.
diff --git a/include/linux/init.h b/include/linux/init.h
index ab1d31f9352b..de994304e0bb 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -301,7 +301,7 @@ void __init parse_early_options(char *cmdline);
301#endif 301#endif
302 302
303/* Data marked not to be saved by software suspend */ 303/* Data marked not to be saved by software suspend */
304#define __nosavedata __section(.data.nosave) 304#define __nosavedata __section(.data..nosave)
305 305
306/* This means "can be init if no module support, otherwise module load 306/* This means "can be init if no module support, otherwise module load
307 may call it." */ 307 may call it." */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index b1ed1cd8e2a8..1f43fa56f600 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -16,7 +16,7 @@ extern struct files_struct init_files;
16extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
17 17
18#define INIT_SIGNALS(sig) { \ 18#define INIT_SIGNALS(sig) { \
19 .count = ATOMIC_INIT(1), \ 19 .nr_threads = 1, \
20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
21 .shared_pending = { \ 21 .shared_pending = { \
22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \ 22 .list = LIST_HEAD_INIT(sig.shared_pending.list), \
@@ -35,7 +35,7 @@ extern struct nsproxy init_nsproxy;
35 35
36#define INIT_SIGHAND(sighand) { \ 36#define INIT_SIGHAND(sighand) { \
37 .count = ATOMIC_INIT(1), \ 37 .count = ATOMIC_INIT(1), \
38 .action = { { { .sa_handler = NULL, } }, }, \ 38 .action = { { { .sa_handler = SIG_DFL, } }, }, \
39 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \ 39 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
40 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \ 40 .signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
41} 41}
@@ -45,11 +45,10 @@ extern struct group_info init_groups;
45#define INIT_STRUCT_PID { \ 45#define INIT_STRUCT_PID { \
46 .count = ATOMIC_INIT(1), \ 46 .count = ATOMIC_INIT(1), \
47 .tasks = { \ 47 .tasks = { \
48 { .first = &init_task.pids[PIDTYPE_PID].node }, \ 48 { .first = NULL }, \
49 { .first = &init_task.pids[PIDTYPE_PGID].node }, \ 49 { .first = NULL }, \
50 { .first = &init_task.pids[PIDTYPE_SID].node }, \ 50 { .first = NULL }, \
51 }, \ 51 }, \
52 .rcu = RCU_HEAD_INIT, \
53 .level = 0, \ 52 .level = 0, \
54 .numbers = { { \ 53 .numbers = { { \
55 .nr = 0, \ 54 .nr = 0, \
@@ -62,7 +61,7 @@ extern struct group_info init_groups;
62{ \ 61{ \
63 .node = { \ 62 .node = { \
64 .next = NULL, \ 63 .next = NULL, \
65 .pprev = &init_struct_pid.tasks[type].first, \ 64 .pprev = NULL, \
66 }, \ 65 }, \
67 .pid = &init_struct_pid, \ 66 .pid = &init_struct_pid, \
68} 67}
@@ -164,6 +163,7 @@ extern struct cred init_cred;
164 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \ 163 [PIDTYPE_PGID] = INIT_PID_LINK(PIDTYPE_PGID), \
165 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 164 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
166 }, \ 165 }, \
166 .thread_group = LIST_HEAD_INIT(tsk.thread_group), \
167 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 167 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
168 INIT_IDS \ 168 INIT_IDS \
169 INIT_PERF_EVENTS(tsk) \ 169 INIT_PERF_EVENTS(tsk) \
@@ -183,7 +183,7 @@ extern struct cred init_cred;
183} 183}
184 184
185/* Attach to the init_task data structure for proper alignment */ 185/* Attach to the init_task data structure for proper alignment */
186#define __init_task_data __attribute__((__section__(".data.init_task"))) 186#define __init_task_data __attribute__((__section__(".data..init_task")))
187 187
188 188
189#endif 189#endif
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index 37ea2894b3c0..d33041e2a42a 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -51,6 +51,7 @@ struct inotify_event {
51/* special flags */ 51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */ 52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */ 53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
54#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ 55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
55#define IN_ISDIR 0x40000000 /* event occurred against dir */ 56#define IN_ISDIR 0x40000000 /* event occurred against dir */
56#define IN_ONESHOT 0x80000000 /* only send event once */ 57#define IN_ONESHOT 0x80000000 /* only send event once */
@@ -70,177 +71,17 @@ struct inotify_event {
70#define IN_NONBLOCK O_NONBLOCK 71#define IN_NONBLOCK O_NONBLOCK
71 72
72#ifdef __KERNEL__ 73#ifdef __KERNEL__
73 74#include <linux/sysctl.h>
74#include <linux/dcache.h> 75extern struct ctl_table inotify_table[]; /* for sysctl */
75#include <linux/fs.h> 76
76 77#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
77/* 78 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
78 * struct inotify_watch - represents a watch request on a specific inode 79 IN_MOVED_TO | IN_CREATE | IN_DELETE | \
79 * 80 IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT | \
80 * h_list is protected by ih->mutex of the associated inotify_handle. 81 IN_Q_OVERFLOW | IN_IGNORED | IN_ONLYDIR | \
81 * i_list, mask are protected by inode->inotify_mutex of the associated inode. 82 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
82 * ih, inode, and wd are never written to once the watch is created. 83 IN_ISDIR | IN_ONESHOT)
83 * 84
84 * Callers must use the established inotify interfaces to access inotify_watch 85#endif
85 * contents. The content of this structure is private to the inotify
86 * implementation.
87 */
88struct inotify_watch {
89 struct list_head h_list; /* entry in inotify_handle's list */
90 struct list_head i_list; /* entry in inode's list */
91 atomic_t count; /* reference count */
92 struct inotify_handle *ih; /* associated inotify handle */
93 struct inode *inode; /* associated inode */
94 __s32 wd; /* watch descriptor */
95 __u32 mask; /* event mask for this watch */
96};
97
98struct inotify_operations {
99 void (*handle_event)(struct inotify_watch *, u32, u32, u32,
100 const char *, struct inode *);
101 void (*destroy_watch)(struct inotify_watch *);
102};
103
104#ifdef CONFIG_INOTIFY
105
106/* Kernel API for producing events */
107
108extern void inotify_d_instantiate(struct dentry *, struct inode *);
109extern void inotify_d_move(struct dentry *);
110extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
111 const char *, struct inode *);
112extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
113 const char *);
114extern void inotify_unmount_inodes(struct list_head *);
115extern void inotify_inode_is_dead(struct inode *);
116extern u32 inotify_get_cookie(void);
117
118/* Kernel Consumer API */
119
120extern struct inotify_handle *inotify_init(const struct inotify_operations *);
121extern void inotify_init_watch(struct inotify_watch *);
122extern void inotify_destroy(struct inotify_handle *);
123extern __s32 inotify_find_watch(struct inotify_handle *, struct inode *,
124 struct inotify_watch **);
125extern __s32 inotify_find_update_watch(struct inotify_handle *, struct inode *,
126 u32);
127extern __s32 inotify_add_watch(struct inotify_handle *, struct inotify_watch *,
128 struct inode *, __u32);
129extern __s32 inotify_clone_watch(struct inotify_watch *, struct inotify_watch *);
130extern void inotify_evict_watch(struct inotify_watch *);
131extern int inotify_rm_watch(struct inotify_handle *, struct inotify_watch *);
132extern int inotify_rm_wd(struct inotify_handle *, __u32);
133extern void inotify_remove_watch_locked(struct inotify_handle *,
134 struct inotify_watch *);
135extern void get_inotify_watch(struct inotify_watch *);
136extern void put_inotify_watch(struct inotify_watch *);
137extern int pin_inotify_watch(struct inotify_watch *);
138extern void unpin_inotify_watch(struct inotify_watch *);
139
140#else
141
142static inline void inotify_d_instantiate(struct dentry *dentry,
143 struct inode *inode)
144{
145}
146
147static inline void inotify_d_move(struct dentry *dentry)
148{
149}
150
151static inline void inotify_inode_queue_event(struct inode *inode,
152 __u32 mask, __u32 cookie,
153 const char *filename,
154 struct inode *n_inode)
155{
156}
157
158static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
159 __u32 mask, __u32 cookie,
160 const char *filename)
161{
162}
163
164static inline void inotify_unmount_inodes(struct list_head *list)
165{
166}
167
168static inline void inotify_inode_is_dead(struct inode *inode)
169{
170}
171
172static inline u32 inotify_get_cookie(void)
173{
174 return 0;
175}
176
177static inline struct inotify_handle *inotify_init(const struct inotify_operations *ops)
178{
179 return ERR_PTR(-EOPNOTSUPP);
180}
181
182static inline void inotify_init_watch(struct inotify_watch *watch)
183{
184}
185
186static inline void inotify_destroy(struct inotify_handle *ih)
187{
188}
189
190static inline __s32 inotify_find_watch(struct inotify_handle *ih, struct inode *inode,
191 struct inotify_watch **watchp)
192{
193 return -EOPNOTSUPP;
194}
195
196static inline __s32 inotify_find_update_watch(struct inotify_handle *ih,
197 struct inode *inode, u32 mask)
198{
199 return -EOPNOTSUPP;
200}
201
202static inline __s32 inotify_add_watch(struct inotify_handle *ih,
203 struct inotify_watch *watch,
204 struct inode *inode, __u32 mask)
205{
206 return -EOPNOTSUPP;
207}
208
209static inline int inotify_rm_watch(struct inotify_handle *ih,
210 struct inotify_watch *watch)
211{
212 return -EOPNOTSUPP;
213}
214
215static inline int inotify_rm_wd(struct inotify_handle *ih, __u32 wd)
216{
217 return -EOPNOTSUPP;
218}
219
220static inline void inotify_remove_watch_locked(struct inotify_handle *ih,
221 struct inotify_watch *watch)
222{
223}
224
225static inline void get_inotify_watch(struct inotify_watch *watch)
226{
227}
228
229static inline void put_inotify_watch(struct inotify_watch *watch)
230{
231}
232
233extern inline int pin_inotify_watch(struct inotify_watch *watch)
234{
235 return 0;
236}
237
238extern inline void unpin_inotify_watch(struct inotify_watch *watch)
239{
240}
241
242#endif /* CONFIG_INOTIFY */
243
244#endif /* __KERNEL __ */
245 86
246#endif /* _LINUX_INOTIFY_H */ 87#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index 7ed2251b33f1..896a92227bc4 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -691,9 +691,12 @@ struct input_absinfo {
691#define ABS_TILT_X 0x1a 691#define ABS_TILT_X 0x1a
692#define ABS_TILT_Y 0x1b 692#define ABS_TILT_Y 0x1b
693#define ABS_TOOL_WIDTH 0x1c 693#define ABS_TOOL_WIDTH 0x1c
694
694#define ABS_VOLUME 0x20 695#define ABS_VOLUME 0x20
696
695#define ABS_MISC 0x28 697#define ABS_MISC 0x28
696 698
699#define ABS_MT_SLOT 0x2f /* MT slot being modified */
697#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ 700#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
698#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ 701#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
699#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ 702#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
@@ -706,6 +709,12 @@ struct input_absinfo {
706#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 709#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
707#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 710#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
708 711
712#ifdef __KERNEL__
713/* Implementation details, userspace should not care about these */
714#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
715#define ABS_MT_LAST ABS_MT_PRESSURE
716#endif
717
709#define ABS_MAX 0x3f 718#define ABS_MAX 0x3f
710#define ABS_CNT (ABS_MAX+1) 719#define ABS_CNT (ABS_MAX+1)
711 720
@@ -767,6 +776,7 @@ struct input_absinfo {
767#define REP_DELAY 0x00 776#define REP_DELAY 0x00
768#define REP_PERIOD 0x01 777#define REP_PERIOD 0x01
769#define REP_MAX 0x01 778#define REP_MAX 0x01
779#define REP_CNT (REP_MAX+1)
770 780
771/* 781/*
772 * Sounds 782 * Sounds
@@ -806,6 +816,7 @@ struct input_absinfo {
806#define BUS_HOST 0x19 816#define BUS_HOST 0x19
807#define BUS_GSC 0x1A 817#define BUS_GSC 0x1A
808#define BUS_ATARI 0x1B 818#define BUS_ATARI 0x1B
819#define BUS_SPI 0x1C
809 820
810/* 821/*
811 * MT_TOOL types 822 * MT_TOOL types
@@ -1047,6 +1058,14 @@ struct ff_effect {
1047#include <linux/mod_devicetable.h> 1058#include <linux/mod_devicetable.h>
1048 1059
1049/** 1060/**
1061 * struct input_mt_slot - represents the state of an input MT slot
1062 * @abs: holds current values of ABS_MT axes for this slot
1063 */
1064struct input_mt_slot {
1065 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
1066};
1067
1068/**
1050 * struct input_dev - represents an input device 1069 * struct input_dev - represents an input device
1051 * @name: name of the device 1070 * @name: name of the device
1052 * @phys: physical path to the device in the system hierarchy 1071 * @phys: physical path to the device in the system hierarchy
@@ -1062,6 +1081,10 @@ struct ff_effect {
1062 * @sndbit: bitmap of sound effects supported by the device 1081 * @sndbit: bitmap of sound effects supported by the device
1063 * @ffbit: bitmap of force feedback effects supported by the device 1082 * @ffbit: bitmap of force feedback effects supported by the device
1064 * @swbit: bitmap of switches present on the device 1083 * @swbit: bitmap of switches present on the device
1084 * @hint_events_per_packet: average number of events generated by the
1085 * device in a packet (between EV_SYN/SYN_REPORT events). Used by
1086 * event handlers to estimate size of the buffer needed to hold
1087 * events.
1065 * @keycodemax: size of keycode table 1088 * @keycodemax: size of keycode table
1066 * @keycodesize: size of elements in keycode table 1089 * @keycodesize: size of elements in keycode table
1067 * @keycode: map of scancodes to keycodes for this device 1090 * @keycode: map of scancodes to keycodes for this device
@@ -1077,18 +1100,18 @@ struct ff_effect {
1077 * @repeat_key: stores key code of the last key pressed; used to implement 1100 * @repeat_key: stores key code of the last key pressed; used to implement
1078 * software autorepeat 1101 * software autorepeat
1079 * @timer: timer for software autorepeat 1102 * @timer: timer for software autorepeat
1080 * @sync: set to 1 when there were no new events since last EV_SYNC
1081 * @abs: current values for reports from absolute axes
1082 * @rep: current values for autorepeat parameters (delay, rate) 1103 * @rep: current values for autorepeat parameters (delay, rate)
1104 * @mt: pointer to array of struct input_mt_slot holding current values
1105 * of tracked contacts
1106 * @mtsize: number of MT slots the device uses
1107 * @slot: MT slot currently being transmitted
1108 * @absinfo: array of &struct absinfo elements holding information
1109 * about absolute axes (current value, min, max, flat, fuzz,
1110 * resolution)
1083 * @key: reflects current state of device's keys/buttons 1111 * @key: reflects current state of device's keys/buttons
1084 * @led: reflects current state of device's LEDs 1112 * @led: reflects current state of device's LEDs
1085 * @snd: reflects current state of sound effects 1113 * @snd: reflects current state of sound effects
1086 * @sw: reflects current state of device's switches 1114 * @sw: reflects current state of device's switches
1087 * @absmax: maximum values for events coming from absolute axes
1088 * @absmin: minimum values for events coming from absolute axes
1089 * @absfuzz: describes noisiness for axes
1090 * @absflat: size of the center flat position (used by joydev)
1091 * @absres: resolution used for events coming form absolute axes
1092 * @open: this method is called when the very first user calls 1115 * @open: this method is called when the very first user calls
1093 * input_open_device(). The driver must prepare the device 1116 * input_open_device(). The driver must prepare the device
1094 * to start generating events (start polling thread, 1117 * to start generating events (start polling thread,
@@ -1118,6 +1141,7 @@ struct ff_effect {
1118 * last user closes the device 1141 * last user closes the device
1119 * @going_away: marks devices that are in a middle of unregistering and 1142 * @going_away: marks devices that are in a middle of unregistering and
1120 * causes input_open_device*() fail with -ENODEV. 1143 * causes input_open_device*() fail with -ENODEV.
1144 * @sync: set to %true when there were no new events since last EV_SYN
1121 * @dev: driver model's view of this device 1145 * @dev: driver model's view of this device
1122 * @h_list: list of input handles associated with the device. When 1146 * @h_list: list of input handles associated with the device. When
1123 * accessing the list dev->mutex must be held 1147 * accessing the list dev->mutex must be held
@@ -1139,6 +1163,8 @@ struct input_dev {
1139 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; 1163 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1140 unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; 1164 unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
1141 1165
1166 unsigned int hint_events_per_packet;
1167
1142 unsigned int keycodemax; 1168 unsigned int keycodemax;
1143 unsigned int keycodesize; 1169 unsigned int keycodesize;
1144 void *keycode; 1170 void *keycode;
@@ -1152,22 +1178,19 @@ struct input_dev {
1152 unsigned int repeat_key; 1178 unsigned int repeat_key;
1153 struct timer_list timer; 1179 struct timer_list timer;
1154 1180
1155 int sync; 1181 int rep[REP_CNT];
1182
1183 struct input_mt_slot *mt;
1184 int mtsize;
1185 int slot;
1156 1186
1157 int abs[ABS_MAX + 1]; 1187 struct input_absinfo *absinfo;
1158 int rep[REP_MAX + 1];
1159 1188
1160 unsigned long key[BITS_TO_LONGS(KEY_CNT)]; 1189 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1161 unsigned long led[BITS_TO_LONGS(LED_CNT)]; 1190 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1162 unsigned long snd[BITS_TO_LONGS(SND_CNT)]; 1191 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1163 unsigned long sw[BITS_TO_LONGS(SW_CNT)]; 1192 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1164 1193
1165 int absmax[ABS_MAX + 1];
1166 int absmin[ABS_MAX + 1];
1167 int absfuzz[ABS_MAX + 1];
1168 int absflat[ABS_MAX + 1];
1169 int absres[ABS_MAX + 1];
1170
1171 int (*open)(struct input_dev *dev); 1194 int (*open)(struct input_dev *dev);
1172 void (*close)(struct input_dev *dev); 1195 void (*close)(struct input_dev *dev);
1173 int (*flush)(struct input_dev *dev, struct file *file); 1196 int (*flush)(struct input_dev *dev, struct file *file);
@@ -1181,6 +1204,8 @@ struct input_dev {
1181 unsigned int users; 1204 unsigned int users;
1182 bool going_away; 1205 bool going_away;
1183 1206
1207 bool sync;
1208
1184 struct device dev; 1209 struct device dev;
1185 1210
1186 struct list_head h_list; 1211 struct list_head h_list;
@@ -1405,18 +1430,54 @@ static inline void input_mt_sync(struct input_dev *dev)
1405 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1430 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1406} 1431}
1407 1432
1433static inline void input_mt_slot(struct input_dev *dev, int slot)
1434{
1435 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
1436}
1437
1408void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1438void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1409 1439
1410static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1440/**
1441 * input_set_events_per_packet - tell handlers about the driver event rate
1442 * @dev: the input device used by the driver
1443 * @n_events: the average number of events between calls to input_sync()
1444 *
1445 * If the event rate sent from a device is unusually large, use this
1446 * function to set the expected event rate. This will allow handlers
1447 * to set up an appropriate buffer size for the event stream, in order
1448 * to minimize information loss.
1449 */
1450static inline void input_set_events_per_packet(struct input_dev *dev, int n_events)
1411{ 1451{
1412 dev->absmin[axis] = min; 1452 dev->hint_events_per_packet = n_events;
1413 dev->absmax[axis] = max; 1453}
1414 dev->absfuzz[axis] = fuzz;
1415 dev->absflat[axis] = flat;
1416 1454
1417 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); 1455void input_alloc_absinfo(struct input_dev *dev);
1456void input_set_abs_params(struct input_dev *dev, unsigned int axis,
1457 int min, int max, int fuzz, int flat);
1458
1459#define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \
1460static inline int input_abs_get_##_suffix(struct input_dev *dev, \
1461 unsigned int axis) \
1462{ \
1463 return dev->absinfo ? dev->absinfo[axis]._item : 0; \
1464} \
1465 \
1466static inline void input_abs_set_##_suffix(struct input_dev *dev, \
1467 unsigned int axis, int val) \
1468{ \
1469 input_alloc_absinfo(dev); \
1470 if (dev->absinfo) \
1471 dev->absinfo[axis]._item = val; \
1418} 1472}
1419 1473
1474INPUT_GENERATE_ABS_ACCESSORS(val, value)
1475INPUT_GENERATE_ABS_ACCESSORS(min, minimum)
1476INPUT_GENERATE_ABS_ACCESSORS(max, maximum)
1477INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz)
1478INPUT_GENERATE_ABS_ACCESSORS(flat, flat)
1479INPUT_GENERATE_ABS_ACCESSORS(res, resolution)
1480
1420int input_get_keycode(struct input_dev *dev, 1481int input_get_keycode(struct input_dev *dev,
1421 unsigned int scancode, unsigned int *keycode); 1482 unsigned int scancode, unsigned int *keycode);
1422int input_set_keycode(struct input_dev *dev, 1483int input_set_keycode(struct input_dev *dev,
@@ -1484,5 +1545,8 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1484int input_ff_create_memless(struct input_dev *dev, void *data, 1545int input_ff_create_memless(struct input_dev *dev, void *data,
1485 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1546 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1486 1547
1548int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
1549void input_mt_destroy_slots(struct input_dev *dev);
1550
1487#endif 1551#endif
1488#endif 1552#endif
diff --git a/include/linux/input/ad714x.h b/include/linux/input/ad714x.h
new file mode 100644
index 000000000000..0cbe5e81482e
--- /dev/null
+++ b/include/linux/input/ad714x.h
@@ -0,0 +1,63 @@
1/*
2 * include/linux/input/ad714x.h
3 *
4 * AD714x is very flexible, it can be used as buttons, scrollwheel,
5 * slider, touchpad at the same time. That depends on the boards.
6 * The platform_data for the device's "struct device" holds this
7 * information.
8 *
9 * Copyright 2009 Analog Devices Inc.
10 *
11 * Licensed under the GPL-2 or later.
12 */
13
14#ifndef __LINUX_INPUT_AD714X_H__
15#define __LINUX_INPUT_AD714X_H__
16
17#define STAGE_NUM 12
18#define STAGE_CFGREG_NUM 8
19#define SYS_CFGREG_NUM 8
20
21/* board information which need be initialized in arch/mach... */
22struct ad714x_slider_plat {
23 int start_stage;
24 int end_stage;
25 int max_coord;
26};
27
28struct ad714x_wheel_plat {
29 int start_stage;
30 int end_stage;
31 int max_coord;
32};
33
34struct ad714x_touchpad_plat {
35 int x_start_stage;
36 int x_end_stage;
37 int x_max_coord;
38
39 int y_start_stage;
40 int y_end_stage;
41 int y_max_coord;
42};
43
44struct ad714x_button_plat {
45 int keycode;
46 unsigned short l_mask;
47 unsigned short h_mask;
48};
49
50struct ad714x_platform_data {
51 int slider_num;
52 int wheel_num;
53 int touchpad_num;
54 int button_num;
55 struct ad714x_slider_plat *slider;
56 struct ad714x_wheel_plat *wheel;
57 struct ad714x_touchpad_plat *touchpad;
58 struct ad714x_button_plat *button;
59 unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
60 unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
61};
62
63#endif
diff --git a/include/linux/input/adxl34x.h b/include/linux/input/adxl34x.h
new file mode 100644
index 000000000000..df00d998a44a
--- /dev/null
+++ b/include/linux/input/adxl34x.h
@@ -0,0 +1,349 @@
1/*
2 * include/linux/input/adxl34x.h
3 *
4 * Digital Accelerometer characteristics are highly application specific
5 * and may vary between boards and models. The platform_data for the
6 * device's "struct device" holds this information.
7 *
8 * Copyright 2009 Analog Devices Inc.
9 *
10 * Licensed under the GPL-2 or later.
11 */
12
13#ifndef __LINUX_INPUT_ADXL34X_H__
14#define __LINUX_INPUT_ADXL34X_H__
15
16struct adxl34x_platform_data {
17
18 /*
19 * X,Y,Z Axis Offset:
20 * offer user offset adjustments in twoscompliment
21 * form with a scale factor of 15.6 mg/LSB (i.e. 0x7F = +2 g)
22 */
23
24 s8 x_axis_offset;
25 s8 y_axis_offset;
26 s8 z_axis_offset;
27
28 /*
29 * TAP_X/Y/Z Enable: Setting TAP_X, Y, or Z Enable enables X,
30 * Y, or Z participation in Tap detection. A '0' excludes the
31 * selected axis from participation in Tap detection.
32 * Setting the SUPPRESS bit suppresses Double Tap detection if
33 * acceleration greater than tap_threshold is present between
34 * taps.
35 */
36
37#define ADXL_SUPPRESS (1 << 3)
38#define ADXL_TAP_X_EN (1 << 2)
39#define ADXL_TAP_Y_EN (1 << 1)
40#define ADXL_TAP_Z_EN (1 << 0)
41
42 u8 tap_axis_control;
43
44 /*
45 * tap_threshold:
46 * holds the threshold value for tap detection/interrupts.
47 * The data format is unsigned. The scale factor is 62.5 mg/LSB
48 * (i.e. 0xFF = +16 g). A zero value may result in undesirable
49 * behavior if Tap/Double Tap is enabled.
50 */
51
52 u8 tap_threshold;
53
54 /*
55 * tap_duration:
56 * is an unsigned time value representing the maximum
57 * time that an event must be above the tap_threshold threshold
58 * to qualify as a tap event. The scale factor is 625 us/LSB. A zero
59 * value will prevent Tap/Double Tap functions from working.
60 */
61
62 u8 tap_duration;
63
64 /*
65 * tap_latency:
66 * is an unsigned time value representing the wait time
67 * from the detection of a tap event to the opening of the time
68 * window tap_window for a possible second tap event. The scale
69 * factor is 1.25 ms/LSB. A zero value will disable the Double Tap
70 * function.
71 */
72
73 u8 tap_latency;
74
75 /*
76 * tap_window:
77 * is an unsigned time value representing the amount
78 * of time after the expiration of tap_latency during which a second
79 * tap can begin. The scale factor is 1.25 ms/LSB. A zero value will
80 * disable the Double Tap function.
81 */
82
83 u8 tap_window;
84
85 /*
86 * act_axis_control:
87 * X/Y/Z Enable: A '1' enables X, Y, or Z participation in activity
88 * or inactivity detection. A '0' excludes the selected axis from
89 * participation. If all of the axes are excluded, the function is
90 * disabled.
91 * AC/DC: A '0' = DC coupled operation and a '1' = AC coupled
92 * operation. In DC coupled operation, the current acceleration is
93 * compared with activity_threshold and inactivity_threshold directly
94 * to determine whether activity or inactivity is detected. In AC
95 * coupled operation for activity detection, the acceleration value
96 * at the start of activity detection is taken as a reference value.
97 * New samples of acceleration are then compared to this
98 * reference value and if the magnitude of the difference exceeds
99 * activity_threshold the device will trigger an activity interrupt. In
100 * AC coupled operation for inactivity detection, a reference value
101 * is used again for comparison and is updated whenever the
102 * device exceeds the inactivity threshold. Once the reference
103 * value is selected, the device compares the magnitude of the
104 * difference between the reference value and the current
105 * acceleration with inactivity_threshold. If the difference is below
106 * inactivity_threshold for a total of inactivity_time, the device is
107 * considered inactive and the inactivity interrupt is triggered.
108 */
109
110#define ADXL_ACT_ACDC (1 << 7)
111#define ADXL_ACT_X_EN (1 << 6)
112#define ADXL_ACT_Y_EN (1 << 5)
113#define ADXL_ACT_Z_EN (1 << 4)
114#define ADXL_INACT_ACDC (1 << 3)
115#define ADXL_INACT_X_EN (1 << 2)
116#define ADXL_INACT_Y_EN (1 << 1)
117#define ADXL_INACT_Z_EN (1 << 0)
118
119 u8 act_axis_control;
120
121 /*
122 * activity_threshold:
123 * holds the threshold value for activity detection.
124 * The data format is unsigned. The scale factor is
125 * 62.5 mg/LSB. A zero value may result in undesirable behavior if
126 * Activity interrupt is enabled.
127 */
128
129 u8 activity_threshold;
130
131 /*
132 * inactivity_threshold:
133 * holds the threshold value for inactivity
134 * detection. The data format is unsigned. The scale
135 * factor is 62.5 mg/LSB. A zero value may result in undesirable
136 * behavior if Inactivity interrupt is enabled.
137 */
138
139 u8 inactivity_threshold;
140
141 /*
142 * inactivity_time:
143 * is an unsigned time value representing the
144 * amount of time that acceleration must be below the value in
145 * inactivity_threshold for inactivity to be declared. The scale factor
146 * is 1 second/LSB. Unlike the other interrupt functions, which
147 * operate on unfiltered data, the inactivity function operates on the
148 * filtered output data. At least one output sample must be
149 * generated for the inactivity interrupt to be triggered. This will
150 * result in the function appearing un-responsive if the
151 * inactivity_time register is set with a value less than the time
152 * constant of the Output Data Rate. A zero value will result in an
153 * interrupt when the output data is below inactivity_threshold.
154 */
155
156 u8 inactivity_time;
157
158 /*
159 * free_fall_threshold:
160 * holds the threshold value for Free-Fall detection.
161 * The data format is unsigned. The root-sum-square(RSS) value
162 * of all axes is calculated and compared to the value in
163 * free_fall_threshold to determine if a free fall event may be
164 * occurring. The scale factor is 62.5 mg/LSB. A zero value may
165 * result in undesirable behavior if Free-Fall interrupt is
166 * enabled. Values between 300 and 600 mg (0x05 to 0x09) are
167 * recommended.
168 */
169
170 u8 free_fall_threshold;
171
172 /*
173 * free_fall_time:
174 * is an unsigned time value representing the minimum
175 * time that the RSS value of all axes must be less than
176 * free_fall_threshold to generate a Free-Fall interrupt. The
177 * scale factor is 5 ms/LSB. A zero value may result in
178 * undesirable behavior if Free-Fall interrupt is enabled.
179 * Values between 100 to 350 ms (0x14 to 0x46) are recommended.
180 */
181
182 u8 free_fall_time;
183
184 /*
185 * data_rate:
186 * Selects device bandwidth and output data rate.
187 * RATE = 3200 Hz / (2^(15 - x)). Default value is 0x0A, or 100 Hz
188 * Output Data Rate. An Output Data Rate should be selected that
189 * is appropriate for the communication protocol and frequency
190 * selected. Selecting too high of an Output Data Rate with a low
191 * communication speed will result in samples being discarded.
192 */
193
194 u8 data_rate;
195
196 /*
197 * data_range:
198 * FULL_RES: When this bit is set with the device is
199 * in Full-Resolution Mode, where the output resolution increases
200 * with RANGE to maintain a 4 mg/LSB scale factor. When this
201 * bit is cleared the device is in 10-bit Mode and RANGE determine the
202 * maximum g-Range and scale factor.
203 */
204
205#define ADXL_FULL_RES (1 << 3)
206#define ADXL_RANGE_PM_2g 0
207#define ADXL_RANGE_PM_4g 1
208#define ADXL_RANGE_PM_8g 2
209#define ADXL_RANGE_PM_16g 3
210
211 u8 data_range;
212
213 /*
214 * low_power_mode:
215 * A '0' = Normal operation and a '1' = Reduced
216 * power operation with somewhat higher noise.
217 */
218
219 u8 low_power_mode;
220
221 /*
222 * power_mode:
223 * LINK: A '1' with both the activity and inactivity functions
224 * enabled will delay the start of the activity function until
225 * inactivity is detected. Once activity is detected, inactivity
226 * detection will begin and prevent the detection of activity. This
227 * bit serially links the activity and inactivity functions. When '0'
228 * the inactivity and activity functions are concurrent. Additional
229 * information can be found in the Application section under Link
230 * Mode.
231 * AUTO_SLEEP: A '1' sets the ADXL34x to switch to Sleep Mode
232 * when inactivity (acceleration has been below inactivity_threshold
233 * for at least inactivity_time) is detected and the LINK bit is set.
234 * A '0' disables automatic switching to Sleep Mode. See SLEEP
235 * for further description.
236 */
237
238#define ADXL_LINK (1 << 5)
239#define ADXL_AUTO_SLEEP (1 << 4)
240
241 u8 power_mode;
242
243 /*
244 * fifo_mode:
245 * BYPASS The FIFO is bypassed
246 * FIFO FIFO collects up to 32 values then stops collecting data
247 * STREAM FIFO holds the last 32 data values. Once full, the FIFO's
248 * oldest data is lost as it is replaced with newer data
249 *
250 * DEFAULT should be ADXL_FIFO_STREAM
251 */
252
253#define ADXL_FIFO_BYPASS 0
254#define ADXL_FIFO_FIFO 1
255#define ADXL_FIFO_STREAM 2
256
257 u8 fifo_mode;
258
259 /*
260 * watermark:
261 * The Watermark feature can be used to reduce the interrupt load
262 * of the system. The FIFO fills up to the value stored in watermark
263 * [1..32] and then generates an interrupt.
264 * A '0' disables the watermark feature.
265 */
266
267 u8 watermark;
268
269 u32 ev_type; /* EV_ABS or EV_REL */
270
271 u32 ev_code_x; /* ABS_X,Y,Z or REL_X,Y,Z */
272 u32 ev_code_y; /* ABS_X,Y,Z or REL_X,Y,Z */
273 u32 ev_code_z; /* ABS_X,Y,Z or REL_X,Y,Z */
274
275 /*
276 * A valid BTN or KEY Code; use tap_axis_control to disable
277 * event reporting
278 */
279
280 u32 ev_code_tap[3]; /* EV_KEY {X-Axis, Y-Axis, Z-Axis} */
281
282 /*
283 * A valid BTN or KEY Code for Free-Fall or Activity enables
284 * input event reporting. A '0' disables the Free-Fall or
285 * Activity reporting.
286 */
287
288 u32 ev_code_ff; /* EV_KEY */
289 u32 ev_code_act_inactivity; /* EV_KEY */
290
291 /*
292 * Use ADXL34x INT2 instead of INT1
293 */
294 u8 use_int2;
295
296 /*
297 * ADXL346 only ORIENTATION SENSING feature
298 * The orientation function of the ADXL346 reports both 2-D and
299 * 3-D orientation concurrently.
300 */
301
302#define ADXL_EN_ORIENTATION_2D 1
303#define ADXL_EN_ORIENTATION_3D 2
304#define ADXL_EN_ORIENTATION_2D_3D 3
305
306 u8 orientation_enable;
307
308 /*
309 * The width of the deadzone region between two or more
310 * orientation positions is determined by setting the Deadzone
311 * value. The deadzone region size can be specified with a
312 * resolution of 3.6deg. The deadzone angle represents the total
313 * angle where the orientation is considered invalid.
314 */
315
316#define ADXL_DEADZONE_ANGLE_0p0 0 /* !!!0.0 [deg] */
317#define ADXL_DEADZONE_ANGLE_3p6 1 /* 3.6 [deg] */
318#define ADXL_DEADZONE_ANGLE_7p2 2 /* 7.2 [deg] */
319#define ADXL_DEADZONE_ANGLE_10p8 3 /* 10.8 [deg] */
320#define ADXL_DEADZONE_ANGLE_14p4 4 /* 14.4 [deg] */
321#define ADXL_DEADZONE_ANGLE_18p0 5 /* 18.0 [deg] */
322#define ADXL_DEADZONE_ANGLE_21p6 6 /* 21.6 [deg] */
323#define ADXL_DEADZONE_ANGLE_25p2 7 /* 25.2 [deg] */
324
325 u8 deadzone_angle;
326
327 /*
328 * To eliminate most human motion such as walking or shaking,
329 * a Divisor value should be selected to effectively limit the
330 * orientation bandwidth. Set the depth of the filter used to
331 * low-pass filter the measured acceleration for stable
332 * orientation sensing
333 */
334
335#define ADXL_LP_FILTER_DIVISOR_2 0
336#define ADXL_LP_FILTER_DIVISOR_4 1
337#define ADXL_LP_FILTER_DIVISOR_8 2
338#define ADXL_LP_FILTER_DIVISOR_16 3
339#define ADXL_LP_FILTER_DIVISOR_32 4
340#define ADXL_LP_FILTER_DIVISOR_64 5
341#define ADXL_LP_FILTER_DIVISOR_128 6
342#define ADXL_LP_FILTER_DIVISOR_256 7
343
344 u8 divisor_length;
345
346 u32 ev_codes_orient_2d[4]; /* EV_KEY {+X, -X, +Y, -Y} */
347 u32 ev_codes_orient_3d[6]; /* EV_KEY {+Z, +Y, +X, -X, -Y, -Z} */
348};
349#endif
diff --git a/include/linux/input/cy8ctmg110_pdata.h b/include/linux/input/cy8ctmg110_pdata.h
new file mode 100644
index 000000000000..09522cb59910
--- /dev/null
+++ b/include/linux/input/cy8ctmg110_pdata.h
@@ -0,0 +1,10 @@
1#ifndef _LINUX_CY8CTMG110_PDATA_H
2#define _LINUX_CY8CTMG110_PDATA_H
3
4struct cy8ctmg110_pdata
5{
6 int reset_pin; /* Reset pin is wired to this GPIO (optional) */
7 int irq_pin; /* IRQ pin is wired to this GPIO */
8};
9
10#endif
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index c964cd7f436a..80352ad6581a 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -41,6 +41,9 @@ struct matrix_keymap_data {
41 * @col_scan_delay_us: delay, measured in microseconds, that is 41 * @col_scan_delay_us: delay, measured in microseconds, that is
42 * needed before we can keypad after activating column gpio 42 * needed before we can keypad after activating column gpio
43 * @debounce_ms: debounce interval in milliseconds 43 * @debounce_ms: debounce interval in milliseconds
44 * @clustered_irq: may be specified if interrupts of all row/column GPIOs
45 * are bundled to one single irq
46 * @clustered_irq_flags: flags that are needed for the clustered irq
44 * @active_low: gpio polarity 47 * @active_low: gpio polarity
45 * @wakeup: controls whether the device should be set up as wakeup 48 * @wakeup: controls whether the device should be set up as wakeup
46 * source 49 * source
@@ -63,6 +66,9 @@ struct matrix_keypad_platform_data {
63 /* key debounce interval in milli-second */ 66 /* key debounce interval in milli-second */
64 unsigned int debounce_ms; 67 unsigned int debounce_ms;
65 68
69 unsigned int clustered_irq;
70 unsigned int clustered_irq_flags;
71
66 bool active_low; 72 bool active_low;
67 bool wakeup; 73 bool wakeup;
68 bool no_autorepeat; 74 bool no_autorepeat;
diff --git a/include/linux/input/tps6507x-ts.h b/include/linux/input/tps6507x-ts.h
new file mode 100644
index 000000000000..ab1440313924
--- /dev/null
+++ b/include/linux/input/tps6507x-ts.h
@@ -0,0 +1,24 @@
1/* linux/i2c/tps6507x-ts.h
2 *
3 * Functions to access TPS65070 touch screen chip.
4 *
5 * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
6 *
7 *
8 * For licencing details see kernel-base/COPYING
9 */
10
11#ifndef __LINUX_I2C_TPS6507X_TS_H
12#define __LINUX_I2C_TPS6507X_TS_H
13
14/* Board specific touch screen initial values */
15struct touchscreen_init_data {
16 int poll_period; /* ms */
17 int vref; /* non-zero to leave vref on */
18 __u16 min_pressure; /* min reading to be treated as a touch */
19 __u16 vendor;
20 __u16 product;
21 __u16 version;
22};
23
24#endif /* __LINUX_I2C_TPS6507X_TS_H */
diff --git a/include/linux/intel_mid_dma.h b/include/linux/intel_mid_dma.h
new file mode 100644
index 000000000000..d9d08b6269b6
--- /dev/null
+++ b/include/linux/intel_mid_dma.h
@@ -0,0 +1,86 @@
1/*
2 * intel_mid_dma.h - Intel MID DMA Drivers
3 *
4 * Copyright (C) 2008-10 Intel Corp
5 * Author: Vinod Koul <vinod.koul@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 *
23 *
24 */
25#ifndef __INTEL_MID_DMA_H__
26#define __INTEL_MID_DMA_H__
27
28#include <linux/dmaengine.h>
29
30/*DMA transaction width, src and dstn width would be same
31The DMA length must be width aligned,
32for 32 bit width the length must be 32 bit (4bytes) aligned only*/
33enum intel_mid_dma_width {
34 LNW_DMA_WIDTH_8BIT = 0x0,
35 LNW_DMA_WIDTH_16BIT = 0x1,
36 LNW_DMA_WIDTH_32BIT = 0x2,
37};
38
39/*DMA mode configurations*/
40enum intel_mid_dma_mode {
41 LNW_DMA_PER_TO_MEM = 0, /*periphral to memory configuration*/
42 LNW_DMA_MEM_TO_PER, /*memory to periphral configuration*/
43 LNW_DMA_MEM_TO_MEM, /*mem to mem confg (testing only)*/
44};
45
46/*DMA handshaking*/
47enum intel_mid_dma_hs_mode {
48 LNW_DMA_HW_HS = 0, /*HW Handshaking only*/
49 LNW_DMA_SW_HS = 1, /*SW Handshaking not recommended*/
50};
51
52/*Burst size configuration*/
53enum intel_mid_dma_msize {
54 LNW_DMA_MSIZE_1 = 0x0,
55 LNW_DMA_MSIZE_4 = 0x1,
56 LNW_DMA_MSIZE_8 = 0x2,
57 LNW_DMA_MSIZE_16 = 0x3,
58 LNW_DMA_MSIZE_32 = 0x4,
59 LNW_DMA_MSIZE_64 = 0x5,
60};
61
62/**
63 * struct intel_mid_dma_slave - DMA slave structure
64 *
65 * @dirn: DMA trf direction
66 * @src_width: tx register width
67 * @dst_width: rx register width
68 * @hs_mode: HW/SW handshaking mode
69 * @cfg_mode: DMA data transfer mode (per-per/mem-per/mem-mem)
70 * @src_msize: Source DMA burst size
71 * @dst_msize: Dst DMA burst size
72 * @device_instance: DMA peripheral device instance, we can have multiple
73 * peripheral device connected to single DMAC
74 */
75struct intel_mid_dma_slave {
76 enum dma_data_direction dirn;
77 enum intel_mid_dma_width src_width; /*width of DMA src txn*/
78 enum intel_mid_dma_width dst_width; /*width of DMA dst txn*/
79 enum intel_mid_dma_hs_mode hs_mode; /*handshaking*/
80 enum intel_mid_dma_mode cfg_mode; /*mode configuration*/
81 enum intel_mid_dma_msize src_msize; /*size if src burst*/
82 enum intel_mid_dma_msize dst_msize; /*size of dst burst*/
83 unsigned int device_instance; /*0, 1 for periphral instance*/
84};
85
86#endif /*__INTEL_MID_DMA_H__*/
diff --git a/include/linux/intel_pmic_gpio.h b/include/linux/intel_pmic_gpio.h
new file mode 100644
index 000000000000..920109a29191
--- /dev/null
+++ b/include/linux/intel_pmic_gpio.h
@@ -0,0 +1,15 @@
1#ifndef LINUX_INTEL_PMIC_H
2#define LINUX_INTEL_PMIC_H
3
4struct intel_pmic_gpio_platform_data {
5 /* the first IRQ of the chip */
6 unsigned irq_base;
7 /* number assigned to the first GPIO */
8 unsigned gpio_base;
9 /* sram address for gpiointr register, the langwell chip will map
10 * the PMIC spi GPIO expander's GPIOINTR register in sram.
11 */
12 unsigned gpiointr;
13};
14
15#endif
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 75f3f00ac1e5..a0384a4d1e6f 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -39,7 +39,8 @@
39 * These flags used only by the kernel as part of the 39 * These flags used only by the kernel as part of the
40 * irq handling routines. 40 * irq handling routines.
41 * 41 *
42 * IRQF_DISABLED - keep irqs disabled when calling the action handler 42 * IRQF_DISABLED - keep irqs disabled when calling the action handler.
43 * DEPRECATED. This flag is a NOOP and scheduled to be removed
43 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator 44 * IRQF_SAMPLE_RANDOM - irq is used to feed the random generator
44 * IRQF_SHARED - allow sharing the irq among several devices 45 * IRQF_SHARED - allow sharing the irq among several devices
45 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur 46 * IRQF_PROBE_SHARED - set by callers when they expect sharing mismatches to occur
@@ -52,16 +53,21 @@
52 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished. 53 * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
53 * Used by threaded interrupts which need to keep the 54 * Used by threaded interrupts which need to keep the
54 * irq line disabled until the threaded handler has been run. 55 * irq line disabled until the threaded handler has been run.
56 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
57 *
55 */ 58 */
56#define IRQF_DISABLED 0x00000020 59#define IRQF_DISABLED 0x00000020
57#define IRQF_SAMPLE_RANDOM 0x00000040 60#define IRQF_SAMPLE_RANDOM 0x00000040
58#define IRQF_SHARED 0x00000080 61#define IRQF_SHARED 0x00000080
59#define IRQF_PROBE_SHARED 0x00000100 62#define IRQF_PROBE_SHARED 0x00000100
60#define IRQF_TIMER 0x00000200 63#define __IRQF_TIMER 0x00000200
61#define IRQF_PERCPU 0x00000400 64#define IRQF_PERCPU 0x00000400
62#define IRQF_NOBALANCING 0x00000800 65#define IRQF_NOBALANCING 0x00000800
63#define IRQF_IRQPOLL 0x00001000 66#define IRQF_IRQPOLL 0x00001000
64#define IRQF_ONESHOT 0x00002000 67#define IRQF_ONESHOT 0x00002000
68#define IRQF_NO_SUSPEND 0x00004000
69
70#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
65 71
66/* 72/*
67 * Bits used by threaded handlers: 73 * Bits used by threaded handlers:
@@ -77,6 +83,18 @@ enum {
77 IRQTF_AFFINITY, 83 IRQTF_AFFINITY,
78}; 84};
79 85
86/*
87 * These values can be returned by request_any_context_irq() and
88 * describe the context the interrupt will be run in.
89 *
90 * IRQC_IS_HARDIRQ - interrupt runs in hardirq context
91 * IRQC_IS_NESTED - interrupt runs in a nested threaded context
92 */
93enum {
94 IRQC_IS_HARDIRQ = 0,
95 IRQC_IS_NESTED,
96};
97
80typedef irqreturn_t (*irq_handler_t)(int, void *); 98typedef irqreturn_t (*irq_handler_t)(int, void *);
81 99
82/** 100/**
@@ -120,6 +138,10 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
120 return request_threaded_irq(irq, handler, NULL, flags, name, dev); 138 return request_threaded_irq(irq, handler, NULL, flags, name, dev);
121} 139}
122 140
141extern int __must_check
142request_any_context_irq(unsigned int irq, irq_handler_t handler,
143 unsigned long flags, const char *name, void *dev_id);
144
123extern void exit_irq_thread(void); 145extern void exit_irq_thread(void);
124#else 146#else
125 147
@@ -141,6 +163,13 @@ request_threaded_irq(unsigned int irq, irq_handler_t handler,
141 return request_irq(irq, handler, flags, name, dev); 163 return request_irq(irq, handler, flags, name, dev);
142} 164}
143 165
166static inline int __must_check
167request_any_context_irq(unsigned int irq, irq_handler_t handler,
168 unsigned long flags, const char *name, void *dev_id)
169{
170 return request_irq(irq, handler, flags, name, dev_id);
171}
172
144static inline void exit_irq_thread(void) { } 173static inline void exit_irq_thread(void) { }
145#endif 174#endif
146 175
@@ -209,6 +238,7 @@ extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
209extern int irq_can_set_affinity(unsigned int irq); 238extern int irq_can_set_affinity(unsigned int irq);
210extern int irq_select_affinity(unsigned int irq); 239extern int irq_select_affinity(unsigned int irq);
211 240
241extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
212#else /* CONFIG_SMP */ 242#else /* CONFIG_SMP */
213 243
214static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 244static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -223,6 +253,11 @@ static inline int irq_can_set_affinity(unsigned int irq)
223 253
224static inline int irq_select_affinity(unsigned int irq) { return 0; } 254static inline int irq_select_affinity(unsigned int irq) { return 0; }
225 255
256static inline int irq_set_affinity_hint(unsigned int irq,
257 const struct cpumask *m)
258{
259 return -EINVAL;
260}
226#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */ 261#endif /* CONFIG_SMP && CONFIG_GENERIC_HARDIRQS */
227 262
228#ifdef CONFIG_GENERIC_HARDIRQS 263#ifdef CONFIG_GENERIC_HARDIRQS
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 25085ddd955f..e0ea40f6c515 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -79,7 +79,9 @@ io_mapping_free(struct io_mapping *mapping)
79 79
80/* Atomic map/unmap */ 80/* Atomic map/unmap */
81static inline void * 81static inline void *
82io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 82io_mapping_map_atomic_wc(struct io_mapping *mapping,
83 unsigned long offset,
84 int slot)
83{ 85{
84 resource_size_t phys_addr; 86 resource_size_t phys_addr;
85 unsigned long pfn; 87 unsigned long pfn;
@@ -87,13 +89,13 @@ io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset)
87 BUG_ON(offset >= mapping->size); 89 BUG_ON(offset >= mapping->size);
88 phys_addr = mapping->base + offset; 90 phys_addr = mapping->base + offset;
89 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT); 91 pfn = (unsigned long) (phys_addr >> PAGE_SHIFT);
90 return iomap_atomic_prot_pfn(pfn, KM_USER0, mapping->prot); 92 return iomap_atomic_prot_pfn(pfn, slot, mapping->prot);
91} 93}
92 94
93static inline void 95static inline void
94io_mapping_unmap_atomic(void *vaddr) 96io_mapping_unmap_atomic(void *vaddr, int slot)
95{ 97{
96 iounmap_atomic(vaddr, KM_USER0); 98 iounmap_atomic(vaddr, slot);
97} 99}
98 100
99static inline void * 101static inline void *
@@ -133,13 +135,15 @@ io_mapping_free(struct io_mapping *mapping)
133 135
134/* Atomic map/unmap */ 136/* Atomic map/unmap */
135static inline void * 137static inline void *
136io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) 138io_mapping_map_atomic_wc(struct io_mapping *mapping,
139 unsigned long offset,
140 int slot)
137{ 141{
138 return ((char *) mapping) + offset; 142 return ((char *) mapping) + offset;
139} 143}
140 144
141static inline void 145static inline void
142io_mapping_unmap_atomic(void *vaddr) 146io_mapping_unmap_atomic(void *vaddr, int slot)
143{ 147{
144} 148}
145 149
diff --git a/include/linux/io.h b/include/linux/io.h
index 6c7f0ba0d5fa..7fd2d2138bf3 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -29,10 +29,10 @@ void __iowrite64_copy(void __iomem *to, const void *from, size_t count);
29 29
30#ifdef CONFIG_MMU 30#ifdef CONFIG_MMU
31int ioremap_page_range(unsigned long addr, unsigned long end, 31int ioremap_page_range(unsigned long addr, unsigned long end,
32 unsigned long phys_addr, pgprot_t prot); 32 phys_addr_t phys_addr, pgprot_t prot);
33#else 33#else
34static inline int ioremap_page_range(unsigned long addr, unsigned long end, 34static inline int ioremap_page_range(unsigned long addr, unsigned long end,
35 unsigned long phys_addr, pgprot_t prot) 35 phys_addr_t phys_addr, pgprot_t prot)
36{ 36{
37 return 0; 37 return 0;
38} 38}
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index a0bb301afac0..64d529133031 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -7,7 +7,6 @@
7struct cfq_queue; 7struct cfq_queue;
8struct cfq_io_context { 8struct cfq_io_context {
9 void *key; 9 void *key;
10 unsigned long dead_key;
11 10
12 struct cfq_queue *cfqq[2]; 11 struct cfq_queue *cfqq[2];
13 12
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index 64d1b638745d..86bdeffe43ad 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_IOMMU_HELPER_H 1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H 2#define _LINUX_IOMMU_HELPER_H
3 3
4#include <linux/kernel.h>
5
4static inline unsigned long iommu_device_max_index(unsigned long size, 6static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset, 7 unsigned long offset,
6 u64 dma_mask) 8 u64 dma_mask)
@@ -20,7 +22,13 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
20 unsigned long boundary_size, 22 unsigned long boundary_size,
21 unsigned long align_mask); 23 unsigned long align_mask);
22 24
23extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len, 25static inline unsigned long iommu_num_pages(unsigned long addr,
24 unsigned long io_page_size); 26 unsigned long len,
27 unsigned long io_page_size)
28{
29 unsigned long size = (addr & (io_page_size - 1)) + len;
30
31 return DIV_ROUND_UP(size, io_page_size);
32}
25 33
26#endif 34#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 3af4ffd591b9..0a2ba4098996 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -30,6 +30,7 @@ struct iommu_domain {
30}; 30};
31 31
32#define IOMMU_CAP_CACHE_COHERENCY 0x1 32#define IOMMU_CAP_CACHE_COHERENCY 0x1
33#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
33 34
34struct iommu_ops { 35struct iommu_ops {
35 int (*domain_init)(struct iommu_domain *domain); 36 int (*domain_init)(struct iommu_domain *domain);
@@ -37,9 +38,9 @@ struct iommu_ops {
37 int (*attach_dev)(struct iommu_domain *domain, struct device *dev); 38 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
38 void (*detach_dev)(struct iommu_domain *domain, struct device *dev); 39 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
39 int (*map)(struct iommu_domain *domain, unsigned long iova, 40 int (*map)(struct iommu_domain *domain, unsigned long iova,
40 phys_addr_t paddr, size_t size, int prot); 41 phys_addr_t paddr, int gfp_order, int prot);
41 void (*unmap)(struct iommu_domain *domain, unsigned long iova, 42 int (*unmap)(struct iommu_domain *domain, unsigned long iova,
42 size_t size); 43 int gfp_order);
43 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, 44 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
44 unsigned long iova); 45 unsigned long iova);
45 int (*domain_has_cap)(struct iommu_domain *domain, 46 int (*domain_has_cap)(struct iommu_domain *domain,
@@ -56,10 +57,10 @@ extern int iommu_attach_device(struct iommu_domain *domain,
56 struct device *dev); 57 struct device *dev);
57extern void iommu_detach_device(struct iommu_domain *domain, 58extern void iommu_detach_device(struct iommu_domain *domain,
58 struct device *dev); 59 struct device *dev);
59extern int iommu_map_range(struct iommu_domain *domain, unsigned long iova, 60extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
60 phys_addr_t paddr, size_t size, int prot); 61 phys_addr_t paddr, int gfp_order, int prot);
61extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova, 62extern int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
62 size_t size); 63 int gfp_order);
63extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 64extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
64 unsigned long iova); 65 unsigned long iova);
65extern int iommu_domain_has_cap(struct iommu_domain *domain, 66extern int iommu_domain_has_cap(struct iommu_domain *domain,
@@ -96,16 +97,16 @@ static inline void iommu_detach_device(struct iommu_domain *domain,
96{ 97{
97} 98}
98 99
99static inline int iommu_map_range(struct iommu_domain *domain, 100static inline int iommu_map(struct iommu_domain *domain, unsigned long iova,
100 unsigned long iova, phys_addr_t paddr, 101 phys_addr_t paddr, int gfp_order, int prot)
101 size_t size, int prot)
102{ 102{
103 return -ENODEV; 103 return -ENODEV;
104} 104}
105 105
106static inline void iommu_unmap_range(struct iommu_domain *domain, 106static inline int iommu_unmap(struct iommu_domain *domain, unsigned long iova,
107 unsigned long iova, size_t size) 107 int gfp_order)
108{ 108{
109 return -ENODEV;
109} 110}
110 111
111static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, 112static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 26fad187d661..b22790268b64 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -52,6 +52,7 @@ struct resource_list {
52 52
53#define IORESOURCE_MEM_64 0x00100000 53#define IORESOURCE_MEM_64 0x00100000
54#define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ 54#define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */
55#define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */
55 56
56#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 57#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
57#define IORESOURCE_DISABLED 0x10000000 58#define IORESOURCE_DISABLED 0x10000000
@@ -143,7 +144,8 @@ static inline unsigned long resource_type(const struct resource *res)
143} 144}
144 145
145/* Convenience shorthand with allocation */ 146/* Convenience shorthand with allocation */
146#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 147#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
148#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
147#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl) 149#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
148#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0) 150#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
149#define request_mem_region_exclusive(start,n,name) \ 151#define request_mem_region_exclusive(start,n,name) \
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index dfc170362842..9708de265bb1 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -19,6 +19,7 @@
19 */ 19 */
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */ 20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */ 21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */
22 23
23/* 24/*
24 * Destination Server Flags 25 * Destination Server Flags
@@ -85,6 +86,7 @@
85#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */ 86#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
86#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */ 87#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
87#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 88#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
89#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
88 90
89#define IP_VS_SCHEDNAME_MAXLEN 16 91#define IP_VS_SCHEDNAME_MAXLEN 16
90#define IP_VS_IFNAME_MAXLEN 16 92#define IP_VS_IFNAME_MAXLEN 16
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index e0cc9a7db2b5..ab9e9e89e407 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -21,6 +21,10 @@ struct in6_pktinfo {
21 int ipi6_ifindex; 21 int ipi6_ifindex;
22}; 22};
23 23
24struct ip6_mtuinfo {
25 struct sockaddr_in6 ip6m_addr;
26 __u32 ip6m_mtu;
27};
24 28
25struct in6_ifreq { 29struct in6_ifreq {
26 struct in6_addr ifr6_addr; 30 struct in6_addr ifr6_addr;
@@ -54,7 +58,7 @@ struct ipv6_opt_hdr {
54 /* 58 /*
55 * TLV encoded option data follows. 59 * TLV encoded option data follows.
56 */ 60 */
57} __attribute__ ((packed)); /* required for some archs */ 61} __packed; /* required for some archs */
58 62
59#define ipv6_destopt_hdr ipv6_opt_hdr 63#define ipv6_destopt_hdr ipv6_opt_hdr
60#define ipv6_hopopt_hdr ipv6_opt_hdr 64#define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -95,7 +99,7 @@ struct ipv6_destopt_hao {
95 __u8 type; 99 __u8 type;
96 __u8 length; 100 __u8 length;
97 struct in6_addr addr; 101 struct in6_addr addr;
98} __attribute__ ((__packed__)); 102} __packed;
99 103
100/* 104/*
101 * IPv6 fixed header 105 * IPv6 fixed header
@@ -242,7 +246,7 @@ struct inet6_skb_parm {
242 __u16 srcrt; 246 __u16 srcrt;
243 __u16 dst1; 247 __u16 dst1;
244 __u16 lastopt; 248 __u16 lastopt;
245 __u32 nhoff; 249 __u16 nhoff;
246 __u16 flags; 250 __u16 flags;
247#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 251#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
248 __u16 dsthao; 252 __u16 dsthao;
@@ -250,9 +254,11 @@ struct inet6_skb_parm {
250 254
251#define IP6SKB_XFRM_TRANSFORMED 1 255#define IP6SKB_XFRM_TRANSFORMED 1
252#define IP6SKB_FORWARDED 2 256#define IP6SKB_FORWARDED 2
257#define IP6SKB_REROUTED 4
253}; 258};
254 259
255#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 260#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
261#define IP6CBMTU(skb) ((struct ip6_mtuinfo *)((skb)->cb))
256 262
257static inline int inet6_iif(const struct sk_buff *skb) 263static inline int inet6_iif(const struct sk_buff *skb)
258{ 264{
@@ -334,21 +340,25 @@ struct ipv6_pinfo {
334 dstopts:1, 340 dstopts:1,
335 odstopts:1, 341 odstopts:1,
336 rxflow:1, 342 rxflow:1,
337 rxtclass:1; 343 rxtclass:1,
344 rxpmtu:1;
338 } bits; 345 } bits;
339 __u16 all; 346 __u16 all;
340 } rxopt; 347 } rxopt;
341 348
342 /* sockopt flags */ 349 /* sockopt flags */
343 __u8 recverr:1, 350 __u16 recverr:1,
344 sndflow:1, 351 sndflow:1,
345 pmtudisc:2, 352 pmtudisc:2,
346 ipv6only:1, 353 ipv6only:1,
347 srcprefs:3; /* 001: prefer temporary address 354 srcprefs:3, /* 001: prefer temporary address
348 * 010: prefer public address 355 * 010: prefer public address
349 * 100: prefer care-of address 356 * 100: prefer care-of address
350 */ 357 */
358 dontfrag:1;
359 __u8 min_hopcount;
351 __u8 tclass; 360 __u8 tclass;
361 __u8 padding;
352 362
353 __u32 dst_cookie; 363 __u32 dst_cookie;
354 364
@@ -358,6 +368,7 @@ struct ipv6_pinfo {
358 368
359 struct ipv6_txoptions *opt; 369 struct ipv6_txoptions *opt;
360 struct sk_buff *pktoptions; 370 struct sk_buff *pktoptions;
371 struct sk_buff *rxpmtu;
361 struct { 372 struct {
362 struct ipv6_txoptions *opt; 373 struct ipv6_txoptions *opt;
363 u8 hop_limit; 374 u8 hop_limit;
@@ -372,6 +383,7 @@ struct raw6_sock {
372 __u32 checksum; /* perform checksum */ 383 __u32 checksum; /* perform checksum */
373 __u32 offset; /* checksum offset */ 384 __u32 offset; /* checksum offset */
374 struct icmp6_filter filter; 385 struct icmp6_filter filter;
386 __u32 ip6mr_table;
375 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */ 387 /* ipv6_pinfo has to be the last member of raw6_sock, see inet6_sk_generic */
376 struct ipv6_pinfo inet6; 388 struct ipv6_pinfo inet6;
377}; 389};
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 707ab122e2e6..c03243ad84b4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -195,6 +195,7 @@ struct irq_desc {
195 raw_spinlock_t lock; 195 raw_spinlock_t lock;
196#ifdef CONFIG_SMP 196#ifdef CONFIG_SMP
197 cpumask_var_t affinity; 197 cpumask_var_t affinity;
198 const struct cpumask *affinity_hint;
198 unsigned int node; 199 unsigned int node;
199#ifdef CONFIG_GENERIC_PENDING_IRQ 200#ifdef CONFIG_GENERIC_PENDING_IRQ
200 cpumask_var_t pending_mask; 201 cpumask_var_t pending_mask;
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index cd5a269fdb5e..e2d28b026a8c 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -43,10 +43,10 @@
43 */ 43 */
44 44
45#ifdef __KERNEL__ 45#ifdef __KERNEL__
46#include <linux/mod_devicetable.h>
46 47
47#define DEVICE_COUNT_COMPATIBLE 4 48#define DEVICE_COUNT_COMPATIBLE 4
48 49
49#define ISAPNP_ANY_ID 0xffff
50#define ISAPNP_CARD_DEVS 8 50#define ISAPNP_CARD_DEVS 8
51 51
52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \ 52#define ISAPNP_CARD_ID(_va, _vb, _vc, _device) \
@@ -74,12 +74,6 @@ struct isapnp_card_id {
74#define ISAPNP_DEVICE_SINGLE_END \ 74#define ISAPNP_DEVICE_SINGLE_END \
75 .card_vendor = 0, .card_device = 0 75 .card_vendor = 0, .card_device = 0
76 76
77struct isapnp_device_id {
78 unsigned short card_vendor, card_device;
79 unsigned short vendor, function;
80 unsigned long driver_data; /* data private to the driver */
81};
82
83#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE)) 77#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
84 78
85#define __ISAPNP__ 79#define __ISAPNP__
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
new file mode 100644
index 000000000000..f1e6c184f14f
--- /dev/null
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -0,0 +1,123 @@
1/*
2 * Export the iSCSI boot info to userland via sysfs.
3 *
4 * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
5 * Copyright (C) 2010 Mike Christie
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License v2.0 as published by
9 * the Free Software Foundation
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#ifndef _ISCSI_BOOT_SYSFS_
17#define _ISCSI_BOOT_SYSFS_
18
19/*
20 * The text attributes names for each of the kobjects.
21*/
22enum iscsi_boot_eth_properties_enum {
23 ISCSI_BOOT_ETH_INDEX,
24 ISCSI_BOOT_ETH_FLAGS,
25 ISCSI_BOOT_ETH_IP_ADDR,
26 ISCSI_BOOT_ETH_SUBNET_MASK,
27 ISCSI_BOOT_ETH_ORIGIN,
28 ISCSI_BOOT_ETH_GATEWAY,
29 ISCSI_BOOT_ETH_PRIMARY_DNS,
30 ISCSI_BOOT_ETH_SECONDARY_DNS,
31 ISCSI_BOOT_ETH_DHCP,
32 ISCSI_BOOT_ETH_VLAN,
33 ISCSI_BOOT_ETH_MAC,
34 /* eth_pci_bdf - this is replaced by link to the device itself. */
35 ISCSI_BOOT_ETH_HOSTNAME,
36 ISCSI_BOOT_ETH_END_MARKER,
37};
38
39enum iscsi_boot_tgt_properties_enum {
40 ISCSI_BOOT_TGT_INDEX,
41 ISCSI_BOOT_TGT_FLAGS,
42 ISCSI_BOOT_TGT_IP_ADDR,
43 ISCSI_BOOT_TGT_PORT,
44 ISCSI_BOOT_TGT_LUN,
45 ISCSI_BOOT_TGT_CHAP_TYPE,
46 ISCSI_BOOT_TGT_NIC_ASSOC,
47 ISCSI_BOOT_TGT_NAME,
48 ISCSI_BOOT_TGT_CHAP_NAME,
49 ISCSI_BOOT_TGT_CHAP_SECRET,
50 ISCSI_BOOT_TGT_REV_CHAP_NAME,
51 ISCSI_BOOT_TGT_REV_CHAP_SECRET,
52 ISCSI_BOOT_TGT_END_MARKER,
53};
54
55enum iscsi_boot_initiator_properties_enum {
56 ISCSI_BOOT_INI_INDEX,
57 ISCSI_BOOT_INI_FLAGS,
58 ISCSI_BOOT_INI_ISNS_SERVER,
59 ISCSI_BOOT_INI_SLP_SERVER,
60 ISCSI_BOOT_INI_PRI_RADIUS_SERVER,
61 ISCSI_BOOT_INI_SEC_RADIUS_SERVER,
62 ISCSI_BOOT_INI_INITIATOR_NAME,
63 ISCSI_BOOT_INI_END_MARKER,
64};
65
66struct attribute_group;
67
68struct iscsi_boot_kobj {
69 struct kobject kobj;
70 struct attribute_group *attr_group;
71 struct list_head list;
72
73 /*
74 * Pointer to store driver specific info. If set this will
75 * be freed for the LLD when the kobj release function is called.
76 */
77 void *data;
78 /*
79 * Driver specific show function.
80 *
81 * The enum of the type. This can be any value of the above
82 * properties.
83 */
84 ssize_t (*show) (void *data, int type, char *buf);
85
86 /*
87 * Drivers specific visibility function.
88 * The function should return if they the attr should be readable
89 * writable or should not be shown.
90 *
91 * The enum of the type. This can be any value of the above
92 * properties.
93 */
94 mode_t (*is_visible) (void *data, int type);
95};
96
97struct iscsi_boot_kset {
98 struct list_head kobj_list;
99 struct kset *kset;
100};
101
102struct iscsi_boot_kobj *
103iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
104 void *data,
105 ssize_t (*show) (void *data, int type, char *buf),
106 mode_t (*is_visible) (void *data, int type));
107
108struct iscsi_boot_kobj *
109iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
110 void *data,
111 ssize_t (*show) (void *data, int type, char *buf),
112 mode_t (*is_visible) (void *data, int type));
113struct iscsi_boot_kobj *
114iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
115 void *data,
116 ssize_t (*show) (void *data, int type, char *buf),
117 mode_t (*is_visible) (void *data, int type));
118
119struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
120struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
121void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset);
122
123#endif
diff --git a/include/linux/iscsi_ibft.h b/include/linux/iscsi_ibft.h
index d2e4042f8f5e..8ba7e5b9d62c 100644
--- a/include/linux/iscsi_ibft.h
+++ b/include/linux/iscsi_ibft.h
@@ -21,21 +21,13 @@
21#ifndef ISCSI_IBFT_H 21#ifndef ISCSI_IBFT_H
22#define ISCSI_IBFT_H 22#define ISCSI_IBFT_H
23 23
24struct ibft_table_header { 24#include <acpi/acpi.h>
25 char signature[4];
26 u32 length;
27 u8 revision;
28 u8 checksum;
29 char oem_id[6];
30 char oem_table_id[8];
31 char reserved[24];
32} __attribute__((__packed__));
33 25
34/* 26/*
35 * Logical location of iSCSI Boot Format Table. 27 * Logical location of iSCSI Boot Format Table.
36 * If the value is NULL there is no iBFT on the machine. 28 * If the value is NULL there is no iBFT on the machine.
37 */ 29 */
38extern struct ibft_table_header *ibft_addr; 30extern struct acpi_table_ibft *ibft_addr;
39 31
40/* 32/*
41 * Routine used to find and reserve the iSCSI Boot Format Table. The 33 * Routine used to find and reserve the iSCSI Boot Format Table. The
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index b9b5a684ed69..b8c23f88dd54 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -317,7 +317,7 @@ typedef struct T30_s {
317 __u8 r_scantime; 317 __u8 r_scantime;
318 __u8 r_id[FAXIDLEN]; 318 __u8 r_id[FAXIDLEN];
319 __u8 r_code; 319 __u8 r_code;
320} __attribute__((packed)) T30_s; 320} __packed T30_s;
321 321
322#define ISDN_TTY_FAX_CONN_IN 0 322#define ISDN_TTY_FAX_CONN_IN 0
323#define ISDN_TTY_FAX_CONN_OUT 1 323#define ISDN_TTY_FAX_CONN_OUT 1
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 7faca98c7d14..ad700a60c158 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -86,7 +86,7 @@ struct stlibrd {
86 unsigned long magic; 86 unsigned long magic;
87 unsigned int brdnr; 87 unsigned int brdnr;
88 unsigned int brdtype; 88 unsigned int brdtype;
89 unsigned int state; 89 unsigned long state;
90 unsigned int nrpanels; 90 unsigned int nrpanels;
91 unsigned int nrports; 91 unsigned int nrports;
92 unsigned int nrdevs; 92 unsigned int nrdevs;
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
index 9d88b29ddf55..e8b92f67f10d 100644
--- a/include/linux/ivtvfb.h
+++ b/include/linux/ivtvfb.h
@@ -33,6 +33,5 @@ struct ivtvfb_dma_frame {
33}; 33};
34 34
35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame) 35#define IVTVFB_IOC_DMA_FRAME _IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
37 36
38#endif 37#endif
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 516a2a27e87a..e06965081ba5 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -427,9 +427,9 @@ struct transaction_s
427 enum { 427 enum {
428 T_RUNNING, 428 T_RUNNING,
429 T_LOCKED, 429 T_LOCKED,
430 T_RUNDOWN,
431 T_FLUSH, 430 T_FLUSH,
432 T_COMMIT, 431 T_COMMIT,
432 T_COMMIT_RECORD,
433 T_FINISHED 433 T_FINISHED
434 } t_state; 434 } t_state;
435 435
@@ -991,6 +991,7 @@ int journal_start_commit(journal_t *journal, tid_t *tid);
991int journal_force_commit_nested(journal_t *journal); 991int journal_force_commit_nested(journal_t *journal);
992int log_wait_commit(journal_t *journal, tid_t tid); 992int log_wait_commit(journal_t *journal, tid_t tid);
993int log_do_checkpoint(journal_t *journal); 993int log_do_checkpoint(journal_t *journal);
994int journal_trans_will_send_data_barrier(journal_t *journal, tid_t tid);
994 995
995void __log_wait_for_space(journal_t *journal); 996void __log_wait_for_space(journal_t *journal);
996extern void __journal_drop_transaction(journal_t *, transaction_t *); 997extern void __journal_drop_transaction(journal_t *, transaction_t *);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index a4d2e9f7088a..0b52924a0cb6 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -601,13 +601,13 @@ struct transaction_s
601 * Number of outstanding updates running on this transaction 601 * Number of outstanding updates running on this transaction
602 * [t_handle_lock] 602 * [t_handle_lock]
603 */ 603 */
604 int t_updates; 604 atomic_t t_updates;
605 605
606 /* 606 /*
607 * Number of buffers reserved for use by all handles in this transaction 607 * Number of buffers reserved for use by all handles in this transaction
608 * handle but not yet modified. [t_handle_lock] 608 * handle but not yet modified. [t_handle_lock]
609 */ 609 */
610 int t_outstanding_credits; 610 atomic_t t_outstanding_credits;
611 611
612 /* 612 /*
613 * Forward and backward links for the circular list of all transactions 613 * Forward and backward links for the circular list of all transactions
@@ -629,7 +629,7 @@ struct transaction_s
629 /* 629 /*
630 * How many handles used this transaction? [t_handle_lock] 630 * How many handles used this transaction? [t_handle_lock]
631 */ 631 */
632 int t_handle_count; 632 atomic_t t_handle_count;
633 633
634 /* 634 /*
635 * This transaction is being forced and some process is 635 * This transaction is being forced and some process is
@@ -764,7 +764,7 @@ struct journal_s
764 /* 764 /*
765 * Protect the various scalars in the journal 765 * Protect the various scalars in the journal
766 */ 766 */
767 spinlock_t j_state_lock; 767 rwlock_t j_state_lock;
768 768
769 /* 769 /*
770 * Number of processes waiting to create a barrier lock [j_state_lock] 770 * Number of processes waiting to create a barrier lock [j_state_lock]
@@ -1026,11 +1026,12 @@ void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1026 1026
1027struct jbd2_buffer_trigger_type { 1027struct jbd2_buffer_trigger_type {
1028 /* 1028 /*
1029 * Fired just before a buffer is written to the journal. 1029 * Fired a the moment data to write to the journal are known to be
1030 * mapped_data is a mapped buffer that is the frozen data for 1030 * stable - so either at the moment b_frozen_data is created or just
1031 * commit. 1031 * before a buffer is written to the journal. mapped_data is a mapped
1032 * buffer that is the frozen data for commit.
1032 */ 1033 */
1033 void (*t_commit)(struct jbd2_buffer_trigger_type *type, 1034 void (*t_frozen)(struct jbd2_buffer_trigger_type *type,
1034 struct buffer_head *bh, void *mapped_data, 1035 struct buffer_head *bh, void *mapped_data,
1035 size_t size); 1036 size_t size);
1036 1037
@@ -1042,7 +1043,7 @@ struct jbd2_buffer_trigger_type {
1042 struct buffer_head *bh); 1043 struct buffer_head *bh);
1043}; 1044};
1044 1045
1045extern void jbd2_buffer_commit_trigger(struct journal_head *jh, 1046extern void jbd2_buffer_frozen_trigger(struct journal_head *jh,
1046 void *mapped_data, 1047 void *mapped_data,
1047 struct jbd2_buffer_trigger_type *triggers); 1048 struct jbd2_buffer_trigger_type *triggers);
1048extern void jbd2_buffer_abort_trigger(struct journal_head *jh, 1049extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
@@ -1081,7 +1082,9 @@ static inline handle_t *journal_current_handle(void)
1081 */ 1082 */
1082 1083
1083extern handle_t *jbd2_journal_start(journal_t *, int nblocks); 1084extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
1084extern int jbd2_journal_restart (handle_t *, int nblocks); 1085extern handle_t *jbd2__journal_start(journal_t *, int nblocks, int gfp_mask);
1086extern int jbd2_journal_restart(handle_t *, int nblocks);
1087extern int jbd2__journal_restart(handle_t *, int nblocks, int gfp_mask);
1085extern int jbd2_journal_extend (handle_t *, int nblocks); 1088extern int jbd2_journal_extend (handle_t *, int nblocks);
1086extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1089extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1087extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1090extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
@@ -1256,8 +1259,8 @@ static inline int jbd_space_needed(journal_t *journal)
1256{ 1259{
1257 int nblocks = journal->j_max_transaction_buffers; 1260 int nblocks = journal->j_max_transaction_buffers;
1258 if (journal->j_committing_transaction) 1261 if (journal->j_committing_transaction)
1259 nblocks += journal->j_committing_transaction-> 1262 nblocks += atomic_read(&journal->j_committing_transaction->
1260 t_outstanding_credits; 1263 t_outstanding_credits);
1261 return nblocks; 1264 return nblocks;
1262} 1265}
1263 1266
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 2b32d638147d..a18b719f49d4 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * JFFS2 -- Journalling Flash File System, Version 2. 2 * JFFS2 -- Journalling Flash File System, Version 2.
3 * 3 *
4 * Copyright (C) 2001-2003 Red Hat, Inc. 4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
5 * 6 *
6 * Created by David Woodhouse <dwmw2@infradead.org> 7 * Created by David Woodhouse <dwmw2@infradead.org>
7 * 8 *
@@ -185,7 +186,7 @@ struct jffs2_raw_xref
185 jint32_t hdr_crc; 186 jint32_t hdr_crc;
186 jint32_t ino; /* inode number */ 187 jint32_t ino; /* inode number */
187 jint32_t xid; /* XATTR identifier number */ 188 jint32_t xid; /* XATTR identifier number */
188 jint32_t xseqno; /* xref sequencial number */ 189 jint32_t xseqno; /* xref sequential number */
189 jint32_t node_crc; 190 jint32_t node_crc;
190} __attribute__((packed)); 191} __attribute__((packed));
191 192
@@ -215,8 +216,8 @@ union jffs2_node_union
215 216
216/* Data payload for device nodes. */ 217/* Data payload for device nodes. */
217union jffs2_device_node { 218union jffs2_device_node {
218 jint16_t old; 219 jint16_t old_id;
219 jint32_t new; 220 jint32_t new_id;
220}; 221};
221 222
222#endif /* __LINUX_JFFS2_H__ */ 223#endif /* __LINUX_JFFS2_H__ */
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index 9e20c29c1e14..47199b13e0eb 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -64,8 +64,8 @@ struct js_event {
64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */ 64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */ 65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
66 66
67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_MAX + 1]) /* set axis mapping */ 67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_MAX + 1]) /* get axis mapping */ 68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */ 69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */ 70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
71 71
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
new file mode 100644
index 000000000000..ea6e5244ed3f
--- /dev/null
+++ b/include/linux/kdb.h
@@ -0,0 +1,121 @@
1#ifndef _KDB_H
2#define _KDB_H
3
4/*
5 * Kernel Debugger Architecture Independent Global Headers
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
12 * Copyright (C) 2000 Stephane Eranian <eranian@hpl.hp.com>
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */
15
16#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h>
18#include <linux/sched.h>
19#include <asm/atomic.h>
20
21#define KDB_POLL_FUNC_MAX 5
22extern int kdb_poll_idx;
23
24/*
25 * kdb_initial_cpu is initialized to -1, and is set to the cpu
26 * number whenever the kernel debugger is entered.
27 */
28extern int kdb_initial_cpu;
29extern atomic_t kdb_event;
30
31/*
32 * kdb_diemsg
33 *
34 * Contains a pointer to the last string supplied to the
35 * kernel 'die' panic function.
36 */
37extern const char *kdb_diemsg;
38
39#define KDB_FLAG_EARLYKDB (1 << 0) /* set from boot parameter kdb=early */
40#define KDB_FLAG_CATASTROPHIC (1 << 1) /* A catastrophic event has occurred */
41#define KDB_FLAG_CMD_INTERRUPT (1 << 2) /* Previous command was interrupted */
42#define KDB_FLAG_NOIPI (1 << 3) /* Do not send IPIs */
43#define KDB_FLAG_ONLY_DO_DUMP (1 << 4) /* Only do a dump, used when
44 * kdb is off */
45#define KDB_FLAG_NO_CONSOLE (1 << 5) /* No console is available,
46 * kdb is disabled */
47#define KDB_FLAG_NO_VT_CONSOLE (1 << 6) /* No VT console is available, do
48 * not use keyboard */
49#define KDB_FLAG_NO_I8042 (1 << 7) /* No i8042 chip is available, do
50 * not use keyboard */
51
52extern int kdb_flags; /* Global flags, see kdb_state for per cpu state */
53
54extern void kdb_save_flags(void);
55extern void kdb_restore_flags(void);
56
57#define KDB_FLAG(flag) (kdb_flags & KDB_FLAG_##flag)
58#define KDB_FLAG_SET(flag) ((void)(kdb_flags |= KDB_FLAG_##flag))
59#define KDB_FLAG_CLEAR(flag) ((void)(kdb_flags &= ~KDB_FLAG_##flag))
60
61/*
62 * External entry point for the kernel debugger. The pt_regs
63 * at the time of entry are supplied along with the reason for
64 * entry to the kernel debugger.
65 */
66
67typedef enum {
68 KDB_REASON_ENTER = 1, /* KDB_ENTER() trap/fault - regs valid */
69 KDB_REASON_ENTER_SLAVE, /* KDB_ENTER_SLAVE() trap/fault - regs valid */
70 KDB_REASON_BREAK, /* Breakpoint inst. - regs valid */
71 KDB_REASON_DEBUG, /* Debug Fault - regs valid */
72 KDB_REASON_OOPS, /* Kernel Oops - regs valid */
73 KDB_REASON_SWITCH, /* CPU switch - regs valid*/
74 KDB_REASON_KEYBOARD, /* Keyboard entry - regs valid */
75 KDB_REASON_NMI, /* Non-maskable interrupt; regs valid */
76 KDB_REASON_RECURSE, /* Recursive entry to kdb;
77 * regs probably valid */
78 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
79} kdb_reason_t;
80
81extern int kdb_trap_printk;
82extern int vkdb_printf(const char *fmt, va_list args)
83 __attribute__ ((format (printf, 1, 0)));
84extern int kdb_printf(const char *, ...)
85 __attribute__ ((format (printf, 1, 2)));
86typedef int (*kdb_printf_t)(const char *, ...)
87 __attribute__ ((format (printf, 1, 2)));
88
89extern void kdb_init(int level);
90
91/* Access to kdb specific polling devices */
92typedef int (*get_char_func)(void);
93extern get_char_func kdb_poll_funcs[];
94extern int kdb_get_kbd_char(void);
95
96static inline
97int kdb_process_cpu(const struct task_struct *p)
98{
99 unsigned int cpu = task_thread_info(p)->cpu;
100 if (cpu > num_possible_cpus())
101 cpu = 0;
102 return cpu;
103}
104
105/* kdb access to register set for stack dumping */
106extern struct pt_regs *kdb_current_regs;
107
108#else /* ! CONFIG_KGDB_KDB */
109#define kdb_printf(...)
110#define kdb_init(x)
111#endif /* CONFIG_KGDB_KDB */
112enum {
113 KDB_NOT_INITIALIZED,
114 KDB_INIT_EARLY,
115 KDB_INIT_FULL,
116};
117
118extern int kdbgetintenv(const char *, int *);
119extern int kdb_set(int, const char **);
120
121#endif /* !_KDB_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9365227dbaf6..d848cb854655 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -4,6 +4,8 @@
4/* 4/*
5 * 'kernel.h' contains some often-used function prototypes etc 5 * 'kernel.h' contains some often-used function prototypes etc
6 */ 6 */
7#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
8#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
7 9
8#ifdef __KERNEL__ 10#ifdef __KERNEL__
9 11
@@ -22,9 +24,9 @@
22extern const char linux_banner[]; 24extern const char linux_banner[];
23extern const char linux_proc_banner[]; 25extern const char linux_proc_banner[];
24 26
25#define USHORT_MAX ((u16)(~0U)) 27#define USHRT_MAX ((u16)(~0U))
26#define SHORT_MAX ((s16)(USHORT_MAX>>1)) 28#define SHRT_MAX ((s16)(USHRT_MAX>>1))
27#define SHORT_MIN (-SHORT_MAX - 1) 29#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
28#define INT_MAX ((int)(~0U>>1)) 30#define INT_MAX ((int)(~0U>>1))
29#define INT_MIN (-INT_MAX - 1) 31#define INT_MIN (-INT_MAX - 1)
30#define UINT_MAX (~0U) 32#define UINT_MAX (~0U)
@@ -37,8 +39,8 @@ extern const char linux_proc_banner[];
37 39
38#define STACK_MAGIC 0xdeadbeef 40#define STACK_MAGIC 0xdeadbeef
39 41
40#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) 42#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
41#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) 43#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
42#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) 44#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
43#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) 45#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
44 46
@@ -169,12 +171,18 @@ static inline void might_fault(void)
169} 171}
170#endif 172#endif
171 173
174struct va_format {
175 const char *fmt;
176 va_list *va;
177};
178
172extern struct atomic_notifier_head panic_notifier_list; 179extern struct atomic_notifier_head panic_notifier_list;
173extern long (*panic_blink)(long time); 180extern long (*panic_blink)(int state);
174NORET_TYPE void panic(const char * fmt, ...) 181NORET_TYPE void panic(const char * fmt, ...)
175 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; 182 __attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
176extern void oops_enter(void); 183extern void oops_enter(void);
177extern void oops_exit(void); 184extern void oops_exit(void);
185void print_oops_end_marker(void);
178extern int oops_may_print(void); 186extern int oops_may_print(void);
179NORET_TYPE void do_exit(long error_code) 187NORET_TYPE void do_exit(long error_code)
180 ATTRIB_NORET; 188 ATTRIB_NORET;
@@ -245,6 +253,13 @@ extern struct pid *session_of_pgrp(struct pid *pgrp);
245#define FW_WARN "[Firmware Warn]: " 253#define FW_WARN "[Firmware Warn]: "
246#define FW_INFO "[Firmware Info]: " 254#define FW_INFO "[Firmware Info]: "
247 255
256/*
257 * HW_ERR
258 * Add this to a message for hardware errors, so that user can report
259 * it to hardware vendor instead of LKML or software vendor.
260 */
261#define HW_ERR "[Hardware Error]: "
262
248#ifdef CONFIG_PRINTK 263#ifdef CONFIG_PRINTK
249asmlinkage int vprintk(const char *fmt, va_list args) 264asmlinkage int vprintk(const char *fmt, va_list args)
250 __attribute__ ((format (printf, 1, 0))); 265 __attribute__ ((format (printf, 1, 0)));
@@ -344,6 +359,7 @@ extern enum system_states {
344#define TAINT_OVERRIDDEN_ACPI_TABLE 8 359#define TAINT_OVERRIDDEN_ACPI_TABLE 8
345#define TAINT_WARN 9 360#define TAINT_WARN 9
346#define TAINT_CRAP 10 361#define TAINT_CRAP 10
362#define TAINT_FIRMWARE_WORKAROUND 11
347 363
348extern void dump_stack(void) __cold; 364extern void dump_stack(void) __cold;
349 365
@@ -372,6 +388,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
372 return buf; 388 return buf;
373} 389}
374 390
391extern int hex_to_bin(char ch);
392
375#ifndef pr_fmt 393#ifndef pr_fmt
376#define pr_fmt(fmt) fmt 394#define pr_fmt(fmt) fmt
377#endif 395#endif
@@ -386,6 +404,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
386 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) 404 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
387#define pr_warning(fmt, ...) \ 405#define pr_warning(fmt, ...) \
388 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) 406 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
407#define pr_warn pr_warning
389#define pr_notice(fmt, ...) \ 408#define pr_notice(fmt, ...) \
390 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 409 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
391#define pr_info(fmt, ...) \ 410#define pr_info(fmt, ...) \
@@ -420,14 +439,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
420 * no local ratelimit_state used in the !PRINTK case 439 * no local ratelimit_state used in the !PRINTK case
421 */ 440 */
422#ifdef CONFIG_PRINTK 441#ifdef CONFIG_PRINTK
423#define printk_ratelimited(fmt, ...) ({ \ 442#define printk_ratelimited(fmt, ...) ({ \
424 static struct ratelimit_state _rs = { \ 443 static DEFINE_RATELIMIT_STATE(_rs, \
425 .interval = DEFAULT_RATELIMIT_INTERVAL, \ 444 DEFAULT_RATELIMIT_INTERVAL, \
426 .burst = DEFAULT_RATELIMIT_BURST, \ 445 DEFAULT_RATELIMIT_BURST); \
427 }; \ 446 \
428 \ 447 if (__ratelimit(&_rs)) \
429 if (__ratelimit(&_rs)) \ 448 printk(fmt, ##__VA_ARGS__); \
430 printk(fmt, ##__VA_ARGS__); \
431}) 449})
432#else 450#else
433/* No effect, but we still get type checking even in the !PRINTK case: */ 451/* No effect, but we still get type checking even in the !PRINTK case: */
@@ -444,6 +462,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
444 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) 462 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
445#define pr_warning_ratelimited(fmt, ...) \ 463#define pr_warning_ratelimited(fmt, ...) \
446 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) 464 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
465#define pr_warn_ratelimited pr_warning_ratelimited
447#define pr_notice_ratelimited(fmt, ...) \ 466#define pr_notice_ratelimited(fmt, ...) \
448 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) 467 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
449#define pr_info_ratelimited(fmt, ...) \ 468#define pr_info_ratelimited(fmt, ...) \
@@ -490,14 +509,18 @@ static inline void tracing_off(void) { }
490static inline void tracing_off_permanent(void) { } 509static inline void tracing_off_permanent(void) { }
491static inline int tracing_is_on(void) { return 0; } 510static inline int tracing_is_on(void) { return 0; }
492#endif 511#endif
512
513enum ftrace_dump_mode {
514 DUMP_NONE,
515 DUMP_ALL,
516 DUMP_ORIG,
517};
518
493#ifdef CONFIG_TRACING 519#ifdef CONFIG_TRACING
494extern void tracing_start(void); 520extern void tracing_start(void);
495extern void tracing_stop(void); 521extern void tracing_stop(void);
496extern void ftrace_off_permanent(void); 522extern void ftrace_off_permanent(void);
497 523
498extern void
499ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
500
501static inline void __attribute__ ((format (printf, 1, 2))) 524static inline void __attribute__ ((format (printf, 1, 2)))
502____trace_printk_check_format(const char *fmt, ...) 525____trace_printk_check_format(const char *fmt, ...)
503{ 526{
@@ -571,10 +594,8 @@ __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap);
571extern int 594extern int
572__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); 595__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
573 596
574extern void ftrace_dump(void); 597extern void ftrace_dump(enum ftrace_dump_mode oops_dump_mode);
575#else 598#else
576static inline void
577ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
578static inline int 599static inline int
579trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); 600trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
580 601
@@ -592,21 +613,10 @@ ftrace_vprintk(const char *fmt, va_list ap)
592{ 613{
593 return 0; 614 return 0;
594} 615}
595static inline void ftrace_dump(void) { } 616static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
596#endif /* CONFIG_TRACING */ 617#endif /* CONFIG_TRACING */
597 618
598/* 619/*
599 * Display an IP address in readable format.
600 */
601
602#define NIPQUAD(addr) \
603 ((unsigned char *)&addr)[0], \
604 ((unsigned char *)&addr)[1], \
605 ((unsigned char *)&addr)[2], \
606 ((unsigned char *)&addr)[3]
607#define NIPQUAD_FMT "%u.%u.%u.%u"
608
609/*
610 * min()/max()/clamp() macros that also do 620 * min()/max()/clamp() macros that also do
611 * strict type-checking.. See the 621 * strict type-checking.. See the
612 * "unnecessary" pointer comparison. 622 * "unnecessary" pointer comparison.
@@ -715,12 +725,6 @@ extern int do_sysinfo(struct sysinfo *info);
715 725
716#endif /* __KERNEL__ */ 726#endif /* __KERNEL__ */
717 727
718#ifndef __EXPORTED_HEADERS__
719#ifndef __KERNEL__
720#warning Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders
721#endif /* __KERNEL__ */
722#endif /* __EXPORTED_HEADERS__ */
723
724#define SI_LOAD_SHIFT 16 728#define SI_LOAD_SHIFT 16
725struct sysinfo { 729struct sysinfo {
726 long uptime; /* Seconds since boot */ 730 long uptime; /* Seconds since boot */
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index e117b1aee69c..311f8753d713 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -1,8 +1,7 @@
1/* 1/*
2 * A generic kernel FIFO implementation. 2 * A generic kernel FIFO implementation
3 * 3 *
4 * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> 4 * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net>
5 * Copyright (C) 2004 Stelian Pop <stelian@popies.net>
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -20,8 +19,11 @@
20 * 19 *
21 */ 20 */
22 21
22#ifndef _LINUX_KFIFO_H
23#define _LINUX_KFIFO_H
24
23/* 25/*
24 * Howto porting drivers to the new generic fifo API: 26 * How to porting drivers to the new generic FIFO API:
25 * 27 *
26 * - Modify the declaration of the "struct kfifo *" object into a 28 * - Modify the declaration of the "struct kfifo *" object into a
27 * in-place "struct kfifo" object 29 * in-place "struct kfifo" object
@@ -30,586 +32,813 @@
30 * passed as the first argument to this functions 32 * passed as the first argument to this functions
31 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get 33 * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get
32 * into kfifo_out 34 * into kfifo_out
33 * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get 35 * - Replace the use of kfifo_put into kfifo_in_spinlocked and kfifo_get
34 * into kfifo_out_locked 36 * into kfifo_out_spinlocked
35 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc 37 * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc
36 * must be passed now to the kfifo_in_locked and kfifo_out_locked 38 * must be passed now to the kfifo_in_spinlocked and kfifo_out_spinlocked
37 * as the last parameter. 39 * as the last parameter
38 * - All formerly name __kfifo_* functions has been renamed into kfifo_* 40 * - The formerly __kfifo_* functions are renamed into kfifo_*
39 */ 41 */
40 42
41#ifndef _LINUX_KFIFO_H 43/*
42#define _LINUX_KFIFO_H 44 * Note about locking : There is no locking required until only * one reader
45 * and one writer is using the fifo and no kfifo_reset() will be * called
46 * kfifo_reset_out() can be safely used, until it will be only called
47 * in the reader thread.
48 * For multiple writer and one reader there is only a need to lock the writer.
49 * And vice versa for only one writer and multiple reader there is only a need
50 * to lock the reader.
51 */
43 52
44#include <linux/kernel.h> 53#include <linux/kernel.h>
45#include <linux/spinlock.h> 54#include <linux/spinlock.h>
46 55#include <linux/stddef.h>
47struct kfifo { 56#include <linux/scatterlist.h>
48 unsigned char *buffer; /* the buffer holding the data */ 57
49 unsigned int size; /* the size of the allocated buffer */ 58struct __kfifo {
50 unsigned int in; /* data is added at offset (in % size) */ 59 unsigned int in;
51 unsigned int out; /* data is extracted from off. (out % size) */ 60 unsigned int out;
61 unsigned int mask;
62 unsigned int esize;
63 void *data;
52}; 64};
53 65
54/* 66#define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \
55 * Macros for declaration and initialization of the kfifo datatype 67 union { \
56 */ 68 struct __kfifo kfifo; \
57 69 datatype *type; \
58/* helper macro */ 70 char (*rectype)[recsize]; \
59#define __kfifo_initializer(s, b) \ 71 ptrtype *ptr; \
60 (struct kfifo) { \ 72 const ptrtype *ptr_const; \
61 .size = s, \
62 .in = 0, \
63 .out = 0, \
64 .buffer = b \
65 } 73 }
66 74
67/** 75#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \
68 * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer 76{ \
69 * @name: name of the declared kfifo datatype 77 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
70 * @size: size of the fifo buffer. Must be a power of two. 78 type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \
71 *
72 * Note1: the macro can be used inside struct or union declaration
73 * Note2: the macro creates two objects:
74 * A kfifo object with the given name and a buffer for the kfifo
75 * object named name##kfifo_buffer
76 */
77#define DECLARE_KFIFO(name, size) \
78union { \
79 struct kfifo name; \
80 unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \
81} 79}
82 80
83/** 81#define STRUCT_KFIFO(type, size) \
84 * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO 82 struct __STRUCT_KFIFO(type, size, 0, type)
85 * @name: name of the declared kfifo datatype 83
84#define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \
85{ \
86 __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \
87 type buf[0]; \
88}
89
90#define STRUCT_KFIFO_PTR(type) \
91 struct __STRUCT_KFIFO_PTR(type, 0, type)
92
93/*
94 * define compatibility "struct kfifo" for dynamic allocated fifos
86 */ 95 */
87#define INIT_KFIFO(name) \ 96struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void);
88 name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \
89 sizeof(struct kfifo), \
90 name##kfifo_buffer + sizeof(struct kfifo))
91 97
92/** 98#define STRUCT_KFIFO_REC_1(size) \
93 * DEFINE_KFIFO - macro to define and initialize a kfifo 99 struct __STRUCT_KFIFO(unsigned char, size, 1, void)
94 * @name: name of the declared kfifo datatype 100
95 * @size: size of the fifo buffer. Must be a power of two. 101#define STRUCT_KFIFO_REC_2(size) \
96 * 102 struct __STRUCT_KFIFO(unsigned char, size, 2, void)
97 * Note1: the macro can be used for global and local kfifo data type variables 103
98 * Note2: the macro creates two objects: 104/*
99 * A kfifo object with the given name and a buffer for the kfifo 105 * define kfifo_rec types
100 * object named name##kfifo_buffer
101 */ 106 */
102#define DEFINE_KFIFO(name, size) \ 107struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void);
103 unsigned char name##kfifo_buffer[size]; \ 108struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
104 struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer)
105 109
106extern void kfifo_init(struct kfifo *fifo, void *buffer, 110/*
107 unsigned int size); 111 * helper macro to distinguish between real in place fifo where the fifo
108extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, 112 * array is a part of the structure and the fifo type where the array is
109 gfp_t gfp_mask); 113 * outside of the fifo structure.
110extern void kfifo_free(struct kfifo *fifo); 114 */
111extern unsigned int kfifo_in(struct kfifo *fifo, 115#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo))
112 const void *from, unsigned int len);
113extern __must_check unsigned int kfifo_out(struct kfifo *fifo,
114 void *to, unsigned int len);
115extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo,
116 void *to, unsigned int len, unsigned offset);
117 116
118/** 117/**
119 * kfifo_initialized - Check if kfifo is initialized. 118 * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object
120 * @fifo: fifo to check 119 * @fifo: name of the declared fifo
121 * Return %true if FIFO is initialized, otherwise %false. 120 * @type: type of the fifo elements
122 * Assumes the fifo was 0 before.
123 */ 121 */
124static inline bool kfifo_initialized(struct kfifo *fifo) 122#define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo
125{
126 return fifo->buffer != NULL;
127}
128 123
129/** 124/**
130 * kfifo_reset - removes the entire FIFO contents 125 * DECLARE_KFIFO - macro to declare a fifo object
131 * @fifo: the fifo to be emptied. 126 * @fifo: name of the declared fifo
127 * @type: type of the fifo elements
128 * @size: the number of elements in the fifo, this must be a power of 2
132 */ 129 */
133static inline void kfifo_reset(struct kfifo *fifo) 130#define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo
134{
135 fifo->in = fifo->out = 0;
136}
137 131
138/** 132/**
139 * kfifo_reset_out - skip FIFO contents 133 * INIT_KFIFO - Initialize a fifo declared by DECLARE_KFIFO
140 * @fifo: the fifo to be emptied. 134 * @fifo: name of the declared fifo datatype
141 */ 135 */
142static inline void kfifo_reset_out(struct kfifo *fifo) 136#define INIT_KFIFO(fifo) \
143{ 137(void)({ \
144 smp_mb(); 138 typeof(&(fifo)) __tmp = &(fifo); \
145 fifo->out = fifo->in; 139 struct __kfifo *__kfifo = &__tmp->kfifo; \
146} 140 __kfifo->in = 0; \
141 __kfifo->out = 0; \
142 __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\
143 __kfifo->esize = sizeof(*__tmp->buf); \
144 __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \
145})
147 146
148/** 147/**
149 * kfifo_size - returns the size of the fifo in bytes 148 * DEFINE_KFIFO - macro to define and initialize a fifo
150 * @fifo: the fifo to be used. 149 * @fifo: name of the declared fifo datatype
151 */ 150 * @type: type of the fifo elements
152static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) 151 * @size: the number of elements in the fifo, this must be a power of 2
152 *
153 * Note: the macro can be used for global and local fifo data type variables.
154 */
155#define DEFINE_KFIFO(fifo, type, size) \
156 DECLARE_KFIFO(fifo, type, size) = \
157 (typeof(fifo)) { \
158 { \
159 { \
160 .in = 0, \
161 .out = 0, \
162 .mask = __is_kfifo_ptr(&(fifo)) ? \
163 0 : \
164 ARRAY_SIZE((fifo).buf) - 1, \
165 .esize = sizeof(*(fifo).buf), \
166 .data = __is_kfifo_ptr(&(fifo)) ? \
167 NULL : \
168 (fifo).buf, \
169 } \
170 } \
171 }
172
173
174static inline unsigned int __must_check
175__kfifo_must_check_helper(unsigned int val)
153{ 176{
154 return fifo->size; 177 return val;
155} 178}
156 179
157/** 180/**
158 * kfifo_len - returns the number of used bytes in the FIFO 181 * kfifo_initialized - Check if the fifo is initialized
159 * @fifo: the fifo to be used. 182 * @fifo: address of the fifo to check
183 *
184 * Return %true if fifo is initialized, otherwise %false.
185 * Assumes the fifo was 0 before.
160 */ 186 */
161static inline unsigned int kfifo_len(struct kfifo *fifo) 187#define kfifo_initialized(fifo) ((fifo)->kfifo.mask)
162{
163 register unsigned int out;
164
165 out = fifo->out;
166 smp_rmb();
167 return fifo->in - out;
168}
169 188
170/** 189/**
171 * kfifo_is_empty - returns true if the fifo is empty 190 * kfifo_esize - returns the size of the element managed by the fifo
172 * @fifo: the fifo to be used. 191 * @fifo: address of the fifo to be used
173 */ 192 */
174static inline __must_check int kfifo_is_empty(struct kfifo *fifo) 193#define kfifo_esize(fifo) ((fifo)->kfifo.esize)
175{
176 return fifo->in == fifo->out;
177}
178 194
179/** 195/**
180 * kfifo_is_full - returns true if the fifo is full 196 * kfifo_recsize - returns the size of the record length field
181 * @fifo: the fifo to be used. 197 * @fifo: address of the fifo to be used
182 */ 198 */
183static inline __must_check int kfifo_is_full(struct kfifo *fifo) 199#define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype))
184{
185 return kfifo_len(fifo) == kfifo_size(fifo);
186}
187 200
188/** 201/**
189 * kfifo_avail - returns the number of bytes available in the FIFO 202 * kfifo_size - returns the size of the fifo in elements
190 * @fifo: the fifo to be used. 203 * @fifo: address of the fifo to be used
191 */ 204 */
192static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) 205#define kfifo_size(fifo) ((fifo)->kfifo.mask + 1)
193{
194 return kfifo_size(fifo) - kfifo_len(fifo);
195}
196 206
197/** 207/**
198 * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking 208 * kfifo_reset - removes the entire fifo content
199 * @fifo: the fifo to be used. 209 * @fifo: address of the fifo to be used
200 * @from: the data to be added.
201 * @n: the length of the data to be added.
202 * @lock: pointer to the spinlock to use for locking.
203 * 210 *
204 * This function copies at most @len bytes from the @from buffer into 211 * Note: usage of kfifo_reset() is dangerous. It should be only called when the
205 * the FIFO depending on the free space, and returns the number of 212 * fifo is exclusived locked or when it is secured that no other thread is
206 * bytes copied. 213 * accessing the fifo.
207 */ 214 */
208static inline unsigned int kfifo_in_locked(struct kfifo *fifo, 215#define kfifo_reset(fifo) \
209 const void *from, unsigned int n, spinlock_t *lock) 216(void)({ \
210{ 217 typeof(fifo + 1) __tmp = (fifo); \
211 unsigned long flags; 218 __tmp->kfifo.in = __tmp->kfifo.out = 0; \
212 unsigned int ret; 219})
213
214 spin_lock_irqsave(lock, flags);
215
216 ret = kfifo_in(fifo, from, n);
217
218 spin_unlock_irqrestore(lock, flags);
219
220 return ret;
221}
222 220
223/** 221/**
224 * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking 222 * kfifo_reset_out - skip fifo content
225 * @fifo: the fifo to be used. 223 * @fifo: address of the fifo to be used
226 * @to: where the data must be copied.
227 * @n: the size of the destination buffer.
228 * @lock: pointer to the spinlock to use for locking.
229 * 224 *
230 * This function copies at most @len bytes from the FIFO into the 225 * Note: The usage of kfifo_reset_out() is safe until it will be only called
231 * @to buffer and returns the number of copied bytes. 226 * from the reader thread and there is only one concurrent reader. Otherwise
232 */ 227 * it is dangerous and must be handled in the same way as kfifo_reset().
233static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo,
234 void *to, unsigned int n, spinlock_t *lock)
235{
236 unsigned long flags;
237 unsigned int ret;
238
239 spin_lock_irqsave(lock, flags);
240
241 ret = kfifo_out(fifo, to, n);
242
243 spin_unlock_irqrestore(lock, flags);
244
245 return ret;
246}
247
248extern void kfifo_skip(struct kfifo *fifo, unsigned int len);
249
250extern __must_check int kfifo_from_user(struct kfifo *fifo,
251 const void __user *from, unsigned int n, unsigned *lenout);
252
253extern __must_check int kfifo_to_user(struct kfifo *fifo,
254 void __user *to, unsigned int n, unsigned *lenout);
255
256/*
257 * __kfifo_add_out internal helper function for updating the out offset
258 */ 228 */
259static inline void __kfifo_add_out(struct kfifo *fifo, 229#define kfifo_reset_out(fifo) \
260 unsigned int off) 230(void)({ \
261{ 231 typeof(fifo + 1) __tmp = (fifo); \
262 smp_mb(); 232 __tmp->kfifo.out = __tmp->kfifo.in; \
263 fifo->out += off; 233})
264}
265 234
266/* 235/**
267 * __kfifo_add_in internal helper function for updating the in offset 236 * kfifo_len - returns the number of used elements in the fifo
237 * @fifo: address of the fifo to be used
268 */ 238 */
269static inline void __kfifo_add_in(struct kfifo *fifo, 239#define kfifo_len(fifo) \
270 unsigned int off) 240({ \
271{ 241 typeof(fifo + 1) __tmpl = (fifo); \
272 smp_wmb(); 242 __tmpl->kfifo.in - __tmpl->kfifo.out; \
273 fifo->in += off; 243})
274}
275 244
276/* 245/**
277 * __kfifo_off internal helper function for calculating the index of a 246 * kfifo_is_empty - returns true if the fifo is empty
278 * given offeset 247 * @fifo: address of the fifo to be used
279 */ 248 */
280static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) 249#define kfifo_is_empty(fifo) \
281{ 250({ \
282 return off & (fifo->size - 1); 251 typeof(fifo + 1) __tmpq = (fifo); \
283} 252 __tmpq->kfifo.in == __tmpq->kfifo.out; \
253})
284 254
285/* 255/**
286 * __kfifo_peek_n internal helper function for determinate the length of 256 * kfifo_is_full - returns true if the fifo is full
287 * the next record in the fifo 257 * @fifo: address of the fifo to be used
288 */ 258 */
289static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, 259#define kfifo_is_full(fifo) \
290 unsigned int recsize) 260({ \
291{ 261 typeof(fifo + 1) __tmpq = (fifo); \
292#define __KFIFO_GET(fifo, off, shift) \ 262 kfifo_len(__tmpq) > __tmpq->kfifo.mask; \
293 ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) 263})
294 264
295 unsigned int l; 265/**
266 * kfifo_avail - returns the number of unused elements in the fifo
267 * @fifo: address of the fifo to be used
268 */
269#define kfifo_avail(fifo) \
270__kfifo_must_check_helper( \
271({ \
272 typeof(fifo + 1) __tmpq = (fifo); \
273 const size_t __recsize = sizeof(*__tmpq->rectype); \
274 unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \
275 (__recsize) ? ((__avail <= __recsize) ? 0 : \
276 __kfifo_max_r(__avail - __recsize, __recsize)) : \
277 __avail; \
278}) \
279)
296 280
297 l = __KFIFO_GET(fifo, 0, 0); 281/**
282 * kfifo_skip - skip output data
283 * @fifo: address of the fifo to be used
284 */
285#define kfifo_skip(fifo) \
286(void)({ \
287 typeof(fifo + 1) __tmp = (fifo); \
288 const size_t __recsize = sizeof(*__tmp->rectype); \
289 struct __kfifo *__kfifo = &__tmp->kfifo; \
290 if (__recsize) \
291 __kfifo_skip_r(__kfifo, __recsize); \
292 else \
293 __kfifo->out++; \
294})
298 295
299 if (--recsize) 296/**
300 l |= __KFIFO_GET(fifo, 1, 8); 297 * kfifo_peek_len - gets the size of the next fifo record
298 * @fifo: address of the fifo to be used
299 *
300 * This function returns the size of the next fifo record in number of bytes.
301 */
302#define kfifo_peek_len(fifo) \
303__kfifo_must_check_helper( \
304({ \
305 typeof(fifo + 1) __tmp = (fifo); \
306 const size_t __recsize = sizeof(*__tmp->rectype); \
307 struct __kfifo *__kfifo = &__tmp->kfifo; \
308 (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \
309 __kfifo_len_r(__kfifo, __recsize); \
310}) \
311)
301 312
302 return l; 313/**
303#undef __KFIFO_GET 314 * kfifo_alloc - dynamically allocates a new fifo buffer
304} 315 * @fifo: pointer to the fifo
316 * @size: the number of elements in the fifo, this must be a power of 2
317 * @gfp_mask: get_free_pages mask, passed to kmalloc()
318 *
319 * This macro dynamically allocates a new fifo buffer.
320 *
321 * The numer of elements will be rounded-up to a power of 2.
322 * The fifo will be release with kfifo_free().
323 * Return 0 if no error, otherwise an error code.
324 */
325#define kfifo_alloc(fifo, size, gfp_mask) \
326__kfifo_must_check_helper( \
327({ \
328 typeof(fifo + 1) __tmp = (fifo); \
329 struct __kfifo *__kfifo = &__tmp->kfifo; \
330 __is_kfifo_ptr(__tmp) ? \
331 __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \
332 -EINVAL; \
333}) \
334)
305 335
306/* 336/**
307 * __kfifo_poke_n internal helper function for storing the length of 337 * kfifo_free - frees the fifo
308 * the next record into the fifo 338 * @fifo: the fifo to be freed
309 */ 339 */
310static inline void __kfifo_poke_n(struct kfifo *fifo, 340#define kfifo_free(fifo) \
311 unsigned int recsize, unsigned int n) 341({ \
312{ 342 typeof(fifo + 1) __tmp = (fifo); \
313#define __KFIFO_PUT(fifo, off, val, shift) \ 343 struct __kfifo *__kfifo = &__tmp->kfifo; \
314 ( \ 344 if (__is_kfifo_ptr(__tmp)) \
315 (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ 345 __kfifo_free(__kfifo); \
316 (unsigned char)((val) >> (shift)) \ 346})
317 )
318 347
319 __KFIFO_PUT(fifo, 0, n, 0); 348/**
349 * kfifo_init - initialize a fifo using a preallocated buffer
350 * @fifo: the fifo to assign the buffer
351 * @buffer: the preallocated buffer to be used
352 * @size: the size of the internal buffer, this have to be a power of 2
353 *
354 * This macro initialize a fifo using a preallocated buffer.
355 *
356 * The numer of elements will be rounded-up to a power of 2.
357 * Return 0 if no error, otherwise an error code.
358 */
359#define kfifo_init(fifo, buffer, size) \
360({ \
361 typeof(fifo + 1) __tmp = (fifo); \
362 struct __kfifo *__kfifo = &__tmp->kfifo; \
363 __is_kfifo_ptr(__tmp) ? \
364 __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \
365 -EINVAL; \
366})
320 367
321 if (--recsize) 368/**
322 __KFIFO_PUT(fifo, 1, n, 8); 369 * kfifo_put - put data into the fifo
323#undef __KFIFO_PUT 370 * @fifo: address of the fifo to be used
324} 371 * @val: the data to be added
372 *
373 * This macro copies the given value into the fifo.
374 * It returns 0 if the fifo was full. Otherwise it returns the number
375 * processed elements.
376 *
377 * Note that with only one concurrent reader and one concurrent
378 * writer, you don't need extra locking to use these macro.
379 */
380#define kfifo_put(fifo, val) \
381({ \
382 typeof(fifo + 1) __tmp = (fifo); \
383 typeof(val + 1) __val = (val); \
384 unsigned int __ret; \
385 const size_t __recsize = sizeof(*__tmp->rectype); \
386 struct __kfifo *__kfifo = &__tmp->kfifo; \
387 if (0) { \
388 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
389 __dummy = (typeof(__val))NULL; \
390 } \
391 if (__recsize) \
392 __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \
393 __recsize); \
394 else { \
395 __ret = !kfifo_is_full(__tmp); \
396 if (__ret) { \
397 (__is_kfifo_ptr(__tmp) ? \
398 ((typeof(__tmp->type))__kfifo->data) : \
399 (__tmp->buf) \
400 )[__kfifo->in & __tmp->kfifo.mask] = \
401 *(typeof(__tmp->type))__val; \
402 smp_wmb(); \
403 __kfifo->in++; \
404 } \
405 } \
406 __ret; \
407})
325 408
326/* 409/**
327 * __kfifo_in_... internal functions for put date into the fifo 410 * kfifo_get - get data from the fifo
328 * do not call it directly, use kfifo_in_rec() instead 411 * @fifo: address of the fifo to be used
329 */ 412 * @val: the var where to store the data to be added
330extern unsigned int __kfifo_in_n(struct kfifo *fifo, 413 *
331 const void *from, unsigned int n, unsigned int recsize); 414 * This macro reads the data from the fifo.
415 * It returns 0 if the fifo was empty. Otherwise it returns the number
416 * processed elements.
417 *
418 * Note that with only one concurrent reader and one concurrent
419 * writer, you don't need extra locking to use these macro.
420 */
421#define kfifo_get(fifo, val) \
422__kfifo_must_check_helper( \
423({ \
424 typeof(fifo + 1) __tmp = (fifo); \
425 typeof(val + 1) __val = (val); \
426 unsigned int __ret; \
427 const size_t __recsize = sizeof(*__tmp->rectype); \
428 struct __kfifo *__kfifo = &__tmp->kfifo; \
429 if (0) \
430 __val = (typeof(__tmp->ptr))0; \
431 if (__recsize) \
432 __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \
433 __recsize); \
434 else { \
435 __ret = !kfifo_is_empty(__tmp); \
436 if (__ret) { \
437 *(typeof(__tmp->type))__val = \
438 (__is_kfifo_ptr(__tmp) ? \
439 ((typeof(__tmp->type))__kfifo->data) : \
440 (__tmp->buf) \
441 )[__kfifo->out & __tmp->kfifo.mask]; \
442 smp_wmb(); \
443 __kfifo->out++; \
444 } \
445 } \
446 __ret; \
447}) \
448)
332 449
333extern unsigned int __kfifo_in_generic(struct kfifo *fifo, 450/**
334 const void *from, unsigned int n, unsigned int recsize); 451 * kfifo_peek - get data from the fifo without removing
452 * @fifo: address of the fifo to be used
453 * @val: the var where to store the data to be added
454 *
455 * This reads the data from the fifo without removing it from the fifo.
456 * It returns 0 if the fifo was empty. Otherwise it returns the number
457 * processed elements.
458 *
459 * Note that with only one concurrent reader and one concurrent
460 * writer, you don't need extra locking to use these macro.
461 */
462#define kfifo_peek(fifo, val) \
463__kfifo_must_check_helper( \
464({ \
465 typeof(fifo + 1) __tmp = (fifo); \
466 typeof(val + 1) __val = (val); \
467 unsigned int __ret; \
468 const size_t __recsize = sizeof(*__tmp->rectype); \
469 struct __kfifo *__kfifo = &__tmp->kfifo; \
470 if (0) \
471 __val = (typeof(__tmp->ptr))NULL; \
472 if (__recsize) \
473 __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \
474 __recsize); \
475 else { \
476 __ret = !kfifo_is_empty(__tmp); \
477 if (__ret) { \
478 *(typeof(__tmp->type))__val = \
479 (__is_kfifo_ptr(__tmp) ? \
480 ((typeof(__tmp->type))__kfifo->data) : \
481 (__tmp->buf) \
482 )[__kfifo->out & __tmp->kfifo.mask]; \
483 smp_wmb(); \
484 } \
485 } \
486 __ret; \
487}) \
488)
335 489
336static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, 490/**
337 const void *from, unsigned int n, unsigned int recsize) 491 * kfifo_in - put data into the fifo
338{ 492 * @fifo: address of the fifo to be used
339 unsigned int ret; 493 * @buf: the data to be added
494 * @n: number of elements to be added
495 *
496 * This macro copies the given buffer into the fifo and returns the
497 * number of copied elements.
498 *
499 * Note that with only one concurrent reader and one concurrent
500 * writer, you don't need extra locking to use these macro.
501 */
502#define kfifo_in(fifo, buf, n) \
503({ \
504 typeof(fifo + 1) __tmp = (fifo); \
505 typeof(buf + 1) __buf = (buf); \
506 unsigned long __n = (n); \
507 const size_t __recsize = sizeof(*__tmp->rectype); \
508 struct __kfifo *__kfifo = &__tmp->kfifo; \
509 if (0) { \
510 typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \
511 __dummy = (typeof(__buf))NULL; \
512 } \
513 (__recsize) ?\
514 __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \
515 __kfifo_in(__kfifo, __buf, __n); \
516})
340 517
341 ret = __kfifo_in_n(fifo, from, n, recsize); 518/**
519 * kfifo_in_spinlocked - put data into the fifo using a spinlock for locking
520 * @fifo: address of the fifo to be used
521 * @buf: the data to be added
522 * @n: number of elements to be added
523 * @lock: pointer to the spinlock to use for locking
524 *
525 * This macro copies the given values buffer into the fifo and returns the
526 * number of copied elements.
527 */
528#define kfifo_in_spinlocked(fifo, buf, n, lock) \
529({ \
530 unsigned long __flags; \
531 unsigned int __ret; \
532 spin_lock_irqsave(lock, __flags); \
533 __ret = kfifo_in(fifo, buf, n); \
534 spin_unlock_irqrestore(lock, __flags); \
535 __ret; \
536})
537
538/* alias for kfifo_in_spinlocked, will be removed in a future release */
539#define kfifo_in_locked(fifo, buf, n, lock) \
540 kfifo_in_spinlocked(fifo, buf, n, lock)
342 541
343 if (likely(ret == 0)) { 542/**
344 if (recsize) 543 * kfifo_out - get data from the fifo
345 __kfifo_poke_n(fifo, recsize, n); 544 * @fifo: address of the fifo to be used
346 __kfifo_add_in(fifo, n + recsize); 545 * @buf: pointer to the storage buffer
347 } 546 * @n: max. number of elements to get
348 return ret; 547 *
349} 548 * This macro get some data from the fifo and return the numbers of elements
549 * copied.
550 *
551 * Note that with only one concurrent reader and one concurrent
552 * writer, you don't need extra locking to use these macro.
553 */
554#define kfifo_out(fifo, buf, n) \
555__kfifo_must_check_helper( \
556({ \
557 typeof(fifo + 1) __tmp = (fifo); \
558 typeof(buf + 1) __buf = (buf); \
559 unsigned long __n = (n); \
560 const size_t __recsize = sizeof(*__tmp->rectype); \
561 struct __kfifo *__kfifo = &__tmp->kfifo; \
562 if (0) { \
563 typeof(__tmp->ptr) __dummy = NULL; \
564 __buf = __dummy; \
565 } \
566 (__recsize) ?\
567 __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \
568 __kfifo_out(__kfifo, __buf, __n); \
569}) \
570)
571
572/**
573 * kfifo_out_spinlocked - get data from the fifo using a spinlock for locking
574 * @fifo: address of the fifo to be used
575 * @buf: pointer to the storage buffer
576 * @n: max. number of elements to get
577 * @lock: pointer to the spinlock to use for locking
578 *
579 * This macro get the data from the fifo and return the numbers of elements
580 * copied.
581 */
582#define kfifo_out_spinlocked(fifo, buf, n, lock) \
583__kfifo_must_check_helper( \
584({ \
585 unsigned long __flags; \
586 unsigned int __ret; \
587 spin_lock_irqsave(lock, __flags); \
588 __ret = kfifo_out(fifo, buf, n); \
589 spin_unlock_irqrestore(lock, __flags); \
590 __ret; \
591}) \
592)
593
594/* alias for kfifo_out_spinlocked, will be removed in a future release */
595#define kfifo_out_locked(fifo, buf, n, lock) \
596 kfifo_out_spinlocked(fifo, buf, n, lock)
350 597
351/** 598/**
352 * kfifo_in_rec - puts some record data into the FIFO 599 * kfifo_from_user - puts some data from user space into the fifo
353 * @fifo: the fifo to be used. 600 * @fifo: address of the fifo to be used
354 * @from: the data to be added. 601 * @from: pointer to the data to be added
355 * @n: the length of the data to be added. 602 * @len: the length of the data to be added
356 * @recsize: size of record field 603 * @copied: pointer to output variable to store the number of copied bytes
357 * 604 *
358 * This function copies @n bytes from the @from into the FIFO and returns 605 * This macro copies at most @len bytes from the @from into the
359 * the number of bytes which cannot be copied. 606 * fifo, depending of the available space and returns -EFAULT/0.
360 * A returned value greater than the @n value means that the record doesn't
361 * fit into the buffer.
362 * 607 *
363 * Note that with only one concurrent reader and one concurrent 608 * Note that with only one concurrent reader and one concurrent
364 * writer, you don't need extra locking to use these functions. 609 * writer, you don't need extra locking to use these macro.
365 */ 610 */
366static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, 611#define kfifo_from_user(fifo, from, len, copied) \
367 void *from, unsigned int n, unsigned int recsize) 612__kfifo_must_check_helper( \
368{ 613({ \
369 if (!__builtin_constant_p(recsize)) 614 typeof(fifo + 1) __tmp = (fifo); \
370 return __kfifo_in_generic(fifo, from, n, recsize); 615 const void __user *__from = (from); \
371 return __kfifo_in_rec(fifo, from, n, recsize); 616 unsigned int __len = (len); \
372} 617 unsigned int *__copied = (copied); \
618 const size_t __recsize = sizeof(*__tmp->rectype); \
619 struct __kfifo *__kfifo = &__tmp->kfifo; \
620 (__recsize) ? \
621 __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \
622 __kfifo_from_user(__kfifo, __from, __len, __copied); \
623}) \
624)
373 625
374/* 626/**
375 * __kfifo_out_... internal functions for get date from the fifo 627 * kfifo_to_user - copies data from the fifo into user space
376 * do not call it directly, use kfifo_out_rec() instead 628 * @fifo: address of the fifo to be used
377 */ 629 * @to: where the data must be copied
378extern unsigned int __kfifo_out_n(struct kfifo *fifo, 630 * @len: the size of the destination buffer
379 void *to, unsigned int reclen, unsigned int recsize); 631 * @copied: pointer to output variable to store the number of copied bytes
632 *
633 * This macro copies at most @len bytes from the fifo into the
634 * @to buffer and returns -EFAULT/0.
635 *
636 * Note that with only one concurrent reader and one concurrent
637 * writer, you don't need extra locking to use these macro.
638 */
639#define kfifo_to_user(fifo, to, len, copied) \
640__kfifo_must_check_helper( \
641({ \
642 typeof(fifo + 1) __tmp = (fifo); \
643 void __user *__to = (to); \
644 unsigned int __len = (len); \
645 unsigned int *__copied = (copied); \
646 const size_t __recsize = sizeof(*__tmp->rectype); \
647 struct __kfifo *__kfifo = &__tmp->kfifo; \
648 (__recsize) ? \
649 __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \
650 __kfifo_to_user(__kfifo, __to, __len, __copied); \
651}) \
652)
653
654/**
655 * kfifo_dma_in_prepare - setup a scatterlist for DMA input
656 * @fifo: address of the fifo to be used
657 * @sgl: pointer to the scatterlist array
658 * @nents: number of entries in the scatterlist array
659 * @len: number of elements to transfer
660 *
661 * This macro fills a scatterlist for DMA input.
662 * It returns the number entries in the scatterlist array.
663 *
664 * Note that with only one concurrent reader and one concurrent
665 * writer, you don't need extra locking to use these macros.
666 */
667#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \
668({ \
669 typeof(fifo + 1) __tmp = (fifo); \
670 struct scatterlist *__sgl = (sgl); \
671 int __nents = (nents); \
672 unsigned int __len = (len); \
673 const size_t __recsize = sizeof(*__tmp->rectype); \
674 struct __kfifo *__kfifo = &__tmp->kfifo; \
675 (__recsize) ? \
676 __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
677 __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \
678})
380 679
381extern unsigned int __kfifo_out_generic(struct kfifo *fifo, 680/**
382 void *to, unsigned int n, 681 * kfifo_dma_in_finish - finish a DMA IN operation
383 unsigned int recsize, unsigned int *total); 682 * @fifo: address of the fifo to be used
683 * @len: number of bytes to received
684 *
685 * This macro finish a DMA IN operation. The in counter will be updated by
686 * the len parameter. No error checking will be done.
687 *
688 * Note that with only one concurrent reader and one concurrent
689 * writer, you don't need extra locking to use these macros.
690 */
691#define kfifo_dma_in_finish(fifo, len) \
692(void)({ \
693 typeof(fifo + 1) __tmp = (fifo); \
694 unsigned int __len = (len); \
695 const size_t __recsize = sizeof(*__tmp->rectype); \
696 struct __kfifo *__kfifo = &__tmp->kfifo; \
697 if (__recsize) \
698 __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \
699 else \
700 __kfifo->in += __len / sizeof(*__tmp->type); \
701})
384 702
385static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, 703/**
386 void *to, unsigned int n, unsigned int recsize, 704 * kfifo_dma_out_prepare - setup a scatterlist for DMA output
387 unsigned int *total) 705 * @fifo: address of the fifo to be used
388{ 706 * @sgl: pointer to the scatterlist array
389 unsigned int l; 707 * @nents: number of entries in the scatterlist array
390 708 * @len: number of elements to transfer
391 if (!recsize) { 709 *
392 l = n; 710 * This macro fills a scatterlist for DMA output which at most @len bytes
393 if (total) 711 * to transfer.
394 *total = l; 712 * It returns the number entries in the scatterlist array.
395 } else { 713 * A zero means there is no space available and the scatterlist is not filled.
396 l = __kfifo_peek_n(fifo, recsize); 714 *
397 if (total) 715 * Note that with only one concurrent reader and one concurrent
398 *total = l; 716 * writer, you don't need extra locking to use these macros.
399 if (n < l) 717 */
400 return l; 718#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \
401 } 719({ \
720 typeof(fifo + 1) __tmp = (fifo); \
721 struct scatterlist *__sgl = (sgl); \
722 int __nents = (nents); \
723 unsigned int __len = (len); \
724 const size_t __recsize = sizeof(*__tmp->rectype); \
725 struct __kfifo *__kfifo = &__tmp->kfifo; \
726 (__recsize) ? \
727 __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \
728 __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \
729})
402 730
403 return __kfifo_out_n(fifo, to, l, recsize); 731/**
404} 732 * kfifo_dma_out_finish - finish a DMA OUT operation
733 * @fifo: address of the fifo to be used
734 * @len: number of bytes transferd
735 *
736 * This macro finish a DMA OUT operation. The out counter will be updated by
737 * the len parameter. No error checking will be done.
738 *
739 * Note that with only one concurrent reader and one concurrent
740 * writer, you don't need extra locking to use these macros.
741 */
742#define kfifo_dma_out_finish(fifo, len) \
743(void)({ \
744 typeof(fifo + 1) __tmp = (fifo); \
745 unsigned int __len = (len); \
746 const size_t __recsize = sizeof(*__tmp->rectype); \
747 struct __kfifo *__kfifo = &__tmp->kfifo; \
748 if (__recsize) \
749 __kfifo_dma_out_finish_r(__kfifo, __recsize); \
750 else \
751 __kfifo->out += __len / sizeof(*__tmp->type); \
752})
405 753
406/** 754/**
407 * kfifo_out_rec - gets some record data from the FIFO 755 * kfifo_out_peek - gets some data from the fifo
408 * @fifo: the fifo to be used. 756 * @fifo: address of the fifo to be used
409 * @to: where the data must be copied. 757 * @buf: pointer to the storage buffer
410 * @n: the size of the destination buffer. 758 * @n: max. number of elements to get
411 * @recsize: size of record field
412 * @total: pointer where the total number of to copied bytes should stored
413 * 759 *
414 * This function copies at most @n bytes from the FIFO to @to and returns the 760 * This macro get the data from the fifo and return the numbers of elements
415 * number of bytes which cannot be copied. 761 * copied. The data is not removed from the fifo.
416 * A returned value greater than the @n value means that the record doesn't
417 * fit into the @to buffer.
418 * 762 *
419 * Note that with only one concurrent reader and one concurrent 763 * Note that with only one concurrent reader and one concurrent
420 * writer, you don't need extra locking to use these functions. 764 * writer, you don't need extra locking to use these macro.
421 */ 765 */
422static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, 766#define kfifo_out_peek(fifo, buf, n) \
423 void *to, unsigned int n, unsigned int recsize, 767__kfifo_must_check_helper( \
424 unsigned int *total) 768({ \
769 typeof(fifo + 1) __tmp = (fifo); \
770 typeof(buf + 1) __buf = (buf); \
771 unsigned long __n = (n); \
772 const size_t __recsize = sizeof(*__tmp->rectype); \
773 struct __kfifo *__kfifo = &__tmp->kfifo; \
774 if (0) { \
775 typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \
776 __buf = __dummy; \
777 } \
778 (__recsize) ? \
779 __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \
780 __kfifo_out_peek(__kfifo, __buf, __n); \
781}) \
782)
425 783
426{ 784extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size,
427 if (!__builtin_constant_p(recsize)) 785 size_t esize, gfp_t gfp_mask);
428 return __kfifo_out_generic(fifo, to, n, recsize, total);
429 return __kfifo_out_rec(fifo, to, n, recsize, total);
430}
431 786
432/* 787extern void __kfifo_free(struct __kfifo *fifo);
433 * __kfifo_from_user_... internal functions for transfer from user space into
434 * the fifo. do not call it directly, use kfifo_from_user_rec() instead
435 */
436extern unsigned int __kfifo_from_user_n(struct kfifo *fifo,
437 const void __user *from, unsigned int n, unsigned int recsize);
438 788
439extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, 789extern int __kfifo_init(struct __kfifo *fifo, void *buffer,
440 const void __user *from, unsigned int n, unsigned int recsize); 790 unsigned int size, size_t esize);
441 791
442static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, 792extern unsigned int __kfifo_in(struct __kfifo *fifo,
443 const void __user *from, unsigned int n, unsigned int recsize) 793 const void *buf, unsigned int len);
444{
445 unsigned int ret;
446 794
447 ret = __kfifo_from_user_n(fifo, from, n, recsize); 795extern unsigned int __kfifo_out(struct __kfifo *fifo,
796 void *buf, unsigned int len);
448 797
449 if (likely(ret == 0)) { 798extern int __kfifo_from_user(struct __kfifo *fifo,
450 if (recsize) 799 const void __user *from, unsigned long len, unsigned int *copied);
451 __kfifo_poke_n(fifo, recsize, n);
452 __kfifo_add_in(fifo, n + recsize);
453 }
454 return ret;
455}
456 800
457/** 801extern int __kfifo_to_user(struct __kfifo *fifo,
458 * kfifo_from_user_rec - puts some data from user space into the FIFO 802 void __user *to, unsigned long len, unsigned int *copied);
459 * @fifo: the fifo to be used.
460 * @from: pointer to the data to be added.
461 * @n: the length of the data to be added.
462 * @recsize: size of record field
463 *
464 * This function copies @n bytes from the @from into the
465 * FIFO and returns the number of bytes which cannot be copied.
466 *
467 * If the returned value is equal or less the @n value, the copy_from_user()
468 * functions has failed. Otherwise the record doesn't fit into the buffer.
469 *
470 * Note that with only one concurrent reader and one concurrent
471 * writer, you don't need extra locking to use these functions.
472 */
473static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo,
474 const void __user *from, unsigned int n, unsigned int recsize)
475{
476 if (!__builtin_constant_p(recsize))
477 return __kfifo_from_user_generic(fifo, from, n, recsize);
478 return __kfifo_from_user_rec(fifo, from, n, recsize);
479}
480 803
481/* 804extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo,
482 * __kfifo_to_user_... internal functions for transfer fifo data into user space 805 struct scatterlist *sgl, int nents, unsigned int len);
483 * do not call it directly, use kfifo_to_user_rec() instead
484 */
485extern unsigned int __kfifo_to_user_n(struct kfifo *fifo,
486 void __user *to, unsigned int n, unsigned int reclen,
487 unsigned int recsize);
488 806
489extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, 807extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo,
490 void __user *to, unsigned int n, unsigned int recsize, 808 struct scatterlist *sgl, int nents, unsigned int len);
491 unsigned int *total);
492 809
493static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, 810extern unsigned int __kfifo_out_peek(struct __kfifo *fifo,
494 void __user *to, unsigned int n, 811 void *buf, unsigned int len);
495 unsigned int recsize, unsigned int *total)
496{
497 unsigned int l;
498
499 if (!recsize) {
500 l = n;
501 if (total)
502 *total = l;
503 } else {
504 l = __kfifo_peek_n(fifo, recsize);
505 if (total)
506 *total = l;
507 if (n < l)
508 return l;
509 }
510 812
511 return __kfifo_to_user_n(fifo, to, n, l, recsize); 813extern unsigned int __kfifo_in_r(struct __kfifo *fifo,
512} 814 const void *buf, unsigned int len, size_t recsize);
513 815
514/** 816extern unsigned int __kfifo_out_r(struct __kfifo *fifo,
515 * kfifo_to_user_rec - gets data from the FIFO and write it to user space 817 void *buf, unsigned int len, size_t recsize);
516 * @fifo: the fifo to be used.
517 * @to: where the data must be copied.
518 * @n: the size of the destination buffer.
519 * @recsize: size of record field
520 * @total: pointer where the total number of to copied bytes should stored
521 *
522 * This function copies at most @n bytes from the FIFO to the @to.
523 * In case of an error, the function returns the number of bytes which cannot
524 * be copied.
525 * If the returned value is equal or less the @n value, the copy_to_user()
526 * functions has failed. Otherwise the record doesn't fit into the @to buffer.
527 *
528 * Note that with only one concurrent reader and one concurrent
529 * writer, you don't need extra locking to use these functions.
530 */
531static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo,
532 void __user *to, unsigned int n, unsigned int recsize,
533 unsigned int *total)
534{
535 if (!__builtin_constant_p(recsize))
536 return __kfifo_to_user_generic(fifo, to, n, recsize, total);
537 return __kfifo_to_user_rec(fifo, to, n, recsize, total);
538}
539 818
540/* 819extern int __kfifo_from_user_r(struct __kfifo *fifo,
541 * __kfifo_peek_... internal functions for peek into the next fifo record 820 const void __user *from, unsigned long len, unsigned int *copied,
542 * do not call it directly, use kfifo_peek_rec() instead 821 size_t recsize);
543 */
544extern unsigned int __kfifo_peek_generic(struct kfifo *fifo,
545 unsigned int recsize);
546 822
547/** 823extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to,
548 * kfifo_peek_rec - gets the size of the next FIFO record data 824 unsigned long len, unsigned int *copied, size_t recsize);
549 * @fifo: the fifo to be used.
550 * @recsize: size of record field
551 *
552 * This function returns the size of the next FIFO record in number of bytes
553 */
554static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo,
555 unsigned int recsize)
556{
557 if (!__builtin_constant_p(recsize))
558 return __kfifo_peek_generic(fifo, recsize);
559 if (!recsize)
560 return kfifo_len(fifo);
561 return __kfifo_peek_n(fifo, recsize);
562}
563 825
564/* 826extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
565 * __kfifo_skip_... internal functions for skip the next fifo record 827 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
566 * do not call it directly, use kfifo_skip_rec() instead
567 */
568extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize);
569 828
570static inline void __kfifo_skip_rec(struct kfifo *fifo, 829extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo,
571 unsigned int recsize) 830 unsigned int len, size_t recsize);
572{
573 unsigned int l;
574 831
575 if (recsize) { 832extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
576 l = __kfifo_peek_n(fifo, recsize); 833 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize);
577 834
578 if (l + recsize <= kfifo_len(fifo)) { 835extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize);
579 __kfifo_add_out(fifo, l + recsize);
580 return;
581 }
582 }
583 kfifo_reset_out(fifo);
584}
585 836
586/** 837extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize);
587 * kfifo_skip_rec - skip the next fifo out record
588 * @fifo: the fifo to be used.
589 * @recsize: size of record field
590 *
591 * This function skips the next FIFO record
592 */
593static inline void kfifo_skip_rec(struct kfifo *fifo,
594 unsigned int recsize)
595{
596 if (!__builtin_constant_p(recsize))
597 __kfifo_skip_generic(fifo, recsize);
598 else
599 __kfifo_skip_rec(fifo, recsize);
600}
601 838
602/** 839extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo,
603 * kfifo_avail_rec - returns the number of bytes available in a record FIFO 840 void *buf, unsigned int len, size_t recsize);
604 * @fifo: the fifo to be used.
605 * @recsize: size of record field
606 */
607static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo,
608 unsigned int recsize)
609{
610 unsigned int l = kfifo_size(fifo) - kfifo_len(fifo);
611 841
612 return (l > recsize) ? l - recsize : 0; 842extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize);
613}
614 843
615#endif 844#endif
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 19ec41a183f5..cc96f0f23e04 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -16,10 +16,12 @@
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/linkage.h> 17#include <linux/linkage.h>
18#include <linux/init.h> 18#include <linux/init.h>
19
20#include <asm/atomic.h> 19#include <asm/atomic.h>
20#ifdef CONFIG_HAVE_ARCH_KGDB
21#include <asm/kgdb.h> 21#include <asm/kgdb.h>
22#endif
22 23
24#ifdef CONFIG_KGDB
23struct pt_regs; 25struct pt_regs;
24 26
25/** 27/**
@@ -34,20 +36,6 @@ struct pt_regs;
34extern int kgdb_skipexception(int exception, struct pt_regs *regs); 36extern int kgdb_skipexception(int exception, struct pt_regs *regs);
35 37
36/** 38/**
37 * kgdb_post_primary_code - (optional) Save error vector/code numbers.
38 * @regs: Original pt_regs.
39 * @e_vector: Original error vector.
40 * @err_code: Original error code.
41 *
42 * This is usually needed on architectures which support SMP and
43 * KGDB. This function is called after all the secondary cpus have
44 * been put to a know spin state and the primary CPU has control over
45 * KGDB.
46 */
47extern void kgdb_post_primary_code(struct pt_regs *regs, int e_vector,
48 int err_code);
49
50/**
51 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook 39 * kgdb_disable_hw_debug - (optional) Disable hardware debugging hook
52 * @regs: Current &struct pt_regs. 40 * @regs: Current &struct pt_regs.
53 * 41 *
@@ -72,6 +60,7 @@ struct uart_port;
72void kgdb_breakpoint(void); 60void kgdb_breakpoint(void);
73 61
74extern int kgdb_connected; 62extern int kgdb_connected;
63extern int kgdb_io_module_registered;
75 64
76extern atomic_t kgdb_setting_breakpoint; 65extern atomic_t kgdb_setting_breakpoint;
77extern atomic_t kgdb_cpu_doing_single_step; 66extern atomic_t kgdb_cpu_doing_single_step;
@@ -101,6 +90,19 @@ struct kgdb_bkpt {
101 enum kgdb_bpstate state; 90 enum kgdb_bpstate state;
102}; 91};
103 92
93struct dbg_reg_def_t {
94 char *name;
95 int size;
96 int offset;
97};
98
99#ifndef DBG_MAX_REG_NUM
100#define DBG_MAX_REG_NUM 0
101#else
102extern struct dbg_reg_def_t dbg_reg_def[];
103extern char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs);
104extern int dbg_set_reg(int regno, void *mem, struct pt_regs *regs);
105#endif
104#ifndef KGDB_MAX_BREAKPOINTS 106#ifndef KGDB_MAX_BREAKPOINTS
105# define KGDB_MAX_BREAKPOINTS 1000 107# define KGDB_MAX_BREAKPOINTS 1000
106#endif 108#endif
@@ -202,12 +204,34 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code,
202 */ 204 */
203extern void kgdb_roundup_cpus(unsigned long flags); 205extern void kgdb_roundup_cpus(unsigned long flags);
204 206
207/**
208 * kgdb_arch_set_pc - Generic call back to the program counter
209 * @regs: Current &struct pt_regs.
210 * @pc: The new value for the program counter
211 *
212 * This function handles updating the program counter and requires an
213 * architecture specific implementation.
214 */
215extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
216
217
205/* Optional functions. */ 218/* Optional functions. */
206extern int kgdb_validate_break_address(unsigned long addr); 219extern int kgdb_validate_break_address(unsigned long addr);
207extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr); 220extern int kgdb_arch_set_breakpoint(unsigned long addr, char *saved_instr);
208extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle); 221extern int kgdb_arch_remove_breakpoint(unsigned long addr, char *bundle);
209 222
210/** 223/**
224 * kgdb_arch_late - Perform any architecture specific initalization.
225 *
226 * This function will handle the late initalization of any
227 * architecture specific callbacks. This is an optional function for
228 * handling things like late initialization of hw breakpoints. The
229 * default implementation does nothing.
230 */
231extern void kgdb_arch_late(void);
232
233
234/**
211 * struct kgdb_arch - Describe architecture specific values. 235 * struct kgdb_arch - Describe architecture specific values.
212 * @gdb_bpt_instr: The instruction to trigger a breakpoint. 236 * @gdb_bpt_instr: The instruction to trigger a breakpoint.
213 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT. 237 * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
@@ -247,6 +271,8 @@ struct kgdb_arch {
247 * the I/O driver. 271 * the I/O driver.
248 * @post_exception: Pointer to a function that will do any cleanup work 272 * @post_exception: Pointer to a function that will do any cleanup work
249 * for the I/O driver. 273 * for the I/O driver.
274 * @is_console: 1 if the end device is a console 0 if the I/O device is
275 * not a console
250 */ 276 */
251struct kgdb_io { 277struct kgdb_io {
252 const char *name; 278 const char *name;
@@ -256,6 +282,7 @@ struct kgdb_io {
256 int (*init) (void); 282 int (*init) (void);
257 void (*pre_exception) (void); 283 void (*pre_exception) (void);
258 void (*post_exception) (void); 284 void (*post_exception) (void);
285 int is_console;
259}; 286};
260 287
261extern struct kgdb_arch arch_kgdb_ops; 288extern struct kgdb_arch arch_kgdb_ops;
@@ -264,12 +291,14 @@ extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
264 291
265extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 292extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
266extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 293extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
294extern struct kgdb_io *dbg_io_ops;
267 295
268extern int kgdb_hex2long(char **ptr, unsigned long *long_val); 296extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
269extern int kgdb_mem2hex(char *mem, char *buf, int count); 297extern char *kgdb_mem2hex(char *mem, char *buf, int count);
270extern int kgdb_hex2mem(char *buf, char *mem, int count); 298extern int kgdb_hex2mem(char *buf, char *mem, int count);
271 299
272extern int kgdb_isremovedbreak(unsigned long addr); 300extern int kgdb_isremovedbreak(unsigned long addr);
301extern void kgdb_schedule_breakpoint(void);
273 302
274extern int 303extern int
275kgdb_handle_exception(int ex_vector, int signo, int err_code, 304kgdb_handle_exception(int ex_vector, int signo, int err_code,
@@ -278,5 +307,12 @@ extern int kgdb_nmicallback(int cpu, void *regs);
278 307
279extern int kgdb_single_step; 308extern int kgdb_single_step;
280extern atomic_t kgdb_active; 309extern atomic_t kgdb_active;
281 310#define in_dbg_master() \
311 (raw_smp_processor_id() == atomic_read(&kgdb_active))
312extern bool dbg_is_early;
313extern void __init dbg_late_init(void);
314#else /* ! CONFIG_KGDB */
315#define in_dbg_master() (0)
316#define dbg_late_init()
317#endif /* ! CONFIG_KGDB */
282#endif /* _KGDB_H_ */ 318#endif /* _KGDB_H_ */
diff --git a/include/linux/kmemtrace.h b/include/linux/kmemtrace.h
deleted file mode 100644
index b616d3930c3b..000000000000
--- a/include/linux/kmemtrace.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
3 *
4 * This file is released under GPL version 2.
5 */
6
7#ifndef _LINUX_KMEMTRACE_H
8#define _LINUX_KMEMTRACE_H
9
10#ifdef __KERNEL__
11
12#include <trace/events/kmem.h>
13
14#ifdef CONFIG_KMEMTRACE
15extern void kmemtrace_init(void);
16#else
17static inline void kmemtrace_init(void)
18{
19}
20#endif
21
22#endif /* __KERNEL__ */
23
24#endif /* _LINUX_KMEMTRACE_H */
25
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index facb27fe7de0..6efd7a78de6a 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -23,6 +23,7 @@
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/compiler.h> 25#include <linux/compiler.h>
26#include <linux/workqueue.h>
26 27
27#define KMOD_PATH_LEN 256 28#define KMOD_PATH_LEN 256
28 29
@@ -45,19 +46,6 @@ static inline int request_module_nowait(const char *name, ...) { return -ENOSYS;
45 46
46struct key; 47struct key;
47struct file; 48struct file;
48struct subprocess_info;
49
50/* Allocate a subprocess_info structure */
51struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
52 char **envp, gfp_t gfp_mask);
53
54/* Set various pieces of state into the subprocess_info structure */
55void call_usermodehelper_setkeys(struct subprocess_info *info,
56 struct key *session_keyring);
57int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info,
58 struct file **filp);
59void call_usermodehelper_setcleanup(struct subprocess_info *info,
60 void (*cleanup)(char **argv, char **envp));
61 49
62enum umh_wait { 50enum umh_wait {
63 UMH_NO_WAIT = -1, /* don't wait at all */ 51 UMH_NO_WAIT = -1, /* don't wait at all */
@@ -65,6 +53,29 @@ enum umh_wait {
65 UMH_WAIT_PROC = 1, /* wait for the process to complete */ 53 UMH_WAIT_PROC = 1, /* wait for the process to complete */
66}; 54};
67 55
56struct subprocess_info {
57 struct work_struct work;
58 struct completion *complete;
59 char *path;
60 char **argv;
61 char **envp;
62 enum umh_wait wait;
63 int retval;
64 int (*init)(struct subprocess_info *info);
65 void (*cleanup)(struct subprocess_info *info);
66 void *data;
67};
68
69/* Allocate a subprocess_info structure */
70struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
71 char **envp, gfp_t gfp_mask);
72
73/* Set various pieces of state into the subprocess_info structure */
74void call_usermodehelper_setfns(struct subprocess_info *info,
75 int (*init)(struct subprocess_info *info),
76 void (*cleanup)(struct subprocess_info *info),
77 void *data);
78
68/* Actually execute the sub-process */ 79/* Actually execute the sub-process */
69int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait); 80int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
70 81
@@ -73,38 +84,33 @@ int call_usermodehelper_exec(struct subprocess_info *info, enum umh_wait wait);
73void call_usermodehelper_freeinfo(struct subprocess_info *info); 84void call_usermodehelper_freeinfo(struct subprocess_info *info);
74 85
75static inline int 86static inline int
76call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait) 87call_usermodehelper_fns(char *path, char **argv, char **envp,
88 enum umh_wait wait,
89 int (*init)(struct subprocess_info *info),
90 void (*cleanup)(struct subprocess_info *), void *data)
77{ 91{
78 struct subprocess_info *info; 92 struct subprocess_info *info;
79 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; 93 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL;
80 94
81 info = call_usermodehelper_setup(path, argv, envp, gfp_mask); 95 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
96
82 if (info == NULL) 97 if (info == NULL)
83 return -ENOMEM; 98 return -ENOMEM;
99
100 call_usermodehelper_setfns(info, init, cleanup, data);
101
84 return call_usermodehelper_exec(info, wait); 102 return call_usermodehelper_exec(info, wait);
85} 103}
86 104
87static inline int 105static inline int
88call_usermodehelper_keys(char *path, char **argv, char **envp, 106call_usermodehelper(char *path, char **argv, char **envp, enum umh_wait wait)
89 struct key *session_keyring, enum umh_wait wait)
90{ 107{
91 struct subprocess_info *info; 108 return call_usermodehelper_fns(path, argv, envp, wait,
92 gfp_t gfp_mask = (wait == UMH_NO_WAIT) ? GFP_ATOMIC : GFP_KERNEL; 109 NULL, NULL, NULL);
93
94 info = call_usermodehelper_setup(path, argv, envp, gfp_mask);
95 if (info == NULL)
96 return -ENOMEM;
97
98 call_usermodehelper_setkeys(info, session_keyring);
99 return call_usermodehelper_exec(info, wait);
100} 110}
101 111
102extern void usermodehelper_init(void); 112extern void usermodehelper_init(void);
103 113
104struct file;
105extern int call_usermodehelper_pipe(char *path, char *argv[], char *envp[],
106 struct file **filp);
107
108extern int usermodehelper_disable(void); 114extern int usermodehelper_disable(void);
109extern void usermodehelper_enable(void); 115extern void usermodehelper_enable(void);
110 116
diff --git a/include/linux/kobj_map.h b/include/linux/kobj_map.h
index 73717ed9ea79..18ca75ffcc5a 100644
--- a/include/linux/kobj_map.h
+++ b/include/linux/kobj_map.h
@@ -1,3 +1,10 @@
1/*
2 * kobj_map.h
3 */
4
5#ifndef _KOBJ_MAP_H_
6#define _KOBJ_MAP_H_
7
1#include <linux/mutex.h> 8#include <linux/mutex.h>
2 9
3typedef struct kobject *kobj_probe_t(dev_t, int *, void *); 10typedef struct kobject *kobj_probe_t(dev_t, int *, void *);
@@ -8,3 +15,5 @@ int kobj_map(struct kobj_map *, dev_t, unsigned long, struct module *,
8void kobj_unmap(struct kobj_map *, dev_t, unsigned long); 15void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
9struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *); 16struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
10struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *); 17struct kobj_map *kobj_map_init(kobj_probe_t *, struct mutex *);
18
19#endif /* _KOBJ_MAP_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 3950d3c2850d..cf343a852534 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -108,6 +108,8 @@ struct kobj_type {
108 void (*release)(struct kobject *kobj); 108 void (*release)(struct kobject *kobj);
109 const struct sysfs_ops *sysfs_ops; 109 const struct sysfs_ops *sysfs_ops;
110 struct attribute **default_attrs; 110 struct attribute **default_attrs;
111 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
112 const void *(*namespace)(struct kobject *kobj);
111}; 113};
112 114
113struct kobj_uevent_env { 115struct kobj_uevent_env {
@@ -134,6 +136,42 @@ struct kobj_attribute {
134 136
135extern const struct sysfs_ops kobj_sysfs_ops; 137extern const struct sysfs_ops kobj_sysfs_ops;
136 138
139/*
140 * Namespace types which are used to tag kobjects and sysfs entries.
141 * Network namespace will likely be the first.
142 */
143enum kobj_ns_type {
144 KOBJ_NS_TYPE_NONE = 0,
145 KOBJ_NS_TYPE_NET,
146 KOBJ_NS_TYPES
147};
148
149struct sock;
150
151/*
152 * Callbacks so sysfs can determine namespaces
153 * @current_ns: return calling task's namespace
154 * @netlink_ns: return namespace to which a sock belongs (right?)
155 * @initial_ns: return the initial namespace (i.e. init_net_ns)
156 */
157struct kobj_ns_type_operations {
158 enum kobj_ns_type type;
159 const void *(*current_ns)(void);
160 const void *(*netlink_ns)(struct sock *sk);
161 const void *(*initial_ns)(void);
162};
163
164int kobj_ns_type_register(const struct kobj_ns_type_operations *ops);
165int kobj_ns_type_registered(enum kobj_ns_type type);
166const struct kobj_ns_type_operations *kobj_child_ns_ops(struct kobject *parent);
167const struct kobj_ns_type_operations *kobj_ns_ops(struct kobject *kobj);
168
169const void *kobj_ns_current(enum kobj_ns_type type);
170const void *kobj_ns_netlink(enum kobj_ns_type type, struct sock *sk);
171const void *kobj_ns_initial(enum kobj_ns_type type);
172void kobj_ns_exit(enum kobj_ns_type type, const void *ns);
173
174
137/** 175/**
138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 176 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
139 * 177 *
diff --git a/include/linux/kref.h b/include/linux/kref.h
index b0cb0ebad9e6..6cc38fc07ab7 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * kref.c - library routines for handling generic reference counted objects 2 * kref.h - library routines for handling generic reference counted objects
3 * 3 *
4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com> 4 * Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
5 * Copyright (C) 2004 IBM Corp. 5 * Copyright (C) 2004 IBM Corp.
@@ -21,7 +21,6 @@ struct kref {
21 atomic_t refcount; 21 atomic_t refcount;
22}; 22};
23 23
24void kref_set(struct kref *kref, int num);
25void kref_init(struct kref *kref); 24void kref_init(struct kref *kref);
26void kref_get(struct kref *kref); 25void kref_get(struct kref *kref);
27int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 26int kref_put(struct kref *kref, void (*release) (struct kref *kref));
diff --git a/include/linux/ks8842.h b/include/linux/ks8842.h
new file mode 100644
index 000000000000..14ba4452296e
--- /dev/null
+++ b/include/linux/ks8842.h
@@ -0,0 +1,38 @@
1/*
2 * ks8842.h KS8842 platform data struct definition
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef _LINUX_KS8842_H
20#define _LINUX_KS8842_H
21
22#include <linux/if_ether.h>
23
24/**
25 * struct ks8842_platform_data - Platform data of the KS8842 network driver
26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in
27 * the chip.
28 * @rx_dma_channel: The DMA channel to use for RX, -1 for none.
29 * @tx_dma_channel: The DMA channel to use for TX, -1 for none.
30 *
31 */
32struct ks8842_platform_data {
33 u8 macaddr[ETH_ALEN];
34 int rx_dma_channel;
35 int tx_dma_channel;
36};
37
38#endif
diff --git a/include/linux/ksm.h b/include/linux/ksm.h
index 43bdab769fc3..74d691ee9121 100644
--- a/include/linux/ksm.h
+++ b/include/linux/ksm.h
@@ -78,7 +78,7 @@ static inline struct page *ksm_might_need_to_copy(struct page *page,
78 struct anon_vma *anon_vma = page_anon_vma(page); 78 struct anon_vma *anon_vma = page_anon_vma(page);
79 79
80 if (!anon_vma || 80 if (!anon_vma ||
81 (anon_vma == vma->anon_vma && 81 (anon_vma->root == vma->anon_vma->root &&
82 page->index == linear_page_index(vma, address))) 82 page->index == linear_page_index(vma, address)))
83 return page; 83 return page;
84 84
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index aabc8a13ba71..685ea65eb803 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -30,8 +30,73 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
30void kthread_bind(struct task_struct *k, unsigned int cpu); 30void kthread_bind(struct task_struct *k, unsigned int cpu);
31int kthread_stop(struct task_struct *k); 31int kthread_stop(struct task_struct *k);
32int kthread_should_stop(void); 32int kthread_should_stop(void);
33void *kthread_data(struct task_struct *k);
33 34
34int kthreadd(void *unused); 35int kthreadd(void *unused);
35extern struct task_struct *kthreadd_task; 36extern struct task_struct *kthreadd_task;
36 37
38/*
39 * Simple work processor based on kthread.
40 *
41 * This provides easier way to make use of kthreads. A kthread_work
42 * can be queued and flushed using queue/flush_kthread_work()
43 * respectively. Queued kthread_works are processed by a kthread
44 * running kthread_worker_fn().
45 *
46 * A kthread_work can't be freed while it is executing.
47 */
48struct kthread_work;
49typedef void (*kthread_work_func_t)(struct kthread_work *work);
50
51struct kthread_worker {
52 spinlock_t lock;
53 struct list_head work_list;
54 struct task_struct *task;
55};
56
57struct kthread_work {
58 struct list_head node;
59 kthread_work_func_t func;
60 wait_queue_head_t done;
61 atomic_t flushing;
62 int queue_seq;
63 int done_seq;
64};
65
66#define KTHREAD_WORKER_INIT(worker) { \
67 .lock = SPIN_LOCK_UNLOCKED, \
68 .work_list = LIST_HEAD_INIT((worker).work_list), \
69 }
70
71#define KTHREAD_WORK_INIT(work, fn) { \
72 .node = LIST_HEAD_INIT((work).node), \
73 .func = (fn), \
74 .done = __WAIT_QUEUE_HEAD_INITIALIZER((work).done), \
75 .flushing = ATOMIC_INIT(0), \
76 }
77
78#define DEFINE_KTHREAD_WORKER(worker) \
79 struct kthread_worker worker = KTHREAD_WORKER_INIT(worker)
80
81#define DEFINE_KTHREAD_WORK(work, fn) \
82 struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
83
84static inline void init_kthread_worker(struct kthread_worker *worker)
85{
86 *worker = (struct kthread_worker)KTHREAD_WORKER_INIT(*worker);
87}
88
89static inline void init_kthread_work(struct kthread_work *work,
90 kthread_work_func_t fn)
91{
92 *work = (struct kthread_work)KTHREAD_WORK_INIT(*work, fn);
93}
94
95int kthread_worker_fn(void *worker_ptr);
96
97bool queue_kthread_work(struct kthread_worker *worker,
98 struct kthread_work *work);
99void flush_kthread_work(struct kthread_work *work);
100void flush_kthread_worker(struct kthread_worker *worker);
101
37#endif /* _LINUX_KTHREAD_H */ 102#endif /* _LINUX_KTHREAD_H */
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index ce5983225be4..e1ceaa9b36bb 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -130,7 +130,7 @@ static inline ktime_t timeval_to_ktime(struct timeval tv)
130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */ 130/* Convert ktime_t to nanoseconds - NOP in the scalar storage format: */
131#define ktime_to_ns(kt) ((kt).tv64) 131#define ktime_to_ns(kt) ((kt).tv64)
132 132
133#else 133#else /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
134 134
135/* 135/*
136 * Helper macros/inlines to get the ktime_t math right in the timespec 136 * Helper macros/inlines to get the ktime_t math right in the timespec
@@ -275,7 +275,7 @@ static inline s64 ktime_to_ns(const ktime_t kt)
275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec; 275 return (s64) kt.tv.sec * NSEC_PER_SEC + kt.tv.nsec;
276} 276}
277 277
278#endif 278#endif /* !((BITS_PER_LONG == 64) || defined(CONFIG_KTIME_SCALAR)) */
279 279
280/** 280/**
281 * ktime_equal - Compares two ktime_t variables to see if they are equal 281 * ktime_equal - Compares two ktime_t variables to see if they are equal
@@ -295,6 +295,12 @@ static inline s64 ktime_to_us(const ktime_t kt)
295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; 295 return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
296} 296}
297 297
298static inline s64 ktime_to_ms(const ktime_t kt)
299{
300 struct timeval tv = ktime_to_timeval(kt);
301 return (s64) tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC;
302}
303
298static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier) 304static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
299{ 305{
300 return ktime_to_us(ktime_sub(later, earlier)); 306 return ktime_to_us(ktime_sub(later, earlier));
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 60df9c84ecae..636fc381c897 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -160,6 +160,7 @@ struct kvm_pit_config {
160#define KVM_EXIT_DCR 15 160#define KVM_EXIT_DCR 15
161#define KVM_EXIT_NMI 16 161#define KVM_EXIT_NMI 16
162#define KVM_EXIT_INTERNAL_ERROR 17 162#define KVM_EXIT_INTERNAL_ERROR 17
163#define KVM_EXIT_OSI 18
163 164
164/* For KVM_EXIT_INTERNAL_ERROR */ 165/* For KVM_EXIT_INTERNAL_ERROR */
165#define KVM_INTERNAL_ERROR_EMULATION 1 166#define KVM_INTERNAL_ERROR_EMULATION 1
@@ -259,6 +260,10 @@ struct kvm_run {
259 __u32 ndata; 260 __u32 ndata;
260 __u64 data[16]; 261 __u64 data[16];
261 } internal; 262 } internal;
263 /* KVM_EXIT_OSI */
264 struct {
265 __u64 gprs[32];
266 } osi;
262 /* Fix the size of the union. */ 267 /* Fix the size of the union. */
263 char padding[256]; 268 char padding[256];
264 }; 269 };
@@ -400,6 +405,15 @@ struct kvm_ioeventfd {
400 __u8 pad[36]; 405 __u8 pad[36];
401}; 406};
402 407
408/* for KVM_ENABLE_CAP */
409struct kvm_enable_cap {
410 /* in */
411 __u32 cap;
412 __u32 flags;
413 __u64 args[4];
414 __u8 pad[64];
415};
416
403#define KVMIO 0xAE 417#define KVMIO 0xAE
404 418
405/* 419/*
@@ -501,7 +515,21 @@ struct kvm_ioeventfd {
501#define KVM_CAP_HYPERV_VAPIC 45 515#define KVM_CAP_HYPERV_VAPIC 45
502#define KVM_CAP_HYPERV_SPIN 46 516#define KVM_CAP_HYPERV_SPIN 46
503#define KVM_CAP_PCI_SEGMENT 47 517#define KVM_CAP_PCI_SEGMENT 47
518#define KVM_CAP_PPC_PAIRED_SINGLES 48
519#define KVM_CAP_INTR_SHADOW 49
520#ifdef __KVM_HAVE_DEBUGREGS
521#define KVM_CAP_DEBUGREGS 50
522#endif
504#define KVM_CAP_X86_ROBUST_SINGLESTEP 51 523#define KVM_CAP_X86_ROBUST_SINGLESTEP 51
524#define KVM_CAP_PPC_OSI 52
525#define KVM_CAP_PPC_UNSET_IRQ 53
526#define KVM_CAP_ENABLE_CAP 54
527#ifdef __KVM_HAVE_XSAVE
528#define KVM_CAP_XSAVE 55
529#endif
530#ifdef __KVM_HAVE_XCRS
531#define KVM_CAP_XCRS 56
532#endif
505 533
506#ifdef KVM_CAP_IRQ_ROUTING 534#ifdef KVM_CAP_IRQ_ROUTING
507 535
@@ -591,6 +619,7 @@ struct kvm_clock_data {
591 */ 619 */
592#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 620#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
593#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 621#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
622/* KVM_SET_MEMORY_ALIAS is obsolete: */
594#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 623#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
595#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) 624#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
596#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) 625#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
@@ -688,6 +717,16 @@ struct kvm_clock_data {
688/* Available with KVM_CAP_VCPU_EVENTS */ 717/* Available with KVM_CAP_VCPU_EVENTS */
689#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events) 718#define KVM_GET_VCPU_EVENTS _IOR(KVMIO, 0x9f, struct kvm_vcpu_events)
690#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events) 719#define KVM_SET_VCPU_EVENTS _IOW(KVMIO, 0xa0, struct kvm_vcpu_events)
720/* Available with KVM_CAP_DEBUGREGS */
721#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
722#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
723#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
724/* Available with KVM_CAP_XSAVE */
725#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
726#define KVM_SET_XSAVE _IOW(KVMIO, 0xa5, struct kvm_xsave)
727/* Available with KVM_CAP_XCRS */
728#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
729#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
691 730
692#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 731#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
693 732
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 169d07758ee5..c13cc48697aa 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -81,13 +81,14 @@ struct kvm_vcpu {
81 int vcpu_id; 81 int vcpu_id;
82 struct mutex mutex; 82 struct mutex mutex;
83 int cpu; 83 int cpu;
84 atomic_t guest_mode;
84 struct kvm_run *run; 85 struct kvm_run *run;
85 unsigned long requests; 86 unsigned long requests;
86 unsigned long guest_debug; 87 unsigned long guest_debug;
87 int srcu_idx; 88 int srcu_idx;
88 89
89 int fpu_active; 90 int fpu_active;
90 int guest_fpu_loaded; 91 int guest_fpu_loaded, guest_xcr0_loaded;
91 wait_queue_head_t wq; 92 wait_queue_head_t wq;
92 int sigset_active; 93 int sigset_active;
93 sigset_t sigset; 94 sigset_t sigset;
@@ -105,6 +106,12 @@ struct kvm_vcpu {
105 struct kvm_vcpu_arch arch; 106 struct kvm_vcpu_arch arch;
106}; 107};
107 108
109/*
110 * Some of the bitops functions do not support too long bitmaps.
111 * This number must be determined not to exceed such limits.
112 */
113#define KVM_MEM_MAX_NR_PAGES ((1UL << 31) - 1)
114
108struct kvm_memory_slot { 115struct kvm_memory_slot {
109 gfn_t base_gfn; 116 gfn_t base_gfn;
110 unsigned long npages; 117 unsigned long npages;
@@ -117,6 +124,7 @@ struct kvm_memory_slot {
117 } *lpage_info[KVM_NR_PAGE_SIZES - 1]; 124 } *lpage_info[KVM_NR_PAGE_SIZES - 1];
118 unsigned long userspace_addr; 125 unsigned long userspace_addr;
119 int user_alloc; 126 int user_alloc;
127 int id;
120}; 128};
121 129
122static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot) 130static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memslot)
@@ -237,23 +245,31 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
237void vcpu_load(struct kvm_vcpu *vcpu); 245void vcpu_load(struct kvm_vcpu *vcpu);
238void vcpu_put(struct kvm_vcpu *vcpu); 246void vcpu_put(struct kvm_vcpu *vcpu);
239 247
240int kvm_init(void *opaque, unsigned int vcpu_size, 248int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
241 struct module *module); 249 struct module *module);
242void kvm_exit(void); 250void kvm_exit(void);
243 251
244void kvm_get_kvm(struct kvm *kvm); 252void kvm_get_kvm(struct kvm *kvm);
245void kvm_put_kvm(struct kvm *kvm); 253void kvm_put_kvm(struct kvm *kvm);
246 254
255static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm)
256{
257 return rcu_dereference_check(kvm->memslots,
258 srcu_read_lock_held(&kvm->srcu)
259 || lockdep_is_held(&kvm->slots_lock));
260}
261
247#define HPA_MSB ((sizeof(hpa_t) * 8) - 1) 262#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
248#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) 263#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
249static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } 264static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
250struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
251 265
252extern struct page *bad_page; 266extern struct page *bad_page;
253extern pfn_t bad_pfn; 267extern pfn_t bad_pfn;
254 268
255int is_error_page(struct page *page); 269int is_error_page(struct page *page);
256int is_error_pfn(pfn_t pfn); 270int is_error_pfn(pfn_t pfn);
271int is_hwpoison_pfn(pfn_t pfn);
272int is_fault_pfn(pfn_t pfn);
257int kvm_is_error_hva(unsigned long addr); 273int kvm_is_error_hva(unsigned long addr);
258int kvm_set_memory_region(struct kvm *kvm, 274int kvm_set_memory_region(struct kvm *kvm,
259 struct kvm_userspace_memory_region *mem, 275 struct kvm_userspace_memory_region *mem,
@@ -272,8 +288,6 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
272 int user_alloc); 288 int user_alloc);
273void kvm_disable_largepages(void); 289void kvm_disable_largepages(void);
274void kvm_arch_flush_shadow(struct kvm *kvm); 290void kvm_arch_flush_shadow(struct kvm *kvm);
275gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
276gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn);
277 291
278struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 292struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
279unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 293unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
@@ -433,7 +447,8 @@ void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
433 struct kvm_irq_mask_notifier *kimn); 447 struct kvm_irq_mask_notifier *kimn);
434void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, 448void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
435 struct kvm_irq_mask_notifier *kimn); 449 struct kvm_irq_mask_notifier *kimn);
436void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask); 450void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin,
451 bool mask);
437 452
438#ifdef __KVM_HAVE_IOAPIC 453#ifdef __KVM_HAVE_IOAPIC
439void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic, 454void kvm_get_intr_delivery_bitmask(struct kvm_ioapic *ioapic,
@@ -550,10 +565,6 @@ static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_se
550} 565}
551#endif 566#endif
552 567
553#ifndef KVM_ARCH_HAS_UNALIAS_INSTANTIATION
554#define unalias_gfn_instantiation unalias_gfn
555#endif
556
557#ifdef CONFIG_HAVE_KVM_IRQCHIP 568#ifdef CONFIG_HAVE_KVM_IRQCHIP
558 569
559#define KVM_MAX_IRQ_ROUTES 1024 570#define KVM_MAX_IRQ_ROUTES 1024
@@ -616,5 +627,25 @@ static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl,
616 627
617#endif 628#endif
618 629
630static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
631{
632 set_bit(req, &vcpu->requests);
633}
634
635static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu)
636{
637 return test_and_set_bit(req, &vcpu->requests);
638}
639
640static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
641{
642 if (test_bit(req, &vcpu->requests)) {
643 clear_bit(req, &vcpu->requests);
644 return true;
645 } else {
646 return false;
647 }
648}
649
619#endif 650#endif
620 651
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index fb46efbeabec..7ac0d4eee430 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -32,11 +32,11 @@
32 32
33typedef unsigned long gva_t; 33typedef unsigned long gva_t;
34typedef u64 gpa_t; 34typedef u64 gpa_t;
35typedef unsigned long gfn_t; 35typedef u64 gfn_t;
36 36
37typedef unsigned long hva_t; 37typedef unsigned long hva_t;
38typedef u64 hpa_t; 38typedef u64 hpa_t;
39typedef unsigned long hfn_t; 39typedef u64 hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
new file mode 100644
index 000000000000..4bdb31df8e72
--- /dev/null
+++ b/include/linux/l2tp.h
@@ -0,0 +1,163 @@
1/*
2 * L2TP-over-IP socket for L2TPv3.
3 *
4 * Author: James Chapman <jchapman@katalix.com>
5 */
6
7#ifndef _LINUX_L2TP_H_
8#define _LINUX_L2TP_H_
9
10#include <linux/types.h>
11#ifdef __KERNEL__
12#include <linux/socket.h>
13#include <linux/in.h>
14#else
15#include <netinet/in.h>
16#endif
17
18#define IPPROTO_L2TP 115
19
20/**
21 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
22 * @l2tp_family: address family number AF_L2TPIP.
23 * @l2tp_addr: protocol specific address information
24 * @l2tp_conn_id: connection id of tunnel
25 */
26#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
27struct sockaddr_l2tpip {
28 /* The first fields must match struct sockaddr_in */
29 sa_family_t l2tp_family; /* AF_INET */
30 __be16 l2tp_unused; /* INET port number (unused) */
31 struct in_addr l2tp_addr; /* Internet address */
32
33 __u32 l2tp_conn_id; /* Connection ID of tunnel */
34
35 /* Pad to size of `struct sockaddr'. */
36 unsigned char __pad[sizeof(struct sockaddr) - sizeof(sa_family_t) -
37 sizeof(__be16) - sizeof(struct in_addr) -
38 sizeof(__u32)];
39};
40
41/*****************************************************************************
42 * NETLINK_GENERIC netlink family.
43 *****************************************************************************/
44
45/*
46 * Commands.
47 * Valid TLVs of each command are:-
48 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
49 * TUNNEL_DELETE - CONN_ID
50 * TUNNEL_MODIFY - CONN_ID, udpcsum
51 * TUNNEL_GETSTATS - CONN_ID, (stats)
52 * TUNNEL_GET - CONN_ID, (...)
53 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
54 * SESSION_DELETE - SESSION_ID
55 * SESSION_MODIFY - SESSION_ID, data_seq
56 * SESSION_GET - SESSION_ID, (...)
57 * SESSION_GETSTATS - SESSION_ID, (stats)
58 *
59 */
60enum {
61 L2TP_CMD_NOOP,
62 L2TP_CMD_TUNNEL_CREATE,
63 L2TP_CMD_TUNNEL_DELETE,
64 L2TP_CMD_TUNNEL_MODIFY,
65 L2TP_CMD_TUNNEL_GET,
66 L2TP_CMD_SESSION_CREATE,
67 L2TP_CMD_SESSION_DELETE,
68 L2TP_CMD_SESSION_MODIFY,
69 L2TP_CMD_SESSION_GET,
70 __L2TP_CMD_MAX,
71};
72
73#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
74
75/*
76 * ATTR types defined for L2TP
77 */
78enum {
79 L2TP_ATTR_NONE, /* no data */
80 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
81 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
82 L2TP_ATTR_OFFSET, /* u16 */
83 L2TP_ATTR_DATA_SEQ, /* u16 */
84 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
85 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
86 L2TP_ATTR_PROTO_VERSION, /* u8 */
87 L2TP_ATTR_IFNAME, /* string */
88 L2TP_ATTR_CONN_ID, /* u32 */
89 L2TP_ATTR_PEER_CONN_ID, /* u32 */
90 L2TP_ATTR_SESSION_ID, /* u32 */
91 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
92 L2TP_ATTR_UDP_CSUM, /* u8 */
93 L2TP_ATTR_VLAN_ID, /* u16 */
94 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
95 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
96 L2TP_ATTR_DEBUG, /* u32 */
97 L2TP_ATTR_RECV_SEQ, /* u8 */
98 L2TP_ATTR_SEND_SEQ, /* u8 */
99 L2TP_ATTR_LNS_MODE, /* u8 */
100 L2TP_ATTR_USING_IPSEC, /* u8 */
101 L2TP_ATTR_RECV_TIMEOUT, /* msec */
102 L2TP_ATTR_FD, /* int */
103 L2TP_ATTR_IP_SADDR, /* u32 */
104 L2TP_ATTR_IP_DADDR, /* u32 */
105 L2TP_ATTR_UDP_SPORT, /* u16 */
106 L2TP_ATTR_UDP_DPORT, /* u16 */
107 L2TP_ATTR_MTU, /* u16 */
108 L2TP_ATTR_MRU, /* u16 */
109 L2TP_ATTR_STATS, /* nested */
110 __L2TP_ATTR_MAX,
111};
112
113#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
114
115/* Nested in L2TP_ATTR_STATS */
116enum {
117 L2TP_ATTR_STATS_NONE, /* no data */
118 L2TP_ATTR_TX_PACKETS, /* u64 */
119 L2TP_ATTR_TX_BYTES, /* u64 */
120 L2TP_ATTR_TX_ERRORS, /* u64 */
121 L2TP_ATTR_RX_PACKETS, /* u64 */
122 L2TP_ATTR_RX_BYTES, /* u64 */
123 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
124 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
125 L2TP_ATTR_RX_ERRORS, /* u64 */
126 __L2TP_ATTR_STATS_MAX,
127};
128
129#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
130
131enum l2tp_pwtype {
132 L2TP_PWTYPE_NONE = 0x0000,
133 L2TP_PWTYPE_ETH_VLAN = 0x0004,
134 L2TP_PWTYPE_ETH = 0x0005,
135 L2TP_PWTYPE_PPP = 0x0007,
136 L2TP_PWTYPE_PPP_AC = 0x0008,
137 L2TP_PWTYPE_IP = 0x000b,
138 __L2TP_PWTYPE_MAX
139};
140
141enum l2tp_l2spec_type {
142 L2TP_L2SPECTYPE_NONE,
143 L2TP_L2SPECTYPE_DEFAULT,
144};
145
146enum l2tp_encap_type {
147 L2TP_ENCAPTYPE_UDP,
148 L2TP_ENCAPTYPE_IP,
149};
150
151enum l2tp_seqmode {
152 L2TP_SEQ_NONE = 0,
153 L2TP_SEQ_IP = 1,
154 L2TP_SEQ_ALL = 2,
155};
156
157/*
158 * NETLINK_GENERIC related info
159 */
160#define L2TP_GENL_NAME "l2tp"
161#define L2TP_GENL_VERSION 0x1
162
163#endif
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index c67fecafff90..8877123f2d6e 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -69,6 +69,29 @@ struct lcd_device {
69 struct device dev; 69 struct device dev;
70}; 70};
71 71
72struct lcd_platform_data {
73 /* reset lcd panel device. */
74 int (*reset)(struct lcd_device *ld);
75 /* on or off to lcd panel. if 'enable' is 0 then
76 lcd power off and 1, lcd power on. */
77 int (*power_on)(struct lcd_device *ld, int enable);
78
79 /* it indicates whether lcd panel was enabled
80 from bootloader or not. */
81 int lcd_enabled;
82 /* it means delay for stable time when it becomes low to high
83 or high to low that is dependent on whether reset gpio is
84 low active or high active. */
85 unsigned int reset_delay;
86 /* stable time needing to become lcd power on. */
87 unsigned int power_on_delay;
88 /* stable time needing to become lcd power off. */
89 unsigned int power_off_delay;
90
91 /* it could be used for any purpose. */
92 void *pdata;
93};
94
72static inline void lcd_set_power(struct lcd_device *ld, int power) 95static inline void lcd_set_power(struct lcd_device *ld, int power)
73{ 96{
74 mutex_lock(&ld->update_lock); 97 mutex_lock(&ld->update_lock);
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d8bf9665e70c..ba6986a11663 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -149,14 +149,18 @@ struct gpio_led {
149 unsigned default_state : 2; 149 unsigned default_state : 2;
150 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */ 150 /* default_state should be one of LEDS_GPIO_DEFSTATE_(ON|OFF|KEEP) */
151}; 151};
152#define LEDS_GPIO_DEFSTATE_OFF 0 152#define LEDS_GPIO_DEFSTATE_OFF 0
153#define LEDS_GPIO_DEFSTATE_ON 1 153#define LEDS_GPIO_DEFSTATE_ON 1
154#define LEDS_GPIO_DEFSTATE_KEEP 2 154#define LEDS_GPIO_DEFSTATE_KEEP 2
155 155
156struct gpio_led_platform_data { 156struct gpio_led_platform_data {
157 int num_leds; 157 int num_leds;
158 struct gpio_led *leds; 158 struct gpio_led *leds;
159 int (*gpio_blink_set)(unsigned gpio, 159
160#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
161#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
162#define GPIO_LED_BLINK 2 /* Plase, blink */
163 int (*gpio_blink_set)(unsigned gpio, int state,
160 unsigned long *delay_on, 164 unsigned long *delay_on,
161 unsigned long *delay_off); 165 unsigned long *delay_off);
162}; 166};
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b2f2003b92e5..f010f18a0f86 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -202,12 +202,6 @@ enum {
202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 202 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
203 * led */ 203 * led */
204 204
205 /* The following flag belongs to ap->pflags but is kept in
206 * ap->flags because it's referenced in many LLDs and will be
207 * removed in not-too-distant future.
208 */
209 ATA_FLAG_DISABLED = (1 << 23), /* port is disabled, ignore it */
210
211 /* bits 24:31 of ap->flags are reserved for LLD specific flags */ 205 /* bits 24:31 of ap->flags are reserved for LLD specific flags */
212 206
213 207
@@ -256,12 +250,13 @@ enum {
256 ATA_TMOUT_INTERNAL_QUICK = 5000, 250 ATA_TMOUT_INTERNAL_QUICK = 5000,
257 ATA_TMOUT_MAX_PARK = 30000, 251 ATA_TMOUT_MAX_PARK = 30000,
258 252
259 /* FIXME: GoVault needs 2s but we can't afford that without 253 /*
260 * parallel probing. 800ms is enough for iVDR disk 254 * GoVault needs 2s and iVDR disk HHD424020F7SV00 800ms. 2s
261 * HHD424020F7SV00. Increase to 2secs when parallel probing 255 * is too much without parallel probing. Use 2s if parallel
262 * is in place. 256 * probing is available, 800ms otherwise.
263 */ 257 */
264 ATA_TMOUT_FF_WAIT = 800, 258 ATA_TMOUT_FF_WAIT_LONG = 2000,
259 ATA_TMOUT_FF_WAIT = 800,
265 260
266 /* Spec mandates to wait for ">= 2ms" before checking status 261 /* Spec mandates to wait for ">= 2ms" before checking status
267 * after reset. We wait 150ms, because that was the magic 262 * after reset. We wait 150ms, because that was the magic
@@ -391,6 +386,7 @@ enum {
391 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ 386 ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */
392 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ 387 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */
393 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ 388 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
389 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
394 390
395 /* DMA mask for user DMA control: User visible values; DO NOT 391 /* DMA mask for user DMA control: User visible values; DO NOT
396 renumber */ 392 renumber */
@@ -518,7 +514,9 @@ struct ata_ioports {
518 void __iomem *command_addr; 514 void __iomem *command_addr;
519 void __iomem *altstatus_addr; 515 void __iomem *altstatus_addr;
520 void __iomem *ctl_addr; 516 void __iomem *ctl_addr;
517#ifdef CONFIG_ATA_BMDMA
521 void __iomem *bmdma_addr; 518 void __iomem *bmdma_addr;
519#endif /* CONFIG_ATA_BMDMA */
522 void __iomem *scr_addr; 520 void __iomem *scr_addr;
523}; 521};
524#endif /* CONFIG_ATA_SFF */ 522#endif /* CONFIG_ATA_SFF */
@@ -721,15 +719,17 @@ struct ata_port {
721 unsigned int print_id; /* user visible unique port ID */ 719 unsigned int print_id; /* user visible unique port ID */
722 unsigned int port_no; /* 0 based port no. inside the host */ 720 unsigned int port_no; /* 0 based port no. inside the host */
723 721
724 struct ata_prd *prd; /* our SG list */
725 dma_addr_t prd_dma; /* and its DMA mapping */
726
727#ifdef CONFIG_ATA_SFF 722#ifdef CONFIG_ATA_SFF
728 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 723 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
729#endif /* CONFIG_ATA_SFF */
730
731 u8 ctl; /* cache of ATA control register */ 724 u8 ctl; /* cache of ATA control register */
732 u8 last_ctl; /* Cache last written value */ 725 u8 last_ctl; /* Cache last written value */
726 struct delayed_work sff_pio_task;
727#ifdef CONFIG_ATA_BMDMA
728 struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */
729 dma_addr_t bmdma_prd_dma; /* and its DMA mapping */
730#endif /* CONFIG_ATA_BMDMA */
731#endif /* CONFIG_ATA_SFF */
732
733 unsigned int pio_mask; 733 unsigned int pio_mask;
734 unsigned int mwdma_mask; 734 unsigned int mwdma_mask;
735 unsigned int udma_mask; 735 unsigned int udma_mask;
@@ -751,8 +751,7 @@ struct ata_port {
751 struct ata_host *host; 751 struct ata_host *host;
752 struct device *dev; 752 struct device *dev;
753 753
754 void *port_task_data; 754 struct mutex scsi_scan_mutex;
755 struct delayed_work port_task;
756 struct delayed_work hotplug_task; 755 struct delayed_work hotplug_task;
757 struct work_struct scsi_rescan_task; 756 struct work_struct scsi_rescan_task;
758 757
@@ -849,6 +848,7 @@ struct ata_port_operations {
849 * SFF / taskfile oriented ops 848 * SFF / taskfile oriented ops
850 */ 849 */
851 void (*sff_dev_select)(struct ata_port *ap, unsigned int device); 850 void (*sff_dev_select)(struct ata_port *ap, unsigned int device);
851 void (*sff_set_devctl)(struct ata_port *ap, u8 ctl);
852 u8 (*sff_check_status)(struct ata_port *ap); 852 u8 (*sff_check_status)(struct ata_port *ap);
853 u8 (*sff_check_altstatus)(struct ata_port *ap); 853 u8 (*sff_check_altstatus)(struct ata_port *ap);
854 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf); 854 void (*sff_tf_load)(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -857,16 +857,17 @@ struct ata_port_operations {
857 const struct ata_taskfile *tf); 857 const struct ata_taskfile *tf);
858 unsigned int (*sff_data_xfer)(struct ata_device *dev, 858 unsigned int (*sff_data_xfer)(struct ata_device *dev,
859 unsigned char *buf, unsigned int buflen, int rw); 859 unsigned char *buf, unsigned int buflen, int rw);
860 u8 (*sff_irq_on)(struct ata_port *); 860 void (*sff_irq_on)(struct ata_port *);
861 bool (*sff_irq_check)(struct ata_port *); 861 bool (*sff_irq_check)(struct ata_port *);
862 void (*sff_irq_clear)(struct ata_port *); 862 void (*sff_irq_clear)(struct ata_port *);
863 void (*sff_drain_fifo)(struct ata_queued_cmd *qc);
863 864
865#ifdef CONFIG_ATA_BMDMA
864 void (*bmdma_setup)(struct ata_queued_cmd *qc); 866 void (*bmdma_setup)(struct ata_queued_cmd *qc);
865 void (*bmdma_start)(struct ata_queued_cmd *qc); 867 void (*bmdma_start)(struct ata_queued_cmd *qc);
866 void (*bmdma_stop)(struct ata_queued_cmd *qc); 868 void (*bmdma_stop)(struct ata_queued_cmd *qc);
867 u8 (*bmdma_status)(struct ata_port *ap); 869 u8 (*bmdma_status)(struct ata_port *ap);
868 870#endif /* CONFIG_ATA_BMDMA */
869 void (*drain_fifo)(struct ata_queued_cmd *qc);
870#endif /* CONFIG_ATA_SFF */ 871#endif /* CONFIG_ATA_SFF */
871 872
872 ssize_t (*em_show)(struct ata_port *ap, char *buf); 873 ssize_t (*em_show)(struct ata_port *ap, char *buf);
@@ -935,7 +936,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
935 return ap->ops == &ata_dummy_port_ops; 936 return ap->ops == &ata_dummy_port_ops;
936} 937}
937 938
938extern void ata_port_probe(struct ata_port *);
939extern int sata_set_spd(struct ata_link *link); 939extern int sata_set_spd(struct ata_link *link);
940extern int ata_std_prereset(struct ata_link *link, unsigned long deadline); 940extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
941extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline, 941extern int ata_wait_after_reset(struct ata_link *link, unsigned long deadline,
@@ -950,7 +950,6 @@ extern int sata_link_hardreset(struct ata_link *link,
950extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, 950extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
951 unsigned long deadline); 951 unsigned long deadline);
952extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); 952extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
953extern void ata_port_disable(struct ata_port *);
954 953
955extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 954extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
956extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 955extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
@@ -1006,7 +1005,6 @@ extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
1006extern int ata_xfer_mode2shift(unsigned long xfer_mode); 1005extern int ata_xfer_mode2shift(unsigned long xfer_mode);
1007extern const char *ata_mode_string(unsigned long xfer_mask); 1006extern const char *ata_mode_string(unsigned long xfer_mask);
1008extern unsigned long ata_id_xfermask(const u16 *id); 1007extern unsigned long ata_id_xfermask(const u16 *id);
1009extern int ata_port_start(struct ata_port *ap);
1010extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 1008extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
1011extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 1009extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
1012extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 1010extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
@@ -1026,6 +1024,7 @@ extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
1026extern int ata_std_bios_param(struct scsi_device *sdev, 1024extern int ata_std_bios_param(struct scsi_device *sdev,
1027 struct block_device *bdev, 1025 struct block_device *bdev,
1028 sector_t capacity, int geom[]); 1026 sector_t capacity, int geom[]);
1027extern void ata_scsi_unlock_native_capacity(struct scsi_device *sdev);
1029extern int ata_scsi_slave_config(struct scsi_device *sdev); 1028extern int ata_scsi_slave_config(struct scsi_device *sdev);
1030extern void ata_scsi_slave_destroy(struct scsi_device *sdev); 1029extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
1031extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 1030extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
@@ -1039,9 +1038,6 @@ extern int ata_cable_sata(struct ata_port *ap);
1039extern int ata_cable_ignore(struct ata_port *ap); 1038extern int ata_cable_ignore(struct ata_port *ap);
1040extern int ata_cable_unknown(struct ata_port *ap); 1039extern int ata_cable_unknown(struct ata_port *ap);
1041 1040
1042extern void ata_pio_queue_task(struct ata_port *ap, void *data,
1043 unsigned long delay);
1044
1045/* Timing helpers */ 1041/* Timing helpers */
1046extern unsigned int ata_pio_need_iordy(const struct ata_device *); 1042extern unsigned int ata_pio_need_iordy(const struct ata_device *);
1047extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode); 1043extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
@@ -1180,6 +1176,7 @@ extern struct device_attribute *ata_common_sdev_attrs[];
1180 .slave_configure = ata_scsi_slave_config, \ 1176 .slave_configure = ata_scsi_slave_config, \
1181 .slave_destroy = ata_scsi_slave_destroy, \ 1177 .slave_destroy = ata_scsi_slave_destroy, \
1182 .bios_param = ata_std_bios_param, \ 1178 .bios_param = ata_std_bios_param, \
1179 .unlock_native_capacity = ata_scsi_unlock_native_capacity, \
1183 .sdev_attrs = ata_common_sdev_attrs 1180 .sdev_attrs = ata_common_sdev_attrs
1184 1181
1185#define ATA_NCQ_SHT(drv_name) \ 1182#define ATA_NCQ_SHT(drv_name) \
@@ -1443,7 +1440,11 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1443{ 1440{
1444 memset(tf, 0, sizeof(*tf)); 1441 memset(tf, 0, sizeof(*tf));
1445 1442
1443#ifdef CONFIG_ATA_SFF
1446 tf->ctl = dev->link->ap->ctl; 1444 tf->ctl = dev->link->ap->ctl;
1445#else
1446 tf->ctl = ATA_DEVCTL_OBS;
1447#endif
1447 if (dev->devno == 0) 1448 if (dev->devno == 0)
1448 tf->device = ATA_DEVICE_OBS; 1449 tf->device = ATA_DEVICE_OBS;
1449 else 1450 else
@@ -1564,7 +1565,6 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1564#ifdef CONFIG_ATA_SFF 1565#ifdef CONFIG_ATA_SFF
1565 1566
1566extern const struct ata_port_operations ata_sff_port_ops; 1567extern const struct ata_port_operations ata_sff_port_ops;
1567extern const struct ata_port_operations ata_bmdma_port_ops;
1568extern const struct ata_port_operations ata_bmdma32_port_ops; 1568extern const struct ata_port_operations ata_bmdma32_port_ops;
1569 1569
1570/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1570/* PIO only, sg_tablesize and dma_boundary limits can be removed */
@@ -1573,13 +1573,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops;
1573 .sg_tablesize = LIBATA_MAX_PRD, \ 1573 .sg_tablesize = LIBATA_MAX_PRD, \
1574 .dma_boundary = ATA_DMA_BOUNDARY 1574 .dma_boundary = ATA_DMA_BOUNDARY
1575 1575
1576#define ATA_BMDMA_SHT(drv_name) \
1577 ATA_BASE_SHT(drv_name), \
1578 .sg_tablesize = LIBATA_MAX_PRD, \
1579 .dma_boundary = ATA_DMA_BOUNDARY
1580
1581extern void ata_sff_qc_prep(struct ata_queued_cmd *qc);
1582extern void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc);
1583extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); 1576extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device);
1584extern u8 ata_sff_check_status(struct ata_port *ap); 1577extern u8 ata_sff_check_status(struct ata_port *ap);
1585extern void ata_sff_pause(struct ata_port *ap); 1578extern void ata_sff_pause(struct ata_port *ap);
@@ -1597,13 +1590,14 @@ extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1597 unsigned char *buf, unsigned int buflen, int rw); 1590 unsigned char *buf, unsigned int buflen, int rw);
1598extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1591extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1599 unsigned char *buf, unsigned int buflen, int rw); 1592 unsigned char *buf, unsigned int buflen, int rw);
1600extern u8 ata_sff_irq_on(struct ata_port *ap); 1593extern void ata_sff_irq_on(struct ata_port *ap);
1601extern void ata_sff_irq_clear(struct ata_port *ap); 1594extern void ata_sff_irq_clear(struct ata_port *ap);
1602extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1595extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1603 u8 status, int in_wq); 1596 u8 status, int in_wq);
1597extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay);
1604extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); 1598extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1605extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); 1599extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
1606extern unsigned int ata_sff_host_intr(struct ata_port *ap, 1600extern unsigned int ata_sff_port_intr(struct ata_port *ap,
1607 struct ata_queued_cmd *qc); 1601 struct ata_queued_cmd *qc);
1608extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); 1602extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance);
1609extern void ata_sff_lost_interrupt(struct ata_port *ap); 1603extern void ata_sff_lost_interrupt(struct ata_port *ap);
@@ -1621,21 +1615,8 @@ extern int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1621extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes); 1615extern void ata_sff_postreset(struct ata_link *link, unsigned int *classes);
1622extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc); 1616extern void ata_sff_drain_fifo(struct ata_queued_cmd *qc);
1623extern void ata_sff_error_handler(struct ata_port *ap); 1617extern void ata_sff_error_handler(struct ata_port *ap);
1624extern void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc);
1625extern int ata_sff_port_start(struct ata_port *ap);
1626extern int ata_sff_port_start32(struct ata_port *ap);
1627extern void ata_sff_std_ports(struct ata_ioports *ioaddr); 1618extern void ata_sff_std_ports(struct ata_ioports *ioaddr);
1628extern unsigned long ata_bmdma_mode_filter(struct ata_device *dev,
1629 unsigned long xfer_mask);
1630extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1631extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1632extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1633extern u8 ata_bmdma_status(struct ata_port *ap);
1634extern void ata_bus_reset(struct ata_port *ap);
1635
1636#ifdef CONFIG_PCI 1619#ifdef CONFIG_PCI
1637extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1638extern int ata_pci_bmdma_init(struct ata_host *host);
1639extern int ata_pci_sff_init_host(struct ata_host *host); 1620extern int ata_pci_sff_init_host(struct ata_host *host);
1640extern int ata_pci_sff_prepare_host(struct pci_dev *pdev, 1621extern int ata_pci_sff_prepare_host(struct pci_dev *pdev,
1641 const struct ata_port_info * const * ppi, 1622 const struct ata_port_info * const * ppi,
@@ -1648,6 +1629,44 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev,
1648 struct scsi_host_template *sht, void *host_priv, int hflags); 1629 struct scsi_host_template *sht, void *host_priv, int hflags);
1649#endif /* CONFIG_PCI */ 1630#endif /* CONFIG_PCI */
1650 1631
1632#ifdef CONFIG_ATA_BMDMA
1633
1634extern const struct ata_port_operations ata_bmdma_port_ops;
1635
1636#define ATA_BMDMA_SHT(drv_name) \
1637 ATA_BASE_SHT(drv_name), \
1638 .sg_tablesize = LIBATA_MAX_PRD, \
1639 .dma_boundary = ATA_DMA_BOUNDARY
1640
1641extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc);
1642extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc);
1643extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc);
1644extern unsigned int ata_bmdma_port_intr(struct ata_port *ap,
1645 struct ata_queued_cmd *qc);
1646extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance);
1647extern void ata_bmdma_error_handler(struct ata_port *ap);
1648extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc);
1649extern void ata_bmdma_irq_clear(struct ata_port *ap);
1650extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
1651extern void ata_bmdma_start(struct ata_queued_cmd *qc);
1652extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
1653extern u8 ata_bmdma_status(struct ata_port *ap);
1654extern int ata_bmdma_port_start(struct ata_port *ap);
1655extern int ata_bmdma_port_start32(struct ata_port *ap);
1656
1657#ifdef CONFIG_PCI
1658extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev);
1659extern void ata_pci_bmdma_init(struct ata_host *host);
1660extern int ata_pci_bmdma_prepare_host(struct pci_dev *pdev,
1661 const struct ata_port_info * const * ppi,
1662 struct ata_host **r_host);
1663extern int ata_pci_bmdma_init_one(struct pci_dev *pdev,
1664 const struct ata_port_info * const * ppi,
1665 struct scsi_host_template *sht,
1666 void *host_priv, int hflags);
1667#endif /* CONFIG_PCI */
1668#endif /* CONFIG_ATA_BMDMA */
1669
1651/** 1670/**
1652 * ata_sff_busy_wait - Wait for a port status register 1671 * ata_sff_busy_wait - Wait for a port status register
1653 * @ap: Port to wait for. 1672 * @ap: Port to wait for.
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 5126cceb6ae9..7135ebc8428c 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -18,8 +18,8 @@
18# define asmregparm 18# define asmregparm
19#endif 19#endif
20 20
21#define __page_aligned_data __section(.data.page_aligned) __aligned(PAGE_SIZE) 21#define __page_aligned_data __section(.data..page_aligned) __aligned(PAGE_SIZE)
22#define __page_aligned_bss __section(.bss.page_aligned) __aligned(PAGE_SIZE) 22#define __page_aligned_bss __section(.bss..page_aligned) __aligned(PAGE_SIZE)
23 23
24/* 24/*
25 * For assembly routines. 25 * For assembly routines.
@@ -27,8 +27,8 @@
27 * Note when using these that you must specify the appropriate 27 * Note when using these that you must specify the appropriate
28 * alignment directives yourself 28 * alignment directives yourself
29 */ 29 */
30#define __PAGE_ALIGNED_DATA .section ".data.page_aligned", "aw" 30#define __PAGE_ALIGNED_DATA .section ".data..page_aligned", "aw"
31#define __PAGE_ALIGNED_BSS .section ".bss.page_aligned", "aw" 31#define __PAGE_ALIGNED_BSS .section ".bss..page_aligned", "aw"
32 32
33/* 33/*
34 * This is used by architectures to keep arguments on the stack 34 * This is used by architectures to keep arguments on the stack
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
index f1ca0dcc1628..0e8a346424bb 100644
--- a/include/linux/lis3lv02d.h
+++ b/include/linux/lis3lv02d.h
@@ -25,12 +25,14 @@ struct lis3lv02d_platform_data {
25#define LIS3_IRQ1_FF_WU_12 (3 << 0) 25#define LIS3_IRQ1_FF_WU_12 (3 << 0)
26#define LIS3_IRQ1_DATA_READY (4 << 0) 26#define LIS3_IRQ1_DATA_READY (4 << 0)
27#define LIS3_IRQ1_CLICK (7 << 0) 27#define LIS3_IRQ1_CLICK (7 << 0)
28#define LIS3_IRQ1_MASK (7 << 0)
28#define LIS3_IRQ2_DISABLE (0 << 3) 29#define LIS3_IRQ2_DISABLE (0 << 3)
29#define LIS3_IRQ2_FF_WU_1 (1 << 3) 30#define LIS3_IRQ2_FF_WU_1 (1 << 3)
30#define LIS3_IRQ2_FF_WU_2 (2 << 3) 31#define LIS3_IRQ2_FF_WU_2 (2 << 3)
31#define LIS3_IRQ2_FF_WU_12 (3 << 3) 32#define LIS3_IRQ2_FF_WU_12 (3 << 3)
32#define LIS3_IRQ2_DATA_READY (4 << 3) 33#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3) 34#define LIS3_IRQ2_CLICK (7 << 3)
35#define LIS3_IRQ2_MASK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6) 36#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_LOW (1 << 7) 37#define LIS3_IRQ_ACTIVE_LOW (1 << 7)
36 unsigned char irq_cfg; 38 unsigned char irq_cfg;
@@ -43,6 +45,15 @@ struct lis3lv02d_platform_data {
43#define LIS3_WAKEUP_Z_HI (1 << 5) 45#define LIS3_WAKEUP_Z_HI (1 << 5)
44 unsigned char wakeup_flags; 46 unsigned char wakeup_flags;
45 unsigned char wakeup_thresh; 47 unsigned char wakeup_thresh;
48 unsigned char wakeup_flags2;
49 unsigned char wakeup_thresh2;
50#define LIS3_HIPASS_CUTFF_8HZ 0
51#define LIS3_HIPASS_CUTFF_4HZ 1
52#define LIS3_HIPASS_CUTFF_2HZ 2
53#define LIS3_HIPASS_CUTFF_1HZ 3
54#define LIS3_HIPASS1_DISABLE (1 << 2)
55#define LIS3_HIPASS2_DISABLE (1 << 3)
56 unsigned char hipass_ctrl;
46#define LIS3_NO_MAP 0 57#define LIS3_NO_MAP 0
47#define LIS3_DEV_X 1 58#define LIS3_DEV_X 1
48#define LIS3_DEV_Y 2 59#define LIS3_DEV_Y 2
@@ -58,6 +69,7 @@ struct lis3lv02d_platform_data {
58 /* Limits for selftest are specified in chip data sheet */ 69 /* Limits for selftest are specified in chip data sheet */
59 s16 st_min_limits[3]; /* min pass limit x, y, z */ 70 s16 st_min_limits[3]; /* min pass limit x, y, z */
60 s16 st_max_limits[3]; /* max pass limit x, y, z */ 71 s16 st_max_limits[3]; /* max pass limit x, y, z */
72 int irq2;
61}; 73};
62 74
63#endif /* __LIS3LV02D_H_ */ 75#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 8392884a2977..d167b5d7c0ac 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_LIST_H 1#ifndef _LINUX_LIST_H
2#define _LINUX_LIST_H 2#define _LINUX_LIST_H
3 3
4#include <linux/types.h>
4#include <linux/stddef.h> 5#include <linux/stddef.h>
5#include <linux/poison.h> 6#include <linux/poison.h>
6#include <linux/prefetch.h> 7#include <linux/prefetch.h>
@@ -16,10 +17,6 @@
16 * using the generic single-entry routines. 17 * using the generic single-entry routines.
17 */ 18 */
18 19
19struct list_head {
20 struct list_head *next, *prev;
21};
22
23#define LIST_HEAD_INIT(name) { &(name), &(name) } 20#define LIST_HEAD_INIT(name) { &(name), &(name) }
24 21
25#define LIST_HEAD(name) \ 22#define LIST_HEAD(name) \
@@ -544,6 +541,21 @@ static inline void list_splice_tail_init(struct list_head *list,
544 &pos->member != (head); \ 541 &pos->member != (head); \
545 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 542 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
546 543
544/**
545 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
546 * @pos: the loop cursor used in the list_for_each_entry_safe loop
547 * @n: temporary storage used in list_for_each_entry_safe
548 * @member: the name of the list_struct within the struct.
549 *
550 * list_safe_reset_next is not safe to use in general if the list may be
551 * modified concurrently (eg. the lock is dropped in the loop body). An
552 * exception to this is if the cursor element (pos) is pinned in the list,
553 * and list_safe_reset_next is called after re-taking the lock and before
554 * completing the current iteration of the loop body.
555 */
556#define list_safe_reset_next(pos, n, member) \
557 n = list_entry(pos->member.next, typeof(*pos), member)
558
547/* 559/*
548 * Double linked lists with a single pointer list head. 560 * Double linked lists with a single pointer list head.
549 * Mostly useful for hash tables where the two pointer list head is 561 * Mostly useful for hash tables where the two pointer list head is
@@ -551,14 +563,6 @@ static inline void list_splice_tail_init(struct list_head *list,
551 * You lose the ability to access the tail in O(1). 563 * You lose the ability to access the tail in O(1).
552 */ 564 */
553 565
554struct hlist_head {
555 struct hlist_node *first;
556};
557
558struct hlist_node {
559 struct hlist_node *next, **pprev;
560};
561
562#define HLIST_HEAD_INIT { .first = NULL } 566#define HLIST_HEAD_INIT { .first = NULL }
563#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } 567#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
564#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) 568#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
deleted file mode 100644
index f3d14333ebed..000000000000
--- a/include/linux/lmb.h
+++ /dev/null
@@ -1,89 +0,0 @@
1#ifndef _LINUX_LMB_H
2#define _LINUX_LMB_H
3#ifdef __KERNEL__
4
5/*
6 * Logical memory blocks.
7 *
8 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/mm.h>
18
19#define MAX_LMB_REGIONS 128
20
21struct lmb_property {
22 u64 base;
23 u64 size;
24};
25
26struct lmb_region {
27 unsigned long cnt;
28 u64 size;
29 struct lmb_property region[MAX_LMB_REGIONS+1];
30};
31
32struct lmb {
33 unsigned long debug;
34 u64 rmo_size;
35 struct lmb_region memory;
36 struct lmb_region reserved;
37};
38
39extern struct lmb lmb;
40
41extern void __init lmb_init(void);
42extern void __init lmb_analyze(void);
43extern long lmb_add(u64 base, u64 size);
44extern long lmb_remove(u64 base, u64 size);
45extern long __init lmb_free(u64 base, u64 size);
46extern long __init lmb_reserve(u64 base, u64 size);
47extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
48 u64 (*nid_range)(u64, u64, int *));
49extern u64 __init lmb_alloc(u64 size, u64 align);
50extern u64 __init lmb_alloc_base(u64 size,
51 u64, u64 max_addr);
52extern u64 __init __lmb_alloc_base(u64 size,
53 u64 align, u64 max_addr);
54extern u64 __init lmb_phys_mem_size(void);
55extern u64 lmb_end_of_DRAM(void);
56extern void __init lmb_enforce_memory_limit(u64 memory_limit);
57extern int __init lmb_is_reserved(u64 addr);
58extern int lmb_is_region_reserved(u64 base, u64 size);
59extern int lmb_find(struct lmb_property *res);
60
61extern void lmb_dump_all(void);
62
63static inline u64
64lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
65{
66 return type->region[region_nr].size;
67}
68static inline u64
69lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
70{
71 return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT;
72}
73static inline u64
74lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
75{
76 return type->region[region_nr].base >> PAGE_SHIFT;
77}
78static inline u64
79lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
80{
81 return lmb_start_pfn(type, region_nr) +
82 lmb_size_pages(type, region_nr);
83}
84
85#include <asm/lmb.h>
86
87#endif /* __KERNEL__ */
88
89#endif /* _LINUX_LMB_H */
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index a03977a96d7e..06aed8305bf3 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -44,6 +44,8 @@ struct lock_class_key {
44 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES]; 44 struct lockdep_subclass_key subkeys[MAX_LOCKDEP_SUBCLASSES];
45}; 45};
46 46
47extern struct lock_class_key __lockdep_no_validate__;
48
47#define LOCKSTAT_POINTS 4 49#define LOCKSTAT_POINTS 4
48 50
49/* 51/*
@@ -270,6 +272,9 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
270#define lockdep_set_subclass(lock, sub) \ 272#define lockdep_set_subclass(lock, sub) \
271 lockdep_init_map(&(lock)->dep_map, #lock, \ 273 lockdep_init_map(&(lock)->dep_map, #lock, \
272 (lock)->dep_map.key, sub) 274 (lock)->dep_map.key, sub)
275
276#define lockdep_set_novalidate_class(lock) \
277 lockdep_set_class(lock, &__lockdep_no_validate__)
273/* 278/*
274 * Compare locking classes 279 * Compare locking classes
275 */ 280 */
@@ -354,6 +359,9 @@ static inline void lockdep_on(void)
354#define lockdep_set_class_and_subclass(lock, key, sub) \ 359#define lockdep_set_class_and_subclass(lock, key, sub) \
355 do { (void)(key); } while (0) 360 do { (void)(key); } while (0)
356#define lockdep_set_subclass(lock, sub) do { } while (0) 361#define lockdep_set_subclass(lock, sub) do { } while (0)
362
363#define lockdep_set_novalidate_class(lock) do { } while (0)
364
357/* 365/*
358 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP 366 * We don't define lockdep_match_class() and lockdep_match_key() for !LOCKDEP
359 * case since the result is not well defined and the caller should rather 367 * case since the result is not well defined and the caller should rather
diff --git a/include/linux/lru_cache.h b/include/linux/lru_cache.h
index de48d167568b..78fbf24f357a 100644
--- a/include/linux/lru_cache.h
+++ b/include/linux/lru_cache.h
@@ -262,7 +262,7 @@ extern void lc_seq_dump_details(struct seq_file *seq, struct lru_cache *lc, char
262 * @lc: the lru cache to operate on 262 * @lc: the lru cache to operate on
263 * 263 *
264 * Note that the reference counts and order on the active and lru lists may 264 * Note that the reference counts and order on the active and lru lists may
265 * still change. Returns true if we aquired the lock. 265 * still change. Returns true if we acquired the lock.
266 */ 266 */
267static inline int lc_try_lock(struct lru_cache *lc) 267static inline int lc_try_lock(struct lru_cache *lc)
268{ 268{
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
index f78f83d7663f..112a55033352 100644
--- a/include/linux/lsm_audit.h
+++ b/include/linux/lsm_audit.h
@@ -33,7 +33,7 @@ struct common_audit_data {
33#define LSM_AUDIT_DATA_IPC 4 33#define LSM_AUDIT_DATA_IPC 4
34#define LSM_AUDIT_DATA_TASK 5 34#define LSM_AUDIT_DATA_TASK 5
35#define LSM_AUDIT_DATA_KEY 6 35#define LSM_AUDIT_DATA_KEY 6
36#define LSM_AUDIT_NO_AUDIT 7 36#define LSM_AUDIT_DATA_NONE 7
37#define LSM_AUDIT_DATA_KMOD 8 37#define LSM_AUDIT_DATA_KMOD 8
38 struct task_struct *tsk; 38 struct task_struct *tsk;
39 union { 39 union {
@@ -90,10 +90,42 @@ struct common_audit_data {
90 u32 requested; 90 u32 requested;
91 u32 audited; 91 u32 audited;
92 u32 denied; 92 u32 denied;
93 /*
94 * auditdeny is a bit tricky and unintuitive. See the
95 * comments in avc.c for it's meaning and usage.
96 */
97 u32 auditdeny;
93 struct av_decision *avd; 98 struct av_decision *avd;
94 int result; 99 int result;
95 } selinux_audit_data; 100 } selinux_audit_data;
96#endif 101#endif
102#ifdef CONFIG_SECURITY_APPARMOR
103 struct {
104 int error;
105 int op;
106 int type;
107 void *profile;
108 const char *name;
109 const char *info;
110 union {
111 void *target;
112 struct {
113 long pos;
114 void *target;
115 } iface;
116 struct {
117 int rlim;
118 unsigned long max;
119 } rlim;
120 struct {
121 const char *target;
122 u32 request;
123 u32 denied;
124 uid_t ouid;
125 } fs;
126 };
127 } apparmor_audit_data;
128#endif
97 }; 129 };
98 /* these callback will be implemented by a specific LSM */ 130 /* these callback will be implemented by a specific LSM */
99 void (*lsm_pre_audit)(struct audit_buffer *, void *); 131 void (*lsm_pre_audit)(struct audit_buffer *, void *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 78c3bed1c3f5..b5e7f2202484 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -251,7 +251,7 @@
251struct mISDNhead { 251struct mISDNhead {
252 unsigned int prim; 252 unsigned int prim;
253 unsigned int id; 253 unsigned int id;
254} __attribute__((packed)); 254} __packed;
255 255
256#define MISDN_HEADER_LEN sizeof(struct mISDNhead) 256#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
257#define MAX_DATA_SIZE 2048 257#define MAX_DATA_SIZE 2048
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
new file mode 100644
index 000000000000..d0f08018335d
--- /dev/null
+++ b/include/linux/marvell_phy.h
@@ -0,0 +1,21 @@
1#ifndef _MARVELL_PHY_H
2#define _MARVELL_PHY_H
3
4/* Mask used for ID comparisons */
5#define MARVELL_PHY_ID_MASK 0xfffffff0
6
7/* Known PHY IDs */
8#define MARVELL_PHY_ID_88E1101 0x01410c60
9#define MARVELL_PHY_ID_88E1112 0x01410c90
10#define MARVELL_PHY_ID_88E1111 0x01410cc0
11#define MARVELL_PHY_ID_88E1118 0x01410e10
12#define MARVELL_PHY_ID_88E1121R 0x01410cb0
13#define MARVELL_PHY_ID_88E1145 0x01410cd0
14#define MARVELL_PHY_ID_88E1240 0x01410e30
15#define MARVELL_PHY_ID_88EC048 0x01410e90
16
17/* struct phy_device dev_flags definitions */
18#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
19#define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002
20
21#endif /* _MARVELL_PHY_H */
diff --git a/include/linux/matroxfb.h b/include/linux/matroxfb.h
index 2203121a43e9..8c22a8938642 100644
--- a/include/linux/matroxfb.h
+++ b/include/linux/matroxfb.h
@@ -4,6 +4,7 @@
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/videodev2.h> 6#include <linux/videodev2.h>
7#include <linux/fb.h>
7 8
8struct matroxioc_output_mode { 9struct matroxioc_output_mode {
9 __u32 output; /* which output */ 10 __u32 output; /* which output */
@@ -37,7 +38,5 @@ enum matroxfb_ctrl_id {
37 MATROXFB_CID_LAST 38 MATROXFB_CID_LAST
38}; 39};
39 40
40#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
41
42#endif 41#endif
43 42
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index a09b84e4fdb4..54cbbac1e71d 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -4,9 +4,6 @@
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6 6
7/* Hardwire the number of additional indexes */
8#define MB_CACHE_INDEXES_COUNT 1
9
10struct mb_cache_entry { 7struct mb_cache_entry {
11 struct list_head e_lru_list; 8 struct list_head e_lru_list;
12 struct mb_cache *e_cache; 9 struct mb_cache *e_cache;
@@ -18,17 +15,12 @@ struct mb_cache_entry {
18 struct { 15 struct {
19 struct list_head o_list; 16 struct list_head o_list;
20 unsigned int o_key; 17 unsigned int o_key;
21 } e_indexes[0]; 18 } e_index;
22};
23
24struct mb_cache_op {
25 int (*free)(struct mb_cache_entry *, gfp_t);
26}; 19};
27 20
28/* Functions on caches */ 21/* Functions on caches */
29 22
30struct mb_cache * mb_cache_create(const char *, struct mb_cache_op *, size_t, 23struct mb_cache *mb_cache_create(const char *, int);
31 int, int);
32void mb_cache_shrink(struct block_device *); 24void mb_cache_shrink(struct block_device *);
33void mb_cache_destroy(struct mb_cache *); 25void mb_cache_destroy(struct mb_cache *);
34 26
@@ -36,17 +28,15 @@ void mb_cache_destroy(struct mb_cache *);
36 28
37struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t); 29struct mb_cache_entry *mb_cache_entry_alloc(struct mb_cache *, gfp_t);
38int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *, 30int mb_cache_entry_insert(struct mb_cache_entry *, struct block_device *,
39 sector_t, unsigned int[]); 31 sector_t, unsigned int);
40void mb_cache_entry_release(struct mb_cache_entry *); 32void mb_cache_entry_release(struct mb_cache_entry *);
41void mb_cache_entry_free(struct mb_cache_entry *); 33void mb_cache_entry_free(struct mb_cache_entry *);
42struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *, 34struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *,
43 struct block_device *, 35 struct block_device *,
44 sector_t); 36 sector_t);
45#if !defined(MB_CACHE_INDEXES_COUNT) || (MB_CACHE_INDEXES_COUNT > 0) 37struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache,
46struct mb_cache_entry *mb_cache_entry_find_first(struct mb_cache *cache, int,
47 struct block_device *, 38 struct block_device *,
48 unsigned int); 39 unsigned int);
49struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *, int, 40struct mb_cache_entry *mb_cache_entry_find_next(struct mb_cache_entry *,
50 struct block_device *, 41 struct block_device *,
51 unsigned int); 42 unsigned int);
52#endif
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
new file mode 100644
index 000000000000..a59faf2b5edd
--- /dev/null
+++ b/include/linux/memblock.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_MEMBLOCK_H
2#define _LINUX_MEMBLOCK_H
3#ifdef __KERNEL__
4
5/*
6 * Logical memory blocks.
7 *
8 * Copyright (C) 2001 Peter Bergner, IBM Corp.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <linux/init.h>
17#include <linux/mm.h>
18
19#define MAX_MEMBLOCK_REGIONS 128
20
21struct memblock_property {
22 u64 base;
23 u64 size;
24};
25
26struct memblock_region {
27 unsigned long cnt;
28 u64 size;
29 struct memblock_property region[MAX_MEMBLOCK_REGIONS+1];
30};
31
32struct memblock {
33 unsigned long debug;
34 u64 rmo_size;
35 struct memblock_region memory;
36 struct memblock_region reserved;
37};
38
39extern struct memblock memblock;
40
41extern void __init memblock_init(void);
42extern void __init memblock_analyze(void);
43extern long memblock_add(u64 base, u64 size);
44extern long memblock_remove(u64 base, u64 size);
45extern long __init memblock_free(u64 base, u64 size);
46extern long __init memblock_reserve(u64 base, u64 size);
47extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid,
48 u64 (*nid_range)(u64, u64, int *));
49extern u64 __init memblock_alloc(u64 size, u64 align);
50extern u64 __init memblock_alloc_base(u64 size,
51 u64, u64 max_addr);
52extern u64 __init __memblock_alloc_base(u64 size,
53 u64 align, u64 max_addr);
54extern u64 __init memblock_phys_mem_size(void);
55extern u64 memblock_end_of_DRAM(void);
56extern void __init memblock_enforce_memory_limit(u64 memory_limit);
57extern int __init memblock_is_reserved(u64 addr);
58extern int memblock_is_region_reserved(u64 base, u64 size);
59extern int memblock_find(struct memblock_property *res);
60
61extern void memblock_dump_all(void);
62
63static inline u64
64memblock_size_bytes(struct memblock_region *type, unsigned long region_nr)
65{
66 return type->region[region_nr].size;
67}
68static inline u64
69memblock_size_pages(struct memblock_region *type, unsigned long region_nr)
70{
71 return memblock_size_bytes(type, region_nr) >> PAGE_SHIFT;
72}
73static inline u64
74memblock_start_pfn(struct memblock_region *type, unsigned long region_nr)
75{
76 return type->region[region_nr].base >> PAGE_SHIFT;
77}
78static inline u64
79memblock_end_pfn(struct memblock_region *type, unsigned long region_nr)
80{
81 return memblock_start_pfn(type, region_nr) +
82 memblock_size_pages(type, region_nr);
83}
84
85#include <asm/memblock.h>
86
87#endif /* __KERNEL__ */
88
89#endif /* _LINUX_MEMBLOCK_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 44301c6affa8..159a0762aeaf 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -25,6 +25,13 @@ struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
29 struct list_head *dst,
30 unsigned long *scanned, int order,
31 int mode, struct zone *z,
32 struct mem_cgroup *mem_cont,
33 int active, int file);
34
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 35#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29/* 36/*
30 * All "charge" functions with gfp_mask should use GFP_KERNEL or 37 * All "charge" functions with gfp_mask should use GFP_KERNEL or
@@ -64,12 +71,6 @@ extern void mem_cgroup_uncharge_cache_page(struct page *page);
64extern int mem_cgroup_shmem_charge_fallback(struct page *page, 71extern int mem_cgroup_shmem_charge_fallback(struct page *page,
65 struct mm_struct *mm, gfp_t gfp_mask); 72 struct mm_struct *mm, gfp_t gfp_mask);
66 73
67extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
68 struct list_head *dst,
69 unsigned long *scanned, int order,
70 int mode, struct zone *z,
71 struct mem_cgroup *mem_cont,
72 int active, int file);
73extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask); 74extern void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask);
74int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem); 75int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
75 76
@@ -89,18 +90,14 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
89extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem); 90extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
90 91
91extern int 92extern int
92mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); 93mem_cgroup_prepare_migration(struct page *page,
94 struct page *newpage, struct mem_cgroup **ptr);
93extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 95extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
94 struct page *oldpage, struct page *newpage); 96 struct page *oldpage, struct page *newpage);
95 97
96/* 98/*
97 * For memory reclaim. 99 * For memory reclaim.
98 */ 100 */
99extern int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem);
100extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
101 int priority);
102extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
103 int priority);
104int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 101int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
105int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg); 102int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
106unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 103unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
@@ -126,8 +123,9 @@ static inline bool mem_cgroup_disabled(void)
126 123
127void mem_cgroup_update_file_mapped(struct page *page, int val); 124void mem_cgroup_update_file_mapped(struct page *page, int val);
128unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 125unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
129 gfp_t gfp_mask, int nid, 126 gfp_t gfp_mask);
130 int zid); 127u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
128
131#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 129#else /* CONFIG_CGROUP_MEM_RES_CTLR */
132struct mem_cgroup; 130struct mem_cgroup;
133 131
@@ -226,7 +224,8 @@ static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
226} 224}
227 225
228static inline int 226static inline int
229mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) 227mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
228 struct mem_cgroup **ptr)
230{ 229{
231 return 0; 230 return 0;
232} 231}
@@ -301,7 +300,13 @@ static inline void mem_cgroup_update_file_mapped(struct page *page,
301 300
302static inline 301static inline
303unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 302unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
304 gfp_t gfp_mask, int nid, int zid) 303 gfp_t gfp_mask)
304{
305 return 0;
306}
307
308static inline
309u64 mem_cgroup_get_limit(struct mem_cgroup *mem)
305{ 310{
306 return 0; 311 return 0;
307} 312}
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 35b07b773e6c..864035fb8f8a 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -202,6 +202,7 @@ static inline int is_mem_section_removable(unsigned long pfn,
202} 202}
203#endif /* CONFIG_MEMORY_HOTREMOVE */ 203#endif /* CONFIG_MEMORY_HOTREMOVE */
204 204
205extern int mem_online_node(int nid);
205extern int add_memory(int nid, u64 start, u64 size); 206extern int add_memory(int nid, u64 start, u64 size);
206extern int arch_add_memory(int nid, u64 start, u64 size); 207extern int arch_add_memory(int nid, u64 start, u64 size);
207extern int remove_memory(u64 start, u64 size); 208extern int remove_memory(u64 start, u64 size);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 1cc966cd3e5f..31ac26ca4acf 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -23,6 +23,13 @@ enum {
23 MPOL_MAX, /* always last member of enum */ 23 MPOL_MAX, /* always last member of enum */
24}; 24};
25 25
26enum mpol_rebind_step {
27 MPOL_REBIND_ONCE, /* do rebind work at once(not by two step) */
28 MPOL_REBIND_STEP1, /* first step(set all the newly nodes) */
29 MPOL_REBIND_STEP2, /* second step(clean all the disallowed nodes)*/
30 MPOL_REBIND_NSTEP,
31};
32
26/* Flags for set_mempolicy */ 33/* Flags for set_mempolicy */
27#define MPOL_F_STATIC_NODES (1 << 15) 34#define MPOL_F_STATIC_NODES (1 << 15)
28#define MPOL_F_RELATIVE_NODES (1 << 14) 35#define MPOL_F_RELATIVE_NODES (1 << 14)
@@ -51,6 +58,7 @@ enum {
51 */ 58 */
52#define MPOL_F_SHARED (1 << 0) /* identify shared policies */ 59#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
53#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */ 60#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
61#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */
54 62
55#ifdef __KERNEL__ 63#ifdef __KERNEL__
56 64
@@ -193,8 +201,8 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
193 201
194extern void numa_default_policy(void); 202extern void numa_default_policy(void);
195extern void numa_policy_init(void); 203extern void numa_policy_init(void);
196extern void mpol_rebind_task(struct task_struct *tsk, 204extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
197 const nodemask_t *new); 205 enum mpol_rebind_step step);
198extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 206extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
199extern void mpol_fix_fork_child_flag(struct task_struct *p); 207extern void mpol_fix_fork_child_flag(struct task_struct *p);
200 208
@@ -202,6 +210,8 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
202 unsigned long addr, gfp_t gfp_flags, 210 unsigned long addr, gfp_t gfp_flags,
203 struct mempolicy **mpol, nodemask_t **nodemask); 211 struct mempolicy **mpol, nodemask_t **nodemask);
204extern bool init_nodemask_of_mempolicy(nodemask_t *mask); 212extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
213extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
214 const nodemask_t *mask);
205extern unsigned slab_node(struct mempolicy *policy); 215extern unsigned slab_node(struct mempolicy *policy);
206 216
207extern enum zone_type policy_zone; 217extern enum zone_type policy_zone;
@@ -308,7 +318,8 @@ static inline void numa_default_policy(void)
308} 318}
309 319
310static inline void mpol_rebind_task(struct task_struct *tsk, 320static inline void mpol_rebind_task(struct task_struct *tsk,
311 const nodemask_t *new) 321 const nodemask_t *new,
322 enum mpol_rebind_step step)
312{ 323{
313} 324}
314 325
@@ -329,7 +340,16 @@ static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
329 return node_zonelist(0, gfp_flags); 340 return node_zonelist(0, gfp_flags);
330} 341}
331 342
332static inline bool init_nodemask_of_mempolicy(nodemask_t *m) { return false; } 343static inline bool init_nodemask_of_mempolicy(nodemask_t *m)
344{
345 return false;
346}
347
348static inline bool mempolicy_nodemask_intersects(struct task_struct *tsk,
349 const nodemask_t *mask)
350{
351 return false;
352}
333 353
334static inline int do_migrate_pages(struct mm_struct *mm, 354static inline int do_migrate_pages(struct mm_struct *mm,
335 const nodemask_t *from_nodes, 355 const nodemask_t *from_nodes,
diff --git a/include/linux/meye.h b/include/linux/meye.h
index 12010ace1f04..0dd49954f746 100644
--- a/include/linux/meye.h
+++ b/include/linux/meye.h
@@ -44,17 +44,17 @@ struct meye_params {
44}; 44};
45 45
46/* query the extended parameters */ 46/* query the extended parameters */
47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params) 47#define MEYEIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params)
48/* set the extended parameters */ 48/* set the extended parameters */
49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params) 49#define MEYEIOC_S_PARAMS _IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params)
50/* queue a buffer for mjpeg capture */ 50/* queue a buffer for mjpeg capture */
51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+2, int) 51#define MEYEIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+2, int)
52/* sync a previously queued mjpeg buffer */ 52/* sync a previously queued mjpeg buffer */
53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOCPRIVATE+3, int) 53#define MEYEIOC_SYNC _IOWR('v', BASE_VIDIOC_PRIVATE+3, int)
54/* get a still uncompressed snapshot */ 54/* get a still uncompressed snapshot */
55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOCPRIVATE+4) 55#define MEYEIOC_STILLCAPT _IO ('v', BASE_VIDIOC_PRIVATE+4)
56/* get a jpeg compressed snapshot */ 56/* get a jpeg compressed snapshot */
57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOCPRIVATE+5, int) 57#define MEYEIOC_STILLJCAPT _IOR ('v', BASE_VIDIOC_PRIVATE+5, int)
58 58
59/* V4L2 private controls */ 59/* V4L2 private controls */
60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE 60#define V4L2_CID_AGC V4L2_CID_PRIVATE_BASE
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 73f92c5feea2..bfd23bef7363 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -132,6 +132,7 @@ enum {
132 PM8607_ID_LDO9, 132 PM8607_ID_LDO9,
133 PM8607_ID_LDO10, 133 PM8607_ID_LDO10,
134 PM8607_ID_LDO12, 134 PM8607_ID_LDO12,
135 PM8607_ID_LDO13,
135 PM8607_ID_LDO14, 136 PM8607_ID_LDO14,
136 137
137 PM8607_ID_RG_MAX, 138 PM8607_ID_RG_MAX,
@@ -309,7 +310,7 @@ struct pm860x_chip {
309 310
310}; 311};
311 312
312#define PM8607_MAX_REGULATOR 15 /* 3 Bucks, 12 LDOs */ 313#define PM8607_MAX_REGULATOR PM8607_ID_RG_MAX /* 3 Bucks, 13 LDOs */
313 314
314enum { 315enum {
315 GI2C_PORT = 0, 316 GI2C_PORT = 0,
@@ -369,7 +370,7 @@ extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
369 unsigned char); 370 unsigned char);
370 371
371extern int pm860x_device_init(struct pm860x_chip *chip, 372extern int pm860x_device_init(struct pm860x_chip *chip,
372 struct pm860x_platform_data *pdata); 373 struct pm860x_platform_data *pdata) __devinit ;
373extern void pm860x_device_exit(struct pm860x_chip *chip); 374extern void pm860x_device_exit(struct pm860x_chip *chip) __devexit ;
374 375
375#endif /* __LINUX_MFD_88PM860X_H */ 376#endif /* __LINUX_MFD_88PM860X_H */
diff --git a/include/linux/mfd/ab4500.h b/include/linux/mfd/ab4500.h
deleted file mode 100644
index a42a7033ae53..000000000000
--- a/include/linux/mfd/ab4500.h
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson
3 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 * AB4500 device core funtions, for client access
11 */
12#ifndef MFD_AB4500_H
13#define MFD_AB4500_H
14
15#include <linux/device.h>
16
17/*
18 * AB4500 bank addresses
19 */
20#define AB4500_SYS_CTRL1_BLOCK 0x1
21#define AB4500_SYS_CTRL2_BLOCK 0x2
22#define AB4500_REGU_CTRL1 0x3
23#define AB4500_REGU_CTRL2 0x4
24#define AB4500_USB 0x5
25#define AB4500_TVOUT 0x6
26#define AB4500_DBI 0x7
27#define AB4500_ECI_AV_ACC 0x8
28#define AB4500_RESERVED 0x9
29#define AB4500_GPADC 0xA
30#define AB4500_CHARGER 0xB
31#define AB4500_GAS_GAUGE 0xC
32#define AB4500_AUDIO 0xD
33#define AB4500_INTERRUPT 0xE
34#define AB4500_RTC 0xF
35#define AB4500_MISC 0x10
36#define AB4500_DEBUG 0x12
37#define AB4500_PROD_TEST 0x13
38#define AB4500_OTP_EMUL 0x15
39
40/*
41 * System control 1 register offsets.
42 * Bank = 0x01
43 */
44#define AB4500_TURNON_STAT_REG 0x0100
45#define AB4500_RESET_STAT_REG 0x0101
46#define AB4500_PONKEY1_PRESS_STAT_REG 0x0102
47
48#define AB4500_FSM_STAT1_REG 0x0140
49#define AB4500_FSM_STAT2_REG 0x0141
50#define AB4500_SYSCLK_REQ_STAT_REG 0x0142
51#define AB4500_USB_STAT1_REG 0x0143
52#define AB4500_USB_STAT2_REG 0x0144
53#define AB4500_STATUS_SPARE1_REG 0x0145
54#define AB4500_STATUS_SPARE2_REG 0x0146
55
56#define AB4500_CTRL1_REG 0x0180
57#define AB4500_CTRL2_REG 0x0181
58
59/*
60 * System control 2 register offsets.
61 * bank = 0x02
62 */
63#define AB4500_CTRL3_REG 0x0200
64#define AB4500_MAIN_WDOG_CTRL_REG 0x0201
65#define AB4500_MAIN_WDOG_TIMER_REG 0x0202
66#define AB4500_LOW_BAT_REG 0x0203
67#define AB4500_BATT_OK_REG 0x0204
68#define AB4500_SYSCLK_TIMER_REG 0x0205
69#define AB4500_SMPSCLK_CTRL_REG 0x0206
70#define AB4500_SMPSCLK_SEL1_REG 0x0207
71#define AB4500_SMPSCLK_SEL2_REG 0x0208
72#define AB4500_SMPSCLK_SEL3_REG 0x0209
73#define AB4500_SYSULPCLK_CONF_REG 0x020A
74#define AB4500_SYSULPCLK_CTRL1_REG 0x020B
75#define AB4500_SYSCLK_CTRL_REG 0x020C
76#define AB4500_SYSCLK_REQ1_VALID_REG 0x020D
77#define AB4500_SYSCLK_REQ_VALID_REG 0x020E
78#define AB4500_SYSCTRL_SPARE_REG 0x020F
79#define AB4500_PAD_CONF_REG 0x0210
80
81/*
82 * Regu control1 register offsets
83 * Bank = 0x03
84 */
85#define AB4500_REGU_SERIAL_CTRL1_REG 0x0300
86#define AB4500_REGU_SERIAL_CTRL2_REG 0x0301
87#define AB4500_REGU_SERIAL_CTRL3_REG 0x0302
88#define AB4500_REGU_REQ_CTRL1_REG 0x0303
89#define AB4500_REGU_REQ_CTRL2_REG 0x0304
90#define AB4500_REGU_REQ_CTRL3_REG 0x0305
91#define AB4500_REGU_REQ_CTRL4_REG 0x0306
92#define AB4500_REGU_MISC1_REG 0x0380
93#define AB4500_REGU_OTGSUPPLY_CTRL_REG 0x0381
94#define AB4500_REGU_VUSB_CTRL_REG 0x0382
95#define AB4500_REGU_VAUDIO_SUPPLY_REG 0x0383
96#define AB4500_REGU_CTRL1_SPARE_REG 0x0384
97
98/*
99 * Regu control2 Vmod register offsets
100 */
101#define AB4500_REGU_VMOD_REGU_REG 0x0440
102#define AB4500_REGU_VMOD_SEL1_REG 0x0441
103#define AB4500_REGU_VMOD_SEL2_REG 0x0442
104#define AB4500_REGU_CTRL_DISCH_REG 0x0443
105#define AB4500_REGU_CTRL_DISCH2_REG 0x0444
106
107/*
108 * USB/ULPI register offsets
109 * Bank : 0x5
110 */
111#define AB4500_USB_LINE_STAT_REG 0x0580
112#define AB4500_USB_LINE_CTRL1_REG 0x0581
113#define AB4500_USB_LINE_CTRL2_REG 0x0582
114#define AB4500_USB_LINE_CTRL3_REG 0x0583
115#define AB4500_USB_LINE_CTRL4_REG 0x0584
116#define AB4500_USB_LINE_CTRL5_REG 0x0585
117#define AB4500_USB_OTG_CTRL_REG 0x0587
118#define AB4500_USB_OTG_STAT_REG 0x0588
119#define AB4500_USB_OTG_STAT_REG 0x0588
120#define AB4500_USB_CTRL_SPARE_REG 0x0589
121#define AB4500_USB_PHY_CTRL_REG 0x058A
122
123/*
124 * TVOUT / CTRL register offsets
125 * Bank : 0x06
126 */
127#define AB4500_TVOUT_CTRL_REG 0x0680
128
129/*
130 * DBI register offsets
131 * Bank : 0x07
132 */
133#define AB4500_DBI_REG1_REG 0x0700
134#define AB4500_DBI_REG2_REG 0x0701
135
136/*
137 * ECI regsiter offsets
138 * Bank : 0x08
139 */
140#define AB4500_ECI_CTRL_REG 0x0800
141#define AB4500_ECI_HOOKLEVEL_REG 0x0801
142#define AB4500_ECI_DATAOUT_REG 0x0802
143#define AB4500_ECI_DATAIN_REG 0x0803
144
145/*
146 * AV Connector register offsets
147 * Bank : 0x08
148 */
149#define AB4500_AV_CONN_REG 0x0840
150
151/*
152 * Accessory detection register offsets
153 * Bank : 0x08
154 */
155#define AB4500_ACC_DET_DB1_REG 0x0880
156#define AB4500_ACC_DET_DB2_REG 0x0881
157
158/*
159 * GPADC register offsets
160 * Bank : 0x0A
161 */
162#define AB4500_GPADC_CTRL1_REG 0x0A00
163#define AB4500_GPADC_CTRL2_REG 0x0A01
164#define AB4500_GPADC_CTRL3_REG 0x0A02
165#define AB4500_GPADC_AUTO_TIMER_REG 0x0A03
166#define AB4500_GPADC_STAT_REG 0x0A04
167#define AB4500_GPADC_MANDATAL_REG 0x0A05
168#define AB4500_GPADC_MANDATAH_REG 0x0A06
169#define AB4500_GPADC_AUTODATAL_REG 0x0A07
170#define AB4500_GPADC_AUTODATAH_REG 0x0A08
171#define AB4500_GPADC_MUX_CTRL_REG 0x0A09
172
173/*
174 * Charger / status register offfsets
175 * Bank : 0x0B
176 */
177#define AB4500_CH_STATUS1_REG 0x0B00
178#define AB4500_CH_STATUS2_REG 0x0B01
179#define AB4500_CH_USBCH_STAT1_REG 0x0B02
180#define AB4500_CH_USBCH_STAT2_REG 0x0B03
181#define AB4500_CH_FSM_STAT_REG 0x0B04
182#define AB4500_CH_STAT_REG 0x0B05
183
184/*
185 * Charger / control register offfsets
186 * Bank : 0x0B
187 */
188#define AB4500_CH_VOLT_LVL_REG 0x0B40
189
190/*
191 * Charger / main control register offfsets
192 * Bank : 0x0B
193 */
194#define AB4500_MCH_CTRL1 0x0B80
195#define AB4500_MCH_CTRL2 0x0B81
196#define AB4500_MCH_IPT_CURLVL_REG 0x0B82
197#define AB4500_CH_WD_REG 0x0B83
198
199/*
200 * Charger / USB control register offsets
201 * Bank : 0x0B
202 */
203#define AB4500_USBCH_CTRL1_REG 0x0BC0
204#define AB4500_USBCH_CTRL2_REG 0x0BC1
205#define AB4500_USBCH_IPT_CRNTLVL_REG 0x0BC2
206
207/*
208 * RTC bank register offsets
209 * Bank : 0xF
210 */
211#define AB4500_RTC_SOFF_STAT_REG 0x0F00
212#define AB4500_RTC_CC_CONF_REG 0x0F01
213#define AB4500_RTC_READ_REQ_REG 0x0F02
214#define AB4500_RTC_WATCH_TSECMID_REG 0x0F03
215#define AB4500_RTC_WATCH_TSECHI_REG 0x0F04
216#define AB4500_RTC_WATCH_TMIN_LOW_REG 0x0F05
217#define AB4500_RTC_WATCH_TMIN_MID_REG 0x0F06
218#define AB4500_RTC_WATCH_TMIN_HI_REG 0x0F07
219#define AB4500_RTC_ALRM_MIN_LOW_REG 0x0F08
220#define AB4500_RTC_ALRM_MIN_MID_REG 0x0F09
221#define AB4500_RTC_ALRM_MIN_HI_REG 0x0F0A
222#define AB4500_RTC_STAT_REG 0x0F0B
223#define AB4500_RTC_BKUP_CHG_REG 0x0F0C
224#define AB4500_RTC_FORCE_BKUP_REG 0x0F0D
225#define AB4500_RTC_CALIB_REG 0x0F0E
226#define AB4500_RTC_SWITCH_STAT_REG 0x0F0F
227
228/*
229 * PWM Out generators
230 * Bank: 0x10
231 */
232#define AB4500_PWM_OUT_CTRL1_REG 0x1060
233#define AB4500_PWM_OUT_CTRL2_REG 0x1061
234#define AB4500_PWM_OUT_CTRL3_REG 0x1062
235#define AB4500_PWM_OUT_CTRL4_REG 0x1063
236#define AB4500_PWM_OUT_CTRL5_REG 0x1064
237#define AB4500_PWM_OUT_CTRL6_REG 0x1065
238#define AB4500_PWM_OUT_CTRL7_REG 0x1066
239
240#define AB4500_I2C_PAD_CTRL_REG 0x1067
241#define AB4500_REV_REG 0x1080
242
243/**
244 * struct ab4500
245 * @spi: spi device structure
246 * @tx_buf: transmit buffer
247 * @rx_buf: receive buffer
248 * @lock: sync primitive
249 */
250struct ab4500 {
251 struct spi_device *spi;
252 unsigned long tx_buf[4];
253 unsigned long rx_buf[4];
254 struct mutex lock;
255};
256
257int ab4500_write(struct ab4500 *ab4500, unsigned char block,
258 unsigned long addr, unsigned char data);
259int ab4500_read(struct ab4500 *ab4500, unsigned char block,
260 unsigned long addr);
261
262#endif /* MFD_AB4500_H */
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
new file mode 100644
index 000000000000..b63ff3ba3351
--- /dev/null
+++ b/include/linux/mfd/ab8500.h
@@ -0,0 +1,128 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 * Author: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
6 */
7#ifndef MFD_AB8500_H
8#define MFD_AB8500_H
9
10#include <linux/device.h>
11
12/*
13 * Interrupts
14 */
15
16#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0
17#define AB8500_INT_UN_PLUG_TV_DET 1
18#define AB8500_INT_PLUG_TV_DET 2
19#define AB8500_INT_TEMP_WARM 3
20#define AB8500_INT_PON_KEY2DB_F 4
21#define AB8500_INT_PON_KEY2DB_R 5
22#define AB8500_INT_PON_KEY1DB_F 6
23#define AB8500_INT_PON_KEY1DB_R 7
24#define AB8500_INT_BATT_OVV 8
25#define AB8500_INT_MAIN_CH_UNPLUG_DET 10
26#define AB8500_INT_MAIN_CH_PLUG_DET 11
27#define AB8500_INT_USB_ID_DET_F 12
28#define AB8500_INT_USB_ID_DET_R 13
29#define AB8500_INT_VBUS_DET_F 14
30#define AB8500_INT_VBUS_DET_R 15
31#define AB8500_INT_VBUS_CH_DROP_END 16
32#define AB8500_INT_RTC_60S 17
33#define AB8500_INT_RTC_ALARM 18
34#define AB8500_INT_BAT_CTRL_INDB 20
35#define AB8500_INT_CH_WD_EXP 21
36#define AB8500_INT_VBUS_OVV 22
37#define AB8500_INT_MAIN_CH_DROP_END 23
38#define AB8500_INT_CCN_CONV_ACC 24
39#define AB8500_INT_INT_AUD 25
40#define AB8500_INT_CCEOC 26
41#define AB8500_INT_CC_INT_CALIB 27
42#define AB8500_INT_LOW_BAT_F 28
43#define AB8500_INT_LOW_BAT_R 29
44#define AB8500_INT_BUP_CHG_NOT_OK 30
45#define AB8500_INT_BUP_CHG_OK 31
46#define AB8500_INT_GP_HW_ADC_CONV_END 32
47#define AB8500_INT_ACC_DETECT_1DB_F 33
48#define AB8500_INT_ACC_DETECT_1DB_R 34
49#define AB8500_INT_ACC_DETECT_22DB_F 35
50#define AB8500_INT_ACC_DETECT_22DB_R 36
51#define AB8500_INT_ACC_DETECT_21DB_F 37
52#define AB8500_INT_ACC_DETECT_21DB_R 38
53#define AB8500_INT_GP_SW_ADC_CONV_END 39
54#define AB8500_INT_BTEMP_LOW 72
55#define AB8500_INT_BTEMP_LOW_MEDIUM 73
56#define AB8500_INT_BTEMP_MEDIUM_HIGH 74
57#define AB8500_INT_BTEMP_HIGH 75
58#define AB8500_INT_USB_CHARGER_NOT_OK 81
59#define AB8500_INT_ID_WAKEUP_R 82
60#define AB8500_INT_ID_DET_R1R 84
61#define AB8500_INT_ID_DET_R2R 85
62#define AB8500_INT_ID_DET_R3R 86
63#define AB8500_INT_ID_DET_R4R 87
64#define AB8500_INT_ID_WAKEUP_F 88
65#define AB8500_INT_ID_DET_R1F 90
66#define AB8500_INT_ID_DET_R2F 91
67#define AB8500_INT_ID_DET_R3F 92
68#define AB8500_INT_ID_DET_R4F 93
69#define AB8500_INT_USB_CHG_DET_DONE 94
70#define AB8500_INT_USB_CH_TH_PROT_F 96
71#define AB8500_INT_USB_CH_TH_PROP_R 97
72#define AB8500_INT_MAIN_CH_TH_PROP_F 98
73#define AB8500_INT_MAIN_CH_TH_PROT_R 99
74#define AB8500_INT_USB_CHARGER_NOT_OKF 103
75
76#define AB8500_NR_IRQS 104
77#define AB8500_NUM_IRQ_REGS 13
78
79/**
80 * struct ab8500 - ab8500 internal structure
81 * @dev: parent device
82 * @lock: read/write operations lock
83 * @irq_lock: genirq bus lock
84 * @revision: chip revision
85 * @irq: irq line
86 * @write: register write
87 * @read: register read
88 * @rx_buf: rx buf for SPI
89 * @tx_buf: tx buf for SPI
90 * @mask: cache of IRQ regs for bus lock
91 * @oldmask: cache of previous IRQ regs for bus lock
92 */
93struct ab8500 {
94 struct device *dev;
95 struct mutex lock;
96 struct mutex irq_lock;
97 int revision;
98 int irq_base;
99 int irq;
100
101 int (*write) (struct ab8500 *a8500, u16 addr, u8 data);
102 int (*read) (struct ab8500 *a8500, u16 addr);
103
104 unsigned long tx_buf[4];
105 unsigned long rx_buf[4];
106
107 u8 mask[AB8500_NUM_IRQ_REGS];
108 u8 oldmask[AB8500_NUM_IRQ_REGS];
109};
110
111/**
112 * struct ab8500_platform_data - AB8500 platform data
113 * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used
114 * @init: board-specific initialization after detection of ab8500
115 */
116struct ab8500_platform_data {
117 int irq_base;
118 void (*init) (struct ab8500 *);
119};
120
121extern int ab8500_write(struct ab8500 *a8500, u16 addr, u8 data);
122extern int ab8500_read(struct ab8500 *a8500, u16 addr);
123extern int ab8500_set_bits(struct ab8500 *a8500, u16 addr, u8 mask, u8 data);
124
125extern int __devinit ab8500_init(struct ab8500 *ab8500);
126extern int __devexit ab8500_exit(struct ab8500 *ab8500);
127
128#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/abx500.h
index 9a881c305a50..390726fcbcb1 100644
--- a/include/linux/mfd/ab3100.h
+++ b/include/linux/mfd/abx500.h
@@ -3,17 +3,37 @@
3 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions 4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com> 5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 *
7 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip
9 * ab3100, ab3550, ab5500 and possibly comming. It is not used for
10 * ab4500 and ab8500 since they are another family of chip.
11 *
12 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
13 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
14 * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
15 * Author: Rickard Andersson <rickard.andersson@stericsson.com>
6 */ 16 */
7 17
8#include <linux/device.h> 18#include <linux/device.h>
9#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
10 20
11#ifndef MFD_AB3100_H 21#ifndef MFD_ABX500_H
12#define MFD_AB3100_H 22#define MFD_ABX500_H
13 23
14#define ABUNKNOWN 0 24#define AB3100_P1A 0xc0
15#define AB3000 1 25#define AB3100_P1B 0xc1
16#define AB3100 2 26#define AB3100_P1C 0xc2
27#define AB3100_P1D 0xc3
28#define AB3100_P1E 0xc4
29#define AB3100_P1F 0xc5
30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8
33#define AB3550_P1A 0x10
34#define AB5500_1_0 0x20
35#define AB5500_2_0 0x21
36#define AB5500_2_1 0x22
17 37
18/* 38/*
19 * AB3100, EVENTA1, A2 and A3 event register flags 39 * AB3100, EVENTA1, A2 and A3 event register flags
@@ -89,7 +109,7 @@ struct ab3100 {
89 char chip_name[32]; 109 char chip_name[32];
90 u8 chip_id; 110 u8 chip_id;
91 struct blocking_notifier_head event_subscribers; 111 struct blocking_notifier_head event_subscribers;
92 u32 startup_events; 112 u8 startup_events[3];
93 bool startup_events_read; 113 bool startup_events_read;
94}; 114};
95 115
@@ -112,18 +132,102 @@ struct ab3100_platform_data {
112 int external_voltage; 132 int external_voltage;
113}; 133};
114 134
115int ab3100_set_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 regval);
116int ab3100_get_register_interruptible(struct ab3100 *ab3100, u8 reg, u8 *regval);
117int ab3100_get_register_page_interruptible(struct ab3100 *ab3100,
118 u8 first_reg, u8 *regvals, u8 numregs);
119int ab3100_mask_and_set_register_interruptible(struct ab3100 *ab3100,
120 u8 reg, u8 andmask, u8 ormask);
121u8 ab3100_get_chip_type(struct ab3100 *ab3100);
122int ab3100_event_register(struct ab3100 *ab3100, 135int ab3100_event_register(struct ab3100 *ab3100,
123 struct notifier_block *nb); 136 struct notifier_block *nb);
124int ab3100_event_unregister(struct ab3100 *ab3100, 137int ab3100_event_unregister(struct ab3100 *ab3100,
125 struct notifier_block *nb); 138 struct notifier_block *nb);
126int ab3100_event_registers_startup_state_get(struct ab3100 *ab3100,
127 u32 *fatevent);
128 139
140/* AB3550, STR register flags */
141#define AB3550_STR_ONSWA (0x01)
142#define AB3550_STR_ONSWB (0x02)
143#define AB3550_STR_ONSWC (0x04)
144#define AB3550_STR_DCIO (0x08)
145#define AB3550_STR_BOOT_MODE (0x10)
146#define AB3550_STR_SIM_OFF (0x20)
147#define AB3550_STR_BATT_REMOVAL (0x40)
148#define AB3550_STR_VBUS (0x80)
149
150/* Interrupt mask registers */
151#define AB3550_IMR1 0x29
152#define AB3550_IMR2 0x2a
153#define AB3550_IMR3 0x2b
154#define AB3550_IMR4 0x2c
155#define AB3550_IMR5 0x2d
156
157enum ab3550_devid {
158 AB3550_DEVID_ADC,
159 AB3550_DEVID_DAC,
160 AB3550_DEVID_LEDS,
161 AB3550_DEVID_POWER,
162 AB3550_DEVID_REGULATORS,
163 AB3550_DEVID_SIM,
164 AB3550_DEVID_UART,
165 AB3550_DEVID_RTC,
166 AB3550_DEVID_CHARGER,
167 AB3550_DEVID_FUELGAUGE,
168 AB3550_DEVID_VIBRATOR,
169 AB3550_DEVID_CODEC,
170 AB3550_NUM_DEVICES,
171};
172
173/**
174 * struct abx500_init_setting
175 * Initial value of the registers for driver to use during setup.
176 */
177struct abx500_init_settings {
178 u8 bank;
179 u8 reg;
180 u8 setting;
181};
182
183/**
184 * struct ab3550_platform_data
185 * Data supplied to initialize board connections to the AB3550
186 */
187struct ab3550_platform_data {
188 struct {unsigned int base; unsigned int count; } irq;
189 void *dev_data[AB3550_NUM_DEVICES];
190 size_t dev_data_sz[AB3550_NUM_DEVICES];
191 struct abx500_init_settings *init_settings;
192 unsigned int init_settings_sz;
193};
194
195int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
196 u8 value);
197int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
198 u8 *value);
199int abx500_get_register_page_interruptible(struct device *dev, u8 bank,
200 u8 first_reg, u8 *regvals, u8 numregs);
201int abx500_set_register_page_interruptible(struct device *dev, u8 bank,
202 u8 first_reg, u8 *regvals, u8 numregs);
203/**
204 * abx500_mask_and_set_register_inerruptible() - Modifies selected bits of a
205 * target register
206 *
207 * @dev: The AB sub device.
208 * @bank: The i2c bank number.
209 * @bitmask: The bit mask to use.
210 * @bitvalues: The new bit values.
211 *
212 * Updates the value of an AB register:
213 * value -> ((value & ~bitmask) | (bitvalues & bitmask))
214 */
215int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
216 u8 reg, u8 bitmask, u8 bitvalues);
217int abx500_get_chip_id(struct device *dev);
218int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
219int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
220
221struct abx500_ops {
222 int (*get_chip_id) (struct device *);
223 int (*get_register) (struct device *, u8, u8, u8 *);
224 int (*set_register) (struct device *, u8, u8, u8);
225 int (*get_register_page) (struct device *, u8, u8, u8 *, u8);
226 int (*set_register_page) (struct device *, u8, u8, u8 *, u8);
227 int (*mask_and_set_register) (struct device *, u8, u8, u8, u8);
228 int (*event_registers_startup_state_get) (struct device *, u8 *);
229 int (*startup_irq_enabled) (struct device *, unsigned int);
230};
231
232int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
129#endif 233#endif
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
new file mode 100644
index 000000000000..0ab61320ffa8
--- /dev/null
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -0,0 +1,126 @@
1/*
2 * DaVinci Voice Codec Core Interface for TI platforms
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc
5 *
6 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#ifndef __LINUX_MFD_DAVINCI_VOICECODEC_H_
24#define __LINUX_MFD_DAVINIC_VOICECODEC_H_
25
26#include <linux/kernel.h>
27#include <linux/platform_device.h>
28#include <linux/mfd/core.h>
29
30#include <mach/edma.h>
31
32/*
33 * Register values.
34 */
35#define DAVINCI_VC_PID 0x00
36#define DAVINCI_VC_CTRL 0x04
37#define DAVINCI_VC_INTEN 0x08
38#define DAVINCI_VC_INTSTATUS 0x0c
39#define DAVINCI_VC_INTCLR 0x10
40#define DAVINCI_VC_EMUL_CTRL 0x14
41#define DAVINCI_VC_RFIFO 0x20
42#define DAVINCI_VC_WFIFO 0x24
43#define DAVINCI_VC_FIFOSTAT 0x28
44#define DAVINCI_VC_TST_CTRL 0x2C
45#define DAVINCI_VC_REG05 0x94
46#define DAVINCI_VC_REG09 0xA4
47#define DAVINCI_VC_REG12 0xB0
48
49/* DAVINCI_VC_CTRL bit fields */
50#define DAVINCI_VC_CTRL_MASK 0x5500
51#define DAVINCI_VC_CTRL_RSTADC BIT(0)
52#define DAVINCI_VC_CTRL_RSTDAC BIT(1)
53#define DAVINCI_VC_CTRL_RD_BITS_8 BIT(4)
54#define DAVINCI_VC_CTRL_RD_UNSIGNED BIT(5)
55#define DAVINCI_VC_CTRL_WD_BITS_8 BIT(6)
56#define DAVINCI_VC_CTRL_WD_UNSIGNED BIT(7)
57#define DAVINCI_VC_CTRL_RFIFOEN BIT(8)
58#define DAVINCI_VC_CTRL_RFIFOCL BIT(9)
59#define DAVINCI_VC_CTRL_RFIFOMD_WORD_1 BIT(10)
60#define DAVINCI_VC_CTRL_WFIFOEN BIT(12)
61#define DAVINCI_VC_CTRL_WFIFOCL BIT(13)
62#define DAVINCI_VC_CTRL_WFIFOMD_WORD_1 BIT(14)
63
64/* DAVINCI_VC_INT bit fields */
65#define DAVINCI_VC_INT_MASK 0x3F
66#define DAVINCI_VC_INT_RDRDY_MASK BIT(0)
67#define DAVINCI_VC_INT_RERROVF_MASK BIT(1)
68#define DAVINCI_VC_INT_RERRUDR_MASK BIT(2)
69#define DAVINCI_VC_INT_WDREQ_MASK BIT(3)
70#define DAVINCI_VC_INT_WERROVF_MASKBIT BIT(4)
71#define DAVINCI_VC_INT_WERRUDR_MASK BIT(5)
72
73/* DAVINCI_VC_REG05 bit fields */
74#define DAVINCI_VC_REG05_PGA_GAIN 0x07
75
76/* DAVINCI_VC_REG09 bit fields */
77#define DAVINCI_VC_REG09_MUTE 0x40
78#define DAVINCI_VC_REG09_DIG_ATTEN 0x3F
79
80/* DAVINCI_VC_REG12 bit fields */
81#define DAVINCI_VC_REG12_POWER_ALL_ON 0xFD
82#define DAVINCI_VC_REG12_POWER_ALL_OFF 0x00
83
84#define DAVINCI_VC_CELLS 2
85
86enum davinci_vc_cells {
87 DAVINCI_VC_VCIF_CELL,
88 DAVINCI_VC_CQ93VC_CELL,
89};
90
91struct davinci_vcif {
92 struct platform_device *pdev;
93 u32 dma_tx_channel;
94 u32 dma_rx_channel;
95 dma_addr_t dma_tx_addr;
96 dma_addr_t dma_rx_addr;
97};
98
99struct cq93vc {
100 struct platform_device *pdev;
101 struct snd_soc_codec *codec;
102 u32 sysclk;
103};
104
105struct davinci_vc;
106
107struct davinci_vc {
108 /* Device data */
109 struct device *dev;
110 struct platform_device *pdev;
111 struct clk *clk;
112
113 /* Memory resources */
114 void __iomem *base;
115 resource_size_t pbase;
116 size_t base_size;
117
118 /* MFD cells */
119 struct mfd_cell cells[DAVINCI_VC_CELLS];
120
121 /* Client devices */
122 struct davinci_vcif davinci_vcif;
123 struct cq93vc cq93vc;
124};
125
126#endif
diff --git a/include/linux/mfd/janz.h b/include/linux/mfd/janz.h
new file mode 100644
index 000000000000..e9994c469803
--- /dev/null
+++ b/include/linux/mfd/janz.h
@@ -0,0 +1,54 @@
1/*
2 * Common Definitions for Janz MODULbus devices
3 *
4 * Copyright (c) 2010 Ira W. Snyder <iws@ovro.caltech.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#ifndef JANZ_H
13#define JANZ_H
14
15struct janz_platform_data {
16 /* MODULbus Module Number */
17 unsigned int modno;
18};
19
20/* PLX bridge chip onboard registers */
21struct janz_cmodio_onboard_regs {
22 u8 unused1;
23
24 /*
25 * Read access: interrupt status
26 * Write access: interrupt disable
27 */
28 u8 int_disable;
29 u8 unused2;
30
31 /*
32 * Read access: MODULbus number (hex switch)
33 * Write access: interrupt enable
34 */
35 u8 int_enable;
36 u8 unused3;
37
38 /* write-only */
39 u8 reset_assert;
40 u8 unused4;
41
42 /* write-only */
43 u8 reset_deassert;
44 u8 unused5;
45
46 /* read-write access to serial EEPROM */
47 u8 eep;
48 u8 unused6;
49
50 /* write-only access to EEPROM chip select */
51 u8 enid;
52};
53
54#endif /* JANZ_H */
diff --git a/include/linux/mfd/mc13783.h b/include/linux/mfd/mc13783.h
index 8895d9d8879c..4a894f688549 100644
--- a/include/linux/mfd/mc13783.h
+++ b/include/linux/mfd/mc13783.h
@@ -64,6 +64,70 @@ static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
64 MC13783_ADC0_TSMOD1 | \ 64 MC13783_ADC0_TSMOD1 | \
65 MC13783_ADC0_TSMOD2) 65 MC13783_ADC0_TSMOD2)
66 66
67struct mc13783_led_platform_data {
68#define MC13783_LED_MD 0
69#define MC13783_LED_AD 1
70#define MC13783_LED_KP 2
71#define MC13783_LED_R1 3
72#define MC13783_LED_G1 4
73#define MC13783_LED_B1 5
74#define MC13783_LED_R2 6
75#define MC13783_LED_G2 7
76#define MC13783_LED_B2 8
77#define MC13783_LED_R3 9
78#define MC13783_LED_G3 10
79#define MC13783_LED_B3 11
80#define MC13783_LED_MAX MC13783_LED_B3
81 int id;
82 const char *name;
83 const char *default_trigger;
84
85/* Three or two bits current selection depending on the led */
86 char max_current;
87};
88
89struct mc13783_leds_platform_data {
90 int num_leds;
91 struct mc13783_led_platform_data *led;
92
93#define MC13783_LED_TRIODE_MD (1 << 0)
94#define MC13783_LED_TRIODE_AD (1 << 1)
95#define MC13783_LED_TRIODE_KP (1 << 2)
96#define MC13783_LED_BOOST_EN (1 << 3)
97#define MC13783_LED_TC1HALF (1 << 4)
98#define MC13783_LED_SLEWLIMTC (1 << 5)
99#define MC13783_LED_SLEWLIMBL (1 << 6)
100#define MC13783_LED_TRIODE_TC1 (1 << 7)
101#define MC13783_LED_TRIODE_TC2 (1 << 8)
102#define MC13783_LED_TRIODE_TC3 (1 << 9)
103 int flags;
104
105#define MC13783_LED_AB_DISABLED 0
106#define MC13783_LED_AB_MD1 1
107#define MC13783_LED_AB_MD12 2
108#define MC13783_LED_AB_MD123 3
109#define MC13783_LED_AB_MD1234 4
110#define MC13783_LED_AB_MD1234_AD1 5
111#define MC13783_LED_AB_MD1234_AD12 6
112#define MC13783_LED_AB_MD1_AD 7
113 char abmode;
114
115#define MC13783_LED_ABREF_200MV 0
116#define MC13783_LED_ABREF_400MV 1
117#define MC13783_LED_ABREF_600MV 2
118#define MC13783_LED_ABREF_800MV 3
119 char abref;
120
121#define MC13783_LED_PERIOD_10MS 0
122#define MC13783_LED_PERIOD_100MS 1
123#define MC13783_LED_PERIOD_500MS 2
124#define MC13783_LED_PERIOD_2S 3
125 char bl_period;
126 char tc1_period;
127 char tc2_period;
128 char tc3_period;
129};
130
67/* to be cleaned up */ 131/* to be cleaned up */
68struct regulator_init_data; 132struct regulator_init_data;
69 133
@@ -80,12 +144,14 @@ struct mc13783_regulator_platform_data {
80struct mc13783_platform_data { 144struct mc13783_platform_data {
81 int num_regulators; 145 int num_regulators;
82 struct mc13783_regulator_init_data *regulators; 146 struct mc13783_regulator_init_data *regulators;
147 struct mc13783_leds_platform_data *leds;
83 148
84#define MC13783_USE_TOUCHSCREEN (1 << 0) 149#define MC13783_USE_TOUCHSCREEN (1 << 0)
85#define MC13783_USE_CODEC (1 << 1) 150#define MC13783_USE_CODEC (1 << 1)
86#define MC13783_USE_ADC (1 << 2) 151#define MC13783_USE_ADC (1 << 2)
87#define MC13783_USE_RTC (1 << 3) 152#define MC13783_USE_RTC (1 << 3)
88#define MC13783_USE_REGULATOR (1 << 4) 153#define MC13783_USE_REGULATOR (1 << 4)
154#define MC13783_USE_LED (1 << 5)
89 unsigned int flags; 155 unsigned int flags;
90}; 156};
91 157
diff --git a/include/linux/mfd/pcf50633/backlight.h b/include/linux/mfd/pcf50633/backlight.h
new file mode 100644
index 000000000000..83747e217b27
--- /dev/null
+++ b/include/linux/mfd/pcf50633/backlight.h
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * PCF50633 backlight device driver
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __LINUX_MFD_PCF50633_BACKLIGHT
17#define __LINUX_MFD_PCF50633_BACKLIGHT
18
19/*
20* @default_brightness: Backlight brightness is initialized to this value
21*
22* Brightness to be used after the driver has been probed.
23* Valid range 0-63.
24*
25* @default_brightness_limit: The actual brightness is limited by this value
26*
27* Brightness limit to be used after the driver has been probed. This is useful
28* when it is not known how much power is available for the backlight during
29* probe.
30* Valid range 0-63. Can be changed later with pcf50633_bl_set_brightness_limit.
31*
32* @ramp_time: Display ramp time when changing brightness
33*
34* When changing the backlights brightness the change is not instant, instead
35* it fades smooth from one state to another. This value specifies how long
36* the fade should take. The lower the value the higher the fade time.
37* Valid range 0-255
38*/
39struct pcf50633_bl_platform_data {
40 unsigned int default_brightness;
41 unsigned int default_brightness_limit;
42 uint8_t ramp_time;
43};
44
45
46struct pcf50633;
47
48int pcf50633_bl_set_brightness_limit(struct pcf50633 *pcf, unsigned int limit);
49
50#endif
51
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h
index 3398bd9aab11..ad411a78870c 100644
--- a/include/linux/mfd/pcf50633/core.h
+++ b/include/linux/mfd/pcf50633/core.h
@@ -18,6 +18,7 @@
18#include <linux/regulator/driver.h> 18#include <linux/regulator/driver.h>
19#include <linux/regulator/machine.h> 19#include <linux/regulator/machine.h>
20#include <linux/power_supply.h> 20#include <linux/power_supply.h>
21#include <linux/mfd/pcf50633/backlight.h>
21 22
22struct pcf50633; 23struct pcf50633;
23 24
@@ -43,6 +44,8 @@ struct pcf50633_platform_data {
43 void (*force_shutdown)(struct pcf50633 *); 44 void (*force_shutdown)(struct pcf50633 *);
44 45
45 u8 resumers[5]; 46 u8 resumers[5];
47
48 struct pcf50633_bl_platform_data *backlight_data;
46}; 49};
47 50
48struct pcf50633_irq { 51struct pcf50633_irq {
@@ -152,6 +155,7 @@ struct pcf50633 {
152 struct platform_device *mbc_pdev; 155 struct platform_device *mbc_pdev;
153 struct platform_device *adc_pdev; 156 struct platform_device *adc_pdev;
154 struct platform_device *input_pdev; 157 struct platform_device *input_pdev;
158 struct platform_device *bl_pdev;
155 struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS]; 159 struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS];
156}; 160};
157 161
diff --git a/include/linux/mfd/rdc321x.h b/include/linux/mfd/rdc321x.h
new file mode 100644
index 000000000000..4bdf19c8eedf
--- /dev/null
+++ b/include/linux/mfd/rdc321x.h
@@ -0,0 +1,26 @@
1#ifndef __RDC321X_MFD_H
2#define __RDC321X_MFD_H
3
4#include <linux/types.h>
5#include <linux/pci.h>
6
7/* Offsets to be accessed in the southbridge PCI
8 * device configuration register */
9#define RDC321X_WDT_CTRL 0x44
10#define RDC321X_GPIO_CTRL_REG1 0x48
11#define RDC321X_GPIO_DATA_REG1 0x4c
12#define RDC321X_GPIO_CTRL_REG2 0x84
13#define RDC321X_GPIO_DATA_REG2 0x88
14
15#define RDC321X_MAX_GPIO 58
16
17struct rdc321x_gpio_pdata {
18 struct pci_dev *sb_pdev;
19 unsigned max_gpios;
20};
21
22struct rdc321x_wdt_pdata {
23 struct pci_dev *sb_pdev;
24};
25
26#endif /* __RDC321X_MFD_H */
diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h
index 3bcd7163485c..49067802a6d7 100644
--- a/include/linux/mfd/sh_mobile_sdhi.h
+++ b/include/linux/mfd/sh_mobile_sdhi.h
@@ -1,7 +1,13 @@
1#ifndef __SH_MOBILE_SDHI_H__ 1#ifndef __SH_MOBILE_SDHI_H__
2#define __SH_MOBILE_SDHI_H__ 2#define __SH_MOBILE_SDHI_H__
3 3
4#include <linux/types.h>
5
4struct sh_mobile_sdhi_info { 6struct sh_mobile_sdhi_info {
7 int dma_slave_tx;
8 int dma_slave_rx;
9 unsigned long tmio_flags;
10 u32 tmio_ocr_mask; /* available MMC voltages */
5 void (*set_pwr)(struct platform_device *pdev, int state); 11 void (*set_pwr)(struct platform_device *pdev, int state);
6}; 12};
7 13
diff --git a/include/linux/mfd/tc35892.h b/include/linux/mfd/tc35892.h
new file mode 100644
index 000000000000..e47f770d3068
--- /dev/null
+++ b/include/linux/mfd/tc35892.h
@@ -0,0 +1,132 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 */
6
7#ifndef __LINUX_MFD_TC35892_H
8#define __LINUX_MFD_TC35892_H
9
10#include <linux/device.h>
11
12#define TC35892_RSTCTRL_IRQRST (1 << 4)
13#define TC35892_RSTCTRL_TIMRST (1 << 3)
14#define TC35892_RSTCTRL_ROTRST (1 << 2)
15#define TC35892_RSTCTRL_KBDRST (1 << 1)
16#define TC35892_RSTCTRL_GPIRST (1 << 0)
17
18#define TC35892_IRQST 0x91
19
20#define TC35892_MANFCODE_MAGIC 0x03
21#define TC35892_MANFCODE 0x80
22#define TC35892_VERSION 0x81
23#define TC35892_IOCFG 0xA7
24
25#define TC35892_CLKMODE 0x88
26#define TC35892_CLKCFG 0x89
27#define TC35892_CLKEN 0x8A
28
29#define TC35892_RSTCTRL 0x82
30#define TC35892_EXTRSTN 0x83
31#define TC35892_RSTINTCLR 0x84
32
33#define TC35892_GPIOIS0 0xC9
34#define TC35892_GPIOIS1 0xCA
35#define TC35892_GPIOIS2 0xCB
36#define TC35892_GPIOIBE0 0xCC
37#define TC35892_GPIOIBE1 0xCD
38#define TC35892_GPIOIBE2 0xCE
39#define TC35892_GPIOIEV0 0xCF
40#define TC35892_GPIOIEV1 0xD0
41#define TC35892_GPIOIEV2 0xD1
42#define TC35892_GPIOIE0 0xD2
43#define TC35892_GPIOIE1 0xD3
44#define TC35892_GPIOIE2 0xD4
45#define TC35892_GPIORIS0 0xD6
46#define TC35892_GPIORIS1 0xD7
47#define TC35892_GPIORIS2 0xD8
48#define TC35892_GPIOMIS0 0xD9
49#define TC35892_GPIOMIS1 0xDA
50#define TC35892_GPIOMIS2 0xDB
51#define TC35892_GPIOIC0 0xDC
52#define TC35892_GPIOIC1 0xDD
53#define TC35892_GPIOIC2 0xDE
54
55#define TC35892_GPIODATA0 0xC0
56#define TC35892_GPIOMASK0 0xc1
57#define TC35892_GPIODATA1 0xC2
58#define TC35892_GPIOMASK1 0xc3
59#define TC35892_GPIODATA2 0xC4
60#define TC35892_GPIOMASK2 0xC5
61
62#define TC35892_GPIODIR0 0xC6
63#define TC35892_GPIODIR1 0xC7
64#define TC35892_GPIODIR2 0xC8
65
66#define TC35892_GPIOSYNC0 0xE6
67#define TC35892_GPIOSYNC1 0xE7
68#define TC35892_GPIOSYNC2 0xE8
69
70#define TC35892_GPIOWAKE0 0xE9
71#define TC35892_GPIOWAKE1 0xEA
72#define TC35892_GPIOWAKE2 0xEB
73
74#define TC35892_GPIOODM0 0xE0
75#define TC35892_GPIOODE0 0xE1
76#define TC35892_GPIOODM1 0xE2
77#define TC35892_GPIOODE1 0xE3
78#define TC35892_GPIOODM2 0xE4
79#define TC35892_GPIOODE2 0xE5
80
81#define TC35892_INT_GPIIRQ 0
82#define TC35892_INT_TI0IRQ 1
83#define TC35892_INT_TI1IRQ 2
84#define TC35892_INT_TI2IRQ 3
85#define TC35892_INT_ROTIRQ 5
86#define TC35892_INT_KBDIRQ 6
87#define TC35892_INT_PORIRQ 7
88
89#define TC35892_NR_INTERNAL_IRQS 8
90#define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x))
91
92struct tc35892 {
93 struct mutex lock;
94 struct device *dev;
95 struct i2c_client *i2c;
96
97 int irq_base;
98 int num_gpio;
99 struct tc35892_platform_data *pdata;
100};
101
102extern int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data);
103extern int tc35892_reg_read(struct tc35892 *tc35892, u8 reg);
104extern int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length,
105 u8 *values);
106extern int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length,
107 const u8 *values);
108extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val);
109
110/**
111 * struct tc35892_gpio_platform_data - TC35892 GPIO platform data
112 * @gpio_base: first gpio number assigned to TC35892. A maximum of
113 * %TC35892_NR_GPIOS GPIOs will be allocated.
114 */
115struct tc35892_gpio_platform_data {
116 int gpio_base;
117};
118
119/**
120 * struct tc35892_platform_data - TC35892 platform data
121 * @irq_base: base IRQ number. %TC35892_NR_IRQS irqs will be used.
122 * @gpio: GPIO-specific platform data
123 */
124struct tc35892_platform_data {
125 int irq_base;
126 struct tc35892_gpio_platform_data *gpio;
127};
128
129#define TC35892_NR_GPIOS 24
130#define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS)
131
132#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index c3f7dff8effc..f07425bc3dcd 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -50,17 +50,28 @@
50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \ 50 tmio_iowrite16((val) >> 16, (base) + ((reg + 2) << (shift))); \
51 } while (0) 51 } while (0)
52 52
53/* tmio MMC platform flags */
54#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)
55
53int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); 56int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
54int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); 57int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
55void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state); 58void tmio_core_mmc_pwr(void __iomem *cnf, int shift, int state);
56void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state); 59void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
57 60
61struct tmio_mmc_dma {
62 void *chan_priv_tx;
63 void *chan_priv_rx;
64};
65
58/* 66/*
59 * data for the MMC controller 67 * data for the MMC controller
60 */ 68 */
61struct tmio_mmc_data { 69struct tmio_mmc_data {
62 unsigned int hclk; 70 unsigned int hclk;
63 unsigned long capabilities; 71 unsigned long capabilities;
72 unsigned long flags;
73 u32 ocr_mask; /* available voltages */
74 struct tmio_mmc_dma *dma;
64 void (*set_pwr)(struct platform_device *host, int state); 75 void (*set_pwr)(struct platform_device *host, int state);
65 void (*set_clk_div)(struct platform_device *host, int state); 76 void (*set_clk_div)(struct platform_device *host, int state);
66}; 77};
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
new file mode 100644
index 000000000000..c923e4864f55
--- /dev/null
+++ b/include/linux/mfd/tps6507x.h
@@ -0,0 +1,169 @@
1/* linux/mfd/tps6507x.h
2 *
3 * Functions to access TPS65070 power management chip.
4 *
5 * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com)
6 *
7 *
8 * For licencing details see kernel-base/COPYING
9 */
10
11#ifndef __LINUX_MFD_TPS6507X_H
12#define __LINUX_MFD_TPS6507X_H
13
14/*
15 * ----------------------------------------------------------------------------
16 * Registers, all 8 bits
17 * ----------------------------------------------------------------------------
18 */
19
20
21/* Register definitions */
22#define TPS6507X_REG_PPATH1 0X01
23#define TPS6507X_CHG_USB BIT(7)
24#define TPS6507X_CHG_AC BIT(6)
25#define TPS6507X_CHG_USB_PW_ENABLE BIT(5)
26#define TPS6507X_CHG_AC_PW_ENABLE BIT(4)
27#define TPS6507X_CHG_AC_CURRENT BIT(2)
28#define TPS6507X_CHG_USB_CURRENT BIT(0)
29
30#define TPS6507X_REG_INT 0X02
31#define TPS6507X_REG_MASK_AC_USB BIT(7)
32#define TPS6507X_REG_MASK_TSC BIT(6)
33#define TPS6507X_REG_MASK_PB_IN BIT(5)
34#define TPS6507X_REG_TSC_INT BIT(3)
35#define TPS6507X_REG_PB_IN_INT BIT(2)
36#define TPS6507X_REG_AC_USB_APPLIED BIT(1)
37#define TPS6507X_REG_AC_USB_REMOVED BIT(0)
38
39#define TPS6507X_REG_CHGCONFIG0 0X03
40
41#define TPS6507X_REG_CHGCONFIG1 0X04
42#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
43#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
44#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
45#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
46#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
47
48#define TPS6507X_REG_CHGCONFIG2 0X05
49
50#define TPS6507X_REG_CHGCONFIG3 0X06
51
52#define TPS6507X_REG_ADCONFIG 0X07
53#define TPS6507X_ADCONFIG_AD_ENABLE BIT(7)
54#define TPS6507X_ADCONFIG_START_CONVERSION BIT(6)
55#define TPS6507X_ADCONFIG_CONVERSION_DONE BIT(5)
56#define TPS6507X_ADCONFIG_VREF_ENABLE BIT(4)
57#define TPS6507X_ADCONFIG_INPUT_AD_IN1 0
58#define TPS6507X_ADCONFIG_INPUT_AD_IN2 1
59#define TPS6507X_ADCONFIG_INPUT_AD_IN3 2
60#define TPS6507X_ADCONFIG_INPUT_AD_IN4 3
61#define TPS6507X_ADCONFIG_INPUT_TS_PIN 4
62#define TPS6507X_ADCONFIG_INPUT_BAT_CURRENT 5
63#define TPS6507X_ADCONFIG_INPUT_AC_VOLTAGE 6
64#define TPS6507X_ADCONFIG_INPUT_SYS_VOLTAGE 7
65#define TPS6507X_ADCONFIG_INPUT_CHARGER_VOLTAGE 8
66#define TPS6507X_ADCONFIG_INPUT_BAT_VOLTAGE 9
67#define TPS6507X_ADCONFIG_INPUT_THRESHOLD_VOLTAGE 10
68#define TPS6507X_ADCONFIG_INPUT_ISET1_VOLTAGE 11
69#define TPS6507X_ADCONFIG_INPUT_ISET2_VOLTAGE 12
70#define TPS6507X_ADCONFIG_INPUT_REAL_TSC 14
71#define TPS6507X_ADCONFIG_INPUT_TSC 15
72
73#define TPS6507X_REG_TSCMODE 0X08
74#define TPS6507X_TSCMODE_X_POSITION 0
75#define TPS6507X_TSCMODE_Y_POSITION 1
76#define TPS6507X_TSCMODE_PRESSURE 2
77#define TPS6507X_TSCMODE_X_PLATE 3
78#define TPS6507X_TSCMODE_Y_PLATE 4
79#define TPS6507X_TSCMODE_STANDBY 5
80#define TPS6507X_TSCMODE_ADC_INPUT 6
81#define TPS6507X_TSCMODE_DISABLE 7
82
83#define TPS6507X_REG_ADRESULT_1 0X09
84
85#define TPS6507X_REG_ADRESULT_2 0X0A
86#define TPS6507X_REG_ADRESULT_2_MASK (BIT(1) | BIT(0))
87
88#define TPS6507X_REG_PGOOD 0X0B
89
90#define TPS6507X_REG_PGOODMASK 0X0C
91
92#define TPS6507X_REG_CON_CTRL1 0X0D
93#define TPS6507X_CON_CTRL1_DCDC1_ENABLE BIT(4)
94#define TPS6507X_CON_CTRL1_DCDC2_ENABLE BIT(3)
95#define TPS6507X_CON_CTRL1_DCDC3_ENABLE BIT(2)
96#define TPS6507X_CON_CTRL1_LDO1_ENABLE BIT(1)
97#define TPS6507X_CON_CTRL1_LDO2_ENABLE BIT(0)
98
99#define TPS6507X_REG_CON_CTRL2 0X0E
100
101#define TPS6507X_REG_CON_CTRL3 0X0F
102
103#define TPS6507X_REG_DEFDCDC1 0X10
104#define TPS6507X_DEFDCDC1_DCDC1_EXT_ADJ_EN BIT(7)
105#define TPS6507X_DEFDCDC1_DCDC1_MASK 0X3F
106
107#define TPS6507X_REG_DEFDCDC2_LOW 0X11
108#define TPS6507X_DEFDCDC2_LOW_DCDC2_MASK 0X3F
109
110#define TPS6507X_REG_DEFDCDC2_HIGH 0X12
111#define TPS6507X_DEFDCDC2_HIGH_DCDC2_MASK 0X3F
112
113#define TPS6507X_REG_DEFDCDC3_LOW 0X13
114#define TPS6507X_DEFDCDC3_LOW_DCDC3_MASK 0X3F
115
116#define TPS6507X_REG_DEFDCDC3_HIGH 0X14
117#define TPS6507X_DEFDCDC3_HIGH_DCDC3_MASK 0X3F
118
119#define TPS6507X_REG_DEFSLEW 0X15
120
121#define TPS6507X_REG_LDO_CTRL1 0X16
122#define TPS6507X_REG_LDO_CTRL1_LDO1_MASK 0X0F
123
124#define TPS6507X_REG_DEFLDO2 0X17
125#define TPS6507X_REG_DEFLDO2_LDO2_MASK 0X3F
126
127#define TPS6507X_REG_WLED_CTRL1 0X18
128
129#define TPS6507X_REG_WLED_CTRL2 0X19
130
131/* VDCDC MASK */
132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
133
134#define TPS6507X_MAX_REGISTER 0X19
135
136/**
137 * struct tps6507x_board - packages regulator and touchscreen init data
138 * @tps6507x_regulator_data: regulator initialization values
139 *
140 * Board data may be used to initialize regulator and touchscreen.
141 */
142
143struct tps6507x_board {
144 struct regulator_init_data *tps6507x_pmic_init_data;
145 struct touchscreen_init_data *tps6507x_ts_init_data;
146};
147
148/**
149 * struct tps6507x_dev - tps6507x sub-driver chip access routines
150 * @read_dev() - I2C register read function
151 * @write_dev() - I2C register write function
152 *
153 * Device data may be used to access the TPS6507x chip
154 */
155
156struct tps6507x_dev {
157 struct device *dev;
158 struct i2c_client *i2c_client;
159 int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
160 void *dest);
161 int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
162 void *src);
163
164 /* Client devices */
165 struct tps6507x_pmic *pmic;
166 struct tps6507x_ts *ts;
167};
168
169#endif /* __LINUX_MFD_TPS6507X_H */
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 5915f6e3d9ab..eb5bd4e0e03c 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -256,8 +256,9 @@ struct wm831x {
256 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */ 256 int irq_masks_cache[WM831X_NUM_IRQ_REGS]; /* Cached hardware value */
257 257
258 /* Chip revision based flags */ 258 /* Chip revision based flags */
259 unsigned has_gpio_ena:1; /* Has GPIO enable bit */ 259 unsigned has_gpio_ena:1; /* Has GPIO enable bit */
260 unsigned has_cs_sts:1; /* Has current sink status bit */ 260 unsigned has_cs_sts:1; /* Has current sink status bit */
261 unsigned charger_irq_wake:1; /* Are charger IRQs a wake source? */
261 262
262 int num_gpio; 263 int num_gpio;
263 264
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index d899dc0223ba..a95141eafce3 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -492,6 +492,8 @@
492 */ 492 */
493#define WM8350_JACK_L_LVL 0x0800 493#define WM8350_JACK_L_LVL 0x0800
494#define WM8350_JACK_R_LVL 0x0400 494#define WM8350_JACK_R_LVL 0x0400
495#define WM8350_JACK_MICSCD_LVL 0x0200
496#define WM8350_JACK_MICSD_LVL 0x0100
495 497
496/* 498/*
497 * WM8350 Platform setup 499 * WM8350 Platform setup
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index b06ff2846748..de79baee4925 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -15,14 +15,38 @@
15#ifndef __MFD_WM8994_CORE_H__ 15#ifndef __MFD_WM8994_CORE_H__
16#define __MFD_WM8994_CORE_H__ 16#define __MFD_WM8994_CORE_H__
17 17
18#include <linux/interrupt.h>
19
18struct regulator_dev; 20struct regulator_dev;
19struct regulator_bulk_data; 21struct regulator_bulk_data;
20 22
21#define WM8994_NUM_GPIO_REGS 11 23#define WM8994_NUM_GPIO_REGS 11
22#define WM8994_NUM_LDO_REGS 2 24#define WM8994_NUM_LDO_REGS 2
25#define WM8994_NUM_IRQ_REGS 2
26
27#define WM8994_IRQ_TEMP_SHUT 0
28#define WM8994_IRQ_MIC1_DET 1
29#define WM8994_IRQ_MIC1_SHRT 2
30#define WM8994_IRQ_MIC2_DET 3
31#define WM8994_IRQ_MIC2_SHRT 4
32#define WM8994_IRQ_FLL1_LOCK 5
33#define WM8994_IRQ_FLL2_LOCK 6
34#define WM8994_IRQ_SRC1_LOCK 7
35#define WM8994_IRQ_SRC2_LOCK 8
36#define WM8994_IRQ_AIF1DRC1_SIG_DET 9
37#define WM8994_IRQ_AIF1DRC2_SIG_DET 10
38#define WM8994_IRQ_AIF2DRC_SIG_DET 11
39#define WM8994_IRQ_FIFOS_ERR 12
40#define WM8994_IRQ_WSEQ_DONE 13
41#define WM8994_IRQ_DCS_DONE 14
42#define WM8994_IRQ_TEMP_WARN 15
43
44/* GPIOs in the chip are numbered from 1-11 */
45#define WM8994_IRQ_GPIO(x) (x + WM8994_IRQ_TEMP_WARN)
23 46
24struct wm8994 { 47struct wm8994 {
25 struct mutex io_lock; 48 struct mutex io_lock;
49 struct mutex irq_lock;
26 50
27 struct device *dev; 51 struct device *dev;
28 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 52 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
@@ -33,6 +57,11 @@ struct wm8994 {
33 void *control_data; 57 void *control_data;
34 58
35 int gpio_base; 59 int gpio_base;
60 int irq_base;
61
62 int irq;
63 u16 irq_masks_cur[WM8994_NUM_IRQ_REGS];
64 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
36 65
37 /* Used over suspend/resume */ 66 /* Used over suspend/resume */
38 u16 ldo_regs[WM8994_NUM_LDO_REGS]; 67 u16 ldo_regs[WM8994_NUM_LDO_REGS];
@@ -51,4 +80,26 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
51int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 80int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
52 int count, u16 *buf); 81 int count, u16 *buf);
53 82
83
84/* Helper to save on boilerplate */
85static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
86 irq_handler_t handler, const char *name,
87 void *data)
88{
89 if (!wm8994->irq_base)
90 return -EINVAL;
91 return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
92 IRQF_TRIGGER_RISING, name,
93 data);
94}
95static inline void wm8994_free_irq(struct wm8994 *wm8994, int irq, void *data)
96{
97 if (!wm8994->irq_base)
98 return;
99 free_irq(wm8994->irq_base + irq, data);
100}
101
102int wm8994_irq_init(struct wm8994 *wm8994);
103void wm8994_irq_exit(struct wm8994 *wm8994);
104
54#endif 105#endif
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 70d6a8687dc5..5c51f367c061 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -70,6 +70,7 @@ struct wm8994_pdata {
70 70
71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO]; 71 struct wm8994_ldo_pdata ldo[WM8994_NUM_LDO];
72 72
73 int irq_base; /** Base IRQ number for WM8994, required for IRQs */
73 74
74 int num_drc_cfgs; 75 int num_drc_cfgs;
75 struct wm8994_drc_cfg *drc_cfgs; 76 struct wm8994_drc_cfg *drc_cfgs;
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 7f085c97c799..7238231b8dd4 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -9,7 +9,7 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
9#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
10#define PAGE_MIGRATION 1 10#define PAGE_MIGRATION 1
11 11
12extern int putback_lru_pages(struct list_head *l); 12extern void putback_lru_pages(struct list_head *l);
13extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
14 struct page *, struct page *); 14 struct page *, struct page *);
15extern int migrate_pages(struct list_head *l, new_page_t x, 15extern int migrate_pages(struct list_head *l, new_page_t x,
@@ -19,17 +19,19 @@ extern int fail_migrate_page(struct address_space *,
19 struct page *, struct page *); 19 struct page *, struct page *);
20 20
21extern int migrate_prep(void); 21extern int migrate_prep(void);
22extern int migrate_prep_local(void);
22extern int migrate_vmas(struct mm_struct *mm, 23extern int migrate_vmas(struct mm_struct *mm,
23 const nodemask_t *from, const nodemask_t *to, 24 const nodemask_t *from, const nodemask_t *to,
24 unsigned long flags); 25 unsigned long flags);
25#else 26#else
26#define PAGE_MIGRATION 0 27#define PAGE_MIGRATION 0
27 28
28static inline int putback_lru_pages(struct list_head *l) { return 0; } 29static inline void putback_lru_pages(struct list_head *l) {}
29static inline int migrate_pages(struct list_head *l, new_page_t x, 30static inline int migrate_pages(struct list_head *l, new_page_t x,
30 unsigned long private, int offlining) { return -ENOSYS; } 31 unsigned long private, int offlining) { return -ENOSYS; }
31 32
32static inline int migrate_prep(void) { return -ENOSYS; } 33static inline int migrate_prep(void) { return -ENOSYS; }
34static inline int migrate_prep_local(void) { return -ENOSYS; }
33 35
34static inline int migrate_vmas(struct mm_struct *mm, 36static inline int migrate_vmas(struct mm_struct *mm,
35 const nodemask_t *from, const nodemask_t *to, 37 const nodemask_t *from, const nodemask_t *to,
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 8b5f7cc0fba6..f6c9b7dcb9fd 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -3,6 +3,12 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/major.h> 4#include <linux/major.h>
5 5
6/*
7 * These allocations are managed by device@lanana.org. If you use an
8 * entry that is not in assigned your entry may well be moved and
9 * reassigned, or set dynamic if a fixed value is not justified.
10 */
11
6#define PSMOUSE_MINOR 1 12#define PSMOUSE_MINOR 1
7#define MS_BUSMOUSE_MINOR 2 13#define MS_BUSMOUSE_MINOR 2
8#define ATIXL_BUSMOUSE_MINOR 3 14#define ATIXL_BUSMOUSE_MINOR 3
@@ -30,7 +36,8 @@
30#define HPET_MINOR 228 36#define HPET_MINOR 228
31#define FUSE_MINOR 229 37#define FUSE_MINOR 229
32#define KVM_MINOR 232 38#define KVM_MINOR 232
33#define VHOST_NET_MINOR 233 39#define BTRFS_MINOR 234
40#define AUTOFS_MINOR 235
34#define MISC_DYNAMIC_MINOR 255 41#define MISC_DYNAMIC_MINOR 255
35 42
36struct device; 43struct device;
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index e92d1bfdb330..7a7f9c1e679a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -123,8 +123,8 @@ enum {
123 MLX4_OPCODE_RDMA_READ = 0x10, 123 MLX4_OPCODE_RDMA_READ = 0x10,
124 MLX4_OPCODE_ATOMIC_CS = 0x11, 124 MLX4_OPCODE_ATOMIC_CS = 0x11,
125 MLX4_OPCODE_ATOMIC_FA = 0x12, 125 MLX4_OPCODE_ATOMIC_FA = 0x12,
126 MLX4_OPCODE_ATOMIC_MASK_CS = 0x14, 126 MLX4_OPCODE_MASKED_ATOMIC_CS = 0x14,
127 MLX4_OPCODE_ATOMIC_MASK_FA = 0x15, 127 MLX4_OPCODE_MASKED_ATOMIC_FA = 0x15,
128 MLX4_OPCODE_BIND_MW = 0x18, 128 MLX4_OPCODE_BIND_MW = 0x18,
129 MLX4_OPCODE_FMR = 0x19, 129 MLX4_OPCODE_FMR = 0x19,
130 MLX4_OPCODE_LOCAL_INVAL = 0x1b, 130 MLX4_OPCODE_LOCAL_INVAL = 0x1b,
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 9f29d86e5dc9..7abe64326f72 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -285,6 +285,13 @@ struct mlx4_wqe_atomic_seg {
285 __be64 compare; 285 __be64 compare;
286}; 286};
287 287
288struct mlx4_wqe_masked_atomic_seg {
289 __be64 swap_add;
290 __be64 compare;
291 __be64 swap_add_mask;
292 __be64 compare_mask;
293};
294
288struct mlx4_wqe_data_seg { 295struct mlx4_wqe_data_seg {
289 __be32 byte_count; 296 __be32 byte_count;
290 __be32 lkey; 297 __be32 lkey;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 462acaf36f3a..709f6728fc90 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -13,13 +13,13 @@
13#include <linux/debug_locks.h> 13#include <linux/debug_locks.h>
14#include <linux/mm_types.h> 14#include <linux/mm_types.h>
15#include <linux/range.h> 15#include <linux/range.h>
16#include <linux/pfn.h>
16 17
17struct mempolicy; 18struct mempolicy;
18struct anon_vma; 19struct anon_vma;
19struct file_ra_state; 20struct file_ra_state;
20struct user_struct; 21struct user_struct;
21struct writeback_control; 22struct writeback_control;
22struct rlimit;
23 23
24#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 24#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
25extern unsigned long max_mapnr; 25extern unsigned long max_mapnr;
@@ -107,6 +107,9 @@ extern unsigned int kobjsize(const void *objp);
107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 107#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */
108#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ 108#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
109 109
110/* Bits set in the VMA until the stack is in its final location */
111#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
112
110#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 113#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
111#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 114#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
112#endif 115#endif
@@ -335,6 +338,7 @@ void put_page(struct page *page);
335void put_pages_list(struct list_head *pages); 338void put_pages_list(struct list_head *pages);
336 339
337void split_page(struct page *page, unsigned int order); 340void split_page(struct page *page, unsigned int order);
341int split_free_page(struct page *page);
338 342
339/* 343/*
340 * Compound pages have a destructor function. Provide a 344 * Compound pages have a destructor function. Provide a
@@ -592,7 +596,7 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
592 596
593static __always_inline void *lowmem_page_address(struct page *page) 597static __always_inline void *lowmem_page_address(struct page *page)
594{ 598{
595 return __va(page_to_pfn(page) << PAGE_SHIFT); 599 return __va(PFN_PHYS(page_to_pfn(page)));
596} 600}
597 601
598#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) 602#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
@@ -811,6 +815,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
811} 815}
812 816
813extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new); 817extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
818extern void truncate_setsize(struct inode *inode, loff_t newsize);
814extern int vmtruncate(struct inode *inode, loff_t offset); 819extern int vmtruncate(struct inode *inode, loff_t offset);
815extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end); 820extern int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end);
816 821
@@ -995,7 +1000,7 @@ static inline void sync_mm_rss(struct task_struct *task, struct mm_struct *mm)
995 * querying the cache size, so a fastpath for that case is appropriate. 1000 * querying the cache size, so a fastpath for that case is appropriate.
996 */ 1001 */
997struct shrinker { 1002struct shrinker {
998 int (*shrink)(int nr_to_scan, gfp_t gfp_mask); 1003 int (*shrink)(struct shrinker *, int nr_to_scan, gfp_t gfp_mask);
999 int seeks; /* seeks to recreate an obj */ 1004 int seeks; /* seeks to recreate an obj */
1000 1005
1001 /* These are for internal use */ 1006 /* These are for internal use */
@@ -1449,9 +1454,6 @@ int vmemmap_populate_basepages(struct page *start_page,
1449int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1454int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1450void vmemmap_populate_print_last(void); 1455void vmemmap_populate_print_last(void);
1451 1456
1452extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1453 size_t size);
1454extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1455 1457
1456enum mf_flags { 1458enum mf_flags {
1457 MF_COUNT_INCREASED = 1 << 0, 1459 MF_COUNT_INCREASED = 1 << 0,
@@ -1464,6 +1466,14 @@ extern int sysctl_memory_failure_recovery;
1464extern void shake_page(struct page *p, int access); 1466extern void shake_page(struct page *p, int access);
1465extern atomic_long_t mce_bad_pages; 1467extern atomic_long_t mce_bad_pages;
1466extern int soft_offline_page(struct page *page, int flags); 1468extern int soft_offline_page(struct page *page, int flags);
1469#ifdef CONFIG_MEMORY_FAILURE
1470int is_hwpoison_address(unsigned long addr);
1471#else
1472static inline int is_hwpoison_address(unsigned long addr)
1473{
1474 return 0;
1475}
1476#endif
1467 1477
1468extern void dump_page(struct page *page); 1478extern void dump_page(struct page *page);
1469 1479
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index d02d2c6e0cfe..4d893eaf8174 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -24,6 +24,7 @@ struct mmc_cid {
24}; 24};
25 25
26struct mmc_csd { 26struct mmc_csd {
27 unsigned char structure;
27 unsigned char mmca_vsn; 28 unsigned char mmca_vsn;
28 unsigned short cmdclass; 29 unsigned short cmdclass;
29 unsigned short tacc_clks; 30 unsigned short tacc_clks;
@@ -92,6 +93,7 @@ struct mmc_card {
92#define MMC_TYPE_MMC 0 /* MMC card */ 93#define MMC_TYPE_MMC 0 /* MMC card */
93#define MMC_TYPE_SD 1 /* SD card */ 94#define MMC_TYPE_SD 1 /* SD card */
94#define MMC_TYPE_SDIO 2 /* SDIO card */ 95#define MMC_TYPE_SDIO 2 /* SDIO card */
96#define MMC_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */
95 unsigned int state; /* (our) card state */ 97 unsigned int state; /* (our) card state */
96#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ 98#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
97#define MMC_STATE_READONLY (1<<1) /* card is read-only */ 99#define MMC_STATE_READONLY (1<<1) /* card is read-only */
@@ -101,6 +103,8 @@ struct mmc_card {
101#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 103#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
102#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 104#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
103 /* for byte mode */ 105 /* for byte mode */
106#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
107 /* (missing CIA registers) */
104 108
105 u32 raw_cid[4]; /* raw card CID */ 109 u32 raw_cid[4]; /* raw card CID */
106 u32 raw_csd[4]; /* raw card CSD */ 110 u32 raw_csd[4]; /* raw card CSD */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 43eaf5ca5848..513ff0376b09 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -108,6 +108,9 @@ struct mmc_host_ops {
108 int (*get_cd)(struct mmc_host *host); 108 int (*get_cd)(struct mmc_host *host);
109 109
110 void (*enable_sdio_irq)(struct mmc_host *host, int enable); 110 void (*enable_sdio_irq)(struct mmc_host *host, int enable);
111
112 /* optional callback for HC quirks */
113 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
111}; 114};
112 115
113struct mmc_card; 116struct mmc_card;
@@ -121,6 +124,7 @@ struct mmc_host {
121 unsigned int f_min; 124 unsigned int f_min;
122 unsigned int f_max; 125 unsigned int f_max;
123 u32 ocr_avail; 126 u32 ocr_avail;
127 struct notifier_block pm_notify;
124 128
125#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ 129#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
126#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ 130#define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */
@@ -180,6 +184,7 @@ struct mmc_host {
180 184
181 /* Only used with MMC_CAP_DISABLE */ 185 /* Only used with MMC_CAP_DISABLE */
182 int enabled; /* host is enabled */ 186 int enabled; /* host is enabled */
187 int rescan_disable; /* disable card detection */
183 int nesting_cnt; /* "enable" nesting count */ 188 int nesting_cnt; /* "enable" nesting count */
184 int en_dis_recurs; /* detect recursion */ 189 int en_dis_recurs; /* detect recursion */
185 unsigned int disable_delay; /* disable delay in msecs */ 190 unsigned int disable_delay; /* disable delay in msecs */
@@ -227,7 +232,7 @@ static inline void *mmc_priv(struct mmc_host *host)
227#define mmc_classdev(x) (&(x)->class_dev) 232#define mmc_classdev(x) (&(x)->class_dev)
228#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 233#define mmc_hostname(x) (dev_name(&(x)->class_dev))
229 234
230extern int mmc_suspend_host(struct mmc_host *, pm_message_t); 235extern int mmc_suspend_host(struct mmc_host *);
231extern int mmc_resume_host(struct mmc_host *); 236extern int mmc_resume_host(struct mmc_host *);
232 237
233extern void mmc_power_save_host(struct mmc_host *host); 238extern void mmc_power_save_host(struct mmc_host *host);
@@ -254,6 +259,7 @@ int mmc_card_can_sleep(struct mmc_host *host);
254int mmc_host_enable(struct mmc_host *host); 259int mmc_host_enable(struct mmc_host *host);
255int mmc_host_disable(struct mmc_host *host); 260int mmc_host_disable(struct mmc_host *host);
256int mmc_host_lazy_disable(struct mmc_host *host); 261int mmc_host_lazy_disable(struct mmc_host *host);
262int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
257 263
258static inline void mmc_set_disable_delay(struct mmc_host *host, 264static inline void mmc_set_disable_delay(struct mmc_host *host,
259 unsigned int disable_delay) 265 unsigned int disable_delay)
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 8a49cbf0376d..52ce98866287 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -254,6 +254,7 @@ struct _mmc_csd {
254#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 254#define EXT_CSD_BUS_WIDTH 183 /* R/W */
255#define EXT_CSD_HS_TIMING 185 /* R/W */ 255#define EXT_CSD_HS_TIMING 185 /* R/W */
256#define EXT_CSD_CARD_TYPE 196 /* RO */ 256#define EXT_CSD_CARD_TYPE 196 /* RO */
257#define EXT_CSD_STRUCTURE 194 /* RO */
257#define EXT_CSD_REV 192 /* RO */ 258#define EXT_CSD_REV 192 /* RO */
258#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 259#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
259#define EXT_CSD_S_A_TIMEOUT 217 260#define EXT_CSD_S_A_TIMEOUT 217
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
new file mode 100644
index 000000000000..9188c973f3e1
--- /dev/null
+++ b/include/linux/mmc/sdhci-spear.h
@@ -0,0 +1,42 @@
1/*
2 * include/linux/mmc/sdhci-spear.h
3 *
4 * SDHCI declarations specific to ST SPEAr platform
5 *
6 * Copyright (C) 2010 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef MMC_SDHCI_SPEAR_H
15#define MMC_SDHCI_SPEAR_H
16
17#include <linux/platform_device.h>
18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure
20 *
21 * @card_power_gpio: gpio pin for enabling/disabling power to sdhci socket
22 * @power_active_high: if set, enable power to sdhci socket by setting
23 * card_power_gpio
24 * @power_always_enb: If set, then enable power on probe, otherwise enable only
25 * on card insertion and disable on card removal.
26 * card_int_gpio: gpio pin used for card detection
27 */
28struct sdhci_plat_data {
29 int card_power_gpio;
30 int power_active_high;
31 int power_always_enb;
32 int card_int_gpio;
33};
34
35/* This function is used to set platform_data field of pdev->dev */
36static inline void
37sdhci_set_plat_data(struct platform_device *pdev, struct sdhci_plat_data *data)
38{
39 pdev->dev.platform_data = data;
40}
41
42#endif /* MMC_SDHCI_SPEAR_H */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 0ebaef577ff5..329a8faa6e37 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -94,6 +94,8 @@
94 94
95#define SDIO_BUS_WIDTH_1BIT 0x00 95#define SDIO_BUS_WIDTH_1BIT 0x00
96#define SDIO_BUS_WIDTH_4BIT 0x02 96#define SDIO_BUS_WIDTH_4BIT 0x02
97#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
98#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
97 99
98#define SDIO_BUS_ASYNC_INT 0x20 100#define SDIO_BUS_ASYNC_INT 0x20
99 101
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index c6c0cceba5fe..31baaf82f458 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -145,6 +145,9 @@ extern void sdio_writew(struct sdio_func *func, u16 b,
145extern void sdio_writel(struct sdio_func *func, u32 b, 145extern void sdio_writel(struct sdio_func *func, u32 b,
146 unsigned int addr, int *err_ret); 146 unsigned int addr, int *err_ret);
147 147
148extern u8 sdio_writeb_readb(struct sdio_func *func, u8 write_byte,
149 unsigned int addr, int *err_ret);
150
148extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr, 151extern int sdio_memcpy_toio(struct sdio_func *func, unsigned int addr,
149 void *src, int count); 152 void *src, int count);
150extern int sdio_writesb(struct sdio_func *func, unsigned int addr, 153extern int sdio_writesb(struct sdio_func *func, unsigned int addr,
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
new file mode 100644
index 000000000000..d4a2ebbdab4b
--- /dev/null
+++ b/include/linux/mmc/sh_mmcif.h
@@ -0,0 +1,200 @@
1/*
2 * include/linux/mmc/sh_mmcif.h
3 *
4 * platform data for eMMC driver
5 *
6 * Copyright (C) 2010 Renesas Solutions Corp.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License.
11 *
12 */
13
14#ifndef __SH_MMCIF_H__
15#define __SH_MMCIF_H__
16
17#include <linux/platform_device.h>
18#include <linux/io.h>
19
20/*
21 * MMCIF : CE_CLK_CTRL [19:16]
22 * 1000 : Peripheral clock / 512
23 * 0111 : Peripheral clock / 256
24 * 0110 : Peripheral clock / 128
25 * 0101 : Peripheral clock / 64
26 * 0100 : Peripheral clock / 32
27 * 0011 : Peripheral clock / 16
28 * 0010 : Peripheral clock / 8
29 * 0001 : Peripheral clock / 4
30 * 0000 : Peripheral clock / 2
31 * 1111 : Peripheral clock (sup_pclk set '1')
32 */
33
34struct sh_mmcif_plat_data {
35 void (*set_pwr)(struct platform_device *pdev, int state);
36 void (*down_pwr)(struct platform_device *pdev);
37 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
38 unsigned long caps;
39 u32 ocr;
40};
41
42#define MMCIF_CE_CMD_SET 0x00000000
43#define MMCIF_CE_ARG 0x00000008
44#define MMCIF_CE_ARG_CMD12 0x0000000C
45#define MMCIF_CE_CMD_CTRL 0x00000010
46#define MMCIF_CE_BLOCK_SET 0x00000014
47#define MMCIF_CE_CLK_CTRL 0x00000018
48#define MMCIF_CE_BUF_ACC 0x0000001C
49#define MMCIF_CE_RESP3 0x00000020
50#define MMCIF_CE_RESP2 0x00000024
51#define MMCIF_CE_RESP1 0x00000028
52#define MMCIF_CE_RESP0 0x0000002C
53#define MMCIF_CE_RESP_CMD12 0x00000030
54#define MMCIF_CE_DATA 0x00000034
55#define MMCIF_CE_INT 0x00000040
56#define MMCIF_CE_INT_MASK 0x00000044
57#define MMCIF_CE_HOST_STS1 0x00000048
58#define MMCIF_CE_HOST_STS2 0x0000004C
59#define MMCIF_CE_VERSION 0x0000007C
60
61extern inline u32 sh_mmcif_readl(void __iomem *addr, int reg)
62{
63 return readl(addr + reg);
64}
65
66extern inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
67{
68 writel(val, addr + reg);
69}
70
71#define SH_MMCIF_BBS 512 /* boot block size */
72
73extern inline void sh_mmcif_boot_cmd_send(void __iomem *base,
74 unsigned long cmd, unsigned long arg)
75{
76 sh_mmcif_writel(base, MMCIF_CE_INT, 0);
77 sh_mmcif_writel(base, MMCIF_CE_ARG, arg);
78 sh_mmcif_writel(base, MMCIF_CE_CMD_SET, cmd);
79}
80
81extern inline int sh_mmcif_boot_cmd_poll(void __iomem *base, unsigned long mask)
82{
83 unsigned long tmp;
84 int cnt;
85
86 for (cnt = 0; cnt < 1000000; cnt++) {
87 tmp = sh_mmcif_readl(base, MMCIF_CE_INT);
88 if (tmp & mask) {
89 sh_mmcif_writel(base, MMCIF_CE_INT, tmp & ~mask);
90 return 0;
91 }
92 }
93
94 return -1;
95}
96
97extern inline int sh_mmcif_boot_cmd(void __iomem *base,
98 unsigned long cmd, unsigned long arg)
99{
100 sh_mmcif_boot_cmd_send(base, cmd, arg);
101 return sh_mmcif_boot_cmd_poll(base, 0x00010000);
102}
103
104extern inline int sh_mmcif_boot_do_read_single(void __iomem *base,
105 unsigned int block_nr,
106 unsigned long *buf)
107{
108 int k;
109
110 /* CMD13 - Status */
111 sh_mmcif_boot_cmd(base, 0x0d400000, 0x00010000);
112
113 if (sh_mmcif_readl(base, MMCIF_CE_RESP0) != 0x0900)
114 return -1;
115
116 /* CMD17 - Read */
117 sh_mmcif_boot_cmd(base, 0x11480000, block_nr * SH_MMCIF_BBS);
118 if (sh_mmcif_boot_cmd_poll(base, 0x00100000) < 0)
119 return -1;
120
121 for (k = 0; k < (SH_MMCIF_BBS / 4); k++)
122 buf[k] = sh_mmcif_readl(base, MMCIF_CE_DATA);
123
124 return 0;
125}
126
127extern inline int sh_mmcif_boot_do_read(void __iomem *base,
128 unsigned long first_block,
129 unsigned long nr_blocks,
130 void *buf)
131{
132 unsigned long k;
133 int ret = 0;
134
135 /* CMD16 - Set the block size */
136 sh_mmcif_boot_cmd(base, 0x10400000, SH_MMCIF_BBS);
137
138 for (k = 0; !ret && k < nr_blocks; k++)
139 ret = sh_mmcif_boot_do_read_single(base, first_block + k,
140 buf + (k * SH_MMCIF_BBS));
141
142 return ret;
143}
144
145extern inline void sh_mmcif_boot_init(void __iomem *base)
146{
147 unsigned long tmp;
148
149 /* reset */
150 tmp = sh_mmcif_readl(base, MMCIF_CE_VERSION);
151 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp | 0x80000000);
152 sh_mmcif_writel(base, MMCIF_CE_VERSION, tmp & ~0x80000000);
153
154 /* byte swap */
155 sh_mmcif_writel(base, MMCIF_CE_BUF_ACC, 0x00010000);
156
157 /* Set block size in MMCIF hardware */
158 sh_mmcif_writel(base, MMCIF_CE_BLOCK_SET, SH_MMCIF_BBS);
159
160 /* Enable the clock, set it to Bus clock/256 (about 325Khz)*/
161 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01072fff);
162
163 /* CMD0 */
164 sh_mmcif_boot_cmd(base, 0x00000040, 0);
165
166 /* CMD1 - Get OCR */
167 do {
168 sh_mmcif_boot_cmd(base, 0x01405040, 0x40300000); /* CMD1 */
169 } while ((sh_mmcif_readl(base, MMCIF_CE_RESP0) & 0x80000000)
170 != 0x80000000);
171
172 /* CMD2 - Get CID */
173 sh_mmcif_boot_cmd(base, 0x02806040, 0);
174
175 /* CMD3 - Set card relative address */
176 sh_mmcif_boot_cmd(base, 0x03400040, 0x00010000);
177}
178
179extern inline void sh_mmcif_boot_slurp(void __iomem *base,
180 unsigned char *buf,
181 unsigned long no_bytes)
182{
183 unsigned long tmp;
184
185 /* In data transfer mode: Set clock to Bus clock/4 (about 20Mhz) */
186 sh_mmcif_writel(base, MMCIF_CE_CLK_CTRL, 0x01012fff);
187
188 /* CMD9 - Get CSD */
189 sh_mmcif_boot_cmd(base, 0x09806000, 0x00010000);
190
191 /* CMD7 - Select the card */
192 sh_mmcif_boot_cmd(base, 0x07400000, 0x00010000);
193
194 tmp = no_bytes / SH_MMCIF_BBS;
195 tmp += (no_bytes % SH_MMCIF_BBS) ? 1 : 0;
196
197 sh_mmcif_boot_do_read(base, 512, tmp, buf);
198}
199
200#endif /* __SH_MMCIF_H__ */
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index ee24ef8ab616..c04ecfe03f7f 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -4,7 +4,7 @@
4#ifdef CONFIG_DEBUG_VM 4#ifdef CONFIG_DEBUG_VM
5#define VM_BUG_ON(cond) BUG_ON(cond) 5#define VM_BUG_ON(cond) BUG_ON(cond)
6#else 6#else
7#define VM_BUG_ON(cond) do { } while (0) 7#define VM_BUG_ON(cond) do { (void)(cond); } while (0)
8#endif 8#endif
9 9
10#ifdef CONFIG_DEBUG_VIRTUAL 10#ifdef CONFIG_DEBUG_VIRTUAL
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index cf9e458e96b0..6e6e62648a4d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -321,6 +321,15 @@ struct zone {
321 unsigned long *pageblock_flags; 321 unsigned long *pageblock_flags;
322#endif /* CONFIG_SPARSEMEM */ 322#endif /* CONFIG_SPARSEMEM */
323 323
324#ifdef CONFIG_COMPACTION
325 /*
326 * On compaction failure, 1<<compact_defer_shift compactions
327 * are skipped before trying again. The number attempted since
328 * last failure is tracked with compact_considered.
329 */
330 unsigned int compact_considered;
331 unsigned int compact_defer_shift;
332#endif
324 333
325 ZONE_PADDING(_pad1_) 334 ZONE_PADDING(_pad1_)
326 335
@@ -339,21 +348,6 @@ struct zone {
339 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; 348 atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
340 349
341 /* 350 /*
342 * prev_priority holds the scanning priority for this zone. It is
343 * defined as the scanning priority at which we achieved our reclaim
344 * target at the previous try_to_free_pages() or balance_pgdat()
345 * invocation.
346 *
347 * We use prev_priority as a measure of how much stress page reclaim is
348 * under - it drives the swappiness decision: whether to unmap mapped
349 * pages.
350 *
351 * Access to both this field is quite racy even on uniprocessor. But
352 * it is expected to average out OK.
353 */
354 int prev_priority;
355
356 /*
357 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on 351 * The target ratio of ACTIVE_ANON to INACTIVE_ANON pages on
358 * this zone's LRU. Maintained by the pageout code. 352 * this zone's LRU. Maintained by the pageout code.
359 */ 353 */
@@ -641,9 +635,8 @@ typedef struct pglist_data {
641 635
642#include <linux/memory_hotplug.h> 636#include <linux/memory_hotplug.h>
643 637
644void get_zone_counts(unsigned long *active, unsigned long *inactive, 638extern struct mutex zonelists_mutex;
645 unsigned long *free); 639void build_all_zonelists(void *data);
646void build_all_zonelists(void);
647void wakeup_kswapd(struct zone *zone, int order); 640void wakeup_kswapd(struct zone *zone, int order);
648int zone_watermark_ok(struct zone *z, int order, unsigned long mark, 641int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
649 int classzone_idx, int alloc_flags); 642 int classzone_idx, int alloc_flags);
@@ -661,6 +654,12 @@ void memory_present(int nid, unsigned long start, unsigned long end);
661static inline void memory_present(int nid, unsigned long start, unsigned long end) {} 654static inline void memory_present(int nid, unsigned long start, unsigned long end) {}
662#endif 655#endif
663 656
657#ifdef CONFIG_HAVE_MEMORYLESS_NODES
658int local_memory_node(int node_id);
659#else
660static inline int local_memory_node(int node_id) { return node_id; };
661#endif
662
664#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE 663#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE
665unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); 664unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
666#endif 665#endif
@@ -972,7 +971,7 @@ struct mem_section {
972#endif 971#endif
973 972
974#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT) 973#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT)
975#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT) 974#define NR_SECTION_ROOTS DIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)
976#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1) 975#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
977 976
978#ifdef CONFIG_SPARSEMEM_EXTREME 977#ifdef CONFIG_SPARSEMEM_EXTREME
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index f58e9d836f32..48c007dae476 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -474,4 +474,46 @@ struct platform_device_id {
474 __attribute__((aligned(sizeof(kernel_ulong_t)))); 474 __attribute__((aligned(sizeof(kernel_ulong_t))));
475}; 475};
476 476
477#define MDIO_MODULE_PREFIX "mdio:"
478
479#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d"
480#define MDIO_ID_ARGS(_id) \
481 (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \
482 ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \
483 ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \
484 ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
485 ((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \
486 ((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \
487 ((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \
488 ((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1
489
490/**
491 * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus
492 * @phy_id: The result of
493 * (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask
494 * for this PHY type
495 * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0
496 * is used to terminate an array of struct mdio_device_id.
497 */
498struct mdio_device_id {
499 __u32 phy_id;
500 __u32 phy_id_mask;
501};
502
503struct zorro_device_id {
504 __u32 id; /* Device ID or ZORRO_WILDCARD */
505 kernel_ulong_t driver_data; /* Data private to the driver */
506};
507
508#define ZORRO_WILDCARD (0xffffffff) /* not official */
509
510#define ZORRO_DEVICE_MODALIAS_FMT "zorro:i%08X"
511
512#define ISAPNP_ANY_ID 0xffff
513struct isapnp_device_id {
514 unsigned short card_vendor, card_device;
515 unsigned short vendor, function;
516 kernel_ulong_t driver_data; /* data private to the driver */
517};
518
477#endif /* LINUX_MOD_DEVICETABLE_H */ 519#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index 515d53ae6a79..8a6b9fdc7ffa 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -181,6 +181,13 @@ void *__symbol_get(const char *symbol);
181void *__symbol_get_gpl(const char *symbol); 181void *__symbol_get_gpl(const char *symbol);
182#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x))) 182#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x)))
183 183
184/* modules using other modules: kdb wants to see this. */
185struct module_use {
186 struct list_head source_list;
187 struct list_head target_list;
188 struct module *source, *target;
189};
190
184#ifndef __GENKSYMS__ 191#ifndef __GENKSYMS__
185#ifdef CONFIG_MODVERSIONS 192#ifdef CONFIG_MODVERSIONS
186/* Mark the CRC weak since genksyms apparently decides not to 193/* Mark the CRC weak since genksyms apparently decides not to
@@ -359,7 +366,9 @@ struct module
359 366
360#ifdef CONFIG_MODULE_UNLOAD 367#ifdef CONFIG_MODULE_UNLOAD
361 /* What modules depend on me? */ 368 /* What modules depend on me? */
362 struct list_head modules_which_use_me; 369 struct list_head source_list;
370 /* What modules do I depend on? */
371 struct list_head target_list;
363 372
364 /* Who is waiting for us to be unloaded */ 373 /* Who is waiting for us to be unloaded */
365 struct task_struct *waiter; 374 struct task_struct *waiter;
@@ -465,8 +474,7 @@ static inline void __module_get(struct module *module)
465 if (module) { 474 if (module) {
466 preempt_disable(); 475 preempt_disable();
467 __this_cpu_inc(module->refptr->incs); 476 __this_cpu_inc(module->refptr->incs);
468 trace_module_get(module, _THIS_IP_, 477 trace_module_get(module, _THIS_IP_);
469 __this_cpu_read(module->refptr->incs));
470 preempt_enable(); 478 preempt_enable();
471 } 479 }
472} 480}
@@ -480,8 +488,7 @@ static inline int try_module_get(struct module *module)
480 488
481 if (likely(module_is_live(module))) { 489 if (likely(module_is_live(module))) {
482 __this_cpu_inc(module->refptr->incs); 490 __this_cpu_inc(module->refptr->incs);
483 trace_module_get(module, _THIS_IP_, 491 trace_module_get(module, _THIS_IP_);
484 __this_cpu_read(module->refptr->incs));
485 } else 492 } else
486 ret = 0; 493 ret = 0;
487 494
@@ -665,43 +672,10 @@ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
665 672
666#endif /* CONFIG_MODULES */ 673#endif /* CONFIG_MODULES */
667 674
668struct device_driver;
669#ifdef CONFIG_SYSFS 675#ifdef CONFIG_SYSFS
670struct module;
671
672extern struct kset *module_kset; 676extern struct kset *module_kset;
673extern struct kobj_type module_ktype; 677extern struct kobj_type module_ktype;
674extern int module_sysfs_initialized; 678extern int module_sysfs_initialized;
675
676int mod_sysfs_init(struct module *mod);
677int mod_sysfs_setup(struct module *mod,
678 struct kernel_param *kparam,
679 unsigned int num_params);
680int module_add_modinfo_attrs(struct module *mod);
681void module_remove_modinfo_attrs(struct module *mod);
682
683#else /* !CONFIG_SYSFS */
684
685static inline int mod_sysfs_init(struct module *mod)
686{
687 return 0;
688}
689
690static inline int mod_sysfs_setup(struct module *mod,
691 struct kernel_param *kparam,
692 unsigned int num_params)
693{
694 return 0;
695}
696
697static inline int module_add_modinfo_attrs(struct module *mod)
698{
699 return 0;
700}
701
702static inline void module_remove_modinfo_attrs(struct module *mod)
703{ }
704
705#endif /* CONFIG_SYSFS */ 679#endif /* CONFIG_SYSFS */
706 680
707#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 681#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4bd05474d11d..907210bd9f9c 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -56,7 +56,11 @@ struct vfsmount {
56 struct list_head mnt_mounts; /* list of children, anchored here */ 56 struct list_head mnt_mounts; /* list of children, anchored here */
57 struct list_head mnt_child; /* and going through their mnt_child */ 57 struct list_head mnt_child; /* and going through their mnt_child */
58 int mnt_flags; 58 int mnt_flags;
59 /* 4 bytes hole on 64bits arches */ 59 /* 4 bytes hole on 64bits arches without fsnotify */
60#ifdef CONFIG_FSNOTIFY
61 __u32 mnt_fsnotify_mask;
62 struct hlist_head mnt_fsnotify_marks;
63#endif
60 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 64 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
61 struct list_head mnt_list; 65 struct list_head mnt_list;
62 struct list_head mnt_expire; /* link in fs-specific expiry list */ 66 struct list_head mnt_expire; /* link in fs-specific expiry list */
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index c5f3d53548e2..fa04b246c9ae 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -27,7 +27,8 @@
27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */ 27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */ 28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */ 29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */ 30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
31#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
31 32
32#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */ 33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
33#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1) 34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
@@ -191,10 +192,7 @@ struct vif_device {
191#define VIFF_STATIC 0x8000 192#define VIFF_STATIC 0x8000
192 193
193struct mfc_cache { 194struct mfc_cache {
194 struct mfc_cache *next; /* Next entry on cache line */ 195 struct list_head list;
195#ifdef CONFIG_NET_NS
196 struct net *mfc_net;
197#endif
198 __be32 mfc_mcastgrp; /* Group the entry belongs to */ 196 __be32 mfc_mcastgrp; /* Group the entry belongs to */
199 __be32 mfc_origin; /* Source of packet */ 197 __be32 mfc_origin; /* Source of packet */
200 vifi_t mfc_parent; /* Source interface */ 198 vifi_t mfc_parent; /* Source interface */
@@ -217,18 +215,6 @@ struct mfc_cache {
217 } mfc_un; 215 } mfc_un;
218}; 216};
219 217
220static inline
221struct net *mfc_net(const struct mfc_cache *mfc)
222{
223 return read_pnet(&mfc->mfc_net);
224}
225
226static inline
227void mfc_net_set(struct mfc_cache *mfc, struct net *net)
228{
229 write_pnet(&mfc->mfc_net, hold_net(net));
230}
231
232#define MFC_STATIC 1 218#define MFC_STATIC 1
233#define MFC_NOTIFY 2 219#define MFC_NOTIFY 2
234 220
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 2caa1a8e525d..6091ab77f388 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -24,7 +24,8 @@
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ 24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ 25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ 26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ 27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
28 29
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ 30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) 31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
@@ -182,10 +183,7 @@ struct mif_device {
182#define VIFF_STATIC 0x8000 183#define VIFF_STATIC 0x8000
183 184
184struct mfc6_cache { 185struct mfc6_cache {
185 struct mfc6_cache *next; /* Next entry on cache line */ 186 struct list_head list;
186#ifdef CONFIG_NET_NS
187 struct net *mfc6_net;
188#endif
189 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 187 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
190 struct in6_addr mf6c_origin; /* Source of packet */ 188 struct in6_addr mf6c_origin; /* Source of packet */
191 mifi_t mf6c_parent; /* Source interface */ 189 mifi_t mf6c_parent; /* Source interface */
@@ -208,18 +206,6 @@ struct mfc6_cache {
208 } mfc_un; 206 } mfc_un;
209}; 207};
210 208
211static inline
212struct net *mfc6_net(const struct mfc6_cache *mfc)
213{
214 return read_pnet(&mfc->mfc6_net);
215}
216
217static inline
218void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
219{
220 write_pnet(&mfc->mfc6_net, hold_net(net));
221}
222
223#define MFC_STATIC 1 209#define MFC_STATIC 1
224#define MFC_NOTIFY 2 210#define MFC_NOTIFY 2
225 211
@@ -244,14 +230,17 @@ extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
244 struct rtmsg *rtm, int nowait); 230 struct rtmsg *rtm, int nowait);
245 231
246#ifdef CONFIG_IPV6_MROUTE 232#ifdef CONFIG_IPV6_MROUTE
247static inline struct sock *mroute6_socket(struct net *net) 233extern struct sock *mroute6_socket(struct net *net, struct sk_buff *skb);
248{
249 return net->ipv6.mroute6_sk;
250}
251extern int ip6mr_sk_done(struct sock *sk); 234extern int ip6mr_sk_done(struct sock *sk);
252#else 235#else
253static inline struct sock *mroute6_socket(struct net *net) { return NULL; } 236static inline struct sock *mroute6_socket(struct net *net, struct sk_buff *skb)
254static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 237{
238 return NULL;
239}
240static inline int ip6mr_sk_done(struct sock *sk)
241{
242 return 0;
243}
255#endif 244#endif
256#endif 245#endif
257 246
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 6991ab5b24d1..91b05c171854 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -14,8 +14,10 @@ struct irq_desc;
14extern void mask_msi_irq(unsigned int irq); 14extern void mask_msi_irq(unsigned int irq);
15extern void unmask_msi_irq(unsigned int irq); 15extern void unmask_msi_irq(unsigned int irq);
16extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 16extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
17extern void get_cached_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
17extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); 18extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
18extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); 19extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
20extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
19extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); 21extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
20 22
21struct msi_desc { 23struct msi_desc {
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
new file mode 100644
index 000000000000..d11fe0f2f956
--- /dev/null
+++ b/include/linux/msm_mdp.h
@@ -0,0 +1,78 @@
1/* include/linux/msm_mdp.h
2 *
3 * Copyright (C) 2007 Google Incorporated
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef _MSM_MDP_H_
15#define _MSM_MDP_H_
16
17#include <linux/types.h>
18
19#define MSMFB_IOCTL_MAGIC 'm'
20#define MSMFB_GRP_DISP _IOW(MSMFB_IOCTL_MAGIC, 1, unsigned int)
21#define MSMFB_BLIT _IOW(MSMFB_IOCTL_MAGIC, 2, unsigned int)
22
23enum {
24 MDP_RGB_565, /* RGB 565 planar */
25 MDP_XRGB_8888, /* RGB 888 padded */
26 MDP_Y_CBCR_H2V2, /* Y and CbCr, pseudo planar w/ Cb is in MSB */
27 MDP_ARGB_8888, /* ARGB 888 */
28 MDP_RGB_888, /* RGB 888 planar */
29 MDP_Y_CRCB_H2V2, /* Y and CrCb, pseudo planar w/ Cr is in MSB */
30 MDP_YCRYCB_H2V1, /* YCrYCb interleave */
31 MDP_Y_CRCB_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
32 MDP_Y_CBCR_H2V1, /* Y and CrCb, pseduo planar w/ Cr is in MSB */
33 MDP_RGBA_8888, /* ARGB 888 */
34 MDP_BGRA_8888, /* ABGR 888 */
35 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */
36};
37
38enum {
39 PMEM_IMG,
40 FB_IMG,
41};
42
43/* flag values */
44#define MDP_ROT_NOP 0
45#define MDP_FLIP_LR 0x1
46#define MDP_FLIP_UD 0x2
47#define MDP_ROT_90 0x4
48#define MDP_ROT_180 (MDP_FLIP_UD|MDP_FLIP_LR)
49#define MDP_ROT_270 (MDP_ROT_90|MDP_FLIP_UD|MDP_FLIP_LR)
50#define MDP_DITHER 0x8
51#define MDP_BLUR 0x10
52
53#define MDP_TRANSP_NOP 0xffffffff
54#define MDP_ALPHA_NOP 0xff
55
56struct mdp_rect {
57 u32 x, y, w, h;
58};
59
60struct mdp_img {
61 u32 width, height, format, offset;
62 int memory_id; /* the file descriptor */
63};
64
65struct mdp_blit_req {
66 struct mdp_img src;
67 struct mdp_img dst;
68 struct mdp_rect src_rect;
69 struct mdp_rect dst_rect;
70 u32 alpha, transp_mask, flags;
71};
72
73struct mdp_blit_req_list {
74 u32 count;
75 struct mdp_blit_req req[];
76};
77
78#endif /* _MSM_MDP_H_ */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 9c3757c5759d..7fa20beb2ab9 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -4,12 +4,26 @@
4 * NAND family Bad Block Management (BBM) header file 4 * NAND family Bad Block Management (BBM) header file
5 * - Bad Block Table (BBT) implementation 5 * - Bad Block Table (BBT) implementation
6 * 6 *
7 * Copyright (c) 2005 Samsung Electronics 7 * Copyright © 2005 Samsung Electronics
8 * Kyungmin Park <kyungmin.park@samsung.com> 8 * Kyungmin Park <kyungmin.park@samsung.com>
9 * 9 *
10 * Copyright (c) 2000-2005 10 * Copyright © 2000-2005
11 * Thomas Gleixner <tglx@linuxtronix.de> 11 * Thomas Gleixner <tglx@linuxtronix.de>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 *
13 */ 27 */
14#ifndef __LINUX_MTD_BBM_H 28#ifndef __LINUX_MTD_BBM_H
15#define __LINUX_MTD_BBM_H 29#define __LINUX_MTD_BBM_H
@@ -82,6 +96,12 @@ struct nand_bbt_descr {
82#define NAND_BBT_SAVECONTENT 0x00002000 96#define NAND_BBT_SAVECONTENT 0x00002000
83/* Search good / bad pattern on the first and the second page */ 97/* Search good / bad pattern on the first and the second page */
84#define NAND_BBT_SCAN2NDPAGE 0x00004000 98#define NAND_BBT_SCAN2NDPAGE 0x00004000
99/* Search good / bad pattern on the last page of the eraseblock */
100#define NAND_BBT_SCANLASTPAGE 0x00008000
101/* Chip stores bad block marker on BOTH 1st and 6th bytes of OOB */
102#define NAND_BBT_SCANBYTE1AND6 0x00100000
103/* The nand_bbt_descr was created dynamicaly and must be freed */
104#define NAND_BBT_DYNAMICSTRUCT 0x00200000
85 105
86/* The maximum number of blocks to scan for a bbt */ 106/* The maximum number of blocks to scan for a bbt */
87#define NAND_BBT_SCAN_MAXBLOCKS 4 107#define NAND_BBT_SCAN_MAXBLOCKS 4
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 8b4aa0523db7..26529ebd59cc 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,7 +1,19 @@
1/* 1/*
2 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 2003-2010 David Woodhouse <dwmw2@infradead.org>
3 * 3 *
4 * Interface to Linux block layer for MTD 'translation layers'. 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 17 *
6 */ 18 */
7 19
@@ -9,6 +21,8 @@
9#define __MTD_TRANS_H__ 21#define __MTD_TRANS_H__
10 22
11#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/kref.h>
25#include <linux/sysfs.h>
12 26
13struct hd_geometry; 27struct hd_geometry;
14struct mtd_info; 28struct mtd_info;
@@ -24,11 +38,16 @@ struct mtd_blktrans_dev {
24 int devnum; 38 int devnum;
25 unsigned long size; 39 unsigned long size;
26 int readonly; 40 int readonly;
27 void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */ 41 int open;
42 struct kref ref;
43 struct gendisk *disk;
44 struct attribute_group *disk_attributes;
45 struct task_struct *thread;
46 struct request_queue *rq;
47 spinlock_t queue_lock;
48 void *priv;
28}; 49};
29 50
30struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */
31
32struct mtd_blktrans_ops { 51struct mtd_blktrans_ops {
33 char *name; 52 char *name;
34 int major; 53 int major;
@@ -60,8 +79,6 @@ struct mtd_blktrans_ops {
60 struct list_head devs; 79 struct list_head devs;
61 struct list_head list; 80 struct list_head list;
62 struct module *owner; 81 struct module *owner;
63
64 struct mtd_blkcore_priv *blkcore_priv;
65}; 82};
66 83
67extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); 84extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index df89f4275232..d2118b0eac9a 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,6 +1,20 @@
1 1/*
2/* Common Flash Interface structures 2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 * See http://support.intel.com/design/flash/technote/index.htm 3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
4 */ 18 */
5 19
6#ifndef __MTD_CFI_H__ 20#ifndef __MTD_CFI_H__
@@ -253,6 +267,7 @@ struct cfi_bri_query {
253#define P_ID_MITSUBISHI_STD 0x0100 267#define P_ID_MITSUBISHI_STD 0x0100
254#define P_ID_MITSUBISHI_EXT 0x0101 268#define P_ID_MITSUBISHI_EXT 0x0101
255#define P_ID_SST_PAGE 0x0102 269#define P_ID_SST_PAGE 0x0102
270#define P_ID_SST_OLD 0x0701
256#define P_ID_INTEL_PERFORMANCE 0x0200 271#define P_ID_INTEL_PERFORMANCE 0x0200
257#define P_ID_INTEL_DATA 0x0210 272#define P_ID_INTEL_DATA 0x0210
258#define P_ID_RESERVED 0xffff 273#define P_ID_RESERVED 0xffff
@@ -297,7 +312,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
297 * and 32bit devices on 16 bit busses 312 * and 32bit devices on 16 bit busses
298 * set the low bit of the alternating bit sequence of the address. 313 * set the low bit of the alternating bit sequence of the address.
299 */ 314 */
300 if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) 315 if (((type * interleave) > bankwidth) && ((cmd_ofs & 0xff) == 0xaa))
301 addr |= (type >> 1)*interleave; 316 addr |= (type >> 1)*interleave;
302 317
303 return addr; 318 return addr;
@@ -515,14 +530,25 @@ struct cfi_fixup {
515 void* param; 530 void* param;
516}; 531};
517 532
518#define CFI_MFR_ANY 0xffff 533#define CFI_MFR_ANY 0xFFFF
519#define CFI_ID_ANY 0xffff 534#define CFI_ID_ANY 0xFFFF
520 535#define CFI_MFR_CONTINUATION 0x007F
521#define CFI_MFR_AMD 0x0001 536
522#define CFI_MFR_INTEL 0x0089 537#define CFI_MFR_AMD 0x0001
523#define CFI_MFR_ATMEL 0x001F 538#define CFI_MFR_ATMEL 0x001F
524#define CFI_MFR_SAMSUNG 0x00EC 539#define CFI_MFR_EON 0x001C
525#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 540#define CFI_MFR_FUJITSU 0x0004
541#define CFI_MFR_HYUNDAI 0x00AD
542#define CFI_MFR_INTEL 0x0089
543#define CFI_MFR_MACRONIX 0x00C2
544#define CFI_MFR_NEC 0x0010
545#define CFI_MFR_PMC 0x009D
546#define CFI_MFR_SAMSUNG 0x00EC
547#define CFI_MFR_SHARP 0x00B0
548#define CFI_MFR_SST 0x00BF
549#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
550#define CFI_MFR_TOSHIBA 0x0098
551#define CFI_MFR_WINBOND 0x00DA
526 552
527void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 553void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
528 554
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index d802f7736be3..51cc3f5917a8 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,3 +1,22 @@
1/*
2 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
1#include <asm/byteorder.h> 20#include <asm/byteorder.h>
2 21
3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 22#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/compatmac.h b/include/linux/mtd/compatmac.h
deleted file mode 100644
index 7d1300d9bd51..000000000000
--- a/include/linux/mtd/compatmac.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifndef __LINUX_MTD_COMPATMAC_H__
3#define __LINUX_MTD_COMPATMAC_H__
4
5/* Nothing to see here. We write 2.5-compatible code and this
6 file makes it all OK in older kernels, but it's empty in _current_
7 kernels. Include guard just to make GCC ignore it in future inclusions
8 anyway... */
9
10#endif /* __LINUX_MTD_COMPATMAC_H__ */
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index e80c674daeb3..ccdbe93a909c 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -1,9 +1,22 @@
1/* 1/*
2 * MTD device concatenation layer definitions 2 * MTD device concatenation layer definitions
3 * 3 *
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * Copyright © 2002 Robert Kaiser <rkaiser@sysgo.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
5 * 19 *
6 * This code is GPL
7 */ 20 */
8 21
9#ifndef MTD_CONCAT_H 22#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 0a6d516ab71d..0f6fea73a1f6 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -1,12 +1,25 @@
1/* 1/*
2 * Linux driver for Disk-On-Chip devices 2 * Linux driver for Disk-On-Chip devices
3 * 3 *
4 * Copyright (C) 1999 Machine Vision Holdings, Inc. 4 * Copyright © 1999 Machine Vision Holdings, Inc.
5 * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> 5 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright © 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright © 2002-2003 SnapGear Inc
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8 * 22 *
9 * Released under GPL
10 */ 23 */
11 24
12#ifndef __MTD_DOC2000_H__ 25#ifndef __MTD_DOC2000_H__
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index d0bf422ae374..b63fa457febd 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -1,10 +1,21 @@
1
2/* 1/*
3 * struct flchip definition 2 * Copyright © 2000 Red Hat UK Limited
3 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
4 * 14 *
5 * Contains information about the location and state of a given flash device 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
6 * 18 *
7 * (C) 2000 Red Hat. GPLd.
8 */ 19 */
9 20
10#ifndef __MTD_FLASHCHIP_H__ 21#ifndef __MTD_FLASHCHIP_H__
@@ -15,6 +26,7 @@
15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h 26 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
16 */ 27 */
17#include <linux/sched.h> 28#include <linux/sched.h>
29#include <linux/mutex.h>
18 30
19typedef enum { 31typedef enum {
20 FL_READY, 32 FL_READY,
@@ -74,8 +86,7 @@ struct flchip {
74 unsigned int erase_suspended:1; 86 unsigned int erase_suspended:1;
75 unsigned long in_progress_block_addr; 87 unsigned long in_progress_block_addr;
76 88
77 spinlock_t *mutex; 89 struct mutex mutex;
78 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
79 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip 90 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
80 to be ready */ 91 to be ready */
81 int word_write_time; 92 int word_write_time;
@@ -92,7 +103,7 @@ struct flchip {
92/* This is used to handle contention on write/erase operations 103/* This is used to handle contention on write/erase operations
93 between partitions of the same physical chip. */ 104 between partitions of the same physical chip. */
94struct flchip_shared { 105struct flchip_shared {
95 spinlock_t lock; 106 struct mutex lock;
96 struct flchip *writing; 107 struct flchip *writing;
97 struct flchip *erasing; 108 struct flchip *erasing;
98}; 109};
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index df362ddf2949..2c456054fded 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,6 +1,21 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * Copyright © 2001 Red Hat UK Limited
3 * GPL'd 3 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 *
4 */ 19 */
5 20
6#ifndef __LINUX_MTD_GEN_PROBE_H__ 21#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index b981b8772217..a9e6ba46865e 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,3 +1,21 @@
1/*
2 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
1 19
2/* Overhauled routines for dealing with different mmap regions of flash */ 20/* Overhauled routines for dealing with different mmap regions of flash */
3 21
@@ -7,8 +25,8 @@
7#include <linux/types.h> 25#include <linux/types.h>
8#include <linux/list.h> 26#include <linux/list.h>
9#include <linux/string.h> 27#include <linux/string.h>
28#include <linux/bug.h>
10 29
11#include <linux/mtd/compatmac.h>
12 30
13#include <asm/unaligned.h> 31#include <asm/unaligned.h>
14#include <asm/system.h> 32#include <asm/system.h>
@@ -386,6 +404,8 @@ static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
386#endif 404#endif
387 else if (map_bankwidth_is_large(map)) 405 else if (map_bankwidth_is_large(map))
388 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); 406 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
407 else
408 BUG();
389 409
390 return r; 410 return r;
391} 411}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 0f32a9b6ff55..8485e42a9b09 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,7 +1,20 @@
1/* 1/*
2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3 * 17 *
4 * Released under GPL
5 */ 18 */
6 19
7#ifndef __MTD_MTD_H__ 20#ifndef __MTD_MTD_H__
@@ -13,14 +26,12 @@
13#include <linux/notifier.h> 26#include <linux/notifier.h>
14#include <linux/device.h> 27#include <linux/device.h>
15 28
16#include <linux/mtd/compatmac.h>
17#include <mtd/mtd-abi.h> 29#include <mtd/mtd-abi.h>
18 30
19#include <asm/div64.h> 31#include <asm/div64.h>
20 32
21#define MTD_CHAR_MAJOR 90 33#define MTD_CHAR_MAJOR 90
22#define MTD_BLOCK_MAJOR 31 34#define MTD_BLOCK_MAJOR 31
23#define MAX_MTD_DEVICES 32
24 35
25#define MTD_ERASE_PENDING 0x01 36#define MTD_ERASE_PENDING 0x01
26#define MTD_ERASING 0x02 37#define MTD_ERASING 0x02
@@ -61,9 +72,7 @@ struct mtd_erase_region_info {
61 * MTD_OOB_PLACE: oob data are placed at the given offset 72 * MTD_OOB_PLACE: oob data are placed at the given offset
62 * MTD_OOB_AUTO: oob data are automatically placed at the free areas 73 * MTD_OOB_AUTO: oob data are automatically placed at the free areas
63 * which are defined by the ecclayout 74 * which are defined by the ecclayout
64 * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data 75 * MTD_OOB_RAW: mode to read oob and data without doing ECC checking
65 * is inserted into the data. Thats a raw image of the
66 * flash contents.
67 */ 76 */
68typedef enum { 77typedef enum {
69 MTD_OOB_PLACE, 78 MTD_OOB_PLACE,
@@ -219,6 +228,7 @@ struct mtd_info {
219 /* Chip-supported device locking */ 228 /* Chip-supported device locking */
220 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 229 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
221 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); 230 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
231 int (*is_locked) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
222 232
223 /* Power Management functions */ 233 /* Power Management functions */
224 int (*suspend) (struct mtd_info *mtd); 234 int (*suspend) (struct mtd_info *mtd);
@@ -290,8 +300,9 @@ extern int add_mtd_device(struct mtd_info *mtd);
290extern int del_mtd_device (struct mtd_info *mtd); 300extern int del_mtd_device (struct mtd_info *mtd);
291 301
292extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); 302extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
303extern int __get_mtd_device(struct mtd_info *mtd);
304extern void __put_mtd_device(struct mtd_info *mtd);
293extern struct mtd_info *get_mtd_device_nm(const char *name); 305extern struct mtd_info *get_mtd_device_nm(const char *name);
294
295extern void put_mtd_device(struct mtd_info *mtd); 306extern void put_mtd_device(struct mtd_info *mtd);
296 307
297 308
diff --git a/include/linux/mtd/mtdram.h b/include/linux/mtd/mtdram.h
index 04fdc07b7353..68891313875d 100644
--- a/include/linux/mtd/mtdram.h
+++ b/include/linux/mtd/mtdram.h
@@ -3,6 +3,6 @@
3 3
4#include <linux/mtd/mtd.h> 4#include <linux/mtd/mtd.h>
5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, 5int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
6 unsigned long size, char *name); 6 unsigned long size, char *name);
7 7
8#endif /* __MTD_MTDRAM_H__ */ 8#endif /* __MTD_MTDRAM_H__ */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ccab9dfc5217..102e12c58cb3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -1,9 +1,9 @@
1/* 1/*
2 * linux/include/linux/mtd/nand.h 2 * linux/include/linux/mtd/nand.h
3 * 3 *
4 * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> 4 * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -25,11 +25,13 @@
25#include <linux/mtd/bbm.h> 25#include <linux/mtd/bbm.h>
26 26
27struct mtd_info; 27struct mtd_info;
28struct nand_flash_dev;
28/* Scan and identify a NAND device */ 29/* Scan and identify a NAND device */
29extern int nand_scan (struct mtd_info *mtd, int max_chips); 30extern int nand_scan (struct mtd_info *mtd, int max_chips);
30/* Separate phases of nand_scan(), allowing board driver to intervene 31/* Separate phases of nand_scan(), allowing board driver to intervene
31 * and override command or ECC setup according to flash type */ 32 * and override command or ECC setup according to flash type */
32extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); 33extern int nand_scan_ident(struct mtd_info *mtd, int max_chips,
34 struct nand_flash_dev *table);
33extern int nand_scan_tail(struct mtd_info *mtd); 35extern int nand_scan_tail(struct mtd_info *mtd);
34 36
35/* Free resources held by the NAND device */ 37/* Free resources held by the NAND device */
@@ -38,6 +40,12 @@ extern void nand_release (struct mtd_info *mtd);
38/* Internal helper for board drivers which need to override command function */ 40/* Internal helper for board drivers which need to override command function */
39extern void nand_wait_ready(struct mtd_info *mtd); 41extern void nand_wait_ready(struct mtd_info *mtd);
40 42
43/* locks all blockes present in the device */
44extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
45
46/* unlocks specified locked blockes */
47extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
48
41/* The maximum number of NAND chips in an array */ 49/* The maximum number of NAND chips in an array */
42#define NAND_MAX_CHIPS 8 50#define NAND_MAX_CHIPS 8
43 51
@@ -45,7 +53,7 @@ extern void nand_wait_ready(struct mtd_info *mtd);
45 * is supported now. If you add a chip with bigger oobsize/page 53 * is supported now. If you add a chip with bigger oobsize/page
46 * adjust this accordingly. 54 * adjust this accordingly.
47 */ 55 */
48#define NAND_MAX_OOBSIZE 128 56#define NAND_MAX_OOBSIZE 256
49#define NAND_MAX_PAGESIZE 4096 57#define NAND_MAX_PAGESIZE 4096
50 58
51/* 59/*
@@ -82,6 +90,10 @@ extern void nand_wait_ready(struct mtd_info *mtd);
82#define NAND_CMD_ERASE2 0xd0 90#define NAND_CMD_ERASE2 0xd0
83#define NAND_CMD_RESET 0xff 91#define NAND_CMD_RESET 0xff
84 92
93#define NAND_CMD_LOCK 0x2a
94#define NAND_CMD_UNLOCK1 0x23
95#define NAND_CMD_UNLOCK2 0x24
96
85/* Extended commands for large page devices */ 97/* Extended commands for large page devices */
86#define NAND_CMD_READSTART 0x30 98#define NAND_CMD_READSTART 0x30
87#define NAND_CMD_RNDOUTSTART 0xE0 99#define NAND_CMD_RNDOUTSTART 0xE0
@@ -170,6 +182,12 @@ typedef enum {
170/* Chip does not allow subpage writes */ 182/* Chip does not allow subpage writes */
171#define NAND_NO_SUBPAGE_WRITE 0x00000200 183#define NAND_NO_SUBPAGE_WRITE 0x00000200
172 184
185/* Device is one of 'new' xD cards that expose fake nand command set */
186#define NAND_BROKEN_XD 0x00000400
187
188/* Device behaves just like nand, but is readonly */
189#define NAND_ROM 0x00000800
190
173/* Options valid for Samsung large page devices */ 191/* Options valid for Samsung large page devices */
174#define NAND_SAMSUNG_LP_OPTIONS \ 192#define NAND_SAMSUNG_LP_OPTIONS \
175 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) 193 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
@@ -391,6 +409,7 @@ struct nand_chip {
391 int subpagesize; 409 int subpagesize;
392 uint8_t cellinfo; 410 uint8_t cellinfo;
393 int badblockpos; 411 int badblockpos;
412 int badblockbits;
394 413
395 flstate_t state; 414 flstate_t state;
396 415
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 41bc013571d0..4d8406c81652 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -1,7 +1,9 @@
1/* 1/*
2 * drivers/mtd/nand_ecc.h 2 * drivers/mtd/nand_ecc.h
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000-2010 Steven J. Hill <sjhill@realitydiluted.com>
5 * David Woodhouse <dwmw2@infradead.org>
6 * Thomas Gleixner <tglx@linutronix.de>
5 * 7 *
6 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index dcaf611ed748..b059629e22bc 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,5 +1,20 @@
1/* 1/*
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 *
3 */ 18 */
4 19
5#ifndef __MTD_NFTL_H__ 20#ifndef __MTD_NFTL_H__
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 5509eb06b326..0c8815bfae1c 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -68,6 +68,7 @@ struct onenand_bufferram {
68 * @write_word: [REPLACEABLE] hardware specific function for write 68 * @write_word: [REPLACEABLE] hardware specific function for write
69 * register of OneNAND 69 * register of OneNAND
70 * @mmcontrol: sync burst read function 70 * @mmcontrol: sync burst read function
71 * @chip_probe: [REPLACEABLE] hardware specific function for chip probe
71 * @block_markbad: function to mark a block as bad 72 * @block_markbad: function to mark a block as bad
72 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning 73 * @scan_bbt: [REPLACEALBE] hardware specific function for scanning
73 * Bad block Table 74 * Bad block Table
@@ -114,6 +115,7 @@ struct onenand_chip {
114 unsigned short (*read_word)(void __iomem *addr); 115 unsigned short (*read_word)(void __iomem *addr);
115 void (*write_word)(unsigned short value, void __iomem *addr); 116 void (*write_word)(unsigned short value, void __iomem *addr);
116 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 117 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
118 int (*chip_probe)(struct mtd_info *mtd);
117 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
118 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
119 121
@@ -125,6 +127,9 @@ struct onenand_chip {
125 flstate_t state; 127 flstate_t state;
126 unsigned char *page_buf; 128 unsigned char *page_buf;
127 unsigned char *oob_buf; 129 unsigned char *oob_buf;
130#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
131 unsigned char *verify_buf;
132#endif
128 133
129 int subpagesize; 134 int subpagesize;
130 struct nand_ecclayout *ecclayout; 135 struct nand_ecclayout *ecclayout;
@@ -175,10 +180,14 @@ struct onenand_chip {
175#define ONENAND_HAS_CONT_LOCK (0x0001) 180#define ONENAND_HAS_CONT_LOCK (0x0001)
176#define ONENAND_HAS_UNLOCK_ALL (0x0002) 181#define ONENAND_HAS_UNLOCK_ALL (0x0002)
177#define ONENAND_HAS_2PLANE (0x0004) 182#define ONENAND_HAS_2PLANE (0x0004)
183#define ONENAND_HAS_4KB_PAGE (0x0008)
178#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 184#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
179#define ONENAND_PAGEBUF_ALLOC (0x1000) 185#define ONENAND_PAGEBUF_ALLOC (0x1000)
180#define ONENAND_OOBBUF_ALLOC (0x2000) 186#define ONENAND_OOBBUF_ALLOC (0x2000)
181 187
188#define ONENAND_IS_4KB_PAGE(this) \
189 (this->options & ONENAND_HAS_4KB_PAGE)
190
182/* 191/*
183 * OneNAND Flash Manufacturer ID Codes 192 * OneNAND Flash Manufacturer ID Codes
184 */ 193 */
@@ -205,6 +214,8 @@ struct mtd_partition;
205 214
206struct onenand_platform_data { 215struct onenand_platform_data {
207 void (*mmcontrol)(struct mtd_info *mtd, int sync_read); 216 void (*mmcontrol)(struct mtd_info *mtd, int sync_read);
217 int (*read_bufferram)(struct mtd_info *mtd, int area,
218 unsigned char *buffer, int offset, size_t count);
208 struct mtd_partition *parts; 219 struct mtd_partition *parts;
209 unsigned int nr_parts; 220 unsigned int nr_parts;
210}; 221};
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 76f7cabf07d3..bcfd9f777454 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base; 27 unsigned int pfow_base;
28 char *probe_type;
28 struct mtd_partition *parts; 29 struct mtd_partition *parts;
29}; 30};
30 31
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index ab77609ec337..9cf4c4c79555 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -93,8 +93,6 @@
93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF 93#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
94#define LOOP_TIMEOUT_MAX 0x00010000 94#define LOOP_TIMEOUT_MAX 0x00010000
95 95
96#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd)
97
98struct sh_flctl { 96struct sh_flctl {
99 struct mtd_info mtd; 97 struct mtd_info mtd;
100 struct nand_chip chip; 98 struct nand_chip chip;
@@ -125,4 +123,9 @@ struct sh_flctl_platform_data {
125 unsigned has_hwecc:1; 123 unsigned has_hwecc:1;
126}; 124};
127 125
126static inline struct sh_flctl *mtd_to_flctl(struct mtd_info *mtdinfo)
127{
128 return container_of(mtdinfo, struct sh_flctl, mtd);
129}
130
128#endif /* __SH_FLCTL_H__ */ 131#endif /* __SH_FLCTL_H__ */
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index cbbbe9bfecad..30b0c4e78f91 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi; 20 struct platform_device *shared_smi;
21 unsigned int t_clk; 21 unsigned int t_clk;
22 /*
23 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
24 * limit of 9KiB will be used.
25 */
26 int tx_csum_limit;
22}; 27};
23 28
24#define MV643XX_ETH_PHY_ADDR_DEFAULT 0 29#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index 155719dab813..bb58854a8061 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -88,7 +88,7 @@ struct nbd_request {
88 char handle[8]; 88 char handle[8];
89 __be64 from; 89 __be64 from;
90 __be32 len; 90 __be32 len;
91} __attribute__ ((packed)); 91} __packed;
92 92
93/* 93/*
94 * This is the reply packet that nbd-server sends back to the client after 94 * This is the reply packet that nbd-server sends back to the client after
diff --git a/include/linux/ncp.h b/include/linux/ncp.h
index 99f0adeeb3f3..3ace8370e61e 100644
--- a/include/linux/ncp.h
+++ b/include/linux/ncp.h
@@ -27,7 +27,7 @@ struct ncp_request_header {
27 __u8 conn_high; 27 __u8 conn_high;
28 __u8 function; 28 __u8 function;
29 __u8 data[0]; 29 __u8 data[0];
30} __attribute__((packed)); 30} __packed;
31 31
32#define NCP_REPLY (0x3333) 32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E) 33#define NCP_WATCHDOG (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header {
42 __u8 completion_code; 42 __u8 completion_code;
43 __u8 connection_state; 43 __u8 connection_state;
44 __u8 data[0]; 44 __u8 data[0];
45} __attribute__((packed)); 45} __packed;
46 46
47#define NCP_VOLNAME_LEN (16) 47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256) 48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct {
158#ifdef __KERNEL__ 158#ifdef __KERNEL__
159 struct nw_nfs_info nfs; 159 struct nw_nfs_info nfs;
160#endif 160#endif
161} __attribute__((packed)); 161} __packed;
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */ 163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02)) 164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info {
190 __u16 inheritanceGrantMask; 190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask; 191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace; 192 __u32 maximumSpace;
193} __attribute__((packed)); 193} __packed;
194 194
195struct nw_search_sequence { 195struct nw_search_sequence {
196 __u8 volNumber; 196 __u8 volNumber;
197 __u32 dirBase; 197 __u32 dirBase;
198 __u32 sequence; 198 __u32 sequence;
199} __attribute__((packed)); 199} __packed;
200 200
201#endif /* _LINUX_NCP_H */ 201#endif /* _LINUX_NCP_H */
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 30b06c893944..4522aed00906 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
211 211
212/* linux/fs/ncpfs/ioctl.c */ 212/* linux/fs/ncpfs/ioctl.c */
213int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long); 213long ncp_ioctl(struct file *, unsigned int, unsigned long);
214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long); 214long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);
215 215
216/* linux/fs/ncpfs/sock.c */ 216/* linux/fs/ncpfs/sock.c */
diff --git a/include/linux/ncp_fs_sb.h b/include/linux/ncp_fs_sb.h
index 5ec9ca671687..8da05bc098ca 100644
--- a/include/linux/ncp_fs_sb.h
+++ b/include/linux/ncp_fs_sb.h
@@ -104,13 +104,13 @@ struct ncp_server {
104 104
105 unsigned int state; /* STREAM only: receiver state */ 105 unsigned int state; /* STREAM only: receiver state */
106 struct { 106 struct {
107 __u32 magic __attribute__((packed)); 107 __u32 magic __packed;
108 __u32 len __attribute__((packed)); 108 __u32 len __packed;
109 __u16 type __attribute__((packed)); 109 __u16 type __packed;
110 __u16 p1 __attribute__((packed)); 110 __u16 p1 __packed;
111 __u16 p2 __attribute__((packed)); 111 __u16 p2 __packed;
112 __u16 p3 __attribute__((packed)); 112 __u16 p3 __packed;
113 __u16 type2 __attribute__((packed)); 113 __u16 type2 __packed;
114 } buf; /* STREAM only: temporary buffer */ 114 } buf; /* STREAM only: temporary buffer */
115 unsigned char* ptr; /* STREAM only: pointer to data */ 115 unsigned char* ptr; /* STREAM only: pointer to data */
116 size_t len; /* STREAM only: length of data to receive */ 116 size_t len; /* STREAM only: length of data to receive */
diff --git a/include/linux/net.h b/include/linux/net.h
index 4157b5d42bd6..dee0b11a8759 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -59,6 +59,7 @@ typedef enum {
59#include <linux/wait.h> 59#include <linux/wait.h>
60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 60#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
61#include <linux/kmemcheck.h> 61#include <linux/kmemcheck.h>
62#include <linux/rcupdate.h>
62 63
63struct poll_table_struct; 64struct poll_table_struct;
64struct pipe_inode_info; 65struct pipe_inode_info;
@@ -116,16 +117,21 @@ enum sock_shutdown_cmd {
116 SHUT_RDWR = 2, 117 SHUT_RDWR = 2,
117}; 118};
118 119
120struct socket_wq {
121 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list;
123 struct rcu_head rcu;
124} ____cacheline_aligned_in_smp;
125
119/** 126/**
120 * struct socket - general BSD socket 127 * struct socket - general BSD socket
121 * @state: socket state (%SS_CONNECTED, etc) 128 * @state: socket state (%SS_CONNECTED, etc)
122 * @type: socket type (%SOCK_STREAM, etc) 129 * @type: socket type (%SOCK_STREAM, etc)
123 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) 130 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
124 * @ops: protocol specific socket operations 131 * @ops: protocol specific socket operations
125 * @fasync_list: Asynchronous wake up list
126 * @file: File back pointer for gc 132 * @file: File back pointer for gc
127 * @sk: internal networking protocol agnostic socket representation 133 * @sk: internal networking protocol agnostic socket representation
128 * @wait: wait queue for several uses 134 * @wq: wait queue for several uses
129 */ 135 */
130struct socket { 136struct socket {
131 socket_state state; 137 socket_state state;
@@ -135,11 +141,8 @@ struct socket {
135 kmemcheck_bitfield_end(type); 141 kmemcheck_bitfield_end(type);
136 142
137 unsigned long flags; 143 unsigned long flags;
138 /* 144
139 * Please keep fasync_list & wait fields in the same cache line 145 struct socket_wq *wq;
140 */
141 struct fasync_struct *fasync_list;
142 wait_queue_head_t wait;
143 146
144 struct file *file; 147 struct file *file;
145 struct sock *sk; 148 struct sock *sk;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index fa8b47637997..46c36ffe20ee 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -31,6 +31,7 @@
31#include <linux/if_link.h> 31#include <linux/if_link.h>
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
34#include <linux/pm_qos_params.h>
34#include <linux/timer.h> 35#include <linux/timer.h>
35#include <linux/delay.h> 36#include <linux/delay.h>
36#include <linux/mm.h> 37#include <linux/mm.h>
@@ -53,6 +54,7 @@
53 54
54struct vlan_group; 55struct vlan_group;
55struct netpoll_info; 56struct netpoll_info;
57struct phy_device;
56/* 802.11 specific */ 58/* 802.11 specific */
57struct wireless_dev; 59struct wireless_dev;
58 /* source back-compat hooks */ 60 /* source back-compat hooks */
@@ -64,6 +66,11 @@ struct wireless_dev;
64#define HAVE_FREE_NETDEV /* free_netdev() */ 66#define HAVE_FREE_NETDEV /* free_netdev() */
65#define HAVE_NETDEV_PRIV /* netdev_priv() */ 67#define HAVE_NETDEV_PRIV /* netdev_priv() */
66 68
69/* hardware address assignment types */
70#define NET_ADDR_PERM 0 /* address is permanent (default) */
71#define NET_ADDR_RANDOM 1 /* address is generated randomly */
72#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
73
67/* Backlog congestion levels */ 74/* Backlog congestion levels */
68#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 75#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
69#define NET_RX_DROP 1 /* packet dropped */ 76#define NET_RX_DROP 1 /* packet dropped */
@@ -158,45 +165,39 @@ static inline bool dev_xmit_complete(int rc)
158#define MAX_HEADER (LL_MAX_HEADER + 48) 165#define MAX_HEADER (LL_MAX_HEADER + 48)
159#endif 166#endif
160 167
161#endif /* __KERNEL__ */
162
163/* 168/*
164 * Network device statistics. Akin to the 2.0 ether stats but 169 * Old network device statistics. Fields are native words
165 * with byte counters. 170 * (unsigned long) so they can be read and written atomically.
166 */ 171 */
167 172
168struct net_device_stats { 173struct net_device_stats {
169 unsigned long rx_packets; /* total packets received */ 174 unsigned long rx_packets;
170 unsigned long tx_packets; /* total packets transmitted */ 175 unsigned long tx_packets;
171 unsigned long rx_bytes; /* total bytes received */ 176 unsigned long rx_bytes;
172 unsigned long tx_bytes; /* total bytes transmitted */ 177 unsigned long tx_bytes;
173 unsigned long rx_errors; /* bad packets received */ 178 unsigned long rx_errors;
174 unsigned long tx_errors; /* packet transmit problems */ 179 unsigned long tx_errors;
175 unsigned long rx_dropped; /* no space in linux buffers */ 180 unsigned long rx_dropped;
176 unsigned long tx_dropped; /* no space available in linux */ 181 unsigned long tx_dropped;
177 unsigned long multicast; /* multicast packets received */ 182 unsigned long multicast;
178 unsigned long collisions; 183 unsigned long collisions;
179
180 /* detailed rx_errors: */
181 unsigned long rx_length_errors; 184 unsigned long rx_length_errors;
182 unsigned long rx_over_errors; /* receiver ring buff overflow */ 185 unsigned long rx_over_errors;
183 unsigned long rx_crc_errors; /* recved pkt with crc error */ 186 unsigned long rx_crc_errors;
184 unsigned long rx_frame_errors; /* recv'd frame alignment error */ 187 unsigned long rx_frame_errors;
185 unsigned long rx_fifo_errors; /* recv'r fifo overrun */ 188 unsigned long rx_fifo_errors;
186 unsigned long rx_missed_errors; /* receiver missed packet */ 189 unsigned long rx_missed_errors;
187
188 /* detailed tx_errors */
189 unsigned long tx_aborted_errors; 190 unsigned long tx_aborted_errors;
190 unsigned long tx_carrier_errors; 191 unsigned long tx_carrier_errors;
191 unsigned long tx_fifo_errors; 192 unsigned long tx_fifo_errors;
192 unsigned long tx_heartbeat_errors; 193 unsigned long tx_heartbeat_errors;
193 unsigned long tx_window_errors; 194 unsigned long tx_window_errors;
194
195 /* for cslip etc */
196 unsigned long rx_compressed; 195 unsigned long rx_compressed;
197 unsigned long tx_compressed; 196 unsigned long tx_compressed;
198}; 197};
199 198
199#endif /* __KERNEL__ */
200
200 201
201/* Media selection options. */ 202/* Media selection options. */
202enum { 203enum {
@@ -218,34 +219,6 @@ struct neighbour;
218struct neigh_parms; 219struct neigh_parms;
219struct sk_buff; 220struct sk_buff;
220 221
221struct netif_rx_stats {
222 unsigned total;
223 unsigned dropped;
224 unsigned time_squeeze;
225 unsigned cpu_collision;
226};
227
228DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
229
230struct dev_addr_list {
231 struct dev_addr_list *next;
232 u8 da_addr[MAX_ADDR_LEN];
233 u8 da_addrlen;
234 u8 da_synced;
235 int da_users;
236 int da_gusers;
237};
238
239/*
240 * We tag multicasts with these structures.
241 */
242
243#define dev_mc_list dev_addr_list
244#define dmi_addr da_addr
245#define dmi_addrlen da_addrlen
246#define dmi_users da_users
247#define dmi_gusers da_gusers
248
249struct netdev_hw_addr { 222struct netdev_hw_addr {
250 struct list_head list; 223 struct list_head list;
251 unsigned char addr[MAX_ADDR_LEN]; 224 unsigned char addr[MAX_ADDR_LEN];
@@ -254,8 +227,10 @@ struct netdev_hw_addr {
254#define NETDEV_HW_ADDR_T_SAN 2 227#define NETDEV_HW_ADDR_T_SAN 2
255#define NETDEV_HW_ADDR_T_SLAVE 3 228#define NETDEV_HW_ADDR_T_SLAVE 3
256#define NETDEV_HW_ADDR_T_UNICAST 4 229#define NETDEV_HW_ADDR_T_UNICAST 4
230#define NETDEV_HW_ADDR_T_MULTICAST 5
257 int refcount; 231 int refcount;
258 bool synced; 232 bool synced;
233 bool global_use;
259 struct rcu_head rcu_head; 234 struct rcu_head rcu_head;
260}; 235};
261 236
@@ -264,16 +239,20 @@ struct netdev_hw_addr_list {
264 int count; 239 int count;
265}; 240};
266 241
267#define netdev_uc_count(dev) ((dev)->uc.count) 242#define netdev_hw_addr_list_count(l) ((l)->count)
268#define netdev_uc_empty(dev) ((dev)->uc.count == 0) 243#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
269#define netdev_for_each_uc_addr(ha, dev) \ 244#define netdev_hw_addr_list_for_each(ha, l) \
270 list_for_each_entry(ha, &dev->uc.list, list) 245 list_for_each_entry(ha, &(l)->list, list)
271 246
272#define netdev_mc_count(dev) ((dev)->mc_count) 247#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
273#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) 248#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
249#define netdev_for_each_uc_addr(ha, dev) \
250 netdev_hw_addr_list_for_each(ha, &(dev)->uc)
274 251
275#define netdev_for_each_mc_addr(mclist, dev) \ 252#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
276 for (mclist = dev->mc_list; mclist; mclist = mclist->next) 253#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
254#define netdev_for_each_mc_addr(ha, dev) \
255 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
277 256
278struct hh_cache { 257struct hh_cache {
279 struct hh_cache *hh_next; /* Next entry */ 258 struct hh_cache *hh_next; /* Next entry */
@@ -402,6 +381,8 @@ enum gro_result {
402}; 381};
403typedef enum gro_result gro_result_t; 382typedef enum gro_result gro_result_t;
404 383
384typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb);
385
405extern void __napi_schedule(struct napi_struct *n); 386extern void __napi_schedule(struct napi_struct *n);
406 387
407static inline int napi_disable_pending(struct napi_struct *n) 388static inline int napi_disable_pending(struct napi_struct *n)
@@ -525,11 +506,90 @@ struct netdev_queue {
525 * please use this field instead of dev->trans_start 506 * please use this field instead of dev->trans_start
526 */ 507 */
527 unsigned long trans_start; 508 unsigned long trans_start;
528 unsigned long tx_bytes; 509 u64 tx_bytes;
529 unsigned long tx_packets; 510 u64 tx_packets;
530 unsigned long tx_dropped; 511 u64 tx_dropped;
531} ____cacheline_aligned_in_smp; 512} ____cacheline_aligned_in_smp;
532 513
514#ifdef CONFIG_RPS
515/*
516 * This structure holds an RPS map which can be of variable length. The
517 * map is an array of CPUs.
518 */
519struct rps_map {
520 unsigned int len;
521 struct rcu_head rcu;
522 u16 cpus[0];
523};
524#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
525
526/*
527 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the
528 * tail pointer for that CPU's input queue at the time of last enqueue.
529 */
530struct rps_dev_flow {
531 u16 cpu;
532 u16 fill;
533 unsigned int last_qtail;
534};
535
536/*
537 * The rps_dev_flow_table structure contains a table of flow mappings.
538 */
539struct rps_dev_flow_table {
540 unsigned int mask;
541 struct rcu_head rcu;
542 struct work_struct free_work;
543 struct rps_dev_flow flows[0];
544};
545#define RPS_DEV_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_dev_flow_table) + \
546 (_num * sizeof(struct rps_dev_flow)))
547
548/*
549 * The rps_sock_flow_table contains mappings of flows to the last CPU
550 * on which they were processed by the application (set in recvmsg).
551 */
552struct rps_sock_flow_table {
553 unsigned int mask;
554 u16 ents[0];
555};
556#define RPS_SOCK_FLOW_TABLE_SIZE(_num) (sizeof(struct rps_sock_flow_table) + \
557 (_num * sizeof(u16)))
558
559#define RPS_NO_CPU 0xffff
560
561static inline void rps_record_sock_flow(struct rps_sock_flow_table *table,
562 u32 hash)
563{
564 if (table && hash) {
565 unsigned int cpu, index = hash & table->mask;
566
567 /* We only give a hint, preemption can change cpu under us */
568 cpu = raw_smp_processor_id();
569
570 if (table->ents[index] != cpu)
571 table->ents[index] = cpu;
572 }
573}
574
575static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
576 u32 hash)
577{
578 if (table && hash)
579 table->ents[hash & table->mask] = RPS_NO_CPU;
580}
581
582extern struct rps_sock_flow_table *rps_sock_flow_table;
583
584/* This structure contains an instance of an RX queue. */
585struct netdev_rx_queue {
586 struct rps_map *rps_map;
587 struct rps_dev_flow_table *rps_flow_table;
588 struct kobject kobj;
589 struct netdev_rx_queue *first;
590 atomic_t count;
591} ____cacheline_aligned_in_smp;
592#endif /* CONFIG_RPS */
533 593
534/* 594/*
535 * This structure defines the management hooks for network devices. 595 * This structure defines the management hooks for network devices.
@@ -602,10 +662,19 @@ struct netdev_queue {
602 * Callback uses when the transmitter has not made any progress 662 * Callback uses when the transmitter has not made any progress
603 * for dev->watchdog ticks. 663 * for dev->watchdog ticks.
604 * 664 *
665 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
666 * struct rtnl_link_stats64 *storage);
605 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 667 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
606 * Called when a user wants to get the network device usage 668 * Called when a user wants to get the network device usage
607 * statistics. If not defined, the counters in dev->stats will 669 * statistics. Drivers must do one of the following:
608 * be used. 670 * 1. Define @ndo_get_stats64 to fill in a zero-initialised
671 * rtnl_link_stats64 structure passed by the caller.
672 * 2. Define @ndo_get_stats to update a net_device_stats structure
673 * (which should normally be dev->stats) and return a pointer to
674 * it. The structure may be changed asynchronously only if each
675 * field is written atomically.
676 * 3. Update dev->stats asynchronously and atomically, and define
677 * neither operation.
609 * 678 *
610 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); 679 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
611 * If device support VLAN receive accleration 680 * If device support VLAN receive accleration
@@ -629,6 +698,9 @@ struct netdev_queue {
629 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); 698 * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate);
630 * int (*ndo_get_vf_config)(struct net_device *dev, 699 * int (*ndo_get_vf_config)(struct net_device *dev,
631 * int vf, struct ifla_vf_info *ivf); 700 * int vf, struct ifla_vf_info *ivf);
701 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
702 * struct nlattr *port[]);
703 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
632 */ 704 */
633#define HAVE_NET_DEVICE_OPS 705#define HAVE_NET_DEVICE_OPS
634struct net_device_ops { 706struct net_device_ops {
@@ -657,6 +729,8 @@ struct net_device_ops {
657 struct neigh_parms *); 729 struct neigh_parms *);
658 void (*ndo_tx_timeout) (struct net_device *dev); 730 void (*ndo_tx_timeout) (struct net_device *dev);
659 731
732 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
733 struct rtnl_link_stats64 *storage);
660 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 734 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
661 735
662 void (*ndo_vlan_rx_register)(struct net_device *dev, 736 void (*ndo_vlan_rx_register)(struct net_device *dev,
@@ -667,6 +741,9 @@ struct net_device_ops {
667 unsigned short vid); 741 unsigned short vid);
668#ifdef CONFIG_NET_POLL_CONTROLLER 742#ifdef CONFIG_NET_POLL_CONTROLLER
669 void (*ndo_poll_controller)(struct net_device *dev); 743 void (*ndo_poll_controller)(struct net_device *dev);
744 int (*ndo_netpoll_setup)(struct net_device *dev,
745 struct netpoll_info *info);
746 void (*ndo_netpoll_cleanup)(struct net_device *dev);
670#endif 747#endif
671 int (*ndo_set_vf_mac)(struct net_device *dev, 748 int (*ndo_set_vf_mac)(struct net_device *dev,
672 int queue, u8 *mac); 749 int queue, u8 *mac);
@@ -677,6 +754,11 @@ struct net_device_ops {
677 int (*ndo_get_vf_config)(struct net_device *dev, 754 int (*ndo_get_vf_config)(struct net_device *dev,
678 int vf, 755 int vf,
679 struct ifla_vf_info *ivf); 756 struct ifla_vf_info *ivf);
757 int (*ndo_set_vf_port)(struct net_device *dev,
758 int vf,
759 struct nlattr *port[]);
760 int (*ndo_get_vf_port)(struct net_device *dev,
761 int vf, struct sk_buff *skb);
680#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 762#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
681 int (*ndo_fcoe_enable)(struct net_device *dev); 763 int (*ndo_fcoe_enable)(struct net_device *dev);
682 int (*ndo_fcoe_disable)(struct net_device *dev); 764 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -708,9 +790,12 @@ struct net_device {
708 /* 790 /*
709 * This is the first field of the "visible" part of this structure 791 * This is the first field of the "visible" part of this structure
710 * (i.e. as seen by users in the "Space.c" file). It is the name 792 * (i.e. as seen by users in the "Space.c" file). It is the name
711 * the interface. 793 * of the interface.
712 */ 794 */
713 char name[IFNAMSIZ]; 795 char name[IFNAMSIZ];
796
797 struct pm_qos_request_list pm_qos_req;
798
714 /* device name hash chain */ 799 /* device name hash chain */
715 struct hlist_node name_hlist; 800 struct hlist_node name_hlist;
716 /* snmp alias */ 801 /* snmp alias */
@@ -764,6 +849,7 @@ struct net_device {
764#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */ 849#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
765#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 850#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
766#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ 851#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
852#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
767 853
768 /* Segmentation offload features */ 854 /* Segmentation offload features */
769#define NETIF_F_GSO_SHIFT 16 855#define NETIF_F_GSO_SHIFT 16
@@ -776,7 +862,8 @@ struct net_device {
776#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) 862#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
777 863
778 /* List of features with software fallbacks. */ 864 /* List of features with software fallbacks. */
779#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6) 865#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
866 NETIF_F_TSO6 | NETIF_F_UFO)
780 867
781 868
782#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM) 869#define NETIF_F_GEN_CSUM (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
@@ -820,7 +907,7 @@ struct net_device {
820 unsigned char operstate; /* RFC2863 operstate */ 907 unsigned char operstate; /* RFC2863 operstate */
821 unsigned char link_mode; /* mapping policy to operstate */ 908 unsigned char link_mode; /* mapping policy to operstate */
822 909
823 unsigned mtu; /* interface MTU value */ 910 unsigned int mtu; /* interface MTU value */
824 unsigned short type; /* interface hardware type */ 911 unsigned short type; /* interface hardware type */
825 unsigned short hard_header_len; /* hardware hdr length */ 912 unsigned short hard_header_len; /* hardware hdr length */
826 913
@@ -837,15 +924,14 @@ struct net_device {
837 924
838 /* Interface address info. */ 925 /* Interface address info. */
839 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 926 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
927 unsigned char addr_assign_type; /* hw address assignment type */
840 unsigned char addr_len; /* hardware address length */ 928 unsigned char addr_len; /* hardware address length */
841 unsigned short dev_id; /* for shared network cards */ 929 unsigned short dev_id; /* for shared network cards */
842 930
843 struct netdev_hw_addr_list uc; /* Secondary unicast
844 mac addresses */
845 int uc_promisc;
846 spinlock_t addr_list_lock; 931 spinlock_t addr_list_lock;
847 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 932 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
848 int mc_count; /* Number of installed mcasts */ 933 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
934 int uc_promisc;
849 unsigned int promiscuity; 935 unsigned int promiscuity;
850 unsigned int allmulti; 936 unsigned int allmulti;
851 937
@@ -878,7 +964,18 @@ struct net_device {
878 964
879 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 965 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
880 966
967#ifdef CONFIG_RPS
968 struct kset *queues_kset;
969
970 struct netdev_rx_queue *_rx;
971
972 /* Number of RX queues allocated at alloc_netdev_mq() time */
973 unsigned int num_rx_queues;
974#endif
975
881 struct netdev_queue rx_queue; 976 struct netdev_queue rx_queue;
977 rx_handler_func_t *rx_handler;
978 void *rx_handler_data;
882 979
883 struct netdev_queue *_tx ____cacheline_aligned_in_smp; 980 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
884 981
@@ -946,10 +1043,6 @@ struct net_device {
946 /* mid-layer private */ 1043 /* mid-layer private */
947 void *ml_priv; 1044 void *ml_priv;
948 1045
949 /* bridge stuff */
950 struct net_bridge_port *br_port;
951 /* macvlan */
952 struct macvlan_port *macvlan_port;
953 /* GARP */ 1046 /* GARP */
954 struct garp_port *garp_port; 1047 struct garp_port *garp_port;
955 1048
@@ -979,6 +1072,9 @@ struct net_device {
979#endif 1072#endif
980 /* n-tuple filter list attached to this device */ 1073 /* n-tuple filter list attached to this device */
981 struct ethtool_rx_ntuple_list ethtool_ntuple_list; 1074 struct ethtool_rx_ntuple_list ethtool_ntuple_list;
1075
1076 /* phy device may attach itself for hardware timestamping */
1077 struct phy_device *phydev;
982}; 1078};
983#define to_net_dev(d) container_of(d, struct net_device, dev) 1079#define to_net_dev(d) container_of(d, struct net_device, dev)
984 1080
@@ -1009,11 +1105,7 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1009static inline 1105static inline
1010struct net *dev_net(const struct net_device *dev) 1106struct net *dev_net(const struct net_device *dev)
1011{ 1107{
1012#ifdef CONFIG_NET_NS 1108 return read_pnet(&dev->nd_net);
1013 return dev->nd_net;
1014#else
1015 return &init_net;
1016#endif
1017} 1109}
1018 1110
1019static inline 1111static inline
@@ -1194,8 +1286,8 @@ extern void dev_add_pack(struct packet_type *pt);
1194extern void dev_remove_pack(struct packet_type *pt); 1286extern void dev_remove_pack(struct packet_type *pt);
1195extern void __dev_remove_pack(struct packet_type *pt); 1287extern void __dev_remove_pack(struct packet_type *pt);
1196 1288
1197extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags, 1289extern struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short flags,
1198 unsigned short mask); 1290 unsigned short mask);
1199extern struct net_device *dev_get_by_name(struct net *net, const char *name); 1291extern struct net_device *dev_get_by_name(struct net *net, const char *name);
1200extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name); 1292extern struct net_device *dev_get_by_name_rcu(struct net *net, const char *name);
1201extern struct net_device *__dev_get_by_name(struct net *net, const char *name); 1293extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
@@ -1306,19 +1398,52 @@ static inline int unregister_gifconf(unsigned int family)
1306} 1398}
1307 1399
1308/* 1400/*
1309 * Incoming packets are placed on per-cpu queues so that 1401 * Incoming packets are placed on per-cpu queues
1310 * no locking is needed.
1311 */ 1402 */
1312struct softnet_data { 1403struct softnet_data {
1313 struct Qdisc *output_queue; 1404 struct Qdisc *output_queue;
1314 struct sk_buff_head input_pkt_queue; 1405 struct Qdisc **output_queue_tailp;
1315 struct list_head poll_list; 1406 struct list_head poll_list;
1316 struct sk_buff *completion_queue; 1407 struct sk_buff *completion_queue;
1317 1408 struct sk_buff_head process_queue;
1409
1410 /* stats */
1411 unsigned int processed;
1412 unsigned int time_squeeze;
1413 unsigned int cpu_collision;
1414 unsigned int received_rps;
1415
1416#ifdef CONFIG_RPS
1417 struct softnet_data *rps_ipi_list;
1418
1419 /* Elements below can be accessed between CPUs for RPS */
1420 struct call_single_data csd ____cacheline_aligned_in_smp;
1421 struct softnet_data *rps_ipi_next;
1422 unsigned int cpu;
1423 unsigned int input_queue_head;
1424 unsigned int input_queue_tail;
1425#endif
1426 unsigned dropped;
1427 struct sk_buff_head input_pkt_queue;
1318 struct napi_struct backlog; 1428 struct napi_struct backlog;
1319}; 1429};
1320 1430
1321DECLARE_PER_CPU(struct softnet_data,softnet_data); 1431static inline void input_queue_head_incr(struct softnet_data *sd)
1432{
1433#ifdef CONFIG_RPS
1434 sd->input_queue_head++;
1435#endif
1436}
1437
1438static inline void input_queue_tail_incr_save(struct softnet_data *sd,
1439 unsigned int *qtail)
1440{
1441#ifdef CONFIG_RPS
1442 *qtail = ++sd->input_queue_tail;
1443#endif
1444}
1445
1446DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
1322 1447
1323#define HAVE_NETIF_QUEUE 1448#define HAVE_NETIF_QUEUE
1324 1449
@@ -1545,6 +1670,9 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
1545 return (dev->num_tx_queues > 1); 1670 return (dev->num_tx_queues > 1);
1546} 1671}
1547 1672
1673extern void netif_set_real_num_tx_queues(struct net_device *dev,
1674 unsigned int txq);
1675
1548/* Use this variant when it is known for sure that it 1676/* Use this variant when it is known for sure that it
1549 * is executing from hardware interrupt context or with hardware interrupts 1677 * is executing from hardware interrupt context or with hardware interrupts
1550 * disabled. 1678 * disabled.
@@ -1582,6 +1710,11 @@ static inline void napi_free_frags(struct napi_struct *napi)
1582 napi->skb = NULL; 1710 napi->skb = NULL;
1583} 1711}
1584 1712
1713extern int netdev_rx_handler_register(struct net_device *dev,
1714 rx_handler_func_t *rx_handler,
1715 void *rx_handler_data);
1716extern void netdev_rx_handler_unregister(struct net_device *dev);
1717
1585extern void netif_nit_deliver(struct sk_buff *skb); 1718extern void netif_nit_deliver(struct sk_buff *skb);
1586extern int dev_valid_name(const char *name); 1719extern int dev_valid_name(const char *name);
1587extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1720extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1661,6 +1794,8 @@ extern void netif_carrier_on(struct net_device *dev);
1661 1794
1662extern void netif_carrier_off(struct net_device *dev); 1795extern void netif_carrier_off(struct net_device *dev);
1663 1796
1797extern void netif_notify_peers(struct net_device *dev);
1798
1664/** 1799/**
1665 * netif_dormant_on - mark device as dormant. 1800 * netif_dormant_on - mark device as dormant.
1666 * @dev: network device 1801 * @dev: network device
@@ -1945,6 +2080,22 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1945extern int register_netdev(struct net_device *dev); 2080extern int register_netdev(struct net_device *dev);
1946extern void unregister_netdev(struct net_device *dev); 2081extern void unregister_netdev(struct net_device *dev);
1947 2082
2083/* General hardware address lists handling functions */
2084extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
2085 struct netdev_hw_addr_list *from_list,
2086 int addr_len, unsigned char addr_type);
2087extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
2088 struct netdev_hw_addr_list *from_list,
2089 int addr_len, unsigned char addr_type);
2090extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
2091 struct netdev_hw_addr_list *from_list,
2092 int addr_len);
2093extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
2094 struct netdev_hw_addr_list *from_list,
2095 int addr_len);
2096extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2097extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2098
1948/* Functions used for device addresses handling */ 2099/* Functions used for device addresses handling */
1949extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2100extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1950 unsigned char addr_type); 2101 unsigned char addr_type);
@@ -1956,35 +2107,46 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,
1956extern int dev_addr_del_multiple(struct net_device *to_dev, 2107extern int dev_addr_del_multiple(struct net_device *to_dev,
1957 struct net_device *from_dev, 2108 struct net_device *from_dev,
1958 unsigned char addr_type); 2109 unsigned char addr_type);
2110extern void dev_addr_flush(struct net_device *dev);
2111extern int dev_addr_init(struct net_device *dev);
2112
2113/* Functions used for unicast addresses handling */
2114extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
2115extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
2116extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2117extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2118extern void dev_uc_flush(struct net_device *dev);
2119extern void dev_uc_init(struct net_device *dev);
2120
2121/* Functions used for multicast addresses handling */
2122extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2123extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2124extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2125extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2126extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2127extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2128extern void dev_mc_flush(struct net_device *dev);
2129extern void dev_mc_init(struct net_device *dev);
1959 2130
1960/* Functions used for secondary unicast and multicast support */ 2131/* Functions used for secondary unicast and multicast support */
1961extern void dev_set_rx_mode(struct net_device *dev); 2132extern void dev_set_rx_mode(struct net_device *dev);
1962extern void __dev_set_rx_mode(struct net_device *dev); 2133extern void __dev_set_rx_mode(struct net_device *dev);
1963extern int dev_unicast_delete(struct net_device *dev, void *addr);
1964extern int dev_unicast_add(struct net_device *dev, void *addr);
1965extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1966extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1967extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1968extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1969extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1970extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1971extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1972extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1973extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1974extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1975extern int dev_set_promiscuity(struct net_device *dev, int inc); 2134extern int dev_set_promiscuity(struct net_device *dev, int inc);
1976extern int dev_set_allmulti(struct net_device *dev, int inc); 2135extern int dev_set_allmulti(struct net_device *dev, int inc);
1977extern void netdev_state_change(struct net_device *dev); 2136extern void netdev_state_change(struct net_device *dev);
1978extern void netdev_bonding_change(struct net_device *dev, 2137extern int netdev_bonding_change(struct net_device *dev,
1979 unsigned long event); 2138 unsigned long event);
1980extern void netdev_features_change(struct net_device *dev); 2139extern void netdev_features_change(struct net_device *dev);
1981/* Load a device via the kmod */ 2140/* Load a device via the kmod */
1982extern void dev_load(struct net *net, const char *name); 2141extern void dev_load(struct net *net, const char *name);
1983extern void dev_mcast_init(void); 2142extern void dev_mcast_init(void);
1984extern const struct net_device_stats *dev_get_stats(struct net_device *dev); 2143extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
1985extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2144 struct rtnl_link_stats64 *storage);
2145extern void dev_txq_stats_fold(const struct net_device *dev,
2146 struct rtnl_link_stats64 *stats);
1986 2147
1987extern int netdev_max_backlog; 2148extern int netdev_max_backlog;
2149extern int netdev_tstamp_prequeue;
1988extern int weight_p; 2150extern int weight_p;
1989extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2151extern int netdev_set_master(struct net_device *dev, struct net_device *master);
1990extern int skb_checksum_help(struct sk_buff *skb); 2152extern int skb_checksum_help(struct sk_buff *skb);
@@ -2045,54 +2207,14 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2045 dev->gso_max_size = size; 2207 dev->gso_max_size = size;
2046} 2208}
2047 2209
2048static inline void skb_bond_set_mac_by_master(struct sk_buff *skb, 2210extern int __skb_bond_should_drop(struct sk_buff *skb,
2049 struct net_device *master) 2211 struct net_device *master);
2050{
2051 if (skb->pkt_type == PACKET_HOST) {
2052 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
2053 2212
2054 memcpy(dest, master->dev_addr, ETH_ALEN);
2055 }
2056}
2057
2058/* On bonding slaves other than the currently active slave, suppress
2059 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
2060 * ARP on active-backup slaves with arp_validate enabled.
2061 */
2062static inline int skb_bond_should_drop(struct sk_buff *skb, 2213static inline int skb_bond_should_drop(struct sk_buff *skb,
2063 struct net_device *master) 2214 struct net_device *master)
2064{ 2215{
2065 if (master) { 2216 if (master)
2066 struct net_device *dev = skb->dev; 2217 return __skb_bond_should_drop(skb, master);
2067
2068 if (master->priv_flags & IFF_MASTER_ARPMON)
2069 dev->last_rx = jiffies;
2070
2071 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
2072 /* Do address unmangle. The local destination address
2073 * will be always the one master has. Provides the right
2074 * functionality in a bridge.
2075 */
2076 skb_bond_set_mac_by_master(skb, master);
2077 }
2078
2079 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
2080 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
2081 skb->protocol == __cpu_to_be16(ETH_P_ARP))
2082 return 0;
2083
2084 if (master->priv_flags & IFF_MASTER_ALB) {
2085 if (skb->pkt_type != PACKET_BROADCAST &&
2086 skb->pkt_type != PACKET_MULTICAST)
2087 return 0;
2088 }
2089 if (master->priv_flags & IFF_MASTER_8023AD &&
2090 skb->protocol == __cpu_to_be16(ETH_P_SLOW))
2091 return 0;
2092
2093 return 1;
2094 }
2095 }
2096 return 0; 2218 return 0;
2097} 2219}
2098 2220
@@ -2131,25 +2253,23 @@ static inline const char *netdev_name(const struct net_device *dev)
2131 return dev->name; 2253 return dev->name;
2132} 2254}
2133 2255
2134#define netdev_printk(level, netdev, format, args...) \ 2256extern int netdev_printk(const char *level, const struct net_device *dev,
2135 dev_printk(level, (netdev)->dev.parent, \ 2257 const char *format, ...)
2136 "%s: " format, \ 2258 __attribute__ ((format (printf, 3, 4)));
2137 netdev_name(netdev), ##args) 2259extern int netdev_emerg(const struct net_device *dev, const char *format, ...)
2138 2260 __attribute__ ((format (printf, 2, 3)));
2139#define netdev_emerg(dev, format, args...) \ 2261extern int netdev_alert(const struct net_device *dev, const char *format, ...)
2140 netdev_printk(KERN_EMERG, dev, format, ##args) 2262 __attribute__ ((format (printf, 2, 3)));
2141#define netdev_alert(dev, format, args...) \ 2263extern int netdev_crit(const struct net_device *dev, const char *format, ...)
2142 netdev_printk(KERN_ALERT, dev, format, ##args) 2264 __attribute__ ((format (printf, 2, 3)));
2143#define netdev_crit(dev, format, args...) \ 2265extern int netdev_err(const struct net_device *dev, const char *format, ...)
2144 netdev_printk(KERN_CRIT, dev, format, ##args) 2266 __attribute__ ((format (printf, 2, 3)));
2145#define netdev_err(dev, format, args...) \ 2267extern int netdev_warn(const struct net_device *dev, const char *format, ...)
2146 netdev_printk(KERN_ERR, dev, format, ##args) 2268 __attribute__ ((format (printf, 2, 3)));
2147#define netdev_warn(dev, format, args...) \ 2269extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2148 netdev_printk(KERN_WARNING, dev, format, ##args) 2270 __attribute__ ((format (printf, 2, 3)));
2149#define netdev_notice(dev, format, args...) \ 2271extern int netdev_info(const struct net_device *dev, const char *format, ...)
2150 netdev_printk(KERN_NOTICE, dev, format, ##args) 2272 __attribute__ ((format (printf, 2, 3)));
2151#define netdev_info(dev, format, args...) \
2152 netdev_printk(KERN_INFO, dev, format, ##args)
2153 2273
2154#if defined(DEBUG) 2274#if defined(DEBUG)
2155#define netdev_dbg(__dev, format, args...) \ 2275#define netdev_dbg(__dev, format, args...) \
@@ -2197,20 +2317,26 @@ do { \
2197 netdev_printk(level, (dev), fmt, ##args); \ 2317 netdev_printk(level, (dev), fmt, ##args); \
2198} while (0) 2318} while (0)
2199 2319
2320#define netif_level(level, priv, type, dev, fmt, args...) \
2321do { \
2322 if (netif_msg_##type(priv)) \
2323 netdev_##level(dev, fmt, ##args); \
2324} while (0)
2325
2200#define netif_emerg(priv, type, dev, fmt, args...) \ 2326#define netif_emerg(priv, type, dev, fmt, args...) \
2201 netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) 2327 netif_level(emerg, priv, type, dev, fmt, ##args)
2202#define netif_alert(priv, type, dev, fmt, args...) \ 2328#define netif_alert(priv, type, dev, fmt, args...) \
2203 netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) 2329 netif_level(alert, priv, type, dev, fmt, ##args)
2204#define netif_crit(priv, type, dev, fmt, args...) \ 2330#define netif_crit(priv, type, dev, fmt, args...) \
2205 netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) 2331 netif_level(crit, priv, type, dev, fmt, ##args)
2206#define netif_err(priv, type, dev, fmt, args...) \ 2332#define netif_err(priv, type, dev, fmt, args...) \
2207 netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) 2333 netif_level(err, priv, type, dev, fmt, ##args)
2208#define netif_warn(priv, type, dev, fmt, args...) \ 2334#define netif_warn(priv, type, dev, fmt, args...) \
2209 netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) 2335 netif_level(warn, priv, type, dev, fmt, ##args)
2210#define netif_notice(priv, type, dev, fmt, args...) \ 2336#define netif_notice(priv, type, dev, fmt, args...) \
2211 netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) 2337 netif_level(notice, priv, type, dev, fmt, ##args)
2212#define netif_info(priv, type, dev, fmt, args...) \ 2338#define netif_info(priv, type, dev, fmt, args...) \
2213 netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) 2339 netif_level(info, priv, type, dev, fmt, ##args)
2214 2340
2215#if defined(DEBUG) 2341#if defined(DEBUG)
2216#define netif_dbg(priv, type, dev, format, args...) \ 2342#define netif_dbg(priv, type, dev, format, args...) \
@@ -2233,12 +2359,12 @@ do { \
2233#endif 2359#endif
2234 2360
2235#if defined(VERBOSE_DEBUG) 2361#if defined(VERBOSE_DEBUG)
2236#define netif_vdbg netdev_dbg 2362#define netif_vdbg netif_dbg
2237#else 2363#else
2238#define netif_vdbg(priv, type, dev, format, args...) \ 2364#define netif_vdbg(priv, type, dev, format, args...) \
2239({ \ 2365({ \
2240 if (0) \ 2366 if (0) \
2241 netif_printk(KERN_DEBUG, dev, format, ##args); \ 2367 netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
2242 0; \ 2368 0; \
2243}) 2369})
2244#endif 2370#endif
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index a5a63e41b8af..edeeabdc1500 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -3,11 +3,13 @@ header-y += nf_conntrack_tuple_common.h
3header-y += nfnetlink_conntrack.h 3header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h 4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h 5header-y += nfnetlink_queue.h
6header-y += xt_CHECKSUM.h
6header-y += xt_CLASSIFY.h 7header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h 8header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h 9header-y += xt_CONNSECMARK.h
9header-y += xt_CT.h 10header-y += xt_CT.h
10header-y += xt_DSCP.h 11header-y += xt_DSCP.h
12header-y += xt_IDLETIMER.h
11header-y += xt_LED.h 13header-y += xt_LED.h
12header-y += xt_MARK.h 14header-y += xt_MARK.h
13header-y += xt_NFLOG.h 15header-y += xt_NFLOG.h
@@ -16,18 +18,21 @@ header-y += xt_RATEEST.h
16header-y += xt_SECMARK.h 18header-y += xt_SECMARK.h
17header-y += xt_TCPMSS.h 19header-y += xt_TCPMSS.h
18header-y += xt_TCPOPTSTRIP.h 20header-y += xt_TCPOPTSTRIP.h
21header-y += xt_TEE.h
19header-y += xt_TPROXY.h 22header-y += xt_TPROXY.h
23header-y += xt_cluster.h
20header-y += xt_comment.h 24header-y += xt_comment.h
21header-y += xt_connbytes.h 25header-y += xt_connbytes.h
22header-y += xt_connlimit.h 26header-y += xt_connlimit.h
23header-y += xt_connmark.h 27header-y += xt_connmark.h
24header-y += xt_conntrack.h 28header-y += xt_conntrack.h
25header-y += xt_cluster.h 29header-y += xt_cpu.h
26header-y += xt_dccp.h 30header-y += xt_dccp.h
27header-y += xt_dscp.h 31header-y += xt_dscp.h
28header-y += xt_esp.h 32header-y += xt_esp.h
29header-y += xt_hashlimit.h 33header-y += xt_hashlimit.h
30header-y += xt_iprange.h 34header-y += xt_iprange.h
35header-y += xt_ipvs.h
31header-y += xt_helper.h 36header-y += xt_helper.h
32header-y += xt_length.h 37header-y += xt_length.h
33header-y += xt_limit.h 38header-y += xt_limit.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index c608677dda60..1afd18c855ec 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -76,6 +76,10 @@ enum ip_conntrack_status {
76 /* Conntrack is a template */ 76 /* Conntrack is a template */
77 IPS_TEMPLATE_BIT = 11, 77 IPS_TEMPLATE_BIT = 11,
78 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT), 78 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
79
80 /* Conntrack is a fake untracked entry */
81 IPS_UNTRACKED_BIT = 12,
82 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
79}; 83};
80 84
81/* Connection tracking event types */ 85/* Connection tracking event types */
@@ -113,6 +117,7 @@ struct ip_conntrack_stat {
113 unsigned int expect_new; 117 unsigned int expect_new;
114 unsigned int expect_create; 118 unsigned int expect_create;
115 unsigned int expect_delete; 119 unsigned int expect_delete;
120 unsigned int search_restart;
116}; 121};
117 122
118/* call to create an explicit dependency on nf_conntrack. */ 123/* call to create an explicit dependency on nf_conntrack. */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/linux/netfilter/nf_conntrack_tuple_common.h
index 8e145f0d61cb..2ea22b018a87 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -1,8 +1,7 @@
1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H 1#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
2#define _NF_CONNTRACK_TUPLE_COMMON_H 2#define _NF_CONNTRACK_TUPLE_COMMON_H
3 3
4enum ip_conntrack_dir 4enum ip_conntrack_dir {
5{
6 IP_CT_DIR_ORIGINAL, 5 IP_CT_DIR_ORIGINAL,
7 IP_CT_DIR_REPLY, 6 IP_CT_DIR_REPLY,
8 IP_CT_DIR_MAX 7 IP_CT_DIR_MAX
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index d3bab7a2c9b7..ea9b8d380527 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -89,6 +89,7 @@ enum nfulnl_attr_config {
89#define NFULNL_COPY_NONE 0x00 89#define NFULNL_COPY_NONE 0x00
90#define NFULNL_COPY_META 0x01 90#define NFULNL_COPY_META 0x01
91#define NFULNL_COPY_PACKET 0x02 91#define NFULNL_COPY_PACKET 0x02
92/* 0xff is reserved, don't use it for new copy modes. */
92 93
93#define NFULNL_CFG_F_SEQ 0x0001 94#define NFULNL_CFG_F_SEQ 0x0001
94#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002 95#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 84c7c928e9eb..24e5d01d27d0 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,9 +1,10 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3 3#include <linux/kernel.h>
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6#define XT_FUNCTION_MAXNAMELEN 30 6#define XT_FUNCTION_MAXNAMELEN 30
7#define XT_EXTENSION_MAXNAMELEN 29
7#define XT_TABLE_MAXNAMELEN 32 8#define XT_TABLE_MAXNAMELEN 32
8 9
9struct xt_entry_match { 10struct xt_entry_match {
@@ -12,8 +13,7 @@ struct xt_entry_match {
12 __u16 match_size; 13 __u16 match_size;
13 14
14 /* Used by userspace */ 15 /* Used by userspace */
15 char name[XT_FUNCTION_MAXNAMELEN-1]; 16 char name[XT_EXTENSION_MAXNAMELEN];
16
17 __u8 revision; 17 __u8 revision;
18 } user; 18 } user;
19 struct { 19 struct {
@@ -36,8 +36,7 @@ struct xt_entry_target {
36 __u16 target_size; 36 __u16 target_size;
37 37
38 /* Used by userspace */ 38 /* Used by userspace */
39 char name[XT_FUNCTION_MAXNAMELEN-1]; 39 char name[XT_EXTENSION_MAXNAMELEN];
40
41 __u8 revision; 40 __u8 revision;
42 } user; 41 } user;
43 struct { 42 struct {
@@ -70,8 +69,7 @@ struct xt_standard_target {
70/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision 69/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
71 * kernel supports, if >= revision. */ 70 * kernel supports, if >= revision. */
72struct xt_get_revision { 71struct xt_get_revision {
73 char name[XT_FUNCTION_MAXNAMELEN-1]; 72 char name[XT_EXTENSION_MAXNAMELEN];
74
75 __u8 revision; 73 __u8 revision;
76}; 74};
77 75
@@ -93,7 +91,7 @@ struct _xt_align {
93 __u64 u64; 91 __u64 u64;
94}; 92};
95 93
96#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) 94#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
97 95
98/* Standard return verdict, or do jump. */ 96/* Standard return verdict, or do jump. */
99#define XT_STANDARD_TARGET "" 97#define XT_STANDARD_TARGET ""
@@ -185,40 +183,53 @@ struct xt_counters_info {
185#include <linux/netdevice.h> 183#include <linux/netdevice.h>
186 184
187/** 185/**
188 * struct xt_match_param - parameters for match extensions' match functions 186 * struct xt_action_param - parameters for matches/targets
189 * 187 *
188 * @match: the match extension
189 * @target: the target extension
190 * @matchinfo: per-match data
191 * @targetinfo: per-target data
190 * @in: input netdevice 192 * @in: input netdevice
191 * @out: output netdevice 193 * @out: output netdevice
192 * @match: struct xt_match through which this function was invoked
193 * @matchinfo: per-match data
194 * @fragoff: packet is a fragment, this is the data offset 194 * @fragoff: packet is a fragment, this is the data offset
195 * @thoff: position of transport header relative to skb->data 195 * @thoff: position of transport header relative to skb->data
196 * @hook: hook number given packet came from 196 * @hook: hook number given packet came from
197 * @family: Actual NFPROTO_* through which the function is invoked 197 * @family: Actual NFPROTO_* through which the function is invoked
198 * (helpful when match->family == NFPROTO_UNSPEC) 198 * (helpful when match->family == NFPROTO_UNSPEC)
199 *
200 * Fields written to by extensions:
201 *
199 * @hotdrop: drop packet if we had inspection problems 202 * @hotdrop: drop packet if we had inspection problems
203 * Network namespace obtainable using dev_net(in/out)
200 */ 204 */
201struct xt_match_param { 205struct xt_action_param {
206 union {
207 const struct xt_match *match;
208 const struct xt_target *target;
209 };
210 union {
211 const void *matchinfo, *targinfo;
212 };
202 const struct net_device *in, *out; 213 const struct net_device *in, *out;
203 const struct xt_match *match;
204 const void *matchinfo;
205 int fragoff; 214 int fragoff;
206 unsigned int thoff; 215 unsigned int thoff;
207 unsigned int hooknum; 216 unsigned int hooknum;
208 u_int8_t family; 217 u_int8_t family;
209 bool *hotdrop; 218 bool hotdrop;
210}; 219};
211 220
212/** 221/**
213 * struct xt_mtchk_param - parameters for match extensions' 222 * struct xt_mtchk_param - parameters for match extensions'
214 * checkentry functions 223 * checkentry functions
215 * 224 *
225 * @net: network namespace through which the check was invoked
216 * @table: table the rule is tried to be inserted into 226 * @table: table the rule is tried to be inserted into
217 * @entryinfo: the family-specific rule data 227 * @entryinfo: the family-specific rule data
218 * (struct ipt_ip, ip6t_ip, ebt_entry) 228 * (struct ipt_ip, ip6t_ip, arpt_arp or (note) ebt_entry)
219 * @match: struct xt_match through which this function was invoked 229 * @match: struct xt_match through which this function was invoked
220 * @matchinfo: per-match data 230 * @matchinfo: per-match data
221 * @hook_mask: via which hooks the new rule is reachable 231 * @hook_mask: via which hooks the new rule is reachable
232 * Other fields as above.
222 */ 233 */
223struct xt_mtchk_param { 234struct xt_mtchk_param {
224 struct net *net; 235 struct net *net;
@@ -230,7 +241,10 @@ struct xt_mtchk_param {
230 u_int8_t family; 241 u_int8_t family;
231}; 242};
232 243
233/* Match destructor parameters */ 244/**
245 * struct xt_mdtor_param - match destructor parameters
246 * Fields as above.
247 */
234struct xt_mtdtor_param { 248struct xt_mtdtor_param {
235 struct net *net; 249 struct net *net;
236 const struct xt_match *match; 250 const struct xt_match *match;
@@ -239,23 +253,6 @@ struct xt_mtdtor_param {
239}; 253};
240 254
241/** 255/**
242 * struct xt_target_param - parameters for target extensions' target functions
243 *
244 * @hooknum: hook through which this target was invoked
245 * @target: struct xt_target through which this function was invoked
246 * @targinfo: per-target data
247 *
248 * Other fields see above.
249 */
250struct xt_target_param {
251 const struct net_device *in, *out;
252 const struct xt_target *target;
253 const void *targinfo;
254 unsigned int hooknum;
255 u_int8_t family;
256};
257
258/**
259 * struct xt_tgchk_param - parameters for target extensions' 256 * struct xt_tgchk_param - parameters for target extensions'
260 * checkentry functions 257 * checkentry functions
261 * 258 *
@@ -285,7 +282,7 @@ struct xt_tgdtor_param {
285struct xt_match { 282struct xt_match {
286 struct list_head list; 283 struct list_head list;
287 284
288 const char name[XT_FUNCTION_MAXNAMELEN-1]; 285 const char name[XT_EXTENSION_MAXNAMELEN];
289 u_int8_t revision; 286 u_int8_t revision;
290 287
291 /* Return true or false: return FALSE and set *hotdrop = 1 to 288 /* Return true or false: return FALSE and set *hotdrop = 1 to
@@ -294,10 +291,10 @@ struct xt_match {
294 non-linear skb, using skb_header_pointer and 291 non-linear skb, using skb_header_pointer and
295 skb_ip_make_writable. */ 292 skb_ip_make_writable. */
296 bool (*match)(const struct sk_buff *skb, 293 bool (*match)(const struct sk_buff *skb,
297 const struct xt_match_param *); 294 struct xt_action_param *);
298 295
299 /* Called when user tries to insert an entry of this type. */ 296 /* Called when user tries to insert an entry of this type. */
300 bool (*checkentry)(const struct xt_mtchk_param *); 297 int (*checkentry)(const struct xt_mtchk_param *);
301 298
302 /* Called when entry of this type deleted. */ 299 /* Called when entry of this type deleted. */
303 void (*destroy)(const struct xt_mtdtor_param *); 300 void (*destroy)(const struct xt_mtdtor_param *);
@@ -309,9 +306,6 @@ struct xt_match {
309 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 306 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
310 struct module *me; 307 struct module *me;
311 308
312 /* Free to use by each match */
313 unsigned long data;
314
315 const char *table; 309 const char *table;
316 unsigned int matchsize; 310 unsigned int matchsize;
317#ifdef CONFIG_COMPAT 311#ifdef CONFIG_COMPAT
@@ -327,19 +321,20 @@ struct xt_match {
327struct xt_target { 321struct xt_target {
328 struct list_head list; 322 struct list_head list;
329 323
330 const char name[XT_FUNCTION_MAXNAMELEN-1]; 324 const char name[XT_EXTENSION_MAXNAMELEN];
325 u_int8_t revision;
331 326
332 /* Returns verdict. Argument order changed since 2.6.9, as this 327 /* Returns verdict. Argument order changed since 2.6.9, as this
333 must now handle non-linear skbs, using skb_copy_bits and 328 must now handle non-linear skbs, using skb_copy_bits and
334 skb_ip_make_writable. */ 329 skb_ip_make_writable. */
335 unsigned int (*target)(struct sk_buff *skb, 330 unsigned int (*target)(struct sk_buff *skb,
336 const struct xt_target_param *); 331 const struct xt_action_param *);
337 332
338 /* Called when user tries to insert an entry of this type: 333 /* Called when user tries to insert an entry of this type:
339 hook_mask is a bitmask of hooks from which it can be 334 hook_mask is a bitmask of hooks from which it can be
340 called. */ 335 called. */
341 /* Should return true or false. */ 336 /* Should return 0 on success or an error code otherwise (-Exxxx). */
342 bool (*checkentry)(const struct xt_tgchk_param *); 337 int (*checkentry)(const struct xt_tgchk_param *);
343 338
344 /* Called when entry of this type deleted. */ 339 /* Called when entry of this type deleted. */
345 void (*destroy)(const struct xt_tgdtor_param *); 340 void (*destroy)(const struct xt_tgdtor_param *);
@@ -360,7 +355,6 @@ struct xt_target {
360 unsigned short proto; 355 unsigned short proto;
361 356
362 unsigned short family; 357 unsigned short family;
363 u_int8_t revision;
364}; 358};
365 359
366/* Furniture shopping... */ 360/* Furniture shopping... */
@@ -398,6 +392,13 @@ struct xt_table_info {
398 unsigned int hook_entry[NF_INET_NUMHOOKS]; 392 unsigned int hook_entry[NF_INET_NUMHOOKS];
399 unsigned int underflow[NF_INET_NUMHOOKS]; 393 unsigned int underflow[NF_INET_NUMHOOKS];
400 394
395 /*
396 * Number of user chains. Since tables cannot have loops, at most
397 * @stacksize jumps (number of user chains) can possibly be made.
398 */
399 unsigned int stacksize;
400 unsigned int __percpu *stackptr;
401 void ***jumpstack;
401 /* ipt_entry tables: one per CPU */ 402 /* ipt_entry tables: one per CPU */
402 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ 403 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
403 void *entries[1]; 404 void *entries[1];
@@ -433,6 +434,8 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
433 434
434extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision); 435extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
435extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision); 436extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
437extern struct xt_match *xt_request_find_match(u8 af, const char *name,
438 u8 revision);
436extern struct xt_target *xt_request_find_target(u8 af, const char *name, 439extern struct xt_target *xt_request_find_target(u8 af, const char *name,
437 u8 revision); 440 u8 revision);
438extern int xt_find_revision(u8 af, const char *name, u8 revision, 441extern int xt_find_revision(u8 af, const char *name, u8 revision,
@@ -598,7 +601,7 @@ struct _compat_xt_align {
598 compat_u64 u64; 601 compat_u64 u64;
599}; 602};
600 603
601#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) 604#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
602 605
603extern void xt_compat_lock(u_int8_t af); 606extern void xt_compat_lock(u_int8_t af);
604extern void xt_compat_unlock(u_int8_t af); 607extern void xt_compat_unlock(u_int8_t af);
diff --git a/include/linux/netfilter/xt_CHECKSUM.h b/include/linux/netfilter/xt_CHECKSUM.h
new file mode 100644
index 000000000000..9a2e4661654e
--- /dev/null
+++ b/include/linux/netfilter/xt_CHECKSUM.h
@@ -0,0 +1,20 @@
1/* Header file for iptables ipt_CHECKSUM target
2 *
3 * (C) 2002 by Harald Welte <laforge@gnumonks.org>
4 * (C) 2010 Red Hat Inc
5 * Author: Michael S. Tsirkin <mst@redhat.com>
6 *
7 * This software is distributed under GNU GPL v2, 1991
8*/
9#ifndef _XT_CHECKSUM_TARGET_H
10#define _XT_CHECKSUM_TARGET_H
11
12#include <linux/types.h>
13
14#define XT_CHECKSUM_OP_FILL 0x01 /* fill in checksum in IP header */
15
16struct xt_CHECKSUM_info {
17 __u8 operation; /* bitset of operations */
18};
19
20#endif /* _XT_CHECKSUM_TARGET_H */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 0a8545866752..2f2e48ec8023 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -1,26 +1,6 @@
1#ifndef _XT_CONNMARK_H_target 1#ifndef _XT_CONNMARK_H_target
2#define _XT_CONNMARK_H_target 2#define _XT_CONNMARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_connmark.h>
5
6/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
7 * by Henrik Nordstrom <hno@marasystems.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25 5
26#endif /*_XT_CONNMARK_H_target*/ 6#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/linux/netfilter/xt_IDLETIMER.h
new file mode 100644
index 000000000000..3e1aa1be942e
--- /dev/null
+++ b/include/linux/netfilter/xt_IDLETIMER.h
@@ -0,0 +1,45 @@
1/*
2 * linux/include/linux/netfilter/xt_IDLETIMER.h
3 *
4 * Header file for Xtables timer target module.
5 *
6 * Copyright (C) 2004, 2010 Nokia Corporation
7 * Written by Timo Teras <ext-timo.teras@nokia.com>
8 *
9 * Converted to x_tables and forward-ported to 2.6.34
10 * by Luciano Coelho <luciano.coelho@nokia.com>
11 *
12 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * version 2 as published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26 * 02110-1301 USA
27 */
28
29#ifndef _XT_IDLETIMER_H
30#define _XT_IDLETIMER_H
31
32#include <linux/types.h>
33
34#define MAX_IDLETIMER_LABEL_SIZE 28
35
36struct idletimer_tg_info {
37 __u32 timeout;
38
39 char label[MAX_IDLETIMER_LABEL_SIZE];
40
41 /* for kernel module internal use only */
42 struct idletimer_tg *timer __attribute((aligned(8)));
43};
44
45#endif
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index bc9561bdef79..41c456deba22 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -1,10 +1,6 @@
1#ifndef _XT_MARK_H_target 1#ifndef _XT_MARK_H_target
2#define _XT_MARK_H_target 2#define _XT_MARK_H_target
3 3
4#include <linux/types.h> 4#include <linux/netfilter/xt_mark.h>
5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9 5
10#endif /*_XT_MARK_H_target */ 6#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_TEE.h b/include/linux/netfilter/xt_TEE.h
new file mode 100644
index 000000000000..5c21d5c829af
--- /dev/null
+++ b/include/linux/netfilter/xt_TEE.h
@@ -0,0 +1,12 @@
1#ifndef _XT_TEE_TARGET_H
2#define _XT_TEE_TARGET_H
3
4struct xt_tee_tginfo {
5 union nf_inet_addr gw;
6 char oif[16];
7
8 /* used internally by the kernel */
9 struct xt_tee_priv *priv __attribute__((aligned(8)));
10};
11
12#endif /* _XT_TEE_TARGET_H */
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index 619e47cde01a..efc17a8305fb 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -12,6 +12,17 @@
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14 14
15enum {
16 XT_CONNMARK_SET = 0,
17 XT_CONNMARK_SAVE,
18 XT_CONNMARK_RESTORE
19};
20
21struct xt_connmark_tginfo1 {
22 __u32 ctmark, ctmask, nfmask;
23 __u8 mode;
24};
25
15struct xt_connmark_mtinfo1 { 26struct xt_connmark_mtinfo1 {
16 __u32 mark, mask; 27 __u32 mark, mask;
17 __u8 invert; 28 __u8 invert;
diff --git a/include/linux/netfilter/xt_cpu.h b/include/linux/netfilter/xt_cpu.h
new file mode 100644
index 000000000000..93c7f11d8f42
--- /dev/null
+++ b/include/linux/netfilter/xt_cpu.h
@@ -0,0 +1,11 @@
1#ifndef _XT_CPU_H
2#define _XT_CPU_H
3
4#include <linux/types.h>
5
6struct xt_cpu_info {
7 __u32 cpu;
8 __u32 invert;
9};
10
11#endif /*_XT_CPU_H*/
diff --git a/include/linux/netfilter/xt_ipvs.h b/include/linux/netfilter/xt_ipvs.h
new file mode 100644
index 000000000000..1167aeb7a347
--- /dev/null
+++ b/include/linux/netfilter/xt_ipvs.h
@@ -0,0 +1,27 @@
1#ifndef _XT_IPVS_H
2#define _XT_IPVS_H
3
4enum {
5 XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
6 XT_IPVS_PROTO = 1 << 1,
7 XT_IPVS_VADDR = 1 << 2,
8 XT_IPVS_VPORT = 1 << 3,
9 XT_IPVS_DIR = 1 << 4,
10 XT_IPVS_METHOD = 1 << 5,
11 XT_IPVS_VPORTCTL = 1 << 6,
12 XT_IPVS_MASK = (1 << 7) - 1,
13 XT_IPVS_ONCE_MASK = XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY
14};
15
16struct xt_ipvs_mtinfo {
17 union nf_inet_addr vaddr, vmask;
18 __be16 vport;
19 __u8 l4proto;
20 __u8 fwd_method;
21 __be16 vportctl;
22
23 __u8 invert;
24 __u8 bitmask;
25};
26
27#endif /* _XT_IPVS_H */
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 6607c8f38ea5..ecadc40d5cde 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -3,6 +3,10 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct xt_mark_tginfo2 {
7 __u32 mark, mask;
8};
9
6struct xt_mark_mtinfo1 { 10struct xt_mark_mtinfo1 {
7 __u32 mark, mask; 11 __u32 mark, mask;
8 __u8 invert; 12 __u8 invert;
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index 8dc89dfc1361..b0d28c659ab7 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -11,9 +11,9 @@ struct xt_quota_priv;
11struct xt_quota_info { 11struct xt_quota_info {
12 u_int32_t flags; 12 u_int32_t flags;
13 u_int32_t pad; 13 u_int32_t pad;
14 aligned_u64 quota;
14 15
15 /* Used internally by the kernel */ 16 /* Used internally by the kernel */
16 aligned_u64 quota;
17 struct xt_quota_priv *master; 17 struct xt_quota_priv *master;
18}; 18};
19 19
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
index d2c276609925..83318e01425e 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/linux/netfilter/xt_recent.h
@@ -9,6 +9,7 @@ enum {
9 XT_RECENT_UPDATE = 1 << 2, 9 XT_RECENT_UPDATE = 1 << 2,
10 XT_RECENT_REMOVE = 1 << 3, 10 XT_RECENT_REMOVE = 1 << 3,
11 XT_RECENT_TTL = 1 << 4, 11 XT_RECENT_TTL = 1 << 4,
12 XT_RECENT_REAP = 1 << 5,
12 13
13 XT_RECENT_SOURCE = 0, 14 XT_RECENT_SOURCE = 0,
14 XT_RECENT_DEST = 1, 15 XT_RECENT_DEST = 1,
@@ -16,6 +17,12 @@ enum {
16 XT_RECENT_NAME_LEN = 200, 17 XT_RECENT_NAME_LEN = 200,
17}; 18};
18 19
20/* Only allowed with --rcheck and --update */
21#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
22
23#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
24 XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
25
19struct xt_recent_mtinfo { 26struct xt_recent_mtinfo {
20 __u32 seconds; 27 __u32 seconds;
21 __u32 hit_count; 28 __u32 hit_count;
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index f8105e54716a..0ddd161f3b06 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -41,10 +41,10 @@ enum nf_br_hook_priorities {
41 41
42#define BRNF_PKT_TYPE 0x01 42#define BRNF_PKT_TYPE 0x01
43#define BRNF_BRIDGED_DNAT 0x02 43#define BRNF_BRIDGED_DNAT 0x02
44#define BRNF_DONT_TAKE_PARENT 0x04 44#define BRNF_BRIDGED 0x04
45#define BRNF_BRIDGED 0x08 45#define BRNF_NF_BRIDGE_PREROUTING 0x08
46#define BRNF_NF_BRIDGE_PREROUTING 0x10 46#define BRNF_8021Q 0x10
47 47#define BRNF_PPPoE 0x20
48 48
49/* Only used in br_forward.c */ 49/* Only used in br_forward.c */
50extern int nf_bridge_copy_header(struct sk_buff *skb); 50extern int nf_bridge_copy_header(struct sk_buff *skb);
@@ -68,6 +68,27 @@ static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
68 } 68 }
69} 69}
70 70
71static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
72{
73 if (unlikely(skb->nf_bridge->mask & BRNF_PPPoE))
74 return PPPOE_SES_HLEN;
75 return 0;
76}
77
78extern int br_handle_frame_finish(struct sk_buff *skb);
79/* Only used in br_device.c */
80static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
81{
82 struct nf_bridge_info *nf_bridge = skb->nf_bridge;
83
84 skb_pull(skb, ETH_HLEN);
85 nf_bridge->mask ^= BRNF_BRIDGED_DNAT;
86 skb_copy_to_linear_data_offset(skb, -(ETH_HLEN-ETH_ALEN),
87 skb->nf_bridge->data, ETH_HLEN-ETH_ALEN);
88 skb->dev = nf_bridge->physindev;
89 return br_handle_frame_finish(skb);
90}
91
71/* This is called by the IP fragmenting code and it ensures there is 92/* This is called by the IP fragmenting code and it ensures there is
72 * enough room for the encapsulating header (if there is one). */ 93 * enough room for the encapsulating header (if there is one). */
73static inline unsigned int nf_bridge_pad(const struct sk_buff *skb) 94static inline unsigned int nf_bridge_pad(const struct sk_buff *skb)
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/linux/netfilter_ipv4/ipt_LOG.h
index 90fa6525ef9c..dcdbadf9fd4a 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -7,7 +7,8 @@
7#define IPT_LOG_IPOPT 0x04 /* Log IP options */ 7#define IPT_LOG_IPOPT 0x04 /* Log IP options */
8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IPT_LOG_UID 0x08 /* Log UID owning local socket */
9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */ 9#define IPT_LOG_NFLOG 0x10 /* Unsupported, don't reuse */
10#define IPT_LOG_MASK 0x1f 10#define IPT_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define IPT_LOG_MASK 0x2f
11 12
12struct ipt_log_info { 13struct ipt_log_info {
13 unsigned char level; 14 unsigned char level;
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index e5ba03d783c6..18442ff19c07 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -316,10 +316,6 @@ extern int ip6t_ext_hdr(u8 nexthdr);
316extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 316extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
317 int target, unsigned short *fragoff); 317 int target, unsigned short *fragoff);
318 318
319extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
320 const struct in6_addr *mask,
321 const struct in6_addr *addr2);
322
323#define IP6T_ALIGN(s) XT_ALIGN(s) 319#define IP6T_ALIGN(s) XT_ALIGN(s)
324 320
325#ifdef CONFIG_COMPAT 321#ifdef CONFIG_COMPAT
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/linux/netfilter_ipv6/ip6t_LOG.h
index 0d0119b0458c..9dd5579e02ec 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -7,7 +7,8 @@
7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */ 7#define IP6T_LOG_IPOPT 0x04 /* Log IP options */
8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */ 8#define IP6T_LOG_UID 0x08 /* Log UID owning local socket */
9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */ 9#define IP6T_LOG_NFLOG 0x10 /* Unsupported, don't use */
10#define IP6T_LOG_MASK 0x1f 10#define IP6T_LOG_MACDECODE 0x20 /* Decode MAC header */
11#define IP6T_LOG_MASK 0x2f
11 12
12struct ip6t_log_info { 13struct ip6t_log_info {
13 unsigned char level; 14 unsigned char level;
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 6eaca5e1e8ca..59d066936ab9 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -188,6 +188,10 @@ extern int netlink_has_listeners(struct sock *sk, unsigned int group);
188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 188extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 189extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
190 __u32 group, gfp_t allocation); 190 __u32 group, gfp_t allocation);
191extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
192 __u32 pid, __u32 group, gfp_t allocation,
193 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
194 void *filter_data);
191extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 195extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code);
192extern int netlink_register_notifier(struct notifier_block *nb); 196extern int netlink_register_notifier(struct notifier_block *nb);
193extern int netlink_unregister_notifier(struct notifier_block *nb); 197extern int netlink_unregister_notifier(struct notifier_block *nb);
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index a765ea898549..413742c92d14 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -14,6 +14,7 @@
14 14
15struct netpoll { 15struct netpoll {
16 struct net_device *dev; 16 struct net_device *dev;
17 struct net_device *real_dev;
17 char dev_name[IFNAMSIZ]; 18 char dev_name[IFNAMSIZ];
18 const char *name; 19 const char *name;
19 void (*rx_hook)(struct netpoll *, int, char *, int); 20 void (*rx_hook)(struct netpoll *, int, char *, int);
@@ -36,41 +37,52 @@ struct netpoll_info {
36 struct sk_buff_head txq; 37 struct sk_buff_head txq;
37 38
38 struct delayed_work tx_work; 39 struct delayed_work tx_work;
40
41 struct netpoll *netpoll;
39}; 42};
40 43
44void netpoll_poll_dev(struct net_device *dev);
41void netpoll_poll(struct netpoll *np); 45void netpoll_poll(struct netpoll *np);
42void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 46void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
43void netpoll_print_options(struct netpoll *np); 47void netpoll_print_options(struct netpoll *np);
44int netpoll_parse_options(struct netpoll *np, char *opt); 48int netpoll_parse_options(struct netpoll *np, char *opt);
49int __netpoll_setup(struct netpoll *np);
45int netpoll_setup(struct netpoll *np); 50int netpoll_setup(struct netpoll *np);
46int netpoll_trap(void); 51int netpoll_trap(void);
47void netpoll_set_trap(int trap); 52void netpoll_set_trap(int trap);
53void __netpoll_cleanup(struct netpoll *np);
48void netpoll_cleanup(struct netpoll *np); 54void netpoll_cleanup(struct netpoll *np);
49int __netpoll_rx(struct sk_buff *skb); 55int __netpoll_rx(struct sk_buff *skb);
56void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
50 57
51 58
52#ifdef CONFIG_NETPOLL 59#ifdef CONFIG_NETPOLL
53static inline int netpoll_rx(struct sk_buff *skb) 60static inline bool netpoll_rx(struct sk_buff *skb)
54{ 61{
55 struct netpoll_info *npinfo = skb->dev->npinfo; 62 struct netpoll_info *npinfo;
56 unsigned long flags; 63 unsigned long flags;
57 int ret = 0; 64 bool ret = false;
65
66 rcu_read_lock_bh();
67 npinfo = rcu_dereference_bh(skb->dev->npinfo);
58 68
59 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) 69 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags))
60 return 0; 70 goto out;
61 71
62 spin_lock_irqsave(&npinfo->rx_lock, flags); 72 spin_lock_irqsave(&npinfo->rx_lock, flags);
63 /* check rx_flags again with the lock held */ 73 /* check rx_flags again with the lock held */
64 if (npinfo->rx_flags && __netpoll_rx(skb)) 74 if (npinfo->rx_flags && __netpoll_rx(skb))
65 ret = 1; 75 ret = true;
66 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 76 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
67 77
78out:
79 rcu_read_unlock_bh();
68 return ret; 80 return ret;
69} 81}
70 82
71static inline int netpoll_rx_on(struct sk_buff *skb) 83static inline int netpoll_rx_on(struct sk_buff *skb)
72{ 84{
73 struct netpoll_info *npinfo = skb->dev->npinfo; 85 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
74 86
75 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags); 87 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
76} 88}
@@ -86,7 +98,6 @@ static inline void *netpoll_poll_lock(struct napi_struct *napi)
86{ 98{
87 struct net_device *dev = napi->dev; 99 struct net_device *dev = napi->dev;
88 100
89 rcu_read_lock(); /* deal with race on ->npinfo */
90 if (dev && dev->npinfo) { 101 if (dev && dev->npinfo) {
91 spin_lock(&napi->poll_lock); 102 spin_lock(&napi->poll_lock);
92 napi->poll_owner = smp_processor_id(); 103 napi->poll_owner = smp_processor_id();
@@ -103,7 +114,11 @@ static inline void netpoll_poll_unlock(void *have)
103 napi->poll_owner = -1; 114 napi->poll_owner = -1;
104 spin_unlock(&napi->poll_lock); 115 spin_unlock(&napi->poll_lock);
105 } 116 }
106 rcu_read_unlock(); 117}
118
119static inline int netpoll_tx_running(struct net_device *dev)
120{
121 return irqs_disabled();
107} 122}
108 123
109#else 124#else
@@ -129,6 +144,10 @@ static inline void netpoll_poll_unlock(void *have)
129static inline void netpoll_netdev_init(struct net_device *dev) 144static inline void netpoll_netdev_init(struct net_device *dev)
130{ 145{
131} 146}
147static inline int netpoll_tx_running(struct net_device *dev)
148{
149 return 0;
150}
132#endif 151#endif
133 152
134#endif 153#endif
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 9b8299af3741..07e40c625972 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -523,6 +523,7 @@ enum {
523 NFSPROC4_CLNT_GETACL, 523 NFSPROC4_CLNT_GETACL,
524 NFSPROC4_CLNT_SETACL, 524 NFSPROC4_CLNT_SETACL,
525 NFSPROC4_CLNT_FS_LOCATIONS, 525 NFSPROC4_CLNT_FS_LOCATIONS,
526 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
526 527
527 /* nfs41 */ 528 /* nfs41 */
528 NFSPROC4_CLNT_EXCHANGE_ID, 529 NFSPROC4_CLNT_EXCHANGE_ID,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 07ce4609fe50..508f8cf6da37 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -72,13 +72,20 @@ struct nfs_access_entry {
72 int mask; 72 int mask;
73}; 73};
74 74
75struct nfs_lock_context {
76 atomic_t count;
77 struct list_head list;
78 struct nfs_open_context *open_context;
79 fl_owner_t lockowner;
80 pid_t pid;
81};
82
75struct nfs4_state; 83struct nfs4_state;
76struct nfs_open_context { 84struct nfs_open_context {
77 atomic_t count; 85 struct nfs_lock_context lock_context;
78 struct path path; 86 struct path path;
79 struct rpc_cred *cred; 87 struct rpc_cred *cred;
80 struct nfs4_state *state; 88 struct nfs4_state *state;
81 fl_owner_t lockowner;
82 fmode_t mode; 89 fmode_t mode;
83 90
84 unsigned long flags; 91 unsigned long flags;
@@ -353,9 +360,25 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
353extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 360extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
354extern void put_nfs_open_context(struct nfs_open_context *ctx); 361extern void put_nfs_open_context(struct nfs_open_context *ctx);
355extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 362extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
363extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
364extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
356extern u64 nfs_compat_user_ino64(u64 fileid); 365extern u64 nfs_compat_user_ino64(u64 fileid);
357extern void nfs_fattr_init(struct nfs_fattr *fattr); 366extern void nfs_fattr_init(struct nfs_fattr *fattr);
358 367
368extern struct nfs_fattr *nfs_alloc_fattr(void);
369
370static inline void nfs_free_fattr(const struct nfs_fattr *fattr)
371{
372 kfree(fattr);
373}
374
375extern struct nfs_fh *nfs_alloc_fhandle(void);
376
377static inline void nfs_free_fhandle(const struct nfs_fh *fh)
378{
379 kfree(fh);
380}
381
359/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 382/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
360extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 383extern __be32 root_nfs_parse_addr(char *name); /*__init*/
361extern unsigned long nfs_inc_attr_generation_counter(void); 384extern unsigned long nfs_inc_attr_generation_counter(void);
@@ -479,8 +502,15 @@ extern int nfs_wb_all(struct inode *inode);
479extern int nfs_wb_page(struct inode *inode, struct page* page); 502extern int nfs_wb_page(struct inode *inode, struct page* page);
480extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 503extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
481#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 504#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
505extern int nfs_commit_inode(struct inode *, int);
482extern struct nfs_write_data *nfs_commitdata_alloc(void); 506extern struct nfs_write_data *nfs_commitdata_alloc(void);
483extern void nfs_commit_free(struct nfs_write_data *wdata); 507extern void nfs_commit_free(struct nfs_write_data *wdata);
508#else
509static inline int
510nfs_commit_inode(struct inode *inode, int how)
511{
512 return 0;
513}
484#endif 514#endif
485 515
486static inline int 516static inline int
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index e82957acea56..c82ee7cd6288 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -15,6 +15,7 @@ struct nlm_host;
15struct nfs4_sequence_args; 15struct nfs4_sequence_args;
16struct nfs4_sequence_res; 16struct nfs4_sequence_res;
17struct nfs_server; 17struct nfs_server;
18struct nfs4_minor_version_ops;
18 19
19/* 20/*
20 * The nfs_client identifies our client state to the server. 21 * The nfs_client identifies our client state to the server.
@@ -44,7 +45,6 @@ struct nfs_client {
44 45
45#ifdef CONFIG_NFS_V4 46#ifdef CONFIG_NFS_V4
46 u64 cl_clientid; /* constant */ 47 u64 cl_clientid; /* constant */
47 nfs4_verifier cl_confirm;
48 unsigned long cl_state; 48 unsigned long cl_state;
49 49
50 struct rb_root cl_openowner_id; 50 struct rb_root cl_openowner_id;
@@ -71,11 +71,7 @@ struct nfs_client {
71 */ 71 */
72 char cl_ipaddr[48]; 72 char cl_ipaddr[48];
73 unsigned char cl_id_uniquifier; 73 unsigned char cl_id_uniquifier;
74 int (* cl_call_sync)(struct nfs_server *server, 74 const struct nfs4_minor_version_ops *cl_mvops;
75 struct rpc_message *msg,
76 struct nfs4_sequence_args *args,
77 struct nfs4_sequence_res *res,
78 int cache_reply);
79#endif /* CONFIG_NFS_V4 */ 75#endif /* CONFIG_NFS_V4 */
80 76
81#ifdef CONFIG_NFS_V4_1 77#ifdef CONFIG_NFS_V4_1
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 4499016e6d0d..5d59ae861aa6 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -69,5 +69,6 @@ struct nfs_mount_data {
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71#define NFS_MOUNT_NORESVPORT 0x40000 71#define NFS_MOUNT_NORESVPORT 0x40000
72#define NFS_MOUNT_LEGACY_INTERFACE 0x80000
72 73
73#endif 74#endif
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 3c60685d972b..f8b60e7f4c44 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -39,6 +39,7 @@ struct nfs_page {
39 struct list_head wb_list; /* Defines state of page: */ 39 struct list_head wb_list; /* Defines state of page: */
40 struct page *wb_page; /* page to read in/write out */ 40 struct page *wb_page; /* page to read in/write out */
41 struct nfs_open_context *wb_context; /* File state context info */ 41 struct nfs_open_context *wb_context; /* File state context info */
42 struct nfs_lock_context *wb_lock_context; /* lock context info */
42 atomic_t wb_complete; /* i/os we're waiting for */ 43 atomic_t wb_complete; /* i/os we're waiting for */
43 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */ 44 pgoff_t wb_index; /* Offset >> PAGE_CACHE_SHIFT */
44 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */ 45 unsigned int wb_offset, /* Offset & ~PAGE_CACHE_MASK */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 89b28812ec24..fc461926c412 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -196,8 +196,10 @@ struct nfs_openargs {
196 __u64 clientid; 196 __u64 clientid;
197 __u64 id; 197 __u64 id;
198 union { 198 union {
199 struct iattr * attrs; /* UNCHECKED, GUARDED */ 199 struct {
200 nfs4_verifier verifier; /* EXCLUSIVE */ 200 struct iattr * attrs; /* UNCHECKED, GUARDED */
201 nfs4_verifier verifier; /* EXCLUSIVE */
202 };
201 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 203 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
202 fmode_t delegation_type; /* CLAIM_PREVIOUS */ 204 fmode_t delegation_type; /* CLAIM_PREVIOUS */
203 } u; 205 } u;
@@ -313,6 +315,10 @@ struct nfs_lockt_res {
313 struct nfs4_sequence_res seq_res; 315 struct nfs4_sequence_res seq_res;
314}; 316};
315 317
318struct nfs_release_lockowner_args {
319 struct nfs_lowner lock_owner;
320};
321
316struct nfs4_delegreturnargs { 322struct nfs4_delegreturnargs {
317 const struct nfs_fh *fhandle; 323 const struct nfs_fh *fhandle;
318 const nfs4_stateid *stateid; 324 const nfs4_stateid *stateid;
@@ -332,6 +338,7 @@ struct nfs4_delegreturnres {
332struct nfs_readargs { 338struct nfs_readargs {
333 struct nfs_fh * fh; 339 struct nfs_fh * fh;
334 struct nfs_open_context *context; 340 struct nfs_open_context *context;
341 struct nfs_lock_context *lock_context;
335 __u64 offset; 342 __u64 offset;
336 __u32 count; 343 __u32 count;
337 unsigned int pgbase; 344 unsigned int pgbase;
@@ -352,6 +359,7 @@ struct nfs_readres {
352struct nfs_writeargs { 359struct nfs_writeargs {
353 struct nfs_fh * fh; 360 struct nfs_fh * fh;
354 struct nfs_open_context *context; 361 struct nfs_open_context *context;
362 struct nfs_lock_context *lock_context;
355 __u64 offset; 363 __u64 offset;
356 __u32 count; 364 __u32 count;
357 enum nfs3_stable_how stable; 365 enum nfs3_stable_how stable;
@@ -386,8 +394,8 @@ struct nfs_removeargs {
386 394
387struct nfs_removeres { 395struct nfs_removeres {
388 const struct nfs_server *server; 396 const struct nfs_server *server;
397 struct nfs_fattr *dir_attr;
389 struct nfs4_change_info cinfo; 398 struct nfs4_change_info cinfo;
390 struct nfs_fattr dir_attr;
391 struct nfs4_sequence_res seq_res; 399 struct nfs4_sequence_res seq_res;
392}; 400};
393 401
@@ -824,6 +832,11 @@ struct nfs4_setclientid {
824 u32 sc_cb_ident; 832 u32 sc_cb_ident;
825}; 833};
826 834
835struct nfs4_setclientid_res {
836 u64 clientid;
837 nfs4_verifier confirm;
838};
839
827struct nfs4_statfs_arg { 840struct nfs4_statfs_arg {
828 const struct nfs_fh * fh; 841 const struct nfs_fh * fh;
829 const u32 * bitmask; 842 const u32 * bitmask;
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 65e333afaee4..80d55bbc5365 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -40,12 +40,12 @@ struct nfs_fhbase_old {
40 * This is the new flexible, extensible style NFSv2/v3 file handle. 40 * This is the new flexible, extensible style NFSv2/v3 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000 41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 * 42 *
43 * The file handle is seens as a list of 4byte words. 43 * The file handle starts with a sequence of four-byte words.
44 * The first word contains a version number (1) and four descriptor bytes 44 * The first word contains a version number (1) and three descriptor bytes
45 * that tell how the remaining 3 variable length fields should be handled. 45 * that tell how the remaining 3 variable length fields should be handled.
46 * These three bytes are auth_type, fsid_type and fileid_type. 46 * These three bytes are auth_type, fsid_type and fileid_type.
47 * 47 *
48 * All 4byte values are in host-byte-order. 48 * All four-byte values are in host-byte-order.
49 * 49 *
50 * The auth_type field specifies how the filehandle can be authenticated 50 * The auth_type field specifies how the filehandle can be authenticated
51 * This might allow a file to be confirmed to be in a writable part of a 51 * This might allow a file to be confirmed to be in a writable part of a
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 640702e97457..f5487b6f91ed 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -160,7 +160,7 @@ struct nilfs_super_root {
160 * struct nilfs_super_block - structure of super block on disk 160 * struct nilfs_super_block - structure of super block on disk
161 */ 161 */
162struct nilfs_super_block { 162struct nilfs_super_block {
163 __le32 s_rev_level; /* Revision level */ 163/*00*/ __le32 s_rev_level; /* Revision level */
164 __le16 s_minor_rev_level; /* minor revision level */ 164 __le16 s_minor_rev_level; /* minor revision level */
165 __le16 s_magic; /* Magic signature */ 165 __le16 s_magic; /* Magic signature */
166 166
@@ -169,51 +169,53 @@ struct nilfs_super_block {
169 is excluded. */ 169 is excluded. */
170 __le16 s_flags; /* flags */ 170 __le16 s_flags; /* flags */
171 __le32 s_crc_seed; /* Seed value of CRC calculation */ 171 __le32 s_crc_seed; /* Seed value of CRC calculation */
172 __le32 s_sum; /* Check sum of super block */ 172/*10*/ __le32 s_sum; /* Check sum of super block */
173 173
174 __le32 s_log_block_size; /* Block size represented as follows 174 __le32 s_log_block_size; /* Block size represented as follows
175 blocksize = 175 blocksize =
176 1 << (s_log_block_size + 10) */ 176 1 << (s_log_block_size + 10) */
177 __le64 s_nsegments; /* Number of segments in filesystem */ 177 __le64 s_nsegments; /* Number of segments in filesystem */
178 __le64 s_dev_size; /* block device size in bytes */ 178/*20*/ __le64 s_dev_size; /* block device size in bytes */
179 __le64 s_first_data_block; /* 1st seg disk block number */ 179 __le64 s_first_data_block; /* 1st seg disk block number */
180 __le32 s_blocks_per_segment; /* number of blocks per full segment */ 180/*30*/ __le32 s_blocks_per_segment; /* number of blocks per full segment */
181 __le32 s_r_segments_percentage; /* Reserved segments percentage */ 181 __le32 s_r_segments_percentage; /* Reserved segments percentage */
182 182
183 __le64 s_last_cno; /* Last checkpoint number */ 183 __le64 s_last_cno; /* Last checkpoint number */
184 __le64 s_last_pseg; /* disk block addr pseg written last */ 184/*40*/ __le64 s_last_pseg; /* disk block addr pseg written last */
185 __le64 s_last_seq; /* seq. number of seg written last */ 185 __le64 s_last_seq; /* seq. number of seg written last */
186 __le64 s_free_blocks_count; /* Free blocks count */ 186/*50*/ __le64 s_free_blocks_count; /* Free blocks count */
187 187
188 __le64 s_ctime; /* Creation time (execution time of 188 __le64 s_ctime; /* Creation time (execution time of
189 newfs) */ 189 newfs) */
190 __le64 s_mtime; /* Mount time */ 190/*60*/ __le64 s_mtime; /* Mount time */
191 __le64 s_wtime; /* Write time */ 191 __le64 s_wtime; /* Write time */
192 __le16 s_mnt_count; /* Mount count */ 192/*70*/ __le16 s_mnt_count; /* Mount count */
193 __le16 s_max_mnt_count; /* Maximal mount count */ 193 __le16 s_max_mnt_count; /* Maximal mount count */
194 __le16 s_state; /* File system state */ 194 __le16 s_state; /* File system state */
195 __le16 s_errors; /* Behaviour when detecting errors */ 195 __le16 s_errors; /* Behaviour when detecting errors */
196 __le64 s_lastcheck; /* time of last check */ 196 __le64 s_lastcheck; /* time of last check */
197 197
198 __le32 s_checkinterval; /* max. time between checks */ 198/*80*/ __le32 s_checkinterval; /* max. time between checks */
199 __le32 s_creator_os; /* OS */ 199 __le32 s_creator_os; /* OS */
200 __le16 s_def_resuid; /* Default uid for reserved blocks */ 200 __le16 s_def_resuid; /* Default uid for reserved blocks */
201 __le16 s_def_resgid; /* Default gid for reserved blocks */ 201 __le16 s_def_resgid; /* Default gid for reserved blocks */
202 __le32 s_first_ino; /* First non-reserved inode */ 202 __le32 s_first_ino; /* First non-reserved inode */
203 203
204 __le16 s_inode_size; /* Size of an inode */ 204/*90*/ __le16 s_inode_size; /* Size of an inode */
205 __le16 s_dat_entry_size; /* Size of a dat entry */ 205 __le16 s_dat_entry_size; /* Size of a dat entry */
206 __le16 s_checkpoint_size; /* Size of a checkpoint */ 206 __le16 s_checkpoint_size; /* Size of a checkpoint */
207 __le16 s_segment_usage_size; /* Size of a segment usage */ 207 __le16 s_segment_usage_size; /* Size of a segment usage */
208 208
209 __u8 s_uuid[16]; /* 128-bit uuid for volume */ 209/*98*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */
210 char s_volume_name[16]; /* volume name */ 210/*A8*/ char s_volume_name[80]; /* volume name */
211 char s_last_mounted[64]; /* directory where last mounted */
212 211
213 __le32 s_c_interval; /* Commit interval of segment */ 212/*F8*/ __le32 s_c_interval; /* Commit interval of segment */
214 __le32 s_c_block_max; /* Threshold of data amount for 213 __le32 s_c_block_max; /* Threshold of data amount for
215 the segment construction */ 214 the segment construction */
216 __u32 s_reserved[192]; /* padding to the end of the block */ 215/*100*/ __le64 s_feature_compat; /* Compatible feature set */
216 __le64 s_feature_compat_ro; /* Read-only compatible feature set */
217 __le64 s_feature_incompat; /* Incompatible feature set */
218 __u32 s_reserved[186]; /* padding to the end of the block */
217}; 219};
218 220
219/* 221/*
@@ -229,6 +231,16 @@ struct nilfs_super_block {
229#define NILFS_MINOR_REV 0 /* minor revision */ 231#define NILFS_MINOR_REV 0 /* minor revision */
230 232
231/* 233/*
234 * Feature set definitions
235 *
236 * If there is a bit set in the incompatible feature set that the kernel
237 * doesn't know about, it should refuse to mount the filesystem.
238 */
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242
243/*
232 * Bytes count of super_block for CRC-calculation 244 * Bytes count of super_block for CRC-calculation
233 */ 245 */
234#define NILFS_SB_BYTES \ 246#define NILFS_SB_BYTES \
@@ -275,6 +287,12 @@ struct nilfs_super_block {
275#define NILFS_NAME_LEN 255 287#define NILFS_NAME_LEN 255
276 288
277/* 289/*
290 * Block size limitations
291 */
292#define NILFS_MIN_BLOCK_SIZE 1024
293#define NILFS_MAX_BLOCK_SIZE 65536
294
295/*
278 * The new version of the directory entry. Since V0 structures are 296 * The new version of the directory entry. Since V0 structures are
279 * stored in intel byte order, and the name_len field could never be 297 * stored in intel byte order, and the name_len field could never be
280 * bigger than 255 chars, it's safe to reclaim the extra byte for the 298 * bigger than 255 chars, it's safe to reclaim the extra byte for the
@@ -314,7 +332,25 @@ enum {
314#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1) 332#define NILFS_DIR_ROUND (NILFS_DIR_PAD - 1)
315#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \ 333#define NILFS_DIR_REC_LEN(name_len) (((name_len) + 12 + NILFS_DIR_ROUND) & \
316 ~NILFS_DIR_ROUND) 334 ~NILFS_DIR_ROUND)
335#define NILFS_MAX_REC_LEN ((1<<16)-1)
317 336
337static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
338{
339 unsigned len = le16_to_cpu(dlen);
340
341 if (len == NILFS_MAX_REC_LEN)
342 return 1 << 16;
343 return len;
344}
345
346static inline __le16 nilfs_rec_len_to_disk(unsigned len)
347{
348 if (len == (1 << 16))
349 return cpu_to_le16(NILFS_MAX_REC_LEN);
350 else if (len > (1 << 16))
351 BUG();
352 return cpu_to_le16(len);
353}
318 354
319/** 355/**
320 * struct nilfs_finfo - file information 356 * struct nilfs_finfo - file information
@@ -377,6 +413,7 @@ union nilfs_binfo {
377 * @ss_nfinfo: number of finfo structures 413 * @ss_nfinfo: number of finfo structures
378 * @ss_sumbytes: total size of segment summary in bytes 414 * @ss_sumbytes: total size of segment summary in bytes
379 * @ss_pad: padding 415 * @ss_pad: padding
416 * @ss_cno: checkpoint number
380 */ 417 */
381struct nilfs_segment_summary { 418struct nilfs_segment_summary {
382 __le32 ss_datasum; 419 __le32 ss_datasum;
@@ -391,6 +428,7 @@ struct nilfs_segment_summary {
391 __le32 ss_nfinfo; 428 __le32 ss_nfinfo;
392 __le32 ss_sumbytes; 429 __le32 ss_sumbytes;
393 __le32 ss_pad; 430 __le32 ss_pad;
431 __le64 ss_cno;
394 /* array of finfo structures */ 432 /* array of finfo structures */
395}; 433};
396 434
@@ -437,10 +475,10 @@ struct nilfs_palloc_group_desc {
437 475
438/** 476/**
439 * struct nilfs_dat_entry - disk address translation entry 477 * struct nilfs_dat_entry - disk address translation entry
440 * @dt_blocknr: block number 478 * @de_blocknr: block number
441 * @dt_start: start checkpoint number 479 * @de_start: start checkpoint number
442 * @dt_end: end checkpoint number 480 * @de_end: end checkpoint number
443 * @dt_rsv: reserved for future use 481 * @de_rsv: reserved for future use
444 */ 482 */
445struct nilfs_dat_entry { 483struct nilfs_dat_entry {
446 __le64 de_blocknr; 484 __le64 de_blocknr;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 28ba20fda3e2..2c8701687336 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -52,6 +52,8 @@
52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, 53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. 54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
55 * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
56 * instead, the support here is for backward compatibility only.
55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 57 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 58 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
57 * %NL80211_ATTR_WIPHY_NAME. 59 * %NL80211_ATTR_WIPHY_NAME.
@@ -130,7 +132,7 @@
130 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and 132 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
131 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. 133 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
132 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain 134 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
133 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 135 * to the specified ISO/IEC 3166-1 alpha2 country code. The core will
134 * store this as a valid request and then query userspace for it. 136 * store this as a valid request and then query userspace for it.
135 * 137 *
136 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the 138 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
@@ -323,6 +325,21 @@
323 * the TX command and %NL80211_ATTR_FRAME includes the contents of the 325 * the TX command and %NL80211_ATTR_FRAME includes the contents of the
324 * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged 326 * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
325 * the frame. 327 * the frame.
328 * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
329 * is used to configure connection quality monitoring notification trigger
330 * levels.
331 * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
332 * command is used as an event to indicate the that a trigger level was
333 * reached.
334 * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
335 * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed
336 * by %NL80211_ATTR_IFINDEX) shall operate on.
337 * In case multiple channels are supported by the device, the mechanism
338 * with which it switches channels is implementation-defined.
339 * When a monitor interface is given, it can only switch channel while
340 * no other interfaces are operating to avoid disturbing the operation
341 * of any other interfaces, and other interfaces will again take
342 * precedence when they are used.
326 * 343 *
327 * @NL80211_CMD_MAX: highest used command number 344 * @NL80211_CMD_MAX: highest used command number
328 * @__NL80211_CMD_AFTER_LAST: internal use 345 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -419,6 +436,11 @@ enum nl80211_commands {
419 NL80211_CMD_SET_POWER_SAVE, 436 NL80211_CMD_SET_POWER_SAVE,
420 NL80211_CMD_GET_POWER_SAVE, 437 NL80211_CMD_GET_POWER_SAVE,
421 438
439 NL80211_CMD_SET_CQM,
440 NL80211_CMD_NOTIFY_CQM,
441
442 NL80211_CMD_SET_CHANNEL,
443
422 /* add new commands above here */ 444 /* add new commands above here */
423 445
424 /* used to define NL80211_CMD_MAX below */ 446 /* used to define NL80211_CMD_MAX below */
@@ -691,6 +713,24 @@ enum nl80211_commands {
691 * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was 713 * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was
692 * acknowledged by the recipient. 714 * acknowledged by the recipient.
693 * 715 *
716 * @NL80211_ATTR_CQM: connection quality monitor configuration in a
717 * nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
718 *
719 * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
720 * is requesting a local authentication/association state change without
721 * invoking actual management frame exchange. This can be used with
722 * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
723 * NL80211_CMD_DISASSOCIATE.
724 *
725 * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
726 * connected to this BSS.
727 *
728 * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See
729 * &enum nl80211_tx_power_setting for possible values.
730 * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units.
731 * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
732 * for non-automatic settings.
733 *
694 * @NL80211_ATTR_MAX: highest attribute number currently defined 734 * @NL80211_ATTR_MAX: highest attribute number currently defined
695 * @__NL80211_ATTR_AFTER_LAST: internal use 735 * @__NL80211_ATTR_AFTER_LAST: internal use
696 */ 736 */
@@ -842,6 +882,15 @@ enum nl80211_attrs {
842 882
843 NL80211_ATTR_PS_STATE, 883 NL80211_ATTR_PS_STATE,
844 884
885 NL80211_ATTR_CQM,
886
887 NL80211_ATTR_LOCAL_STATE_CHANGE,
888
889 NL80211_ATTR_AP_ISOLATE,
890
891 NL80211_ATTR_WIPHY_TX_POWER_SETTING,
892 NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
893
845 /* add attributes here, update the policy in nl80211.c */ 894 /* add attributes here, update the policy in nl80211.c */
846 895
847 __NL80211_ATTR_AFTER_LAST, 896 __NL80211_ATTR_AFTER_LAST,
@@ -1583,4 +1632,53 @@ enum nl80211_ps_state {
1583 NL80211_PS_ENABLED, 1632 NL80211_PS_ENABLED,
1584}; 1633};
1585 1634
1635/**
1636 * enum nl80211_attr_cqm - connection quality monitor attributes
1637 * @__NL80211_ATTR_CQM_INVALID: invalid
1638 * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
1639 * the threshold for the RSSI level at which an event will be sent. Zero
1640 * to disable.
1641 * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
1642 * the minimum amount the RSSI level must change after an event before a
1643 * new event may be issued (to reduce effects of RSSI oscillation).
1644 * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
1645 * @__NL80211_ATTR_CQM_AFTER_LAST: internal
1646 * @NL80211_ATTR_CQM_MAX: highest key attribute
1647 */
1648enum nl80211_attr_cqm {
1649 __NL80211_ATTR_CQM_INVALID,
1650 NL80211_ATTR_CQM_RSSI_THOLD,
1651 NL80211_ATTR_CQM_RSSI_HYST,
1652 NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
1653
1654 /* keep last */
1655 __NL80211_ATTR_CQM_AFTER_LAST,
1656 NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
1657};
1658
1659/**
1660 * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event
1661 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW - The RSSI level is lower than the
1662 * configured threshold
1663 * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH - The RSSI is higher than the
1664 * configured threshold
1665 */
1666enum nl80211_cqm_rssi_threshold_event {
1667 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
1668 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
1669};
1670
1671
1672/**
1673 * enum nl80211_tx_power_setting - TX power adjustment
1674 * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power
1675 * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter
1676 * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter
1677 */
1678enum nl80211_tx_power_setting {
1679 NL80211_TX_POWER_AUTOMATIC,
1680 NL80211_TX_POWER_LIMITED,
1681 NL80211_TX_POWER_FIXED,
1682};
1683
1586#endif /* __LINUX_NL80211_H */ 1684#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index b752e807adde..06aab5eee134 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -20,10 +20,14 @@ extern void touch_nmi_watchdog(void);
20extern void acpi_nmi_disable(void); 20extern void acpi_nmi_disable(void);
21extern void acpi_nmi_enable(void); 21extern void acpi_nmi_enable(void);
22#else 22#else
23#ifndef CONFIG_HARDLOCKUP_DETECTOR
23static inline void touch_nmi_watchdog(void) 24static inline void touch_nmi_watchdog(void)
24{ 25{
25 touch_softlockup_watchdog(); 26 touch_softlockup_watchdog();
26} 27}
28#else
29extern void touch_nmi_watchdog(void);
30#endif
27static inline void acpi_nmi_disable(void) { } 31static inline void acpi_nmi_disable(void) { }
28static inline void acpi_nmi_enable(void) { } 32static inline void acpi_nmi_enable(void) { }
29#endif 33#endif
@@ -47,4 +51,13 @@ static inline bool trigger_all_cpu_backtrace(void)
47} 51}
48#endif 52#endif
49 53
54#ifdef CONFIG_LOCKUP_DETECTOR
55int hw_nmi_is_cpu_stuck(struct pt_regs *);
56u64 hw_nmi_get_sample_period(void);
57extern int watchdog_enabled;
58struct ctl_table;
59extern int proc_dowatchdog_enabled(struct ctl_table *, int ,
60 void __user *, size_t *, loff_t *);
61#endif
62
50#endif 63#endif
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index fee6c2f68075..b2f1a4d83550 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -164,7 +164,10 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
164/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */ 164/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
165static inline int notifier_from_errno(int err) 165static inline int notifier_from_errno(int err)
166{ 166{
167 return NOTIFY_STOP_MASK | (NOTIFY_OK - err); 167 if (err)
168 return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
169
170 return NOTIFY_OK;
168} 171}
169 172
170/* Restore (negative) errno value from notify return value. */ 173/* Restore (negative) errno value from notify return value. */
@@ -182,7 +185,10 @@ static inline int notifier_to_errno(int ret)
182 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc... 185 * VC switch chains (for loadable kernel svgalib VC switch helpers) etc...
183 */ 186 */
184 187
185/* netdevice notifier chain */ 188/* netdevice notifier chain. Please remember to update the rtnetlink
189 * notification exclusion list in rtnetlink_event() when adding new
190 * types.
191 */
186#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */ 192#define NETDEV_UP 0x0001 /* For now you can't veto a device up/down */
187#define NETDEV_DOWN 0x0002 193#define NETDEV_DOWN 0x0002
188#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface 194#define NETDEV_REBOOT 0x0003 /* Tell a protocol stack a network interface
@@ -199,10 +205,12 @@ static inline int notifier_to_errno(int ret)
199#define NETDEV_FEAT_CHANGE 0x000B 205#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 206#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D 207#define NETDEV_PRE_UP 0x000D
202#define NETDEV_BONDING_OLDTYPE 0x000E 208#define NETDEV_PRE_TYPE_CHANGE 0x000E
203#define NETDEV_BONDING_NEWTYPE 0x000F 209#define NETDEV_POST_TYPE_CHANGE 0x000F
204#define NETDEV_POST_INIT 0x0010 210#define NETDEV_POST_INIT 0x0010
205#define NETDEV_UNREGISTER_BATCH 0x0011 211#define NETDEV_UNREGISTER_BATCH 0x0011
212#define NETDEV_BONDING_DESLAVE 0x0012
213#define NETDEV_NOTIFY_PEERS 0x0013
206 214
207#define SYS_DOWN 0x0001 /* Notify of system down */ 215#define SYS_DOWN 0x0001 /* Notify of system down */
208#define SYS_RESTART SYS_DOWN 216#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/of.h b/include/linux/of.h
index a367e19bb3af..cad7cf0ab278 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -70,6 +70,11 @@ extern struct device_node *allnodes;
70extern struct device_node *of_chosen; 70extern struct device_node *of_chosen;
71extern rwlock_t devtree_lock; 71extern rwlock_t devtree_lock;
72 72
73static inline bool of_node_is_root(const struct device_node *node)
74{
75 return node && (node->parent == NULL);
76}
77
73static inline int of_node_check_flag(struct device_node *n, unsigned long flag) 78static inline int of_node_check_flag(struct device_node *n, unsigned long flag)
74{ 79{
75 return test_bit(flag, &n->_flags); 80 return test_bit(flag, &n->_flags);
@@ -141,6 +146,11 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
141 146
142#define OF_BAD_ADDR ((u64)-1) 147#define OF_BAD_ADDR ((u64)-1)
143 148
149#ifndef of_node_to_nid
150static inline int of_node_to_nid(struct device_node *np) { return -1; }
151#define of_node_to_nid of_node_to_nid
152#endif
153
144extern struct device_node *of_find_node_by_name(struct device_node *from, 154extern struct device_node *of_find_node_by_name(struct device_node *from,
145 const char *name); 155 const char *name);
146#define for_each_node_by_name(dn, name) \ 156#define for_each_node_by_name(dn, name) \
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
new file mode 100644
index 000000000000..8aea06f0564c
--- /dev/null
+++ b/include/linux/of_address.h
@@ -0,0 +1,44 @@
1#ifndef __OF_ADDRESS_H
2#define __OF_ADDRESS_H
3#include <linux/ioport.h>
4#include <linux/of.h>
5
6extern u64 of_translate_address(struct device_node *np, const u32 *addr);
7extern int of_address_to_resource(struct device_node *dev, int index,
8 struct resource *r);
9extern void __iomem *of_iomap(struct device_node *device, int index);
10
11/* Extract an address from a device, returns the region size and
12 * the address space flags too. The PCI version uses a BAR number
13 * instead of an absolute index
14 */
15extern const u32 *of_get_address(struct device_node *dev, int index,
16 u64 *size, unsigned int *flags);
17
18#ifndef pci_address_to_pio
19static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
20#define pci_address_to_pio pci_address_to_pio
21#endif
22
23#ifdef CONFIG_PCI
24extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
25 u64 *size, unsigned int *flags);
26extern int of_pci_address_to_resource(struct device_node *dev, int bar,
27 struct resource *r);
28#else /* CONFIG_PCI */
29static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
30 struct resource *r)
31{
32 return -ENOSYS;
33}
34
35static inline const u32 *of_get_pci_address(struct device_node *dev,
36 int bar_no, u64 *size, unsigned int *flags)
37{
38 return NULL;
39}
40#endif /* CONFIG_PCI */
41
42
43#endif /* __OF_ADDRESS_H */
44
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index d3a74e00a3e1..35aa44ad9f2c 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -1,30 +1,77 @@
1#ifndef _LINUX_OF_DEVICE_H 1#ifndef _LINUX_OF_DEVICE_H
2#define _LINUX_OF_DEVICE_H 2#define _LINUX_OF_DEVICE_H
3 3
4/*
5 * The of_device *was* a kind of "base class" that was a superset of
6 * struct device for use by devices attached to an OF node and probed
7 * using OF properties. However, the important bit of OF-style
8 * probing, namely the device node pointer, has been moved into the
9 * common struct device when CONFIG_OF is set to make OF-style probing
10 * available to all bus types. So now, just make of_device and
11 * platform_device equivalent so that current of_platform bus users
12 * can be transparently migrated over to using the platform bus.
13 *
14 * This line will go away once all references to of_device are removed
15 * from the kernel.
16 */
17#define of_device platform_device
18#include <linux/platform_device.h>
19#include <linux/of_platform.h> /* temporary until merge */
20
21#ifdef CONFIG_OF_DEVICE
4#include <linux/device.h> 22#include <linux/device.h>
5#include <linux/of.h> 23#include <linux/of.h>
6#include <linux/mod_devicetable.h> 24#include <linux/mod_devicetable.h>
7 25
8#include <asm/of_device.h>
9
10#define to_of_device(d) container_of(d, struct of_device, dev) 26#define to_of_device(d) container_of(d, struct of_device, dev)
11 27
12extern const struct of_device_id *of_match_device( 28extern const struct of_device_id *of_match_device(
13 const struct of_device_id *matches, const struct of_device *dev); 29 const struct of_device_id *matches, const struct device *dev);
30extern void of_device_make_bus_id(struct device *dev);
31
32/**
33 * of_driver_match_device - Tell if a driver's of_match_table matches a device.
34 * @drv: the device_driver structure to test
35 * @dev: the device structure to match against
36 */
37static inline int of_driver_match_device(const struct device *dev,
38 const struct device_driver *drv)
39{
40 return of_match_device(drv->of_match_table, dev) != NULL;
41}
14 42
15extern struct of_device *of_dev_get(struct of_device *dev); 43extern struct platform_device *of_dev_get(struct platform_device *dev);
16extern void of_dev_put(struct of_device *dev); 44extern void of_dev_put(struct platform_device *dev);
17 45
18extern int of_device_register(struct of_device *ofdev); 46extern int of_device_register(struct platform_device *ofdev);
19extern void of_device_unregister(struct of_device *ofdev); 47extern void of_device_unregister(struct platform_device *ofdev);
20extern void of_release_dev(struct device *dev); 48extern void of_release_dev(struct device *dev);
21 49
22static inline void of_device_free(struct of_device *dev) 50static inline void of_device_free(struct platform_device *dev)
23{ 51{
24 of_release_dev(&dev->dev); 52 of_release_dev(&dev->dev);
25} 53}
26 54
27extern ssize_t of_device_get_modalias(struct of_device *ofdev, 55extern ssize_t of_device_get_modalias(struct device *dev,
28 char *str, ssize_t len); 56 char *str, ssize_t len);
29 57
58extern int of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
59
60
61#else /* CONFIG_OF_DEVICE */
62
63static inline int of_driver_match_device(struct device *dev,
64 struct device_driver *drv)
65{
66 return 0;
67}
68
69static inline int of_device_uevent(struct device *dev,
70 struct kobj_uevent_env *env)
71{
72 return -ENODEV;
73}
74
75#endif /* CONFIG_OF_DEVICE */
76
30#endif /* _LINUX_OF_DEVICE_H */ 77#endif /* _LINUX_OF_DEVICE_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index a1ca92ccb0ff..71e1a916d3fa 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -57,6 +57,7 @@ struct boot_param_header {
57 __be32 dt_struct_size; /* size of the DT structure block */ 57 __be32 dt_struct_size; /* size of the DT structure block */
58}; 58};
59 59
60#if defined(CONFIG_OF_FLATTREE)
60/* TBD: Temporary export of fdt globals - remove when code fully merged */ 61/* TBD: Temporary export of fdt globals - remove when code fully merged */
61extern int __initdata dt_root_addr_cells; 62extern int __initdata dt_root_addr_cells;
62extern int __initdata dt_root_size_cells; 63extern int __initdata dt_root_size_cells;
@@ -98,6 +99,9 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
98/* Other Prototypes */ 99/* Other Prototypes */
99extern void unflatten_device_tree(void); 100extern void unflatten_device_tree(void);
100extern void early_init_devtree(void *); 101extern void early_init_devtree(void *);
102#else /* CONFIG_OF_FLATTREE */
103static inline void unflatten_device_tree(void) {}
104#endif /* CONFIG_OF_FLATTREE */
101 105
102#endif /* __ASSEMBLY__ */ 106#endif /* __ASSEMBLY__ */
103#endif /* _LINUX_OF_FDT_H */ 107#endif /* _LINUX_OF_FDT_H */
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index fc2472c3c254..6598c04dab01 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -33,34 +33,17 @@ enum of_gpio_flags {
33#ifdef CONFIG_OF_GPIO 33#ifdef CONFIG_OF_GPIO
34 34
35/* 35/*
36 * Generic OF GPIO chip
37 */
38struct of_gpio_chip {
39 struct gpio_chip gc;
40 int gpio_cells;
41 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
42 const void *gpio_spec, enum of_gpio_flags *flags);
43};
44
45static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
46{
47 return container_of(gc, struct of_gpio_chip, gc);
48}
49
50/*
51 * OF GPIO chip for memory mapped banks 36 * OF GPIO chip for memory mapped banks
52 */ 37 */
53struct of_mm_gpio_chip { 38struct of_mm_gpio_chip {
54 struct of_gpio_chip of_gc; 39 struct gpio_chip gc;
55 void (*save_regs)(struct of_mm_gpio_chip *mm_gc); 40 void (*save_regs)(struct of_mm_gpio_chip *mm_gc);
56 void __iomem *regs; 41 void __iomem *regs;
57}; 42};
58 43
59static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) 44static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
60{ 45{
61 struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); 46 return container_of(gc, struct of_mm_gpio_chip, gc);
62
63 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
64} 47}
65 48
66extern int of_get_gpio_flags(struct device_node *np, int index, 49extern int of_get_gpio_flags(struct device_node *np, int index,
@@ -69,11 +52,12 @@ extern unsigned int of_gpio_count(struct device_node *np);
69 52
70extern int of_mm_gpiochip_add(struct device_node *np, 53extern int of_mm_gpiochip_add(struct device_node *np,
71 struct of_mm_gpio_chip *mm_gc); 54 struct of_mm_gpio_chip *mm_gc);
72extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, 55
73 struct device_node *np, 56extern void of_gpiochip_add(struct gpio_chip *gc);
74 const void *gpio_spec, 57extern void of_gpiochip_remove(struct gpio_chip *gc);
75 enum of_gpio_flags *flags); 58extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
76#else 59
60#else /* CONFIG_OF_GPIO */
77 61
78/* Drivers may not strictly depend on the GPIO support, so let them link. */ 62/* Drivers may not strictly depend on the GPIO support, so let them link. */
79static inline int of_get_gpio_flags(struct device_node *np, int index, 63static inline int of_get_gpio_flags(struct device_node *np, int index,
@@ -87,6 +71,9 @@ static inline unsigned int of_gpio_count(struct device_node *np)
87 return 0; 71 return 0;
88} 72}
89 73
74static inline void of_gpiochip_add(struct gpio_chip *gc) { }
75static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
76
90#endif /* CONFIG_OF_GPIO */ 77#endif /* CONFIG_OF_GPIO */
91 78
92/** 79/**
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 34974b5a76f7..0efe8d465f55 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -12,12 +12,19 @@
12#ifndef __LINUX_OF_I2C_H 12#ifndef __LINUX_OF_I2C_H
13#define __LINUX_OF_I2C_H 13#define __LINUX_OF_I2C_H
14 14
15#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
15#include <linux/i2c.h> 16#include <linux/i2c.h>
16 17
17void of_register_i2c_devices(struct i2c_adapter *adap, 18extern void of_i2c_register_devices(struct i2c_adapter *adap);
18 struct device_node *adap_node);
19 19
20/* must call put_device() when done with returned i2c_client device */ 20/* must call put_device() when done with returned i2c_client device */
21struct i2c_client *of_find_i2c_device_by_node(struct device_node *node); 21extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
22
23#else
24static inline void of_i2c_register_devices(struct i2c_adapter *adap)
25{
26 return;
27}
28#endif /* CONFIG_OF_I2C */
22 29
23#endif /* __LINUX_OF_I2C_H */ 30#endif /* __LINUX_OF_I2C_H */
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
new file mode 100644
index 000000000000..5929781c104d
--- /dev/null
+++ b/include/linux/of_irq.h
@@ -0,0 +1,70 @@
1#ifndef __OF_IRQ_H
2#define __OF_IRQ_H
3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h>
7#include <linux/errno.h>
8#include <linux/ioport.h>
9#include <linux/of.h>
10
11/*
12 * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC
13 * implements it differently. However, the prototype is the same for all,
14 * so declare it here regardless of the CONFIG_OF_IRQ setting.
15 */
16extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
17
18#if defined(CONFIG_OF_IRQ)
19/**
20 * of_irq - container for device_node/irq_specifier pair for an irq controller
21 * @controller: pointer to interrupt controller device tree node
22 * @size: size of interrupt specifier
23 * @specifier: array of cells @size long specifing the specific interrupt
24 *
25 * This structure is returned when an interrupt is mapped. The controller
26 * field needs to be put() after use
27 */
28#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
29struct of_irq {
30 struct device_node *controller; /* Interrupt controller node */
31 u32 size; /* Specifier size */
32 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
33};
34
35/*
36 * Workarounds only applied to 32bit powermac machines
37 */
38#define OF_IMAP_OLDWORLD_MAC 0x00000001
39#define OF_IMAP_NO_PHANDLE 0x00000002
40
41#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
42extern unsigned int of_irq_workarounds;
43extern struct device_node *of_irq_dflt_pic;
44extern int of_irq_map_oldworld(struct device_node *device, int index,
45 struct of_irq *out_irq);
46#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
47#define of_irq_workarounds (0)
48#define of_irq_dflt_pic (NULL)
49static inline int of_irq_map_oldworld(struct device_node *device, int index,
50 struct of_irq *out_irq)
51{
52 return -EINVAL;
53}
54#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
55
56
57extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
58 u32 ointsize, const u32 *addr,
59 struct of_irq *out_irq);
60extern int of_irq_map_one(struct device_node *device, int index,
61 struct of_irq *out_irq);
62extern unsigned int irq_create_of_mapping(struct device_node *controller,
63 const u32 *intspec,
64 unsigned int intsize);
65extern int of_irq_to_resource(struct device_node *dev, int index,
66 struct resource *r);
67
68#endif /* CONFIG_OF_IRQ */
69#endif /* CONFIG_OF */
70#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 908406651330..4e6d989c06df 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -11,38 +11,30 @@
11 * 11 *
12 */ 12 */
13 13
14#ifdef CONFIG_OF_DEVICE
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/mod_devicetable.h> 17#include <linux/mod_devicetable.h>
17#include <linux/pm.h> 18#include <linux/pm.h>
18#include <linux/of_device.h> 19#include <linux/of_device.h>
19 20#include <linux/platform_device.h>
20/*
21 * The of_platform_bus_type is a bus type used by drivers that do not
22 * attach to a macio or similar bus but still use OF probing
23 * mechanism
24 */
25extern struct bus_type of_platform_bus_type;
26 21
27/* 22/*
28 * An of_platform_driver driver is attached to a basic of_device on 23 * An of_platform_driver driver is attached to a basic of_device on
29 * the "platform bus" (of_platform_bus_type). 24 * the "platform bus" (platform_bus_type).
30 */ 25 */
31struct of_platform_driver 26struct of_platform_driver
32{ 27{
33 const char *name; 28 int (*probe)(struct platform_device* dev,
34 const struct of_device_id *match_table;
35 struct module *owner;
36
37 int (*probe)(struct of_device* dev,
38 const struct of_device_id *match); 29 const struct of_device_id *match);
39 int (*remove)(struct of_device* dev); 30 int (*remove)(struct platform_device* dev);
40 31
41 int (*suspend)(struct of_device* dev, pm_message_t state); 32 int (*suspend)(struct platform_device* dev, pm_message_t state);
42 int (*resume)(struct of_device* dev); 33 int (*resume)(struct platform_device* dev);
43 int (*shutdown)(struct of_device* dev); 34 int (*shutdown)(struct platform_device* dev);
44 35
45 struct device_driver driver; 36 struct device_driver driver;
37 struct platform_driver platform_driver;
46}; 38};
47#define to_of_platform_driver(drv) \ 39#define to_of_platform_driver(drv) \
48 container_of(drv,struct of_platform_driver, driver) 40 container_of(drv,struct of_platform_driver, driver)
@@ -52,19 +44,30 @@ extern int of_register_driver(struct of_platform_driver *drv,
52extern void of_unregister_driver(struct of_platform_driver *drv); 44extern void of_unregister_driver(struct of_platform_driver *drv);
53 45
54/* Platform drivers register/unregister */ 46/* Platform drivers register/unregister */
55static inline int of_register_platform_driver(struct of_platform_driver *drv) 47extern int of_register_platform_driver(struct of_platform_driver *drv);
56{ 48extern void of_unregister_platform_driver(struct of_platform_driver *drv);
57 return of_register_driver(drv, &of_platform_bus_type);
58}
59static inline void of_unregister_platform_driver(struct of_platform_driver *drv)
60{
61 of_unregister_driver(drv);
62}
63 49
64#include <asm/of_platform.h> 50extern struct platform_device *of_device_alloc(struct device_node *np,
65 51 const char *bus_id,
66extern struct of_device *of_find_device_by_node(struct device_node *np); 52 struct device *parent);
53extern struct platform_device *of_find_device_by_node(struct device_node *np);
67 54
68extern int of_bus_type_init(struct bus_type *bus, const char *name); 55extern int of_bus_type_init(struct bus_type *bus, const char *name);
69 56
57#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
58/* Platform devices and busses creation */
59extern struct platform_device *of_platform_device_create(struct device_node *np,
60 const char *bus_id,
61 struct device *parent);
62
63/* pseudo "matches" value to not do deep probe */
64#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
65
66extern int of_platform_bus_probe(struct device_node *root,
67 const struct of_device_id *matches,
68 struct device *parent);
69#endif /* !CONFIG_SPARC */
70
71#endif /* CONFIG_OF_DEVICE */
72
70#endif /* _LINUX_OF_PLATFORM_H */ 73#endif /* _LINUX_OF_PLATFORM_H */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
index 5f71ee8c0868..9e3e70f78ae6 100644
--- a/include/linux/of_spi.h
+++ b/include/linux/of_spi.h
@@ -9,10 +9,15 @@
9#ifndef __LINUX_OF_SPI_H 9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H 10#define __LINUX_OF_SPI_H
11 11
12#include <linux/of.h>
13#include <linux/spi/spi.h> 12#include <linux/spi/spi.h>
14 13
15extern void of_register_spi_devices(struct spi_master *master, 14#if defined(CONFIG_OF_SPI) || defined(CONFIG_OF_SPI_MODULE)
16 struct device_node *np); 15extern void of_register_spi_devices(struct spi_master *master);
16#else
17static inline void of_register_spi_devices(struct spi_master *master)
18{
19 return;
20}
21#endif /* CONFIG_OF_SPI */
17 22
18#endif /* __LINUX_OF_SPI */ 23#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index 9bdd91486b49..c0b018790f07 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -85,6 +85,9 @@
85#define OMAPFB_MEMTYPE_SRAM 1 85#define OMAPFB_MEMTYPE_SRAM 1
86#define OMAPFB_MEMTYPE_MAX 1 86#define OMAPFB_MEMTYPE_MAX 1
87 87
88#define OMAPFB_MEM_IDX_ENABLED 0x80
89#define OMAPFB_MEM_IDX_MASK 0x7f
90
88enum omapfb_color_format { 91enum omapfb_color_format {
89 OMAPFB_COLOR_RGB565 = 0, 92 OMAPFB_COLOR_RGB565 = 0,
90 OMAPFB_COLOR_YUV422, 93 OMAPFB_COLOR_YUV422,
@@ -136,7 +139,7 @@ struct omapfb_plane_info {
136 __u8 enabled; 139 __u8 enabled;
137 __u8 channel_out; 140 __u8 channel_out;
138 __u8 mirror; 141 __u8 mirror;
139 __u8 reserved1; 142 __u8 mem_idx;
140 __u32 out_width; 143 __u32 out_width;
141 __u32 out_height; 144 __u32 out_height;
142 __u32 reserved2[12]; 145 __u32 reserved2[12];
@@ -253,7 +256,7 @@ struct omapfb_platform_data {
253/* in arch/arm/plat-omap/fb.c */ 256/* in arch/arm/plat-omap/fb.c */
254extern void omapfb_set_platform_data(struct omapfb_platform_data *data); 257extern void omapfb_set_platform_data(struct omapfb_platform_data *data);
255extern void omapfb_set_ctrl_platform_data(void *pdata); 258extern void omapfb_set_ctrl_platform_data(void *pdata);
256extern void omapfb_reserve_sdram(void); 259extern void omapfb_reserve_sdram_memblock(void);
257 260
258#endif 261#endif
259 262
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 537662315627..5e3aa8311c5e 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -1,19 +1,34 @@
1#ifndef __INCLUDE_LINUX_OOM_H 1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H 2#define __INCLUDE_LINUX_OOM_H
3 3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ 4/*
5 * /proc/<pid>/oom_adj is deprecated, see
6 * Documentation/feature-removal-schedule.txt.
7 *
8 * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
9 */
5#define OOM_DISABLE (-17) 10#define OOM_DISABLE (-17)
6/* inclusive */ 11/* inclusive */
7#define OOM_ADJUST_MIN (-16) 12#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15 13#define OOM_ADJUST_MAX 15
9 14
15/*
16 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
17 * pid.
18 */
19#define OOM_SCORE_ADJ_MIN (-1000)
20#define OOM_SCORE_ADJ_MAX 1000
21
10#ifdef __KERNEL__ 22#ifdef __KERNEL__
11 23
24#include <linux/sched.h>
12#include <linux/types.h> 25#include <linux/types.h>
13#include <linux/nodemask.h> 26#include <linux/nodemask.h>
14 27
15struct zonelist; 28struct zonelist;
16struct notifier_block; 29struct notifier_block;
30struct mem_cgroup;
31struct task_struct;
17 32
18/* 33/*
19 * Types of limitations to the nodes from which allocations may occur 34 * Types of limitations to the nodes from which allocations may occur
@@ -22,9 +37,12 @@ enum oom_constraint {
22 CONSTRAINT_NONE, 37 CONSTRAINT_NONE,
23 CONSTRAINT_CPUSET, 38 CONSTRAINT_CPUSET,
24 CONSTRAINT_MEMORY_POLICY, 39 CONSTRAINT_MEMORY_POLICY,
40 CONSTRAINT_MEMCG,
25}; 41};
26 42
27extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags); 43extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
44 const nodemask_t *nodemask, unsigned long totalpages);
45extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags); 46extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
29 47
30extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, 48extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
@@ -43,5 +61,16 @@ static inline void oom_killer_enable(void)
43{ 61{
44 oom_killer_disabled = false; 62 oom_killer_disabled = false;
45} 63}
64
65/* The badness from the OOM killer */
66extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem,
67 const nodemask_t *nodemask, unsigned long uptime);
68
69extern struct task_struct *find_lock_task_mm(struct task_struct *p);
70
71/* sysctls */
72extern int sysctl_oom_dump_tasks;
73extern int sysctl_oom_kill_allocating_task;
74extern int sysctl_panic_on_oom;
46#endif /* __KERNEL__*/ 75#endif /* __KERNEL__*/
47#endif /* _INCLUDE_LINUX_OOM_H */ 76#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 51611da9c498..bdcd1e9eacea 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -24,7 +24,24 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/list.h> 26#include <linux/list.h>
27#include <linux/timer.h>
28#include <linux/notifier.h>
29#include <linux/kobject.h>
27 30
31#define PADATA_CPU_SERIAL 0x01
32#define PADATA_CPU_PARALLEL 0x02
33
34/**
35 * struct padata_priv - Embedded to the users data structure.
36 *
37 * @list: List entry, to attach to the padata lists.
38 * @pd: Pointer to the internal control structure.
39 * @cb_cpu: Callback cpu for serializatioon.
40 * @seq_nr: Sequence number of the parallelized data object.
41 * @info: Used to pass information from the parallel to the serial function.
42 * @parallel: Parallel execution function.
43 * @serial: Serial complete function.
44 */
28struct padata_priv { 45struct padata_priv {
29 struct list_head list; 46 struct list_head list;
30 struct parallel_data *pd; 47 struct parallel_data *pd;
@@ -35,54 +52,141 @@ struct padata_priv {
35 void (*serial)(struct padata_priv *padata); 52 void (*serial)(struct padata_priv *padata);
36}; 53};
37 54
55/**
56 * struct padata_list
57 *
58 * @list: List head.
59 * @lock: List lock.
60 */
38struct padata_list { 61struct padata_list {
39 struct list_head list; 62 struct list_head list;
40 spinlock_t lock; 63 spinlock_t lock;
41}; 64};
42 65
43struct padata_queue { 66/**
44 struct padata_list parallel; 67* struct padata_serial_queue - The percpu padata serial queue
45 struct padata_list reorder; 68*
46 struct padata_list serial; 69* @serial: List to wait for serialization after reordering.
47 struct work_struct pwork; 70* @work: work struct for serialization.
48 struct work_struct swork; 71* @pd: Backpointer to the internal control structure.
49 struct parallel_data *pd; 72*/
50 atomic_t num_obj; 73struct padata_serial_queue {
51 int cpu_index; 74 struct padata_list serial;
75 struct work_struct work;
76 struct parallel_data *pd;
52}; 77};
53 78
79/**
80 * struct padata_parallel_queue - The percpu padata parallel queue
81 *
82 * @parallel: List to wait for parallelization.
83 * @reorder: List to wait for reordering after parallel processing.
84 * @serial: List to wait for serialization after reordering.
85 * @pwork: work struct for parallelization.
86 * @swork: work struct for serialization.
87 * @pd: Backpointer to the internal control structure.
88 * @work: work struct for parallelization.
89 * @num_obj: Number of objects that are processed by this cpu.
90 * @cpu_index: Index of the cpu.
91 */
92struct padata_parallel_queue {
93 struct padata_list parallel;
94 struct padata_list reorder;
95 struct parallel_data *pd;
96 struct work_struct work;
97 atomic_t num_obj;
98 int cpu_index;
99};
100
101/**
102 * struct padata_cpumask - The cpumasks for the parallel/serial workers
103 *
104 * @pcpu: cpumask for the parallel workers.
105 * @cbcpu: cpumask for the serial (callback) workers.
106 */
107struct padata_cpumask {
108 cpumask_var_t pcpu;
109 cpumask_var_t cbcpu;
110};
111
112/**
113 * struct parallel_data - Internal control structure, covers everything
114 * that depends on the cpumask in use.
115 *
116 * @pinst: padata instance.
117 * @pqueue: percpu padata queues used for parallelization.
118 * @squeue: percpu padata queues used for serialuzation.
119 * @seq_nr: The sequence number that will be attached to the next object.
120 * @reorder_objects: Number of objects waiting in the reorder queues.
121 * @refcnt: Number of objects holding a reference on this parallel_data.
122 * @max_seq_nr: Maximal used sequence number.
123 * @cpumask: The cpumasks in use for parallel and serial workers.
124 * @lock: Reorder lock.
125 * @processed: Number of already processed objects.
126 * @timer: Reorder timer.
127 */
54struct parallel_data { 128struct parallel_data {
55 struct padata_instance *pinst; 129 struct padata_instance *pinst;
56 struct padata_queue *queue; 130 struct padata_parallel_queue *pqueue;
57 atomic_t seq_nr; 131 struct padata_serial_queue *squeue;
58 atomic_t reorder_objects; 132 atomic_t seq_nr;
59 atomic_t refcnt; 133 atomic_t reorder_objects;
60 unsigned int max_seq_nr; 134 atomic_t refcnt;
61 cpumask_var_t cpumask; 135 unsigned int max_seq_nr;
62 spinlock_t lock; 136 struct padata_cpumask cpumask;
137 spinlock_t lock ____cacheline_aligned;
138 unsigned int processed;
139 struct timer_list timer;
63}; 140};
64 141
142/**
143 * struct padata_instance - The overall control structure.
144 *
145 * @cpu_notifier: cpu hotplug notifier.
146 * @wq: The workqueue in use.
147 * @pd: The internal control structure.
148 * @cpumask: User supplied cpumasks for parallel and serial works.
149 * @cpumask_change_notifier: Notifiers chain for user-defined notify
150 * callbacks that will be called when either @pcpu or @cbcpu
151 * or both cpumasks change.
152 * @kobj: padata instance kernel object.
153 * @lock: padata instance lock.
154 * @flags: padata flags.
155 */
65struct padata_instance { 156struct padata_instance {
66 struct notifier_block cpu_notifier; 157 struct notifier_block cpu_notifier;
67 struct workqueue_struct *wq; 158 struct workqueue_struct *wq;
68 struct parallel_data *pd; 159 struct parallel_data *pd;
69 cpumask_var_t cpumask; 160 struct padata_cpumask cpumask;
70 struct mutex lock; 161 struct blocking_notifier_head cpumask_change_notifier;
71 u8 flags; 162 struct kobject kobj;
72#define PADATA_INIT 1 163 struct mutex lock;
73#define PADATA_RESET 2 164 u8 flags;
165#define PADATA_INIT 1
166#define PADATA_RESET 2
167#define PADATA_INVALID 4
74}; 168};
75 169
76extern struct padata_instance *padata_alloc(const struct cpumask *cpumask, 170extern struct padata_instance *padata_alloc_possible(
77 struct workqueue_struct *wq); 171 struct workqueue_struct *wq);
172extern struct padata_instance *padata_alloc(struct workqueue_struct *wq,
173 const struct cpumask *pcpumask,
174 const struct cpumask *cbcpumask);
78extern void padata_free(struct padata_instance *pinst); 175extern void padata_free(struct padata_instance *pinst);
79extern int padata_do_parallel(struct padata_instance *pinst, 176extern int padata_do_parallel(struct padata_instance *pinst,
80 struct padata_priv *padata, int cb_cpu); 177 struct padata_priv *padata, int cb_cpu);
81extern void padata_do_serial(struct padata_priv *padata); 178extern void padata_do_serial(struct padata_priv *padata);
82extern int padata_set_cpumask(struct padata_instance *pinst, 179extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
83 cpumask_var_t cpumask); 180 cpumask_var_t cpumask);
84extern int padata_add_cpu(struct padata_instance *pinst, int cpu); 181extern int padata_set_cpumasks(struct padata_instance *pinst,
85extern int padata_remove_cpu(struct padata_instance *pinst, int cpu); 182 cpumask_var_t pcpumask,
86extern void padata_start(struct padata_instance *pinst); 183 cpumask_var_t cbcpumask);
184extern int padata_add_cpu(struct padata_instance *pinst, int cpu, int mask);
185extern int padata_remove_cpu(struct padata_instance *pinst, int cpu, int mask);
186extern int padata_start(struct padata_instance *pinst);
87extern void padata_stop(struct padata_instance *pinst); 187extern void padata_stop(struct padata_instance *pinst);
188extern int padata_register_cpumask_notifier(struct padata_instance *pinst,
189 struct notifier_block *nblock);
190extern int padata_unregister_cpumask_notifier(struct padata_instance *pinst,
191 struct notifier_block *nblock);
88#endif 192#endif
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5b59f35dcb8f..6fa317801e1c 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -128,7 +128,6 @@ enum pageflags {
128 128
129 /* SLUB */ 129 /* SLUB */
130 PG_slub_frozen = PG_active, 130 PG_slub_frozen = PG_active,
131 PG_slub_debug = PG_error,
132}; 131};
133 132
134#ifndef __GENERATING_BOUNDS_H 133#ifndef __GENERATING_BOUNDS_H
@@ -215,7 +214,6 @@ PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
215__PAGEFLAG(SlobFree, slob_free) 214__PAGEFLAG(SlobFree, slob_free)
216 215
217__PAGEFLAG(SlubFrozen, slub_frozen) 216__PAGEFLAG(SlubFrozen, slub_frozen)
218__PAGEFLAG(SlubDebug, slub_debug)
219 217
220/* 218/*
221 * Private page markings that may be used by the filesystem that owns the page 219 * Private page markings that may be used by the filesystem that owns the page
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index aef22ae2af47..5bb13b3db84d 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -40,6 +40,7 @@ enum {
40 PCG_USED, /* this object is in use. */ 40 PCG_USED, /* this object is in use. */
41 PCG_ACCT_LRU, /* page has been accounted for */ 41 PCG_ACCT_LRU, /* page has been accounted for */
42 PCG_FILE_MAPPED, /* page is accounted as "mapped" */ 42 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
43 PCG_MIGRATION, /* under page migration */
43}; 44};
44 45
45#define TESTPCGFLAG(uname, lname) \ 46#define TESTPCGFLAG(uname, lname) \
@@ -79,6 +80,10 @@ SETPCGFLAG(FileMapped, FILE_MAPPED)
79CLEARPCGFLAG(FileMapped, FILE_MAPPED) 80CLEARPCGFLAG(FileMapped, FILE_MAPPED)
80TESTPCGFLAG(FileMapped, FILE_MAPPED) 81TESTPCGFLAG(FileMapped, FILE_MAPPED)
81 82
83SETPCGFLAG(Migration, MIGRATION)
84CLEARPCGFLAG(Migration, MIGRATION)
85TESTPCGFLAG(Migration, MIGRATION)
86
82static inline int page_cgroup_nid(struct page_cgroup *pc) 87static inline int page_cgroup_nid(struct page_cgroup *pc)
83{ 88{
84 return page_to_nid(pc->page); 89 return page_to_nid(pc->page);
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 3c62ed408492..78a702ce4fcb 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -423,8 +423,10 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
423 const char __user *end = uaddr + size - 1; 423 const char __user *end = uaddr + size - 1;
424 424
425 if (((unsigned long)uaddr & PAGE_MASK) != 425 if (((unsigned long)uaddr & PAGE_MASK) !=
426 ((unsigned long)end & PAGE_MASK)) 426 ((unsigned long)end & PAGE_MASK)) {
427 ret = __get_user(c, end); 427 ret = __get_user(c, end);
428 (void)c;
429 }
428 } 430 }
429 return ret; 431 return ret;
430} 432}
diff --git a/include/linux/pch_dma.h b/include/linux/pch_dma.h
new file mode 100644
index 000000000000..fdafe529ef8a
--- /dev/null
+++ b/include/linux/pch_dma.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (c) 2010 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#ifndef PCH_DMA_H
19#define PCH_DMA_H
20
21#include <linux/dmaengine.h>
22
23enum pch_dma_width {
24 PCH_DMA_WIDTH_1_BYTE,
25 PCH_DMA_WIDTH_2_BYTES,
26 PCH_DMA_WIDTH_4_BYTES,
27};
28
29struct pch_dma_slave {
30 struct device *dma_dev;
31 unsigned int chan_id;
32 dma_addr_t tx_reg;
33 dma_addr_t rx_reg;
34 enum pch_dma_width width;
35};
36
37#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index a788fa12ff31..b1d17956a153 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -270,6 +270,8 @@ struct pci_dev {
270 unsigned int d1_support:1; /* Low power state D1 is supported */ 270 unsigned int d1_support:1; /* Low power state D1 is supported */
271 unsigned int d2_support:1; /* Low power state D2 is supported */ 271 unsigned int d2_support:1; /* Low power state D2 is supported */
272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 272 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
273 unsigned int mmio_always_on:1; /* disallow turning off io/mem
274 decoding during bar sizing */
273 unsigned int wakeup_prepared:1; 275 unsigned int wakeup_prepared:1;
274 unsigned int d3_delay; /* D3->D0 transition time in ms */ 276 unsigned int d3_delay; /* D3->D0 transition time in ms */
275 277
@@ -288,6 +290,7 @@ struct pci_dev {
288 */ 290 */
289 unsigned int irq; 291 unsigned int irq;
290 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */ 292 struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
293 resource_size_t fw_addr[DEVICE_COUNT_RESOURCE]; /* FW-assigned addr */
291 294
292 /* These fields are used by common fixups */ 295 /* These fields are used by common fixups */
293 unsigned int transparent:1; /* Transparent PCI bridge */ 296 unsigned int transparent:1; /* Transparent PCI bridge */
@@ -311,7 +314,8 @@ struct pci_dev {
311 unsigned int is_virtfn:1; 314 unsigned int is_virtfn:1;
312 unsigned int reset_fn:1; 315 unsigned int reset_fn:1;
313 unsigned int is_hotplug_bridge:1; 316 unsigned int is_hotplug_bridge:1;
314 unsigned int aer_firmware_first:1; 317 unsigned int __aer_firmware_first_valid:1;
318 unsigned int __aer_firmware_first:1;
315 pci_dev_flags_t dev_flags; 319 pci_dev_flags_t dev_flags;
316 atomic_t enable_cnt; /* pci_enable_device has been called */ 320 atomic_t enable_cnt; /* pci_enable_device has been called */
317 321
@@ -334,6 +338,16 @@ struct pci_dev {
334#endif 338#endif
335}; 339};
336 340
341static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
342{
343#ifdef CONFIG_PCI_IOV
344 if (dev->is_virtfn)
345 dev = dev->physfn;
346#endif
347
348 return dev;
349}
350
337extern struct pci_dev *alloc_pci_dev(void); 351extern struct pci_dev *alloc_pci_dev(void);
338 352
339#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) 353#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
@@ -621,6 +635,7 @@ void pci_fixup_cardbus(struct pci_bus *);
621 635
622/* Generic PCI functions used internally */ 636/* Generic PCI functions used internally */
623 637
638void pcibios_scan_specific_bus(int busn);
624extern struct pci_bus *pci_find_bus(int domain, int busnr); 639extern struct pci_bus *pci_find_bus(int domain, int busnr);
625void pci_bus_add_devices(const struct pci_bus *bus); 640void pci_bus_add_devices(const struct pci_bus *bus);
626struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 641struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 9f688d243b86..f6a3b2d36cad 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1261,6 +1261,7 @@
1261#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1261#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8
1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 1263#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2
1264#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85
1264 1265
1265#define PCI_VENDOR_ID_IMS 0x10e0 1266#define PCI_VENDOR_ID_IMS 0x10e0
1266#define PCI_DEVICE_ID_IMS_TT128 0x9128 1267#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -1493,6 +1494,9 @@
1493#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 1494#define PCI_DEVICE_ID_SBE_WANXL100 0x0301
1494#define PCI_DEVICE_ID_SBE_WANXL200 0x0302 1495#define PCI_DEVICE_ID_SBE_WANXL200 0x0302
1495#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 1496#define PCI_DEVICE_ID_SBE_WANXL400 0x0104
1497#define PCI_SUBDEVICE_ID_SBE_T3E3 0x0009
1498#define PCI_SUBDEVICE_ID_SBE_2T3E3_P0 0x0901
1499#define PCI_SUBDEVICE_ID_SBE_2T3E3_P1 0x0902
1496 1500
1497#define PCI_VENDOR_ID_TOSHIBA 0x1179 1501#define PCI_VENDOR_ID_TOSHIBA 0x1179
1498#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101 1502#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101
@@ -2053,7 +2057,6 @@
2053#define PCI_DEVICE_ID_NX2_57711E 0x1650 2057#define PCI_DEVICE_ID_NX2_57711E 0x1650
2054#define PCI_DEVICE_ID_TIGON3_5705 0x1653 2058#define PCI_DEVICE_ID_TIGON3_5705 0x1653
2055#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 2059#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
2056#define PCI_DEVICE_ID_TIGON3_5720 0x1658
2057#define PCI_DEVICE_ID_TIGON3_5721 0x1659 2060#define PCI_DEVICE_ID_TIGON3_5721 0x1659
2058#define PCI_DEVICE_ID_TIGON3_5722 0x165a 2061#define PCI_DEVICE_ID_TIGON3_5722 0x165a
2059#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2062#define PCI_DEVICE_ID_TIGON3_5723 0x165b
@@ -2067,13 +2070,11 @@
2067#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 2070#define PCI_DEVICE_ID_TIGON3_5754M 0x1672
2068#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 2071#define PCI_DEVICE_ID_TIGON3_5755M 0x1673
2069#define PCI_DEVICE_ID_TIGON3_5756 0x1674 2072#define PCI_DEVICE_ID_TIGON3_5756 0x1674
2070#define PCI_DEVICE_ID_TIGON3_5750 0x1676
2071#define PCI_DEVICE_ID_TIGON3_5751 0x1677 2073#define PCI_DEVICE_ID_TIGON3_5751 0x1677
2072#define PCI_DEVICE_ID_TIGON3_5715 0x1678 2074#define PCI_DEVICE_ID_TIGON3_5715 0x1678
2073#define PCI_DEVICE_ID_TIGON3_5715S 0x1679 2075#define PCI_DEVICE_ID_TIGON3_5715S 0x1679
2074#define PCI_DEVICE_ID_TIGON3_5754 0x167a 2076#define PCI_DEVICE_ID_TIGON3_5754 0x167a
2075#define PCI_DEVICE_ID_TIGON3_5755 0x167b 2077#define PCI_DEVICE_ID_TIGON3_5755 0x167b
2076#define PCI_DEVICE_ID_TIGON3_5750M 0x167c
2077#define PCI_DEVICE_ID_TIGON3_5751M 0x167d 2078#define PCI_DEVICE_ID_TIGON3_5751M 0x167d
2078#define PCI_DEVICE_ID_TIGON3_5751F 0x167e 2079#define PCI_DEVICE_ID_TIGON3_5751F 0x167e
2079#define PCI_DEVICE_ID_TIGON3_5787F 0x167f 2080#define PCI_DEVICE_ID_TIGON3_5787F 0x167f
@@ -2263,6 +2264,7 @@
2263#define PCI_DEVICE_ID_TDI_EHCI 0x0101 2264#define PCI_DEVICE_ID_TDI_EHCI 0x0101
2264 2265
2265#define PCI_VENDOR_ID_FREESCALE 0x1957 2266#define PCI_VENDOR_ID_FREESCALE 0x1957
2267#define PCI_DEVICE_ID_MPC8308 0xc006
2266#define PCI_DEVICE_ID_MPC8315E 0x00b4 2268#define PCI_DEVICE_ID_MPC8315E 0x00b4
2267#define PCI_DEVICE_ID_MPC8315 0x00b5 2269#define PCI_DEVICE_ID_MPC8315 0x00b5
2268#define PCI_DEVICE_ID_MPC8314E 0x00b6 2270#define PCI_DEVICE_ID_MPC8314E 0x00b6
@@ -2321,10 +2323,13 @@
2321#define PCI_VENDOR_ID_JMICRON 0x197B 2323#define PCI_VENDOR_ID_JMICRON 0x197B
2322#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 2324#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
2323#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 2325#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361
2326#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362
2324#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 2327#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363
2328#define PCI_DEVICE_ID_JMICRON_JMB364 0x2364
2325#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2329#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2326#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2330#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2327#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2331#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2332#define PCI_DEVICE_ID_JMICRON_JMB369 0x2369
2328#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 2333#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2329#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382 2334#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382
2330#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 2335#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383
@@ -2367,6 +2372,9 @@
2367#define PCI_VENDOR_ID_AKS 0x416c 2372#define PCI_VENDOR_ID_AKS 0x416c
2368#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2373#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2369 2374
2375#define PCI_VENDOR_ID_ACCESSIO 0x494f
2376#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0
2377
2370#define PCI_VENDOR_ID_S3 0x5333 2378#define PCI_VENDOR_ID_S3 0x5333
2371#define PCI_DEVICE_ID_S3_TRIO 0x8811 2379#define PCI_DEVICE_ID_S3_TRIO 0x8811
2372#define PCI_DEVICE_ID_S3_868 0x8880 2380#define PCI_DEVICE_ID_S3_868 0x8880
@@ -2419,8 +2427,8 @@
2419#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 2427#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30
2420#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 2428#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38
2421#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 2429#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22
2422#define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42 2430#define PCI_DEVICE_ID_INTEL_CPT_LPC_MIN 0x1c41
2423#define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43 2431#define PCI_DEVICE_ID_INTEL_CPT_LPC_MAX 0x1c5f
2424#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2432#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2425#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2433#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2426#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2434#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
@@ -2532,11 +2540,63 @@
2532#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2540#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2533#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 2541#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2534#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 2542#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2543#define PCI_DEVICE_ID_INTEL_I7_MCR 0x2c18
2544#define PCI_DEVICE_ID_INTEL_I7_MC_TAD 0x2c19
2545#define PCI_DEVICE_ID_INTEL_I7_MC_RAS 0x2c1a
2546#define PCI_DEVICE_ID_INTEL_I7_MC_TEST 0x2c1c
2547#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_CTRL 0x2c20
2548#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_ADDR 0x2c21
2549#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_RANK 0x2c22
2550#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_TC 0x2c23
2551#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_CTRL 0x2c28
2552#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_ADDR 0x2c29
2553#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_RANK 0x2c2a
2554#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_TC 0x2c2b
2555#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_CTRL 0x2c30
2556#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_ADDR 0x2c31
2557#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_RANK 0x2c32
2558#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_TC 0x2c33
2559#define PCI_DEVICE_ID_INTEL_I7_NONCORE 0x2c41
2560#define PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT 0x2c40
2561#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE 0x2c50
2562#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT 0x2c51
2563#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_REV2 0x2c70
2564#define PCI_DEVICE_ID_INTEL_LYNNFIELD_SAD 0x2c81
2565#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_LINK0 0x2c90
2566#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_PHY0 0x2c91
2567#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR 0x2c98
2568#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD 0x2c99
2569#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST 0x2c9C
2570#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL 0x2ca0
2571#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR 0x2ca1
2572#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK 0x2ca2
2573#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC 0x2ca3
2574#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL 0x2ca8
2575#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR 0x2ca9
2576#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK 0x2caa
2577#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC 0x2cab
2578#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR_REV2 0x2d98
2579#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD_REV2 0x2d99
2580#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_RAS_REV2 0x2d9a
2581#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST_REV2 0x2d9c
2582#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL_REV2 0x2da0
2583#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR_REV2 0x2da1
2584#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK_REV2 0x2da2
2585#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC_REV2 0x2da3
2586#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL_REV2 0x2da8
2587#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR_REV2 0x2da9
2588#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK_REV2 0x2daa
2589#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC_REV2 0x2dab
2590#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_CTRL_REV2 0x2db0
2591#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_ADDR_REV2 0x2db1
2592#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_RANK_REV2 0x2db2
2593#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_TC_REV2 0x2db3
2535#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2594#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2536#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429 2595#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429
2537#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a 2596#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a
2538#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b 2597#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b
2539#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c 2598#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c
2599#define PCI_DEVICE_ID_INTEL_X58_HUB_MGMT 0x342e
2540#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430 2600#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430
2541#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431 2601#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431
2542#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432 2602#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432
@@ -2718,3 +2778,6 @@
2718#define PCI_DEVICE_ID_RME_DIGI32 0x9896 2778#define PCI_DEVICE_ID_RME_DIGI32 0x9896
2719#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 2779#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2720#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 2780#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2781
2782#define PCI_VENDOR_ID_XEN 0x5853
2783#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c8f302991b66..455b9ccdfca7 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -442,7 +442,10 @@
442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */ 442#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
443#define PCI_EXP_LNKSTA 18 /* Link Status */ 443#define PCI_EXP_LNKSTA 18 /* Link Status */
444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */ 444#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
445#define PCI_EXP_LNKSTA_CLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */
446#define PCI_EXP_LNKSTA_CLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */
445#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */ 447#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
448#define PCI_EXP_LNKSTA_NLW_SHIFT 4 /* start of NLW mask in link status */
446#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */ 449#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
447#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 450#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
448#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */ 451#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
@@ -563,8 +566,7 @@
563#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */ 566#define PCI_ERR_ROOT_FIRST_FATAL 0x00000010 /* First Fatal */
564#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */ 567#define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
565#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */ 568#define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
566#define PCI_ERR_ROOT_COR_SRC 52 569#define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */
567#define PCI_ERR_ROOT_SRC 54
568 570
569/* Virtual Channel */ 571/* Virtual Channel */
570#define PCI_VC_PORT_REG1 4 572#define PCI_VC_PORT_REG1 4
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index d4cf7a2ceb3e..c9e4d814ff77 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -24,6 +24,8 @@ struct pda_power_pdata {
24 int (*is_usb_online)(void); 24 int (*is_usb_online)(void);
25 void (*set_charge)(int flags); 25 void (*set_charge)(int flags);
26 void (*exit)(struct device *dev); 26 void (*exit)(struct device *dev);
27 int (*suspend)(pm_message_t state);
28 int (*resume)(void);
27 29
28 char **supplied_to; 30 char **supplied_to;
29 size_t num_supplicants; 31 size_t num_supplicants;
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 68567c0b3a5d..ce2dc655cd1d 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -131,11 +131,11 @@
131 * Declaration/definition used for per-CPU variables that must be page aligned. 131 * Declaration/definition used for per-CPU variables that must be page aligned.
132 */ 132 */
133#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \ 133#define DECLARE_PER_CPU_PAGE_ALIGNED(type, name) \
134 DECLARE_PER_CPU_SECTION(type, name, ".page_aligned") \ 134 DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \
135 __aligned(PAGE_SIZE) 135 __aligned(PAGE_SIZE)
136 136
137#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \ 137#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
138 DEFINE_PER_CPU_SECTION(type, name, ".page_aligned") \ 138 DEFINE_PER_CPU_SECTION(type, name, "..page_aligned") \
139 __aligned(PAGE_SIZE) 139 __aligned(PAGE_SIZE)
140 140
141/* 141/*
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index d3a38d687104..b8b9084527b1 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -45,6 +45,16 @@
45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10) 45#define PCPU_MIN_UNIT_SIZE PFN_ALIGN(64 << 10)
46 46
47/* 47/*
48 * Percpu allocator can serve percpu allocations before slab is
49 * initialized which allows slab to depend on the percpu allocator.
50 * The following two parameters decide how much resource to
51 * preallocate for this. Keep PERCPU_DYNAMIC_RESERVE equal to or
52 * larger than PERCPU_DYNAMIC_EARLY_SIZE.
53 */
54#define PERCPU_DYNAMIC_EARLY_SLOTS 128
55#define PERCPU_DYNAMIC_EARLY_SIZE (12 << 10)
56
57/*
48 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy 58 * PERCPU_DYNAMIC_RESERVE indicates the amount of free area to piggy
49 * back on the first chunk for dynamic percpu allocation if arch is 59 * back on the first chunk for dynamic percpu allocation if arch is
50 * manually allocating and mapping it for faster access (as a part of 60 * manually allocating and mapping it for faster access (as a part of
@@ -104,16 +114,11 @@ extern struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
104 int nr_units); 114 int nr_units);
105extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai); 115extern void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai);
106 116
107extern struct pcpu_alloc_info * __init pcpu_build_alloc_info(
108 size_t reserved_size, ssize_t dyn_size,
109 size_t atom_size,
110 pcpu_fc_cpu_distance_fn_t cpu_distance_fn);
111
112extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, 117extern int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
113 void *base_addr); 118 void *base_addr);
114 119
115#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK 120#ifdef CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
116extern int __init pcpu_embed_first_chunk(size_t reserved_size, ssize_t dyn_size, 121extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
117 size_t atom_size, 122 size_t atom_size,
118 pcpu_fc_cpu_distance_fn_t cpu_distance_fn, 123 pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
119 pcpu_fc_alloc_fn_t alloc_fn, 124 pcpu_fc_alloc_fn_t alloc_fn,
@@ -140,6 +145,7 @@ extern bool is_kernel_percpu_address(unsigned long addr);
140#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA 145#ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA
141extern void __init setup_per_cpu_areas(void); 146extern void __init setup_per_cpu_areas(void);
142#endif 147#endif
148extern void __init percpu_init_late(void);
143 149
144#else /* CONFIG_SMP */ 150#else /* CONFIG_SMP */
145 151
@@ -153,6 +159,8 @@ static inline bool is_kernel_percpu_address(unsigned long addr)
153 159
154static inline void __init setup_per_cpu_areas(void) { } 160static inline void __init setup_per_cpu_areas(void) { }
155 161
162static inline void __init percpu_init_late(void) { }
163
156static inline void *pcpu_lpage_remapped(void *kaddr) 164static inline void *pcpu_lpage_remapped(void *kaddr)
157{ 165{
158 return NULL; 166 return NULL;
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index c88d67b59394..8a7d510ffa9c 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -40,6 +40,7 @@ void percpu_counter_destroy(struct percpu_counter *fbc);
40void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
42s64 __percpu_counter_sum(struct percpu_counter *fbc); 42s64 __percpu_counter_sum(struct percpu_counter *fbc);
43int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs);
43 44
44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 45static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
45{ 46{
@@ -98,6 +99,16 @@ static inline void percpu_counter_set(struct percpu_counter *fbc, s64 amount)
98 fbc->count = amount; 99 fbc->count = amount;
99} 100}
100 101
102static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
103{
104 if (fbc->count > rhs)
105 return 1;
106 else if (fbc->count < rhs)
107 return -1;
108 else
109 return 0;
110}
111
101static inline void 112static inline void
102percpu_counter_add(struct percpu_counter *fbc, s64 amount) 113percpu_counter_add(struct percpu_counter *fbc, s64 amount)
103{ 114{
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c8e375440403..716f99b682c1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -203,8 +203,20 @@ struct perf_event_attr {
203 enable_on_exec : 1, /* next exec enables */ 203 enable_on_exec : 1, /* next exec enables */
204 task : 1, /* trace fork/exit */ 204 task : 1, /* trace fork/exit */
205 watermark : 1, /* wakeup_watermark */ 205 watermark : 1, /* wakeup_watermark */
206 206 /*
207 __reserved_1 : 49; 207 * precise_ip:
208 *
209 * 0 - SAMPLE_IP can have arbitrary skid
210 * 1 - SAMPLE_IP must have constant skid
211 * 2 - SAMPLE_IP requested to have 0 skid
212 * 3 - SAMPLE_IP must have 0 skid
213 *
214 * See also PERF_RECORD_MISC_EXACT_IP
215 */
216 precise_ip : 2, /* skid constraint */
217 mmap_data : 1, /* non-exec mmap data */
218
219 __reserved_1 : 46;
208 220
209 union { 221 union {
210 __u32 wakeup_events; /* wakeup every n events */ 222 __u32 wakeup_events; /* wakeup every n events */
@@ -287,11 +299,24 @@ struct perf_event_mmap_page {
287 __u64 data_tail; /* user-space written tail */ 299 __u64 data_tail; /* user-space written tail */
288}; 300};
289 301
290#define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) 302#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
291#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) 303#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
292#define PERF_RECORD_MISC_KERNEL (1 << 0) 304#define PERF_RECORD_MISC_KERNEL (1 << 0)
293#define PERF_RECORD_MISC_USER (2 << 0) 305#define PERF_RECORD_MISC_USER (2 << 0)
294#define PERF_RECORD_MISC_HYPERVISOR (3 << 0) 306#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
307#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
308#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
309
310/*
311 * Indicates that the content of PERF_SAMPLE_IP points to
312 * the actual instruction that triggered the event. See also
313 * perf_event_attr::precise_ip.
314 */
315#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
316/*
317 * Reserve the last bit to indicate some extended misc field
318 */
319#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
295 320
296struct perf_event_header { 321struct perf_event_header {
297 __u32 type; 322 __u32 type;
@@ -437,8 +462,15 @@ enum perf_callchain_context {
437 462
438#ifdef CONFIG_PERF_EVENTS 463#ifdef CONFIG_PERF_EVENTS
439# include <asm/perf_event.h> 464# include <asm/perf_event.h>
465# include <asm/local64.h>
440#endif 466#endif
441 467
468struct perf_guest_info_callbacks {
469 int (*is_in_guest) (void);
470 int (*is_user_mode) (void);
471 unsigned long (*get_guest_ip) (void);
472};
473
442#ifdef CONFIG_HAVE_HW_BREAKPOINT 474#ifdef CONFIG_HAVE_HW_BREAKPOINT
443#include <asm/hw_breakpoint.h> 475#include <asm/hw_breakpoint.h>
444#endif 476#endif
@@ -455,6 +487,7 @@ enum perf_callchain_context {
455#include <linux/ftrace.h> 487#include <linux/ftrace.h>
456#include <linux/cpu.h> 488#include <linux/cpu.h>
457#include <asm/atomic.h> 489#include <asm/atomic.h>
490#include <asm/local.h>
458 491
459#define PERF_MAX_STACK_DEPTH 255 492#define PERF_MAX_STACK_DEPTH 255
460 493
@@ -468,6 +501,17 @@ struct perf_raw_record {
468 void *data; 501 void *data;
469}; 502};
470 503
504struct perf_branch_entry {
505 __u64 from;
506 __u64 to;
507 __u64 flags;
508};
509
510struct perf_branch_stack {
511 __u64 nr;
512 struct perf_branch_entry entries[0];
513};
514
471struct task_struct; 515struct task_struct;
472 516
473/** 517/**
@@ -489,14 +533,16 @@ struct hw_perf_event {
489 struct hrtimer hrtimer; 533 struct hrtimer hrtimer;
490 }; 534 };
491#ifdef CONFIG_HAVE_HW_BREAKPOINT 535#ifdef CONFIG_HAVE_HW_BREAKPOINT
492 /* breakpoint */ 536 struct { /* breakpoint */
493 struct arch_hw_breakpoint info; 537 struct arch_hw_breakpoint info;
538 struct list_head bp_list;
539 };
494#endif 540#endif
495 }; 541 };
496 atomic64_t prev_count; 542 local64_t prev_count;
497 u64 sample_period; 543 u64 sample_period;
498 u64 last_period; 544 u64 last_period;
499 atomic64_t period_left; 545 local64_t period_left;
500 u64 interrupts; 546 u64 interrupts;
501 547
502 u64 freq_time_stamp; 548 u64 freq_time_stamp;
@@ -506,6 +552,11 @@ struct hw_perf_event {
506 552
507struct perf_event; 553struct perf_event;
508 554
555/*
556 * Common implementation detail of pmu::{start,commit,cancel}_txn
557 */
558#define PERF_EVENT_TXN 0x1
559
509/** 560/**
510 * struct pmu - generic performance monitoring unit 561 * struct pmu - generic performance monitoring unit
511 */ 562 */
@@ -516,6 +567,30 @@ struct pmu {
516 void (*stop) (struct perf_event *event); 567 void (*stop) (struct perf_event *event);
517 void (*read) (struct perf_event *event); 568 void (*read) (struct perf_event *event);
518 void (*unthrottle) (struct perf_event *event); 569 void (*unthrottle) (struct perf_event *event);
570
571 /*
572 * Group events scheduling is treated as a transaction, add group
573 * events as a whole and perform one schedulability test. If the test
574 * fails, roll back the whole group
575 */
576
577 /*
578 * Start the transaction, after this ->enable() doesn't need
579 * to do schedulability tests.
580 */
581 void (*start_txn) (const struct pmu *pmu);
582 /*
583 * If ->start_txn() disabled the ->enable() schedulability test
584 * then ->commit_txn() is required to perform one. On success
585 * the transaction is closed. On error the transaction is kept
586 * open until ->cancel_txn() is called.
587 */
588 int (*commit_txn) (const struct pmu *pmu);
589 /*
590 * Will cancel the transaction, assumes ->disable() is called for
591 * each successfull ->enable() during the transaction.
592 */
593 void (*cancel_txn) (const struct pmu *pmu);
519}; 594};
520 595
521/** 596/**
@@ -530,25 +605,25 @@ enum perf_event_active_state {
530 605
531struct file; 606struct file;
532 607
533struct perf_mmap_data { 608#define PERF_BUFFER_WRITABLE 0x01
609
610struct perf_buffer {
611 atomic_t refcount;
534 struct rcu_head rcu_head; 612 struct rcu_head rcu_head;
535#ifdef CONFIG_PERF_USE_VMALLOC 613#ifdef CONFIG_PERF_USE_VMALLOC
536 struct work_struct work; 614 struct work_struct work;
615 int page_order; /* allocation order */
537#endif 616#endif
538 int data_order;
539 int nr_pages; /* nr of data pages */ 617 int nr_pages; /* nr of data pages */
540 int writable; /* are we writable */ 618 int writable; /* are we writable */
541 int nr_locked; /* nr pages mlocked */
542 619
543 atomic_t poll; /* POLL_ for wakeups */ 620 atomic_t poll; /* POLL_ for wakeups */
544 atomic_t events; /* event_id limit */
545
546 atomic_long_t head; /* write position */
547 atomic_long_t done_head; /* completed head */
548 621
549 atomic_t lock; /* concurrent writes */ 622 local_t head; /* write position */
550 atomic_t wakeup; /* needs a wakeup */ 623 local_t nest; /* nested writers */
551 atomic_t lost; /* nr records lost */ 624 local_t events; /* event limit */
625 local_t wakeup; /* wakeup stamp */
626 local_t lost; /* nr records lost */
552 627
553 long watermark; /* wakeup watermark */ 628 long watermark; /* wakeup watermark */
554 629
@@ -571,6 +646,17 @@ enum perf_group_flag {
571 PERF_GROUP_SOFTWARE = 0x1, 646 PERF_GROUP_SOFTWARE = 0x1,
572}; 647};
573 648
649#define SWEVENT_HLIST_BITS 8
650#define SWEVENT_HLIST_SIZE (1 << SWEVENT_HLIST_BITS)
651
652struct swevent_hlist {
653 struct hlist_head heads[SWEVENT_HLIST_SIZE];
654 struct rcu_head rcu_head;
655};
656
657#define PERF_ATTACH_CONTEXT 0x01
658#define PERF_ATTACH_GROUP 0x02
659
574/** 660/**
575 * struct perf_event - performance event kernel representation: 661 * struct perf_event - performance event kernel representation:
576 */ 662 */
@@ -579,14 +665,16 @@ struct perf_event {
579 struct list_head group_entry; 665 struct list_head group_entry;
580 struct list_head event_entry; 666 struct list_head event_entry;
581 struct list_head sibling_list; 667 struct list_head sibling_list;
668 struct hlist_node hlist_entry;
582 int nr_siblings; 669 int nr_siblings;
583 int group_flags; 670 int group_flags;
584 struct perf_event *group_leader; 671 struct perf_event *group_leader;
585 struct perf_event *output;
586 const struct pmu *pmu; 672 const struct pmu *pmu;
587 673
588 enum perf_event_active_state state; 674 enum perf_event_active_state state;
589 atomic64_t count; 675 unsigned int attach_state;
676 local64_t count;
677 atomic64_t child_count;
590 678
591 /* 679 /*
592 * These are the total time in nanoseconds that the event 680 * These are the total time in nanoseconds that the event
@@ -643,7 +731,9 @@ struct perf_event {
643 /* mmap bits */ 731 /* mmap bits */
644 struct mutex mmap_mutex; 732 struct mutex mmap_mutex;
645 atomic_t mmap_count; 733 atomic_t mmap_count;
646 struct perf_mmap_data *data; 734 int mmap_locked;
735 struct user_struct *mmap_user;
736 struct perf_buffer *buffer;
647 737
648 /* poll related */ 738 /* poll related */
649 wait_queue_head_t waitq; 739 wait_queue_head_t waitq;
@@ -666,6 +756,7 @@ struct perf_event {
666 perf_overflow_handler_t overflow_handler; 756 perf_overflow_handler_t overflow_handler;
667 757
668#ifdef CONFIG_EVENT_TRACING 758#ifdef CONFIG_EVENT_TRACING
759 struct ftrace_event_call *tp_event;
669 struct event_filter *filter; 760 struct event_filter *filter;
670#endif 761#endif
671 762
@@ -726,6 +817,9 @@ struct perf_cpu_context {
726 int active_oncpu; 817 int active_oncpu;
727 int max_pertask; 818 int max_pertask;
728 int exclusive; 819 int exclusive;
820 struct swevent_hlist *swevent_hlist;
821 struct mutex hlist_mutex;
822 int hlist_refcount;
729 823
730 /* 824 /*
731 * Recursion avoidance: 825 * Recursion avoidance:
@@ -737,12 +831,13 @@ struct perf_cpu_context {
737 831
738struct perf_output_handle { 832struct perf_output_handle {
739 struct perf_event *event; 833 struct perf_event *event;
740 struct perf_mmap_data *data; 834 struct perf_buffer *buffer;
741 unsigned long head; 835 unsigned long wakeup;
742 unsigned long offset; 836 unsigned long size;
837 void *addr;
838 int page;
743 int nmi; 839 int nmi;
744 int sample; 840 int sample;
745 int locked;
746}; 841};
747 842
748#ifdef CONFIG_PERF_EVENTS 843#ifdef CONFIG_PERF_EVENTS
@@ -769,9 +864,6 @@ extern void perf_disable(void);
769extern void perf_enable(void); 864extern void perf_enable(void);
770extern int perf_event_task_disable(void); 865extern int perf_event_task_disable(void);
771extern int perf_event_task_enable(void); 866extern int perf_event_task_enable(void);
772extern int hw_perf_group_sched_in(struct perf_event *group_leader,
773 struct perf_cpu_context *cpuctx,
774 struct perf_event_context *ctx);
775extern void perf_event_update_userpage(struct perf_event *event); 867extern void perf_event_update_userpage(struct perf_event *event);
776extern int perf_event_release_kernel(struct perf_event *event); 868extern int perf_event_release_kernel(struct perf_event *event);
777extern struct perf_event * 869extern struct perf_event *
@@ -842,8 +934,10 @@ extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX];
842 934
843extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64); 935extern void __perf_sw_event(u32, u64, int, struct pt_regs *, u64);
844 936
845extern void 937#ifndef perf_arch_fetch_caller_regs
846perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip); 938static inline void
939perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip) { }
940#endif
847 941
848/* 942/*
849 * Take a snapshot of the regs. Skip ip and frame pointer to 943 * Take a snapshot of the regs. Skip ip and frame pointer to
@@ -853,31 +947,11 @@ perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip);
853 * - bp for callchains 947 * - bp for callchains
854 * - eflags, for future purposes, just in case 948 * - eflags, for future purposes, just in case
855 */ 949 */
856static inline void perf_fetch_caller_regs(struct pt_regs *regs, int skip) 950static inline void perf_fetch_caller_regs(struct pt_regs *regs)
857{ 951{
858 unsigned long ip;
859
860 memset(regs, 0, sizeof(*regs)); 952 memset(regs, 0, sizeof(*regs));
861 953
862 switch (skip) { 954 perf_arch_fetch_caller_regs(regs, CALLER_ADDR0);
863 case 1 :
864 ip = CALLER_ADDR0;
865 break;
866 case 2 :
867 ip = CALLER_ADDR1;
868 break;
869 case 3 :
870 ip = CALLER_ADDR2;
871 break;
872 case 4:
873 ip = CALLER_ADDR3;
874 break;
875 /* No need to support further for now */
876 default:
877 ip = 0;
878 }
879
880 return perf_arch_fetch_caller_regs(regs, ip, skip);
881} 955}
882 956
883static inline void 957static inline void
@@ -887,20 +961,17 @@ perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
887 struct pt_regs hot_regs; 961 struct pt_regs hot_regs;
888 962
889 if (!regs) { 963 if (!regs) {
890 perf_fetch_caller_regs(&hot_regs, 1); 964 perf_fetch_caller_regs(&hot_regs);
891 regs = &hot_regs; 965 regs = &hot_regs;
892 } 966 }
893 __perf_sw_event(event_id, nr, nmi, regs, addr); 967 __perf_sw_event(event_id, nr, nmi, regs, addr);
894 } 968 }
895} 969}
896 970
897extern void __perf_event_mmap(struct vm_area_struct *vma); 971extern void perf_event_mmap(struct vm_area_struct *vma);
898 972extern struct perf_guest_info_callbacks *perf_guest_cbs;
899static inline void perf_event_mmap(struct vm_area_struct *vma) 973extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
900{ 974extern int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks);
901 if (vma->vm_flags & VM_EXEC)
902 __perf_event_mmap(vma);
903}
904 975
905extern void perf_event_comm(struct task_struct *tsk); 976extern void perf_event_comm(struct task_struct *tsk);
906extern void perf_event_fork(struct task_struct *tsk); 977extern void perf_event_fork(struct task_struct *tsk);
@@ -927,8 +998,9 @@ static inline bool perf_paranoid_kernel(void)
927} 998}
928 999
929extern void perf_event_init(void); 1000extern void perf_event_init(void);
930extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, 1001extern void perf_tp_event(u64 addr, u64 count, void *record,
931 int entry_size, struct pt_regs *regs); 1002 int entry_size, struct pt_regs *regs,
1003 struct hlist_head *head, int rctx);
932extern void perf_bp_event(struct perf_event *event, void *data); 1004extern void perf_bp_event(struct perf_event *event, void *data);
933 1005
934#ifndef perf_misc_flags 1006#ifndef perf_misc_flags
@@ -971,6 +1043,11 @@ perf_sw_event(u32 event_id, u64 nr, int nmi,
971static inline void 1043static inline void
972perf_bp_event(struct perf_event *event, void *data) { } 1044perf_bp_event(struct perf_event *event, void *data) { }
973 1045
1046static inline int perf_register_guest_info_callbacks
1047(struct perf_guest_info_callbacks *callbacks) { return 0; }
1048static inline int perf_unregister_guest_info_callbacks
1049(struct perf_guest_info_callbacks *callbacks) { return 0; }
1050
974static inline void perf_event_mmap(struct vm_area_struct *vma) { } 1051static inline void perf_event_mmap(struct vm_area_struct *vma) { }
975static inline void perf_event_comm(struct task_struct *tsk) { } 1052static inline void perf_event_comm(struct task_struct *tsk) { }
976static inline void perf_event_fork(struct task_struct *tsk) { } 1053static inline void perf_event_fork(struct task_struct *tsk) { }
@@ -990,7 +1067,7 @@ static inline void perf_event_disable(struct perf_event *event) { }
990#define perf_cpu_notifier(fn) \ 1067#define perf_cpu_notifier(fn) \
991do { \ 1068do { \
992 static struct notifier_block fn##_nb __cpuinitdata = \ 1069 static struct notifier_block fn##_nb __cpuinitdata = \
993 { .notifier_call = fn, .priority = 20 }; \ 1070 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
994 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 1071 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
995 (void *)(unsigned long)smp_processor_id()); \ 1072 (void *)(unsigned long)smp_processor_id()); \
996 fn(&fn##_nb, (unsigned long)CPU_STARTING, \ 1073 fn(&fn##_nb, (unsigned long)CPU_STARTING, \
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 126120819a0d..eec3bae164d4 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -12,7 +12,7 @@ struct pt_regs;
12 12
13extern int register_exec_domain(struct exec_domain *); 13extern int register_exec_domain(struct exec_domain *);
14extern int unregister_exec_domain(struct exec_domain *); 14extern int unregister_exec_domain(struct exec_domain *);
15extern int __set_personality(unsigned long); 15extern int __set_personality(unsigned int);
16 16
17#endif /* __KERNEL__ */ 17#endif /* __KERNEL__ */
18 18
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index e5126cff9b2a..24426c3d6b5a 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -56,7 +56,7 @@ struct phonethdr {
56 __be16 pn_length; 56 __be16 pn_length;
57 __u8 pn_robj; 57 __u8 pn_robj;
58 __u8 pn_sobj; 58 __u8 pn_sobj;
59} __attribute__((packed)); 59} __packed;
60 60
61/* Common Phonet payload header */ 61/* Common Phonet payload header */
62struct phonetmsg { 62struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn {
98 __u8 spn_dev; 98 __u8 spn_dev;
99 __u8 spn_resource; 99 __u8 spn_resource;
100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3]; 100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
101} __attribute__ ((packed)); 101} __packed;
102 102
103/* Well known address */ 103/* Well known address */
104#define PN_DEV_PC 0x10 104#define PN_DEV_PC 0x10
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 14d7fdf6a90a..6b0a782c6224 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -24,6 +24,7 @@
24#include <linux/mii.h> 24#include <linux/mii.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/mod_devicetable.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29 30
@@ -81,6 +82,10 @@ typedef enum {
81 */ 82 */
82#define MII_BUS_ID_SIZE (20 - 3) 83#define MII_BUS_ID_SIZE (20 - 3)
83 84
85/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit
86 IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */
87#define MII_ADDR_C45 (1<<30)
88
84/* 89/*
85 * The Bus class for PHYs. Devices which provide access to 90 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure 91 * PHYs should register using this structure
@@ -127,8 +132,8 @@ int mdiobus_register(struct mii_bus *bus);
127void mdiobus_unregister(struct mii_bus *bus); 132void mdiobus_unregister(struct mii_bus *bus);
128void mdiobus_free(struct mii_bus *bus); 133void mdiobus_free(struct mii_bus *bus);
129struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); 134struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
130int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); 135int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum);
131int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); 136int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);
132 137
133 138
134#define PHY_INTERRUPT_DISABLED 0x0 139#define PHY_INTERRUPT_DISABLED 0x0
@@ -229,6 +234,8 @@ enum phy_state {
229 PHY_RESUMING 234 PHY_RESUMING
230}; 235};
231 236
237struct sk_buff;
238
232/* phy_device: An instance of a PHY 239/* phy_device: An instance of a PHY
233 * 240 *
234 * drv: Pointer to the driver for this PHY instance 241 * drv: Pointer to the driver for this PHY instance
@@ -397,6 +404,26 @@ struct phy_driver {
397 /* Clears up any memory if needed */ 404 /* Clears up any memory if needed */
398 void (*remove)(struct phy_device *phydev); 405 void (*remove)(struct phy_device *phydev);
399 406
407 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
408 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
409
410 /*
411 * Requests a Rx timestamp for 'skb'. If the skb is accepted,
412 * the phy driver promises to deliver it using netif_rx() as
413 * soon as a timestamp becomes available. One of the
414 * PTP_CLASS_ values is passed in 'type'. The function must
415 * return true if the skb is accepted for delivery.
416 */
417 bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
418
419 /*
420 * Requests a Tx timestamp for 'skb'. The phy driver promises
421 * to deliver it to the socket's error queue as soon as a
422 * timestamp becomes available. One of the PTP_CLASS_ values
423 * is passed in 'type'.
424 */
425 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
426
400 struct device_driver driver; 427 struct device_driver driver;
401}; 428};
402#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 429#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -422,7 +449,7 @@ struct phy_fixup {
422 * because the bus read/write functions may wait for an interrupt 449 * because the bus read/write functions may wait for an interrupt
423 * to conclude the operation. 450 * to conclude the operation.
424 */ 451 */
425static inline int phy_read(struct phy_device *phydev, u16 regnum) 452static inline int phy_read(struct phy_device *phydev, u32 regnum)
426{ 453{
427 return mdiobus_read(phydev->bus, phydev->addr, regnum); 454 return mdiobus_read(phydev->bus, phydev->addr, regnum);
428} 455}
@@ -437,7 +464,7 @@ static inline int phy_read(struct phy_device *phydev, u16 regnum)
437 * because the bus read/write functions may wait for an interrupt 464 * because the bus read/write functions may wait for an interrupt
438 * to conclude the operation. 465 * to conclude the operation.
439 */ 466 */
440static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) 467static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)
441{ 468{
442 return mdiobus_write(phydev->bus, phydev->addr, regnum, val); 469 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
443} 470}
@@ -493,7 +520,7 @@ void phy_stop_machine(struct phy_device *phydev);
493int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); 520int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
494int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); 521int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
495int phy_mii_ioctl(struct phy_device *phydev, 522int phy_mii_ioctl(struct phy_device *phydev,
496 struct mii_ioctl_data *mii_data, int cmd); 523 struct ifreq *ifr, int cmd);
497int phy_start_interrupts(struct phy_device *phydev); 524int phy_start_interrupts(struct phy_device *phydev);
498void phy_print_status(struct phy_device *phydev); 525void phy_print_status(struct phy_device *phydev);
499struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 526struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index b43a9e039059..445796945ac9 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -3,7 +3,7 @@
3 3
4#define PIPEFS_MAGIC 0x50495045 4#define PIPEFS_MAGIC 0x50495045
5 5
6#define PIPE_BUFFERS (16) 6#define PIPE_DEF_BUFFERS 16
7 7
8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */ 8#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */ 9#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
@@ -44,17 +44,17 @@ struct pipe_buffer {
44 **/ 44 **/
45struct pipe_inode_info { 45struct pipe_inode_info {
46 wait_queue_head_t wait; 46 wait_queue_head_t wait;
47 unsigned int nrbufs, curbuf; 47 unsigned int nrbufs, curbuf, buffers;
48 struct page *tmp_page;
49 unsigned int readers; 48 unsigned int readers;
50 unsigned int writers; 49 unsigned int writers;
51 unsigned int waiting_writers; 50 unsigned int waiting_writers;
52 unsigned int r_counter; 51 unsigned int r_counter;
53 unsigned int w_counter; 52 unsigned int w_counter;
53 struct page *tmp_page;
54 struct fasync_struct *fasync_readers; 54 struct fasync_struct *fasync_readers;
55 struct fasync_struct *fasync_writers; 55 struct fasync_struct *fasync_writers;
56 struct inode *inode; 56 struct inode *inode;
57 struct pipe_buffer bufs[PIPE_BUFFERS]; 57 struct pipe_buffer *bufs;
58}; 58};
59 59
60/* 60/*
@@ -139,6 +139,10 @@ void pipe_lock(struct pipe_inode_info *);
139void pipe_unlock(struct pipe_inode_info *); 139void pipe_unlock(struct pipe_inode_info *);
140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *); 140void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *);
141 141
142extern unsigned int pipe_max_size, pipe_min_size;
143int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);
144
145
142/* Drop the inode semaphore and wait for a pipe event, atomically */ 146/* Drop the inode semaphore and wait for a pipe event, atomically */
143void pipe_wait(struct pipe_inode_info *pipe); 147void pipe_wait(struct pipe_inode_info *pipe);
144 148
@@ -154,4 +158,7 @@ int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
154int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 158int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
155void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); 159void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
156 160
161/* for F_SETPIPE_SZ and F_GETPIPE_SZ */
162long pipe_fcntl(struct file *, unsigned int, unsigned long arg);
163
157#endif 164#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 212da17d06af..d7ecad0093bb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -43,13 +43,69 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
43extern int platform_get_irq_byname(struct platform_device *, const char *); 43extern int platform_get_irq_byname(struct platform_device *, const char *);
44extern int platform_add_devices(struct platform_device **, int); 44extern int platform_add_devices(struct platform_device **, int);
45 45
46extern struct platform_device *platform_device_register_simple(const char *, int id, 46extern struct platform_device *platform_device_register_resndata(
47 struct resource *, unsigned int); 47 struct device *parent, const char *name, int id,
48extern struct platform_device *platform_device_register_data(struct device *, 48 const struct resource *res, unsigned int num,
49 const char *, int, const void *, size_t); 49 const void *data, size_t size);
50
51/**
52 * platform_device_register_simple - add a platform-level device and its resources
53 * @name: base name of the device we're adding
54 * @id: instance id
55 * @res: set of resources that needs to be allocated for the device
56 * @num: number of resources
57 *
58 * This function creates a simple platform device that requires minimal
59 * resource and memory management. Canned release function freeing memory
60 * allocated for the device allows drivers using such devices to be
61 * unloaded without waiting for the last reference to the device to be
62 * dropped.
63 *
64 * This interface is primarily intended for use with legacy drivers which
65 * probe hardware directly. Because such drivers create sysfs device nodes
66 * themselves, rather than letting system infrastructure handle such device
67 * enumeration tasks, they don't fully conform to the Linux driver model.
68 * In particular, when such drivers are built as modules, they can't be
69 * "hotplugged".
70 *
71 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
72 */
73static inline struct platform_device *platform_device_register_simple(
74 const char *name, int id,
75 const struct resource *res, unsigned int num)
76{
77 return platform_device_register_resndata(NULL, name, id,
78 res, num, NULL, 0);
79}
80
81/**
82 * platform_device_register_data - add a platform-level device with platform-specific data
83 * @parent: parent device for the device we're adding
84 * @name: base name of the device we're adding
85 * @id: instance id
86 * @data: platform specific data for this platform device
87 * @size: size of platform specific data
88 *
89 * This function creates a simple platform device that requires minimal
90 * resource and memory management. Canned release function freeing memory
91 * allocated for the device allows drivers using such devices to be
92 * unloaded without waiting for the last reference to the device to be
93 * dropped.
94 *
95 * Returns &struct platform_device pointer on success, or ERR_PTR() on error.
96 */
97static inline struct platform_device *platform_device_register_data(
98 struct device *parent, const char *name, int id,
99 const void *data, size_t size)
100{
101 return platform_device_register_resndata(parent, name, id,
102 NULL, 0, data, size);
103}
50 104
51extern struct platform_device *platform_device_alloc(const char *name, int id); 105extern struct platform_device *platform_device_alloc(const char *name, int id);
52extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 106extern int platform_device_add_resources(struct platform_device *pdev,
107 const struct resource *res,
108 unsigned int num);
53extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 109extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size);
54extern int platform_device_add(struct platform_device *pdev); 110extern int platform_device_add(struct platform_device *pdev);
55extern void platform_device_del(struct platform_device *pdev); 111extern void platform_device_del(struct platform_device *pdev);
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 6898985e7b38..7254eda078e5 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -260,6 +260,23 @@ static inline int plist_node_empty(const struct plist_node *node)
260#endif 260#endif
261 261
262/** 262/**
263 * plist_last_entry - get the struct for the last entry
264 * @head: the &struct plist_head pointer
265 * @type: the type of the struct this is embedded in
266 * @member: the name of the list_struct within the struct
267 */
268#ifdef CONFIG_DEBUG_PI_LIST
269# define plist_last_entry(head, type, member) \
270({ \
271 WARN_ON(plist_head_empty(head)); \
272 container_of(plist_last(head), type, member); \
273})
274#else
275# define plist_last_entry(head, type, member) \
276 container_of(plist_last(head), type, member)
277#endif
278
279/**
263 * plist_first - return the first node (and thus, highest priority) 280 * plist_first - return the first node (and thus, highest priority)
264 * @head: the &struct plist_head pointer 281 * @head: the &struct plist_head pointer
265 * 282 *
@@ -271,4 +288,16 @@ static inline struct plist_node *plist_first(const struct plist_head *head)
271 struct plist_node, plist.node_list); 288 struct plist_node, plist.node_list);
272} 289}
273 290
291/**
292 * plist_last - return the last node (and thus, lowest priority)
293 * @head: the &struct plist_head pointer
294 *
295 * Assumes the plist is _not_ empty.
296 */
297static inline struct plist_node *plist_last(const struct plist_head *head)
298{
299 return list_entry(head->node_list.prev,
300 struct plist_node, plist.node_list);
301}
302
274#endif 303#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8e258c727971..52e8c55ff314 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -457,6 +457,7 @@ struct dev_pm_info {
457#ifdef CONFIG_PM_SLEEP 457#ifdef CONFIG_PM_SLEEP
458 struct list_head entry; 458 struct list_head entry;
459 struct completion completion; 459 struct completion completion;
460 unsigned long wakeup_count;
460#endif 461#endif
461#ifdef CONFIG_PM_RUNTIME 462#ifdef CONFIG_PM_RUNTIME
462 struct timer_list suspend_timer; 463 struct timer_list suspend_timer;
@@ -476,9 +477,15 @@ struct dev_pm_info {
476 enum rpm_request request; 477 enum rpm_request request;
477 enum rpm_status runtime_status; 478 enum rpm_status runtime_status;
478 int runtime_error; 479 int runtime_error;
480 unsigned long active_jiffies;
481 unsigned long suspended_jiffies;
482 unsigned long accounting_timestamp;
479#endif 483#endif
480}; 484};
481 485
486extern void update_pm_runtime_accounting(struct device *dev);
487
488
482/* 489/*
483 * The PM_EVENT_ messages are also used by drivers implementing the legacy 490 * The PM_EVENT_ messages are also used by drivers implementing the legacy
484 * suspend framework, based on the ->suspend() and ->resume() callbacks common 491 * suspend framework, based on the ->suspend() and ->resume() callbacks common
@@ -552,6 +559,11 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
552 } while (0) 559 } while (0)
553 560
554extern void device_pm_wait_for_dev(struct device *sub, struct device *dev); 561extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
562
563/* drivers/base/power/wakeup.c */
564extern void pm_wakeup_event(struct device *dev, unsigned int msec);
565extern void pm_stay_awake(struct device *dev);
566extern void pm_relax(void);
555#else /* !CONFIG_PM_SLEEP */ 567#else /* !CONFIG_PM_SLEEP */
556 568
557#define device_pm_lock() do {} while (0) 569#define device_pm_lock() do {} while (0)
@@ -565,6 +577,10 @@ static inline int dpm_suspend_start(pm_message_t state)
565#define suspend_report_result(fn, ret) do {} while (0) 577#define suspend_report_result(fn, ret) do {} while (0)
566 578
567static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {} 579static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
580
581static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
582static inline void pm_stay_awake(struct device *dev) {}
583static inline void pm_relax(void) {}
568#endif /* !CONFIG_PM_SLEEP */ 584#endif /* !CONFIG_PM_SLEEP */
569 585
570/* How to reorder dpm_list after device_move() */ 586/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index d74f75ed1e47..77cbddb3784c 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -1,8 +1,10 @@
1#ifndef _LINUX_PM_QOS_PARAMS_H
2#define _LINUX_PM_QOS_PARAMS_H
1/* interface for the pm_qos_power infrastructure of the linux kernel. 3/* interface for the pm_qos_power infrastructure of the linux kernel.
2 * 4 *
3 * Mark Gross <mgross@linux.intel.com> 5 * Mark Gross <mgross@linux.intel.com>
4 */ 6 */
5#include <linux/list.h> 7#include <linux/plist.h>
6#include <linux/notifier.h> 8#include <linux/notifier.h>
7#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
8 10
@@ -14,12 +16,19 @@
14#define PM_QOS_NUM_CLASSES 4 16#define PM_QOS_NUM_CLASSES 4
15#define PM_QOS_DEFAULT_VALUE -1 17#define PM_QOS_DEFAULT_VALUE -1
16 18
17int pm_qos_add_requirement(int qos, char *name, s32 value); 19struct pm_qos_request_list {
18int pm_qos_update_requirement(int qos, char *name, s32 new_value); 20 struct plist_node list;
19void pm_qos_remove_requirement(int qos, char *name); 21 int pm_qos_class;
22};
20 23
21int pm_qos_requirement(int qos); 24void pm_qos_add_request(struct pm_qos_request_list *l, int pm_qos_class, s32 value);
25void pm_qos_update_request(struct pm_qos_request_list *pm_qos_req,
26 s32 new_value);
27void pm_qos_remove_request(struct pm_qos_request_list *pm_qos_req);
22 28
23int pm_qos_add_notifier(int qos, struct notifier_block *notifier); 29int pm_qos_request(int pm_qos_class);
24int pm_qos_remove_notifier(int qos, struct notifier_block *notifier); 30int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier);
31int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier);
32int pm_qos_request_active(struct pm_qos_request_list *req);
25 33
34#endif
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index b776db737244..6e81888c6222 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -30,6 +30,9 @@ extern void pm_runtime_enable(struct device *dev);
30extern void __pm_runtime_disable(struct device *dev, bool check_resume); 30extern void __pm_runtime_disable(struct device *dev, bool check_resume);
31extern void pm_runtime_allow(struct device *dev); 31extern void pm_runtime_allow(struct device *dev);
32extern void pm_runtime_forbid(struct device *dev); 32extern void pm_runtime_forbid(struct device *dev);
33extern int pm_generic_runtime_idle(struct device *dev);
34extern int pm_generic_runtime_suspend(struct device *dev);
35extern int pm_generic_runtime_resume(struct device *dev);
33 36
34static inline bool pm_children_suspended(struct device *dev) 37static inline bool pm_children_suspended(struct device *dev)
35{ 38{
@@ -96,6 +99,10 @@ static inline bool device_run_wake(struct device *dev) { return false; }
96static inline void device_set_run_wake(struct device *dev, bool enable) {} 99static inline void device_set_run_wake(struct device *dev, bool enable) {}
97static inline bool pm_runtime_suspended(struct device *dev) { return false; } 100static inline bool pm_runtime_suspended(struct device *dev) { return false; }
98 101
102static inline int pm_generic_runtime_idle(struct device *dev) { return 0; }
103static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
104static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
105
99#endif /* !CONFIG_PM_RUNTIME */ 106#endif /* !CONFIG_PM_RUNTIME */
100 107
101static inline int pm_runtime_get(struct device *dev) 108static inline int pm_runtime_get(struct device *dev)
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 0aae7776185e..76aca48722ae 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -25,53 +25,67 @@
25# error "please don't include this file directly" 25# error "please don't include this file directly"
26#endif 26#endif
27 27
28#include <linux/types.h>
29
28#ifdef CONFIG_PM 30#ifdef CONFIG_PM
29 31
30/* changes to device_may_wakeup take effect on the next pm state change. 32/* Changes to device_may_wakeup take effect on the next pm state change.
31 * by default, devices should wakeup if they can. 33 *
34 * By default, most devices should leave wakeup disabled. The exceptions
35 * are devices that everyone expects to be wakeup sources: keyboards,
36 * power buttons, possibly network interfaces, etc.
32 */ 37 */
33static inline void device_init_wakeup(struct device *dev, int val) 38static inline void device_init_wakeup(struct device *dev, bool val)
34{ 39{
35 dev->power.can_wakeup = dev->power.should_wakeup = !!val; 40 dev->power.can_wakeup = dev->power.should_wakeup = val;
36} 41}
37 42
38static inline void device_set_wakeup_capable(struct device *dev, int val) 43static inline void device_set_wakeup_capable(struct device *dev, bool capable)
39{ 44{
40 dev->power.can_wakeup = !!val; 45 dev->power.can_wakeup = capable;
41} 46}
42 47
43static inline int device_can_wakeup(struct device *dev) 48static inline bool device_can_wakeup(struct device *dev)
44{ 49{
45 return dev->power.can_wakeup; 50 return dev->power.can_wakeup;
46} 51}
47 52
48static inline void device_set_wakeup_enable(struct device *dev, int val) 53static inline void device_set_wakeup_enable(struct device *dev, bool enable)
49{ 54{
50 dev->power.should_wakeup = !!val; 55 dev->power.should_wakeup = enable;
51} 56}
52 57
53static inline int device_may_wakeup(struct device *dev) 58static inline bool device_may_wakeup(struct device *dev)
54{ 59{
55 return dev->power.can_wakeup && dev->power.should_wakeup; 60 return dev->power.can_wakeup && dev->power.should_wakeup;
56} 61}
57 62
58#else /* !CONFIG_PM */ 63#else /* !CONFIG_PM */
59 64
60/* For some reason the next two routines work even without CONFIG_PM */ 65/* For some reason the following routines work even without CONFIG_PM */
61static inline void device_init_wakeup(struct device *dev, int val) 66static inline void device_init_wakeup(struct device *dev, bool val)
62{ 67{
63 dev->power.can_wakeup = !!val; 68 dev->power.can_wakeup = val;
64} 69}
65 70
66static inline void device_set_wakeup_capable(struct device *dev, int val) { } 71static inline void device_set_wakeup_capable(struct device *dev, bool capable)
72{
73 dev->power.can_wakeup = capable;
74}
67 75
68static inline int device_can_wakeup(struct device *dev) 76static inline bool device_can_wakeup(struct device *dev)
69{ 77{
70 return dev->power.can_wakeup; 78 return dev->power.can_wakeup;
71} 79}
72 80
73#define device_set_wakeup_enable(dev, val) do {} while (0) 81static inline void device_set_wakeup_enable(struct device *dev, bool enable)
74#define device_may_wakeup(dev) 0 82{
83}
84
85static inline bool device_may_wakeup(struct device *dev)
86{
87 return false;
88}
75 89
76#endif /* !CONFIG_PM */ 90#endif /* !CONFIG_PM */
77 91
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 7c4193eb0072..1bc1338b817b 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -414,6 +414,7 @@ struct pnp_protocol {
414 int (*disable) (struct pnp_dev *dev); 414 int (*disable) (struct pnp_dev *dev);
415 415
416 /* protocol specific suspend/resume */ 416 /* protocol specific suspend/resume */
417 bool (*can_wakeup) (struct pnp_dev *dev);
417 int (*suspend) (struct pnp_dev * dev, pm_message_t state); 418 int (*suspend) (struct pnp_dev * dev, pm_message_t state);
418 int (*resume) (struct pnp_dev * dev); 419 int (*resume) (struct pnp_dev * dev);
419 420
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 4f71bf4e628c..3e23844a6990 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -117,6 +117,6 @@ void set_process_cpu_timer(struct task_struct *task, unsigned int clock_idx,
117 117
118long clock_nanosleep_restart(struct restart_block *restart_block); 118long clock_nanosleep_restart(struct restart_block *restart_block);
119 119
120void update_rlimit_cpu(unsigned long rlim_new); 120void update_rlimit_cpu(struct task_struct *task, unsigned long rlim_new);
121 121
122#endif 122#endif
diff --git a/include/linux/power/jz4740-battery.h b/include/linux/power/jz4740-battery.h
new file mode 100644
index 000000000000..19c9610c720a
--- /dev/null
+++ b/include/linux/power/jz4740-battery.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2009, Jiejing Zhang <kzjeef@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __JZ4740_BATTERY_H
16#define __JZ4740_BATTERY_H
17
18struct jz_battery_platform_data {
19 struct power_supply_info info;
20 int gpio_charge; /* GPIO port of Charger state */
21 int gpio_charge_active_low;
22};
23
24#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ebd2b8fb00d0..30083a896f36 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -114,6 +114,7 @@ enum power_supply_property {
114 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, 114 POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
115 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, 115 POWER_SUPPLY_PROP_TIME_TO_FULL_NOW,
116 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, 116 POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,
117 POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */
117 /* Properties of type `const char *' */ 118 /* Properties of type `const char *' */
118 POWER_SUPPLY_PROP_MODEL_NAME, 119 POWER_SUPPLY_PROP_MODEL_NAME,
119 POWER_SUPPLY_PROP_MANUFACTURER, 120 POWER_SUPPLY_PROP_MANUFACTURER,
@@ -144,6 +145,11 @@ struct power_supply {
144 int (*get_property)(struct power_supply *psy, 145 int (*get_property)(struct power_supply *psy,
145 enum power_supply_property psp, 146 enum power_supply_property psp,
146 union power_supply_propval *val); 147 union power_supply_propval *val);
148 int (*set_property)(struct power_supply *psy,
149 enum power_supply_property psp,
150 const union power_supply_propval *val);
151 int (*property_is_writeable)(struct power_supply *psy,
152 enum power_supply_property psp);
147 void (*external_power_changed)(struct power_supply *psy); 153 void (*external_power_changed)(struct power_supply *psy);
148 void (*set_charged)(struct power_supply *psy); 154 void (*set_charged)(struct power_supply *psy);
149 155
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
index 0d3fa63e90ea..5d87f810a3b7 100644
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -36,7 +36,7 @@ struct ppp_channel_ops {
36 36
37struct ppp_channel { 37struct ppp_channel {
38 void *private; /* channel private data */ 38 void *private; /* channel private data */
39 struct ppp_channel_ops *ops; /* operations for this channel */ 39 const struct ppp_channel_ops *ops; /* operations for this channel */
40 int mtu; /* max transmit packet size */ 40 int mtu; /* max transmit packet size */
41 int hdrlen; /* amount of headroom channel needs */ 41 int hdrlen; /* amount of headroom channel needs */
42 void *ppp; /* opaque to channel */ 42 void *ppp; /* opaque to channel */
@@ -72,6 +72,9 @@ extern int ppp_channel_index(struct ppp_channel *);
72/* Get the unit number associated with a channel, or -1 if none */ 72/* Get the unit number associated with a channel, or -1 if none */
73extern int ppp_unit_number(struct ppp_channel *); 73extern int ppp_unit_number(struct ppp_channel *);
74 74
75/* Get the device name associated with a channel, or NULL if none */
76extern char *ppp_dev_name(struct ppp_channel *);
77
75/* 78/*
76 * SMP locking notes: 79 * SMP locking notes:
77 * The channel code must ensure that when it calls ppp_unregister_channel, 80 * The channel code must ensure that when it calls ppp_unregister_channel,
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
new file mode 100644
index 000000000000..943a85ab0020
--- /dev/null
+++ b/include/linux/ptp_classify.h
@@ -0,0 +1,126 @@
1/*
2 * PTP 1588 support
3 *
4 * This file implements a BPF that recognizes PTP event messages.
5 *
6 * Copyright (C) 2010 OMICRON electronics GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_
25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/filter.h>
29#ifdef __KERNEL__
30#include <linux/in.h>
31#else
32#include <netinet/in.h>
33#endif
34
35#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
36#define PTP_CLASS_V1 0x01 /* protocol version 1 */
37#define PTP_CLASS_V2 0x02 /* protocol version 2 */
38#define PTP_CLASS_VMASK 0x0f /* max protocol version is 15 */
39#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */
40#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */
41#define PTP_CLASS_L2 0x30 /* event in a L2 packet */
42#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */
43#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
44
45#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
46#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/
47#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
48#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
49#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
50#define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN)
51
52#define PTP_EV_PORT 319
53
54#define OFF_ETYPE 12
55#define OFF_IHL 14
56#define OFF_FRAG 20
57#define OFF_PROTO4 23
58#define OFF_NEXT 6
59#define OFF_UDP_DST 2
60
61#define IP6_HLEN 40
62#define UDP_HLEN 8
63
64#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
65#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
66#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
67
68#define OP_AND (BPF_ALU | BPF_AND | BPF_K)
69#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K)
70#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K)
71#define OP_LDB (BPF_LD | BPF_B | BPF_ABS)
72#define OP_LDH (BPF_LD | BPF_H | BPF_ABS)
73#define OP_LDHI (BPF_LD | BPF_H | BPF_IND)
74#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH)
75#define OP_OR (BPF_ALU | BPF_OR | BPF_K)
76#define OP_RETA (BPF_RET | BPF_A)
77#define OP_RETK (BPF_RET | BPF_K)
78
79static inline int ptp_filter_init(struct sock_filter *f, int len)
80{
81 if (OP_LDH == f[0].code)
82 return sk_chk_filter(f, len);
83 else
84 return 0;
85}
86
87#define PTP_FILTER \
88 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
89 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
90 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
91 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
92 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
93 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
94 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
95 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
96 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
97 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
98 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
99 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
100 {OP_RETA, 0, 0, 0 }, /* */ \
101/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
102/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
103 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
104 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
105 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
106 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
107 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
108 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
109 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
110 {OP_RETA, 0, 0, 0 }, /* */ \
111/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
112/*L40*/ {OP_JEQ, 0, 6, ETH_P_8021Q }, /* f goto L50 */ \
113 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
114 {OP_JEQ, 0, 9, ETH_P_1588 }, /* f goto L60 */ \
115 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L50*/ {OP_JEQ, 0, 4, ETH_P_1588 }, /* f goto L61 */ \
120 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
121 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
122 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
123 {OP_RETA, 0, 0, 0 }, /* */ \
124/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
125
126#endif
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index e1fb60729979..4272521e29e9 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -345,18 +345,6 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
345#define arch_ptrace_stop(code, info) do { } while (0) 345#define arch_ptrace_stop(code, info) do { } while (0)
346#endif 346#endif
347 347
348#ifndef arch_ptrace_untrace
349/*
350 * Do machine-specific work before untracing child.
351 *
352 * This is called for a normal detach as well as from ptrace_exit()
353 * when the tracing task dies.
354 *
355 * Called with write_lock(&tasklist_lock) held.
356 */
357#define arch_ptrace_untrace(task) do { } while (0)
358#endif
359
360extern int task_current_syscall(struct task_struct *target, long *callno, 348extern int task_current_syscall(struct task_struct *target, long *callno,
361 unsigned long args[6], unsigned int maxargs, 349 unsigned long args[6], unsigned int maxargs,
362 unsigned long *sp, unsigned long *pc); 350 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index b462916b2a0a..94c1f03b50eb 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -174,6 +174,7 @@ enum {
174#include <linux/rwsem.h> 174#include <linux/rwsem.h>
175#include <linux/spinlock.h> 175#include <linux/spinlock.h>
176#include <linux/wait.h> 176#include <linux/wait.h>
177#include <linux/percpu_counter.h>
177 178
178#include <linux/dqblk_xfs.h> 179#include <linux/dqblk_xfs.h>
179#include <linux/dqblk_v1.h> 180#include <linux/dqblk_v1.h>
@@ -238,19 +239,36 @@ static inline int info_dirty(struct mem_dqinfo *info)
238 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags); 239 return test_bit(DQF_INFO_DIRTY_B, &info->dqi_flags);
239} 240}
240 241
242enum {
243 DQST_LOOKUPS,
244 DQST_DROPS,
245 DQST_READS,
246 DQST_WRITES,
247 DQST_CACHE_HITS,
248 DQST_ALLOC_DQUOTS,
249 DQST_FREE_DQUOTS,
250 DQST_SYNCS,
251 _DQST_DQSTAT_LAST
252};
253
241struct dqstats { 254struct dqstats {
242 int lookups; 255 int stat[_DQST_DQSTAT_LAST];
243 int drops; 256 struct percpu_counter counter[_DQST_DQSTAT_LAST];
244 int reads;
245 int writes;
246 int cache_hits;
247 int allocated_dquots;
248 int free_dquots;
249 int syncs;
250}; 257};
251 258
259extern struct dqstats *dqstats_pcpu;
252extern struct dqstats dqstats; 260extern struct dqstats dqstats;
253 261
262static inline void dqstats_inc(unsigned int type)
263{
264 percpu_counter_inc(&dqstats.counter[type]);
265}
266
267static inline void dqstats_dec(unsigned int type)
268{
269 percpu_counter_dec(&dqstats.counter[type]);
270}
271
254#define DQ_MOD_B 0 /* dquot modified since read */ 272#define DQ_MOD_B 0 /* dquot modified since read */
255#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */ 273#define DQ_BLKS_B 1 /* uid/gid has been warned about blk limit */
256#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */ 274#define DQ_INODES_B 2 /* uid/gid has been warned about inode limit */
@@ -306,17 +324,15 @@ struct dquot_operations {
306 324
307/* Operations handling requests from userspace */ 325/* Operations handling requests from userspace */
308struct quotactl_ops { 326struct quotactl_ops {
309 int (*quota_on)(struct super_block *, int, int, char *, int); 327 int (*quota_on)(struct super_block *, int, int, char *);
310 int (*quota_off)(struct super_block *, int, int); 328 int (*quota_off)(struct super_block *, int);
311 int (*quota_sync)(struct super_block *, int, int); 329 int (*quota_sync)(struct super_block *, int, int);
312 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 330 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
313 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 331 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
314 int (*get_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 332 int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
315 int (*set_dqblk)(struct super_block *, int, qid_t, struct if_dqblk *); 333 int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *);
316 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 334 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
317 int (*set_xstate)(struct super_block *, unsigned int, int); 335 int (*set_xstate)(struct super_block *, unsigned int, int);
318 int (*get_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
319 int (*set_xquota)(struct super_block *, int, qid_t, struct fs_disk_quota *);
320}; 336};
321 337
322struct quota_format_type { 338struct quota_format_type {
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index e6fa7acce290..d50ba858cfe0 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -9,13 +9,31 @@
9 9
10#include <linux/fs.h> 10#include <linux/fs.h>
11 11
12#define DQUOT_SPACE_WARN 0x1
13#define DQUOT_SPACE_RESERVE 0x2
14#define DQUOT_SPACE_NOFAIL 0x4
15
12static inline struct quota_info *sb_dqopt(struct super_block *sb) 16static inline struct quota_info *sb_dqopt(struct super_block *sb)
13{ 17{
14 return &sb->s_dquot; 18 return &sb->s_dquot;
15} 19}
16 20
21/* i_mutex must being held */
22static inline bool is_quota_modification(struct inode *inode, struct iattr *ia)
23{
24 return (ia->ia_valid & ATTR_SIZE && ia->ia_size != inode->i_size) ||
25 (ia->ia_valid & ATTR_UID && ia->ia_uid != inode->i_uid) ||
26 (ia->ia_valid & ATTR_GID && ia->ia_gid != inode->i_gid);
27}
28
17#if defined(CONFIG_QUOTA) 29#if defined(CONFIG_QUOTA)
18 30
31#define quota_error(sb, fmt, args...) \
32 __quota_error((sb), __func__, fmt , ## args)
33
34extern void __quota_error(struct super_block *sb, const char *func,
35 const char *fmt, ...);
36
19/* 37/*
20 * declaration of quota_function calls in kernel. 38 * declaration of quota_function calls in kernel.
21 */ 39 */
@@ -33,15 +51,22 @@ int dquot_scan_active(struct super_block *sb,
33struct dquot *dquot_alloc(struct super_block *sb, int type); 51struct dquot *dquot_alloc(struct super_block *sb, int type);
34void dquot_destroy(struct dquot *dquot); 52void dquot_destroy(struct dquot *dquot);
35 53
36int __dquot_alloc_space(struct inode *inode, qsize_t number, 54int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags);
37 int warn, int reserve); 55void __dquot_free_space(struct inode *inode, qsize_t number, int flags);
38void __dquot_free_space(struct inode *inode, qsize_t number, int reserve);
39 56
40int dquot_alloc_inode(const struct inode *inode); 57int dquot_alloc_inode(const struct inode *inode);
41 58
42int dquot_claim_space_nodirty(struct inode *inode, qsize_t number); 59int dquot_claim_space_nodirty(struct inode *inode, qsize_t number);
43void dquot_free_inode(const struct inode *inode); 60void dquot_free_inode(const struct inode *inode);
44 61
62int dquot_disable(struct super_block *sb, int type, unsigned int flags);
63/* Suspend quotas on remount RO */
64static inline int dquot_suspend(struct super_block *sb, int type)
65{
66 return dquot_disable(sb, type, DQUOT_SUSPENDED);
67}
68int dquot_resume(struct super_block *sb, int type);
69
45int dquot_commit(struct dquot *dquot); 70int dquot_commit(struct dquot *dquot);
46int dquot_acquire(struct dquot *dquot); 71int dquot_acquire(struct dquot *dquot);
47int dquot_release(struct dquot *dquot); 72int dquot_release(struct dquot *dquot);
@@ -50,24 +75,25 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
50 75
51int dquot_file_open(struct inode *inode, struct file *file); 76int dquot_file_open(struct inode *inode, struct file *file);
52 77
53int vfs_quota_on(struct super_block *sb, int type, int format_id, 78int dquot_quota_on(struct super_block *sb, int type, int format_id,
54 char *path, int remount); 79 char *path);
55int vfs_quota_enable(struct inode *inode, int type, int format_id, 80int dquot_enable(struct inode *inode, int type, int format_id,
56 unsigned int flags); 81 unsigned int flags);
57int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 82int dquot_quota_on_path(struct super_block *sb, int type, int format_id,
58 struct path *path); 83 struct path *path);
59int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 84int dquot_quota_on_mount(struct super_block *sb, char *qf_name,
60 int format_id, int type); 85 int format_id, int type);
61int vfs_quota_off(struct super_block *sb, int type, int remount); 86int dquot_quota_off(struct super_block *sb, int type);
62int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags); 87int dquot_quota_sync(struct super_block *sb, int type, int wait);
63int vfs_quota_sync(struct super_block *sb, int type, int wait); 88int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
64int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 89int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
65int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 90int dquot_get_dqblk(struct super_block *sb, int type, qid_t id,
66int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 91 struct fs_disk_quota *di);
67int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *di); 92int dquot_set_dqblk(struct super_block *sb, int type, qid_t id,
68 93 struct fs_disk_quota *di);
94
95int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
69int dquot_transfer(struct inode *inode, struct iattr *iattr); 96int dquot_transfer(struct inode *inode, struct iattr *iattr);
70int vfs_dq_quota_on_remount(struct super_block *sb);
71 97
72static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) 98static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
73{ 99{
@@ -125,29 +151,11 @@ static inline bool sb_has_quota_active(struct super_block *sb, int type)
125 !sb_has_quota_suspended(sb, type); 151 !sb_has_quota_suspended(sb, type);
126} 152}
127 153
128static inline unsigned sb_any_quota_active(struct super_block *sb)
129{
130 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb);
131}
132
133/* 154/*
134 * Operations supported for diskquotas. 155 * Operations supported for diskquotas.
135 */ 156 */
136extern const struct dquot_operations dquot_operations; 157extern const struct dquot_operations dquot_operations;
137extern const struct quotactl_ops vfs_quotactl_ops; 158extern const struct quotactl_ops dquot_quotactl_ops;
138
139#define sb_dquot_ops (&dquot_operations)
140#define sb_quotactl_ops (&vfs_quotactl_ops)
141
142/* Cannot be called inside a transaction */
143static inline int vfs_dq_off(struct super_block *sb, int remount)
144{
145 int ret = -ENOSYS;
146
147 if (sb->s_qcop && sb->s_qcop->quota_off)
148 ret = sb->s_qcop->quota_off(sb, -1, remount);
149 return ret;
150}
151 159
152#else 160#else
153 161
@@ -187,17 +195,6 @@ static inline int sb_has_quota_active(struct super_block *sb, int type)
187 return 0; 195 return 0;
188} 196}
189 197
190static inline int sb_any_quota_active(struct super_block *sb)
191{
192 return 0;
193}
194
195/*
196 * NO-OP when quota not configured.
197 */
198#define sb_dquot_ops (NULL)
199#define sb_quotactl_ops (NULL)
200
201static inline void dquot_initialize(struct inode *inode) 198static inline void dquot_initialize(struct inode *inode)
202{ 199{
203} 200}
@@ -215,39 +212,45 @@ static inline void dquot_free_inode(const struct inode *inode)
215{ 212{
216} 213}
217 214
218static inline int vfs_dq_off(struct super_block *sb, int remount) 215static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
219{ 216{
220 return 0; 217 return 0;
221} 218}
222 219
223static inline int vfs_dq_quota_on_remount(struct super_block *sb) 220static inline int __dquot_alloc_space(struct inode *inode, qsize_t number,
221 int flags)
224{ 222{
223 if (!(flags & DQUOT_SPACE_RESERVE))
224 inode_add_bytes(inode, number);
225 return 0; 225 return 0;
226} 226}
227 227
228static inline int dquot_transfer(struct inode *inode, struct iattr *iattr) 228static inline void __dquot_free_space(struct inode *inode, qsize_t number,
229 int flags)
229{ 230{
231 if (!(flags & DQUOT_SPACE_RESERVE))
232 inode_sub_bytes(inode, number);
233}
234
235static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
236{
237 inode_add_bytes(inode, number);
230 return 0; 238 return 0;
231} 239}
232 240
233static inline int __dquot_alloc_space(struct inode *inode, qsize_t number, 241static inline int dquot_disable(struct super_block *sb, int type,
234 int warn, int reserve) 242 unsigned int flags)
235{ 243{
236 if (!reserve)
237 inode_add_bytes(inode, number);
238 return 0; 244 return 0;
239} 245}
240 246
241static inline void __dquot_free_space(struct inode *inode, qsize_t number, 247static inline int dquot_suspend(struct super_block *sb, int type)
242 int reserve)
243{ 248{
244 if (!reserve) 249 return 0;
245 inode_sub_bytes(inode, number);
246} 250}
247 251
248static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) 252static inline int dquot_resume(struct super_block *sb, int type)
249{ 253{
250 inode_add_bytes(inode, number);
251 return 0; 254 return 0;
252} 255}
253 256
@@ -257,7 +260,13 @@ static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
257 260
258static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr) 261static inline int dquot_alloc_space_nodirty(struct inode *inode, qsize_t nr)
259{ 262{
260 return __dquot_alloc_space(inode, nr, 1, 0); 263 return __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN);
264}
265
266static inline void dquot_alloc_space_nofail(struct inode *inode, qsize_t nr)
267{
268 __dquot_alloc_space(inode, nr, DQUOT_SPACE_WARN|DQUOT_SPACE_NOFAIL);
269 mark_inode_dirty_sync(inode);
261} 270}
262 271
263static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) 272static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
@@ -266,7 +275,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
266 275
267 ret = dquot_alloc_space_nodirty(inode, nr); 276 ret = dquot_alloc_space_nodirty(inode, nr);
268 if (!ret) 277 if (!ret)
269 mark_inode_dirty(inode); 278 mark_inode_dirty_sync(inode);
270 return ret; 279 return ret;
271} 280}
272 281
@@ -275,6 +284,11 @@ static inline int dquot_alloc_block_nodirty(struct inode *inode, qsize_t nr)
275 return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits); 284 return dquot_alloc_space_nodirty(inode, nr << inode->i_blkbits);
276} 285}
277 286
287static inline void dquot_alloc_block_nofail(struct inode *inode, qsize_t nr)
288{
289 dquot_alloc_space_nofail(inode, nr << inode->i_blkbits);
290}
291
278static inline int dquot_alloc_block(struct inode *inode, qsize_t nr) 292static inline int dquot_alloc_block(struct inode *inode, qsize_t nr)
279{ 293{
280 return dquot_alloc_space(inode, nr << inode->i_blkbits); 294 return dquot_alloc_space(inode, nr << inode->i_blkbits);
@@ -282,7 +296,7 @@ static inline int dquot_alloc_block(struct inode *inode, qsize_t nr)
282 296
283static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr) 297static inline int dquot_prealloc_block_nodirty(struct inode *inode, qsize_t nr)
284{ 298{
285 return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0, 0); 299 return __dquot_alloc_space(inode, nr << inode->i_blkbits, 0);
286} 300}
287 301
288static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr) 302static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr)
@@ -291,13 +305,14 @@ static inline int dquot_prealloc_block(struct inode *inode, qsize_t nr)
291 305
292 ret = dquot_prealloc_block_nodirty(inode, nr); 306 ret = dquot_prealloc_block_nodirty(inode, nr);
293 if (!ret) 307 if (!ret)
294 mark_inode_dirty(inode); 308 mark_inode_dirty_sync(inode);
295 return ret; 309 return ret;
296} 310}
297 311
298static inline int dquot_reserve_block(struct inode *inode, qsize_t nr) 312static inline int dquot_reserve_block(struct inode *inode, qsize_t nr)
299{ 313{
300 return __dquot_alloc_space(inode, nr << inode->i_blkbits, 1, 1); 314 return __dquot_alloc_space(inode, nr << inode->i_blkbits,
315 DQUOT_SPACE_WARN|DQUOT_SPACE_RESERVE);
301} 316}
302 317
303static inline int dquot_claim_block(struct inode *inode, qsize_t nr) 318static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
@@ -306,7 +321,7 @@ static inline int dquot_claim_block(struct inode *inode, qsize_t nr)
306 321
307 ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits); 322 ret = dquot_claim_space_nodirty(inode, nr << inode->i_blkbits);
308 if (!ret) 323 if (!ret)
309 mark_inode_dirty(inode); 324 mark_inode_dirty_sync(inode);
310 return ret; 325 return ret;
311} 326}
312 327
@@ -318,7 +333,7 @@ static inline void dquot_free_space_nodirty(struct inode *inode, qsize_t nr)
318static inline void dquot_free_space(struct inode *inode, qsize_t nr) 333static inline void dquot_free_space(struct inode *inode, qsize_t nr)
319{ 334{
320 dquot_free_space_nodirty(inode, nr); 335 dquot_free_space_nodirty(inode, nr);
321 mark_inode_dirty(inode); 336 mark_inode_dirty_sync(inode);
322} 337}
323 338
324static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr) 339static inline void dquot_free_block_nodirty(struct inode *inode, qsize_t nr)
@@ -334,7 +349,7 @@ static inline void dquot_free_block(struct inode *inode, qsize_t nr)
334static inline void dquot_release_reservation_block(struct inode *inode, 349static inline void dquot_release_reservation_block(struct inode *inode,
335 qsize_t nr) 350 qsize_t nr)
336{ 351{
337 __dquot_free_space(inode, nr << inode->i_blkbits, 1); 352 __dquot_free_space(inode, nr << inode->i_blkbits, DQUOT_SPACE_RESERVE);
338} 353}
339 354
340#endif /* _LINUX_QUOTAOPS_ */ 355#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 55ca73cf25e5..634b8e674ac5 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -55,7 +55,7 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
55 55
56/*** radix-tree API starts here ***/ 56/*** radix-tree API starts here ***/
57 57
58#define RADIX_TREE_MAX_TAGS 2 58#define RADIX_TREE_MAX_TAGS 3
59 59
60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */ 60/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
61struct radix_tree_root { 61struct radix_tree_root {
@@ -192,6 +192,10 @@ unsigned int
192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, 192radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
193 unsigned long first_index, unsigned int max_items, 193 unsigned long first_index, unsigned int max_items,
194 unsigned int tag); 194 unsigned int tag);
195unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root,
196 unsigned long *first_indexp, unsigned long last_index,
197 unsigned long nr_to_tag,
198 unsigned int fromtag, unsigned int totag);
195int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 199int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
196 200
197static inline void radix_tree_preload_end(void) 201static inline void radix_tree_preload_end(void)
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 4e768dda87b0..e7320b5e82fb 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_RAMFS_H 1#ifndef _LINUX_RAMFS_H
2#define _LINUX_RAMFS_H 2#define _LINUX_RAMFS_H
3 3
4struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev); 4struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,
5 int mode, dev_t dev);
5extern int ramfs_get_sb(struct file_system_type *fs_type, 6extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 7 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 8
@@ -20,4 +21,6 @@ extern const struct file_operations ramfs_file_operations;
20extern const struct vm_operations_struct generic_file_vm_ops; 21extern const struct vm_operations_struct generic_file_vm_ops;
21extern int __init init_rootfs(void); 22extern int __init init_rootfs(void);
22 23
24int ramfs_fill_super(struct super_block *sb, void *data, int silent);
25
23#endif 26#endif
diff --git a/include/linux/random.h b/include/linux/random.h
index 25d02fe5c9b5..fb7ab9de5f36 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -40,6 +40,10 @@ struct rand_pool_info {
40 __u32 buf[0]; 40 __u32 buf[0];
41}; 41};
42 42
43struct rnd_state {
44 __u32 s1, s2, s3;
45};
46
43/* Exported functions */ 47/* Exported functions */
44 48
45#ifdef __KERNEL__ 49#ifdef __KERNEL__
@@ -74,6 +78,30 @@ unsigned long randomize_range(unsigned long start, unsigned long end, unsigned l
74u32 random32(void); 78u32 random32(void);
75void srandom32(u32 seed); 79void srandom32(u32 seed);
76 80
81u32 prandom32(struct rnd_state *);
82
83/*
84 * Handle minimum values for seeds
85 */
86static inline u32 __seed(u32 x, u32 m)
87{
88 return (x < m) ? x + m : x;
89}
90
91/**
92 * prandom32_seed - set seed for prandom32().
93 * @state: pointer to state structure to receive the seed.
94 * @seed: arbitrary 64-bit value to use as a seed.
95 */
96static inline void prandom32_seed(struct rnd_state *state, u64 seed)
97{
98 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
99
100 state->s1 = __seed(i, 1);
101 state->s2 = __seed(i, 7);
102 state->s3 = __seed(i, 15);
103}
104
77#endif /* __KERNEL___ */ 105#endif /* __KERNEL___ */
78 106
79#endif /* _LINUX_RANDOM_H */ 107#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/rar_register.h b/include/linux/rar_register.h
new file mode 100644
index 000000000000..ffa805780f85
--- /dev/null
+++ b/include/linux/rar_register.h
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2010 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General
6 * Public License as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public
13 * License along with this program; if not, write to the Free
14 * Software Foundation, Inc., 59 Temple Place - Suite 330,
15 * Boston, MA 02111-1307, USA.
16 * The full GNU General Public License is included in this
17 * distribution in the file called COPYING.
18 */
19
20
21#ifndef _RAR_REGISTER_H
22#define _RAR_REGISTER_H
23
24#include <linux/types.h>
25
26/* following are used both in drivers as well as user space apps */
27
28#define RAR_TYPE_VIDEO 0
29#define RAR_TYPE_AUDIO 1
30#define RAR_TYPE_IMAGE 2
31#define RAR_TYPE_DATA 3
32
33#ifdef __KERNEL__
34
35struct rar_device;
36
37int register_rar(int num,
38 int (*callback)(unsigned long data), unsigned long data);
39void unregister_rar(int num);
40int rar_get_address(int rar_index, dma_addr_t *start, dma_addr_t *end);
41int rar_lock(int rar_index);
42
43#endif /* __KERNEL__ */
44#endif /* _RAR_REGISTER_H */
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 668cf1bef030..8f69d09a41a5 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -2,7 +2,7 @@
2#define _LINUX_RATELIMIT_H 2#define _LINUX_RATELIMIT_H
3 3
4#include <linux/param.h> 4#include <linux/param.h>
5#include <linux/spinlock_types.h> 5#include <linux/spinlock.h>
6 6
7#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) 7#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ)
8#define DEFAULT_RATELIMIT_BURST 10 8#define DEFAULT_RATELIMIT_BURST 10
@@ -25,6 +25,17 @@ struct ratelimit_state {
25 .burst = burst_init, \ 25 .burst = burst_init, \
26 } 26 }
27 27
28static inline void ratelimit_state_init(struct ratelimit_state *rs,
29 int interval, int burst)
30{
31 spin_lock_init(&rs->lock);
32 rs->interval = interval;
33 rs->burst = burst;
34 rs->printed = 0;
35 rs->missed = 0;
36 rs->begin = 0;
37}
38
28extern int ___ratelimit(struct ratelimit_state *rs, const char *func); 39extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
29#define __ratelimit(state) ___ratelimit(state, __func__) 40#define __ratelimit(state) ___ratelimit(state, __func__)
30 41
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 5210a5c60877..7066acb2c530 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -139,6 +139,14 @@ static inline void rb_set_color(struct rb_node *rb, int color)
139extern void rb_insert_color(struct rb_node *, struct rb_root *); 139extern void rb_insert_color(struct rb_node *, struct rb_root *);
140extern void rb_erase(struct rb_node *, struct rb_root *); 140extern void rb_erase(struct rb_node *, struct rb_root *);
141 141
142typedef void (*rb_augment_f)(struct rb_node *node, void *data);
143
144extern void rb_augment_insert(struct rb_node *node,
145 rb_augment_f func, void *data);
146extern struct rb_node *rb_augment_erase_begin(struct rb_node *node);
147extern void rb_augment_erase_end(struct rb_node *node,
148 rb_augment_f func, void *data);
149
142/* Find logical next and previous nodes in a tree */ 150/* Find logical next and previous nodes in a tree */
143extern struct rb_node *rb_next(const struct rb_node *); 151extern struct rb_node *rb_next(const struct rb_node *);
144extern struct rb_node *rb_prev(const struct rb_node *); 152extern struct rb_node *rb_prev(const struct rb_node *);
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 2c9b46cff3d7..4ec3b38ce9c5 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -428,5 +428,47 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
428 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \ 428 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
429 pos = rcu_dereference_raw(pos->next)) 429 pos = rcu_dereference_raw(pos->next))
430 430
431/**
432 * hlist_for_each_entry_rcu_bh - iterate over rcu list of given type
433 * @tpos: the type * to use as a loop cursor.
434 * @pos: the &struct hlist_node to use as a loop cursor.
435 * @head: the head for your list.
436 * @member: the name of the hlist_node within the struct.
437 *
438 * This list-traversal primitive may safely run concurrently with
439 * the _rcu list-mutation primitives such as hlist_add_head_rcu()
440 * as long as the traversal is guarded by rcu_read_lock().
441 */
442#define hlist_for_each_entry_rcu_bh(tpos, pos, head, member) \
443 for (pos = rcu_dereference_bh((head)->first); \
444 pos && ({ prefetch(pos->next); 1; }) && \
445 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
446 pos = rcu_dereference_bh(pos->next))
447
448/**
449 * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point
450 * @tpos: the type * to use as a loop cursor.
451 * @pos: the &struct hlist_node to use as a loop cursor.
452 * @member: the name of the hlist_node within the struct.
453 */
454#define hlist_for_each_entry_continue_rcu(tpos, pos, member) \
455 for (pos = rcu_dereference((pos)->next); \
456 pos && ({ prefetch(pos->next); 1; }) && \
457 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
458 pos = rcu_dereference(pos->next))
459
460/**
461 * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
462 * @tpos: the type * to use as a loop cursor.
463 * @pos: the &struct hlist_node to use as a loop cursor.
464 * @member: the name of the hlist_node within the struct.
465 */
466#define hlist_for_each_entry_continue_rcu_bh(tpos, pos, member) \
467 for (pos = rcu_dereference_bh((pos)->next); \
468 pos && ({ prefetch(pos->next); 1; }) && \
469 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \
470 pos = rcu_dereference_bh(pos->next))
471
472
431#endif /* __KERNEL__ */ 473#endif /* __KERNEL__ */
432#endif 474#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index db266bbed23f..9fbc54a2585d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -40,6 +40,7 @@
40#include <linux/seqlock.h> 40#include <linux/seqlock.h>
41#include <linux/lockdep.h> 41#include <linux/lockdep.h>
42#include <linux/completion.h> 42#include <linux/completion.h>
43#include <linux/debugobjects.h>
43 44
44#ifdef CONFIG_RCU_TORTURE_TEST 45#ifdef CONFIG_RCU_TORTURE_TEST
45extern int rcutorture_runnable; /* for sysctl */ 46extern int rcutorture_runnable; /* for sysctl */
@@ -56,8 +57,6 @@ struct rcu_head {
56}; 57};
57 58
58/* Exported common interfaces */ 59/* Exported common interfaces */
59extern void synchronize_rcu_bh(void);
60extern void synchronize_sched(void);
61extern void rcu_barrier(void); 60extern void rcu_barrier(void);
62extern void rcu_barrier_bh(void); 61extern void rcu_barrier_bh(void);
63extern void rcu_barrier_sched(void); 62extern void rcu_barrier_sched(void);
@@ -66,8 +65,6 @@ extern int sched_expedited_torture_stats(char *page);
66 65
67/* Internal to kernel */ 66/* Internal to kernel */
68extern void rcu_init(void); 67extern void rcu_init(void);
69extern int rcu_scheduler_active;
70extern void rcu_scheduler_starting(void);
71 68
72#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 69#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
73#include <linux/rcutree.h> 70#include <linux/rcutree.h>
@@ -83,6 +80,25 @@ extern void rcu_scheduler_starting(void);
83 (ptr)->next = NULL; (ptr)->func = NULL; \ 80 (ptr)->next = NULL; (ptr)->func = NULL; \
84} while (0) 81} while (0)
85 82
83/*
84 * init_rcu_head_on_stack()/destroy_rcu_head_on_stack() are needed for dynamic
85 * initialization and destruction of rcu_head on the stack. rcu_head structures
86 * allocated dynamically in the heap or defined statically don't need any
87 * initialization.
88 */
89#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
90extern void init_rcu_head_on_stack(struct rcu_head *head);
91extern void destroy_rcu_head_on_stack(struct rcu_head *head);
92#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
93static inline void init_rcu_head_on_stack(struct rcu_head *head)
94{
95}
96
97static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
98{
99}
100#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
101
86#ifdef CONFIG_DEBUG_LOCK_ALLOC 102#ifdef CONFIG_DEBUG_LOCK_ALLOC
87 103
88extern struct lockdep_map rcu_lock_map; 104extern struct lockdep_map rcu_lock_map;
@@ -106,12 +122,13 @@ extern int debug_lockdep_rcu_enabled(void);
106/** 122/**
107 * rcu_read_lock_held - might we be in RCU read-side critical section? 123 * rcu_read_lock_held - might we be in RCU read-side critical section?
108 * 124 *
109 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in 125 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
110 * an RCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, 126 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
111 * this assumes we are in an RCU read-side critical section unless it can 127 * this assumes we are in an RCU read-side critical section unless it can
112 * prove otherwise. 128 * prove otherwise.
113 * 129 *
114 * Check rcu_scheduler_active to prevent false positives during boot. 130 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
131 * and while lockdep is disabled.
115 */ 132 */
116static inline int rcu_read_lock_held(void) 133static inline int rcu_read_lock_held(void)
117{ 134{
@@ -129,13 +146,15 @@ extern int rcu_read_lock_bh_held(void);
129/** 146/**
130 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section? 147 * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
131 * 148 *
132 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in an 149 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an
133 * RCU-sched read-side critical section. In absence of CONFIG_PROVE_LOCKING, 150 * RCU-sched read-side critical section. In absence of
134 * this assumes we are in an RCU-sched read-side critical section unless it 151 * CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side
135 * can prove otherwise. Note that disabling of preemption (including 152 * critical section unless it can prove otherwise. Note that disabling
136 * disabling irqs) counts as an RCU-sched read-side critical section. 153 * of preemption (including disabling irqs) counts as an RCU-sched
154 * read-side critical section.
137 * 155 *
138 * Check rcu_scheduler_active to prevent false positives during boot. 156 * Check debug_lockdep_rcu_enabled() to prevent false positives during boot
157 * and while lockdep is disabled.
139 */ 158 */
140#ifdef CONFIG_PREEMPT 159#ifdef CONFIG_PREEMPT
141static inline int rcu_read_lock_sched_held(void) 160static inline int rcu_read_lock_sched_held(void)
@@ -177,7 +196,7 @@ static inline int rcu_read_lock_bh_held(void)
177#ifdef CONFIG_PREEMPT 196#ifdef CONFIG_PREEMPT
178static inline int rcu_read_lock_sched_held(void) 197static inline int rcu_read_lock_sched_held(void)
179{ 198{
180 return !rcu_scheduler_active || preempt_count() != 0 || irqs_disabled(); 199 return preempt_count() != 0 || irqs_disabled();
181} 200}
182#else /* #ifdef CONFIG_PREEMPT */ 201#else /* #ifdef CONFIG_PREEMPT */
183static inline int rcu_read_lock_sched_held(void) 202static inline int rcu_read_lock_sched_held(void)
@@ -192,6 +211,15 @@ static inline int rcu_read_lock_sched_held(void)
192 211
193extern int rcu_my_thread_group_empty(void); 212extern int rcu_my_thread_group_empty(void);
194 213
214#define __do_rcu_dereference_check(c) \
215 do { \
216 static bool __warned; \
217 if (debug_lockdep_rcu_enabled() && !__warned && !(c)) { \
218 __warned = true; \
219 lockdep_rcu_dereference(__FILE__, __LINE__); \
220 } \
221 } while (0)
222
195/** 223/**
196 * rcu_dereference_check - rcu_dereference with debug checking 224 * rcu_dereference_check - rcu_dereference with debug checking
197 * @p: The pointer to read, prior to dereferencing 225 * @p: The pointer to read, prior to dereferencing
@@ -221,8 +249,7 @@ extern int rcu_my_thread_group_empty(void);
221 */ 249 */
222#define rcu_dereference_check(p, c) \ 250#define rcu_dereference_check(p, c) \
223 ({ \ 251 ({ \
224 if (debug_lockdep_rcu_enabled() && !(c)) \ 252 __do_rcu_dereference_check(c); \
225 lockdep_rcu_dereference(__FILE__, __LINE__); \
226 rcu_dereference_raw(p); \ 253 rcu_dereference_raw(p); \
227 }) 254 })
228 255
@@ -239,8 +266,7 @@ extern int rcu_my_thread_group_empty(void);
239 */ 266 */
240#define rcu_dereference_protected(p, c) \ 267#define rcu_dereference_protected(p, c) \
241 ({ \ 268 ({ \
242 if (debug_lockdep_rcu_enabled() && !(c)) \ 269 __do_rcu_dereference_check(c); \
243 lockdep_rcu_dereference(__FILE__, __LINE__); \
244 (p); \ 270 (p); \
245 }) 271 })
246 272
@@ -503,4 +529,74 @@ extern void call_rcu(struct rcu_head *head,
503extern void call_rcu_bh(struct rcu_head *head, 529extern void call_rcu_bh(struct rcu_head *head,
504 void (*func)(struct rcu_head *head)); 530 void (*func)(struct rcu_head *head));
505 531
532/*
533 * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
534 * by call_rcu() and rcu callback execution, and are therefore not part of the
535 * RCU API. Leaving in rcupdate.h because they are used by all RCU flavors.
536 */
537
538#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
539# define STATE_RCU_HEAD_READY 0
540# define STATE_RCU_HEAD_QUEUED 1
541
542extern struct debug_obj_descr rcuhead_debug_descr;
543
544static inline void debug_rcu_head_queue(struct rcu_head *head)
545{
546 debug_object_activate(head, &rcuhead_debug_descr);
547 debug_object_active_state(head, &rcuhead_debug_descr,
548 STATE_RCU_HEAD_READY,
549 STATE_RCU_HEAD_QUEUED);
550}
551
552static inline void debug_rcu_head_unqueue(struct rcu_head *head)
553{
554 debug_object_active_state(head, &rcuhead_debug_descr,
555 STATE_RCU_HEAD_QUEUED,
556 STATE_RCU_HEAD_READY);
557 debug_object_deactivate(head, &rcuhead_debug_descr);
558}
559#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
560static inline void debug_rcu_head_queue(struct rcu_head *head)
561{
562}
563
564static inline void debug_rcu_head_unqueue(struct rcu_head *head)
565{
566}
567#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
568
569#ifndef CONFIG_PROVE_RCU
570#define __do_rcu_dereference_check(c) do { } while (0)
571#endif /* #ifdef CONFIG_PROVE_RCU */
572
573#define __rcu_dereference_index_check(p, c) \
574 ({ \
575 typeof(p) _________p1 = ACCESS_ONCE(p); \
576 __do_rcu_dereference_check(c); \
577 smp_read_barrier_depends(); \
578 (_________p1); \
579 })
580
581/**
582 * rcu_dereference_index_check() - rcu_dereference for indices with debug checking
583 * @p: The pointer to read, prior to dereferencing
584 * @c: The conditions under which the dereference will take place
585 *
586 * Similar to rcu_dereference_check(), but omits the sparse checking.
587 * This allows rcu_dereference_index_check() to be used on integers,
588 * which can then be used as array indices. Attempting to use
589 * rcu_dereference_check() on an integer will give compiler warnings
590 * because the sparse address-space mechanism relies on dereferencing
591 * the RCU-protected pointer. Dereferencing integers is not something
592 * that even gcc will put up with.
593 *
594 * Note that this function does not implicitly check for RCU read-side
595 * critical sections. If this function gains lots of uses, it might
596 * make sense to provide versions for each flavor of RCU, but it does
597 * not make sense as of early 2010.
598 */
599#define rcu_dereference_index_check(p, c) \
600 __rcu_dereference_index_check((p), (c))
601
506#endif /* __LINUX_RCUPDATE_H */ 602#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index a5195875480a..e2e893144a84 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -29,6 +29,10 @@
29 29
30void rcu_sched_qs(int cpu); 30void rcu_sched_qs(int cpu);
31void rcu_bh_qs(int cpu); 31void rcu_bh_qs(int cpu);
32static inline void rcu_note_context_switch(int cpu)
33{
34 rcu_sched_qs(cpu);
35}
32 36
33#define __rcu_read_lock() preempt_disable() 37#define __rcu_read_lock() preempt_disable()
34#define __rcu_read_unlock() preempt_enable() 38#define __rcu_read_unlock() preempt_enable()
@@ -60,8 +64,6 @@ static inline long rcu_batches_completed_bh(void)
60 return 0; 64 return 0;
61} 65}
62 66
63extern int rcu_expedited_torture_stats(char *page);
64
65static inline void rcu_force_quiescent_state(void) 67static inline void rcu_force_quiescent_state(void)
66{ 68{
67} 69}
@@ -74,7 +76,17 @@ static inline void rcu_sched_force_quiescent_state(void)
74{ 76{
75} 77}
76 78
77#define synchronize_rcu synchronize_sched 79extern void synchronize_sched(void);
80
81static inline void synchronize_rcu(void)
82{
83 synchronize_sched();
84}
85
86static inline void synchronize_rcu_bh(void)
87{
88 synchronize_sched();
89}
78 90
79static inline void synchronize_rcu_expedited(void) 91static inline void synchronize_rcu_expedited(void)
80{ 92{
@@ -114,4 +126,17 @@ static inline int rcu_preempt_depth(void)
114 return 0; 126 return 0;
115} 127}
116 128
129#ifdef CONFIG_DEBUG_LOCK_ALLOC
130
131extern int rcu_scheduler_active __read_mostly;
132extern void rcu_scheduler_starting(void);
133
134#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
135
136static inline void rcu_scheduler_starting(void)
137{
138}
139
140#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
141
117#endif /* __LINUX_RCUTINY_H */ 142#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 42cc3a04779e..c0ed1c056f29 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -34,8 +34,8 @@ struct notifier_block;
34 34
35extern void rcu_sched_qs(int cpu); 35extern void rcu_sched_qs(int cpu);
36extern void rcu_bh_qs(int cpu); 36extern void rcu_bh_qs(int cpu);
37extern void rcu_note_context_switch(int cpu);
37extern int rcu_needs_cpu(int cpu); 38extern int rcu_needs_cpu(int cpu);
38extern int rcu_expedited_torture_stats(char *page);
39 39
40#ifdef CONFIG_TREE_PREEMPT_RCU 40#ifdef CONFIG_TREE_PREEMPT_RCU
41 41
@@ -86,6 +86,8 @@ static inline void __rcu_read_unlock_bh(void)
86 86
87extern void call_rcu_sched(struct rcu_head *head, 87extern void call_rcu_sched(struct rcu_head *head,
88 void (*func)(struct rcu_head *rcu)); 88 void (*func)(struct rcu_head *rcu));
89extern void synchronize_rcu_bh(void);
90extern void synchronize_sched(void);
89extern void synchronize_rcu_expedited(void); 91extern void synchronize_rcu_expedited(void);
90 92
91static inline void synchronize_rcu_bh_expedited(void) 93static inline void synchronize_rcu_bh_expedited(void)
@@ -120,4 +122,7 @@ static inline int rcu_blocking_is_gp(void)
120 return num_online_cpus() == 1; 122 return num_online_cpus() == 1;
121} 123}
122 124
125extern void rcu_scheduler_starting(void);
126extern int rcu_scheduler_active __read_mostly;
127
123#endif /* __LINUX_RCUTREE_H */ 128#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/rds.h b/include/linux/rds.h
index cab4994c2f63..24bce3ded9ea 100644
--- a/include/linux/rds.h
+++ b/include/linux/rds.h
@@ -100,7 +100,7 @@
100struct rds_info_counter { 100struct rds_info_counter {
101 u_int8_t name[32]; 101 u_int8_t name[32];
102 u_int64_t value; 102 u_int64_t value;
103} __attribute__((packed)); 103} __packed;
104 104
105#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01 105#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
106#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02 106#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
@@ -115,7 +115,7 @@ struct rds_info_connection {
115 __be32 faddr; 115 __be32 faddr;
116 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */ 116 u_int8_t transport[TRANSNAMSIZ]; /* null term ascii */
117 u_int8_t flags; 117 u_int8_t flags;
118} __attribute__((packed)); 118} __packed;
119 119
120struct rds_info_flow { 120struct rds_info_flow {
121 __be32 laddr; 121 __be32 laddr;
@@ -123,7 +123,7 @@ struct rds_info_flow {
123 u_int32_t bytes; 123 u_int32_t bytes;
124 __be16 lport; 124 __be16 lport;
125 __be16 fport; 125 __be16 fport;
126} __attribute__((packed)); 126} __packed;
127 127
128#define RDS_INFO_MESSAGE_FLAG_ACK 0x01 128#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
129#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02 129#define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
@@ -136,7 +136,7 @@ struct rds_info_message {
136 __be16 lport; 136 __be16 lport;
137 __be16 fport; 137 __be16 fport;
138 u_int8_t flags; 138 u_int8_t flags;
139} __attribute__((packed)); 139} __packed;
140 140
141struct rds_info_socket { 141struct rds_info_socket {
142 u_int32_t sndbuf; 142 u_int32_t sndbuf;
@@ -146,7 +146,7 @@ struct rds_info_socket {
146 __be16 connected_port; 146 __be16 connected_port;
147 u_int32_t rcvbuf; 147 u_int32_t rcvbuf;
148 u_int64_t inum; 148 u_int64_t inum;
149} __attribute__((packed)); 149} __packed;
150 150
151struct rds_info_tcp_socket { 151struct rds_info_tcp_socket {
152 __be32 local_addr; 152 __be32 local_addr;
@@ -158,7 +158,7 @@ struct rds_info_tcp_socket {
158 u_int32_t last_sent_nxt; 158 u_int32_t last_sent_nxt;
159 u_int32_t last_expected_una; 159 u_int32_t last_expected_una;
160 u_int32_t last_seen_una; 160 u_int32_t last_seen_una;
161} __attribute__((packed)); 161} __packed;
162 162
163#define RDS_IB_GID_LEN 16 163#define RDS_IB_GID_LEN 16
164struct rds_info_rdma_connection { 164struct rds_info_rdma_connection {
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 234a8476cba8..e2980287245e 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -157,7 +157,11 @@ struct regulator_consumer_supply {
157 * 157 *
158 * Initialisation constraints, our supply and consumers supplies. 158 * Initialisation constraints, our supply and consumers supplies.
159 * 159 *
160 * @supply_regulator_dev: Parent regulator (if any). 160 * @supply_regulator: Parent regulator. Specified using the regulator name
161 * as it appears in the name field in sysfs, which can
162 * be explicitly set using the constraints field 'name'.
163 * @supply_regulator_dev: Parent regulator (if any) - DEPRECATED in favour
164 * of supply_regulator.
161 * 165 *
162 * @constraints: Constraints. These must be specified for the regulator to 166 * @constraints: Constraints. These must be specified for the regulator to
163 * be usable. 167 * be usable.
@@ -168,7 +172,8 @@ struct regulator_consumer_supply {
168 * @driver_data: Data passed to regulator_init. 172 * @driver_data: Data passed to regulator_init.
169 */ 173 */
170struct regulator_init_data { 174struct regulator_init_data {
171 struct device *supply_regulator_dev; /* or NULL for LINE */ 175 const char *supply_regulator; /* or NULL for system supply */
176 struct device *supply_regulator_dev; /* or NULL for system supply */
172 177
173 struct regulation_constraints constraints; 178 struct regulation_constraints constraints;
174 179
diff --git a/include/linux/regulator/tps6507x.h b/include/linux/regulator/tps6507x.h
new file mode 100644
index 000000000000..4892f591bab1
--- /dev/null
+++ b/include/linux/regulator/tps6507x.h
@@ -0,0 +1,32 @@
1/*
2 * tps6507x.h -- Voltage regulation for the Texas Instruments TPS6507X
3 *
4 * Copyright (C) 2010 Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef REGULATOR_TPS6507X
21#define REGULATOR_TPS6507X
22
23/**
24 * tps6507x_reg_platform_data - platform data for tps6507x
25 * @defdcdc_default: Defines whether DCDC high or the low register controls
26 * output voltage by default. Valid for DCDC2 and DCDC3 outputs only.
27 */
28struct tps6507x_reg_platform_data {
29 bool defdcdc_default;
30};
31
32#endif
diff --git a/include/linux/reiserfs_acl.h b/include/linux/reiserfs_acl.h
index b4448853900e..3fd8c4506bbb 100644
--- a/include/linux/reiserfs_acl.h
+++ b/include/linux/reiserfs_acl.h
@@ -53,8 +53,8 @@ int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry, 53 struct inode *dir, struct dentry *dentry,
54 struct inode *inode); 54 struct inode *inode);
55int reiserfs_cache_default_acl(struct inode *dir); 55int reiserfs_cache_default_acl(struct inode *dir);
56extern struct xattr_handler reiserfs_posix_acl_default_handler; 56extern const struct xattr_handler reiserfs_posix_acl_default_handler;
57extern struct xattr_handler reiserfs_posix_acl_access_handler; 57extern const struct xattr_handler reiserfs_posix_acl_access_handler;
58 58
59#else 59#else
60 60
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 3b603f474186..91a4177e60ce 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -360,7 +360,7 @@ int is_reiserfs_jr(struct reiserfs_super_block *rs);
360/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ 360/* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */
361#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) 361#define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024)
362 362
363// reiserfs internal error code (used by search_by_key adn fix_nodes)) 363/* reiserfs internal error code (used by search_by_key and fix_nodes)) */
364#define CARRY_ON 0 364#define CARRY_ON 0
365#define REPEAT_SEARCH -1 365#define REPEAT_SEARCH -1
366#define IO_ERROR -2 366#define IO_ERROR -2
@@ -2033,7 +2033,7 @@ void reiserfs_read_locked_inode(struct inode *inode,
2033 struct reiserfs_iget_args *args); 2033 struct reiserfs_iget_args *args);
2034int reiserfs_find_actor(struct inode *inode, void *p); 2034int reiserfs_find_actor(struct inode *inode, void *p);
2035int reiserfs_init_locked_inode(struct inode *inode, void *p); 2035int reiserfs_init_locked_inode(struct inode *inode, void *p);
2036void reiserfs_delete_inode(struct inode *inode); 2036void reiserfs_evict_inode(struct inode *inode);
2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc); 2037int reiserfs_write_inode(struct inode *inode, struct writeback_control *wbc);
2038int reiserfs_get_block(struct inode *inode, sector_t block, 2038int reiserfs_get_block(struct inode *inode, sector_t block,
2039 struct buffer_head *bh_result, int create); 2039 struct buffer_head *bh_result, int create);
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
index 89f4d3abbf5a..97959bdfe214 100644
--- a/include/linux/reiserfs_fs_i.h
+++ b/include/linux/reiserfs_fs_i.h
@@ -25,7 +25,6 @@ typedef enum {
25 i_link_saved_truncate_mask = 0x0020, 25 i_link_saved_truncate_mask = 0x0020,
26 i_has_xattr_dir = 0x0040, 26 i_has_xattr_dir = 0x0040,
27 i_data_log = 0x0080, 27 i_data_log = 0x0080,
28 i_ever_mapped = 0x0100
29} reiserfs_inode_flags; 28} reiserfs_inode_flags;
30 29
31struct reiserfs_inode_info { 30struct reiserfs_inode_info {
@@ -53,7 +52,8 @@ struct reiserfs_inode_info {
53 ** flushed */ 52 ** flushed */
54 unsigned int i_trans_id; 53 unsigned int i_trans_id;
55 struct reiserfs_journal_list *i_jl; 54 struct reiserfs_journal_list *i_jl;
56 struct mutex i_mmap; 55 atomic_t openers;
56 struct mutex tailpack;
57#ifdef CONFIG_REISERFS_FS_XATTR 57#ifdef CONFIG_REISERFS_FS_XATTR
58 struct rw_semaphore i_xattr_sem; 58 struct rw_semaphore i_xattr_sem;
59#endif 59#endif
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 7fa02b4af838..b2cf2089769b 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -58,9 +58,9 @@ int reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *,
58 struct inode *, const char *, const void *, 58 struct inode *, const char *, const void *,
59 size_t, int); 59 size_t, int);
60 60
61extern struct xattr_handler reiserfs_xattr_user_handler; 61extern const struct xattr_handler reiserfs_xattr_user_handler;
62extern struct xattr_handler reiserfs_xattr_trusted_handler; 62extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern struct xattr_handler reiserfs_xattr_security_handler; 63extern const struct xattr_handler reiserfs_xattr_security_handler;
64#ifdef CONFIG_REISERFS_FS_SECURITY 64#ifdef CONFIG_REISERFS_FS_SECURITY
65int reiserfs_security_init(struct inode *dir, struct inode *inode, 65int reiserfs_security_init(struct inode *dir, struct inode *inode,
66 struct reiserfs_security_handle *sec); 66 struct reiserfs_security_handle *sec);
diff --git a/include/linux/resource.h b/include/linux/resource.h
index f1e914eefeab..88d36f9145ba 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -43,6 +43,13 @@ struct rlimit {
43 unsigned long rlim_max; 43 unsigned long rlim_max;
44}; 44};
45 45
46#define RLIM64_INFINITY (~0ULL)
47
48struct rlimit64 {
49 __u64 rlim_cur;
50 __u64 rlim_max;
51};
52
46#define PRIO_MIN (-20) 53#define PRIO_MIN (-20)
47#define PRIO_MAX 20 54#define PRIO_MAX 20
48 55
@@ -73,6 +80,8 @@ struct rlimit {
73struct task_struct; 80struct task_struct;
74 81
75int getrusage(struct task_struct *p, int who, struct rusage __user *ru); 82int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
83int do_prlimit(struct task_struct *tsk, unsigned int resource,
84 struct rlimit *new_rlim, struct rlimit *old_rlim);
76 85
77#endif /* __KERNEL__ */ 86#endif /* __KERNEL__ */
78 87
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 5fcc31ed5771..25b4f686d918 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -120,12 +120,16 @@ int ring_buffer_write(struct ring_buffer *buffer,
120 unsigned long length, void *data); 120 unsigned long length, void *data);
121 121
122struct ring_buffer_event * 122struct ring_buffer_event *
123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts); 123ring_buffer_peek(struct ring_buffer *buffer, int cpu, u64 *ts,
124 unsigned long *lost_events);
124struct ring_buffer_event * 125struct ring_buffer_event *
125ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts); 126ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts,
127 unsigned long *lost_events);
126 128
127struct ring_buffer_iter * 129struct ring_buffer_iter *
128ring_buffer_read_start(struct ring_buffer *buffer, int cpu); 130ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu);
131void ring_buffer_read_prepare_sync(void);
132void ring_buffer_read_start(struct ring_buffer_iter *iter);
129void ring_buffer_read_finish(struct ring_buffer_iter *iter); 133void ring_buffer_read_finish(struct ring_buffer_iter *iter);
130 134
131struct ring_buffer_event * 135struct ring_buffer_event *
diff --git a/include/linux/rio.h b/include/linux/rio.h
index dc0c75556c63..bd6eb0ed34a7 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -64,10 +64,13 @@
64#define RIO_INB_MBOX_RESOURCE 1 64#define RIO_INB_MBOX_RESOURCE 1
65#define RIO_OUTB_MBOX_RESOURCE 2 65#define RIO_OUTB_MBOX_RESOURCE 2
66 66
67#define RIO_PW_MSG_SIZE 64
68
67extern struct bus_type rio_bus_type; 69extern struct bus_type rio_bus_type;
68extern struct list_head rio_devices; /* list of all devices */ 70extern struct list_head rio_devices; /* list of all devices */
69 71
70struct rio_mport; 72struct rio_mport;
73union rio_pw_msg;
71 74
72/** 75/**
73 * struct rio_dev - RIO device info 76 * struct rio_dev - RIO device info
@@ -85,11 +88,15 @@ struct rio_mport;
85 * @swpinfo: Switch port info 88 * @swpinfo: Switch port info
86 * @src_ops: Source operation capabilities 89 * @src_ops: Source operation capabilities
87 * @dst_ops: Destination operation capabilities 90 * @dst_ops: Destination operation capabilities
91 * @comp_tag: RIO component tag
92 * @phys_efptr: RIO device extended features pointer
93 * @em_efptr: RIO Error Management features pointer
88 * @dma_mask: Mask of bits of RIO address this device implements 94 * @dma_mask: Mask of bits of RIO address this device implements
89 * @rswitch: Pointer to &struct rio_switch if valid for this device 95 * @rswitch: Pointer to &struct rio_switch if valid for this device
90 * @driver: Driver claiming this device 96 * @driver: Driver claiming this device
91 * @dev: Device model device 97 * @dev: Device model device
92 * @riores: RIO resources this device owns 98 * @riores: RIO resources this device owns
99 * @pwcback: port-write callback function for this device
93 * @destid: Network destination ID 100 * @destid: Network destination ID
94 */ 101 */
95struct rio_dev { 102struct rio_dev {
@@ -107,11 +114,15 @@ struct rio_dev {
107 u32 swpinfo; /* Only used for switches */ 114 u32 swpinfo; /* Only used for switches */
108 u32 src_ops; 115 u32 src_ops;
109 u32 dst_ops; 116 u32 dst_ops;
117 u32 comp_tag;
118 u32 phys_efptr;
119 u32 em_efptr;
110 u64 dma_mask; 120 u64 dma_mask;
111 struct rio_switch *rswitch; /* RIO switch info */ 121 struct rio_switch *rswitch; /* RIO switch info */
112 struct rio_driver *driver; /* RIO driver claiming this device */ 122 struct rio_driver *driver; /* RIO driver claiming this device */
113 struct device dev; /* LDM device structure */ 123 struct device dev; /* LDM device structure */
114 struct resource riores[RIO_MAX_DEV_RESOURCES]; 124 struct resource riores[RIO_MAX_DEV_RESOURCES];
125 int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);
115 u16 destid; 126 u16 destid;
116}; 127};
117 128
@@ -211,8 +222,14 @@ struct rio_net {
211 * @hopcount: Hopcount to this switch 222 * @hopcount: Hopcount to this switch
212 * @destid: Associated destid in the path 223 * @destid: Associated destid in the path
213 * @route_table: Copy of switch routing table 224 * @route_table: Copy of switch routing table
225 * @port_ok: Status of each port (one bit per port) - OK=1 or UNINIT=0
214 * @add_entry: Callback for switch-specific route add function 226 * @add_entry: Callback for switch-specific route add function
215 * @get_entry: Callback for switch-specific route get function 227 * @get_entry: Callback for switch-specific route get function
228 * @clr_table: Callback for switch-specific clear route table function
229 * @set_domain: Callback for switch-specific domain setting function
230 * @get_domain: Callback for switch-specific domain get function
231 * @em_init: Callback for switch-specific error management initialization function
232 * @em_handle: Callback for switch-specific error management handler function
216 */ 233 */
217struct rio_switch { 234struct rio_switch {
218 struct list_head node; 235 struct list_head node;
@@ -220,10 +237,19 @@ struct rio_switch {
220 u16 hopcount; 237 u16 hopcount;
221 u16 destid; 238 u16 destid;
222 u8 *route_table; 239 u8 *route_table;
240 u32 port_ok;
223 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 241 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
224 u16 table, u16 route_destid, u8 route_port); 242 u16 table, u16 route_destid, u8 route_port);
225 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount, 243 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
226 u16 table, u16 route_destid, u8 * route_port); 244 u16 table, u16 route_destid, u8 * route_port);
245 int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount,
246 u16 table);
247 int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
248 u8 sw_domain);
249 int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount,
250 u8 *sw_domain);
251 int (*em_init) (struct rio_dev *dev);
252 int (*em_handle) (struct rio_dev *dev, u8 swport);
227}; 253};
228 254
229/* Low-level architecture-dependent routines */ 255/* Low-level architecture-dependent routines */
@@ -235,6 +261,7 @@ struct rio_switch {
235 * @cread: Callback to perform network read of config space. 261 * @cread: Callback to perform network read of config space.
236 * @cwrite: Callback to perform network write of config space. 262 * @cwrite: Callback to perform network write of config space.
237 * @dsend: Callback to send a doorbell message. 263 * @dsend: Callback to send a doorbell message.
264 * @pwenable: Callback to enable/disable port-write message handling.
238 */ 265 */
239struct rio_ops { 266struct rio_ops {
240 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 267 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -246,6 +273,7 @@ struct rio_ops {
246 int (*cwrite) (struct rio_mport *mport, int index, u16 destid, 273 int (*cwrite) (struct rio_mport *mport, int index, u16 destid,
247 u8 hopcount, u32 offset, int len, u32 data); 274 u8 hopcount, u32 offset, int len, u32 data);
248 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 275 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
276 int (*pwenable) (struct rio_mport *mport, int enable);
249}; 277};
250 278
251#define RIO_RESOURCE_MEM 0x00000100 279#define RIO_RESOURCE_MEM 0x00000100
@@ -302,21 +330,28 @@ struct rio_device_id {
302}; 330};
303 331
304/** 332/**
305 * struct rio_route_ops - Per-switch route operations 333 * struct rio_switch_ops - Per-switch operations
306 * @vid: RIO vendor ID 334 * @vid: RIO vendor ID
307 * @did: RIO device ID 335 * @did: RIO device ID
308 * @add_hook: Callback that adds a route entry 336 * @init_hook: Callback that performs switch device initialization
309 * @get_hook: Callback that gets a route entry
310 * 337 *
311 * Defines the operations that are necessary to manipulate the route 338 * Defines the operations that are necessary to initialize/control
312 * tables for a particular RIO switch device. 339 * a particular RIO switch device.
313 */ 340 */
314struct rio_route_ops { 341struct rio_switch_ops {
315 u16 vid, did; 342 u16 vid, did;
316 int (*add_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, 343 int (*init_hook) (struct rio_dev *rdev, int do_enum);
317 u16 table, u16 route_destid, u8 route_port); 344};
318 int (*get_hook) (struct rio_mport * mport, u16 destid, u8 hopcount, 345
319 u16 table, u16 route_destid, u8 * route_port); 346union rio_pw_msg {
347 struct {
348 u32 comptag; /* Component Tag CSR */
349 u32 errdetect; /* Port N Error Detect CSR */
350 u32 is_port; /* Implementation specific + PortID */
351 u32 ltlerrdet; /* LTL Error Detect CSR */
352 u32 padding[12];
353 } em;
354 u32 raw[RIO_PW_MSG_SIZE/sizeof(u32)];
320}; 355};
321 356
322/* Architecture and hardware-specific functions */ 357/* Architecture and hardware-specific functions */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index c93a58a40033..edc55da717b3 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -413,6 +413,12 @@ void rio_release_regions(struct rio_dev *);
413int rio_request_region(struct rio_dev *, int, char *); 413int rio_request_region(struct rio_dev *, int, char *);
414void rio_release_region(struct rio_dev *, int); 414void rio_release_region(struct rio_dev *, int);
415 415
416/* Port-Write management */
417extern int rio_request_inb_pwrite(struct rio_dev *,
418 int (*)(struct rio_dev *, union rio_pw_msg*, int));
419extern int rio_release_inb_pwrite(struct rio_dev *);
420extern int rio_inb_pwrite_handler(union rio_pw_msg *pw_msg);
421
416/* LDM support */ 422/* LDM support */
417int rio_register_driver(struct rio_driver *); 423int rio_register_driver(struct rio_driver *);
418void rio_unregister_driver(struct rio_driver *); 424void rio_unregister_driver(struct rio_driver *);
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
index 919d4e07d54e..db50e1c288b7 100644
--- a/include/linux/rio_ids.h
+++ b/include/linux/rio_ids.h
@@ -20,5 +20,19 @@
20 20
21#define RIO_VID_TUNDRA 0x000d 21#define RIO_VID_TUNDRA 0x000d
22#define RIO_DID_TSI500 0x0500 22#define RIO_DID_TSI500 0x0500
23#define RIO_DID_TSI568 0x0568
24#define RIO_DID_TSI572 0x0572
25#define RIO_DID_TSI574 0x0574
26#define RIO_DID_TSI576 0x0578 /* Same ID as Tsi578 */
27#define RIO_DID_TSI577 0x0577
28#define RIO_DID_TSI578 0x0578
29
30#define RIO_VID_IDT 0x0038
31#define RIO_DID_IDT70K200 0x0310
32#define RIO_DID_IDTCPS8 0x035c
33#define RIO_DID_IDTCPS12 0x035d
34#define RIO_DID_IDTCPS16 0x035b
35#define RIO_DID_IDTCPS6Q 0x035f
36#define RIO_DID_IDTCPS10Q 0x035e
23 37
24#endif /* LINUX_RIO_IDS_H */ 38#endif /* LINUX_RIO_IDS_H */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
index 326540f9b54e..aedee0489fb4 100644
--- a/include/linux/rio_regs.h
+++ b/include/linux/rio_regs.h
@@ -39,6 +39,8 @@
39#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */ 39#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */
40#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */ 40#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */
41#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */ 41#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */
42#define RIO_PEF_EXT_RT 0x00000200 /* [III, 1.3] Extended route table support */
43#define RIO_PEF_STD_RT 0x00000100 /* [III, 1.3] Standard route table support */
42#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */ 44#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */
43#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */ 45#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */
44#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */ 46#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */
@@ -91,7 +93,10 @@
91#define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */ 93#define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */
92#define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */ 94#define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */
93 95
94 /* 0x20-0x3c *//* Reserved */ 96 /* 0x20-0x30 *//* Reserved */
97
98#define RIO_SWITCH_RT_LIMIT 0x34 /* [III, 1.3] Switch Route Table Destination ID Limit CAR */
99#define RIO_RT_MAX_DESTID 0x0000ffff
95 100
96#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */ 101#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */
97#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */ 102#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */
@@ -153,7 +158,11 @@
153#define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */ 158#define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */
154#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */ 159#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */
155 160
156 /* 0x70-0xf8 *//* Reserved */ 161#define RIO_STD_RTE_CONF_DESTID_SEL_CSR 0x70
162#define RIO_STD_RTE_CONF_PORT_SEL_CSR 0x74
163#define RIO_STD_RTE_DEFAULT_PORT 0x78
164
165 /* 0x7c-0xf8 *//* Reserved */
157 /* 0x100-0xfff8 *//* [I] Extended Features Space */ 166 /* 0x100-0xfff8 *//* [I] Extended Features Space */
158 /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */ 167 /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */
159 168
@@ -183,9 +192,14 @@
183#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */ 192#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */
184#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */ 193#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */
185#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */ 194#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */
195#define RIO_EFB_SER_EP_ID_V13P 0x0001 /* [VI] LP/Serial EP Devices, RapidIO Spec ver 1.3 and above */
196#define RIO_EFB_SER_EP_REC_ID_V13P 0x0002 /* [VI] LP/Serial EP Recovery Devices, RapidIO Spec ver 1.3 and above */
197#define RIO_EFB_SER_EP_FREE_ID_V13P 0x0003 /* [VI] LP/Serial EP Free Devices, RapidIO Spec ver 1.3 and above */
186#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */ 198#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */
187#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */ 199#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */
188#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */ 200#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */
201#define RIO_EFB_SER_EP_FREC_ID 0x0009 /* [VI] LP/Serial EP Free Recovery Devices */
202#define RIO_EFB_ERR_MGMNT 0x0007 /* [VIII] Error Management Extensions */
189 203
190/* 204/*
191 * Physical 8/16 LP-LVDS 205 * Physical 8/16 LP-LVDS
@@ -201,15 +215,71 @@
201#define RIO_PORT_MNT_HEADER 0x0000 215#define RIO_PORT_MNT_HEADER 0x0000
202#define RIO_PORT_REQ_CTL_CSR 0x0020 216#define RIO_PORT_REQ_CTL_CSR 0x0020
203#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */ 217#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */
218#define RIO_PORT_LINKTO_CTL_CSR 0x0020 /* Serial */
219#define RIO_PORT_RSPTO_CTL_CSR 0x0024 /* Serial */
204#define RIO_PORT_GEN_CTL_CSR 0x003c 220#define RIO_PORT_GEN_CTL_CSR 0x003c
205#define RIO_PORT_GEN_HOST 0x80000000 221#define RIO_PORT_GEN_HOST 0x80000000
206#define RIO_PORT_GEN_MASTER 0x40000000 222#define RIO_PORT_GEN_MASTER 0x40000000
207#define RIO_PORT_GEN_DISCOVERED 0x20000000 223#define RIO_PORT_GEN_DISCOVERED 0x20000000
208#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */ 224#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */
209#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */ 225#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */
226#define RIO_PORT_N_MNT_RSP_RVAL 0x80000000 /* Response Valid */
227#define RIO_PORT_N_MNT_RSP_ASTAT 0x000003e0 /* ackID Status */
228#define RIO_PORT_N_MNT_RSP_LSTAT 0x0000001f /* Link Status */
210#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */ 229#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */
211#define RIO_PORT_N_ERR_STS_CSR(x) (0x58 + x*0x20) 230#define RIO_PORT_N_ACK_CLEAR 0x80000000
212#define PORT_N_ERR_STS_PORT_OK 0x00000002 231#define RIO_PORT_N_ACK_INBOUND 0x1f000000
213#define RIO_PORT_N_CTL_CSR(x) (0x5c + x*0x20) 232#define RIO_PORT_N_ACK_OUTSTAND 0x00001f00
233#define RIO_PORT_N_ACK_OUTBOUND 0x0000001f
234#define RIO_PORT_N_ERR_STS_CSR(x) (0x0058 + x*0x20)
235#define RIO_PORT_N_ERR_STS_PW_OUT_ES 0x00010000 /* Output Error-stopped */
236#define RIO_PORT_N_ERR_STS_PW_INP_ES 0x00000100 /* Input Error-stopped */
237#define RIO_PORT_N_ERR_STS_PW_PEND 0x00000010 /* Port-Write Pending */
238#define RIO_PORT_N_ERR_STS_PORT_ERR 0x00000004
239#define RIO_PORT_N_ERR_STS_PORT_OK 0x00000002
240#define RIO_PORT_N_ERR_STS_PORT_UNINIT 0x00000001
241#define RIO_PORT_N_ERR_STS_CLR_MASK 0x07120204
242#define RIO_PORT_N_CTL_CSR(x) (0x005c + x*0x20)
243#define RIO_PORT_N_CTL_PWIDTH 0xc0000000
244#define RIO_PORT_N_CTL_PWIDTH_1 0x00000000
245#define RIO_PORT_N_CTL_PWIDTH_4 0x40000000
246#define RIO_PORT_N_CTL_P_TYP_SER 0x00000001
247#define RIO_PORT_N_CTL_LOCKOUT 0x00000002
248#define RIO_PORT_N_CTL_EN_RX_SER 0x00200000
249#define RIO_PORT_N_CTL_EN_TX_SER 0x00400000
250#define RIO_PORT_N_CTL_EN_RX_PAR 0x08000000
251#define RIO_PORT_N_CTL_EN_TX_PAR 0x40000000
252
253/*
254 * Error Management Extensions (RapidIO 1.3+, Part 8)
255 *
256 * Extended Features Block ID=0x0007
257 */
258
259/* General EM Registers (Common for all Ports) */
260
261#define RIO_EM_EFB_HEADER 0x000 /* Error Management Extensions Block Header */
262#define RIO_EM_LTL_ERR_DETECT 0x008 /* Logical/Transport Layer Error Detect CSR */
263#define RIO_EM_LTL_ERR_EN 0x00c /* Logical/Transport Layer Error Enable CSR */
264#define RIO_EM_LTL_HIADDR_CAP 0x010 /* Logical/Transport Layer High Address Capture CSR */
265#define RIO_EM_LTL_ADDR_CAP 0x014 /* Logical/Transport Layer Address Capture CSR */
266#define RIO_EM_LTL_DEVID_CAP 0x018 /* Logical/Transport Layer Device ID Capture CSR */
267#define RIO_EM_LTL_CTRL_CAP 0x01c /* Logical/Transport Layer Control Capture CSR */
268#define RIO_EM_PW_TGT_DEVID 0x028 /* Port-write Target deviceID CSR */
269#define RIO_EM_PKT_TTL 0x02c /* Packet Time-to-live CSR */
270
271/* Per-Port EM Registers */
272
273#define RIO_EM_PN_ERR_DETECT(x) (0x040 + x*0x40) /* Port N Error Detect CSR */
274#define REM_PED_IMPL_SPEC 0x80000000
275#define REM_PED_LINK_TO 0x00000001
276#define RIO_EM_PN_ERRRATE_EN(x) (0x044 + x*0x40) /* Port N Error Rate Enable CSR */
277#define RIO_EM_PN_ATTRIB_CAP(x) (0x048 + x*0x40) /* Port N Attributes Capture CSR */
278#define RIO_EM_PN_PKT_CAP_0(x) (0x04c + x*0x40) /* Port N Packet/Control Symbol Capture 0 CSR */
279#define RIO_EM_PN_PKT_CAP_1(x) (0x050 + x*0x40) /* Port N Packet Capture 1 CSR */
280#define RIO_EM_PN_PKT_CAP_2(x) (0x054 + x*0x40) /* Port N Packet Capture 2 CSR */
281#define RIO_EM_PN_PKT_CAP_3(x) (0x058 + x*0x40) /* Port N Packet Capture 3 CSR */
282#define RIO_EM_PN_ERRRATE(x) (0x068 + x*0x40) /* Port N Error Rate CSR */
283#define RIO_EM_PN_ERRRATE_TR(x) (0x06c + x*0x40) /* Port N Error Rate Threshold CSR */
214 284
215#endif /* LINUX_RIO_REGS_H */ 285#endif /* LINUX_RIO_REGS_H */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index d25bd224d370..d6661de56f30 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,8 +26,18 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29#ifdef CONFIG_KSM 29 struct anon_vma *root; /* Root of this anon_vma tree */
30 atomic_t ksm_refcount; 30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
31
32 /*
33 * The external_refcount is taken by either KSM or page migration
34 * to take a reference to an anon_vma when there is no
35 * guarantee that the vma of page tables will exist for
36 * the duration of the operation. A caller that takes
37 * the reference is responsible for clearing up the
38 * anon_vma if they are the last user on release
39 */
40 atomic_t external_refcount;
31#endif 41#endif
32 /* 42 /*
33 * NOTE: the LSB of the head.next is set by 43 * NOTE: the LSB of the head.next is set by
@@ -61,25 +71,40 @@ struct anon_vma_chain {
61}; 71};
62 72
63#ifdef CONFIG_MMU 73#ifdef CONFIG_MMU
64#ifdef CONFIG_KSM 74#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
65static inline void ksm_refcount_init(struct anon_vma *anon_vma) 75static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
76{
77 atomic_set(&anon_vma->external_refcount, 0);
78}
79
80static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
66{ 81{
67 atomic_set(&anon_vma->ksm_refcount, 0); 82 return atomic_read(&anon_vma->external_refcount);
68} 83}
69 84
70static inline int ksm_refcount(struct anon_vma *anon_vma) 85static inline void get_anon_vma(struct anon_vma *anon_vma)
71{ 86{
72 return atomic_read(&anon_vma->ksm_refcount); 87 atomic_inc(&anon_vma->external_refcount);
73} 88}
89
90void drop_anon_vma(struct anon_vma *);
74#else 91#else
75static inline void ksm_refcount_init(struct anon_vma *anon_vma) 92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
76{ 93{
77} 94}
78 95
79static inline int ksm_refcount(struct anon_vma *anon_vma) 96static inline int anonvma_external_refcount(struct anon_vma *anon_vma)
80{ 97{
81 return 0; 98 return 0;
82} 99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{
103}
104
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
83#endif /* CONFIG_KSM */ 108#endif /* CONFIG_KSM */
84 109
85static inline struct anon_vma *page_anon_vma(struct page *page) 110static inline struct anon_vma *page_anon_vma(struct page *page)
@@ -90,18 +115,28 @@ static inline struct anon_vma *page_anon_vma(struct page *page)
90 return page_rmapping(page); 115 return page_rmapping(page);
91} 116}
92 117
93static inline void anon_vma_lock(struct vm_area_struct *vma) 118static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
94{ 119{
95 struct anon_vma *anon_vma = vma->anon_vma; 120 struct anon_vma *anon_vma = vma->anon_vma;
96 if (anon_vma) 121 if (anon_vma)
97 spin_lock(&anon_vma->lock); 122 spin_lock(&anon_vma->root->lock);
98} 123}
99 124
100static inline void anon_vma_unlock(struct vm_area_struct *vma) 125static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
101{ 126{
102 struct anon_vma *anon_vma = vma->anon_vma; 127 struct anon_vma *anon_vma = vma->anon_vma;
103 if (anon_vma) 128 if (anon_vma)
104 spin_unlock(&anon_vma->lock); 129 spin_unlock(&anon_vma->root->lock);
130}
131
132static inline void anon_vma_lock(struct anon_vma *anon_vma)
133{
134 spin_lock(&anon_vma->root->lock);
135}
136
137static inline void anon_vma_unlock(struct anon_vma *anon_vma)
138{
139 spin_unlock(&anon_vma->root->lock);
105} 140}
106 141
107/* 142/*
@@ -127,6 +162,8 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
127 */ 162 */
128void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 163void page_move_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
129void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 164void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
165void do_page_add_anon_rmap(struct page *, struct vm_area_struct *,
166 unsigned long, int);
130void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 167void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
131void page_add_file_rmap(struct page *); 168void page_add_file_rmap(struct page *);
132void page_remove_rmap(struct page *); 169void page_remove_rmap(struct page *);
diff --git a/include/linux/rtc-v3020.h b/include/linux/rtc-v3020.h
index 8ba646e610d9..e55d82cebf80 100644
--- a/include/linux/rtc-v3020.h
+++ b/include/linux/rtc-v3020.h
@@ -15,7 +15,7 @@
15struct v3020_platform_data { 15struct v3020_platform_data {
16 int leftshift; /* (1<<(leftshift)) & readl() */ 16 int leftshift; /* (1<<(leftshift)) & readl() */
17 17
18 int use_gpio:1; 18 unsigned int use_gpio:1;
19 unsigned int gpio_cs; 19 unsigned int gpio_cs;
20 unsigned int gpio_wr; 20 unsigned int gpio_wr;
21 unsigned int gpio_rd; 21 unsigned int gpio_rd;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index d1c7c90e9cd4..58d44491880f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -7,6 +7,13 @@
7#include <linux/if_addr.h> 7#include <linux/if_addr.h>
8#include <linux/neighbour.h> 8#include <linux/neighbour.h>
9 9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_IP6MR 129
15#define RTNL_FAMILY_MAX 129
16
10/**** 17/****
11 * Routing/neighbour discovery messages. 18 * Routing/neighbour discovery messages.
12 ****/ 19 ****/
@@ -275,6 +282,7 @@ enum rtattr_type_t {
275 RTA_SESSION, /* no longer used */ 282 RTA_SESSION, /* no longer used */
276 RTA_MP_ALGO, /* no longer used */ 283 RTA_MP_ALGO, /* no longer used */
277 RTA_TABLE, 284 RTA_TABLE,
285 RTA_MARK,
278 __RTA_MAX 286 __RTA_MAX
279}; 287};
280 288
diff --git a/include/linux/sched.h b/include/linux/sched.h
index dad7f668ebf7..ce160d68f5e7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -99,7 +99,6 @@ struct futex_pi_state;
99struct robust_list_head; 99struct robust_list_head;
100struct bio_list; 100struct bio_list;
101struct fs_struct; 101struct fs_struct;
102struct bts_context;
103struct perf_event_context; 102struct perf_event_context;
104 103
105/* 104/*
@@ -140,7 +139,7 @@ extern int nr_processes(void);
140extern unsigned long nr_running(void); 139extern unsigned long nr_running(void);
141extern unsigned long nr_uninterruptible(void); 140extern unsigned long nr_uninterruptible(void);
142extern unsigned long nr_iowait(void); 141extern unsigned long nr_iowait(void);
143extern unsigned long nr_iowait_cpu(void); 142extern unsigned long nr_iowait_cpu(int cpu);
144extern unsigned long this_cpu_load(void); 143extern unsigned long this_cpu_load(void);
145 144
146 145
@@ -215,6 +214,7 @@ extern char ___assert_task_state[1 - 2*!!(
215 214
216#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) 215#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
217#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) 216#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
217#define task_is_dead(task) ((task)->exit_state != 0)
218#define task_is_stopped_or_traced(task) \ 218#define task_is_stopped_or_traced(task) \
219 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 219 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
220#define task_contributes_to_load(task) \ 220#define task_contributes_to_load(task) \
@@ -269,17 +269,13 @@ extern void init_idle(struct task_struct *idle, int cpu);
269extern void init_idle_bootup_task(struct task_struct *idle); 269extern void init_idle_bootup_task(struct task_struct *idle);
270 270
271extern int runqueue_is_locked(int cpu); 271extern int runqueue_is_locked(int cpu);
272extern void task_rq_unlock_wait(struct task_struct *p);
273 272
274extern cpumask_var_t nohz_cpu_mask; 273extern cpumask_var_t nohz_cpu_mask;
275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 274#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
276extern int select_nohz_load_balancer(int cpu); 275extern void select_nohz_load_balancer(int stop_tick);
277extern int get_nohz_load_balancer(void); 276extern int get_nohz_timer_target(void);
278#else 277#else
279static inline int select_nohz_load_balancer(int cpu) 278static inline void select_nohz_load_balancer(int stop_tick) { }
280{
281 return 0;
282}
283#endif 279#endif
284 280
285/* 281/*
@@ -311,20 +307,16 @@ extern void scheduler_tick(void);
311 307
312extern void sched_show_task(struct task_struct *p); 308extern void sched_show_task(struct task_struct *p);
313 309
314#ifdef CONFIG_DETECT_SOFTLOCKUP 310#ifdef CONFIG_LOCKUP_DETECTOR
315extern void softlockup_tick(void);
316extern void touch_softlockup_watchdog(void); 311extern void touch_softlockup_watchdog(void);
317extern void touch_softlockup_watchdog_sync(void); 312extern void touch_softlockup_watchdog_sync(void);
318extern void touch_all_softlockup_watchdogs(void); 313extern void touch_all_softlockup_watchdogs(void);
319extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, 314extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
320 void __user *buffer, 315 void __user *buffer,
321 size_t *lenp, loff_t *ppos); 316 size_t *lenp, loff_t *ppos);
322extern unsigned int softlockup_panic; 317extern unsigned int softlockup_panic;
323extern int softlockup_thresh; 318extern int softlockup_thresh;
324#else 319#else
325static inline void softlockup_tick(void)
326{
327}
328static inline void touch_softlockup_watchdog(void) 320static inline void touch_softlockup_watchdog(void)
329{ 321{
330} 322}
@@ -379,7 +371,7 @@ struct user_namespace;
379 * 1-3 now and depends on arch. We use "5" as safe margin, here. 371 * 1-3 now and depends on arch. We use "5" as safe margin, here.
380 */ 372 */
381#define MAPCOUNT_ELF_CORE_MARGIN (5) 373#define MAPCOUNT_ELF_CORE_MARGIN (5)
382#define DEFAULT_MAX_MAP_COUNT (USHORT_MAX - MAPCOUNT_ELF_CORE_MARGIN) 374#define DEFAULT_MAX_MAP_COUNT (USHRT_MAX - MAPCOUNT_ELF_CORE_MARGIN)
383 375
384extern int sysctl_max_map_count; 376extern int sysctl_max_map_count;
385 377
@@ -522,8 +514,9 @@ struct thread_group_cputimer {
522 * the locking of signal_struct. 514 * the locking of signal_struct.
523 */ 515 */
524struct signal_struct { 516struct signal_struct {
525 atomic_t count; 517 atomic_t sigcnt;
526 atomic_t live; 518 atomic_t live;
519 int nr_threads;
527 520
528 wait_queue_head_t wait_chldexit; /* for wait4() */ 521 wait_queue_head_t wait_chldexit; /* for wait4() */
529 522
@@ -628,7 +621,8 @@ struct signal_struct {
628 struct tty_audit_buf *tty_audit_buf; 621 struct tty_audit_buf *tty_audit_buf;
629#endif 622#endif
630 623
631 int oom_adj; /* OOM kill score adjustment (bit shift) */ 624 int oom_adj; /* OOM kill score adjustment (bit shift) */
625 int oom_score_adj; /* OOM kill score adjustment */
632}; 626};
633 627
634/* Context switch must be unlocked if interrupts are to be enabled */ 628/* Context switch must be unlocked if interrupts are to be enabled */
@@ -799,7 +793,7 @@ enum cpu_idle_type {
799#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */ 793#define SD_POWERSAVINGS_BALANCE 0x0100 /* Balance for power savings */
800#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 794#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
801#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 795#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
802 796#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
803#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 797#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
804 798
805enum powersavings_balance_level { 799enum powersavings_balance_level {
@@ -834,6 +828,8 @@ static inline int sd_balance_for_package_power(void)
834 return SD_PREFER_SIBLING; 828 return SD_PREFER_SIBLING;
835} 829}
836 830
831extern int __weak arch_sd_sibiling_asym_packing(void);
832
837/* 833/*
838 * Optimise SD flags for power savings: 834 * Optimise SD flags for power savings:
839 * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings. 835 * SD_BALANCE_NEWIDLE helps agressive task consolidation and power savings.
@@ -855,7 +851,7 @@ struct sched_group {
855 * CPU power of this group, SCHED_LOAD_SCALE being max power for a 851 * CPU power of this group, SCHED_LOAD_SCALE being max power for a
856 * single CPU. 852 * single CPU.
857 */ 853 */
858 unsigned int cpu_power; 854 unsigned int cpu_power, cpu_power_orig;
859 855
860 /* 856 /*
861 * The CPUs this group covers. 857 * The CPUs this group covers.
@@ -954,6 +950,7 @@ struct sched_domain {
954 char *name; 950 char *name;
955#endif 951#endif
956 952
953 unsigned int span_weight;
957 /* 954 /*
958 * Span of all CPUs in this domain. 955 * Span of all CPUs in this domain.
959 * 956 *
@@ -1026,12 +1023,17 @@ struct sched_domain;
1026#define WF_SYNC 0x01 /* waker goes to sleep after wakup */ 1023#define WF_SYNC 0x01 /* waker goes to sleep after wakup */
1027#define WF_FORK 0x02 /* child wakeup after fork */ 1024#define WF_FORK 0x02 /* child wakeup after fork */
1028 1025
1026#define ENQUEUE_WAKEUP 1
1027#define ENQUEUE_WAKING 2
1028#define ENQUEUE_HEAD 4
1029
1030#define DEQUEUE_SLEEP 1
1031
1029struct sched_class { 1032struct sched_class {
1030 const struct sched_class *next; 1033 const struct sched_class *next;
1031 1034
1032 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup, 1035 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1033 bool head); 1036 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1034 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
1035 void (*yield_task) (struct rq *rq); 1037 void (*yield_task) (struct rq *rq);
1036 1038
1037 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); 1039 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
@@ -1040,7 +1042,8 @@ struct sched_class {
1040 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 1042 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
1041 1043
1042#ifdef CONFIG_SMP 1044#ifdef CONFIG_SMP
1043 int (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); 1045 int (*select_task_rq)(struct rq *rq, struct task_struct *p,
1046 int sd_flag, int flags);
1044 1047
1045 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); 1048 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
1046 void (*post_schedule) (struct rq *this_rq); 1049 void (*post_schedule) (struct rq *this_rq);
@@ -1077,36 +1080,8 @@ struct load_weight {
1077 unsigned long weight, inv_weight; 1080 unsigned long weight, inv_weight;
1078}; 1081};
1079 1082
1080/*
1081 * CFS stats for a schedulable entity (task, task-group etc)
1082 *
1083 * Current field usage histogram:
1084 *
1085 * 4 se->block_start
1086 * 4 se->run_node
1087 * 4 se->sleep_start
1088 * 6 se->load.weight
1089 */
1090struct sched_entity {
1091 struct load_weight load; /* for load-balancing */
1092 struct rb_node run_node;
1093 struct list_head group_node;
1094 unsigned int on_rq;
1095
1096 u64 exec_start;
1097 u64 sum_exec_runtime;
1098 u64 vruntime;
1099 u64 prev_sum_exec_runtime;
1100
1101 u64 last_wakeup;
1102 u64 avg_overlap;
1103
1104 u64 nr_migrations;
1105
1106 u64 start_runtime;
1107 u64 avg_wakeup;
1108
1109#ifdef CONFIG_SCHEDSTATS 1083#ifdef CONFIG_SCHEDSTATS
1084struct sched_statistics {
1110 u64 wait_start; 1085 u64 wait_start;
1111 u64 wait_max; 1086 u64 wait_max;
1112 u64 wait_count; 1087 u64 wait_count;
@@ -1138,6 +1113,24 @@ struct sched_entity {
1138 u64 nr_wakeups_affine_attempts; 1113 u64 nr_wakeups_affine_attempts;
1139 u64 nr_wakeups_passive; 1114 u64 nr_wakeups_passive;
1140 u64 nr_wakeups_idle; 1115 u64 nr_wakeups_idle;
1116};
1117#endif
1118
1119struct sched_entity {
1120 struct load_weight load; /* for load-balancing */
1121 struct rb_node run_node;
1122 struct list_head group_node;
1123 unsigned int on_rq;
1124
1125 u64 exec_start;
1126 u64 sum_exec_runtime;
1127 u64 vruntime;
1128 u64 prev_sum_exec_runtime;
1129
1130 u64 nr_migrations;
1131
1132#ifdef CONFIG_SCHEDSTATS
1133 struct sched_statistics statistics;
1141#endif 1134#endif
1142 1135
1143#ifdef CONFIG_FAIR_GROUP_SCHED 1136#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1272,12 +1265,6 @@ struct task_struct {
1272 struct list_head ptraced; 1265 struct list_head ptraced;
1273 struct list_head ptrace_entry; 1266 struct list_head ptrace_entry;
1274 1267
1275 /*
1276 * This is the tracer handle for the ptrace BTS extension.
1277 * This field actually belongs to the ptracer task.
1278 */
1279 struct bts_context *bts;
1280
1281 /* PID/PID hash table linkage. */ 1268 /* PID/PID hash table linkage. */
1282 struct pid_link pids[PIDTYPE_MAX]; 1269 struct pid_link pids[PIDTYPE_MAX];
1283 struct list_head thread_group; 1270 struct list_head thread_group;
@@ -1425,7 +1412,9 @@ struct task_struct {
1425#endif 1412#endif
1426#ifdef CONFIG_CPUSETS 1413#ifdef CONFIG_CPUSETS
1427 nodemask_t mems_allowed; /* Protected by alloc_lock */ 1414 nodemask_t mems_allowed; /* Protected by alloc_lock */
1415 int mems_allowed_change_disable;
1428 int cpuset_mem_spread_rotor; 1416 int cpuset_mem_spread_rotor;
1417 int cpuset_slab_spread_rotor;
1429#endif 1418#endif
1430#ifdef CONFIG_CGROUPS 1419#ifdef CONFIG_CGROUPS
1431 /* Control Group info protected by css_set_lock */ 1420 /* Control Group info protected by css_set_lock */
@@ -1497,7 +1486,6 @@ struct task_struct {
1497 /* bitmask of trace recursion */ 1486 /* bitmask of trace recursion */
1498 unsigned long trace_recursion; 1487 unsigned long trace_recursion;
1499#endif /* CONFIG_TRACING */ 1488#endif /* CONFIG_TRACING */
1500 unsigned long stack_start;
1501#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ 1489#ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */
1502 struct memcg_batch_info { 1490 struct memcg_batch_info {
1503 int do_batch; /* incremented when batch uncharge started */ 1491 int do_batch; /* incremented when batch uncharge started */
@@ -1699,6 +1687,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1699#define PF_EXITING 0x00000004 /* getting shut down */ 1687#define PF_EXITING 0x00000004 /* getting shut down */
1700#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1688#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1701#define PF_VCPU 0x00000010 /* I'm a virtual CPU */ 1689#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1690#define PF_WQ_WORKER 0x00000020 /* I'm a workqueue worker */
1702#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1691#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1703#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */ 1692#define PF_MCE_PROCESS 0x00000080 /* process policy on mce errors */
1704#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1693#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
@@ -1793,20 +1782,23 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1793#endif 1782#endif
1794 1783
1795/* 1784/*
1796 * Architectures can set this to 1 if they have specified 1785 * Do not use outside of architecture code which knows its limitations.
1797 * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig, 1786 *
1798 * but then during bootup it turns out that sched_clock() 1787 * sched_clock() has no promise of monotonicity or bounded drift between
1799 * is reliable after all: 1788 * CPUs, use (which you should not) requires disabling IRQs.
1789 *
1790 * Please use one of the three interfaces below.
1800 */ 1791 */
1801#ifdef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1802extern int sched_clock_stable;
1803#endif
1804
1805/* ftrace calls sched_clock() directly */
1806extern unsigned long long notrace sched_clock(void); 1792extern unsigned long long notrace sched_clock(void);
1793/*
1794 * See the comment in kernel/sched_clock.c
1795 */
1796extern u64 cpu_clock(int cpu);
1797extern u64 local_clock(void);
1798extern u64 sched_clock_cpu(int cpu);
1799
1807 1800
1808extern void sched_clock_init(void); 1801extern void sched_clock_init(void);
1809extern u64 sched_clock_cpu(int cpu);
1810 1802
1811#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK 1803#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1812static inline void sched_clock_tick(void) 1804static inline void sched_clock_tick(void)
@@ -1821,17 +1813,19 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1821{ 1813{
1822} 1814}
1823#else 1815#else
1816/*
1817 * Architectures can set this to 1 if they have specified
1818 * CONFIG_HAVE_UNSTABLE_SCHED_CLOCK in their arch Kconfig,
1819 * but then during bootup it turns out that sched_clock()
1820 * is reliable after all:
1821 */
1822extern int sched_clock_stable;
1823
1824extern void sched_clock_tick(void); 1824extern void sched_clock_tick(void);
1825extern void sched_clock_idle_sleep_event(void); 1825extern void sched_clock_idle_sleep_event(void);
1826extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1826extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1827#endif 1827#endif
1828 1828
1829/*
1830 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
1831 * clock constructed from sched_clock():
1832 */
1833extern unsigned long long cpu_clock(int cpu);
1834
1835extern unsigned long long 1829extern unsigned long long
1836task_sched_runtime(struct task_struct *task); 1830task_sched_runtime(struct task_struct *task);
1837extern unsigned long long thread_group_sched_runtime(struct task_struct *task); 1831extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
@@ -1847,6 +1841,7 @@ extern void sched_clock_idle_sleep_event(void);
1847extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1841extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1848 1842
1849#ifdef CONFIG_HOTPLUG_CPU 1843#ifdef CONFIG_HOTPLUG_CPU
1844extern void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p);
1850extern void idle_task_exit(void); 1845extern void idle_task_exit(void);
1851#else 1846#else
1852static inline void idle_task_exit(void) {} 1847static inline void idle_task_exit(void) {}
@@ -2038,7 +2033,7 @@ extern int do_notify_parent(struct task_struct *, int);
2038extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2033extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2039extern void force_sig(int, struct task_struct *); 2034extern void force_sig(int, struct task_struct *);
2040extern int send_sig(int, struct task_struct *, int); 2035extern int send_sig(int, struct task_struct *, int);
2041extern void zap_other_threads(struct task_struct *p); 2036extern int zap_other_threads(struct task_struct *p);
2042extern struct sigqueue *sigqueue_alloc(void); 2037extern struct sigqueue *sigqueue_alloc(void);
2043extern void sigqueue_free(struct sigqueue *); 2038extern void sigqueue_free(struct sigqueue *);
2044extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); 2039extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
@@ -2103,7 +2098,6 @@ extern void flush_thread(void);
2103extern void exit_thread(void); 2098extern void exit_thread(void);
2104 2099
2105extern void exit_files(struct task_struct *); 2100extern void exit_files(struct task_struct *);
2106extern void __cleanup_signal(struct signal_struct *);
2107extern void __cleanup_sighand(struct sighand_struct *); 2101extern void __cleanup_sighand(struct sighand_struct *);
2108 2102
2109extern void exit_itimers(struct signal_struct *); 2103extern void exit_itimers(struct signal_struct *);
@@ -2123,10 +2117,8 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
2123extern char *get_task_comm(char *to, struct task_struct *tsk); 2117extern char *get_task_comm(char *to, struct task_struct *tsk);
2124 2118
2125#ifdef CONFIG_SMP 2119#ifdef CONFIG_SMP
2126extern void wait_task_context_switch(struct task_struct *p);
2127extern unsigned long wait_task_inactive(struct task_struct *, long match_state); 2120extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
2128#else 2121#else
2129static inline void wait_task_context_switch(struct task_struct *p) {}
2130static inline unsigned long wait_task_inactive(struct task_struct *p, 2122static inline unsigned long wait_task_inactive(struct task_struct *p,
2131 long match_state) 2123 long match_state)
2132{ 2124{
@@ -2152,6 +2144,11 @@ extern bool current_is_single_threaded(void);
2152#define while_each_thread(g, t) \ 2144#define while_each_thread(g, t) \
2153 while ((t = next_thread(t)) != g) 2145 while ((t = next_thread(t)) != g)
2154 2146
2147static inline int get_nr_threads(struct task_struct *tsk)
2148{
2149 return tsk->signal->nr_threads;
2150}
2151
2155/* de_thread depends on thread_group_leader not being a pid based check */ 2152/* de_thread depends on thread_group_leader not being a pid based check */
2156#define thread_group_leader(p) (p == p->group_leader) 2153#define thread_group_leader(p) (p == p->group_leader)
2157 2154
@@ -2398,10 +2395,6 @@ static inline void thread_group_cputime_init(struct signal_struct *sig)
2398 spin_lock_init(&sig->cputimer.lock); 2395 spin_lock_init(&sig->cputimer.lock);
2399} 2396}
2400 2397
2401static inline void thread_group_cputime_free(struct signal_struct *sig)
2402{
2403}
2404
2405/* 2398/*
2406 * Reevaluate whether the task has signals pending delivery. 2399 * Reevaluate whether the task has signals pending delivery.
2407 * Wake the task if so. 2400 * Wake the task if so.
@@ -2438,18 +2431,6 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2438 2431
2439#endif /* CONFIG_SMP */ 2432#endif /* CONFIG_SMP */
2440 2433
2441#ifdef CONFIG_TRACING
2442extern void
2443__trace_special(void *__tr, void *__data,
2444 unsigned long arg1, unsigned long arg2, unsigned long arg3);
2445#else
2446static inline void
2447__trace_special(void *__tr, void *__data,
2448 unsigned long arg1, unsigned long arg2, unsigned long arg3)
2449{
2450}
2451#endif
2452
2453extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask); 2434extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);
2454extern long sched_getaffinity(pid_t pid, struct cpumask *mask); 2435extern long sched_getaffinity(pid_t pid, struct cpumask *mask);
2455 2436
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c20d3ce673c0..c11a28706fa4 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -61,7 +61,7 @@ typedef struct sctphdr {
61 __be16 dest; 61 __be16 dest;
62 __be32 vtag; 62 __be32 vtag;
63 __le32 checksum; 63 __le32 checksum;
64} __attribute__((packed)) sctp_sctphdr_t; 64} __packed sctp_sctphdr_t;
65 65
66#ifdef __KERNEL__ 66#ifdef __KERNEL__
67#include <linux/skbuff.h> 67#include <linux/skbuff.h>
@@ -77,7 +77,7 @@ typedef struct sctp_chunkhdr {
77 __u8 type; 77 __u8 type;
78 __u8 flags; 78 __u8 flags;
79 __be16 length; 79 __be16 length;
80} __attribute__((packed)) sctp_chunkhdr_t; 80} __packed sctp_chunkhdr_t;
81 81
82 82
83/* Section 3.2. Chunk Type Values. 83/* Section 3.2. Chunk Type Values.
@@ -167,7 +167,7 @@ enum { SCTP_CHUNK_FLAG_T = 0x01 };
167typedef struct sctp_paramhdr { 167typedef struct sctp_paramhdr {
168 __be16 type; 168 __be16 type;
169 __be16 length; 169 __be16 length;
170} __attribute__((packed)) sctp_paramhdr_t; 170} __packed sctp_paramhdr_t;
171 171
172typedef enum { 172typedef enum {
173 173
@@ -228,12 +228,12 @@ typedef struct sctp_datahdr {
228 __be16 ssn; 228 __be16 ssn;
229 __be32 ppid; 229 __be32 ppid;
230 __u8 payload[0]; 230 __u8 payload[0];
231} __attribute__((packed)) sctp_datahdr_t; 231} __packed sctp_datahdr_t;
232 232
233typedef struct sctp_data_chunk { 233typedef struct sctp_data_chunk {
234 sctp_chunkhdr_t chunk_hdr; 234 sctp_chunkhdr_t chunk_hdr;
235 sctp_datahdr_t data_hdr; 235 sctp_datahdr_t data_hdr;
236} __attribute__((packed)) sctp_data_chunk_t; 236} __packed sctp_data_chunk_t;
237 237
238/* DATA Chuck Specific Flags */ 238/* DATA Chuck Specific Flags */
239enum { 239enum {
@@ -259,78 +259,78 @@ typedef struct sctp_inithdr {
259 __be16 num_inbound_streams; 259 __be16 num_inbound_streams;
260 __be32 initial_tsn; 260 __be32 initial_tsn;
261 __u8 params[0]; 261 __u8 params[0];
262} __attribute__((packed)) sctp_inithdr_t; 262} __packed sctp_inithdr_t;
263 263
264typedef struct sctp_init_chunk { 264typedef struct sctp_init_chunk {
265 sctp_chunkhdr_t chunk_hdr; 265 sctp_chunkhdr_t chunk_hdr;
266 sctp_inithdr_t init_hdr; 266 sctp_inithdr_t init_hdr;
267} __attribute__((packed)) sctp_init_chunk_t; 267} __packed sctp_init_chunk_t;
268 268
269 269
270/* Section 3.3.2.1. IPv4 Address Parameter (5) */ 270/* Section 3.3.2.1. IPv4 Address Parameter (5) */
271typedef struct sctp_ipv4addr_param { 271typedef struct sctp_ipv4addr_param {
272 sctp_paramhdr_t param_hdr; 272 sctp_paramhdr_t param_hdr;
273 struct in_addr addr; 273 struct in_addr addr;
274} __attribute__((packed)) sctp_ipv4addr_param_t; 274} __packed sctp_ipv4addr_param_t;
275 275
276/* Section 3.3.2.1. IPv6 Address Parameter (6) */ 276/* Section 3.3.2.1. IPv6 Address Parameter (6) */
277typedef struct sctp_ipv6addr_param { 277typedef struct sctp_ipv6addr_param {
278 sctp_paramhdr_t param_hdr; 278 sctp_paramhdr_t param_hdr;
279 struct in6_addr addr; 279 struct in6_addr addr;
280} __attribute__((packed)) sctp_ipv6addr_param_t; 280} __packed sctp_ipv6addr_param_t;
281 281
282/* Section 3.3.2.1 Cookie Preservative (9) */ 282/* Section 3.3.2.1 Cookie Preservative (9) */
283typedef struct sctp_cookie_preserve_param { 283typedef struct sctp_cookie_preserve_param {
284 sctp_paramhdr_t param_hdr; 284 sctp_paramhdr_t param_hdr;
285 __be32 lifespan_increment; 285 __be32 lifespan_increment;
286} __attribute__((packed)) sctp_cookie_preserve_param_t; 286} __packed sctp_cookie_preserve_param_t;
287 287
288/* Section 3.3.2.1 Host Name Address (11) */ 288/* Section 3.3.2.1 Host Name Address (11) */
289typedef struct sctp_hostname_param { 289typedef struct sctp_hostname_param {
290 sctp_paramhdr_t param_hdr; 290 sctp_paramhdr_t param_hdr;
291 uint8_t hostname[0]; 291 uint8_t hostname[0];
292} __attribute__((packed)) sctp_hostname_param_t; 292} __packed sctp_hostname_param_t;
293 293
294/* Section 3.3.2.1 Supported Address Types (12) */ 294/* Section 3.3.2.1 Supported Address Types (12) */
295typedef struct sctp_supported_addrs_param { 295typedef struct sctp_supported_addrs_param {
296 sctp_paramhdr_t param_hdr; 296 sctp_paramhdr_t param_hdr;
297 __be16 types[0]; 297 __be16 types[0];
298} __attribute__((packed)) sctp_supported_addrs_param_t; 298} __packed sctp_supported_addrs_param_t;
299 299
300/* Appendix A. ECN Capable (32768) */ 300/* Appendix A. ECN Capable (32768) */
301typedef struct sctp_ecn_capable_param { 301typedef struct sctp_ecn_capable_param {
302 sctp_paramhdr_t param_hdr; 302 sctp_paramhdr_t param_hdr;
303} __attribute__((packed)) sctp_ecn_capable_param_t; 303} __packed sctp_ecn_capable_param_t;
304 304
305/* ADDIP Section 3.2.6 Adaptation Layer Indication */ 305/* ADDIP Section 3.2.6 Adaptation Layer Indication */
306typedef struct sctp_adaptation_ind_param { 306typedef struct sctp_adaptation_ind_param {
307 struct sctp_paramhdr param_hdr; 307 struct sctp_paramhdr param_hdr;
308 __be32 adaptation_ind; 308 __be32 adaptation_ind;
309} __attribute__((packed)) sctp_adaptation_ind_param_t; 309} __packed sctp_adaptation_ind_param_t;
310 310
311/* ADDIP Section 4.2.7 Supported Extensions Parameter */ 311/* ADDIP Section 4.2.7 Supported Extensions Parameter */
312typedef struct sctp_supported_ext_param { 312typedef struct sctp_supported_ext_param {
313 struct sctp_paramhdr param_hdr; 313 struct sctp_paramhdr param_hdr;
314 __u8 chunks[0]; 314 __u8 chunks[0];
315} __attribute__((packed)) sctp_supported_ext_param_t; 315} __packed sctp_supported_ext_param_t;
316 316
317/* AUTH Section 3.1 Random */ 317/* AUTH Section 3.1 Random */
318typedef struct sctp_random_param { 318typedef struct sctp_random_param {
319 sctp_paramhdr_t param_hdr; 319 sctp_paramhdr_t param_hdr;
320 __u8 random_val[0]; 320 __u8 random_val[0];
321} __attribute__((packed)) sctp_random_param_t; 321} __packed sctp_random_param_t;
322 322
323/* AUTH Section 3.2 Chunk List */ 323/* AUTH Section 3.2 Chunk List */
324typedef struct sctp_chunks_param { 324typedef struct sctp_chunks_param {
325 sctp_paramhdr_t param_hdr; 325 sctp_paramhdr_t param_hdr;
326 __u8 chunks[0]; 326 __u8 chunks[0];
327} __attribute__((packed)) sctp_chunks_param_t; 327} __packed sctp_chunks_param_t;
328 328
329/* AUTH Section 3.3 HMAC Algorithm */ 329/* AUTH Section 3.3 HMAC Algorithm */
330typedef struct sctp_hmac_algo_param { 330typedef struct sctp_hmac_algo_param {
331 sctp_paramhdr_t param_hdr; 331 sctp_paramhdr_t param_hdr;
332 __be16 hmac_ids[0]; 332 __be16 hmac_ids[0];
333} __attribute__((packed)) sctp_hmac_algo_param_t; 333} __packed sctp_hmac_algo_param_t;
334 334
335/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2): 335/* RFC 2960. Section 3.3.3 Initiation Acknowledgement (INIT ACK) (2):
336 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP 336 * The INIT ACK chunk is used to acknowledge the initiation of an SCTP
@@ -342,13 +342,13 @@ typedef sctp_init_chunk_t sctp_initack_chunk_t;
342typedef struct sctp_cookie_param { 342typedef struct sctp_cookie_param {
343 sctp_paramhdr_t p; 343 sctp_paramhdr_t p;
344 __u8 body[0]; 344 __u8 body[0];
345} __attribute__((packed)) sctp_cookie_param_t; 345} __packed sctp_cookie_param_t;
346 346
347/* Section 3.3.3.1 Unrecognized Parameters (8) */ 347/* Section 3.3.3.1 Unrecognized Parameters (8) */
348typedef struct sctp_unrecognized_param { 348typedef struct sctp_unrecognized_param {
349 sctp_paramhdr_t param_hdr; 349 sctp_paramhdr_t param_hdr;
350 sctp_paramhdr_t unrecognized; 350 sctp_paramhdr_t unrecognized;
351} __attribute__((packed)) sctp_unrecognized_param_t; 351} __packed sctp_unrecognized_param_t;
352 352
353 353
354 354
@@ -363,7 +363,7 @@ typedef struct sctp_unrecognized_param {
363typedef struct sctp_gap_ack_block { 363typedef struct sctp_gap_ack_block {
364 __be16 start; 364 __be16 start;
365 __be16 end; 365 __be16 end;
366} __attribute__((packed)) sctp_gap_ack_block_t; 366} __packed sctp_gap_ack_block_t;
367 367
368typedef __be32 sctp_dup_tsn_t; 368typedef __be32 sctp_dup_tsn_t;
369 369
@@ -378,12 +378,12 @@ typedef struct sctp_sackhdr {
378 __be16 num_gap_ack_blocks; 378 __be16 num_gap_ack_blocks;
379 __be16 num_dup_tsns; 379 __be16 num_dup_tsns;
380 sctp_sack_variable_t variable[0]; 380 sctp_sack_variable_t variable[0];
381} __attribute__((packed)) sctp_sackhdr_t; 381} __packed sctp_sackhdr_t;
382 382
383typedef struct sctp_sack_chunk { 383typedef struct sctp_sack_chunk {
384 sctp_chunkhdr_t chunk_hdr; 384 sctp_chunkhdr_t chunk_hdr;
385 sctp_sackhdr_t sack_hdr; 385 sctp_sackhdr_t sack_hdr;
386} __attribute__((packed)) sctp_sack_chunk_t; 386} __packed sctp_sack_chunk_t;
387 387
388 388
389/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4): 389/* RFC 2960. Section 3.3.5 Heartbeat Request (HEARTBEAT) (4):
@@ -395,12 +395,12 @@ typedef struct sctp_sack_chunk {
395 395
396typedef struct sctp_heartbeathdr { 396typedef struct sctp_heartbeathdr {
397 sctp_paramhdr_t info; 397 sctp_paramhdr_t info;
398} __attribute__((packed)) sctp_heartbeathdr_t; 398} __packed sctp_heartbeathdr_t;
399 399
400typedef struct sctp_heartbeat_chunk { 400typedef struct sctp_heartbeat_chunk {
401 sctp_chunkhdr_t chunk_hdr; 401 sctp_chunkhdr_t chunk_hdr;
402 sctp_heartbeathdr_t hb_hdr; 402 sctp_heartbeathdr_t hb_hdr;
403} __attribute__((packed)) sctp_heartbeat_chunk_t; 403} __packed sctp_heartbeat_chunk_t;
404 404
405 405
406/* For the abort and shutdown ACK we must carry the init tag in the 406/* For the abort and shutdown ACK we must carry the init tag in the
@@ -409,7 +409,7 @@ typedef struct sctp_heartbeat_chunk {
409 */ 409 */
410typedef struct sctp_abort_chunk { 410typedef struct sctp_abort_chunk {
411 sctp_chunkhdr_t uh; 411 sctp_chunkhdr_t uh;
412} __attribute__((packed)) sctp_abort_chunk_t; 412} __packed sctp_abort_chunk_t;
413 413
414 414
415/* For the graceful shutdown we must carry the tag (in common header) 415/* For the graceful shutdown we must carry the tag (in common header)
@@ -417,12 +417,12 @@ typedef struct sctp_abort_chunk {
417 */ 417 */
418typedef struct sctp_shutdownhdr { 418typedef struct sctp_shutdownhdr {
419 __be32 cum_tsn_ack; 419 __be32 cum_tsn_ack;
420} __attribute__((packed)) sctp_shutdownhdr_t; 420} __packed sctp_shutdownhdr_t;
421 421
422struct sctp_shutdown_chunk_t { 422struct sctp_shutdown_chunk_t {
423 sctp_chunkhdr_t chunk_hdr; 423 sctp_chunkhdr_t chunk_hdr;
424 sctp_shutdownhdr_t shutdown_hdr; 424 sctp_shutdownhdr_t shutdown_hdr;
425} __attribute__ ((packed)); 425} __packed;
426 426
427/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ 427/* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */
428 428
@@ -430,12 +430,12 @@ typedef struct sctp_errhdr {
430 __be16 cause; 430 __be16 cause;
431 __be16 length; 431 __be16 length;
432 __u8 variable[0]; 432 __u8 variable[0];
433} __attribute__((packed)) sctp_errhdr_t; 433} __packed sctp_errhdr_t;
434 434
435typedef struct sctp_operr_chunk { 435typedef struct sctp_operr_chunk {
436 sctp_chunkhdr_t chunk_hdr; 436 sctp_chunkhdr_t chunk_hdr;
437 sctp_errhdr_t err_hdr; 437 sctp_errhdr_t err_hdr;
438} __attribute__((packed)) sctp_operr_chunk_t; 438} __packed sctp_operr_chunk_t;
439 439
440/* RFC 2960 3.3.10 - Operation Error 440/* RFC 2960 3.3.10 - Operation Error
441 * 441 *
@@ -525,7 +525,7 @@ typedef struct sctp_ecnehdr {
525typedef struct sctp_ecne_chunk { 525typedef struct sctp_ecne_chunk {
526 sctp_chunkhdr_t chunk_hdr; 526 sctp_chunkhdr_t chunk_hdr;
527 sctp_ecnehdr_t ence_hdr; 527 sctp_ecnehdr_t ence_hdr;
528} __attribute__((packed)) sctp_ecne_chunk_t; 528} __packed sctp_ecne_chunk_t;
529 529
530/* RFC 2960. Appendix A. Explicit Congestion Notification. 530/* RFC 2960. Appendix A. Explicit Congestion Notification.
531 * Congestion Window Reduced (CWR) (13) 531 * Congestion Window Reduced (CWR) (13)
@@ -537,7 +537,7 @@ typedef struct sctp_cwrhdr {
537typedef struct sctp_cwr_chunk { 537typedef struct sctp_cwr_chunk {
538 sctp_chunkhdr_t chunk_hdr; 538 sctp_chunkhdr_t chunk_hdr;
539 sctp_cwrhdr_t cwr_hdr; 539 sctp_cwrhdr_t cwr_hdr;
540} __attribute__((packed)) sctp_cwr_chunk_t; 540} __packed sctp_cwr_chunk_t;
541 541
542/* PR-SCTP 542/* PR-SCTP
543 * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN) 543 * 3.2 Forward Cumulative TSN Chunk Definition (FORWARD TSN)
@@ -588,17 +588,17 @@ typedef struct sctp_cwr_chunk {
588struct sctp_fwdtsn_skip { 588struct sctp_fwdtsn_skip {
589 __be16 stream; 589 __be16 stream;
590 __be16 ssn; 590 __be16 ssn;
591} __attribute__((packed)); 591} __packed;
592 592
593struct sctp_fwdtsn_hdr { 593struct sctp_fwdtsn_hdr {
594 __be32 new_cum_tsn; 594 __be32 new_cum_tsn;
595 struct sctp_fwdtsn_skip skip[0]; 595 struct sctp_fwdtsn_skip skip[0];
596} __attribute((packed)); 596} __packed;
597 597
598struct sctp_fwdtsn_chunk { 598struct sctp_fwdtsn_chunk {
599 struct sctp_chunkhdr chunk_hdr; 599 struct sctp_chunkhdr chunk_hdr;
600 struct sctp_fwdtsn_hdr fwdtsn_hdr; 600 struct sctp_fwdtsn_hdr fwdtsn_hdr;
601} __attribute((packed)); 601} __packed;
602 602
603 603
604/* ADDIP 604/* ADDIP
@@ -636,17 +636,17 @@ struct sctp_fwdtsn_chunk {
636typedef struct sctp_addip_param { 636typedef struct sctp_addip_param {
637 sctp_paramhdr_t param_hdr; 637 sctp_paramhdr_t param_hdr;
638 __be32 crr_id; 638 __be32 crr_id;
639} __attribute__((packed)) sctp_addip_param_t; 639} __packed sctp_addip_param_t;
640 640
641typedef struct sctp_addiphdr { 641typedef struct sctp_addiphdr {
642 __be32 serial; 642 __be32 serial;
643 __u8 params[0]; 643 __u8 params[0];
644} __attribute__((packed)) sctp_addiphdr_t; 644} __packed sctp_addiphdr_t;
645 645
646typedef struct sctp_addip_chunk { 646typedef struct sctp_addip_chunk {
647 sctp_chunkhdr_t chunk_hdr; 647 sctp_chunkhdr_t chunk_hdr;
648 sctp_addiphdr_t addip_hdr; 648 sctp_addiphdr_t addip_hdr;
649} __attribute__((packed)) sctp_addip_chunk_t; 649} __packed sctp_addip_chunk_t;
650 650
651/* AUTH 651/* AUTH
652 * Section 4.1 Authentication Chunk (AUTH) 652 * Section 4.1 Authentication Chunk (AUTH)
@@ -701,11 +701,11 @@ typedef struct sctp_authhdr {
701 __be16 shkey_id; 701 __be16 shkey_id;
702 __be16 hmac_id; 702 __be16 hmac_id;
703 __u8 hmac[0]; 703 __u8 hmac[0];
704} __attribute__((packed)) sctp_authhdr_t; 704} __packed sctp_authhdr_t;
705 705
706typedef struct sctp_auth_chunk { 706typedef struct sctp_auth_chunk {
707 sctp_chunkhdr_t chunk_hdr; 707 sctp_chunkhdr_t chunk_hdr;
708 sctp_authhdr_t auth_hdr; 708 sctp_authhdr_t auth_hdr;
709} __attribute__((packed)) sctp_auth_chunk_t; 709} __packed sctp_auth_chunk_t;
710 710
711#endif /* __LINUX_SCTP_H__ */ 711#endif /* __LINUX_SCTP_H__ */
diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h
new file mode 100644
index 000000000000..0239bd70241e
--- /dev/null
+++ b/include/linux/sdhci-pltfm.h
@@ -0,0 +1,35 @@
1/*
2 * Platform data declarations for the sdhci-pltfm driver.
3 *
4 * Copyright (c) 2010 MontaVista Software, LLC.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
12 */
13
14#ifndef _SDHCI_PLTFM_H
15#define _SDHCI_PLTFM_H
16
17struct sdhci_ops;
18struct sdhci_host;
19
20/**
21 * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks
22 * @ops: optional pointer to the platform-provided SDHCI ops
23 * @quirks: optional SDHCI quirks
24 * @init: optional hook that is called during device probe, before the
25 * driver tries to access any SDHCI registers
26 * @exit: optional hook that is called during device removal
27 */
28struct sdhci_pltfm_data {
29 struct sdhci_ops *ops;
30 unsigned int quirks;
31 int (*init)(struct sdhci_host *host);
32 void (*exit)(struct sdhci_host *host);
33};
34
35#endif /* _SDHCI_PLTFM_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 3158dd982d27..a22219afff09 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -23,6 +23,7 @@
23#define __LINUX_SECURITY_H 23#define __LINUX_SECURITY_H
24 24
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h>
26#include <linux/binfmts.h> 27#include <linux/binfmts.h>
27#include <linux/signal.h> 28#include <linux/signal.h>
28#include <linux/resource.h> 29#include <linux/resource.h>
@@ -267,49 +268,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
267 * @orig the original mount data copied from userspace. 268 * @orig the original mount data copied from userspace.
268 * @copy copied data which will be passed to the security module. 269 * @copy copied data which will be passed to the security module.
269 * Returns 0 if the copy was successful. 270 * Returns 0 if the copy was successful.
270 * @sb_check_sb:
271 * Check permission before the device with superblock @mnt->sb is mounted
272 * on the mount point named by @nd.
273 * @mnt contains the vfsmount for device being mounted.
274 * @path contains the path for the mount point.
275 * Return 0 if permission is granted.
276 * @sb_umount: 271 * @sb_umount:
277 * Check permission before the @mnt file system is unmounted. 272 * Check permission before the @mnt file system is unmounted.
278 * @mnt contains the mounted file system. 273 * @mnt contains the mounted file system.
279 * @flags contains the unmount flags, e.g. MNT_FORCE. 274 * @flags contains the unmount flags, e.g. MNT_FORCE.
280 * Return 0 if permission is granted. 275 * Return 0 if permission is granted.
281 * @sb_umount_close:
282 * Close any files in the @mnt mounted filesystem that are held open by
283 * the security module. This hook is called during an umount operation
284 * prior to checking whether the filesystem is still busy.
285 * @mnt contains the mounted filesystem.
286 * @sb_umount_busy:
287 * Handle a failed umount of the @mnt mounted filesystem, e.g. re-opening
288 * any files that were closed by umount_close. This hook is called during
289 * an umount operation if the umount fails after a call to the
290 * umount_close hook.
291 * @mnt contains the mounted filesystem.
292 * @sb_post_remount:
293 * Update the security module's state when a filesystem is remounted.
294 * This hook is only called if the remount was successful.
295 * @mnt contains the mounted file system.
296 * @flags contains the new filesystem flags.
297 * @data contains the filesystem-specific data.
298 * @sb_post_addmount:
299 * Update the security module's state when a filesystem is mounted.
300 * This hook is called any time a mount is successfully grafetd to
301 * the tree.
302 * @mnt contains the mounted filesystem.
303 * @mountpoint contains the path for the mount point.
304 * @sb_pivotroot: 276 * @sb_pivotroot:
305 * Check permission before pivoting the root filesystem. 277 * Check permission before pivoting the root filesystem.
306 * @old_path contains the path for the new location of the current root (put_old). 278 * @old_path contains the path for the new location of the current root (put_old).
307 * @new_path contains the path for the new root (new_root). 279 * @new_path contains the path for the new root (new_root).
308 * Return 0 if permission is granted. 280 * Return 0 if permission is granted.
309 * @sb_post_pivotroot:
310 * Update module state after a successful pivot.
311 * @old_path contains the path for the old root.
312 * @new_path contains the path for the new root.
313 * @sb_set_mnt_opts: 281 * @sb_set_mnt_opts:
314 * Set the security relevant mount options used for a superblock 282 * Set the security relevant mount options used for a superblock
315 * @sb the superblock to set security mount options for 283 * @sb the superblock to set security mount options for
@@ -503,20 +471,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
503 * @path_truncate: 471 * @path_truncate:
504 * Check permission before truncating a file. 472 * Check permission before truncating a file.
505 * @path contains the path structure for the file. 473 * @path contains the path structure for the file.
506 * @length is the new length of the file.
507 * @time_attrs is the flags passed to do_truncate().
508 * Return 0 if permission is granted. 474 * Return 0 if permission is granted.
509 * @inode_getattr: 475 * @inode_getattr:
510 * Check permission before obtaining file attributes. 476 * Check permission before obtaining file attributes.
511 * @mnt is the vfsmount where the dentry was looked up 477 * @mnt is the vfsmount where the dentry was looked up
512 * @dentry contains the dentry structure for the file. 478 * @dentry contains the dentry structure for the file.
513 * Return 0 if permission is granted. 479 * Return 0 if permission is granted.
514 * @inode_delete:
515 * @inode contains the inode structure for deleted inode.
516 * This hook is called when a deleted inode is released (i.e. an inode
517 * with no hard links has its use count drop to zero). A security module
518 * can use this hook to release any persistent label associated with the
519 * inode.
520 * @inode_setxattr: 480 * @inode_setxattr:
521 * Check permission before setting the extended attributes 481 * Check permission before setting the extended attributes
522 * @value identified by @name for @dentry. 482 * @value identified by @name for @dentry.
@@ -691,10 +651,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
691 * @old points to the original credentials. 651 * @old points to the original credentials.
692 * @gfp indicates the atomicity of any memory allocations. 652 * @gfp indicates the atomicity of any memory allocations.
693 * Prepare a new set of credentials by copying the data from the old set. 653 * Prepare a new set of credentials by copying the data from the old set.
694 * @cred_commit:
695 * @new points to the new credentials.
696 * @old points to the original credentials.
697 * Install a new set of credentials.
698 * @cred_transfer: 654 * @cred_transfer:
699 * @new points to the new credentials. 655 * @new points to the new credentials.
700 * @old points to the original credentials. 656 * @old points to the original credentials.
@@ -717,18 +673,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
717 * userspace to load a kernel module with the given name. 673 * userspace to load a kernel module with the given name.
718 * @kmod_name name of the module requested by the kernel 674 * @kmod_name name of the module requested by the kernel
719 * Return 0 if successful. 675 * Return 0 if successful.
720 * @task_setuid:
721 * Check permission before setting one or more of the user identity
722 * attributes of the current process. The @flags parameter indicates
723 * which of the set*uid system calls invoked this hook and how to
724 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
725 * definitions at the beginning of this file for the @flags values and
726 * their meanings.
727 * @id0 contains a uid.
728 * @id1 contains a uid.
729 * @id2 contains a uid.
730 * @flags contains one of the LSM_SETID_* values.
731 * Return 0 if permission is granted.
732 * @task_fix_setuid: 676 * @task_fix_setuid:
733 * Update the module's state after setting one or more of the user 677 * Update the module's state after setting one or more of the user
734 * identity attributes of the current process. The @flags parameter 678 * identity attributes of the current process. The @flags parameter
@@ -738,18 +682,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
738 * @old is the set of credentials that are being replaces 682 * @old is the set of credentials that are being replaces
739 * @flags contains one of the LSM_SETID_* values. 683 * @flags contains one of the LSM_SETID_* values.
740 * Return 0 on success. 684 * Return 0 on success.
741 * @task_setgid:
742 * Check permission before setting one or more of the group identity
743 * attributes of the current process. The @flags parameter indicates
744 * which of the set*gid system calls invoked this hook and how to
745 * interpret the @id0, @id1, and @id2 parameters. See the LSM_SETID
746 * definitions at the beginning of this file for the @flags values and
747 * their meanings.
748 * @id0 contains a gid.
749 * @id1 contains a gid.
750 * @id2 contains a gid.
751 * @flags contains one of the LSM_SETID_* values.
752 * Return 0 if permission is granted.
753 * @task_setpgid: 685 * @task_setpgid:
754 * Check permission before setting the process group identifier of the 686 * Check permission before setting the process group identifier of the
755 * process @p to @pgid. 687 * process @p to @pgid.
@@ -771,11 +703,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
771 * @p contains the task_struct for the process and place is into @secid. 703 * @p contains the task_struct for the process and place is into @secid.
772 * In case of failure, @secid will be set to zero. 704 * In case of failure, @secid will be set to zero.
773 * 705 *
774 * @task_setgroups:
775 * Check permission before setting the supplementary group set of the
776 * current process.
777 * @group_info contains the new group information.
778 * Return 0 if permission is granted.
779 * @task_setnice: 706 * @task_setnice:
780 * Check permission before setting the nice value of @p to @nice. 707 * Check permission before setting the nice value of @p to @nice.
781 * @p contains the task_struct of process. 708 * @p contains the task_struct of process.
@@ -1139,13 +1066,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1139 * Return the length of the string (including terminating NUL) or -ve if 1066 * Return the length of the string (including terminating NUL) or -ve if
1140 * an error. 1067 * an error.
1141 * May also return 0 (and a NULL buffer pointer) if there is no label. 1068 * May also return 0 (and a NULL buffer pointer) if there is no label.
1142 * @key_session_to_parent:
1143 * Forcibly assign the session keyring from a process to its parent
1144 * process.
1145 * @cred: Pointer to process's credentials
1146 * @parent_cred: Pointer to parent process's credentials
1147 * @keyring: Proposed new session keyring
1148 * Return 0 if permission is granted, -ve error otherwise.
1149 * 1069 *
1150 * Security hooks affecting all System V IPC operations. 1070 * Security hooks affecting all System V IPC operations.
1151 * 1071 *
@@ -1333,13 +1253,6 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1333 * @cap contains the capability <include/linux/capability.h>. 1253 * @cap contains the capability <include/linux/capability.h>.
1334 * @audit: Whether to write an audit message or not 1254 * @audit: Whether to write an audit message or not
1335 * Return 0 if the capability is granted for @tsk. 1255 * Return 0 if the capability is granted for @tsk.
1336 * @acct:
1337 * Check permission before enabling or disabling process accounting. If
1338 * accounting is being enabled, then @file refers to the open file used to
1339 * store accounting records. If accounting is being disabled, then @file
1340 * is NULL.
1341 * @file contains the file structure for the accounting file (may be NULL).
1342 * Return 0 if permission is granted.
1343 * @sysctl: 1256 * @sysctl:
1344 * Check permission before accessing the @table sysctl variable in the 1257 * Check permission before accessing the @table sysctl variable in the
1345 * manner specified by @op. 1258 * manner specified by @op.
@@ -1462,7 +1375,6 @@ struct security_operations {
1462 const kernel_cap_t *permitted); 1375 const kernel_cap_t *permitted);
1463 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1376 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1464 int cap, int audit); 1377 int cap, int audit);
1465 int (*acct) (struct file *file);
1466 int (*sysctl) (struct ctl_table *table, int op); 1378 int (*sysctl) (struct ctl_table *table, int op);
1467 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1379 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1468 int (*quota_on) (struct dentry *dentry); 1380 int (*quota_on) (struct dentry *dentry);
@@ -1484,18 +1396,9 @@ struct security_operations {
1484 int (*sb_statfs) (struct dentry *dentry); 1396 int (*sb_statfs) (struct dentry *dentry);
1485 int (*sb_mount) (char *dev_name, struct path *path, 1397 int (*sb_mount) (char *dev_name, struct path *path,
1486 char *type, unsigned long flags, void *data); 1398 char *type, unsigned long flags, void *data);
1487 int (*sb_check_sb) (struct vfsmount *mnt, struct path *path);
1488 int (*sb_umount) (struct vfsmount *mnt, int flags); 1399 int (*sb_umount) (struct vfsmount *mnt, int flags);
1489 void (*sb_umount_close) (struct vfsmount *mnt);
1490 void (*sb_umount_busy) (struct vfsmount *mnt);
1491 void (*sb_post_remount) (struct vfsmount *mnt,
1492 unsigned long flags, void *data);
1493 void (*sb_post_addmount) (struct vfsmount *mnt,
1494 struct path *mountpoint);
1495 int (*sb_pivotroot) (struct path *old_path, 1400 int (*sb_pivotroot) (struct path *old_path,
1496 struct path *new_path); 1401 struct path *new_path);
1497 void (*sb_post_pivotroot) (struct path *old_path,
1498 struct path *new_path);
1499 int (*sb_set_mnt_opts) (struct super_block *sb, 1402 int (*sb_set_mnt_opts) (struct super_block *sb,
1500 struct security_mnt_opts *opts); 1403 struct security_mnt_opts *opts);
1501 void (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1404 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
@@ -1508,8 +1411,7 @@ struct security_operations {
1508 int (*path_rmdir) (struct path *dir, struct dentry *dentry); 1411 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1509 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode, 1412 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
1510 unsigned int dev); 1413 unsigned int dev);
1511 int (*path_truncate) (struct path *path, loff_t length, 1414 int (*path_truncate) (struct path *path);
1512 unsigned int time_attrs);
1513 int (*path_symlink) (struct path *dir, struct dentry *dentry, 1415 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1514 const char *old_name); 1416 const char *old_name);
1515 int (*path_link) (struct dentry *old_dentry, struct path *new_dir, 1417 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
@@ -1544,7 +1446,6 @@ struct security_operations {
1544 int (*inode_permission) (struct inode *inode, int mask); 1446 int (*inode_permission) (struct inode *inode, int mask);
1545 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1447 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1546 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1448 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1547 void (*inode_delete) (struct inode *inode);
1548 int (*inode_setxattr) (struct dentry *dentry, const char *name, 1449 int (*inode_setxattr) (struct dentry *dentry, const char *name,
1549 const void *value, size_t size, int flags); 1450 const void *value, size_t size, int flags);
1550 void (*inode_post_setxattr) (struct dentry *dentry, const char *name, 1451 void (*inode_post_setxattr) (struct dentry *dentry, const char *name,
@@ -1585,24 +1486,21 @@ struct security_operations {
1585 void (*cred_free) (struct cred *cred); 1486 void (*cred_free) (struct cred *cred);
1586 int (*cred_prepare)(struct cred *new, const struct cred *old, 1487 int (*cred_prepare)(struct cred *new, const struct cred *old,
1587 gfp_t gfp); 1488 gfp_t gfp);
1588 void (*cred_commit)(struct cred *new, const struct cred *old);
1589 void (*cred_transfer)(struct cred *new, const struct cred *old); 1489 void (*cred_transfer)(struct cred *new, const struct cred *old);
1590 int (*kernel_act_as)(struct cred *new, u32 secid); 1490 int (*kernel_act_as)(struct cred *new, u32 secid);
1591 int (*kernel_create_files_as)(struct cred *new, struct inode *inode); 1491 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1592 int (*kernel_module_request)(char *kmod_name); 1492 int (*kernel_module_request)(char *kmod_name);
1593 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1594 int (*task_fix_setuid) (struct cred *new, const struct cred *old, 1493 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1595 int flags); 1494 int flags);
1596 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1597 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1495 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1598 int (*task_getpgid) (struct task_struct *p); 1496 int (*task_getpgid) (struct task_struct *p);
1599 int (*task_getsid) (struct task_struct *p); 1497 int (*task_getsid) (struct task_struct *p);
1600 void (*task_getsecid) (struct task_struct *p, u32 *secid); 1498 void (*task_getsecid) (struct task_struct *p, u32 *secid);
1601 int (*task_setgroups) (struct group_info *group_info);
1602 int (*task_setnice) (struct task_struct *p, int nice); 1499 int (*task_setnice) (struct task_struct *p, int nice);
1603 int (*task_setioprio) (struct task_struct *p, int ioprio); 1500 int (*task_setioprio) (struct task_struct *p, int ioprio);
1604 int (*task_getioprio) (struct task_struct *p); 1501 int (*task_getioprio) (struct task_struct *p);
1605 int (*task_setrlimit) (unsigned int resource, struct rlimit *new_rlim); 1502 int (*task_setrlimit) (struct task_struct *p, unsigned int resource,
1503 struct rlimit *new_rlim);
1606 int (*task_setscheduler) (struct task_struct *p, int policy, 1504 int (*task_setscheduler) (struct task_struct *p, int policy,
1607 struct sched_param *lp); 1505 struct sched_param *lp);
1608 int (*task_getscheduler) (struct task_struct *p); 1506 int (*task_getscheduler) (struct task_struct *p);
@@ -1728,9 +1626,6 @@ struct security_operations {
1728 const struct cred *cred, 1626 const struct cred *cred,
1729 key_perm_t perm); 1627 key_perm_t perm);
1730 int (*key_getsecurity)(struct key *key, char **_buffer); 1628 int (*key_getsecurity)(struct key *key, char **_buffer);
1731 int (*key_session_to_parent)(const struct cred *cred,
1732 const struct cred *parent_cred,
1733 struct key *key);
1734#endif /* CONFIG_KEYS */ 1629#endif /* CONFIG_KEYS */
1735 1630
1736#ifdef CONFIG_AUDIT 1631#ifdef CONFIG_AUDIT
@@ -1761,7 +1656,6 @@ int security_capset(struct cred *new, const struct cred *old,
1761int security_capable(int cap); 1656int security_capable(int cap);
1762int security_real_capable(struct task_struct *tsk, int cap); 1657int security_real_capable(struct task_struct *tsk, int cap);
1763int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1658int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1764int security_acct(struct file *file);
1765int security_sysctl(struct ctl_table *table, int op); 1659int security_sysctl(struct ctl_table *table, int op);
1766int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1660int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1767int security_quota_on(struct dentry *dentry); 1661int security_quota_on(struct dentry *dentry);
@@ -1783,14 +1677,8 @@ int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1783int security_sb_statfs(struct dentry *dentry); 1677int security_sb_statfs(struct dentry *dentry);
1784int security_sb_mount(char *dev_name, struct path *path, 1678int security_sb_mount(char *dev_name, struct path *path,
1785 char *type, unsigned long flags, void *data); 1679 char *type, unsigned long flags, void *data);
1786int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
1787int security_sb_umount(struct vfsmount *mnt, int flags); 1680int security_sb_umount(struct vfsmount *mnt, int flags);
1788void security_sb_umount_close(struct vfsmount *mnt);
1789void security_sb_umount_busy(struct vfsmount *mnt);
1790void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1791void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
1792int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1681int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1793void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
1794int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1682int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
1795void security_sb_clone_mnt_opts(const struct super_block *oldsb, 1683void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1796 struct super_block *newsb); 1684 struct super_block *newsb);
@@ -1816,7 +1704,6 @@ int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1816int security_inode_permission(struct inode *inode, int mask); 1704int security_inode_permission(struct inode *inode, int mask);
1817int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1705int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1818int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1706int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1819void security_inode_delete(struct inode *inode);
1820int security_inode_setxattr(struct dentry *dentry, const char *name, 1707int security_inode_setxattr(struct dentry *dentry, const char *name,
1821 const void *value, size_t size, int flags); 1708 const void *value, size_t size, int flags);
1822void security_inode_post_setxattr(struct dentry *dentry, const char *name, 1709void security_inode_post_setxattr(struct dentry *dentry, const char *name,
@@ -1850,24 +1737,21 @@ int security_task_create(unsigned long clone_flags);
1850int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); 1737int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
1851void security_cred_free(struct cred *cred); 1738void security_cred_free(struct cred *cred);
1852int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp); 1739int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1853void security_commit_creds(struct cred *new, const struct cred *old);
1854void security_transfer_creds(struct cred *new, const struct cred *old); 1740void security_transfer_creds(struct cred *new, const struct cred *old);
1855int security_kernel_act_as(struct cred *new, u32 secid); 1741int security_kernel_act_as(struct cred *new, u32 secid);
1856int security_kernel_create_files_as(struct cred *new, struct inode *inode); 1742int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1857int security_kernel_module_request(char *kmod_name); 1743int security_kernel_module_request(char *kmod_name);
1858int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1859int security_task_fix_setuid(struct cred *new, const struct cred *old, 1744int security_task_fix_setuid(struct cred *new, const struct cred *old,
1860 int flags); 1745 int flags);
1861int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1862int security_task_setpgid(struct task_struct *p, pid_t pgid); 1746int security_task_setpgid(struct task_struct *p, pid_t pgid);
1863int security_task_getpgid(struct task_struct *p); 1747int security_task_getpgid(struct task_struct *p);
1864int security_task_getsid(struct task_struct *p); 1748int security_task_getsid(struct task_struct *p);
1865void security_task_getsecid(struct task_struct *p, u32 *secid); 1749void security_task_getsecid(struct task_struct *p, u32 *secid);
1866int security_task_setgroups(struct group_info *group_info);
1867int security_task_setnice(struct task_struct *p, int nice); 1750int security_task_setnice(struct task_struct *p, int nice);
1868int security_task_setioprio(struct task_struct *p, int ioprio); 1751int security_task_setioprio(struct task_struct *p, int ioprio);
1869int security_task_getioprio(struct task_struct *p); 1752int security_task_getioprio(struct task_struct *p);
1870int security_task_setrlimit(unsigned int resource, struct rlimit *new_rlim); 1753int security_task_setrlimit(struct task_struct *p, unsigned int resource,
1754 struct rlimit *new_rlim);
1871int security_task_setscheduler(struct task_struct *p, 1755int security_task_setscheduler(struct task_struct *p,
1872 int policy, struct sched_param *lp); 1756 int policy, struct sched_param *lp);
1873int security_task_getscheduler(struct task_struct *p); 1757int security_task_getscheduler(struct task_struct *p);
@@ -1990,11 +1874,6 @@ int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1990 return ret; 1874 return ret;
1991} 1875}
1992 1876
1993static inline int security_acct(struct file *file)
1994{
1995 return 0;
1996}
1997
1998static inline int security_sysctl(struct ctl_table *table, int op) 1877static inline int security_sysctl(struct ctl_table *table, int op)
1999{ 1878{
2000 return 0; 1879 return 0;
@@ -2099,41 +1978,17 @@ static inline int security_sb_mount(char *dev_name, struct path *path,
2099 return 0; 1978 return 0;
2100} 1979}
2101 1980
2102static inline int security_sb_check_sb(struct vfsmount *mnt,
2103 struct path *path)
2104{
2105 return 0;
2106}
2107
2108static inline int security_sb_umount(struct vfsmount *mnt, int flags) 1981static inline int security_sb_umount(struct vfsmount *mnt, int flags)
2109{ 1982{
2110 return 0; 1983 return 0;
2111} 1984}
2112 1985
2113static inline void security_sb_umount_close(struct vfsmount *mnt)
2114{ }
2115
2116static inline void security_sb_umount_busy(struct vfsmount *mnt)
2117{ }
2118
2119static inline void security_sb_post_remount(struct vfsmount *mnt,
2120 unsigned long flags, void *data)
2121{ }
2122
2123static inline void security_sb_post_addmount(struct vfsmount *mnt,
2124 struct path *mountpoint)
2125{ }
2126
2127static inline int security_sb_pivotroot(struct path *old_path, 1986static inline int security_sb_pivotroot(struct path *old_path,
2128 struct path *new_path) 1987 struct path *new_path)
2129{ 1988{
2130 return 0; 1989 return 0;
2131} 1990}
2132 1991
2133static inline void security_sb_post_pivotroot(struct path *old_path,
2134 struct path *new_path)
2135{ }
2136
2137static inline int security_sb_set_mnt_opts(struct super_block *sb, 1992static inline int security_sb_set_mnt_opts(struct super_block *sb,
2138 struct security_mnt_opts *opts) 1993 struct security_mnt_opts *opts)
2139{ 1994{
@@ -2249,9 +2104,6 @@ static inline int security_inode_getattr(struct vfsmount *mnt,
2249 return 0; 2104 return 0;
2250} 2105}
2251 2106
2252static inline void security_inode_delete(struct inode *inode)
2253{ }
2254
2255static inline int security_inode_setxattr(struct dentry *dentry, 2107static inline int security_inode_setxattr(struct dentry *dentry,
2256 const char *name, const void *value, size_t size, int flags) 2108 const char *name, const void *value, size_t size, int flags)
2257{ 2109{
@@ -2398,11 +2250,6 @@ static inline int security_prepare_creds(struct cred *new,
2398 return 0; 2250 return 0;
2399} 2251}
2400 2252
2401static inline void security_commit_creds(struct cred *new,
2402 const struct cred *old)
2403{
2404}
2405
2406static inline void security_transfer_creds(struct cred *new, 2253static inline void security_transfer_creds(struct cred *new,
2407 const struct cred *old) 2254 const struct cred *old)
2408{ 2255{
@@ -2424,12 +2271,6 @@ static inline int security_kernel_module_request(char *kmod_name)
2424 return 0; 2271 return 0;
2425} 2272}
2426 2273
2427static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2428 int flags)
2429{
2430 return 0;
2431}
2432
2433static inline int security_task_fix_setuid(struct cred *new, 2274static inline int security_task_fix_setuid(struct cred *new,
2434 const struct cred *old, 2275 const struct cred *old,
2435 int flags) 2276 int flags)
@@ -2437,12 +2278,6 @@ static inline int security_task_fix_setuid(struct cred *new,
2437 return cap_task_fix_setuid(new, old, flags); 2278 return cap_task_fix_setuid(new, old, flags);
2438} 2279}
2439 2280
2440static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
2441 int flags)
2442{
2443 return 0;
2444}
2445
2446static inline int security_task_setpgid(struct task_struct *p, pid_t pgid) 2281static inline int security_task_setpgid(struct task_struct *p, pid_t pgid)
2447{ 2282{
2448 return 0; 2283 return 0;
@@ -2463,11 +2298,6 @@ static inline void security_task_getsecid(struct task_struct *p, u32 *secid)
2463 *secid = 0; 2298 *secid = 0;
2464} 2299}
2465 2300
2466static inline int security_task_setgroups(struct group_info *group_info)
2467{
2468 return 0;
2469}
2470
2471static inline int security_task_setnice(struct task_struct *p, int nice) 2301static inline int security_task_setnice(struct task_struct *p, int nice)
2472{ 2302{
2473 return cap_task_setnice(p, nice); 2303 return cap_task_setnice(p, nice);
@@ -2483,7 +2313,8 @@ static inline int security_task_getioprio(struct task_struct *p)
2483 return 0; 2313 return 0;
2484} 2314}
2485 2315
2486static inline int security_task_setrlimit(unsigned int resource, 2316static inline int security_task_setrlimit(struct task_struct *p,
2317 unsigned int resource,
2487 struct rlimit *new_rlim) 2318 struct rlimit *new_rlim)
2488{ 2319{
2489 return 0; 2320 return 0;
@@ -2976,8 +2807,7 @@ int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
2976int security_path_rmdir(struct path *dir, struct dentry *dentry); 2807int security_path_rmdir(struct path *dir, struct dentry *dentry);
2977int security_path_mknod(struct path *dir, struct dentry *dentry, int mode, 2808int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
2978 unsigned int dev); 2809 unsigned int dev);
2979int security_path_truncate(struct path *path, loff_t length, 2810int security_path_truncate(struct path *path);
2980 unsigned int time_attrs);
2981int security_path_symlink(struct path *dir, struct dentry *dentry, 2811int security_path_symlink(struct path *dir, struct dentry *dentry,
2982 const char *old_name); 2812 const char *old_name);
2983int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2813int security_path_link(struct dentry *old_dentry, struct path *new_dir,
@@ -3011,8 +2841,7 @@ static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
3011 return 0; 2841 return 0;
3012} 2842}
3013 2843
3014static inline int security_path_truncate(struct path *path, loff_t length, 2844static inline int security_path_truncate(struct path *path)
3015 unsigned int time_attrs)
3016{ 2845{
3017 return 0; 2846 return 0;
3018} 2847}
@@ -3064,9 +2893,6 @@ void security_key_free(struct key *key);
3064int security_key_permission(key_ref_t key_ref, 2893int security_key_permission(key_ref_t key_ref,
3065 const struct cred *cred, key_perm_t perm); 2894 const struct cred *cred, key_perm_t perm);
3066int security_key_getsecurity(struct key *key, char **_buffer); 2895int security_key_getsecurity(struct key *key, char **_buffer);
3067int security_key_session_to_parent(const struct cred *cred,
3068 const struct cred *parent_cred,
3069 struct key *key);
3070 2896
3071#else 2897#else
3072 2898
@@ -3094,13 +2920,6 @@ static inline int security_key_getsecurity(struct key *key, char **_buffer)
3094 return 0; 2920 return 0;
3095} 2921}
3096 2922
3097static inline int security_key_session_to_parent(const struct cred *cred,
3098 const struct cred *parent_cred,
3099 struct key *key)
3100{
3101 return 0;
3102}
3103
3104#endif 2923#endif
3105#endif /* CONFIG_KEYS */ 2924#endif /* CONFIG_KEYS */
3106 2925
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 8a4adbef8a0f..f2961afa2f66 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -79,6 +79,7 @@ struct seminfo {
79#ifdef __KERNEL__ 79#ifdef __KERNEL__
80#include <asm/atomic.h> 80#include <asm/atomic.h>
81#include <linux/rcupdate.h> 81#include <linux/rcupdate.h>
82#include <linux/cache.h>
82 83
83struct task_struct; 84struct task_struct;
84 85
@@ -91,7 +92,8 @@ struct sem {
91 92
92/* One sem_array data structure for each set of semaphores in the system. */ 93/* One sem_array data structure for each set of semaphores in the system. */
93struct sem_array { 94struct sem_array {
94 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ 95 struct kern_ipc_perm ____cacheline_aligned_in_smp
96 sem_perm; /* permissions .. see ipc.h */
95 time_t sem_otime; /* last semop time */ 97 time_t sem_otime; /* last semop time */
96 time_t sem_ctime; /* last change time */ 98 time_t sem_ctime; /* last change time */
97 struct sem *sem_base; /* ptr to first semaphore in array */ 99 struct sem *sem_base; /* ptr to first semaphore in array */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index c8613c3ff9d3..1ebc694a6d52 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -77,7 +77,8 @@ struct serial_struct {
77#define PORT_16654 11 77#define PORT_16654 11
78#define PORT_16850 12 78#define PORT_16850 12
79#define PORT_RSA 13 /* RSA-DV II/S card */ 79#define PORT_RSA 13 /* RSA-DV II/S card */
80#define PORT_MAX 13 80#define PORT_U6_16550A 14
81#define PORT_MAX 14
81 82
82#define SERIAL_IO_PORT 0 83#define SERIAL_IO_PORT 0
83#define SERIAL_IO_HUB6 1 84#define SERIAL_IO_HUB6 1
@@ -151,7 +152,7 @@ struct serial_uart_config {
151#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) 152#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
152#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) 153#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
153 154
154#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1) 155#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
155#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ 156#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
156 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) 157 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
157#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) 158#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
@@ -210,8 +211,10 @@ struct serial_rs485 {
210#define SER_RS485_ENABLED (1 << 0) 211#define SER_RS485_ENABLED (1 << 0)
211#define SER_RS485_RTS_ON_SEND (1 << 1) 212#define SER_RS485_RTS_ON_SEND (1 << 1)
212#define SER_RS485_RTS_AFTER_SEND (1 << 2) 213#define SER_RS485_RTS_AFTER_SEND (1 << 2)
214#define SER_RS485_RTS_BEFORE_SEND (1 << 3)
213 __u32 delay_rts_before_send; /* Milliseconds */ 215 __u32 delay_rts_before_send; /* Milliseconds */
214 __u32 padding[6]; /* Memory is cheap, new structs 216 __u32 delay_rts_after_send; /* Milliseconds */
217 __u32 padding[5]; /* Memory is cheap, new structs
215 are a royal PITA .. */ 218 are a royal PITA .. */
216}; 219};
217 220
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index fb46aba11fb5..7638deaaba65 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -32,6 +32,9 @@ struct plat_serial8250_port {
32 unsigned int type; /* If UPF_FIXED_TYPE */ 32 unsigned int type; /* If UPF_FIXED_TYPE */
33 unsigned int (*serial_in)(struct uart_port *, int); 33 unsigned int (*serial_in)(struct uart_port *, int);
34 void (*serial_out)(struct uart_port *, int, int); 34 void (*serial_out)(struct uart_port *, int, int);
35 void (*set_termios)(struct uart_port *,
36 struct ktermios *new,
37 struct ktermios *old);
35}; 38};
36 39
37/* 40/*
@@ -71,5 +74,7 @@ extern int early_serial_setup(struct uart_port *port);
71extern int serial8250_find_port(struct uart_port *p); 74extern int serial8250_find_port(struct uart_port *p);
72extern int serial8250_find_port_for_earlycon(void); 75extern int serial8250_find_port_for_earlycon(void);
73extern int setup_early_serial8250_console(char *cmdline); 76extern int setup_early_serial8250_console(char *cmdline);
77extern void serial8250_do_set_termios(struct uart_port *port,
78 struct ktermios *termios, struct ktermios *old);
74 79
75#endif 80#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 78dd1e7120a9..3c2ad99fed34 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -182,6 +182,19 @@
182/* Aeroflex Gaisler GRLIB APBUART */ 182/* Aeroflex Gaisler GRLIB APBUART */
183#define PORT_APBUART 90 183#define PORT_APBUART 90
184 184
185/* Altera UARTs */
186#define PORT_ALTERA_JTAGUART 91
187#define PORT_ALTERA_UART 92
188
189/* SH-SCI */
190#define PORT_SCIFB 93
191
192/* MAX3107 */
193#define PORT_MAX3107 94
194
195/* High Speed UART for Medfield */
196#define PORT_MFD 95
197
185#ifdef __KERNEL__ 198#ifdef __KERNEL__
186 199
187#include <linux/compiler.h> 200#include <linux/compiler.h>
@@ -216,7 +229,7 @@ struct uart_ops {
216 void (*flush_buffer)(struct uart_port *); 229 void (*flush_buffer)(struct uart_port *);
217 void (*set_termios)(struct uart_port *, struct ktermios *new, 230 void (*set_termios)(struct uart_port *, struct ktermios *new,
218 struct ktermios *old); 231 struct ktermios *old);
219 void (*set_ldisc)(struct uart_port *); 232 void (*set_ldisc)(struct uart_port *, int new);
220 void (*pm)(struct uart_port *, unsigned int state, 233 void (*pm)(struct uart_port *, unsigned int state,
221 unsigned int oldstate); 234 unsigned int oldstate);
222 int (*set_wake)(struct uart_port *, unsigned int state); 235 int (*set_wake)(struct uart_port *, unsigned int state);
@@ -246,6 +259,7 @@ struct uart_ops {
246#endif 259#endif
247}; 260};
248 261
262#define NO_POLL_CHAR 0x00ff0000
249#define UART_CONFIG_TYPE (1 << 0) 263#define UART_CONFIG_TYPE (1 << 0)
250#define UART_CONFIG_IRQ (1 << 1) 264#define UART_CONFIG_IRQ (1 << 1)
251 265
@@ -271,6 +285,9 @@ struct uart_port {
271 unsigned char __iomem *membase; /* read/write[bwl] */ 285 unsigned char __iomem *membase; /* read/write[bwl] */
272 unsigned int (*serial_in)(struct uart_port *, int); 286 unsigned int (*serial_in)(struct uart_port *, int);
273 void (*serial_out)(struct uart_port *, int, int); 287 void (*serial_out)(struct uart_port *, int, int);
288 void (*set_termios)(struct uart_port *,
289 struct ktermios *new,
290 struct ktermios *old);
274 unsigned int irq; /* irq number */ 291 unsigned int irq; /* irq number */
275 unsigned long irqflags; /* irq flags */ 292 unsigned long irqflags; /* irq flags */
276 unsigned int uartclk; /* base uart clock */ 293 unsigned int uartclk; /* base uart clock */
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h
new file mode 100644
index 000000000000..2b071e0b034d
--- /dev/null
+++ b/include/linux/serial_mfd.h
@@ -0,0 +1,47 @@
1#ifndef _SERIAL_MFD_H_
2#define _SERIAL_MFD_H_
3
4/* HW register offset definition */
5#define UART_FOR 0x08
6#define UART_PS 0x0C
7#define UART_MUL 0x0D
8#define UART_DIV 0x0E
9
10#define HSU_GBL_IEN 0x0
11#define HSU_GBL_IST 0x4
12
13#define HSU_GBL_INT_BIT_PORT0 0x0
14#define HSU_GBL_INT_BIT_PORT1 0x1
15#define HSU_GBL_INT_BIT_PORT2 0x2
16#define HSU_GBL_INT_BIT_IRI 0x3
17#define HSU_GBL_INT_BIT_HDLC 0x4
18#define HSU_GBL_INT_BIT_DMA 0x5
19
20#define HSU_GBL_ISR 0x8
21#define HSU_GBL_DMASR 0x400
22#define HSU_GBL_DMAISR 0x404
23
24#define HSU_PORT_REG_OFFSET 0x80
25#define HSU_PORT0_REG_OFFSET 0x80
26#define HSU_PORT1_REG_OFFSET 0x100
27#define HSU_PORT2_REG_OFFSET 0x180
28#define HSU_PORT_REG_LENGTH 0x80
29
30#define HSU_DMA_CHANS_REG_OFFSET 0x500
31#define HSU_DMA_CHANS_REG_LENGTH 0x40
32
33#define HSU_CH_SR 0x0 /* channel status reg */
34#define HSU_CH_CR 0x4 /* control reg */
35#define HSU_CH_DCR 0x8 /* descriptor control reg */
36#define HSU_CH_BSR 0x10 /* max fifo buffer size reg */
37#define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */
38#define HSU_CH_D0SAR 0x20 /* desc 0 start addr */
39#define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */
40#define HSU_CH_D1SAR 0x28
41#define HSU_CH_D1TSR 0x2C
42#define HSU_CH_D2SAR 0x30
43#define HSU_CH_D2TSR 0x34
44#define HSU_CH_D3SAR 0x38
45#define HSU_CH_D3TSR 0x3C
46
47#endif
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index cf9327c051ad..c7a0ce11cd47 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -221,8 +221,24 @@
221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ 221#define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */
222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ 222#define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */
223 223
224/*
225 * Intel MID on-chip HSU (High Speed UART) defined bits
226 */
227#define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */
228#define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */
229#define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */
230#define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */
231
232#define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */
233#define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */
234#define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */
235#define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */
224 236
237#define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */
238#define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */
225 239
240#define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */
241#define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */
226 242
227/* 243/*
228 * These register definitions are for the 16C950 244 * These register definitions are for the 16C950
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 193d4bfe42ff..baed2122c5a6 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -2,9 +2,7 @@
2#define __LINUX_SERIAL_SCI_H 2#define __LINUX_SERIAL_SCI_H
3 3
4#include <linux/serial_core.h> 4#include <linux/serial_core.h>
5#ifdef CONFIG_SERIAL_SH_SCI_DMA 5#include <linux/sh_dma.h>
6#include <asm/dmaengine.h>
7#endif
8 6
9/* 7/*
10 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
@@ -33,8 +31,8 @@ struct plat_sci_port {
33 char *clk; /* clock string */ 31 char *clk; /* clock string */
34 struct device *dma_dev; 32 struct device *dma_dev;
35#ifdef CONFIG_SERIAL_SH_SCI_DMA 33#ifdef CONFIG_SERIAL_SH_SCI_DMA
36 enum sh_dmae_slave_chan_id dma_slave_tx; 34 unsigned int dma_slave_tx;
37 enum sh_dmae_slave_chan_id dma_slave_rx; 35 unsigned int dma_slave_rx;
38#endif 36#endif
39}; 37};
40 38
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 64b473066b9a..b5552568178d 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -196,5 +196,6 @@ static inline void serio_continue_rx(struct serio *serio)
196#define SERIO_TOUCHIT213 0x38 196#define SERIO_TOUCHIT213 0x38
197#define SERIO_W8001 0x39 197#define SERIO_W8001 0x39
198#define SERIO_DYNAPRO 0x3a 198#define SERIO_DYNAPRO 0x3a
199#define SERIO_HAMPSHIRE 0x3b
199 200
200#endif 201#endif
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index 9a6f7607174e..0299b4ce63db 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -73,6 +73,8 @@
73#define SFI_SIG_SPIB "SPIB" 73#define SFI_SIG_SPIB "SPIB"
74#define SFI_SIG_I2CB "I2CB" 74#define SFI_SIG_I2CB "I2CB"
75#define SFI_SIG_GPEM "GPEM" 75#define SFI_SIG_GPEM "GPEM"
76#define SFI_SIG_DEVS "DEVS"
77#define SFI_SIG_GPIO "GPIO"
76 78
77#define SFI_SIGNATURE_SIZE 4 79#define SFI_SIGNATURE_SIZE 4
78#define SFI_OEM_ID_SIZE 6 80#define SFI_OEM_ID_SIZE 6
@@ -145,6 +147,27 @@ struct sfi_rtc_table_entry {
145 u32 irq; 147 u32 irq;
146} __packed; 148} __packed;
147 149
150struct sfi_device_table_entry {
151 u8 type; /* bus type, I2C, SPI or ...*/
152#define SFI_DEV_TYPE_SPI 0
153#define SFI_DEV_TYPE_I2C 1
154#define SFI_DEV_TYPE_UART 2
155#define SFI_DEV_TYPE_HSI 3
156#define SFI_DEV_TYPE_IPC 4
157
158 u8 host_num; /* attached to host 0, 1...*/
159 u16 addr;
160 u8 irq;
161 u32 max_freq;
162 char name[16];
163} __packed;
164
165struct sfi_gpio_table_entry {
166 char controller_name[16];
167 u16 pin_no;
168 char pin_name[16];
169} __packed;
170
148struct sfi_spi_table_entry { 171struct sfi_spi_table_entry {
149 u16 host_num; /* attached to host 0, 1...*/ 172 u16 host_num; /* attached to host 0, 1...*/
150 u16 cs; /* chip select */ 173 u16 cs; /* chip select */
@@ -166,7 +189,6 @@ struct sfi_gpe_table_entry {
166 u16 phys_id; /* physical GPE id */ 189 u16 phys_id; /* physical GPE id */
167} __packed; 190} __packed;
168 191
169
170typedef int (*sfi_table_handler) (struct sfi_table_header *table); 192typedef int (*sfi_table_handler) (struct sfi_table_header *table);
171 193
172#ifdef CONFIG_SFI 194#ifdef CONFIG_SFI
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
new file mode 100644
index 000000000000..875ce50719a9
--- /dev/null
+++ b/include/linux/sh_clk.h
@@ -0,0 +1,163 @@
1#ifndef __SH_CLOCK_H
2#define __SH_CLOCK_H
3
4#include <linux/list.h>
5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
7#include <linux/clk.h>
8#include <linux/err.h>
9
10struct clk;
11
12struct clk_ops {
13 void (*init)(struct clk *clk);
14 int (*enable)(struct clk *clk);
15 void (*disable)(struct clk *clk);
16 unsigned long (*recalc)(struct clk *clk);
17 int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
18 int (*set_parent)(struct clk *clk, struct clk *parent);
19 long (*round_rate)(struct clk *clk, unsigned long rate);
20};
21
22struct clk {
23 struct list_head node;
24 const char *name;
25 int id;
26
27 struct clk *parent;
28 struct clk **parent_table; /* list of parents to */
29 unsigned short parent_num; /* choose between */
30 unsigned char src_shift; /* source clock field in the */
31 unsigned char src_width; /* configuration register */
32 struct clk_ops *ops;
33
34 struct list_head children;
35 struct list_head sibling; /* node for children */
36
37 int usecount;
38
39 unsigned long rate;
40 unsigned long flags;
41
42 void __iomem *enable_reg;
43 unsigned int enable_bit;
44
45 unsigned long arch_flags;
46 void *priv;
47 struct dentry *dentry;
48 struct cpufreq_frequency_table *freq_table;
49};
50
51#define CLK_ENABLE_ON_INIT (1 << 0)
52
53/* drivers/sh/clk.c */
54unsigned long followparent_recalc(struct clk *);
55void recalculate_root_clocks(void);
56void propagate_rate(struct clk *);
57int clk_reparent(struct clk *child, struct clk *parent);
58int clk_register(struct clk *);
59void clk_unregister(struct clk *);
60void clk_enable_init_clocks(void);
61
62/**
63 * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
64 * @clk: clock source
65 * @rate: desired clock rate in Hz
66 * @algo_id: algorithm id to be passed down to ops->set_rate
67 *
68 * Returns success (0) or negative errno.
69 */
70int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id);
71
72enum clk_sh_algo_id {
73 NO_CHANGE = 0,
74
75 IUS_N1_N1,
76 IUS_322,
77 IUS_522,
78 IUS_N11,
79
80 SB_N1,
81
82 SB3_N1,
83 SB3_32,
84 SB3_43,
85 SB3_54,
86
87 BP_N1,
88
89 IP_N1,
90};
91
92struct clk_div_mult_table {
93 unsigned int *divisors;
94 unsigned int nr_divisors;
95 unsigned int *multipliers;
96 unsigned int nr_multipliers;
97};
98
99struct cpufreq_frequency_table;
100void clk_rate_table_build(struct clk *clk,
101 struct cpufreq_frequency_table *freq_table,
102 int nr_freqs,
103 struct clk_div_mult_table *src_table,
104 unsigned long *bitmap);
105
106long clk_rate_table_round(struct clk *clk,
107 struct cpufreq_frequency_table *freq_table,
108 unsigned long rate);
109
110int clk_rate_table_find(struct clk *clk,
111 struct cpufreq_frequency_table *freq_table,
112 unsigned long rate);
113
114#define SH_CLK_MSTP32(_parent, _enable_reg, _enable_bit, _flags) \
115{ \
116 .parent = _parent, \
117 .enable_reg = (void __iomem *)_enable_reg, \
118 .enable_bit = _enable_bit, \
119 .flags = _flags, \
120}
121
122int sh_clk_mstp32_register(struct clk *clks, int nr);
123
124#define SH_CLK_DIV4(_parent, _reg, _shift, _div_bitmap, _flags) \
125{ \
126 .parent = _parent, \
127 .enable_reg = (void __iomem *)_reg, \
128 .enable_bit = _shift, \
129 .arch_flags = _div_bitmap, \
130 .flags = _flags, \
131}
132
133struct clk_div4_table {
134 struct clk_div_mult_table *div_mult_table;
135 void (*kick)(struct clk *clk);
136};
137
138int sh_clk_div4_register(struct clk *clks, int nr,
139 struct clk_div4_table *table);
140int sh_clk_div4_enable_register(struct clk *clks, int nr,
141 struct clk_div4_table *table);
142int sh_clk_div4_reparent_register(struct clk *clks, int nr,
143 struct clk_div4_table *table);
144
145#define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \
146 _num_parents, _src_shift, _src_width) \
147{ \
148 .parent = _parent, \
149 .enable_reg = (void __iomem *)_reg, \
150 .flags = _flags, \
151 .parent_table = _parents, \
152 .parent_num = _num_parents, \
153 .src_shift = _src_shift, \
154 .src_width = _src_width, \
155}
156
157#define SH_CLK_DIV6(_parent, _reg, _flags) \
158 SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0)
159
160int sh_clk_div6_register(struct clk *clks, int nr);
161int sh_clk_div6_reparent_register(struct clk *clks, int nr);
162
163#endif /* __SH_CLOCK_H */
diff --git a/include/linux/sh_dma.h b/include/linux/sh_dma.h
new file mode 100644
index 000000000000..b08cd4efa15c
--- /dev/null
+++ b/include/linux/sh_dma.h
@@ -0,0 +1,102 @@
1/*
2 * Header for the new SH dmaengine driver
3 *
4 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef SH_DMA_H
11#define SH_DMA_H
12
13#include <linux/list.h>
14#include <linux/dmaengine.h>
15
16/* Used by slave DMA clients to request DMA to/from a specific peripheral */
17struct sh_dmae_slave {
18 unsigned int slave_id; /* Set by the platform */
19 struct device *dma_dev; /* Set by the platform */
20 const struct sh_dmae_slave_config *config; /* Set by the driver */
21};
22
23struct sh_dmae_regs {
24 u32 sar; /* SAR / source address */
25 u32 dar; /* DAR / destination address */
26 u32 tcr; /* TCR / transfer count */
27};
28
29struct sh_desc {
30 struct sh_dmae_regs hw;
31 struct list_head node;
32 struct dma_async_tx_descriptor async_tx;
33 enum dma_data_direction direction;
34 dma_cookie_t cookie;
35 size_t partial;
36 int chunks;
37 int mark;
38};
39
40struct sh_dmae_slave_config {
41 unsigned int slave_id;
42 dma_addr_t addr;
43 u32 chcr;
44 char mid_rid;
45};
46
47struct sh_dmae_channel {
48 unsigned int offset;
49 unsigned int dmars;
50 unsigned int dmars_bit;
51};
52
53struct sh_dmae_pdata {
54 const struct sh_dmae_slave_config *slave;
55 int slave_num;
56 const struct sh_dmae_channel *channel;
57 int channel_num;
58 unsigned int ts_low_shift;
59 unsigned int ts_low_mask;
60 unsigned int ts_high_shift;
61 unsigned int ts_high_mask;
62 const unsigned int *ts_shift;
63 int ts_shift_num;
64 u16 dmaor_init;
65};
66
67/* DMA register */
68#define SAR 0x00
69#define DAR 0x04
70#define TCR 0x08
71#define CHCR 0x0C
72#define DMAOR 0x40
73
74/* DMAOR definitions */
75#define DMAOR_AE 0x00000004
76#define DMAOR_NMIF 0x00000002
77#define DMAOR_DME 0x00000001
78
79/* Definitions for the SuperH DMAC */
80#define REQ_L 0x00000000
81#define REQ_E 0x00080000
82#define RACK_H 0x00000000
83#define RACK_L 0x00040000
84#define ACK_R 0x00000000
85#define ACK_W 0x00020000
86#define ACK_H 0x00000000
87#define ACK_L 0x00010000
88#define DM_INC 0x00004000
89#define DM_DEC 0x00008000
90#define DM_FIX 0x0000c000
91#define SM_INC 0x00001000
92#define SM_DEC 0x00002000
93#define SM_FIX 0x00003000
94#define RS_IN 0x00000200
95#define RS_OUT 0x00000300
96#define TS_BLK 0x00000040
97#define TM_BUR 0x00000020
98#define CHCR_DE 0x00000001
99#define CHCR_TE 0x00000002
100#define CHCR_IE 0x00000004
101
102#endif
diff --git a/include/linux/sh_intc.h b/include/linux/sh_intc.h
index 51d288d8ac88..0d6cd38e673d 100644
--- a/include/linux/sh_intc.h
+++ b/include/linux/sh_intc.h
@@ -1,6 +1,8 @@
1#ifndef __SH_INTC_H 1#ifndef __SH_INTC_H
2#define __SH_INTC_H 2#define __SH_INTC_H
3 3
4#include <linux/ioport.h>
5
4typedef unsigned char intc_enum; 6typedef unsigned char intc_enum;
5 7
6struct intc_vect { 8struct intc_vect {
@@ -21,6 +23,9 @@ struct intc_group {
21struct intc_mask_reg { 23struct intc_mask_reg {
22 unsigned long set_reg, clr_reg, reg_width; 24 unsigned long set_reg, clr_reg, reg_width;
23 intc_enum enum_ids[32]; 25 intc_enum enum_ids[32];
26#ifdef CONFIG_INTC_BALANCING
27 unsigned long dist_reg;
28#endif
24#ifdef CONFIG_SMP 29#ifdef CONFIG_SMP
25 unsigned long smp; 30 unsigned long smp;
26#endif 31#endif
@@ -39,8 +44,14 @@ struct intc_sense_reg {
39 intc_enum enum_ids[16]; 44 intc_enum enum_ids[16];
40}; 45};
41 46
47#ifdef CONFIG_INTC_BALANCING
48#define INTC_SMP_BALANCING(reg) .dist_reg = (reg)
49#else
50#define INTC_SMP_BALANCING(reg)
51#endif
52
42#ifdef CONFIG_SMP 53#ifdef CONFIG_SMP
43#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8) 54#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
44#else 55#else
45#define INTC_SMP(stride, nr) 56#define INTC_SMP(stride, nr)
46#endif 57#endif
@@ -71,6 +82,8 @@ struct intc_hw_desc {
71 82
72struct intc_desc { 83struct intc_desc {
73 char *name; 84 char *name;
85 struct resource *resource;
86 unsigned int num_resources;
74 intc_enum force_enable; 87 intc_enum force_enable;
75 intc_enum force_disable; 88 intc_enum force_disable;
76 struct intc_hw_desc hw; 89 struct intc_hw_desc hw;
@@ -92,9 +105,18 @@ struct intc_desc symbol __initdata = { \
92 prio_regs, sense_regs, ack_regs), \ 105 prio_regs, sense_regs, ack_regs), \
93} 106}
94 107
95void __init register_intc_controller(struct intc_desc *desc); 108int __init register_intc_controller(struct intc_desc *desc);
96int intc_set_priority(unsigned int irq, unsigned int prio); 109int intc_set_priority(unsigned int irq, unsigned int prio);
97 110
111#ifdef CONFIG_INTC_USERIMASK
112int register_intc_userimask(unsigned long addr);
113#else
114static inline int register_intc_userimask(unsigned long addr)
115{
116 return 0;
117}
118#endif
119
98int reserve_irq_vector(unsigned int irq); 120int reserve_irq_vector(unsigned int irq);
99void reserve_irq_legacy(void); 121void reserve_irq_legacy(void);
100 122
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index e164291fb3e7..399be5ad2f99 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/swap.h> 4#include <linux/swap.h>
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/percpu_counter.h>
6 7
7/* inode in-kernel data */ 8/* inode in-kernel data */
8 9
@@ -23,7 +24,7 @@ struct shmem_inode_info {
23 24
24struct shmem_sb_info { 25struct shmem_sb_info {
25 unsigned long max_blocks; /* How many blocks are allowed */ 26 unsigned long max_blocks; /* How many blocks are allowed */
26 unsigned long free_blocks; /* How many are left for allocation */ 27 struct percpu_counter used_blocks; /* How many are allocated */
27 unsigned long max_inodes; /* How many inodes are allowed */ 28 unsigned long max_inodes; /* How many inodes are allowed */
28 unsigned long free_inodes; /* How many are left for allocation */ 29 unsigned long free_inodes; /* How many are left for allocation */
29 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */ 30 spinlock_t stat_lock; /* Serialize shmem_sb_info changes */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 124f90cd5a38..77eb60d2b496 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -169,6 +169,7 @@ struct skb_shared_hwtstamps {
169 * @software: generate software time stamp 169 * @software: generate software time stamp
170 * @in_progress: device driver is going to provide 170 * @in_progress: device driver is going to provide
171 * hardware time stamp 171 * hardware time stamp
172 * @prevent_sk_orphan: make sk reference available on driver level
172 * @flags: all shared_tx flags 173 * @flags: all shared_tx flags
173 * 174 *
174 * These flags are attached to packets as part of the 175 * These flags are attached to packets as part of the
@@ -178,7 +179,8 @@ union skb_shared_tx {
178 struct { 179 struct {
179 __u8 hardware:1, 180 __u8 hardware:1,
180 software:1, 181 software:1,
181 in_progress:1; 182 in_progress:1,
183 prevent_sk_orphan:1;
182 }; 184 };
183 __u8 flags; 185 __u8 flags;
184}; 186};
@@ -187,7 +189,6 @@ union skb_shared_tx {
187 * the end of the header data, ie. at skb->end. 189 * the end of the header data, ie. at skb->end.
188 */ 190 */
189struct skb_shared_info { 191struct skb_shared_info {
190 atomic_t dataref;
191 unsigned short nr_frags; 192 unsigned short nr_frags;
192 unsigned short gso_size; 193 unsigned short gso_size;
193 /* Warning: this field is not always filled in (UFO)! */ 194 /* Warning: this field is not always filled in (UFO)! */
@@ -197,10 +198,17 @@ struct skb_shared_info {
197 union skb_shared_tx tx_flags; 198 union skb_shared_tx tx_flags;
198 struct sk_buff *frag_list; 199 struct sk_buff *frag_list;
199 struct skb_shared_hwtstamps hwtstamps; 200 struct skb_shared_hwtstamps hwtstamps;
200 skb_frag_t frags[MAX_SKB_FRAGS]; 201
202 /*
203 * Warning : all fields before dataref are cleared in __alloc_skb()
204 */
205 atomic_t dataref;
206
201 /* Intermediate layers must ensure that destructor_arg 207 /* Intermediate layers must ensure that destructor_arg
202 * remains valid until skb destructor */ 208 * remains valid until skb destructor */
203 void * destructor_arg; 209 void * destructor_arg;
210 /* must be last field, see pskb_expand_head() */
211 skb_frag_t frags[MAX_SKB_FRAGS];
204}; 212};
205 213
206/* We divide dataref into two halves. The higher 16 bits hold references 214/* We divide dataref into two halves. The higher 16 bits hold references
@@ -259,7 +267,7 @@ typedef unsigned char *sk_buff_data_t;
259 * @transport_header: Transport layer header 267 * @transport_header: Transport layer header
260 * @network_header: Network layer header 268 * @network_header: Network layer header
261 * @mac_header: Link layer header 269 * @mac_header: Link layer header
262 * @_skb_dst: destination entry 270 * @_skb_refdst: destination entry (with norefcount bit)
263 * @sp: the security path, used for xfrm 271 * @sp: the security path, used for xfrm
264 * @cb: Control buffer. Free for use by every layer. Put private vars here 272 * @cb: Control buffer. Free for use by every layer. Put private vars here
265 * @len: Length of actual data 273 * @len: Length of actual data
@@ -294,6 +302,7 @@ typedef unsigned char *sk_buff_data_t;
294 * @nfct_reasm: netfilter conntrack re-assembly pointer 302 * @nfct_reasm: netfilter conntrack re-assembly pointer
295 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c 303 * @nf_bridge: Saved data about a bridged frame - see br_netfilter.c
296 * @skb_iif: ifindex of device we arrived on 304 * @skb_iif: ifindex of device we arrived on
305 * @rxhash: the packet hash computed on receive
297 * @queue_mapping: Queue mapping for multiqueue devices 306 * @queue_mapping: Queue mapping for multiqueue devices
298 * @tc_index: Traffic control index 307 * @tc_index: Traffic control index
299 * @tc_verd: traffic control verdict 308 * @tc_verd: traffic control verdict
@@ -322,7 +331,7 @@ struct sk_buff {
322 */ 331 */
323 char cb[48] __aligned(8); 332 char cb[48] __aligned(8);
324 333
325 unsigned long _skb_dst; 334 unsigned long _skb_refdst;
326#ifdef CONFIG_XFRM 335#ifdef CONFIG_XFRM
327 struct sec_path *sp; 336 struct sec_path *sp;
328#endif 337#endif
@@ -369,10 +378,15 @@ struct sk_buff {
369#endif 378#endif
370#endif 379#endif
371 380
381 __u32 rxhash;
382
372 kmemcheck_bitfield_begin(flags2); 383 kmemcheck_bitfield_begin(flags2);
373 __u16 queue_mapping:16; 384 __u16 queue_mapping:16;
374#ifdef CONFIG_IPV6_NDISC_NODETYPE 385#ifdef CONFIG_IPV6_NDISC_NODETYPE
375 __u8 ndisc_nodetype:2; 386 __u8 ndisc_nodetype:2,
387 deliver_no_wcard:1;
388#else
389 __u8 deliver_no_wcard:1;
376#endif 390#endif
377 kmemcheck_bitfield_end(flags2); 391 kmemcheck_bitfield_end(flags2);
378 392
@@ -411,14 +425,64 @@ struct sk_buff {
411 425
412#include <asm/system.h> 426#include <asm/system.h>
413 427
428/*
429 * skb might have a dst pointer attached, refcounted or not.
430 * _skb_refdst low order bit is set if refcount was _not_ taken
431 */
432#define SKB_DST_NOREF 1UL
433#define SKB_DST_PTRMASK ~(SKB_DST_NOREF)
434
435/**
436 * skb_dst - returns skb dst_entry
437 * @skb: buffer
438 *
439 * Returns skb dst_entry, regardless of reference taken or not.
440 */
414static inline struct dst_entry *skb_dst(const struct sk_buff *skb) 441static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
415{ 442{
416 return (struct dst_entry *)skb->_skb_dst; 443 /* If refdst was not refcounted, check we still are in a
444 * rcu_read_lock section
445 */
446 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) &&
447 !rcu_read_lock_held() &&
448 !rcu_read_lock_bh_held());
449 return (struct dst_entry *)(skb->_skb_refdst & SKB_DST_PTRMASK);
417} 450}
418 451
452/**
453 * skb_dst_set - sets skb dst
454 * @skb: buffer
455 * @dst: dst entry
456 *
457 * Sets skb dst, assuming a reference was taken on dst and should
458 * be released by skb_dst_drop()
459 */
419static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) 460static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
420{ 461{
421 skb->_skb_dst = (unsigned long)dst; 462 skb->_skb_refdst = (unsigned long)dst;
463}
464
465/**
466 * skb_dst_set_noref - sets skb dst, without a reference
467 * @skb: buffer
468 * @dst: dst entry
469 *
470 * Sets skb dst, assuming a reference was not taken on dst
471 * skb_dst_drop() should not dst_release() this dst
472 */
473static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst)
474{
475 WARN_ON(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
476 skb->_skb_refdst = (unsigned long)dst | SKB_DST_NOREF;
477}
478
479/**
480 * skb_dst_is_noref - Test if skb dst isnt refcounted
481 * @skb: buffer
482 */
483static inline bool skb_dst_is_noref(const struct sk_buff *skb)
484{
485 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb);
422} 486}
423 487
424static inline struct rtable *skb_rtable(const struct sk_buff *skb) 488static inline struct rtable *skb_rtable(const struct sk_buff *skb)
@@ -443,7 +507,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
443 return __alloc_skb(size, priority, 1, -1); 507 return __alloc_skb(size, priority, 1, -1);
444} 508}
445 509
446extern int skb_recycle_check(struct sk_buff *skb, int skb_size); 510extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
447 511
448extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 512extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
449extern struct sk_buff *skb_clone(struct sk_buff *skb, 513extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -467,11 +531,6 @@ extern int skb_cow_data(struct sk_buff *skb, int tailbits,
467 struct sk_buff **trailer); 531 struct sk_buff **trailer);
468extern int skb_pad(struct sk_buff *skb, int pad); 532extern int skb_pad(struct sk_buff *skb, int pad);
469#define dev_kfree_skb(a) consume_skb(a) 533#define dev_kfree_skb(a) consume_skb(a)
470#define dev_consume_skb(a) kfree_skb_clean(a)
471extern void skb_over_panic(struct sk_buff *skb, int len,
472 void *here);
473extern void skb_under_panic(struct sk_buff *skb, int len,
474 void *here);
475 534
476extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb, 535extern int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
477 int getfrag(void *from, char *to, int offset, 536 int getfrag(void *from, char *to, int offset,
@@ -1130,6 +1189,11 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
1130 return skb->data += len; 1189 return skb->data += len;
1131} 1190}
1132 1191
1192static inline unsigned char *skb_pull_inline(struct sk_buff *skb, unsigned int len)
1193{
1194 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
1195}
1196
1133extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 1197extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
1134 1198
1135static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1199static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1315,6 +1379,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1315 return skb_network_header(skb) - skb->data; 1379 return skb_network_header(skb) - skb->data;
1316} 1380}
1317 1381
1382static inline int pskb_network_may_pull(struct sk_buff *skb, unsigned int len)
1383{
1384 return pskb_may_pull(skb, skb_network_offset(skb) + len);
1385}
1386
1318/* 1387/*
1319 * CPUs often take a performance hit when accessing unaligned memory 1388 * CPUs often take a performance hit when accessing unaligned memory
1320 * locations. The actual performance hit varies, it can be small if the 1389 * locations. The actual performance hit varies, it can be small if the
@@ -1353,9 +1422,14 @@ static inline int skb_network_offset(const struct sk_buff *skb)
1353 * 1422 *
1354 * Various parts of the networking layer expect at least 32 bytes of 1423 * Various parts of the networking layer expect at least 32 bytes of
1355 * headroom, you should not reduce this. 1424 * headroom, you should not reduce this.
1425 *
1426 * Using max(32, L1_CACHE_BYTES) makes sense (especially with RPS)
1427 * to reduce average number of cache lines per packet.
1428 * get_rps_cpus() for example only access one 64 bytes aligned block :
1429 * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
1356 */ 1430 */
1357#ifndef NET_SKB_PAD 1431#ifndef NET_SKB_PAD
1358#define NET_SKB_PAD 32 1432#define NET_SKB_PAD max(32, L1_CACHE_BYTES)
1359#endif 1433#endif
1360 1434
1361extern int ___pskb_trim(struct sk_buff *skb, unsigned int len); 1435extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1867,6 +1941,36 @@ static inline ktime_t net_invalid_timestamp(void)
1867 return ktime_set(0, 0); 1941 return ktime_set(0, 0);
1868} 1942}
1869 1943
1944extern void skb_timestamping_init(void);
1945
1946#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
1947
1948extern void skb_clone_tx_timestamp(struct sk_buff *skb);
1949extern bool skb_defer_rx_timestamp(struct sk_buff *skb);
1950
1951#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
1952
1953static inline void skb_clone_tx_timestamp(struct sk_buff *skb)
1954{
1955}
1956
1957static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1958{
1959 return false;
1960}
1961
1962#endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */
1963
1964/**
1965 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1966 *
1967 * @skb: clone of the the original outgoing packet
1968 * @hwtstamps: hardware time stamps
1969 *
1970 */
1971void skb_complete_tx_timestamp(struct sk_buff *skb,
1972 struct skb_shared_hwtstamps *hwtstamps);
1973
1870/** 1974/**
1871 * skb_tstamp_tx - queue clone of skb with send time stamps 1975 * skb_tstamp_tx - queue clone of skb with send time stamps
1872 * @orig_skb: the original outgoing packet 1976 * @orig_skb: the original outgoing packet
@@ -1881,6 +1985,28 @@ static inline ktime_t net_invalid_timestamp(void)
1881extern void skb_tstamp_tx(struct sk_buff *orig_skb, 1985extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1882 struct skb_shared_hwtstamps *hwtstamps); 1986 struct skb_shared_hwtstamps *hwtstamps);
1883 1987
1988static inline void sw_tx_timestamp(struct sk_buff *skb)
1989{
1990 union skb_shared_tx *shtx = skb_tx(skb);
1991 if (shtx->software && !shtx->in_progress)
1992 skb_tstamp_tx(skb, NULL);
1993}
1994
1995/**
1996 * skb_tx_timestamp() - Driver hook for transmit timestamping
1997 *
1998 * Ethernet MAC Drivers should call this function in their hard_xmit()
1999 * function as soon as possible after giving the sk_buff to the MAC
2000 * hardware, but before freeing the sk_buff.
2001 *
2002 * @skb: A socket buffer.
2003 */
2004static inline void skb_tx_timestamp(struct sk_buff *skb)
2005{
2006 skb_clone_tx_timestamp(skb);
2007 sw_tx_timestamp(skb);
2008}
2009
1884extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2010extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1885extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2011extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1886 2012
@@ -2068,7 +2194,8 @@ static inline bool skb_warn_if_lro(const struct sk_buff *skb)
2068 /* LRO sets gso_size but not gso_type, whereas if GSO is really 2194 /* LRO sets gso_size but not gso_type, whereas if GSO is really
2069 * wanted then gso_type will be set. */ 2195 * wanted then gso_type will be set. */
2070 struct skb_shared_info *shinfo = skb_shinfo(skb); 2196 struct skb_shared_info *shinfo = skb_shinfo(skb);
2071 if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) { 2197 if (skb_is_nonlinear(skb) && shinfo->gso_size != 0 &&
2198 unlikely(shinfo->gso_type == 0)) {
2072 __skb_warn_lro_forwarding(skb); 2199 __skb_warn_lro_forwarding(skb);
2073 return true; 2200 return true;
2074 } 2201 }
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 49d1247cd6d9..59260e21bdf5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -268,7 +268,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
268 * allocator where we care about the real place the memory allocation 268 * allocator where we care about the real place the memory allocation
269 * request comes from. 269 * request comes from.
270 */ 270 */
271#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 271#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
272 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
272extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 273extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
273#define kmalloc_track_caller(size, flags) \ 274#define kmalloc_track_caller(size, flags) \
274 __kmalloc_track_caller(size, flags, _RET_IP_) 275 __kmalloc_track_caller(size, flags, _RET_IP_)
@@ -286,7 +287,8 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
286 * standard allocator where we care about the real place the memory 287 * standard allocator where we care about the real place the memory
287 * allocation request comes from. 288 * allocation request comes from.
288 */ 289 */
289#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 290#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
291 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
290extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 292extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
291#define kmalloc_node_track_caller(size, flags, node) \ 293#define kmalloc_node_track_caller(size, flags, node) \
292 __kmalloc_node_track_caller(size, flags, node, \ 294 __kmalloc_node_track_caller(size, flags, node, \
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index ca6b2b317991..791a502f6906 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -14,7 +14,34 @@
14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ 14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/kmemtrace.h> 17
18#include <trace/events/kmem.h>
19
20/*
21 * Enforce a minimum alignment for the kmalloc caches.
22 * Usually, the kmalloc caches are cache_line_size() aligned, except when
23 * DEBUG and FORCED_DEBUG are enabled, then they are BYTES_PER_WORD aligned.
24 * Some archs want to perform DMA into kmalloc caches and need a guaranteed
25 * alignment larger than the alignment of a 64-bit integer.
26 * ARCH_KMALLOC_MINALIGN allows that.
27 * Note that increasing this value may disable some debug features.
28 */
29#ifdef ARCH_DMA_MINALIGN
30#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
31#else
32#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
33#endif
34
35#ifndef ARCH_SLAB_MINALIGN
36/*
37 * Enforce a minimum alignment for all caches.
38 * Intended for archs that get misalignment faults even for BYTES_PER_WORD
39 * aligned buffers. Includes ARCH_KMALLOC_MINALIGN.
40 * If possible: Do not enable this flag for CONFIG_DEBUG_SLAB, it disables
41 * some debug features.
42 */
43#define ARCH_SLAB_MINALIGN 0
44#endif
18 45
19/* 46/*
20 * struct kmem_cache 47 * struct kmem_cache
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..4382db09df4f 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,6 +1,16 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#ifdef ARCH_DMA_MINALIGN
5#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
6#else
7#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long)
8#endif
9
10#ifndef ARCH_SLAB_MINALIGN
11#define ARCH_SLAB_MINALIGN __alignof__(unsigned long)
12#endif
13
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 14void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 15
6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 16static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
diff --git a/include/linux/slow-work.h b/include/linux/slow-work.h
deleted file mode 100644
index 13337bf6c3f5..000000000000
--- a/include/linux/slow-work.h
+++ /dev/null
@@ -1,163 +0,0 @@
1/* Worker thread pool for slow items, such as filesystem lookups or mkdirs
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 *
11 * See Documentation/slow-work.txt
12 */
13
14#ifndef _LINUX_SLOW_WORK_H
15#define _LINUX_SLOW_WORK_H
16
17#ifdef CONFIG_SLOW_WORK
18
19#include <linux/sysctl.h>
20#include <linux/timer.h>
21
22struct slow_work;
23#ifdef CONFIG_SLOW_WORK_DEBUG
24struct seq_file;
25#endif
26
27/*
28 * The operations used to support slow work items
29 */
30struct slow_work_ops {
31 /* owner */
32 struct module *owner;
33
34 /* get a ref on a work item
35 * - return 0 if successful, -ve if not
36 */
37 int (*get_ref)(struct slow_work *work);
38
39 /* discard a ref to a work item */
40 void (*put_ref)(struct slow_work *work);
41
42 /* execute a work item */
43 void (*execute)(struct slow_work *work);
44
45#ifdef CONFIG_SLOW_WORK_DEBUG
46 /* describe a work item for debugfs */
47 void (*desc)(struct slow_work *work, struct seq_file *m);
48#endif
49};
50
51/*
52 * A slow work item
53 * - A reference is held on the parent object by the thread pool when it is
54 * queued
55 */
56struct slow_work {
57 struct module *owner; /* the owning module */
58 unsigned long flags;
59#define SLOW_WORK_PENDING 0 /* item pending (further) execution */
60#define SLOW_WORK_EXECUTING 1 /* item currently executing */
61#define SLOW_WORK_ENQ_DEFERRED 2 /* item enqueue deferred */
62#define SLOW_WORK_VERY_SLOW 3 /* item is very slow */
63#define SLOW_WORK_CANCELLING 4 /* item is being cancelled, don't enqueue */
64#define SLOW_WORK_DELAYED 5 /* item is struct delayed_slow_work with active timer */
65 const struct slow_work_ops *ops; /* operations table for this item */
66 struct list_head link; /* link in queue */
67#ifdef CONFIG_SLOW_WORK_DEBUG
68 struct timespec mark; /* jiffies at which queued or exec begun */
69#endif
70};
71
72struct delayed_slow_work {
73 struct slow_work work;
74 struct timer_list timer;
75};
76
77/**
78 * slow_work_init - Initialise a slow work item
79 * @work: The work item to initialise
80 * @ops: The operations to use to handle the slow work item
81 *
82 * Initialise a slow work item.
83 */
84static inline void slow_work_init(struct slow_work *work,
85 const struct slow_work_ops *ops)
86{
87 work->flags = 0;
88 work->ops = ops;
89 INIT_LIST_HEAD(&work->link);
90}
91
92/**
93 * slow_work_init - Initialise a delayed slow work item
94 * @work: The work item to initialise
95 * @ops: The operations to use to handle the slow work item
96 *
97 * Initialise a delayed slow work item.
98 */
99static inline void delayed_slow_work_init(struct delayed_slow_work *dwork,
100 const struct slow_work_ops *ops)
101{
102 init_timer(&dwork->timer);
103 slow_work_init(&dwork->work, ops);
104}
105
106/**
107 * vslow_work_init - Initialise a very slow work item
108 * @work: The work item to initialise
109 * @ops: The operations to use to handle the slow work item
110 *
111 * Initialise a very slow work item. This item will be restricted such that
112 * only a certain number of the pool threads will be able to execute items of
113 * this type.
114 */
115static inline void vslow_work_init(struct slow_work *work,
116 const struct slow_work_ops *ops)
117{
118 work->flags = 1 << SLOW_WORK_VERY_SLOW;
119 work->ops = ops;
120 INIT_LIST_HEAD(&work->link);
121}
122
123/**
124 * slow_work_is_queued - Determine if a slow work item is on the work queue
125 * work: The work item to test
126 *
127 * Determine if the specified slow-work item is on the work queue. This
128 * returns true if it is actually on the queue.
129 *
130 * If the item is executing and has been marked for requeue when execution
131 * finishes, then false will be returned.
132 *
133 * Anyone wishing to wait for completion of execution can wait on the
134 * SLOW_WORK_EXECUTING bit.
135 */
136static inline bool slow_work_is_queued(struct slow_work *work)
137{
138 unsigned long flags = work->flags;
139 return flags & SLOW_WORK_PENDING && !(flags & SLOW_WORK_EXECUTING);
140}
141
142extern int slow_work_enqueue(struct slow_work *work);
143extern void slow_work_cancel(struct slow_work *work);
144extern int slow_work_register_user(struct module *owner);
145extern void slow_work_unregister_user(struct module *owner);
146
147extern int delayed_slow_work_enqueue(struct delayed_slow_work *dwork,
148 unsigned long delay);
149
150static inline void delayed_slow_work_cancel(struct delayed_slow_work *dwork)
151{
152 slow_work_cancel(&dwork->work);
153}
154
155extern bool slow_work_sleep_till_thread_needed(struct slow_work *work,
156 signed long *_timeout);
157
158#ifdef CONFIG_SYSCTL
159extern ctl_table slow_work_sysctls[];
160#endif
161
162#endif /* CONFIG_SLOW_WORK */
163#endif /* _LINUX_SLOW_WORK_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 0249d4175bac..6d14409c4d9a 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,9 +10,10 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <linux/kmemtrace.h>
14#include <linux/kmemleak.h> 13#include <linux/kmemleak.h>
15 14
15#include <trace/events/kmem.h>
16
16enum stat_item { 17enum stat_item {
17 ALLOC_FASTPATH, /* Allocation from cpu slab */ 18 ALLOC_FASTPATH, /* Allocation from cpu slab */
18 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */ 19 ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
@@ -75,12 +76,6 @@ struct kmem_cache {
75 int offset; /* Free pointer offset. */ 76 int offset; /* Free pointer offset. */
76 struct kmem_cache_order_objects oo; 77 struct kmem_cache_order_objects oo;
77 78
78 /*
79 * Avoid an extra cache line for UP, SMP and for the node local to
80 * struct kmem_cache.
81 */
82 struct kmem_cache_node local_node;
83
84 /* Allocation and freeing of slabs */ 79 /* Allocation and freeing of slabs */
85 struct kmem_cache_order_objects max; 80 struct kmem_cache_order_objects max;
86 struct kmem_cache_order_objects min; 81 struct kmem_cache_order_objects min;
@@ -102,20 +97,33 @@ struct kmem_cache {
102 */ 97 */
103 int remote_node_defrag_ratio; 98 int remote_node_defrag_ratio;
104 struct kmem_cache_node *node[MAX_NUMNODES]; 99 struct kmem_cache_node *node[MAX_NUMNODES];
100#else
101 /* Avoid an extra cache line for UP */
102 struct kmem_cache_node local_node;
105#endif 103#endif
106}; 104};
107 105
108/* 106/*
109 * Kmalloc subsystem. 107 * Kmalloc subsystem.
110 */ 108 */
111#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 109#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
112#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN 110#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
113#else 111#else
114#define KMALLOC_MIN_SIZE 8 112#define KMALLOC_MIN_SIZE 8
115#endif 113#endif
116 114
117#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) 115#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
118 116
117#ifdef ARCH_DMA_MINALIGN
118#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
119#else
120#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
121#endif
122
123#ifndef ARCH_SLAB_MINALIGN
124#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
125#endif
126
119/* 127/*
120 * Maximum kmalloc object size handled by SLUB. Larger object allocations 128 * Maximum kmalloc object size handled by SLUB. Larger object allocations
121 * are passed through to the page allocator. The page allocator "fastpath" 129 * are passed through to the page allocator. The page allocator "fastpath"
@@ -132,7 +140,7 @@ struct kmem_cache {
132#ifdef CONFIG_ZONE_DMA 140#ifdef CONFIG_ZONE_DMA
133#define SLUB_DMA __GFP_DMA 141#define SLUB_DMA __GFP_DMA
134/* Reserve extra caches for potential DMA use */ 142/* Reserve extra caches for potential DMA use */
135#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT - 6) 143#define KMALLOC_CACHES (2 * SLUB_PAGE_SHIFT)
136#else 144#else
137/* Disable DMA functionality */ 145/* Disable DMA functionality */
138#define SLUB_DMA (__force gfp_t)0 146#define SLUB_DMA (__force gfp_t)0
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 4435d1084755..ebb0c80ffd6e 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -100,6 +100,7 @@ enum
100 ICMP6_MIB_INMSGS, /* InMsgs */ 100 ICMP6_MIB_INMSGS, /* InMsgs */
101 ICMP6_MIB_INERRORS, /* InErrors */ 101 ICMP6_MIB_INERRORS, /* InErrors */
102 ICMP6_MIB_OUTMSGS, /* OutMsgs */ 102 ICMP6_MIB_OUTMSGS, /* OutMsgs */
103 ICMP6_MIB_OUTERRORS, /* OutErrors */
103 __ICMP6_MIB_MAX 104 __ICMP6_MIB_MAX
104}; 105};
105 106
@@ -227,6 +228,8 @@ enum
227 LINUX_MIB_SACKSHIFTFALLBACK, 228 LINUX_MIB_SACKSHIFTFALLBACK,
228 LINUX_MIB_TCPBACKLOGDROP, 229 LINUX_MIB_TCPBACKLOGDROP,
229 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ 230 LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
231 LINUX_MIB_TCPDEFERACCEPTDROP,
232 LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
230 __LINUX_MIB_MAX 233 __LINUX_MIB_MAX
231}; 234};
232 235
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 354cc5617f8b..a2fada9becb6 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -24,6 +24,9 @@ struct __kernel_sockaddr_storage {
24#include <linux/types.h> /* pid_t */ 24#include <linux/types.h> /* pid_t */
25#include <linux/compiler.h> /* __user */ 25#include <linux/compiler.h> /* __user */
26 26
27struct pid;
28struct cred;
29
27#define __sockaddr_check_size(size) \ 30#define __sockaddr_check_size(size) \
28 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage))) 31 BUILD_BUG_ON(((size) > sizeof(struct __kernel_sockaddr_storage)))
29 32
@@ -189,7 +192,8 @@ struct ucred {
189#define AF_ISDN 34 /* mISDN sockets */ 192#define AF_ISDN 34 /* mISDN sockets */
190#define AF_PHONET 35 /* Phonet sockets */ 193#define AF_PHONET 35 /* Phonet sockets */
191#define AF_IEEE802154 36 /* IEEE802154 sockets */ 194#define AF_IEEE802154 36 /* IEEE802154 sockets */
192#define AF_MAX 37 /* For now.. */ 195#define AF_CAIF 37 /* CAIF sockets */
196#define AF_MAX 38 /* For now.. */
193 197
194/* Protocol families, same as address families. */ 198/* Protocol families, same as address families. */
195#define PF_UNSPEC AF_UNSPEC 199#define PF_UNSPEC AF_UNSPEC
@@ -229,6 +233,7 @@ struct ucred {
229#define PF_ISDN AF_ISDN 233#define PF_ISDN AF_ISDN
230#define PF_PHONET AF_PHONET 234#define PF_PHONET AF_PHONET
231#define PF_IEEE802154 AF_IEEE802154 235#define PF_IEEE802154 AF_IEEE802154
236#define PF_CAIF AF_CAIF
232#define PF_MAX AF_MAX 237#define PF_MAX AF_MAX
233 238
234/* Maximum queue length specifiable by listen. */ 239/* Maximum queue length specifiable by listen. */
@@ -301,11 +306,14 @@ struct ucred {
301#define SOL_PNPIPE 275 306#define SOL_PNPIPE 275
302#define SOL_RDS 276 307#define SOL_RDS 276
303#define SOL_IUCV 277 308#define SOL_IUCV 277
309#define SOL_CAIF 278
304 310
305/* IPX options */ 311/* IPX options */
306#define IPX_TYPE 1 312#define IPX_TYPE 1
307 313
308#ifdef __KERNEL__ 314#ifdef __KERNEL__
315extern void cred_to_ucred(struct pid *pid, const struct cred *cred, struct ucred *ucred);
316
309extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 317extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
310extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, 318extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
311 int offset, int len); 319 int offset, int len);
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index b4ae570d3c98..92bd0839d5b4 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -48,11 +48,12 @@ struct ads7846_platform_data {
48 * state if get_pendown_state == NULL 48 * state if get_pendown_state == NULL
49 */ 49 */
50 int (*get_pendown_state)(void); 50 int (*get_pendown_state)(void);
51 int (*filter_init) (struct ads7846_platform_data *pdata, 51 int (*filter_init) (const struct ads7846_platform_data *pdata,
52 void **filter_data); 52 void **filter_data);
53 int (*filter) (void *filter_data, int data_idx, int *val); 53 int (*filter) (void *filter_data, int data_idx, int *val);
54 void (*filter_cleanup)(void *filter_data); 54 void (*filter_cleanup)(void *filter_data);
55 void (*wait_for_sync)(void); 55 void (*wait_for_sync)(void);
56 bool wakeup; 56 bool wakeup;
57 unsigned long irq_flags;
57}; 58};
58 59
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
index 34af0a3477bf..bcaa2f762cc1 100644
--- a/include/linux/spi/max7301.h
+++ b/include/linux/spi/max7301.h
@@ -11,6 +11,7 @@ struct max7301 {
11 struct mutex lock; 11 struct mutex lock;
12 u8 port_config[8]; /* field 0 is unused */ 12 u8 port_config[8]; /* field 0 is unused */
13 u32 out_level; /* cached output levels */ 13 u32 out_level; /* cached output levels */
14 u32 input_pullup_active;
14 struct gpio_chip chip; 15 struct gpio_chip chip;
15 struct device *dev; 16 struct device *dev;
16 int (*write)(struct device *dev, unsigned int reg, unsigned int val); 17 int (*write)(struct device *dev, unsigned int reg, unsigned int val);
@@ -20,6 +21,13 @@ struct max7301 {
20struct max7301_platform_data { 21struct max7301_platform_data {
21 /* number assigned to the first GPIO */ 22 /* number assigned to the first GPIO */
22 unsigned base; 23 unsigned base;
24 /*
25 * bitmask controlling the pullup configuration,
26 *
27 * _note_ the 4 lowest bits are unused, because the first 4
28 * ports of the controller are not used, too.
29 */
30 u32 input_pullup_active;
23}; 31};
24 32
25extern int __max730x_remove(struct device *dev); 33extern int __max730x_remove(struct device *dev);
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 3274c507b8a9..f987a2bee16a 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -1,24 +1,6 @@
1#ifndef __SPI_BITBANG_H 1#ifndef __SPI_BITBANG_H
2#define __SPI_BITBANG_H 2#define __SPI_BITBANG_H
3 3
4/*
5 * Mix this utility code with some glue code to get one of several types of
6 * simple SPI master driver. Two do polled word-at-a-time I/O:
7 *
8 * - GPIO/parport bitbangers. Provide chipselect() and txrx_word[](),
9 * expanding the per-word routines from the inline templates below.
10 *
11 * - Drivers for controllers resembling bare shift registers. Provide
12 * chipselect() and txrx_word[](), with custom setup()/cleanup() methods
13 * that use your controller's clock and chipselect registers.
14 *
15 * Some hardware works well with requests at spi_transfer scope:
16 *
17 * - Drivers leveraging smarter hardware, with fifos or DMA; or for half
18 * duplex (MicroWire) controllers. Provide chipselect() and txrx_bufs(),
19 * and custom setup()/cleanup() methods.
20 */
21
22#include <linux/workqueue.h> 4#include <linux/workqueue.h>
23 5
24struct spi_bitbang { 6struct spi_bitbang {
@@ -68,86 +50,3 @@ extern int spi_bitbang_start(struct spi_bitbang *spi);
68extern int spi_bitbang_stop(struct spi_bitbang *spi); 50extern int spi_bitbang_stop(struct spi_bitbang *spi);
69 51
70#endif /* __SPI_BITBANG_H */ 52#endif /* __SPI_BITBANG_H */
71
72/*-------------------------------------------------------------------------*/
73
74#ifdef EXPAND_BITBANG_TXRX
75
76/*
77 * The code that knows what GPIO pins do what should have declared four
78 * functions, ideally as inlines, before #defining EXPAND_BITBANG_TXRX
79 * and including this header:
80 *
81 * void setsck(struct spi_device *, int is_on);
82 * void setmosi(struct spi_device *, int is_on);
83 * int getmiso(struct spi_device *);
84 * void spidelay(unsigned);
85 *
86 * setsck()'s is_on parameter is a zero/nonzero boolean.
87 *
88 * setmosi()'s is_on parameter is a zero/nonzero boolean.
89 *
90 * getmiso() is required to return 0 or 1 only. Any other value is invalid
91 * and will result in improper operation.
92 *
93 * A non-inlined routine would call bitbang_txrx_*() routines. The
94 * main loop could easily compile down to a handful of instructions,
95 * especially if the delay is a NOP (to run at peak speed).
96 *
97 * Since this is software, the timings may not be exactly what your board's
98 * chips need ... there may be several reasons you'd need to tweak timings
99 * in these routines, not just make to make it faster or slower to match a
100 * particular CPU clock rate.
101 */
102
103static inline u32
104bitbang_txrx_be_cpha0(struct spi_device *spi,
105 unsigned nsecs, unsigned cpol,
106 u32 word, u8 bits)
107{
108 /* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
109
110 /* clock starts at inactive polarity */
111 for (word <<= (32 - bits); likely(bits); bits--) {
112
113 /* setup MSB (to slave) on trailing edge */
114 setmosi(spi, word & (1 << 31));
115 spidelay(nsecs); /* T(setup) */
116
117 setsck(spi, !cpol);
118 spidelay(nsecs);
119
120 /* sample MSB (from slave) on leading edge */
121 word <<= 1;
122 word |= getmiso(spi);
123 setsck(spi, cpol);
124 }
125 return word;
126}
127
128static inline u32
129bitbang_txrx_be_cpha1(struct spi_device *spi,
130 unsigned nsecs, unsigned cpol,
131 u32 word, u8 bits)
132{
133 /* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
134
135 /* clock starts at inactive polarity */
136 for (word <<= (32 - bits); likely(bits); bits--) {
137
138 /* setup MSB (to slave) on leading edge */
139 setsck(spi, !cpol);
140 setmosi(spi, word & (1 << 31));
141 spidelay(nsecs); /* T(setup) */
142
143 setsck(spi, cpol);
144 spidelay(nsecs);
145
146 /* sample MSB (from slave) on trailing edge */
147 word <<= 1;
148 word |= getmiso(spi);
149 }
150 return word;
151}
152
153#endif /* EXPAND_BITBANG_TXRX */
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
index aed64ed3dc8a..a223ecbc71ef 100644
--- a/include/linux/spi/wl12xx.h
+++ b/include/linux/spi/wl12xx.h
@@ -26,6 +26,8 @@
26 26
27struct wl12xx_platform_data { 27struct wl12xx_platform_data {
28 void (*set_power)(bool enable); 28 void (*set_power)(bool enable);
29 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
30 int irq;
29 bool use_eeprom; 31 bool use_eeprom;
30}; 32};
31 33
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 89fac6a3f78b..f8854655860e 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -60,7 +60,7 @@
60/* 60/*
61 * Must define these before including other files, inline functions need them 61 * Must define these before including other files, inline functions need them
62 */ 62 */
63#define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME 63#define LOCK_SECTION_NAME ".text..lock."KBUILD_BASENAME
64 64
65#define LOCK_SECTION_START(extra) \ 65#define LOCK_SECTION_START(extra) \
66 ".subsection 1\n\t" \ 66 ".subsection 1\n\t" \
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 18e7c7c0cae6..997c3b4c212b 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -82,4 +82,11 @@ extern ssize_t splice_to_pipe(struct pipe_inode_info *,
82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *, 82extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
83 splice_direct_actor *); 83 splice_direct_actor *);
84 84
85/*
86 * for dynamic pipe sizing
87 */
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *,
90 struct splice_pipe_desc *);
91
85#endif 92#endif
diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 4d5ecb222af9..4d5d2f546dbf 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -27,6 +27,8 @@
27#ifndef _LINUX_SRCU_H 27#ifndef _LINUX_SRCU_H
28#define _LINUX_SRCU_H 28#define _LINUX_SRCU_H
29 29
30#include <linux/mutex.h>
31
30struct srcu_struct_array { 32struct srcu_struct_array {
31 int c[2]; 33 int c[2];
32}; 34};
@@ -84,8 +86,8 @@ long srcu_batches_completed(struct srcu_struct *sp);
84/** 86/**
85 * srcu_read_lock_held - might we be in SRCU read-side critical section? 87 * srcu_read_lock_held - might we be in SRCU read-side critical section?
86 * 88 *
87 * If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in 89 * If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an SRCU
88 * an SRCU read-side critical section. In absence of CONFIG_PROVE_LOCKING, 90 * read-side critical section. In absence of CONFIG_DEBUG_LOCK_ALLOC,
89 * this assumes we are in an SRCU read-side critical section unless it can 91 * this assumes we are in an SRCU read-side critical section unless it can
90 * prove otherwise. 92 * prove otherwise.
91 */ 93 */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 24f988547361..623b704fdc42 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -167,7 +167,7 @@ struct ssb_device {
167 * is an optimization. */ 167 * is an optimization. */
168 const struct ssb_bus_ops *ops; 168 const struct ssb_bus_ops *ops;
169 169
170 struct device *dev; 170 struct device *dev, *dma_dev;
171 171
172 struct ssb_bus *bus; 172 struct ssb_bus *bus;
173 struct ssb_device_id id; 173 struct ssb_device_id id;
@@ -305,6 +305,7 @@ struct ssb_bus {
305 /* ID information about the Chip. */ 305 /* ID information about the Chip. */
306 u16 chip_id; 306 u16 chip_id;
307 u16 chip_rev; 307 u16 chip_rev;
308 u16 sprom_offset;
308 u16 sprom_size; /* number of words in sprom */ 309 u16 sprom_size; /* number of words in sprom */
309 u8 chip_package; 310 u8 chip_package;
310 311
@@ -394,6 +395,9 @@ extern int ssb_bus_sdiobus_register(struct ssb_bus *bus,
394 395
395extern void ssb_bus_unregister(struct ssb_bus *bus); 396extern void ssb_bus_unregister(struct ssb_bus *bus);
396 397
398/* Does the device have an SPROM? */
399extern bool ssb_is_sprom_available(struct ssb_bus *bus);
400
397/* Set a fallback SPROM. 401/* Set a fallback SPROM.
398 * See kdoc at the function definition for complete documentation. */ 402 * See kdoc at the function definition for complete documentation. */
399extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom); 403extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
@@ -466,14 +470,6 @@ extern u32 ssb_dma_translation(struct ssb_device *dev);
466#define SSB_DMA_TRANSLATION_MASK 0xC0000000 470#define SSB_DMA_TRANSLATION_MASK 0xC0000000
467#define SSB_DMA_TRANSLATION_SHIFT 30 471#define SSB_DMA_TRANSLATION_SHIFT 30
468 472
469extern int ssb_dma_set_mask(struct ssb_device *dev, u64 mask);
470
471extern void * ssb_dma_alloc_consistent(struct ssb_device *dev, size_t size,
472 dma_addr_t *dma_handle, gfp_t gfp_flags);
473extern void ssb_dma_free_consistent(struct ssb_device *dev, size_t size,
474 void *vaddr, dma_addr_t dma_handle,
475 gfp_t gfp_flags);
476
477static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) 473static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
478{ 474{
479#ifdef CONFIG_SSB_DEBUG 475#ifdef CONFIG_SSB_DEBUG
@@ -482,155 +478,6 @@ static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev)
482#endif /* DEBUG */ 478#endif /* DEBUG */
483} 479}
484 480
485static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
486{
487 switch (dev->bus->bustype) {
488 case SSB_BUSTYPE_PCI:
489#ifdef CONFIG_SSB_PCIHOST
490 return pci_dma_mapping_error(dev->bus->host_pci, addr);
491#endif
492 break;
493 case SSB_BUSTYPE_SSB:
494 return dma_mapping_error(dev->dev, addr);
495 default:
496 break;
497 }
498 __ssb_dma_not_implemented(dev);
499 return -ENOSYS;
500}
501
502static inline dma_addr_t ssb_dma_map_single(struct ssb_device *dev, void *p,
503 size_t size, enum dma_data_direction dir)
504{
505 switch (dev->bus->bustype) {
506 case SSB_BUSTYPE_PCI:
507#ifdef CONFIG_SSB_PCIHOST
508 return pci_map_single(dev->bus->host_pci, p, size, dir);
509#endif
510 break;
511 case SSB_BUSTYPE_SSB:
512 return dma_map_single(dev->dev, p, size, dir);
513 default:
514 break;
515 }
516 __ssb_dma_not_implemented(dev);
517 return 0;
518}
519
520static inline void ssb_dma_unmap_single(struct ssb_device *dev, dma_addr_t dma_addr,
521 size_t size, enum dma_data_direction dir)
522{
523 switch (dev->bus->bustype) {
524 case SSB_BUSTYPE_PCI:
525#ifdef CONFIG_SSB_PCIHOST
526 pci_unmap_single(dev->bus->host_pci, dma_addr, size, dir);
527 return;
528#endif
529 break;
530 case SSB_BUSTYPE_SSB:
531 dma_unmap_single(dev->dev, dma_addr, size, dir);
532 return;
533 default:
534 break;
535 }
536 __ssb_dma_not_implemented(dev);
537}
538
539static inline void ssb_dma_sync_single_for_cpu(struct ssb_device *dev,
540 dma_addr_t dma_addr,
541 size_t size,
542 enum dma_data_direction dir)
543{
544 switch (dev->bus->bustype) {
545 case SSB_BUSTYPE_PCI:
546#ifdef CONFIG_SSB_PCIHOST
547 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
548 size, dir);
549 return;
550#endif
551 break;
552 case SSB_BUSTYPE_SSB:
553 dma_sync_single_for_cpu(dev->dev, dma_addr, size, dir);
554 return;
555 default:
556 break;
557 }
558 __ssb_dma_not_implemented(dev);
559}
560
561static inline void ssb_dma_sync_single_for_device(struct ssb_device *dev,
562 dma_addr_t dma_addr,
563 size_t size,
564 enum dma_data_direction dir)
565{
566 switch (dev->bus->bustype) {
567 case SSB_BUSTYPE_PCI:
568#ifdef CONFIG_SSB_PCIHOST
569 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
570 size, dir);
571 return;
572#endif
573 break;
574 case SSB_BUSTYPE_SSB:
575 dma_sync_single_for_device(dev->dev, dma_addr, size, dir);
576 return;
577 default:
578 break;
579 }
580 __ssb_dma_not_implemented(dev);
581}
582
583static inline void ssb_dma_sync_single_range_for_cpu(struct ssb_device *dev,
584 dma_addr_t dma_addr,
585 unsigned long offset,
586 size_t size,
587 enum dma_data_direction dir)
588{
589 switch (dev->bus->bustype) {
590 case SSB_BUSTYPE_PCI:
591#ifdef CONFIG_SSB_PCIHOST
592 /* Just sync everything. That's all the PCI API can do. */
593 pci_dma_sync_single_for_cpu(dev->bus->host_pci, dma_addr,
594 offset + size, dir);
595 return;
596#endif
597 break;
598 case SSB_BUSTYPE_SSB:
599 dma_sync_single_range_for_cpu(dev->dev, dma_addr, offset,
600 size, dir);
601 return;
602 default:
603 break;
604 }
605 __ssb_dma_not_implemented(dev);
606}
607
608static inline void ssb_dma_sync_single_range_for_device(struct ssb_device *dev,
609 dma_addr_t dma_addr,
610 unsigned long offset,
611 size_t size,
612 enum dma_data_direction dir)
613{
614 switch (dev->bus->bustype) {
615 case SSB_BUSTYPE_PCI:
616#ifdef CONFIG_SSB_PCIHOST
617 /* Just sync everything. That's all the PCI API can do. */
618 pci_dma_sync_single_for_device(dev->bus->host_pci, dma_addr,
619 offset + size, dir);
620 return;
621#endif
622 break;
623 case SSB_BUSTYPE_SSB:
624 dma_sync_single_range_for_device(dev->dev, dma_addr, offset,
625 size, dir);
626 return;
627 default:
628 break;
629 }
630 __ssb_dma_not_implemented(dev);
631}
632
633
634#ifdef CONFIG_SSB_PCIHOST 481#ifdef CONFIG_SSB_PCIHOST
635/* PCI-host wrapper driver */ 482/* PCI-host wrapper driver */
636extern int ssb_pcihost_register(struct pci_driver *driver); 483extern int ssb_pcihost_register(struct pci_driver *driver);
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 4e27acf0a92f..2cdf249b4e5f 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -53,6 +53,7 @@
53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ 53#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */
54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ 54#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */
55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ 55#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */
56#define SSB_CHIPCO_CAP_SPROM 0x40000000 /* SPROM present */
56#define SSB_CHIPCO_CORECTL 0x0008 57#define SSB_CHIPCO_CORECTL 0x0008
57#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ 58#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */
58#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ 59#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */
@@ -385,6 +386,7 @@
385 386
386 387
387/** Chip specific Chip-Status register contents. */ 388/** Chip specific Chip-Status register contents. */
389#define SSB_CHIPCO_CHST_4322_SPROM_EXISTS 0x00000040 /* SPROM present */
388#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 390#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003
389#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ 391#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */
390#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ 392#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */
@@ -398,6 +400,18 @@
398#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 400#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4
399#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ 401#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */
400 402
403/** Macros to determine SPROM presence based on Chip-Status register. */
404#define SSB_CHIPCO_CHST_4312_SPROM_PRESENT(status) \
405 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
406 SSB_CHIPCO_CHST_4325_OTP_SEL)
407#define SSB_CHIPCO_CHST_4322_SPROM_PRESENT(status) \
408 (status & SSB_CHIPCO_CHST_4322_SPROM_EXISTS)
409#define SSB_CHIPCO_CHST_4325_SPROM_PRESENT(status) \
410 (((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
411 SSB_CHIPCO_CHST_4325_DEFCIS_SEL) && \
412 ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \
413 SSB_CHIPCO_CHST_4325_OTP_SEL))
414
401 415
402 416
403/** Clockcontrol masks and values **/ 417/** Clockcontrol masks and values **/
@@ -564,6 +578,7 @@ struct ssb_chipcommon_pmu {
564struct ssb_chipcommon { 578struct ssb_chipcommon {
565 struct ssb_device *dev; 579 struct ssb_device *dev;
566 u32 capabilities; 580 u32 capabilities;
581 u32 status;
567 /* Fast Powerup Delay constant */ 582 /* Fast Powerup Delay constant */
568 u16 fast_pwrup_delay; 583 u16 fast_pwrup_delay;
569 struct ssb_chipcommon_pmu pmu; 584 struct ssb_chipcommon_pmu pmu;
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 9ae9082eaeb4..a6d5225b9275 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -170,26 +170,27 @@
170#define SSB_SPROMSIZE_WORDS_R4 220 170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) 171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) 172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
173#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE1 0x1000
174#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_BASE31 0x0800
175#define SSB_SPROM_REVISION 0x007E
175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 176#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 177#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
177#define SSB_SPROM_REVISION_CRC_SHIFT 8 178#define SSB_SPROM_REVISION_CRC_SHIFT 8
178 179
179/* SPROM Revision 1 */ 180/* SPROM Revision 1 */
180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 181#define SSB_SPROM1_SPID 0x0004 /* Subsystem Product ID for PCI */
181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 182#define SSB_SPROM1_SVID 0x0006 /* Subsystem Vendor ID for PCI */
182#define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */ 183#define SSB_SPROM1_PID 0x0008 /* Product ID for PCI */
183#define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */ 184#define SSB_SPROM1_IL0MAC 0x0048 /* 6 bytes MAC address for 802.11b/g */
184#define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */ 185#define SSB_SPROM1_ET0MAC 0x004E /* 6 bytes MAC address for Ethernet */
185#define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */ 186#define SSB_SPROM1_ET1MAC 0x0054 /* 6 bytes MAC address for 802.11a */
186#define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */ 187#define SSB_SPROM1_ETHPHY 0x005A /* Ethernet PHY settings */
187#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 188#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
188#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 189#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
189#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5 190#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5
190#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 191#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
191#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 192#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
192#define SSB_SPROM1_BINF 0x105C /* Board info */ 193#define SSB_SPROM1_BINF 0x005C /* Board info */
193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 194#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 195#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
195#define SSB_SPROM1_BINF_CCODE_SHIFT 8 196#define SSB_SPROM1_BINF_CCODE_SHIFT 8
@@ -197,63 +198,63 @@
197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12 198#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */ 199#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
199#define SSB_SPROM1_BINF_ANTA_SHIFT 14 200#define SSB_SPROM1_BINF_ANTA_SHIFT 14
200#define SSB_SPROM1_PA0B0 0x105E 201#define SSB_SPROM1_PA0B0 0x005E
201#define SSB_SPROM1_PA0B1 0x1060 202#define SSB_SPROM1_PA0B1 0x0060
202#define SSB_SPROM1_PA0B2 0x1062 203#define SSB_SPROM1_PA0B2 0x0062
203#define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */ 204#define SSB_SPROM1_GPIOA 0x0064 /* General Purpose IO pins 0 and 1 */
204#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */ 205#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */
205#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */ 206#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */
206#define SSB_SPROM1_GPIOA_P1_SHIFT 8 207#define SSB_SPROM1_GPIOA_P1_SHIFT 8
207#define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */ 208#define SSB_SPROM1_GPIOB 0x0066 /* General Purpuse IO pins 2 and 3 */
208#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */ 209#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */
209#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */ 210#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
210#define SSB_SPROM1_GPIOB_P3_SHIFT 8 211#define SSB_SPROM1_GPIOB_P3_SHIFT 8
211#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */ 212#define SSB_SPROM1_MAXPWR 0x0068 /* Power Amplifier Max Power */
212#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */ 213#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
213#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */ 214#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
214#define SSB_SPROM1_MAXPWR_A_SHIFT 8 215#define SSB_SPROM1_MAXPWR_A_SHIFT 8
215#define SSB_SPROM1_PA1B0 0x106A 216#define SSB_SPROM1_PA1B0 0x006A
216#define SSB_SPROM1_PA1B1 0x106C 217#define SSB_SPROM1_PA1B1 0x006C
217#define SSB_SPROM1_PA1B2 0x106E 218#define SSB_SPROM1_PA1B2 0x006E
218#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */ 219#define SSB_SPROM1_ITSSI 0x0070 /* Idle TSSI Target */
219#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/ 220#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
220#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */ 221#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
221#define SSB_SPROM1_ITSSI_A_SHIFT 8 222#define SSB_SPROM1_ITSSI_A_SHIFT 8
222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 223#define SSB_SPROM1_BFLLO 0x0072 /* Boardflags (low 16 bits) */
223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 224#define SSB_SPROM1_AGAIN 0x0074 /* Antenna Gain (in dBm Q5.2) */
224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
225#define SSB_SPROM1_AGAIN_BG_SHIFT 0 226#define SSB_SPROM1_AGAIN_BG_SHIFT 0
226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ 227#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
227#define SSB_SPROM1_AGAIN_A_SHIFT 8 228#define SSB_SPROM1_AGAIN_A_SHIFT 8
228 229
229/* SPROM Revision 2 (inherits from rev 1) */ 230/* SPROM Revision 2 (inherits from rev 1) */
230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 231#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 232#define SSB_SPROM2_MAXP_A 0x003A /* A-PHY Max Power */
232#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */ 233#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */
233#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */ 234#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */
234#define SSB_SPROM2_MAXP_A_LO_SHIFT 8 235#define SSB_SPROM2_MAXP_A_LO_SHIFT 8
235#define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */ 236#define SSB_SPROM2_PA1LOB0 0x003C /* A-PHY PowerAmplifier Low Settings */
236#define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */ 237#define SSB_SPROM2_PA1LOB1 0x003E /* A-PHY PowerAmplifier Low Settings */
237#define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */ 238#define SSB_SPROM2_PA1LOB2 0x0040 /* A-PHY PowerAmplifier Low Settings */
238#define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */ 239#define SSB_SPROM2_PA1HIB0 0x0042 /* A-PHY PowerAmplifier High Settings */
239#define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */ 240#define SSB_SPROM2_PA1HIB1 0x0044 /* A-PHY PowerAmplifier High Settings */
240#define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */ 241#define SSB_SPROM2_PA1HIB2 0x0046 /* A-PHY PowerAmplifier High Settings */
241#define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */ 242#define SSB_SPROM2_OPO 0x0078 /* OFDM Power Offset from CCK Level */
242#define SSB_SPROM2_OPO_VALUE 0x00FF 243#define SSB_SPROM2_OPO_VALUE 0x00FF
243#define SSB_SPROM2_OPO_UNUSED 0xFF00 244#define SSB_SPROM2_OPO_UNUSED 0xFF00
244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 245#define SSB_SPROM2_CCODE 0x007C /* Two char Country Code */
245 246
246/* SPROM Revision 3 (inherits most data from rev 2) */ 247/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ 248#define SSB_SPROM3_OFDMAPO 0x002C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
248#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 249#define SSB_SPROM3_OFDMALPO 0x0030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
249#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAHPO 0x0034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
250#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_GPIOLDC 0x0042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
251#define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */ 252#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */
253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8 253#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8
254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */ 254#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */
255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16 255#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16
256#define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */ 256#define SSB_SPROM3_IL0MAC 0x004A /* 6 bytes MAC address for 802.11b/g */
257#define SSB_SPROM3_CCKPO 0x0078 /* CCK Power Offset */
257#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */ 258#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */
258#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */ 259#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */
259#define SSB_SPROM3_CCKPO_2M_SHIFT 4 260#define SSB_SPROM3_CCKPO_2M_SHIFT 4
@@ -264,100 +265,100 @@
264#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 265#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
265 266
266/* SPROM Revision 4 */ 267/* SPROM Revision 4 */
267#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ 268#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
268#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ 269#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
270#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
271#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
272#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
273#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
274#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
275#define SSB_SPROM4_GPIOA_P1_SHIFT 8
276#define SSB_SPROM4_GPIOB 0x0058 /* Gen. Purpose IO # 2 and 3 */
277#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
278#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
279#define SSB_SPROM4_GPIOB_P3_SHIFT 8
280#define SSB_SPROM4_ETHPHY 0x005A /* Ethernet PHY settings ?? */
269#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 281#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
270#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 282#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
271#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 283#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
272#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ 284#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
273#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ 285#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
274#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */ 286#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */
275#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */ 287#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
276#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ 288#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
277#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 289#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
278#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ 290#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
279#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 291#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
280#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
281#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
282#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ 292#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
283#define SSB_SPROM4_AGAIN0_SHIFT 0 293#define SSB_SPROM4_AGAIN0_SHIFT 0
284#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */ 294#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
285#define SSB_SPROM4_AGAIN1_SHIFT 8 295#define SSB_SPROM4_AGAIN1_SHIFT 8
286#define SSB_SPROM4_AGAIN23 0x1060 296#define SSB_SPROM4_AGAIN23 0x0060
287#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */ 297#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
288#define SSB_SPROM4_AGAIN2_SHIFT 0 298#define SSB_SPROM4_AGAIN2_SHIFT 0
289#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ 299#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
290#define SSB_SPROM4_AGAIN3_SHIFT 8 300#define SSB_SPROM4_AGAIN3_SHIFT 8
291#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */ 301#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
292#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
293#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ 302#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
294#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 303#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
295#define SSB_SPROM4_ITSSI_BG_SHIFT 8 304#define SSB_SPROM4_ITSSI_BG_SHIFT 8
296#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */ 305#define SSB_SPROM4_MAXP_A 0x008A /* Max Power A in path 1 */
297#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ 306#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
298#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 307#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
299#define SSB_SPROM4_ITSSI_A_SHIFT 8 308#define SSB_SPROM4_ITSSI_A_SHIFT 8
300#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */ 309#define SSB_SPROM4_PA0B0 0x0082 /* The paXbY locations are */
301#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */ 310#define SSB_SPROM4_PA0B1 0x0084 /* only guesses */
302#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */ 311#define SSB_SPROM4_PA0B2 0x0086
303#define SSB_SPROM4_GPIOA_P1_SHIFT 8 312#define SSB_SPROM4_PA1B0 0x008E
304#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */ 313#define SSB_SPROM4_PA1B1 0x0090
305#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */ 314#define SSB_SPROM4_PA1B2 0x0092
306#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
307#define SSB_SPROM4_GPIOB_P3_SHIFT 8
308#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
309#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
310#define SSB_SPROM4_PA0B2 0x1086
311#define SSB_SPROM4_PA1B0 0x108E
312#define SSB_SPROM4_PA1B1 0x1090
313#define SSB_SPROM4_PA1B2 0x1092
314 315
315/* SPROM Revision 5 (inherits most data from rev 4) */ 316/* SPROM Revision 5 (inherits most data from rev 4) */
316#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */ 317#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
317#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */ 318#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
318#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */ 319#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
319#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */ 320#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
320#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */ 321#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
321#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ 322#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
322#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ 323#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
323#define SSB_SPROM5_GPIOA_P1_SHIFT 8 324#define SSB_SPROM5_GPIOA_P1_SHIFT 8
324#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */ 325#define SSB_SPROM5_GPIOB 0x0078 /* Gen. Purpose IO # 2 and 3 */
325#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ 326#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ 327#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8 328#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328 329
329/* SPROM Revision 8 */ 330/* SPROM Revision 8 */
330#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */ 331#define SSB_SPROM8_BOARDREV 0x0082 /* Board revision */
331#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */ 332#define SSB_SPROM8_BFLLO 0x0084 /* Board flags (bits 0-15) */
332#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */ 333#define SSB_SPROM8_BFLHI 0x0086 /* Board flags (bits 16-31) */
333#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */ 334#define SSB_SPROM8_BFL2LO 0x0088 /* Board flags (bits 32-47) */
334#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */ 335#define SSB_SPROM8_BFL2HI 0x008A /* Board flags (bits 48-63) */
335#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */ 336#define SSB_SPROM8_IL0MAC 0x008C /* 6 byte MAC address */
336#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */ 337#define SSB_SPROM8_CCODE 0x0092 /* 2 byte country code */
337#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/ 338#define SSB_SPROM8_GPIOA 0x0096 /*Gen. Purpose IO # 0 and 1 */
338#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ 339#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
339#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 340#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
340#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ 341#define SSB_SPROM8_GPIOA_P1_SHIFT 8
341#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0 342#define SSB_SPROM8_GPIOB 0x0098 /* Gen. Purpose IO # 2 and 3 */
342#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */ 343#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
344#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
345#define SSB_SPROM8_GPIOB_P3_SHIFT 8
346#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
347#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
348#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
349#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
350#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
351#define SSB_SPROM8_AGAIN01 0x009E /* Antenna Gain (in dBm Q5.2) */
343#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */ 352#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
344#define SSB_SPROM8_AGAIN0_SHIFT 0 353#define SSB_SPROM8_AGAIN0_SHIFT 0
345#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */ 354#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
346#define SSB_SPROM8_AGAIN1_SHIFT 8 355#define SSB_SPROM8_AGAIN1_SHIFT 8
347#define SSB_SPROM8_AGAIN23 0x10A0 356#define SSB_SPROM8_AGAIN23 0x00A0
348#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */ 357#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
349#define SSB_SPROM8_AGAIN2_SHIFT 0 358#define SSB_SPROM8_AGAIN2_SHIFT 0
350#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ 359#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
351#define SSB_SPROM8_AGAIN3_SHIFT 8 360#define SSB_SPROM8_AGAIN3_SHIFT 8
352#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */ 361#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
353#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
354#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
355#define SSB_SPROM8_GPIOA_P1_SHIFT 8
356#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
357#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
358#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
359#define SSB_SPROM8_GPIOB_P3_SHIFT 8
360#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
361#define SSB_SPROM8_RSSISMF2G 0x000F 362#define SSB_SPROM8_RSSISMF2G 0x000F
362#define SSB_SPROM8_RSSISMC2G 0x00F0 363#define SSB_SPROM8_RSSISMC2G 0x00F0
363#define SSB_SPROM8_RSSISMC2G_SHIFT 4 364#define SSB_SPROM8_RSSISMC2G_SHIFT 4
@@ -365,7 +366,7 @@
365#define SSB_SPROM8_RSSISAV2G_SHIFT 8 366#define SSB_SPROM8_RSSISAV2G_SHIFT 8
366#define SSB_SPROM8_BXA2G 0x1800 367#define SSB_SPROM8_BXA2G 0x1800
367#define SSB_SPROM8_BXA2G_SHIFT 11 368#define SSB_SPROM8_BXA2G_SHIFT 11
368#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */ 369#define SSB_SPROM8_RSSIPARM5G 0x00A6 /* RSSI params for 5GHz */
369#define SSB_SPROM8_RSSISMF5G 0x000F 370#define SSB_SPROM8_RSSISMF5G 0x000F
370#define SSB_SPROM8_RSSISMC5G 0x00F0 371#define SSB_SPROM8_RSSISMC5G 0x00F0
371#define SSB_SPROM8_RSSISMC5G_SHIFT 4 372#define SSB_SPROM8_RSSISMC5G_SHIFT 4
@@ -373,47 +374,47 @@
373#define SSB_SPROM8_RSSISAV5G_SHIFT 8 374#define SSB_SPROM8_RSSISAV5G_SHIFT 8
374#define SSB_SPROM8_BXA5G 0x1800 375#define SSB_SPROM8_BXA5G 0x1800
375#define SSB_SPROM8_BXA5G_SHIFT 11 376#define SSB_SPROM8_BXA5G_SHIFT 11
376#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */ 377#define SSB_SPROM8_TRI25G 0x00A8 /* TX isolation 2.4&5.3GHz */
377#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */ 378#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
378#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */ 379#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
379#define SSB_SPROM8_TRI5G_SHIFT 8 380#define SSB_SPROM8_TRI5G_SHIFT 8
380#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */ 381#define SSB_SPROM8_TRI5GHL 0x00AA /* TX isolation 5.2/5.8GHz */
381#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */ 382#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
382#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */ 383#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
383#define SSB_SPROM8_TRI5GH_SHIFT 8 384#define SSB_SPROM8_TRI5GH_SHIFT 8
384#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */ 385#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
385#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ 386#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
386#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ 387#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
387#define SSB_SPROM8_RXPO5G_SHIFT 8 388#define SSB_SPROM8_RXPO5G_SHIFT 8
388#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */ 389#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
389#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ 390#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
390#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ 391#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
391#define SSB_SPROM8_ITSSI_BG_SHIFT 8 392#define SSB_SPROM8_ITSSI_BG_SHIFT 8
392#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */ 393#define SSB_SPROM8_PA0B0 0x00C2 /* 2GHz power amp settings */
393#define SSB_SPROM8_PA0B1 0x10C4 394#define SSB_SPROM8_PA0B1 0x00C4
394#define SSB_SPROM8_PA0B2 0x10C6 395#define SSB_SPROM8_PA0B2 0x00C6
395#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */ 396#define SSB_SPROM8_MAXP_A 0x00C8 /* Max Power 5.3GHz */
396#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */ 397#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
397#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ 398#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
398#define SSB_SPROM8_ITSSI_A_SHIFT 8 399#define SSB_SPROM8_ITSSI_A_SHIFT 8
399#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */ 400#define SSB_SPROM8_MAXP_AHL 0x00CA /* Max Power 5.2/5.8GHz */
400#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */ 401#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */
401#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */ 402#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */
402#define SSB_SPROM8_MAXP_AL_SHIFT 8 403#define SSB_SPROM8_MAXP_AL_SHIFT 8
403#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */ 404#define SSB_SPROM8_PA1B0 0x00CC /* 5.3GHz power amp settings */
404#define SSB_SPROM8_PA1B1 0x10CE 405#define SSB_SPROM8_PA1B1 0x00CE
405#define SSB_SPROM8_PA1B2 0x10D0 406#define SSB_SPROM8_PA1B2 0x00D0
406#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */ 407#define SSB_SPROM8_PA1LOB0 0x00D2 /* 5.2GHz power amp settings */
407#define SSB_SPROM8_PA1LOB1 0x10D4 408#define SSB_SPROM8_PA1LOB1 0x00D4
408#define SSB_SPROM8_PA1LOB2 0x10D6 409#define SSB_SPROM8_PA1LOB2 0x00D6
409#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */ 410#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
410#define SSB_SPROM8_PA1HIB1 0x10DA 411#define SSB_SPROM8_PA1HIB1 0x00DA
411#define SSB_SPROM8_PA1HIB2 0x10DC 412#define SSB_SPROM8_PA1HIB2 0x00DC
412#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */ 413#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
413#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */ 414#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
414#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */ 415#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
415#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */ 416#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
416#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */ 417#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
417 418
418/* Values for SSB_SPROM1_BINF_CCODE */ 419/* Values for SSB_SPROM1_BINF_CCODE */
419enum { 420enum {
diff --git a/include/linux/statfs.h b/include/linux/statfs.h
index b34cc829f98d..0166d320a75d 100644
--- a/include/linux/statfs.h
+++ b/include/linux/statfs.h
@@ -2,7 +2,6 @@
2#define _LINUX_STATFS_H 2#define _LINUX_STATFS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5
6#include <asm/statfs.h> 5#include <asm/statfs.h>
7 6
8struct kstatfs { 7struct kstatfs {
@@ -16,7 +15,29 @@ struct kstatfs {
16 __kernel_fsid_t f_fsid; 15 __kernel_fsid_t f_fsid;
17 long f_namelen; 16 long f_namelen;
18 long f_frsize; 17 long f_frsize;
19 long f_spare[5]; 18 long f_flags;
19 long f_spare[4];
20}; 20};
21 21
22/*
23 * Definitions for the flag in f_flag.
24 *
25 * Generally these flags are equivalent to the MS_ flags used in the mount
26 * ABI. The exception is ST_VALID which has the same value as MS_REMOUNT
27 * which doesn't make any sense for statfs.
28 */
29#define ST_RDONLY 0x0001 /* mount read-only */
30#define ST_NOSUID 0x0002 /* ignore suid and sgid bits */
31#define ST_NODEV 0x0004 /* disallow access to device special files */
32#define ST_NOEXEC 0x0008 /* disallow program execution */
33#define ST_SYNCHRONOUS 0x0010 /* writes are synced at once */
34#define ST_VALID 0x0020 /* f_flags support is implemented */
35#define ST_MANDLOCK 0x0040 /* allow mandatory locks on an FS */
36/* 0x0080 used for ST_WRITE in glibc */
37/* 0x0100 used for ST_APPEND in glibc */
38/* 0x0200 used for ST_IMMUTABLE in glibc */
39#define ST_NOATIME 0x0400 /* do not update access times */
40#define ST_NODIRATIME 0x0800 /* do not update directory access times */
41#define ST_RELATIME 0x1000 /* update atime relative to mtime/ctime */
42
22#endif 43#endif
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 32bfd1a8a48d..632ff7c03280 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -33,6 +33,7 @@ struct plat_stmmacenet_data {
33 int bus_id; 33 int bus_id;
34 int pbl; 34 int pbl;
35 int has_gmac; 35 int has_gmac;
36 int enh_desc;
36 void (*fix_mac_speed)(void *priv, unsigned int speed); 37 void (*fix_mac_speed)(void *priv, unsigned int speed);
37 void (*bus_setup)(unsigned long ioaddr); 38 void (*bus_setup)(unsigned long ioaddr);
38#ifdef CONFIG_STM_DRIVERS 39#ifdef CONFIG_STM_DRIVERS
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index baba3a23a814..6b524a0d02e4 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -1,13 +1,101 @@
1#ifndef _LINUX_STOP_MACHINE 1#ifndef _LINUX_STOP_MACHINE
2#define _LINUX_STOP_MACHINE 2#define _LINUX_STOP_MACHINE
3/* "Bogolock": stop the entire machine, disable interrupts. This is a 3
4 very heavy lock, which is equivalent to grabbing every spinlock
5 (and more). So the "read" side to such a lock is anything which
6 disables preeempt. */
7#include <linux/cpu.h> 4#include <linux/cpu.h>
8#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/list.h>
9#include <asm/system.h> 7#include <asm/system.h>
10 8
9/*
10 * stop_cpu[s]() is simplistic per-cpu maximum priority cpu
11 * monopolization mechanism. The caller can specify a non-sleeping
12 * function to be executed on a single or multiple cpus preempting all
13 * other processes and monopolizing those cpus until it finishes.
14 *
15 * Resources for this mechanism are preallocated when a cpu is brought
16 * up and requests are guaranteed to be served as long as the target
17 * cpus are online.
18 */
19typedef int (*cpu_stop_fn_t)(void *arg);
20
21#ifdef CONFIG_SMP
22
23struct cpu_stop_work {
24 struct list_head list; /* cpu_stopper->works */
25 cpu_stop_fn_t fn;
26 void *arg;
27 struct cpu_stop_done *done;
28};
29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
34int try_stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
35
36#else /* CONFIG_SMP */
37
38#include <linux/workqueue.h>
39
40struct cpu_stop_work {
41 struct work_struct work;
42 cpu_stop_fn_t fn;
43 void *arg;
44};
45
46static inline int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
47{
48 int ret = -ENOENT;
49 preempt_disable();
50 if (cpu == smp_processor_id())
51 ret = fn(arg);
52 preempt_enable();
53 return ret;
54}
55
56static void stop_one_cpu_nowait_workfn(struct work_struct *work)
57{
58 struct cpu_stop_work *stwork =
59 container_of(work, struct cpu_stop_work, work);
60 preempt_disable();
61 stwork->fn(stwork->arg);
62 preempt_enable();
63}
64
65static inline void stop_one_cpu_nowait(unsigned int cpu,
66 cpu_stop_fn_t fn, void *arg,
67 struct cpu_stop_work *work_buf)
68{
69 if (cpu == smp_processor_id()) {
70 INIT_WORK(&work_buf->work, stop_one_cpu_nowait_workfn);
71 work_buf->fn = fn;
72 work_buf->arg = arg;
73 schedule_work(&work_buf->work);
74 }
75}
76
77static inline int stop_cpus(const struct cpumask *cpumask,
78 cpu_stop_fn_t fn, void *arg)
79{
80 if (cpumask_test_cpu(raw_smp_processor_id(), cpumask))
81 return stop_one_cpu(raw_smp_processor_id(), fn, arg);
82 return -ENOENT;
83}
84
85static inline int try_stop_cpus(const struct cpumask *cpumask,
86 cpu_stop_fn_t fn, void *arg)
87{
88 return stop_cpus(cpumask, fn, arg);
89}
90
91#endif /* CONFIG_SMP */
92
93/*
94 * stop_machine "Bogolock": stop the entire machine, disable
95 * interrupts. This is a very heavy lock, which is equivalent to
96 * grabbing every spinlock (and more). So the "read" side to such a
97 * lock is anything which disables preeempt.
98 */
11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 99#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12 100
13/** 101/**
@@ -36,24 +124,7 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
36 */ 124 */
37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 125int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38 126
39/** 127#else /* CONFIG_STOP_MACHINE && CONFIG_SMP */
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
56#else
57 128
58static inline int stop_machine(int (*fn)(void *), void *data, 129static inline int stop_machine(int (*fn)(void *), void *data,
59 const struct cpumask *cpus) 130 const struct cpumask *cpus)
@@ -65,8 +136,5 @@ static inline int stop_machine(int (*fn)(void *), void *data,
65 return ret; 136 return ret;
66} 137}
67 138
68static inline int stop_machine_create(void) { return 0; } 139#endif /* CONFIG_STOP_MACHINE && CONFIG_SMP */
69static inline void stop_machine_destroy(void) { } 140#endif /* _LINUX_STOP_MACHINE */
70
71#endif /* CONFIG_SMP */
72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 996df4dac7d4..5bbc447175dc 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -54,19 +54,14 @@ struct rpc_cred {
54#define RPCAUTH_CRED_NEW 0 54#define RPCAUTH_CRED_NEW 0
55#define RPCAUTH_CRED_UPTODATE 1 55#define RPCAUTH_CRED_UPTODATE 1
56#define RPCAUTH_CRED_HASHED 2 56#define RPCAUTH_CRED_HASHED 2
57#define RPCAUTH_CRED_NEGATIVE 3
57 58
58#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0 59#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
59 60
60/* 61/*
61 * Client authentication handle 62 * Client authentication handle
62 */ 63 */
63#define RPC_CREDCACHE_HASHBITS 4 64struct rpc_cred_cache;
64#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
65struct rpc_cred_cache {
66 struct hlist_head hashtable[RPC_CREDCACHE_NR];
67 spinlock_t lock;
68};
69
70struct rpc_authops; 65struct rpc_authops;
71struct rpc_auth { 66struct rpc_auth {
72 unsigned int au_cslack; /* call cred size estimate */ 67 unsigned int au_cslack; /* call cred size estimate */
@@ -111,7 +106,7 @@ struct rpc_credops {
111 void (*crdestroy)(struct rpc_cred *); 106 void (*crdestroy)(struct rpc_cred *);
112 107
113 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int); 108 int (*crmatch)(struct auth_cred *, struct rpc_cred *, int);
114 void (*crbind)(struct rpc_task *, struct rpc_cred *, int); 109 struct rpc_cred * (*crbind)(struct rpc_task *, struct rpc_cred *, int);
115 __be32 * (*crmarshal)(struct rpc_task *, __be32 *); 110 __be32 * (*crmarshal)(struct rpc_task *, __be32 *);
116 int (*crrefresh)(struct rpc_task *); 111 int (*crrefresh)(struct rpc_task *);
117 __be32 * (*crvalidate)(struct rpc_task *, __be32 *); 112 __be32 * (*crvalidate)(struct rpc_task *, __be32 *);
@@ -124,11 +119,12 @@ struct rpc_credops {
124extern const struct rpc_authops authunix_ops; 119extern const struct rpc_authops authunix_ops;
125extern const struct rpc_authops authnull_ops; 120extern const struct rpc_authops authnull_ops;
126 121
127void __init rpc_init_authunix(void); 122int __init rpc_init_authunix(void);
128void __init rpc_init_generic_auth(void); 123int __init rpc_init_generic_auth(void);
129void __init rpcauth_init_module(void); 124int __init rpcauth_init_module(void);
130void __exit rpcauth_remove_module(void); 125void __exit rpcauth_remove_module(void);
131void __exit rpc_destroy_generic_auth(void); 126void __exit rpc_destroy_generic_auth(void);
127void rpc_destroy_authunix(void);
132 128
133struct rpc_cred * rpc_lookup_cred(void); 129struct rpc_cred * rpc_lookup_cred(void);
134struct rpc_cred * rpc_lookup_machine_cred(void); 130struct rpc_cred * rpc_lookup_machine_cred(void);
@@ -139,10 +135,8 @@ void rpcauth_release(struct rpc_auth *);
139struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int); 135struct rpc_cred * rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);
140void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); 136void rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *);
141struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int); 137struct rpc_cred * rpcauth_lookupcred(struct rpc_auth *, int);
142void rpcauth_bindcred(struct rpc_task *, struct rpc_cred *, int); 138struct rpc_cred * rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
143void rpcauth_generic_bind_cred(struct rpc_task *, struct rpc_cred *, int);
144void put_rpccred(struct rpc_cred *); 139void put_rpccred(struct rpc_cred *);
145void rpcauth_unbindcred(struct rpc_task *);
146__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *); 140__be32 * rpcauth_marshcred(struct rpc_task *, __be32 *);
147__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *); 141__be32 * rpcauth_checkverf(struct rpc_task *, __be32 *);
148int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj); 142int rpcauth_wrap_req(struct rpc_task *task, kxdrproc_t encode, void *rqstp, __be32 *data, void *obj);
diff --git a/include/linux/sunrpc/auth_gss.h b/include/linux/sunrpc/auth_gss.h
index d48d4e605f74..671538d25bc1 100644
--- a/include/linux/sunrpc/auth_gss.h
+++ b/include/linux/sunrpc/auth_gss.h
@@ -82,6 +82,7 @@ struct gss_cred {
82 enum rpc_gss_svc gc_service; 82 enum rpc_gss_svc gc_service;
83 struct gss_cl_ctx *gc_ctx; 83 struct gss_cl_ctx *gc_ctx;
84 struct gss_upcall_msg *gc_upcall; 84 struct gss_upcall_msg *gc_upcall;
85 unsigned long gc_upcall_timestamp;
85 unsigned char gc_machine_cred : 1; 86 unsigned char gc_machine_cred : 1;
86}; 87};
87 88
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6f52b4d7c447..7bf3e84b92f4 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -192,6 +192,7 @@ extern int cache_check(struct cache_detail *detail,
192extern void cache_flush(void); 192extern void cache_flush(void);
193extern void cache_purge(struct cache_detail *detail); 193extern void cache_purge(struct cache_detail *detail);
194#define NEVER (0x7FFFFFFF) 194#define NEVER (0x7FFFFFFF)
195extern void __init cache_initialize(void);
195extern int cache_register(struct cache_detail *cd); 196extern int cache_register(struct cache_detail *cd);
196extern void cache_unregister(struct cache_detail *cd); 197extern void cache_unregister(struct cache_detail *cd);
197 198
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8ed9642a5a76..569dc722a600 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -131,6 +131,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
131struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 131struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
132void rpc_shutdown_client(struct rpc_clnt *); 132void rpc_shutdown_client(struct rpc_clnt *);
133void rpc_release_client(struct rpc_clnt *); 133void rpc_release_client(struct rpc_clnt *);
134void rpc_task_release_client(struct rpc_task *);
134 135
135int rpcb_register(u32, u32, int, unsigned short); 136int rpcb_register(u32, u32, int, unsigned short);
136int rpcb_v4_register(const u32 program, const u32 version, 137int rpcb_v4_register(const u32 program, const u32 version,
@@ -148,8 +149,8 @@ int rpc_call_sync(struct rpc_clnt *clnt,
148 const struct rpc_message *msg, int flags); 149 const struct rpc_message *msg, int flags);
149struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 150struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
150 int flags); 151 int flags);
151void rpc_restart_call_prepare(struct rpc_task *); 152int rpc_restart_call_prepare(struct rpc_task *);
152void rpc_restart_call(struct rpc_task *); 153int rpc_restart_call(struct rpc_task *);
153void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 154void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
154size_t rpc_max_payload(struct rpc_clnt *); 155size_t rpc_max_payload(struct rpc_clnt *);
155void rpc_force_rebind(struct rpc_clnt *); 156void rpc_force_rebind(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 03f33330ece2..5d8048beb051 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -35,7 +35,8 @@ int gss_import_sec_context(
35 const void* input_token, 35 const void* input_token,
36 size_t bufsize, 36 size_t bufsize,
37 struct gss_api_mech *mech, 37 struct gss_api_mech *mech,
38 struct gss_ctx **ctx_id); 38 struct gss_ctx **ctx_id,
39 gfp_t gfp_mask);
39u32 gss_get_mic( 40u32 gss_get_mic(
40 struct gss_ctx *ctx_id, 41 struct gss_ctx *ctx_id,
41 struct xdr_buf *message, 42 struct xdr_buf *message,
@@ -80,6 +81,8 @@ struct gss_api_mech {
80 /* pseudoflavors supported by this mechanism: */ 81 /* pseudoflavors supported by this mechanism: */
81 int gm_pf_num; 82 int gm_pf_num;
82 struct pf_desc * gm_pfs; 83 struct pf_desc * gm_pfs;
84 /* Should the following be a callback operation instead? */
85 const char *gm_upcall_enctypes;
83}; 86};
84 87
85/* and must provide the following operations: */ 88/* and must provide the following operations: */
@@ -87,7 +90,8 @@ struct gss_api_ops {
87 int (*gss_import_sec_context)( 90 int (*gss_import_sec_context)(
88 const void *input_token, 91 const void *input_token,
89 size_t bufsize, 92 size_t bufsize,
90 struct gss_ctx *ctx_id); 93 struct gss_ctx *ctx_id,
94 gfp_t gfp_mask);
91 u32 (*gss_get_mic)( 95 u32 (*gss_get_mic)(
92 struct gss_ctx *ctx_id, 96 struct gss_ctx *ctx_id,
93 struct xdr_buf *message, 97 struct xdr_buf *message,
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h
index e7bbdba474d5..5af2931cf58d 100644
--- a/include/linux/sunrpc/gss_krb5.h
+++ b/include/linux/sunrpc/gss_krb5.h
@@ -4,7 +4,7 @@
4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, 4 * Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h,
5 * lib/gssapi/krb5/gssapiP_krb5.h, and others 5 * lib/gssapi/krb5/gssapiP_krb5.h, and others
6 * 6 *
7 * Copyright (c) 2000 The Regents of the University of Michigan. 7 * Copyright (c) 2000-2008 The Regents of the University of Michigan.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * Andy Adamson <andros@umich.edu> 10 * Andy Adamson <andros@umich.edu>
@@ -36,17 +36,86 @@
36 * 36 *
37 */ 37 */
38 38
39#include <linux/crypto.h>
39#include <linux/sunrpc/auth_gss.h> 40#include <linux/sunrpc/auth_gss.h>
40#include <linux/sunrpc/gss_err.h> 41#include <linux/sunrpc/gss_err.h>
41#include <linux/sunrpc/gss_asn1.h> 42#include <linux/sunrpc/gss_asn1.h>
42 43
44/* Length of constant used in key derivation */
45#define GSS_KRB5_K5CLENGTH (5)
46
47/* Maximum key length (in bytes) for the supported crypto algorithms*/
48#define GSS_KRB5_MAX_KEYLEN (32)
49
50/* Maximum checksum function output for the supported crypto algorithms */
51#define GSS_KRB5_MAX_CKSUM_LEN (20)
52
53/* Maximum blocksize for the supported crypto algorithms */
54#define GSS_KRB5_MAX_BLOCKSIZE (16)
55
56struct krb5_ctx;
57
58struct gss_krb5_enctype {
59 const u32 etype; /* encryption (key) type */
60 const u32 ctype; /* checksum type */
61 const char *name; /* "friendly" name */
62 const char *encrypt_name; /* crypto encrypt name */
63 const char *cksum_name; /* crypto checksum name */
64 const u16 signalg; /* signing algorithm */
65 const u16 sealalg; /* sealing algorithm */
66 const u32 blocksize; /* encryption blocksize */
67 const u32 conflen; /* confounder length
68 (normally the same as
69 the blocksize) */
70 const u32 cksumlength; /* checksum length */
71 const u32 keyed_cksum; /* is it a keyed cksum? */
72 const u32 keybytes; /* raw key len, in bytes */
73 const u32 keylength; /* final key len, in bytes */
74 u32 (*encrypt) (struct crypto_blkcipher *tfm,
75 void *iv, void *in, void *out,
76 int length); /* encryption function */
77 u32 (*decrypt) (struct crypto_blkcipher *tfm,
78 void *iv, void *in, void *out,
79 int length); /* decryption function */
80 u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,
81 struct xdr_netobj *in,
82 struct xdr_netobj *out); /* complete key generation */
83 u32 (*encrypt_v2) (struct krb5_ctx *kctx, u32 offset,
84 struct xdr_buf *buf, int ec,
85 struct page **pages); /* v2 encryption function */
86 u32 (*decrypt_v2) (struct krb5_ctx *kctx, u32 offset,
87 struct xdr_buf *buf, u32 *headskip,
88 u32 *tailskip); /* v2 decryption function */
89};
90
91/* krb5_ctx flags definitions */
92#define KRB5_CTX_FLAG_INITIATOR 0x00000001
93#define KRB5_CTX_FLAG_CFX 0x00000002
94#define KRB5_CTX_FLAG_ACCEPTOR_SUBKEY 0x00000004
95
43struct krb5_ctx { 96struct krb5_ctx {
44 int initiate; /* 1 = initiating, 0 = accepting */ 97 int initiate; /* 1 = initiating, 0 = accepting */
98 u32 enctype;
99 u32 flags;
100 const struct gss_krb5_enctype *gk5e; /* enctype-specific info */
45 struct crypto_blkcipher *enc; 101 struct crypto_blkcipher *enc;
46 struct crypto_blkcipher *seq; 102 struct crypto_blkcipher *seq;
103 struct crypto_blkcipher *acceptor_enc;
104 struct crypto_blkcipher *initiator_enc;
105 struct crypto_blkcipher *acceptor_enc_aux;
106 struct crypto_blkcipher *initiator_enc_aux;
107 u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
108 u8 cksum[GSS_KRB5_MAX_KEYLEN];
47 s32 endtime; 109 s32 endtime;
48 u32 seq_send; 110 u32 seq_send;
111 u64 seq_send64;
49 struct xdr_netobj mech_used; 112 struct xdr_netobj mech_used;
113 u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
114 u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
115 u8 initiator_seal[GSS_KRB5_MAX_KEYLEN];
116 u8 acceptor_seal[GSS_KRB5_MAX_KEYLEN];
117 u8 initiator_integ[GSS_KRB5_MAX_KEYLEN];
118 u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN];
50}; 119};
51 120
52extern spinlock_t krb5_seq_lock; 121extern spinlock_t krb5_seq_lock;
@@ -57,6 +126,18 @@ extern spinlock_t krb5_seq_lock;
57#define KG_TOK_MIC_MSG 0x0101 126#define KG_TOK_MIC_MSG 0x0101
58#define KG_TOK_WRAP_MSG 0x0201 127#define KG_TOK_WRAP_MSG 0x0201
59 128
129#define KG2_TOK_INITIAL 0x0101
130#define KG2_TOK_RESPONSE 0x0202
131#define KG2_TOK_MIC 0x0404
132#define KG2_TOK_WRAP 0x0504
133
134#define KG2_TOKEN_FLAG_SENTBYACCEPTOR 0x01
135#define KG2_TOKEN_FLAG_SEALED 0x02
136#define KG2_TOKEN_FLAG_ACCEPTORSUBKEY 0x04
137
138#define KG2_RESP_FLAG_ERROR 0x0001
139#define KG2_RESP_FLAG_DELEG_OK 0x0002
140
60enum sgn_alg { 141enum sgn_alg {
61 SGN_ALG_DES_MAC_MD5 = 0x0000, 142 SGN_ALG_DES_MAC_MD5 = 0x0000,
62 SGN_ALG_MD2_5 = 0x0001, 143 SGN_ALG_MD2_5 = 0x0001,
@@ -81,6 +162,9 @@ enum seal_alg {
81#define CKSUMTYPE_RSA_MD5_DES 0x0008 162#define CKSUMTYPE_RSA_MD5_DES 0x0008
82#define CKSUMTYPE_NIST_SHA 0x0009 163#define CKSUMTYPE_NIST_SHA 0x0009
83#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c 164#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c
165#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f
166#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010
167#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138 /* Microsoft md5 hmac cksumtype */
84 168
85/* from gssapi_err_krb5.h */ 169/* from gssapi_err_krb5.h */
86#define KG_CCACHE_NOMATCH (39756032L) 170#define KG_CCACHE_NOMATCH (39756032L)
@@ -111,11 +195,56 @@ enum seal_alg {
111#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */ 195#define ENCTYPE_DES3_CBC_RAW 0x0006 /* DES-3 cbc mode raw */
112#define ENCTYPE_DES_HMAC_SHA1 0x0008 196#define ENCTYPE_DES_HMAC_SHA1 0x0008
113#define ENCTYPE_DES3_CBC_SHA1 0x0010 197#define ENCTYPE_DES3_CBC_SHA1 0x0010
198#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011
199#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012
200#define ENCTYPE_ARCFOUR_HMAC 0x0017
201#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018
114#define ENCTYPE_UNKNOWN 0x01ff 202#define ENCTYPE_UNKNOWN 0x01ff
115 203
116s32 204/*
117make_checksum(char *, char *header, int hdrlen, struct xdr_buf *body, 205 * Constants used for key derivation
118 int body_offset, struct xdr_netobj *cksum); 206 */
207/* for 3DES */
208#define KG_USAGE_SEAL (22)
209#define KG_USAGE_SIGN (23)
210#define KG_USAGE_SEQ (24)
211
212/* from rfc3961 */
213#define KEY_USAGE_SEED_CHECKSUM (0x99)
214#define KEY_USAGE_SEED_ENCRYPTION (0xAA)
215#define KEY_USAGE_SEED_INTEGRITY (0x55)
216
217/* from rfc4121 */
218#define KG_USAGE_ACCEPTOR_SEAL (22)
219#define KG_USAGE_ACCEPTOR_SIGN (23)
220#define KG_USAGE_INITIATOR_SEAL (24)
221#define KG_USAGE_INITIATOR_SIGN (25)
222
223/*
224 * This compile-time check verifies that we will not exceed the
225 * slack space allotted by the client and server auth_gss code
226 * before they call gss_wrap().
227 */
228#define GSS_KRB5_MAX_SLACK_NEEDED \
229 (GSS_KRB5_TOK_HDR_LEN /* gss token header */ \
230 + GSS_KRB5_MAX_CKSUM_LEN /* gss token checksum */ \
231 + GSS_KRB5_MAX_BLOCKSIZE /* confounder */ \
232 + GSS_KRB5_MAX_BLOCKSIZE /* possible padding */ \
233 + GSS_KRB5_TOK_HDR_LEN /* encrypted hdr in v2 token */\
234 + GSS_KRB5_MAX_CKSUM_LEN /* encryption hmac */ \
235 + 4 + 4 /* RPC verifier */ \
236 + GSS_KRB5_TOK_HDR_LEN \
237 + GSS_KRB5_MAX_CKSUM_LEN)
238
239u32
240make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
241 struct xdr_buf *body, int body_offset, u8 *cksumkey,
242 unsigned int usage, struct xdr_netobj *cksumout);
243
244u32
245make_checksum_v2(struct krb5_ctx *, char *header, int hdrlen,
246 struct xdr_buf *body, int body_offset, u8 *key,
247 unsigned int usage, struct xdr_netobj *cksum);
119 248
120u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, 249u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *,
121 struct xdr_netobj *); 250 struct xdr_netobj *);
@@ -149,11 +278,54 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf,
149 int offset); 278 int offset);
150 279
151s32 280s32
152krb5_make_seq_num(struct crypto_blkcipher *key, 281krb5_make_seq_num(struct krb5_ctx *kctx,
282 struct crypto_blkcipher *key,
153 int direction, 283 int direction,
154 u32 seqnum, unsigned char *cksum, unsigned char *buf); 284 u32 seqnum, unsigned char *cksum, unsigned char *buf);
155 285
156s32 286s32
157krb5_get_seq_num(struct crypto_blkcipher *key, 287krb5_get_seq_num(struct krb5_ctx *kctx,
158 unsigned char *cksum, 288 unsigned char *cksum,
159 unsigned char *buf, int *direction, u32 *seqnum); 289 unsigned char *buf, int *direction, u32 *seqnum);
290
291int
292xdr_extend_head(struct xdr_buf *buf, unsigned int base, unsigned int shiftlen);
293
294u32
295krb5_derive_key(const struct gss_krb5_enctype *gk5e,
296 const struct xdr_netobj *inkey,
297 struct xdr_netobj *outkey,
298 const struct xdr_netobj *in_constant,
299 gfp_t gfp_mask);
300
301u32
302gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e,
303 struct xdr_netobj *randombits,
304 struct xdr_netobj *key);
305
306u32
307gss_krb5_aes_make_key(const struct gss_krb5_enctype *gk5e,
308 struct xdr_netobj *randombits,
309 struct xdr_netobj *key);
310
311u32
312gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,
313 struct xdr_buf *buf, int ec,
314 struct page **pages);
315
316u32
317gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset,
318 struct xdr_buf *buf, u32 *plainoffset,
319 u32 *plainlen);
320
321int
322krb5_rc4_setup_seq_key(struct krb5_ctx *kctx,
323 struct crypto_blkcipher *cipher,
324 unsigned char *cksum);
325
326int
327krb5_rc4_setup_enc_key(struct krb5_ctx *kctx,
328 struct crypto_blkcipher *cipher,
329 s32 seqnum);
330void
331gss_krb5_make_confounder(char *p, u32 conflen);
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index 77f78e56c481..b6edbc0ea83d 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -26,6 +26,7 @@
26#define _LINUX_SUNRPC_METRICS_H 26#define _LINUX_SUNRPC_METRICS_H
27 27
28#include <linux/seq_file.h> 28#include <linux/seq_file.h>
29#include <linux/ktime.h>
29 30
30#define RPC_IOSTATS_VERS "1.0" 31#define RPC_IOSTATS_VERS "1.0"
31 32
@@ -58,9 +59,9 @@ struct rpc_iostats {
58 * and the total time the request spent from init to release 59 * and the total time the request spent from init to release
59 * are measured. 60 * are measured.
60 */ 61 */
61 unsigned long long om_queue, /* jiffies queued for xmit */ 62 ktime_t om_queue, /* queued for xmit */
62 om_rtt, /* jiffies for RPC RTT */ 63 om_rtt, /* RPC RTT */
63 om_execute; /* jiffies for RPC execution */ 64 om_execute; /* RPC execution */
64} ____cacheline_aligned; 65} ____cacheline_aligned;
65 66
66struct rpc_task; 67struct rpc_task;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 7bc7fd5291ce..88513fd8e208 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -10,6 +10,7 @@
10#define _LINUX_SUNRPC_SCHED_H_ 10#define _LINUX_SUNRPC_SCHED_H_
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/ktime.h>
13#include <linux/sunrpc/types.h> 14#include <linux/sunrpc/types.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
15#include <linux/wait.h> 16#include <linux/wait.h>
@@ -40,21 +41,15 @@ struct rpc_wait {
40 * This is the RPC task struct 41 * This is the RPC task struct
41 */ 42 */
42struct rpc_task { 43struct rpc_task {
43#ifdef RPC_DEBUG
44 unsigned long tk_magic; /* 0xf00baa */
45#endif
46 atomic_t tk_count; /* Reference count */ 44 atomic_t tk_count; /* Reference count */
47 struct list_head tk_task; /* global list of tasks */ 45 struct list_head tk_task; /* global list of tasks */
48 struct rpc_clnt * tk_client; /* RPC client */ 46 struct rpc_clnt * tk_client; /* RPC client */
49 struct rpc_rqst * tk_rqstp; /* RPC request */ 47 struct rpc_rqst * tk_rqstp; /* RPC request */
50 int tk_status; /* result of last operation */
51 48
52 /* 49 /*
53 * RPC call state 50 * RPC call state
54 */ 51 */
55 struct rpc_message tk_msg; /* RPC call info */ 52 struct rpc_message tk_msg; /* RPC call info */
56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry;
58 53
59 /* 54 /*
60 * callback to be executed after waking up 55 * callback to be executed after waking up
@@ -67,7 +62,6 @@ struct rpc_task {
67 void * tk_calldata; 62 void * tk_calldata;
68 63
69 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 64 unsigned long tk_timeout; /* timeout for rpc_sleep() */
70 unsigned short tk_flags; /* misc flags */
71 unsigned long tk_runstate; /* Task run status */ 65 unsigned long tk_runstate; /* Task run status */
72 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 66 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
73 * be any workqueue 67 * be any workqueue
@@ -78,17 +72,19 @@ struct rpc_task {
78 struct rpc_wait tk_wait; /* RPC wait */ 72 struct rpc_wait tk_wait; /* RPC wait */
79 } u; 73 } u;
80 74
81 unsigned short tk_timeouts; /* maj timeouts */ 75 ktime_t tk_start; /* RPC task init timestamp */
82 size_t tk_bytes_sent; /* total bytes sent */
83 unsigned long tk_start; /* RPC task init timestamp */
84 long tk_rtt; /* round-trip time (jiffies) */
85 76
86 pid_t tk_owner; /* Process id for batching tasks */ 77 pid_t tk_owner; /* Process id for batching tasks */
87 unsigned char tk_priority : 2;/* Task priority */ 78 int tk_status; /* result of last operation */
79 unsigned short tk_flags; /* misc flags */
80 unsigned short tk_timeouts; /* maj timeouts */
88 81
89#ifdef RPC_DEBUG 82#ifdef RPC_DEBUG
90 unsigned short tk_pid; /* debugging aid */ 83 unsigned short tk_pid; /* debugging aid */
91#endif 84#endif
85 unsigned char tk_priority : 2,/* Task priority */
86 tk_garb_retry : 2,
87 tk_cred_retry : 2;
92}; 88};
93#define tk_xprt tk_client->cl_xprt 89#define tk_xprt tk_client->cl_xprt
94 90
@@ -217,6 +213,7 @@ struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
217 const struct rpc_call_ops *ops); 213 const struct rpc_call_ops *ops);
218void rpc_put_task(struct rpc_task *); 214void rpc_put_task(struct rpc_task *);
219void rpc_exit_task(struct rpc_task *); 215void rpc_exit_task(struct rpc_task *);
216void rpc_exit(struct rpc_task *, int);
220void rpc_release_calldata(const struct rpc_call_ops *, void *); 217void rpc_release_calldata(const struct rpc_call_ops *, void *);
221void rpc_killall_tasks(struct rpc_clnt *); 218void rpc_killall_tasks(struct rpc_clnt *);
222void rpc_execute(struct rpc_task *); 219void rpc_execute(struct rpc_task *);
@@ -245,12 +242,6 @@ void rpc_destroy_mempool(void);
245extern struct workqueue_struct *rpciod_workqueue; 242extern struct workqueue_struct *rpciod_workqueue;
246void rpc_prepare_task(struct rpc_task *task); 243void rpc_prepare_task(struct rpc_task *task);
247 244
248static inline void rpc_exit(struct rpc_task *task, int status)
249{
250 task->tk_status = status;
251 task->tk_action = rpc_exit_task;
252}
253
254static inline int rpc_wait_for_completion_task(struct rpc_task *task) 245static inline int rpc_wait_for_completion_task(struct rpc_task *task)
255{ 246{
256 return __rpc_wait_for_completion_task(task, NULL); 247 return __rpc_wait_for_completion_task(task, NULL);
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index f5cc0898bc53..35cf2e8cd7c6 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -1,7 +1,10 @@
1/* 1/*
2 * include/linux/sunrpc/xdr.h 2 * XDR standard data types and function declarations
3 * 3 *
4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
5 *
6 * Based on:
7 * RFC 4506 "XDR: External Data Representation Standard", May 2006
5 */ 8 */
6 9
7#ifndef _SUNRPC_XDR_H_ 10#ifndef _SUNRPC_XDR_H_
@@ -62,7 +65,6 @@ struct xdr_buf {
62 65
63 unsigned int buflen, /* Total length of storage buffer */ 66 unsigned int buflen, /* Total length of storage buffer */
64 len; /* Length of XDR encoded message */ 67 len; /* Length of XDR encoded message */
65
66}; 68};
67 69
68/* 70/*
@@ -178,7 +180,7 @@ struct xdr_array2_desc {
178}; 180};
179 181
180extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base, 182extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
181 struct xdr_array2_desc *desc); 183 struct xdr_array2_desc *desc);
182extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base, 184extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
183 struct xdr_array2_desc *desc); 185 struct xdr_array2_desc *desc);
184 186
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 6f9457a75b8f..ff5a77b28c50 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -13,6 +13,7 @@
13#include <linux/socket.h> 13#include <linux/socket.h>
14#include <linux/in.h> 14#include <linux/in.h>
15#include <linux/kref.h> 15#include <linux/kref.h>
16#include <linux/ktime.h>
16#include <linux/sunrpc/sched.h> 17#include <linux/sunrpc/sched.h>
17#include <linux/sunrpc/xdr.h> 18#include <linux/sunrpc/xdr.h>
18#include <linux/sunrpc/msg_prot.h> 19#include <linux/sunrpc/msg_prot.h>
@@ -63,10 +64,9 @@ struct rpc_rqst {
63 * This is the private part 64 * This is the private part
64 */ 65 */
65 struct rpc_task * rq_task; /* RPC task data */ 66 struct rpc_task * rq_task; /* RPC task data */
67 struct rpc_cred * rq_cred; /* Bound cred */
66 __be32 rq_xid; /* request XID */ 68 __be32 rq_xid; /* request XID */
67 int rq_cong; /* has incremented xprt->cong */ 69 int rq_cong; /* has incremented xprt->cong */
68 int rq_reply_bytes_recvd; /* number of reply */
69 /* bytes received */
70 u32 rq_seqno; /* gss seq no. used on req. */ 70 u32 rq_seqno; /* gss seq no. used on req. */
71 int rq_enc_pages_num; 71 int rq_enc_pages_num;
72 struct page **rq_enc_pages; /* scratch pages for use by 72 struct page **rq_enc_pages; /* scratch pages for use by
@@ -77,12 +77,16 @@ struct rpc_rqst {
77 __u32 * rq_buffer; /* XDR encode buffer */ 77 __u32 * rq_buffer; /* XDR encode buffer */
78 size_t rq_callsize, 78 size_t rq_callsize,
79 rq_rcvsize; 79 rq_rcvsize;
80 size_t rq_xmit_bytes_sent; /* total bytes sent */
81 size_t rq_reply_bytes_recvd; /* total reply bytes */
82 /* received */
80 83
81 struct xdr_buf rq_private_buf; /* The receive buffer 84 struct xdr_buf rq_private_buf; /* The receive buffer
82 * used in the softirq. 85 * used in the softirq.
83 */ 86 */
84 unsigned long rq_majortimeo; /* major timeout alarm */ 87 unsigned long rq_majortimeo; /* major timeout alarm */
85 unsigned long rq_timeout; /* Current timeout value */ 88 unsigned long rq_timeout; /* Current timeout value */
89 ktime_t rq_rtt; /* round-trip time */
86 unsigned int rq_retries; /* # of retries */ 90 unsigned int rq_retries; /* # of retries */
87 unsigned int rq_connect_cookie; 91 unsigned int rq_connect_cookie;
88 /* A cookie used to track the 92 /* A cookie used to track the
@@ -94,7 +98,7 @@ struct rpc_rqst {
94 */ 98 */
95 u32 rq_bytes_sent; /* Bytes we have sent */ 99 u32 rq_bytes_sent; /* Bytes we have sent */
96 100
97 unsigned long rq_xtime; /* when transmitted */ 101 ktime_t rq_xtime; /* transmit time stamp */
98 int rq_ntrans; 102 int rq_ntrans;
99 103
100#if defined(CONFIG_NFS_V4_1) 104#if defined(CONFIG_NFS_V4_1)
@@ -174,8 +178,7 @@ struct rpc_xprt {
174 /* 178 /*
175 * Connection of transports 179 * Connection of transports
176 */ 180 */
177 unsigned long connect_timeout, 181 unsigned long bind_timeout,
178 bind_timeout,
179 reestablish_timeout; 182 reestablish_timeout;
180 unsigned int connect_cookie; /* A cookie that gets bumped 183 unsigned int connect_cookie; /* A cookie that gets bumped
181 every time the transport 184 every time the transport
@@ -294,7 +297,6 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
294void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 297void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
295void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); 298void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
296void xprt_write_space(struct rpc_xprt *xprt); 299void xprt_write_space(struct rpc_xprt *xprt);
297void xprt_update_rtt(struct rpc_task *task);
298void xprt_adjust_cwnd(struct rpc_task *task, int result); 300void xprt_adjust_cwnd(struct rpc_task *task, int result);
299struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 301struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
300void xprt_complete_rqst(struct rpc_task *task, int copied); 302void xprt_complete_rqst(struct rpc_task *task, int copied);
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 5e781d824e6d..4af270ec2204 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -61,14 +61,15 @@ typedef int __bitwise suspend_state_t;
61 * before device drivers' late suspend callbacks are executed. It returns 61 * before device drivers' late suspend callbacks are executed. It returns
62 * 0 on success or a negative error code otherwise, in which case the 62 * 0 on success or a negative error code otherwise, in which case the
63 * system cannot enter the desired sleep state (@prepare_late(), @enter(), 63 * system cannot enter the desired sleep state (@prepare_late(), @enter(),
64 * @wake(), and @finish() will not be called in that case). 64 * and @wake() will not be called in that case).
65 * 65 *
66 * @prepare_late: Finish preparing the platform for entering the system sleep 66 * @prepare_late: Finish preparing the platform for entering the system sleep
67 * state indicated by @begin(). 67 * state indicated by @begin().
68 * @prepare_late is called before disabling nonboot CPUs and after 68 * @prepare_late is called before disabling nonboot CPUs and after
69 * device drivers' late suspend callbacks have been executed. It returns 69 * device drivers' late suspend callbacks have been executed. It returns
70 * 0 on success or a negative error code otherwise, in which case the 70 * 0 on success or a negative error code otherwise, in which case the
71 * system cannot enter the desired sleep state (@enter() and @wake()). 71 * system cannot enter the desired sleep state (@enter() will not be
72 * executed).
72 * 73 *
73 * @enter: Enter the system sleep state indicated by @begin() or represented by 74 * @enter: Enter the system sleep state indicated by @begin() or represented by
74 * the argument if @begin() is not implemented. 75 * the argument if @begin() is not implemented.
@@ -81,14 +82,15 @@ typedef int __bitwise suspend_state_t;
81 * resume callbacks are executed. 82 * resume callbacks are executed.
82 * This callback is optional, but should be implemented by the platforms 83 * This callback is optional, but should be implemented by the platforms
83 * that implement @prepare_late(). If implemented, it is always called 84 * that implement @prepare_late(). If implemented, it is always called
84 * after @enter(), even if @enter() fails. 85 * after @prepare_late and @enter(), even if one of them fails.
85 * 86 *
86 * @finish: Finish wake-up of the platform. 87 * @finish: Finish wake-up of the platform.
87 * @finish is called right prior to calling device drivers' regular suspend 88 * @finish is called right prior to calling device drivers' regular suspend
88 * callbacks. 89 * callbacks.
89 * This callback is optional, but should be implemented by the platforms 90 * This callback is optional, but should be implemented by the platforms
90 * that implement @prepare(). If implemented, it is always called after 91 * that implement @prepare(). If implemented, it is always called after
91 * @enter() and @wake(), if implemented, even if any of them fails. 92 * @enter() and @wake(), even if any of them fails. It is executed after
93 * a failing @prepare.
92 * 94 *
93 * @end: Called by the PM core right after resuming devices, to indicate to 95 * @end: Called by the PM core right after resuming devices, to indicate to
94 * the platform that the system has returned to the working state or 96 * the platform that the system has returned to the working state or
@@ -256,22 +258,22 @@ static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; } 258static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */ 259#endif /* CONFIG_HIBERNATION */
258 260
259#ifdef CONFIG_HIBERNATION_NVS 261#ifdef CONFIG_SUSPEND_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size); 262extern int suspend_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void); 263extern int suspend_nvs_alloc(void);
262extern void hibernate_nvs_free(void); 264extern void suspend_nvs_free(void);
263extern void hibernate_nvs_save(void); 265extern void suspend_nvs_save(void);
264extern void hibernate_nvs_restore(void); 266extern void suspend_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */ 267#else /* CONFIG_SUSPEND_NVS */
266static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 268static inline int suspend_nvs_register(unsigned long a, unsigned long b)
267{ 269{
268 return 0; 270 return 0;
269} 271}
270static inline int hibernate_nvs_alloc(void) { return 0; } 272static inline int suspend_nvs_alloc(void) { return 0; }
271static inline void hibernate_nvs_free(void) {} 273static inline void suspend_nvs_free(void) {}
272static inline void hibernate_nvs_save(void) {} 274static inline void suspend_nvs_save(void) {}
273static inline void hibernate_nvs_restore(void) {} 275static inline void suspend_nvs_restore(void) {}
274#endif /* CONFIG_HIBERNATION_NVS */ 276#endif /* CONFIG_SUSPEND_NVS */
275 277
276#ifdef CONFIG_PM_SLEEP 278#ifdef CONFIG_PM_SLEEP
277void save_processor_state(void); 279void save_processor_state(void);
@@ -286,6 +288,13 @@ extern int unregister_pm_notifier(struct notifier_block *nb);
286 { .notifier_call = fn, .priority = pri }; \ 288 { .notifier_call = fn, .priority = pri }; \
287 register_pm_notifier(&fn##_nb); \ 289 register_pm_notifier(&fn##_nb); \
288} 290}
291
292/* drivers/base/power/wakeup.c */
293extern bool events_check_enabled;
294
295extern bool pm_check_wakeup_events(void);
296extern bool pm_get_wakeup_count(unsigned long *count);
297extern bool pm_save_wakeup_count(unsigned long count);
289#else /* !CONFIG_PM_SLEEP */ 298#else /* !CONFIG_PM_SLEEP */
290 299
291static inline int register_pm_notifier(struct notifier_block *nb) 300static inline int register_pm_notifier(struct notifier_block *nb)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 1f59d9340c4d..2fee51a11b73 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -146,11 +146,13 @@ enum {
146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */ 146 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */ 147 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */ 148 SWP_CONTINUED = (1 << 5), /* swap_map has count continuation */
149 SWP_BLKDEV = (1 << 6), /* its a block device */
149 /* add others here before... */ 150 /* add others here before... */
150 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 151 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
151}; 152};
152 153
153#define SWAP_CLUSTER_MAX 32 154#define SWAP_CLUSTER_MAX 32
155#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
154 156
155#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 157#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
156#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 158#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
@@ -223,20 +225,15 @@ static inline void lru_cache_add_anon(struct page *page)
223 __lru_cache_add(page, LRU_INACTIVE_ANON); 225 __lru_cache_add(page, LRU_INACTIVE_ANON);
224} 226}
225 227
226static inline void lru_cache_add_active_anon(struct page *page)
227{
228 __lru_cache_add(page, LRU_ACTIVE_ANON);
229}
230
231static inline void lru_cache_add_file(struct page *page) 228static inline void lru_cache_add_file(struct page *page)
232{ 229{
233 __lru_cache_add(page, LRU_INACTIVE_FILE); 230 __lru_cache_add(page, LRU_INACTIVE_FILE);
234} 231}
235 232
236static inline void lru_cache_add_active_file(struct page *page) 233/* LRU Isolation modes. */
237{ 234#define ISOLATE_INACTIVE 0 /* Isolate inactive pages. */
238 __lru_cache_add(page, LRU_ACTIVE_FILE); 235#define ISOLATE_ACTIVE 1 /* Isolate active pages. */
239} 236#define ISOLATE_BOTH 2 /* Isolate both active and inactive pages. */
240 237
241/* linux/mm/vmscan.c */ 238/* linux/mm/vmscan.c */
242extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 239extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
@@ -247,8 +244,7 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
247extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 244extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
248 gfp_t gfp_mask, bool noswap, 245 gfp_t gfp_mask, bool noswap,
249 unsigned int swappiness, 246 unsigned int swappiness,
250 struct zone *zone, 247 struct zone *zone);
251 int nid);
252extern int __isolate_lru_page(struct page *page, int mode, int file); 248extern int __isolate_lru_page(struct page *page, int mode, int file);
253extern unsigned long shrink_all_memory(unsigned long nr_pages); 249extern unsigned long shrink_all_memory(unsigned long nr_pages);
254extern int vm_swappiness; 250extern int vm_swappiness;
@@ -285,6 +281,11 @@ extern void kswapd_stop(int nid);
285extern int shmem_unuse(swp_entry_t entry, struct page *page); 281extern int shmem_unuse(swp_entry_t entry, struct page *page);
286#endif /* CONFIG_MMU */ 282#endif /* CONFIG_MMU */
287 283
284#ifdef CONFIG_CGROUP_MEM_RES_CTLR
285extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
286 struct page **pagep, swp_entry_t *ent);
287#endif
288
288extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *); 289extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
289 290
290#ifdef CONFIG_SWAP 291#ifdef CONFIG_SWAP
@@ -314,7 +315,6 @@ extern long nr_swap_pages;
314extern long total_swap_pages; 315extern long total_swap_pages;
315extern void si_swapinfo(struct sysinfo *); 316extern void si_swapinfo(struct sysinfo *);
316extern swp_entry_t get_swap_page(void); 317extern swp_entry_t get_swap_page(void);
317extern swp_entry_t get_swap_page_of_type(int);
318extern int valid_swaphandles(swp_entry_t, unsigned long *); 318extern int valid_swaphandles(swp_entry_t, unsigned long *);
319extern int add_swap_count_continuation(swp_entry_t, gfp_t); 319extern int add_swap_count_continuation(swp_entry_t, gfp_t);
320extern void swap_shmem_alloc(swp_entry_t); 320extern void swap_shmem_alloc(swp_entry_t);
@@ -331,6 +331,13 @@ extern int reuse_swap_page(struct page *);
331extern int try_to_free_swap(struct page *); 331extern int try_to_free_swap(struct page *);
332struct backing_dev_info; 332struct backing_dev_info;
333 333
334#ifdef CONFIG_HIBERNATION
335void hibernation_freeze_swap(void);
336void hibernation_thaw_swap(void);
337swp_entry_t get_swap_for_hibernation(int type);
338void swap_free_for_hibernation(swp_entry_t val);
339#endif
340
334/* linux/mm/thrash.c */ 341/* linux/mm/thrash.c */
335extern struct mm_struct *swap_token_mm; 342extern struct mm_struct *swap_token_mm;
336extern void grab_swap_token(struct mm_struct *); 343extern void grab_swap_token(struct mm_struct *);
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index febedcf67c7e..8c0e349f4a6c 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -23,6 +23,29 @@ extern int swiotlb_force;
23#define IO_TLB_SHIFT 11 23#define IO_TLB_SHIFT 11
24 24
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27
28/*
29 * Enumeration for sync targets
30 */
31enum dma_sync_target {
32 SYNC_FOR_CPU = 0,
33 SYNC_FOR_DEVICE = 1,
34};
35extern void *swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr,
36 phys_addr_t phys, size_t size,
37 enum dma_data_direction dir);
38
39extern void swiotlb_tbl_unmap_single(struct device *hwdev, char *dma_addr,
40 size_t size, enum dma_data_direction dir);
41
42extern void swiotlb_tbl_sync_single(struct device *hwdev, char *dma_addr,
43 size_t size, enum dma_data_direction dir,
44 enum dma_sync_target target);
45
46/* Accessory functions. */
47extern void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
48 enum dma_data_direction dir);
26 49
27extern void 50extern void
28*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 51*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -42,11 +65,11 @@ extern void swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
42 65
43extern int 66extern int
44swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, 67swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
45 int direction); 68 enum dma_data_direction dir);
46 69
47extern void 70extern void
48swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, 71swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
49 int direction); 72 enum dma_data_direction dir);
50 73
51extern int 74extern int
52swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, 75swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
@@ -73,16 +96,6 @@ extern void
73swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 96swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
74 int nelems, enum dma_data_direction dir); 97 int nelems, enum dma_data_direction dir);
75 98
76extern void
77swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
78 unsigned long offset, size_t size,
79 enum dma_data_direction dir);
80
81extern void
82swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
83 unsigned long offset, size_t size,
84 enum dma_data_direction dir);
85
86extern int 99extern int
87swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr); 100swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
88 101
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 057929b0a651..1b67bd333b5e 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -35,6 +35,7 @@ struct oldold_utsname;
35struct old_utsname; 35struct old_utsname;
36struct pollfd; 36struct pollfd;
37struct rlimit; 37struct rlimit;
38struct rlimit64;
38struct rusage; 39struct rusage;
39struct sched_param; 40struct sched_param;
40struct sel_arg_struct; 41struct sel_arg_struct;
@@ -103,22 +104,6 @@ struct perf_event_attr;
103#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__) 104#define __SC_TEST5(t5, a5, ...) __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
104#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) 105#define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
105 106
106#ifdef CONFIG_PERF_EVENTS
107
108#define TRACE_SYS_ENTER_PERF_INIT(sname) \
109 .perf_event_enable = perf_sysenter_enable, \
110 .perf_event_disable = perf_sysenter_disable,
111
112#define TRACE_SYS_EXIT_PERF_INIT(sname) \
113 .perf_event_enable = perf_sysexit_enable, \
114 .perf_event_disable = perf_sysexit_disable,
115#else
116#define TRACE_SYS_ENTER_PERF(sname)
117#define TRACE_SYS_ENTER_PERF_INIT(sname)
118#define TRACE_SYS_EXIT_PERF(sname)
119#define TRACE_SYS_EXIT_PERF_INIT(sname)
120#endif /* CONFIG_PERF_EVENTS */
121
122#ifdef CONFIG_FTRACE_SYSCALLS 107#ifdef CONFIG_FTRACE_SYSCALLS
123#define __SC_STR_ADECL1(t, a) #a 108#define __SC_STR_ADECL1(t, a) #a
124#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__) 109#define __SC_STR_ADECL2(t, a, ...) #a, __SC_STR_ADECL1(__VA_ARGS__)
@@ -134,54 +119,45 @@ struct perf_event_attr;
134#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__) 119#define __SC_STR_TDECL5(t, a, ...) #t, __SC_STR_TDECL4(__VA_ARGS__)
135#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__) 120#define __SC_STR_TDECL6(t, a, ...) #t, __SC_STR_TDECL5(__VA_ARGS__)
136 121
122extern struct ftrace_event_class event_class_syscall_enter;
123extern struct ftrace_event_class event_class_syscall_exit;
124extern struct trace_event_functions enter_syscall_print_funcs;
125extern struct trace_event_functions exit_syscall_print_funcs;
126
137#define SYSCALL_TRACE_ENTER_EVENT(sname) \ 127#define SYSCALL_TRACE_ENTER_EVENT(sname) \
138 static const struct syscall_metadata __syscall_meta_##sname; \ 128 static struct syscall_metadata \
129 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
139 static struct ftrace_event_call \ 130 static struct ftrace_event_call \
140 __attribute__((__aligned__(4))) event_enter_##sname; \ 131 __attribute__((__aligned__(4))) event_enter_##sname; \
141 static struct trace_event enter_syscall_print_##sname = { \
142 .trace = print_syscall_enter, \
143 }; \
144 static struct ftrace_event_call __used \ 132 static struct ftrace_event_call __used \
145 __attribute__((__aligned__(4))) \ 133 __attribute__((__aligned__(4))) \
146 __attribute__((section("_ftrace_events"))) \ 134 __attribute__((section("_ftrace_events"))) \
147 event_enter_##sname = { \ 135 event_enter_##sname = { \
148 .name = "sys_enter"#sname, \ 136 .name = "sys_enter"#sname, \
149 .system = "syscalls", \ 137 .class = &event_class_syscall_enter, \
150 .event = &enter_syscall_print_##sname, \ 138 .event.funcs = &enter_syscall_print_funcs, \
151 .raw_init = init_syscall_trace, \
152 .define_fields = syscall_enter_define_fields, \
153 .regfunc = reg_event_syscall_enter, \
154 .unregfunc = unreg_event_syscall_enter, \
155 .data = (void *)&__syscall_meta_##sname,\ 139 .data = (void *)&__syscall_meta_##sname,\
156 TRACE_SYS_ENTER_PERF_INIT(sname) \
157 } 140 }
158 141
159#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 142#define SYSCALL_TRACE_EXIT_EVENT(sname) \
160 static const struct syscall_metadata __syscall_meta_##sname; \ 143 static struct syscall_metadata \
144 __attribute__((__aligned__(4))) __syscall_meta_##sname; \
161 static struct ftrace_event_call \ 145 static struct ftrace_event_call \
162 __attribute__((__aligned__(4))) event_exit_##sname; \ 146 __attribute__((__aligned__(4))) event_exit_##sname; \
163 static struct trace_event exit_syscall_print_##sname = { \
164 .trace = print_syscall_exit, \
165 }; \
166 static struct ftrace_event_call __used \ 147 static struct ftrace_event_call __used \
167 __attribute__((__aligned__(4))) \ 148 __attribute__((__aligned__(4))) \
168 __attribute__((section("_ftrace_events"))) \ 149 __attribute__((section("_ftrace_events"))) \
169 event_exit_##sname = { \ 150 event_exit_##sname = { \
170 .name = "sys_exit"#sname, \ 151 .name = "sys_exit"#sname, \
171 .system = "syscalls", \ 152 .class = &event_class_syscall_exit, \
172 .event = &exit_syscall_print_##sname, \ 153 .event.funcs = &exit_syscall_print_funcs, \
173 .raw_init = init_syscall_trace, \
174 .define_fields = syscall_exit_define_fields, \
175 .regfunc = reg_event_syscall_exit, \
176 .unregfunc = unreg_event_syscall_exit, \
177 .data = (void *)&__syscall_meta_##sname,\ 154 .data = (void *)&__syscall_meta_##sname,\
178 TRACE_SYS_EXIT_PERF_INIT(sname) \
179 } 155 }
180 156
181#define SYSCALL_METADATA(sname, nb) \ 157#define SYSCALL_METADATA(sname, nb) \
182 SYSCALL_TRACE_ENTER_EVENT(sname); \ 158 SYSCALL_TRACE_ENTER_EVENT(sname); \
183 SYSCALL_TRACE_EXIT_EVENT(sname); \ 159 SYSCALL_TRACE_EXIT_EVENT(sname); \
184 static const struct syscall_metadata __used \ 160 static struct syscall_metadata __used \
185 __attribute__((__aligned__(4))) \ 161 __attribute__((__aligned__(4))) \
186 __attribute__((section("__syscalls_metadata"))) \ 162 __attribute__((section("__syscalls_metadata"))) \
187 __syscall_meta_##sname = { \ 163 __syscall_meta_##sname = { \
@@ -191,12 +167,13 @@ struct perf_event_attr;
191 .args = args_##sname, \ 167 .args = args_##sname, \
192 .enter_event = &event_enter_##sname, \ 168 .enter_event = &event_enter_##sname, \
193 .exit_event = &event_exit_##sname, \ 169 .exit_event = &event_exit_##sname, \
170 .enter_fields = LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \
194 }; 171 };
195 172
196#define SYSCALL_DEFINE0(sname) \ 173#define SYSCALL_DEFINE0(sname) \
197 SYSCALL_TRACE_ENTER_EVENT(_##sname); \ 174 SYSCALL_TRACE_ENTER_EVENT(_##sname); \
198 SYSCALL_TRACE_EXIT_EVENT(_##sname); \ 175 SYSCALL_TRACE_EXIT_EVENT(_##sname); \
199 static const struct syscall_metadata __used \ 176 static struct syscall_metadata __used \
200 __attribute__((__aligned__(4))) \ 177 __attribute__((__aligned__(4))) \
201 __attribute__((section("__syscalls_metadata"))) \ 178 __attribute__((section("__syscalls_metadata"))) \
202 __syscall_meta__##sname = { \ 179 __syscall_meta__##sname = { \
@@ -204,6 +181,7 @@ struct perf_event_attr;
204 .nb_args = 0, \ 181 .nb_args = 0, \
205 .enter_event = &event_enter__##sname, \ 182 .enter_event = &event_enter__##sname, \
206 .exit_event = &event_exit__##sname, \ 183 .exit_event = &event_exit__##sname, \
184 .enter_fields = LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \
207 }; \ 185 }; \
208 asmlinkage long sys_##sname(void) 186 asmlinkage long sys_##sname(void)
209#else 187#else
@@ -312,7 +290,7 @@ asmlinkage long sys_capget(cap_user_header_t header,
312 cap_user_data_t dataptr); 290 cap_user_data_t dataptr);
313asmlinkage long sys_capset(cap_user_header_t header, 291asmlinkage long sys_capset(cap_user_header_t header,
314 const cap_user_data_t data); 292 const cap_user_data_t data);
315asmlinkage long sys_personality(u_long personality); 293asmlinkage long sys_personality(unsigned int personality);
316 294
317asmlinkage long sys_sigpending(old_sigset_t __user *set); 295asmlinkage long sys_sigpending(old_sigset_t __user *set);
318asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set, 296asmlinkage long sys_sigprocmask(int how, old_sigset_t __user *set,
@@ -667,6 +645,9 @@ asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *r
667#endif 645#endif
668asmlinkage long sys_setrlimit(unsigned int resource, 646asmlinkage long sys_setrlimit(unsigned int resource,
669 struct rlimit __user *rlim); 647 struct rlimit __user *rlim);
648asmlinkage long sys_prlimit64(pid_t pid, unsigned int resource,
649 const struct rlimit64 __user *new_rlim,
650 struct rlimit64 __user *old_rlim);
670asmlinkage long sys_getrusage(int who, struct rusage __user *ru); 651asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
671asmlinkage long sys_umask(int mask); 652asmlinkage long sys_umask(int mask);
672 653
@@ -834,6 +815,10 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
834asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 815asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
835 struct timespec __user *, const sigset_t __user *, 816 struct timespec __user *, const sigset_t __user *,
836 size_t); 817 size_t);
818asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags);
819asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
820 u64 mask, int fd,
821 const char __user *pathname);
837 822
838int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 823int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
839 824
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index f66014c90c9f..7bb5cb64f3b8 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -980,6 +980,8 @@ extern int proc_doulongvec_minmax(struct ctl_table *, int,
980 void __user *, size_t *, loff_t *); 980 void __user *, size_t *, loff_t *);
981extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int, 981extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
982 void __user *, size_t *, loff_t *); 982 void __user *, size_t *, loff_t *);
983extern int proc_do_large_bitmap(struct ctl_table *, int,
984 void __user *, size_t *, loff_t *);
983 985
984/* 986/*
985 * Register a set of sysctl names by calling register_sysctl_table 987 * Register a set of sysctl names by calling register_sysctl_table
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index f0496b3d1811..3c92121ba9af 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -20,15 +20,10 @@
20 20
21struct kobject; 21struct kobject;
22struct module; 22struct module;
23enum kobj_ns_type;
23 24
24/* FIXME
25 * The *owner field is no longer used.
26 * x86 tree has been cleaned up. The owner
27 * attribute is still left for other arches.
28 */
29struct attribute { 25struct attribute {
30 const char *name; 26 const char *name;
31 struct module *owner;
32 mode_t mode; 27 mode_t mode;
33#ifdef CONFIG_DEBUG_LOCK_ALLOC 28#ifdef CONFIG_DEBUG_LOCK_ALLOC
34 struct lock_class_key *key; 29 struct lock_class_key *key;
@@ -86,17 +81,18 @@ struct attribute_group {
86 81
87#define attr_name(_attr) (_attr).attr.name 82#define attr_name(_attr) (_attr).attr.name
88 83
84struct file;
89struct vm_area_struct; 85struct vm_area_struct;
90 86
91struct bin_attribute { 87struct bin_attribute {
92 struct attribute attr; 88 struct attribute attr;
93 size_t size; 89 size_t size;
94 void *private; 90 void *private;
95 ssize_t (*read)(struct kobject *, struct bin_attribute *, 91 ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
96 char *, loff_t, size_t); 92 char *, loff_t, size_t);
97 ssize_t (*write)(struct kobject *, struct bin_attribute *, 93 ssize_t (*write)(struct file *,struct kobject *, struct bin_attribute *,
98 char *, loff_t, size_t); 94 char *, loff_t, size_t);
99 int (*mmap)(struct kobject *, struct bin_attribute *attr, 95 int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
100 struct vm_area_struct *vma); 96 struct vm_area_struct *vma);
101}; 97};
102 98
@@ -134,8 +130,8 @@ int __must_check sysfs_create_file(struct kobject *kobj,
134 const struct attribute *attr); 130 const struct attribute *attr);
135int __must_check sysfs_create_files(struct kobject *kobj, 131int __must_check sysfs_create_files(struct kobject *kobj,
136 const struct attribute **attr); 132 const struct attribute **attr);
137int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, 133int __must_check sysfs_chmod_file(struct kobject *kobj,
138 mode_t mode); 134 const struct attribute *attr, mode_t mode);
139void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 135void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
140void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 136void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
141 137
@@ -154,6 +150,9 @@ void sysfs_remove_link(struct kobject *kobj, const char *name);
154int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 150int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
155 const char *old_name, const char *new_name); 151 const char *old_name, const char *new_name);
156 152
153void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
154 const char *name);
155
157int __must_check sysfs_create_group(struct kobject *kobj, 156int __must_check sysfs_create_group(struct kobject *kobj,
158 const struct attribute_group *grp); 157 const struct attribute_group *grp);
159int sysfs_update_group(struct kobject *kobj, 158int sysfs_update_group(struct kobject *kobj,
@@ -168,10 +167,15 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
168void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 167void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
169void sysfs_notify_dirent(struct sysfs_dirent *sd); 168void sysfs_notify_dirent(struct sysfs_dirent *sd);
170struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 169struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
170 const void *ns,
171 const unsigned char *name); 171 const unsigned char *name);
172struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 172struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
173void sysfs_put(struct sysfs_dirent *sd); 173void sysfs_put(struct sysfs_dirent *sd);
174void sysfs_printk_last_file(void); 174void sysfs_printk_last_file(void);
175
176/* Called to clear a ns tag when it is no longer valid */
177void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
178
175int __must_check sysfs_init(void); 179int __must_check sysfs_init(void);
176 180
177#else /* CONFIG_SYSFS */ 181#else /* CONFIG_SYSFS */
@@ -215,7 +219,7 @@ static inline int sysfs_create_files(struct kobject *kobj,
215} 219}
216 220
217static inline int sysfs_chmod_file(struct kobject *kobj, 221static inline int sysfs_chmod_file(struct kobject *kobj,
218 struct attribute *attr, mode_t mode) 222 const struct attribute *attr, mode_t mode)
219{ 223{
220 return 0; 224 return 0;
221} 225}
@@ -264,6 +268,11 @@ static inline int sysfs_rename_link(struct kobject *k, struct kobject *t,
264 return 0; 268 return 0;
265} 269}
266 270
271static inline void sysfs_delete_link(struct kobject *k, struct kobject *t,
272 const char *name)
273{
274}
275
267static inline int sysfs_create_group(struct kobject *kobj, 276static inline int sysfs_create_group(struct kobject *kobj,
268 const struct attribute_group *grp) 277 const struct attribute_group *grp)
269{ 278{
@@ -301,6 +310,7 @@ static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
301} 310}
302static inline 311static inline
303struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 312struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
313 const void *ns,
304 const unsigned char *name) 314 const unsigned char *name)
305{ 315{
306 return NULL; 316 return NULL;
@@ -313,6 +323,10 @@ static inline void sysfs_put(struct sysfs_dirent *sd)
313{ 323{
314} 324}
315 325
326static inline void sysfs_exit_ns(int type, const void *tag)
327{
328}
329
316static inline int __must_check sysfs_init(void) 330static inline int __must_check sysfs_init(void)
317{ 331{
318 return 0; 332 return 0;
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 99adcdc0d3ca..609e8ca5f534 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -39,13 +39,6 @@ struct sysrq_key_op {
39 39
40#ifdef CONFIG_MAGIC_SYSRQ 40#ifdef CONFIG_MAGIC_SYSRQ
41 41
42extern int sysrq_on(void);
43
44/*
45 * Do not use this one directly:
46 */
47extern int __sysrq_enabled;
48
49/* Generic SysRq interface -- you may call it from any device driver, supplying 42/* Generic SysRq interface -- you may call it from any device driver, supplying
50 * ASCII code of the key, pointer to registers and kbd/tty structs (if they 43 * ASCII code of the key, pointer to registers and kbd/tty structs (if they
51 * are available -- else NULL's). 44 * are available -- else NULL's).
@@ -57,23 +50,24 @@ int register_sysrq_key(int key, struct sysrq_key_op *op);
57int unregister_sysrq_key(int key, struct sysrq_key_op *op); 50int unregister_sysrq_key(int key, struct sysrq_key_op *op);
58struct sysrq_key_op *__sysrq_get_key_op(int key); 51struct sysrq_key_op *__sysrq_get_key_op(int key);
59 52
53int sysrq_toggle_support(int enable_mask);
54
60#else 55#else
61 56
62static inline int sysrq_on(void) 57static inline void handle_sysrq(int key, struct tty_struct *tty)
63{ 58{
64 return 0;
65} 59}
66static inline int __reterr(void) 60
61static inline int register_sysrq_key(int key, struct sysrq_key_op *op)
67{ 62{
68 return -EINVAL; 63 return -EINVAL;
69} 64}
70static inline void handle_sysrq(int key, struct tty_struct *tty) 65
66static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op)
71{ 67{
68 return -EINVAL;
72} 69}
73 70
74#define register_sysrq_key(ig,nore) __reterr()
75#define unregister_sysrq_key(ig,nore) __reterr()
76
77#endif 71#endif
78 72
79#endif /* _LINUX_SYSRQ_H */ 73#endif /* _LINUX_SYSRQ_H */
diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h
index 96411306eec6..e47d6d90023d 100644
--- a/include/linux/sysv_fs.h
+++ b/include/linux/sysv_fs.h
@@ -148,6 +148,17 @@ struct v7_super_block {
148 char s_fname[6]; /* file system name */ 148 char s_fname[6]; /* file system name */
149 char s_fpack[6]; /* file system pack name */ 149 char s_fpack[6]; /* file system pack name */
150}; 150};
151/* Constants to aid sanity checking */
152/* This is not a hard limit, nor enforced by v7 kernel. It's actually just
153 * the limit used by Seventh Edition's ls, though is high enough to assume
154 * that no reasonable file system would have that much entries in root
155 * directory. Thus, if we see anything higher, we just probably got the
156 * endiannes wrong. */
157#define V7_NFILES 1024
158/* The disk addresses are three-byte (despite direct block addresses being
159 * aligned word-wise in inode). If the most significant byte is non-zero,
160 * something is most likely wrong (not a filesystem, bad bytesex). */
161#define V7_MAXSIZE 0x00ffffff
151 162
152/* Coherent super-block data on disk */ 163/* Coherent super-block data on disk */
153#define COH_NICINOD 100 /* number of inode cache entries */ 164#define COH_NICINOD 100 /* number of inode cache entries */
diff --git a/include/linux/tboot.h b/include/linux/tboot.h
index bf2a0c748878..1dba6ee55203 100644
--- a/include/linux/tboot.h
+++ b/include/linux/tboot.h
@@ -150,6 +150,7 @@ extern int tboot_force_iommu(void);
150 150
151#else 151#else
152 152
153#define tboot_enabled() 0
153#define tboot_probe() do { } while (0) 154#define tboot_probe() do { } while (0)
154#define tboot_shutdown(shutdown_type) do { } while (0) 155#define tboot_shutdown(shutdown_type) do { } while (0)
155#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \ 156#define tboot_sleep(sleep_state, pm1a_control, pm1b_control) \
diff --git a/include/linux/tca6416_keypad.h b/include/linux/tca6416_keypad.h
new file mode 100644
index 000000000000..7bd266f3525c
--- /dev/null
+++ b/include/linux/tca6416_keypad.h
@@ -0,0 +1,34 @@
1/*
2 * tca6416 keypad platform support
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * Author: Sriramakrishnan <srk@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _TCA6416_KEYS_H
14#define _TCA6416_KEYS_H
15
16#include <linux/types.h>
17
18struct tca6416_button {
19 /* Configuration parameters */
20 int code; /* input event code (KEY_*, SW_*) */
21 int active_low;
22 int type; /* input event type (EV_KEY, EV_SW) */
23};
24
25struct tca6416_keys_platform_data {
26 struct tca6416_button *buttons;
27 int nbuttons;
28 unsigned int rep:1; /* enable input subsystem auto repeat */
29 uint16_t pinmask;
30 uint16_t invert;
31 int irq_is_gpio;
32 int use_polling; /* use polling if Interrupt is not connected*/
33};
34#endif
diff --git a/include/linux/threads.h b/include/linux/threads.h
index 052b12bec8bd..383ab9592bec 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -33,4 +33,13 @@
33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ 33#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT)) 34 (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
35 35
36/*
37 * Define a minimum number of pids per cpu. Heuristically based
38 * on original pid max of 32k for 32 cpus. Also, increase the
39 * minimum settable value for pid_max on the running system based
40 * on similar defaults. See kernel/pid.c:pidmap_init() for details.
41 */
42#define PIDS_PER_CPU_DEFAULT 1024
43#define PIDS_PER_CPU_MIN 8
44
36#endif 45#endif
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d2ae79e21be3..b232ccc0ee29 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -42,6 +42,7 @@ enum tick_nohz_mode {
42 * @idle_waketime: Time when the idle was interrupted 42 * @idle_waketime: Time when the idle was interrupted
43 * @idle_exittime: Time when the idle state was left 43 * @idle_exittime: Time when the idle state was left
44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
45 * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
45 * @sleep_length: Duration of the current idle sleep 46 * @sleep_length: Duration of the current idle sleep
46 * @do_timer_lst: CPU was the last one doing do_timer before going idle 47 * @do_timer_lst: CPU was the last one doing do_timer before going idle
47 */ 48 */
@@ -60,7 +61,7 @@ struct tick_sched {
60 ktime_t idle_waketime; 61 ktime_t idle_waketime;
61 ktime_t idle_exittime; 62 ktime_t idle_exittime;
62 ktime_t idle_sleeptime; 63 ktime_t idle_sleeptime;
63 ktime_t idle_lastupdate; 64 ktime_t iowait_sleeptime;
64 ktime_t sleep_length; 65 ktime_t sleep_length;
65 unsigned long last_jiffies; 66 unsigned long last_jiffies;
66 unsigned long next_jiffies; 67 unsigned long next_jiffies;
@@ -124,6 +125,7 @@ extern void tick_nohz_stop_sched_tick(int inidle);
124extern void tick_nohz_restart_sched_tick(void); 125extern void tick_nohz_restart_sched_tick(void);
125extern ktime_t tick_nohz_get_sleep_length(void); 126extern ktime_t tick_nohz_get_sleep_length(void);
126extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time); 127extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
128extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
127# else 129# else
128static inline void tick_nohz_stop_sched_tick(int inidle) { } 130static inline void tick_nohz_stop_sched_tick(int inidle) { }
129static inline void tick_nohz_restart_sched_tick(void) { } 131static inline void tick_nohz_restart_sched_tick(void) { }
@@ -134,6 +136,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
134 return len; 136 return len;
135} 137}
136static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } 138static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
139static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; }
137# endif /* !NO_HZ */ 140# endif /* !NO_HZ */
138 141
139#endif 142#endif
diff --git a/include/linux/timb_dma.h b/include/linux/timb_dma.h
new file mode 100644
index 000000000000..bb043e970b96
--- /dev/null
+++ b/include/linux/timb_dma.h
@@ -0,0 +1,55 @@
1/*
2 * timb_dma.h timberdale FPGA DMA driver defines
3 * Copyright (c) 2010 Intel Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/* Supports:
20 * Timberdale FPGA DMA engine
21 */
22
23#ifndef _LINUX_TIMB_DMA_H
24#define _LINUX_TIMB_DMA_H
25
26/**
27 * struct timb_dma_platform_data_channel - Description of each individual
28 * DMA channel for the timberdale DMA driver
29 * @rx: true if this channel handles data in the direction to
30 * the CPU.
31 * @bytes_per_line: Number of bytes per line, this is specific for channels
32 * handling video data. For other channels this shall be left to 0.
33 * @descriptors: Number of descriptors to allocate for this channel.
34 * @descriptor_elements: Number of elements in each descriptor.
35 *
36 */
37struct timb_dma_platform_data_channel {
38 bool rx;
39 unsigned int bytes_per_line;
40 unsigned int descriptors;
41 unsigned int descriptor_elements;
42};
43
44/**
45 * struct timb_dma_platform_data - Platform data of the timberdale DMA driver
46 * @nr_channels: Number of defined channels in the channels array.
47 * @channels: Definition of the each channel.
48 *
49 */
50struct timb_dma_platform_data {
51 unsigned nr_channels;
52 struct timb_dma_platform_data_channel channels[32];
53};
54
55#endif
diff --git a/include/linux/time.h b/include/linux/time.h
index 6e026e45a179..cb34e35fabac 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -76,9 +76,25 @@ extern unsigned long mktime(const unsigned int year, const unsigned int mon,
76 const unsigned int min, const unsigned int sec); 76 const unsigned int min, const unsigned int sec);
77 77
78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); 78extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec);
79
80/*
81 * timespec_add_safe assumes both values are positive and checks
82 * for overflow. It will return TIME_T_MAX if the reutrn would be
83 * smaller then either of the arguments.
84 */
79extern struct timespec timespec_add_safe(const struct timespec lhs, 85extern struct timespec timespec_add_safe(const struct timespec lhs,
80 const struct timespec rhs); 86 const struct timespec rhs);
81 87
88
89static inline struct timespec timespec_add(struct timespec lhs,
90 struct timespec rhs)
91{
92 struct timespec ts_delta;
93 set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec,
94 lhs.tv_nsec + rhs.tv_nsec);
95 return ts_delta;
96}
97
82/* 98/*
83 * sub = lhs - rhs, in normalized form 99 * sub = lhs - rhs, in normalized form
84 */ 100 */
@@ -97,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
97#define timespec_valid(ts) \ 113#define timespec_valid(ts) \
98 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 114 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC))
99 115
100extern struct timespec xtime;
101extern struct timespec wall_to_monotonic;
102extern seqlock_t xtime_lock; 116extern seqlock_t xtime_lock;
103 117
104extern void read_persistent_clock(struct timespec *ts); 118extern void read_persistent_clock(struct timespec *ts);
@@ -110,7 +124,8 @@ extern int timekeeping_suspended;
110 124
111unsigned long get_seconds(void); 125unsigned long get_seconds(void);
112struct timespec current_kernel_time(void); 126struct timespec current_kernel_time(void);
113struct timespec __current_kernel_time(void); /* does not hold xtime_lock */ 127struct timespec __current_kernel_time(void); /* does not take xtime_lock */
128struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
114struct timespec get_monotonic_coarse(void); 129struct timespec get_monotonic_coarse(void);
115 130
116#define CURRENT_TIME (current_kernel_time()) 131#define CURRENT_TIME (current_kernel_time())
@@ -150,7 +165,6 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
150extern int timekeeping_valid_for_hres(void); 165extern int timekeeping_valid_for_hres(void);
151extern u64 timekeeping_max_deferment(void); 166extern u64 timekeeping_max_deferment(void);
152extern void update_wall_time(void); 167extern void update_wall_time(void);
153extern void update_xtime_cache(u64 nsec);
154extern void timekeeping_leap_insert(int leapsecond); 168extern void timekeeping_leap_insert(int leapsecond);
155 169
156struct tms; 170struct tms;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a2d1eb6cb3f0..38cf093ef62c 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -10,13 +10,19 @@
10struct tvec_base; 10struct tvec_base;
11 11
12struct timer_list { 12struct timer_list {
13 /*
14 * All fields that change during normal runtime grouped to the
15 * same cacheline
16 */
13 struct list_head entry; 17 struct list_head entry;
14 unsigned long expires; 18 unsigned long expires;
19 struct tvec_base *base;
15 20
16 void (*function)(unsigned long); 21 void (*function)(unsigned long);
17 unsigned long data; 22 unsigned long data;
18 23
19 struct tvec_base *base; 24 int slack;
25
20#ifdef CONFIG_TIMER_STATS 26#ifdef CONFIG_TIMER_STATS
21 void *start_site; 27 void *start_site;
22 char start_comm[16]; 28 char start_comm[16];
@@ -94,6 +100,13 @@ void init_timer_deferrable_key(struct timer_list *timer,
94 setup_timer_on_stack_key((timer), #timer, &__key, \ 100 setup_timer_on_stack_key((timer), #timer, &__key, \
95 (fn), (data)); \ 101 (fn), (data)); \
96 } while (0) 102 } while (0)
103#define setup_deferrable_timer_on_stack(timer, fn, data) \
104 do { \
105 static struct lock_class_key __key; \
106 setup_deferrable_timer_on_stack_key((timer), #timer, \
107 &__key, (fn), \
108 (data)); \
109 } while (0)
97#else 110#else
98#define init_timer(timer)\ 111#define init_timer(timer)\
99 init_timer_key((timer), NULL, NULL) 112 init_timer_key((timer), NULL, NULL)
@@ -105,6 +118,8 @@ void init_timer_deferrable_key(struct timer_list *timer,
105 setup_timer_key((timer), NULL, NULL, (fn), (data)) 118 setup_timer_key((timer), NULL, NULL, (fn), (data))
106#define setup_timer_on_stack(timer, fn, data)\ 119#define setup_timer_on_stack(timer, fn, data)\
107 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data)) 120 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
121#define setup_deferrable_timer_on_stack(timer, fn, data)\
122 setup_deferrable_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
108#endif 123#endif
109 124
110#ifdef CONFIG_DEBUG_OBJECTS_TIMERS 125#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
@@ -144,6 +159,12 @@ static inline void setup_timer_on_stack_key(struct timer_list *timer,
144 init_timer_on_stack_key(timer, name, key); 159 init_timer_on_stack_key(timer, name, key);
145} 160}
146 161
162extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
163 const char *name,
164 struct lock_class_key *key,
165 void (*function)(unsigned long),
166 unsigned long data);
167
147/** 168/**
148 * timer_pending - is a timer pending? 169 * timer_pending - is a timer pending?
149 * @timer: the timer in question 170 * @timer: the timer in question
@@ -165,6 +186,8 @@ extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 186extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires); 187extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
167 188
189extern void set_timer_slack(struct timer_list *time, int slack_hz);
190
168#define TIMER_NOT_PINNED 0 191#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1 192#define TIMER_PINNED 1
170/* 193/*
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 7a082b32d8e1..32d852f8cbe4 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -232,13 +232,11 @@ struct timex {
232 */ 232 */
233extern unsigned long tick_usec; /* USER_HZ period (usec) */ 233extern unsigned long tick_usec; /* USER_HZ period (usec) */
234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */ 234extern unsigned long tick_nsec; /* ACTHZ period (nsec) */
235extern int tickadj; /* amount of adjustment per tick */
236 235
237/* 236/*
238 * phase-lock loop variables 237 * phase-lock loop variables
239 */ 238 */
240extern int time_status; /* clock synchronization status bits */ 239extern int time_status; /* clock synchronization status bits */
241extern long time_adjust; /* The amount of adjtime left */
242 240
243extern void ntp_init(void); 241extern void ntp_init(void);
244extern void ntp_clear(void); 242extern void ntp_clear(void);
@@ -271,9 +269,6 @@ extern void second_overflow(void);
271extern void update_ntp_one_tick(void); 269extern void update_ntp_one_tick(void);
272extern int do_adjtimex(struct timex *); 270extern int do_adjtimex(struct timex *);
273 271
274/* Don't use! Compatibility define for existing users. */
275#define tickadj (500/HZ ? : 1)
276
277int read_current_timer(unsigned long *timer_val); 272int read_current_timer(unsigned long *timer_val);
278 273
279/* The clock frequency of the i8253/i8254 PIT */ 274/* The clock frequency of the i8253/i8254 PIT */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 3d92396639de..181c8d0e6f73 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -107,7 +107,7 @@ static inline unsigned int tipc_node(__u32 addr)
107 * Message importance levels 107 * Message importance levels
108 */ 108 */
109 109
110#define TIPC_LOW_IMPORTANCE 0 /* default */ 110#define TIPC_LOW_IMPORTANCE 0
111#define TIPC_MEDIUM_IMPORTANCE 1 111#define TIPC_MEDIUM_IMPORTANCE 1
112#define TIPC_HIGH_IMPORTANCE 2 112#define TIPC_HIGH_IMPORTANCE 2
113#define TIPC_CRITICAL_IMPORTANCE 3 113#define TIPC_CRITICAL_IMPORTANCE 3
@@ -127,23 +127,17 @@ static inline unsigned int tipc_node(__u32 addr)
127 * TIPC topology subscription service definitions 127 * TIPC topology subscription service definitions
128 */ 128 */
129 129
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_SERVICE 0x00 /* Filter for service availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_PORTS 0x01 /* Filter for port availability */
132#define TIPC_SUB_CANCEL 0x04 /* cancel a subscription */ 132#define TIPC_SUB_CANCEL 0x04 /* Cancel a subscription */
133#if 0
134/* The following filter options are not currently implemented */
135#define TIPC_SUB_NO_BIND_EVTS 0x04 /* filter out "publish" events */
136#define TIPC_SUB_NO_UNBIND_EVTS 0x08 /* filter out "withdraw" events */
137#define TIPC_SUB_SINGLE_EVT 0x10 /* expire after first event */
138#endif
139 133
140#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */ 134#define TIPC_WAIT_FOREVER ~0 /* timeout for permanent subscription */
141 135
142struct tipc_subscr { 136struct tipc_subscr {
143 struct tipc_name_seq seq; /* name sequence of interest */ 137 struct tipc_name_seq seq; /* NBO. Name sequence of interest */
144 __u32 timeout; /* subscription duration (in ms) */ 138 __u32 timeout; /* NBO. Subscription duration (in ms) */
145 __u32 filter; /* bitmask of filter options */ 139 __u32 filter; /* NBO. Bitmask of filter options */
146 char usr_handle[8]; /* available for subscriber use */ 140 char usr_handle[8]; /* Opaque. Available for subscriber use */
147}; 141};
148 142
149#define TIPC_PUBLISHED 1 /* publication event */ 143#define TIPC_PUBLISHED 1 /* publication event */
@@ -151,11 +145,11 @@ struct tipc_subscr {
151#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */ 145#define TIPC_SUBSCR_TIMEOUT 3 /* subscription timeout event */
152 146
153struct tipc_event { 147struct tipc_event {
154 __u32 event; /* event type */ 148 __u32 event; /* NBO. Event type, as defined above */
155 __u32 found_lower; /* matching name seq instances */ 149 __u32 found_lower; /* NBO. Matching name seq instances */
156 __u32 found_upper; /* " " " " */ 150 __u32 found_upper; /* " " " " " */
157 struct tipc_portid port; /* associated port */ 151 struct tipc_portid port; /* NBO. Associated port */
158 struct tipc_subscr s; /* associated subscription */ 152 struct tipc_subscr s; /* Original, associated subscription */
159}; 153};
160 154
161/* 155/*
@@ -188,7 +182,7 @@ struct sockaddr_tipc {
188 struct tipc_name_seq nameseq; 182 struct tipc_name_seq nameseq;
189 struct { 183 struct {
190 struct tipc_name name; 184 struct tipc_name name;
191 __u32 domain; /* 0: own zone */ 185 __u32 domain;
192 } name; 186 } name;
193 } addr; 187 } addr;
194}; 188};
@@ -206,7 +200,7 @@ struct sockaddr_tipc {
206 */ 200 */
207 201
208#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */ 202#define TIPC_IMPORTANCE 127 /* Default: TIPC_LOW_IMPORTANCE */
209#define TIPC_SRC_DROPPABLE 128 /* Default: 0 (resend congested msg) */ 203#define TIPC_SRC_DROPPABLE 128 /* Default: based on socket type */
210#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */ 204#define TIPC_DEST_DROPPABLE 129 /* Default: based on socket type */
211#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */ 205#define TIPC_CONN_TIMEOUT 130 /* Default: 8000 (ms) */
212#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */ 206#define TIPC_NODE_RECVQ_DEPTH 131 /* Default: none (read only) */
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 2bc6fa4adeb5..9cde86c32412 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -74,6 +74,7 @@
74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */ 74#define TIPC_CMD_SHOW_NAME_TABLE 0x0005 /* tx name_tbl_query, rx ultra_string */
75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */ 75#define TIPC_CMD_SHOW_PORTS 0x0006 /* tx none, rx ultra_string */
76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */ 76#define TIPC_CMD_SHOW_LINK_STATS 0x000B /* tx link_name, rx ultra_string */
77#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
77 78
78#if 0 79#if 0
79#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */ 80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 5b81156780b1..64e084ff5e5c 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -31,6 +31,7 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/mmzone.h> 32#include <linux/mmzone.h>
33#include <linux/smp.h> 33#include <linux/smp.h>
34#include <linux/percpu.h>
34#include <asm/topology.h> 35#include <asm/topology.h>
35 36
36#ifndef node_has_online_mem 37#ifndef node_has_online_mem
@@ -102,6 +103,7 @@ int arch_update_cpu_topology(void);
102 | 1*SD_SHARE_PKG_RESOURCES \ 103 | 1*SD_SHARE_PKG_RESOURCES \
103 | 0*SD_SERIALIZE \ 104 | 0*SD_SERIALIZE \
104 | 0*SD_PREFER_SIBLING \ 105 | 0*SD_PREFER_SIBLING \
106 | arch_sd_sibling_asym_packing() \
105 , \ 107 , \
106 .last_balance = jiffies, \ 108 .last_balance = jiffies, \
107 .balance_interval = 1, \ 109 .balance_interval = 1, \
@@ -203,8 +205,110 @@ int arch_update_cpu_topology(void);
203#ifndef SD_NODE_INIT 205#ifndef SD_NODE_INIT
204#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!! 206#error Please define an appropriate SD_NODE_INIT in include/asm/topology.h!!!
205#endif 207#endif
208
206#endif /* CONFIG_NUMA */ 209#endif /* CONFIG_NUMA */
207 210
211#ifdef CONFIG_USE_PERCPU_NUMA_NODE_ID
212DECLARE_PER_CPU(int, numa_node);
213
214#ifndef numa_node_id
215/* Returns the number of the current Node. */
216static inline int numa_node_id(void)
217{
218 return __this_cpu_read(numa_node);
219}
220#endif
221
222#ifndef cpu_to_node
223static inline int cpu_to_node(int cpu)
224{
225 return per_cpu(numa_node, cpu);
226}
227#endif
228
229#ifndef set_numa_node
230static inline void set_numa_node(int node)
231{
232 percpu_write(numa_node, node);
233}
234#endif
235
236#ifndef set_cpu_numa_node
237static inline void set_cpu_numa_node(int cpu, int node)
238{
239 per_cpu(numa_node, cpu) = node;
240}
241#endif
242
243#else /* !CONFIG_USE_PERCPU_NUMA_NODE_ID */
244
245/* Returns the number of the current Node. */
246#ifndef numa_node_id
247static inline int numa_node_id(void)
248{
249 return cpu_to_node(raw_smp_processor_id());
250}
251#endif
252
253#endif /* [!]CONFIG_USE_PERCPU_NUMA_NODE_ID */
254
255#ifdef CONFIG_HAVE_MEMORYLESS_NODES
256
257/*
258 * N.B., Do NOT reference the '_numa_mem_' per cpu variable directly.
259 * It will not be defined when CONFIG_HAVE_MEMORYLESS_NODES is not defined.
260 * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
261 */
262DECLARE_PER_CPU(int, _numa_mem_);
263
264#ifndef set_numa_mem
265static inline void set_numa_mem(int node)
266{
267 percpu_write(_numa_mem_, node);
268}
269#endif
270
271#ifndef numa_mem_id
272/* Returns the number of the nearest Node with memory */
273static inline int numa_mem_id(void)
274{
275 return __this_cpu_read(_numa_mem_);
276}
277#endif
278
279#ifndef cpu_to_mem
280static inline int cpu_to_mem(int cpu)
281{
282 return per_cpu(_numa_mem_, cpu);
283}
284#endif
285
286#ifndef set_cpu_numa_mem
287static inline void set_cpu_numa_mem(int cpu, int node)
288{
289 per_cpu(_numa_mem_, cpu) = node;
290}
291#endif
292
293#else /* !CONFIG_HAVE_MEMORYLESS_NODES */
294
295#ifndef numa_mem_id
296/* Returns the number of the nearest Node with memory */
297static inline int numa_mem_id(void)
298{
299 return numa_node_id();
300}
301#endif
302
303#ifndef cpu_to_mem
304static inline int cpu_to_mem(int cpu)
305{
306 return cpu_to_node(cpu);
307}
308#endif
309
310#endif /* [!]CONFIG_HAVE_MEMORYLESS_NODES */
311
208#ifndef topology_physical_package_id 312#ifndef topology_physical_package_id
209#define topology_physical_package_id(cpu) ((void)(cpu), -1) 313#define topology_physical_package_id(cpu) ((void)(cpu), -1)
210#endif 314#endif
@@ -218,9 +322,4 @@ int arch_update_cpu_topology(void);
218#define topology_core_cpumask(cpu) cpumask_of(cpu) 322#define topology_core_cpumask(cpu) cpumask_of(cpu)
219#endif 323#endif
220 324
221/* Returns the number of the current Node. */
222#ifndef numa_node_id
223#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
224#endif
225
226#endif /* _LINUX_TOPOLOGY_H */ 325#endif /* _LINUX_TOPOLOGY_H */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 78b4bd3be496..103d1b61aacb 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -14,18 +14,24 @@
14 * See the file COPYING for more details. 14 * See the file COPYING for more details.
15 */ 15 */
16 16
17#include <linux/errno.h>
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/rcupdate.h> 19#include <linux/rcupdate.h>
19 20
20struct module; 21struct module;
21struct tracepoint; 22struct tracepoint;
22 23
24struct tracepoint_func {
25 void *func;
26 void *data;
27};
28
23struct tracepoint { 29struct tracepoint {
24 const char *name; /* Tracepoint name */ 30 const char *name; /* Tracepoint name */
25 int state; /* State. */ 31 int state; /* State. */
26 void (*regfunc)(void); 32 void (*regfunc)(void);
27 void (*unregfunc)(void); 33 void (*unregfunc)(void);
28 void **funcs; 34 struct tracepoint_func *funcs;
29} __attribute__((aligned(32))); /* 35} __attribute__((aligned(32))); /*
30 * Aligned on 32 bytes because it is 36 * Aligned on 32 bytes because it is
31 * globally visible and gcc happily 37 * globally visible and gcc happily
@@ -33,6 +39,68 @@ struct tracepoint {
33 * Keep in sync with vmlinux.lds.h. 39 * Keep in sync with vmlinux.lds.h.
34 */ 40 */
35 41
42/*
43 * Connect a probe to a tracepoint.
44 * Internal API, should not be used directly.
45 */
46extern int tracepoint_probe_register(const char *name, void *probe, void *data);
47
48/*
49 * Disconnect a probe from a tracepoint.
50 * Internal API, should not be used directly.
51 */
52extern int
53tracepoint_probe_unregister(const char *name, void *probe, void *data);
54
55extern int tracepoint_probe_register_noupdate(const char *name, void *probe,
56 void *data);
57extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe,
58 void *data);
59extern void tracepoint_probe_update_all(void);
60
61struct tracepoint_iter {
62 struct module *module;
63 struct tracepoint *tracepoint;
64};
65
66extern void tracepoint_iter_start(struct tracepoint_iter *iter);
67extern void tracepoint_iter_next(struct tracepoint_iter *iter);
68extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
69extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
70extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
71 struct tracepoint *begin, struct tracepoint *end);
72
73/*
74 * tracepoint_synchronize_unregister must be called between the last tracepoint
75 * probe unregistration and the end of module exit to make sure there is no
76 * caller executing a probe when it is freed.
77 */
78static inline void tracepoint_synchronize_unregister(void)
79{
80 synchronize_sched();
81}
82
83#define PARAMS(args...) args
84
85#ifdef CONFIG_TRACEPOINTS
86extern void tracepoint_update_probe_range(struct tracepoint *begin,
87 struct tracepoint *end);
88#else
89static inline void tracepoint_update_probe_range(struct tracepoint *begin,
90 struct tracepoint *end)
91{ }
92#endif /* CONFIG_TRACEPOINTS */
93
94#endif /* _LINUX_TRACEPOINT_H */
95
96/*
97 * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include
98 * file ifdef protection.
99 * This is due to the way trace events work. If a file includes two
100 * trace event headers under one "CREATE_TRACE_POINTS" the first include
101 * will override the TRACE_EVENT and break the second include.
102 */
103
36#ifndef DECLARE_TRACE 104#ifndef DECLARE_TRACE
37 105
38#define TP_PROTO(args...) args 106#define TP_PROTO(args...) args
@@ -43,17 +111,27 @@ struct tracepoint {
43/* 111/*
44 * it_func[0] is never NULL because there is at least one element in the array 112 * it_func[0] is never NULL because there is at least one element in the array
45 * when the array itself is non NULL. 113 * when the array itself is non NULL.
114 *
115 * Note, the proto and args passed in includes "__data" as the first parameter.
116 * The reason for this is to handle the "void" prototype. If a tracepoint
117 * has a "void" prototype, then it is invalid to declare a function
118 * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
119 * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
46 */ 120 */
47#define __DO_TRACE(tp, proto, args) \ 121#define __DO_TRACE(tp, proto, args) \
48 do { \ 122 do { \
49 void **it_func; \ 123 struct tracepoint_func *it_func_ptr; \
124 void *it_func; \
125 void *__data; \
50 \ 126 \
51 rcu_read_lock_sched_notrace(); \ 127 rcu_read_lock_sched_notrace(); \
52 it_func = rcu_dereference_sched((tp)->funcs); \ 128 it_func_ptr = rcu_dereference_sched((tp)->funcs); \
53 if (it_func) { \ 129 if (it_func_ptr) { \
54 do { \ 130 do { \
55 ((void(*)(proto))(*it_func))(args); \ 131 it_func = (it_func_ptr)->func; \
56 } while (*(++it_func)); \ 132 __data = (it_func_ptr)->data; \
133 ((void(*)(proto))(it_func))(args); \
134 } while ((++it_func_ptr)->func); \
57 } \ 135 } \
58 rcu_read_unlock_sched_notrace(); \ 136 rcu_read_unlock_sched_notrace(); \
59 } while (0) 137 } while (0)
@@ -63,24 +141,32 @@ struct tracepoint {
63 * not add unwanted padding between the beginning of the section and the 141 * not add unwanted padding between the beginning of the section and the
64 * structure. Force alignment to the same alignment as the section start. 142 * structure. Force alignment to the same alignment as the section start.
65 */ 143 */
66#define DECLARE_TRACE(name, proto, args) \ 144#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
67 extern struct tracepoint __tracepoint_##name; \ 145 extern struct tracepoint __tracepoint_##name; \
68 static inline void trace_##name(proto) \ 146 static inline void trace_##name(proto) \
69 { \ 147 { \
70 if (unlikely(__tracepoint_##name.state)) \ 148 if (unlikely(__tracepoint_##name.state)) \
71 __DO_TRACE(&__tracepoint_##name, \ 149 __DO_TRACE(&__tracepoint_##name, \
72 TP_PROTO(proto), TP_ARGS(args)); \ 150 TP_PROTO(data_proto), \
151 TP_ARGS(data_args)); \
73 } \ 152 } \
74 static inline int register_trace_##name(void (*probe)(proto)) \ 153 static inline int \
154 register_trace_##name(void (*probe)(data_proto), void *data) \
75 { \ 155 { \
76 return tracepoint_probe_register(#name, (void *)probe); \ 156 return tracepoint_probe_register(#name, (void *)probe, \
157 data); \
77 } \ 158 } \
78 static inline int unregister_trace_##name(void (*probe)(proto)) \ 159 static inline int \
160 unregister_trace_##name(void (*probe)(data_proto), void *data) \
161 { \
162 return tracepoint_probe_unregister(#name, (void *)probe, \
163 data); \
164 } \
165 static inline void \
166 check_trace_callback_type_##name(void (*cb)(data_proto)) \
79 { \ 167 { \
80 return tracepoint_probe_unregister(#name, (void *)probe);\
81 } 168 }
82 169
83
84#define DEFINE_TRACE_FN(name, reg, unreg) \ 170#define DEFINE_TRACE_FN(name, reg, unreg) \
85 static const char __tpstrtab_##name[] \ 171 static const char __tpstrtab_##name[] \
86 __attribute__((section("__tracepoints_strings"))) = #name; \ 172 __attribute__((section("__tracepoints_strings"))) = #name; \
@@ -96,22 +182,24 @@ struct tracepoint {
96#define EXPORT_TRACEPOINT_SYMBOL(name) \ 182#define EXPORT_TRACEPOINT_SYMBOL(name) \
97 EXPORT_SYMBOL(__tracepoint_##name) 183 EXPORT_SYMBOL(__tracepoint_##name)
98 184
99extern void tracepoint_update_probe_range(struct tracepoint *begin,
100 struct tracepoint *end);
101
102#else /* !CONFIG_TRACEPOINTS */ 185#else /* !CONFIG_TRACEPOINTS */
103#define DECLARE_TRACE(name, proto, args) \ 186#define __DECLARE_TRACE(name, proto, args, data_proto, data_args) \
104 static inline void _do_trace_##name(struct tracepoint *tp, proto) \
105 { } \
106 static inline void trace_##name(proto) \ 187 static inline void trace_##name(proto) \
107 { } \ 188 { } \
108 static inline int register_trace_##name(void (*probe)(proto)) \ 189 static inline int \
190 register_trace_##name(void (*probe)(data_proto), \
191 void *data) \
109 { \ 192 { \
110 return -ENOSYS; \ 193 return -ENOSYS; \
111 } \ 194 } \
112 static inline int unregister_trace_##name(void (*probe)(proto)) \ 195 static inline int \
196 unregister_trace_##name(void (*probe)(data_proto), \
197 void *data) \
113 { \ 198 { \
114 return -ENOSYS; \ 199 return -ENOSYS; \
200 } \
201 static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
202 { \
115 } 203 }
116 204
117#define DEFINE_TRACE_FN(name, reg, unreg) 205#define DEFINE_TRACE_FN(name, reg, unreg)
@@ -119,60 +207,31 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
119#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) 207#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
120#define EXPORT_TRACEPOINT_SYMBOL(name) 208#define EXPORT_TRACEPOINT_SYMBOL(name)
121 209
122static inline void tracepoint_update_probe_range(struct tracepoint *begin,
123 struct tracepoint *end)
124{ }
125#endif /* CONFIG_TRACEPOINTS */ 210#endif /* CONFIG_TRACEPOINTS */
126#endif /* DECLARE_TRACE */
127
128/*
129 * Connect a probe to a tracepoint.
130 * Internal API, should not be used directly.
131 */
132extern int tracepoint_probe_register(const char *name, void *probe);
133
134/*
135 * Disconnect a probe from a tracepoint.
136 * Internal API, should not be used directly.
137 */
138extern int tracepoint_probe_unregister(const char *name, void *probe);
139
140extern int tracepoint_probe_register_noupdate(const char *name, void *probe);
141extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe);
142extern void tracepoint_probe_update_all(void);
143
144struct tracepoint_iter {
145 struct module *module;
146 struct tracepoint *tracepoint;
147};
148
149extern void tracepoint_iter_start(struct tracepoint_iter *iter);
150extern void tracepoint_iter_next(struct tracepoint_iter *iter);
151extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
152extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
153extern int tracepoint_get_iter_range(struct tracepoint **tracepoint,
154 struct tracepoint *begin, struct tracepoint *end);
155 211
156/* 212/*
157 * tracepoint_synchronize_unregister must be called between the last tracepoint 213 * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
158 * probe unregistration and the end of module exit to make sure there is no 214 * (void). "void" is a special value in a function prototype and can
159 * caller executing a probe when it is freed. 215 * not be combined with other arguments. Since the DECLARE_TRACE()
216 * macro adds a data element at the beginning of the prototype,
217 * we need a way to differentiate "(void *data, proto)" from
218 * "(void *data, void)". The second prototype is invalid.
219 *
220 * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
221 * and "void *__data" as the callback prototype.
222 *
223 * DECLARE_TRACE() passes "proto" as the tracepoint protoype and
224 * "void *__data, proto" as the callback prototype.
160 */ 225 */
161static inline void tracepoint_synchronize_unregister(void) 226#define DECLARE_TRACE_NOARGS(name) \
162{ 227 __DECLARE_TRACE(name, void, , void *__data, __data)
163 synchronize_sched();
164}
165 228
166#define PARAMS(args...) args 229#define DECLARE_TRACE(name, proto, args) \
167 230 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
168#endif /* _LINUX_TRACEPOINT_H */ 231 PARAMS(void *__data, proto), \
232 PARAMS(__data, args))
169 233
170/* 234#endif /* DECLARE_TRACE */
171 * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
172 * This is due to the way trace events work. If a file includes two
173 * trace event headers under one "CREATE_TRACE_POINTS" the first include
174 * will override the TRACE_EVENT and break the second include.
175 */
176 235
177#ifndef TRACE_EVENT 236#ifndef TRACE_EVENT
178/* 237/*
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4409967db0c4..1437da3ddc62 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -13,6 +13,7 @@
13#include <linux/tty_driver.h> 13#include <linux/tty_driver.h>
14#include <linux/tty_ldisc.h> 14#include <linux/tty_ldisc.h>
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/smp_lock.h>
16 17
17#include <asm/system.h> 18#include <asm/system.h>
18 19
@@ -23,7 +24,7 @@
23 */ 24 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 25#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 26#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 20 27#define NR_LDISCS 30
27 28
28/* line disciplines */ 29/* line disciplines */
29#define N_TTY 0 30#define N_TTY 0
@@ -46,8 +47,9 @@
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 47#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ 48#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
48#define N_PPS 18 /* Pulse per Second */ 49#define N_PPS 18 /* Pulse per Second */
49
50#define N_V253 19 /* Codec control over voice modem */ 50#define N_V253 19 /* Codec control over voice modem */
51#define N_CAIF 20 /* CAIF protocol for talking to modems */
52#define N_GSM0710 21 /* GSM 0710 Mux */
51 53
52/* 54/*
53 * This character is the same as _POSIX_VDISABLE: it cannot be used as 55 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -178,6 +180,7 @@ struct tty_bufhead {
178#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) 180#define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO)
179#define L_PENDIN(tty) _L_FLAG((tty), PENDIN) 181#define L_PENDIN(tty) _L_FLAG((tty), PENDIN)
180#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) 182#define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN)
183#define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC)
181 184
182struct device; 185struct device;
183struct signal_struct; 186struct signal_struct;
@@ -414,6 +417,7 @@ extern int is_ignored(int sig);
414extern int tty_signal(int sig, struct tty_struct *tty); 417extern int tty_signal(int sig, struct tty_struct *tty);
415extern void tty_hangup(struct tty_struct *tty); 418extern void tty_hangup(struct tty_struct *tty);
416extern void tty_vhangup(struct tty_struct *tty); 419extern void tty_vhangup(struct tty_struct *tty);
420extern void tty_vhangup_locked(struct tty_struct *tty);
417extern void tty_vhangup_self(void); 421extern void tty_vhangup_self(void);
418extern void tty_unhangup(struct file *filp); 422extern void tty_unhangup(struct file *filp);
419extern int tty_hung_up_p(struct file *filp); 423extern int tty_hung_up_p(struct file *filp);
@@ -551,6 +555,9 @@ static inline void tty_audit_push_task(struct task_struct *tsk,
551} 555}
552#endif 556#endif
553 557
558/* tty_io.c */
559extern int __init tty_init(void);
560
554/* tty_ioctl.c */ 561/* tty_ioctl.c */
555extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, 562extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
556 unsigned int cmd, unsigned long arg); 563 unsigned int cmd, unsigned long arg);
@@ -571,5 +578,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file,
571extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 578extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file,
572 unsigned int cmd, unsigned long arg); 579 unsigned int cmd, unsigned long arg);
573 580
581/* tty_mutex.c */
582/* functions for preparation of BKL removal */
583extern void __lockfunc tty_lock(void) __acquires(tty_lock);
584extern void __lockfunc tty_unlock(void) __releases(tty_lock);
585extern struct task_struct *__big_tty_mutex_owner;
586#define tty_locked() (current == __big_tty_mutex_owner)
587
588/*
589 * wait_event_interruptible_tty -- wait for a condition with the tty lock held
590 *
591 * The condition we are waiting for might take a long time to
592 * become true, or might depend on another thread taking the
593 * BTM. In either case, we need to drop the BTM to guarantee
594 * forward progress. This is a leftover from the conversion
595 * from the BKL and should eventually get removed as the BTM
596 * falls out of use.
597 *
598 * Do not use in new code.
599 */
600#define wait_event_interruptible_tty(wq, condition) \
601({ \
602 int __ret = 0; \
603 if (!(condition)) { \
604 __wait_event_interruptible_tty(wq, condition, __ret); \
605 } \
606 __ret; \
607})
608
609#define __wait_event_interruptible_tty(wq, condition, ret) \
610do { \
611 DEFINE_WAIT(__wait); \
612 \
613 for (;;) { \
614 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
615 if (condition) \
616 break; \
617 if (!signal_pending(current)) { \
618 tty_unlock(); \
619 schedule(); \
620 tty_lock(); \
621 continue; \
622 } \
623 ret = -ERESTARTSYS; \
624 break; \
625 } \
626 finish_wait(&wq, &__wait); \
627} while (0)
628
629
574#endif /* __KERNEL__ */ 630#endif /* __KERNEL__ */
575#endif 631#endif
diff --git a/include/linux/types.h b/include/linux/types.h
index c42724f8c802..01a082f56ef4 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -8,7 +8,10 @@
8 8
9#define DECLARE_BITMAP(name,bits) \ 9#define DECLARE_BITMAP(name,bits) \
10 unsigned long name[BITS_TO_LONGS(bits)] 10 unsigned long name[BITS_TO_LONGS(bits)]
11 11#else
12#ifndef __EXPORTED_HEADERS__
13#warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
14#endif /* __EXPORTED_HEADERS__ */
12#endif 15#endif
13 16
14#include <linux/posix_types.h> 17#include <linux/posix_types.h>
@@ -188,15 +191,27 @@ typedef u32 phys_addr_t;
188typedef phys_addr_t resource_size_t; 191typedef phys_addr_t resource_size_t;
189 192
190typedef struct { 193typedef struct {
191 volatile int counter; 194 int counter;
192} atomic_t; 195} atomic_t;
193 196
194#ifdef CONFIG_64BIT 197#ifdef CONFIG_64BIT
195typedef struct { 198typedef struct {
196 volatile long counter; 199 long counter;
197} atomic64_t; 200} atomic64_t;
198#endif 201#endif
199 202
203struct list_head {
204 struct list_head *next, *prev;
205};
206
207struct hlist_head {
208 struct hlist_node *first;
209};
210
211struct hlist_node {
212 struct hlist_node *next, **pprev;
213};
214
200struct ustat { 215struct ustat {
201 __kernel_daddr_t f_tfree; 216 __kernel_daddr_t f_tfree;
202 __kernel_ino_t f_tinode; 217 __kernel_ino_t f_tinode;
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
new file mode 100644
index 000000000000..fa261a0da280
--- /dev/null
+++ b/include/linux/u64_stats_sync.h
@@ -0,0 +1,140 @@
1#ifndef _LINUX_U64_STATS_SYNC_H
2#define _LINUX_U64_STATS_SYNC_H
3
4/*
5 * To properly implement 64bits network statistics on 32bit and 64bit hosts,
6 * we provide a synchronization point, that is a noop on 64bit or UP kernels.
7 *
8 * Key points :
9 * 1) Use a seqcount on SMP 32bits, with low overhead.
10 * 2) Whole thing is a noop on 64bit arches or UP kernels.
11 * 3) Write side must ensure mutual exclusion or one seqcount update could
12 * be lost, thus blocking readers forever.
13 * If this synchronization point is not a mutex, but a spinlock or
14 * spinlock_bh() or disable_bh() :
15 * 3.1) Write side should not sleep.
16 * 3.2) Write side should not allow preemption.
17 * 3.3) If applicable, interrupts should be disabled.
18 *
19 * 4) If reader fetches several counters, there is no guarantee the whole values
20 * are consistent (remember point 1) : this is a noop on 64bit arches anyway)
21 *
22 * 5) readers are allowed to sleep or be preempted/interrupted : They perform
23 * pure reads. But if they have to fetch many values, it's better to not allow
24 * preemptions/interruptions to avoid many retries.
25 *
26 * 6) If counter might be written by an interrupt, readers should block interrupts.
27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
28 * read partial values)
29 *
30 * 7) For softirq uses, readers can use u64_stats_fetch_begin_bh() and
31 * u64_stats_fetch_retry_bh() helpers
32 *
33 * Usage :
34 *
35 * Stats producer (writer) should use following template granted it already got
36 * an exclusive access to counters (a lock is already taken, or per cpu
37 * data is used [in a non preemptable context])
38 *
39 * spin_lock_bh(...) or other synchronization to get exclusive access
40 * ...
41 * u64_stats_update_begin(&stats->syncp);
42 * stats->bytes64 += len; // non atomic operation
43 * stats->packets64++; // non atomic operation
44 * u64_stats_update_end(&stats->syncp);
45 *
46 * While a consumer (reader) should use following template to get consistent
47 * snapshot for each variable (but no guarantee on several ones)
48 *
49 * u64 tbytes, tpackets;
50 * unsigned int start;
51 *
52 * do {
53 * start = u64_stats_fetch_begin(&stats->syncp);
54 * tbytes = stats->bytes64; // non atomic operation
55 * tpackets = stats->packets64; // non atomic operation
56 * } while (u64_stats_fetch_retry(&stats->syncp, start));
57 *
58 *
59 * Example of use in drivers/net/loopback.c, using per_cpu containers,
60 * in BH disabled context.
61 */
62#include <linux/seqlock.h>
63
64struct u64_stats_sync {
65#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
66 seqcount_t seq;
67#endif
68};
69
70static void inline u64_stats_update_begin(struct u64_stats_sync *syncp)
71{
72#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
73 write_seqcount_begin(&syncp->seq);
74#endif
75}
76
77static void inline u64_stats_update_end(struct u64_stats_sync *syncp)
78{
79#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
80 write_seqcount_end(&syncp->seq);
81#endif
82}
83
84static unsigned int inline u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
85{
86#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
87 return read_seqcount_begin(&syncp->seq);
88#else
89#if BITS_PER_LONG==32
90 preempt_disable();
91#endif
92 return 0;
93#endif
94}
95
96static bool inline u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
97 unsigned int start)
98{
99#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
100 return read_seqcount_retry(&syncp->seq, start);
101#else
102#if BITS_PER_LONG==32
103 preempt_enable();
104#endif
105 return false;
106#endif
107}
108
109/*
110 * In case softirq handlers can update u64 counters, readers can use following helpers
111 * - SMP 32bit arches use seqcount protection, irq safe.
112 * - UP 32bit must disable BH.
113 * - 64bit have no problem atomically reading u64 values, irq safe.
114 */
115static unsigned int inline u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp)
116{
117#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
118 return read_seqcount_begin(&syncp->seq);
119#else
120#if BITS_PER_LONG==32
121 local_bh_disable();
122#endif
123 return 0;
124#endif
125}
126
127static bool inline u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp,
128 unsigned int start)
129{
130#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
131 return read_seqcount_retry(&syncp->seq, start);
132#else
133#if BITS_PER_LONG==32
134 local_bh_enable();
135#endif
136 return false;
137#endif
138}
139
140#endif /* _LINUX_U64_STATS_SYNC_H */
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 15ddd4483b09..60c81da77f0f 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -166,11 +166,11 @@ struct uinput_ff_erase {
166struct uinput_user_dev { 166struct uinput_user_dev {
167 char name[UINPUT_MAX_NAME_SIZE]; 167 char name[UINPUT_MAX_NAME_SIZE];
168 struct input_id id; 168 struct input_id id;
169 int ff_effects_max; 169 int ff_effects_max;
170 int absmax[ABS_MAX + 1]; 170 int absmax[ABS_CNT];
171 int absmin[ABS_MAX + 1]; 171 int absmin[ABS_CNT];
172 int absfuzz[ABS_MAX + 1]; 172 int absfuzz[ABS_CNT];
173 int absflat[ABS_MAX + 1]; 173 int absflat[ABS_CNT];
174}; 174};
175#endif /* __UINPUT_H_ */ 175#endif /* __UINPUT_H_ */
176 176
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 739f1fd1cc15..35fe6ab222bb 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -45,27 +45,14 @@ struct wusb_dev;
45 45
46struct ep_device; 46struct ep_device;
47 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
61/** 48/**
62 * struct usb_host_endpoint - host-side endpoint descriptor and queue 49 * struct usb_host_endpoint - host-side endpoint descriptor and queue
63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 50 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
51 * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint
64 * @urb_list: urbs queued to this endpoint; maintained by usbcore 52 * @urb_list: urbs queued to this endpoint; maintained by usbcore
65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 53 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
66 * with one or more transfer descriptors (TDs) per urb 54 * with one or more transfer descriptors (TDs) per urb
67 * @ep_dev: ep_device for sysfs info 55 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
69 * @extra: descriptors following this endpoint in the configuration 56 * @extra: descriptors following this endpoint in the configuration
70 * @extralen: how many bytes of "extra" are valid 57 * @extralen: how many bytes of "extra" are valid
71 * @enabled: URBs may be submitted to this endpoint 58 * @enabled: URBs may be submitted to this endpoint
@@ -74,11 +61,11 @@ struct usb_host_ss_ep_comp {
74 * descriptor within an active interface in a given USB configuration. 61 * descriptor within an active interface in a given USB configuration.
75 */ 62 */
76struct usb_host_endpoint { 63struct usb_host_endpoint {
77 struct usb_endpoint_descriptor desc; 64 struct usb_endpoint_descriptor desc;
65 struct usb_ss_ep_comp_descriptor ss_ep_comp;
78 struct list_head urb_list; 66 struct list_head urb_list;
79 void *hcpriv; 67 void *hcpriv;
80 struct ep_device *ep_dev; /* For sysfs info */ 68 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
82 69
83 unsigned char *extra; /* Extra descriptors */ 70 unsigned char *extra; /* Extra descriptors */
84 int extralen; 71 int extralen;
@@ -109,8 +96,8 @@ enum usb_interface_condition {
109/** 96/**
110 * struct usb_interface - what usb device drivers talk to 97 * struct usb_interface - what usb device drivers talk to
111 * @altsetting: array of interface structures, one for each alternate 98 * @altsetting: array of interface structures, one for each alternate
112 * setting that may be selected. Each one includes a set of 99 * setting that may be selected. Each one includes a set of
113 * endpoint configurations. They will be in no particular order. 100 * endpoint configurations. They will be in no particular order.
114 * @cur_altsetting: the current altsetting. 101 * @cur_altsetting: the current altsetting.
115 * @num_altsetting: number of altsettings defined. 102 * @num_altsetting: number of altsettings defined.
116 * @intf_assoc: interface association descriptor 103 * @intf_assoc: interface association descriptor
@@ -140,6 +127,8 @@ enum usb_interface_condition {
140 * queued reset so that usb_cancel_queued_reset() doesn't try to 127 * queued reset so that usb_cancel_queued_reset() doesn't try to
141 * remove from the workqueue when running inside the worker 128 * remove from the workqueue when running inside the worker
142 * thread. See __usb_queue_reset_device(). 129 * thread. See __usb_queue_reset_device().
130 * @resetting_device: USB core reset the device, so use alt setting 0 as
131 * current; needs bandwidth alloc after reset.
143 * 132 *
144 * USB device drivers attach to interfaces on a physical device. Each 133 * USB device drivers attach to interfaces on a physical device. Each
145 * interface encapsulates a single high level function, such as feeding 134 * interface encapsulates a single high level function, such as feeding
@@ -197,8 +186,6 @@ struct usb_interface {
197 struct work_struct reset_ws; /* for resets in atomic context */ 186 struct work_struct reset_ws; /* for resets in atomic context */
198}; 187};
199#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 188#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
200#define interface_to_usbdev(intf) \
201 container_of(intf->dev.parent, struct usb_device, dev)
202 189
203static inline void *usb_get_intfdata(struct usb_interface *intf) 190static inline void *usb_get_intfdata(struct usb_interface *intf)
204{ 191{
@@ -215,7 +202,7 @@ void usb_put_intf(struct usb_interface *intf);
215 202
216/* this maximum is arbitrary */ 203/* this maximum is arbitrary */
217#define USB_MAXINTERFACES 32 204#define USB_MAXINTERFACES 32
218#define USB_MAXIADS USB_MAXINTERFACES/2 205#define USB_MAXIADS (USB_MAXINTERFACES/2)
219 206
220/** 207/**
221 * struct usb_interface_cache - long-term representation of a device interface 208 * struct usb_interface_cache - long-term representation of a device interface
@@ -425,7 +412,6 @@ struct usb_tt;
425 * @connect_time: time device was first connected 412 * @connect_time: time device was first connected
426 * @do_remote_wakeup: remote wakeup should be enabled 413 * @do_remote_wakeup: remote wakeup should be enabled
427 * @reset_resume: needs reset instead of resume 414 * @reset_resume: needs reset instead of resume
428 * @autosuspend_disabled: autosuspend disabled by the user
429 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 415 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
430 * specific data for the device. 416 * specific data for the device.
431 * @slot_id: Slot ID assigned by xHCI 417 * @slot_id: Slot ID assigned by xHCI
@@ -436,7 +422,7 @@ struct usb_tt;
436 */ 422 */
437struct usb_device { 423struct usb_device {
438 int devnum; 424 int devnum;
439 char devpath [16]; 425 char devpath[16];
440 u32 route; 426 u32 route;
441 enum usb_device_state state; 427 enum usb_device_state state;
442 enum usb_device_speed speed; 428 enum usb_device_speed speed;
@@ -469,7 +455,7 @@ struct usb_device {
469 unsigned persist_enabled:1; 455 unsigned persist_enabled:1;
470 unsigned have_langid:1; 456 unsigned have_langid:1;
471 unsigned authorized:1; 457 unsigned authorized:1;
472 unsigned authenticated:1; 458 unsigned authenticated:1;
473 unsigned wusb:1; 459 unsigned wusb:1;
474 int string_langid; 460 int string_langid;
475 461
@@ -501,13 +487,17 @@ struct usb_device {
501 487
502 unsigned do_remote_wakeup:1; 488 unsigned do_remote_wakeup:1;
503 unsigned reset_resume:1; 489 unsigned reset_resume:1;
504 unsigned autosuspend_disabled:1;
505#endif 490#endif
506 struct wusb_dev *wusb_dev; 491 struct wusb_dev *wusb_dev;
507 int slot_id; 492 int slot_id;
508}; 493};
509#define to_usb_device(d) container_of(d, struct usb_device, dev) 494#define to_usb_device(d) container_of(d, struct usb_device, dev)
510 495
496static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
497{
498 return to_usb_device(intf->dev.parent);
499}
500
511extern struct usb_device *usb_get_dev(struct usb_device *dev); 501extern struct usb_device *usb_get_dev(struct usb_device *dev);
512extern void usb_put_dev(struct usb_device *dev); 502extern void usb_put_dev(struct usb_device *dev);
513 503
@@ -522,12 +512,11 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
522extern int usb_reset_device(struct usb_device *dev); 512extern int usb_reset_device(struct usb_device *dev);
523extern void usb_queue_reset_device(struct usb_interface *dev); 513extern void usb_queue_reset_device(struct usb_interface *dev);
524 514
525extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
526 515
527/* USB autosuspend and autoresume */ 516/* USB autosuspend and autoresume */
528#ifdef CONFIG_USB_SUSPEND 517#ifdef CONFIG_USB_SUSPEND
529extern int usb_enable_autosuspend(struct usb_device *udev); 518extern void usb_enable_autosuspend(struct usb_device *udev);
530extern int usb_disable_autosuspend(struct usb_device *udev); 519extern void usb_disable_autosuspend(struct usb_device *udev);
531 520
532extern int usb_autopm_get_interface(struct usb_interface *intf); 521extern int usb_autopm_get_interface(struct usb_interface *intf);
533extern void usb_autopm_put_interface(struct usb_interface *intf); 522extern void usb_autopm_put_interface(struct usb_interface *intf);
@@ -572,6 +561,16 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
572/* for drivers using iso endpoints */ 561/* for drivers using iso endpoints */
573extern int usb_get_current_frame_number(struct usb_device *usb_dev); 562extern int usb_get_current_frame_number(struct usb_device *usb_dev);
574 563
564/* Sets up a group of bulk endpoints to support multiple stream IDs. */
565extern int usb_alloc_streams(struct usb_interface *interface,
566 struct usb_host_endpoint **eps, unsigned int num_eps,
567 unsigned int num_streams, gfp_t mem_flags);
568
569/* Reverts a group of bulk endpoints back to not using stream IDs. */
570extern void usb_free_streams(struct usb_interface *interface,
571 struct usb_host_endpoint **eps, unsigned int num_eps,
572 gfp_t mem_flags);
573
575/* used these for multi-interface device registration */ 574/* used these for multi-interface device registration */
576extern int usb_driver_claim_interface(struct usb_driver *driver, 575extern int usb_driver_claim_interface(struct usb_driver *driver,
577 struct usb_interface *iface, void *priv); 576 struct usb_interface *iface, void *priv);
@@ -667,7 +666,7 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
667 * This macro is used to create a struct usb_device_id that matches a 666 * This macro is used to create a struct usb_device_id that matches a
668 * specific device. 667 * specific device.
669 */ 668 */
670#define USB_DEVICE(vend,prod) \ 669#define USB_DEVICE(vend, prod) \
671 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ 670 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
672 .idVendor = (vend), \ 671 .idVendor = (vend), \
673 .idProduct = (prod) 672 .idProduct = (prod)
@@ -846,7 +845,7 @@ struct usb_driver {
846 845
847 void (*disconnect) (struct usb_interface *intf); 846 void (*disconnect) (struct usb_interface *intf);
848 847
849 int (*ioctl) (struct usb_interface *intf, unsigned int code, 848 int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code,
850 void *buf); 849 void *buf);
851 850
852 int (*suspend) (struct usb_interface *intf, pm_message_t message); 851 int (*suspend) (struct usb_interface *intf, pm_message_t message);
@@ -958,17 +957,25 @@ extern int usb_disabled(void);
958#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 957#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
959 * ignored */ 958 * ignored */
960#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 959#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
961#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
962#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 960#define URB_NO_FSBR 0x0020 /* UHCI-specific */
963#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ 961#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
964#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt 962#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
965 * needed */ 963 * needed */
966#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 964#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
967 965
966/* The following flags are used internally by usbcore and HCDs */
968#define URB_DIR_IN 0x0200 /* Transfer from device to host */ 967#define URB_DIR_IN 0x0200 /* Transfer from device to host */
969#define URB_DIR_OUT 0 968#define URB_DIR_OUT 0
970#define URB_DIR_MASK URB_DIR_IN 969#define URB_DIR_MASK URB_DIR_IN
971 970
971#define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */
972#define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */
973#define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */
974#define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */
975#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
976#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
977#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
978
972struct usb_iso_packet_descriptor { 979struct usb_iso_packet_descriptor {
973 unsigned int offset; 980 unsigned int offset;
974 unsigned int length; /* expected length */ 981 unsigned int length; /* expected length */
@@ -1010,6 +1017,7 @@ typedef void (*usb_complete_t)(struct urb *);
1010 * is a different endpoint (and pipe) from "out" endpoint two. 1017 * is a different endpoint (and pipe) from "out" endpoint two.
1011 * The current configuration controls the existence, type, and 1018 * The current configuration controls the existence, type, and
1012 * maximum packet size of any given endpoint. 1019 * maximum packet size of any given endpoint.
1020 * @stream_id: the endpoint's stream ID for bulk streams
1013 * @dev: Identifies the USB device to perform the request. 1021 * @dev: Identifies the USB device to perform the request.
1014 * @status: This is read in non-iso completion functions to get the 1022 * @status: This is read in non-iso completion functions to get the
1015 * status of the particular request. ISO requests only use it 1023 * status of the particular request. ISO requests only use it
@@ -1045,12 +1053,8 @@ typedef void (*usb_complete_t)(struct urb *);
1045 * @setup_packet: Only used for control transfers, this points to eight bytes 1053 * @setup_packet: Only used for control transfers, this points to eight bytes
1046 * of setup data. Control transfers always start by sending this data 1054 * of setup data. Control transfers always start by sending this data
1047 * to the device. Then transfer_buffer is read or written, if needed. 1055 * to the device. Then transfer_buffer is read or written, if needed.
1048 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1056 * @setup_dma: DMA pointer for the setup packet. The caller must not use
1049 * device driver has provided this DMA address for the setup packet. 1057 * this field; setup_packet must point to a valid buffer.
1050 * The host controller driver should use this in preference to
1051 * setup_packet, but the HCD may chose to ignore the address if it must
1052 * copy the setup packet into internal structures. Therefore, setup_packet
1053 * must always point to a valid buffer.
1054 * @start_frame: Returns the initial frame for isochronous transfers. 1058 * @start_frame: Returns the initial frame for isochronous transfers.
1055 * @number_of_packets: Lists the number of ISO transfer buffers. 1059 * @number_of_packets: Lists the number of ISO transfer buffers.
1056 * @interval: Specifies the polling interval for interrupt or isochronous 1060 * @interval: Specifies the polling interval for interrupt or isochronous
@@ -1082,13 +1086,14 @@ typedef void (*usb_complete_t)(struct urb *);
1082 * bounce buffer or talking to an IOMMU), 1086 * bounce buffer or talking to an IOMMU),
1083 * although they're cheap on commodity x86 and ppc hardware. 1087 * although they're cheap on commodity x86 and ppc hardware.
1084 * 1088 *
1085 * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, 1089 * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag,
1086 * which tell the host controller driver that no such mapping is needed since 1090 * which tells the host controller driver that no such mapping is needed for
1091 * the transfer_buffer since
1087 * the device driver is DMA-aware. For example, a device driver might 1092 * the device driver is DMA-aware. For example, a device driver might
1088 * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map(). 1093 * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map().
1089 * When these transfer flags are provided, host controller drivers will 1094 * When this transfer flag is provided, host controller drivers will
1090 * attempt to use the dma addresses found in the transfer_dma and/or 1095 * attempt to use the dma address found in the transfer_dma
1091 * setup_dma fields rather than determining a dma address themselves. 1096 * field rather than determining a dma address themselves.
1092 * 1097 *
1093 * Note that transfer_buffer must still be set if the controller 1098 * Note that transfer_buffer must still be set if the controller
1094 * does not support DMA (as indicated by bus.uses_dma) and when talking 1099 * does not support DMA (as indicated by bus.uses_dma) and when talking
@@ -1111,11 +1116,9 @@ typedef void (*usb_complete_t)(struct urb *);
1111 * should always terminate with a short packet, even if it means adding an 1116 * should always terminate with a short packet, even if it means adding an
1112 * extra zero length packet. 1117 * extra zero length packet.
1113 * 1118 *
1114 * Control URBs must provide a setup_packet. The setup_packet and 1119 * Control URBs must provide a valid pointer in the setup_packet field.
1115 * transfer_buffer may each be mapped for DMA or not, independently of 1120 * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA
1116 * the other. The transfer_flags bits URB_NO_TRANSFER_DMA_MAP and 1121 * beforehand.
1117 * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped.
1118 * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs.
1119 * 1122 *
1120 * Interrupt URBs must provide an interval, saying how often (in milliseconds 1123 * Interrupt URBs must provide an interval, saying how often (in milliseconds
1121 * or, for highspeed devices, 125 microsecond units) 1124 * or, for highspeed devices, 125 microsecond units)
@@ -1186,14 +1189,15 @@ struct urb {
1186 * current owner */ 1189 * current owner */
1187 struct list_head anchor_list; /* the URB may be anchored */ 1190 struct list_head anchor_list; /* the URB may be anchored */
1188 struct usb_anchor *anchor; 1191 struct usb_anchor *anchor;
1189 struct usb_device *dev; /* (in) pointer to associated device */ 1192 struct usb_device *dev; /* (in) pointer to associated device */
1190 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ 1193 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
1191 unsigned int pipe; /* (in) pipe information */ 1194 unsigned int pipe; /* (in) pipe information */
1195 unsigned int stream_id; /* (in) stream ID */
1192 int status; /* (return) non-ISO status */ 1196 int status; /* (return) non-ISO status */
1193 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1197 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1194 void *transfer_buffer; /* (in) associated data buffer */ 1198 void *transfer_buffer; /* (in) associated data buffer */
1195 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1199 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1196 struct usb_sg_request *sg; /* (in) scatter gather buffer list */ 1200 struct scatterlist *sg; /* (in) scatter gather buffer list */
1197 int num_sgs; /* (in) number of entries in the sg list */ 1201 int num_sgs; /* (in) number of entries in the sg list */
1198 u32 transfer_buffer_length; /* (in) data buffer length */ 1202 u32 transfer_buffer_length; /* (in) data buffer length */
1199 u32 actual_length; /* (return) actual transfer length */ 1203 u32 actual_length; /* (return) actual transfer length */
@@ -1371,18 +1375,6 @@ void *usb_alloc_coherent(struct usb_device *dev, size_t size,
1371void usb_free_coherent(struct usb_device *dev, size_t size, 1375void usb_free_coherent(struct usb_device *dev, size_t size,
1372 void *addr, dma_addr_t dma); 1376 void *addr, dma_addr_t dma);
1373 1377
1374/* Compatible macros while we switch over */
1375static inline void *usb_buffer_alloc(struct usb_device *dev, size_t size,
1376 gfp_t mem_flags, dma_addr_t *dma)
1377{
1378 return usb_alloc_coherent(dev, size, mem_flags, dma);
1379}
1380static inline void usb_buffer_free(struct usb_device *dev, size_t size,
1381 void *addr, dma_addr_t dma)
1382{
1383 return usb_free_coherent(dev, size, addr, dma);
1384}
1385
1386#if 0 1378#if 0
1387struct urb *usb_buffer_map(struct urb *urb); 1379struct urb *usb_buffer_map(struct urb *urb);
1388void usb_buffer_dmasync(struct urb *urb); 1380void usb_buffer_dmasync(struct urb *urb);
@@ -1467,8 +1459,6 @@ struct usb_sg_request {
1467 1459
1468 struct usb_device *dev; 1460 struct usb_device *dev;
1469 int pipe; 1461 int pipe;
1470 struct scatterlist *sg;
1471 int nents;
1472 1462
1473 int entries; 1463 int entries;
1474 struct urb **urbs; 1464 struct urb **urbs;
@@ -1536,23 +1526,31 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
1536} 1526}
1537 1527
1538/* Create various pipes... */ 1528/* Create various pipes... */
1539#define usb_sndctrlpipe(dev,endpoint) \ 1529#define usb_sndctrlpipe(dev, endpoint) \
1540 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) 1530 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
1541#define usb_rcvctrlpipe(dev,endpoint) \ 1531#define usb_rcvctrlpipe(dev, endpoint) \
1542 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1532 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1543#define usb_sndisocpipe(dev,endpoint) \ 1533#define usb_sndisocpipe(dev, endpoint) \
1544 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) 1534 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
1545#define usb_rcvisocpipe(dev,endpoint) \ 1535#define usb_rcvisocpipe(dev, endpoint) \
1546 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1536 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1547#define usb_sndbulkpipe(dev,endpoint) \ 1537#define usb_sndbulkpipe(dev, endpoint) \
1548 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) 1538 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
1549#define usb_rcvbulkpipe(dev,endpoint) \ 1539#define usb_rcvbulkpipe(dev, endpoint) \
1550 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1540 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1551#define usb_sndintpipe(dev,endpoint) \ 1541#define usb_sndintpipe(dev, endpoint) \
1552 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) 1542 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
1553#define usb_rcvintpipe(dev,endpoint) \ 1543#define usb_rcvintpipe(dev, endpoint) \
1554 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) 1544 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1555 1545
1546static inline struct usb_host_endpoint *
1547usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
1548{
1549 struct usb_host_endpoint **eps;
1550 eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
1551 return eps[usb_pipeendpoint(pipe)];
1552}
1553
1556/*-------------------------------------------------------------------------*/ 1554/*-------------------------------------------------------------------------*/
1557 1555
1558static inline __u16 1556static inline __u16
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 29fd73b0bffc..51410e0200cf 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,6 +1,7 @@
1header-y += audio.h 1header-y += audio.h
2header-y += cdc.h 2header-y += cdc.h
3header-y += ch9.h 3header-y += ch9.h
4header-y += ch11.h
4header-y += gadgetfs.h 5header-y += gadgetfs.h
5header-y += midi.h 6header-y += midi.h
6header-y += g_printer.h 7header-y += g_printer.h
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index baf41c8616e9..ba99af275a31 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,7 +15,7 @@ struct usba_ep_data {
15 15
16struct usba_platform_data { 16struct usba_platform_data {
17 int vbus_pin; 17 int vbus_pin;
18 int vbus_pin_inverted; 18 int vbus_pin_inverted;
19 int num_ep; 19 int num_ep;
20 struct usba_ep_data ep[0]; 20 struct usba_ep_data ep[0];
21}; 21};
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
new file mode 100644
index 000000000000..964cb603f7c7
--- /dev/null
+++ b/include/linux/usb/audio-v2.h
@@ -0,0 +1,438 @@
1/*
2 * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de>
3 *
4 * This software is distributed under the terms of the GNU General Public
5 * License ("GPL") version 2, as published by the Free Software Foundation.
6 *
7 * This file holds USB constants and structures defined
8 * by the USB Device Class Definition for Audio Devices in version 2.0.
9 * Comments below reference relevant sections of the documents contained
10 * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip
11 */
12
13#ifndef __LINUX_USB_AUDIO_V2_H
14#define __LINUX_USB_AUDIO_V2_H
15
16#include <linux/types.h>
17
18/* v1.0 and v2.0 of this standard have many things in common. For the rest
19 * of the definitions, please refer to audio.h */
20
21/*
22 * bmControl field decoders
23 *
24 * From the USB Audio spec v2.0:
25 *
26 * bmaControls() is a (ch+1)-element array of 4-byte bitmaps,
27 * each containing a set of bit pairs. If a Control is present,
28 * it must be Host readable. If a certain Control is not
29 * present then the bit pair must be set to 0b00.
30 * If a Control is present but read-only, the bit pair must be
31 * set to 0b01. If a Control is also Host programmable, the bit
32 * pair must be set to 0b11. The value 0b10 is not allowed.
33 *
34 */
35
36static inline bool uac2_control_is_readable(u32 bmControls, u8 control)
37{
38 return (bmControls >> (control * 2)) & 0x1;
39}
40
41static inline bool uac2_control_is_writeable(u32 bmControls, u8 control)
42{
43 return (bmControls >> (control * 2)) & 0x2;
44}
45
46/* 4.7.2.1 Clock Source Descriptor */
47
48struct uac_clock_source_descriptor {
49 __u8 bLength;
50 __u8 bDescriptorType;
51 __u8 bDescriptorSubtype;
52 __u8 bClockID;
53 __u8 bmAttributes;
54 __u8 bmControls;
55 __u8 bAssocTerminal;
56 __u8 iClockSource;
57} __attribute__((packed));
58
59/* bmAttribute fields */
60#define UAC_CLOCK_SOURCE_TYPE_EXT 0x0
61#define UAC_CLOCK_SOURCE_TYPE_INT_FIXED 0x1
62#define UAC_CLOCK_SOURCE_TYPE_INT_VAR 0x2
63#define UAC_CLOCK_SOURCE_TYPE_INT_PROG 0x3
64#define UAC_CLOCK_SOURCE_SYNCED_TO_SOF (1 << 2)
65
66/* 4.7.2.2 Clock Source Descriptor */
67
68struct uac_clock_selector_descriptor {
69 __u8 bLength;
70 __u8 bDescriptorType;
71 __u8 bDescriptorSubtype;
72 __u8 bClockID;
73 __u8 bNrInPins;
74 __u8 baCSourceID[];
75 /* bmControls, bAssocTerminal and iClockSource omitted */
76} __attribute__((packed));
77
78/* 4.7.2.3 Clock Multiplier Descriptor */
79
80struct uac_clock_multiplier_descriptor {
81 __u8 bLength;
82 __u8 bDescriptorType;
83 __u8 bDescriptorSubtype;
84 __u8 bClockID;
85 __u8 bCSourceID;
86 __u8 bmControls;
87 __u8 iClockMultiplier;
88} __attribute__((packed));
89
90/* 4.7.2.4 Input terminal descriptor */
91
92struct uac2_input_terminal_descriptor {
93 __u8 bLength;
94 __u8 bDescriptorType;
95 __u8 bDescriptorSubtype;
96 __u8 bTerminalID;
97 __u16 wTerminalType;
98 __u8 bAssocTerminal;
99 __u8 bCSourceID;
100 __u8 bNrChannels;
101 __u32 bmChannelConfig;
102 __u8 iChannelNames;
103 __u16 bmControls;
104 __u8 iTerminal;
105} __attribute__((packed));
106
107/* 4.7.2.5 Output terminal descriptor */
108
109struct uac2_output_terminal_descriptor {
110 __u8 bLength;
111 __u8 bDescriptorType;
112 __u8 bDescriptorSubtype;
113 __u8 bTerminalID;
114 __u16 wTerminalType;
115 __u8 bAssocTerminal;
116 __u8 bSourceID;
117 __u8 bCSourceID;
118 __u16 bmControls;
119 __u8 iTerminal;
120} __attribute__((packed));
121
122
123
124/* 4.7.2.8 Feature Unit Descriptor */
125
126struct uac2_feature_unit_descriptor {
127 __u8 bLength;
128 __u8 bDescriptorType;
129 __u8 bDescriptorSubtype;
130 __u8 bUnitID;
131 __u8 bSourceID;
132 /* bmaControls is actually u32,
133 * but u8 is needed for the hybrid parser */
134 __u8 bmaControls[0]; /* variable length */
135} __attribute__((packed));
136
137/* 4.9.2 Class-Specific AS Interface Descriptor */
138
139struct uac2_as_header_descriptor {
140 __u8 bLength;
141 __u8 bDescriptorType;
142 __u8 bDescriptorSubtype;
143 __u8 bTerminalLink;
144 __u8 bmControls;
145 __u8 bFormatType;
146 __u32 bmFormats;
147 __u8 bNrChannels;
148 __u32 bmChannelConfig;
149 __u8 iChannelNames;
150} __attribute__((packed));
151
152/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */
153
154struct uac2_iso_endpoint_descriptor {
155 __u8 bLength; /* in bytes: 8 */
156 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
157 __u8 bDescriptorSubtype; /* EP_GENERAL */
158 __u8 bmAttributes;
159 __u8 bmControls;
160 __u8 bLockDelayUnits;
161 __le16 wLockDelay;
162} __attribute__((packed));
163
164#define UAC2_CONTROL_PITCH (3 << 0)
165#define UAC2_CONTROL_DATA_OVERRUN (3 << 2)
166#define UAC2_CONTROL_DATA_UNDERRUN (3 << 4)
167
168/* 6.1 Interrupt Data Message */
169
170#define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0)
171#define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1)
172
173struct uac2_interrupt_data_msg {
174 __u8 bInfo;
175 __u8 bAttribute;
176 __le16 wValue;
177 __le16 wIndex;
178} __attribute__((packed));
179
180/* A.7 Audio Function Category Codes */
181#define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00
182#define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01
183#define UAC2_FUNCTION_HOME_THEATER 0x02
184#define UAC2_FUNCTION_MICROPHONE 0x03
185#define UAC2_FUNCTION_HEADSET 0x04
186#define UAC2_FUNCTION_TELEPHONE 0x05
187#define UAC2_FUNCTION_CONVERTER 0x06
188#define UAC2_FUNCTION_SOUND_RECORDER 0x07
189#define UAC2_FUNCTION_IO_BOX 0x08
190#define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09
191#define UAC2_FUNCTION_PRO_AUDIO 0x0a
192#define UAC2_FUNCTION_AUDIO_VIDEO 0x0b
193#define UAC2_FUNCTION_CONTROL_PANEL 0x0c
194#define UAC2_FUNCTION_OTHER 0xff
195
196/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */
197/* see audio.h for the rest, which is identical to v1 */
198#define UAC2_EFFECT_UNIT 0x07
199#define UAC2_PROCESSING_UNIT_V2 0x08
200#define UAC2_EXTENSION_UNIT_V2 0x09
201#define UAC2_CLOCK_SOURCE 0x0a
202#define UAC2_CLOCK_SELECTOR 0x0b
203#define UAC2_CLOCK_MULTIPLIER 0x0c
204#define UAC2_SAMPLE_RATE_CONVERTER 0x0d
205
206/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */
207/* see audio.h for the rest, which is identical to v1 */
208#define UAC2_ENCODER 0x03
209#define UAC2_DECODER 0x04
210
211/* A.11 Effect Unit Effect Types */
212#define UAC2_EFFECT_UNDEFINED 0x00
213#define UAC2_EFFECT_PARAM_EQ 0x01
214#define UAC2_EFFECT_REVERB 0x02
215#define UAC2_EFFECT_MOD_DELAY 0x03
216#define UAC2_EFFECT_DYN_RANGE_COMP 0x04
217
218/* A.12 Processing Unit Process Types */
219#define UAC2_PROCESS_UNDEFINED 0x00
220#define UAC2_PROCESS_UP_DOWNMIX 0x01
221#define UAC2_PROCESS_DOLBY_PROLOCIC 0x02
222#define UAC2_PROCESS_STEREO_EXTENDER 0x03
223
224/* A.14 Audio Class-Specific Request Codes */
225#define UAC2_CS_CUR 0x01
226#define UAC2_CS_RANGE 0x02
227#define UAC2_CS_MEM 0x03
228
229/* A.15 Encoder Type Codes */
230#define UAC2_ENCODER_UNDEFINED 0x00
231#define UAC2_ENCODER_OTHER 0x01
232#define UAC2_ENCODER_MPEG 0x02
233#define UAC2_ENCODER_AC3 0x03
234#define UAC2_ENCODER_WMA 0x04
235#define UAC2_ENCODER_DTS 0x05
236
237/* A.16 Decoder Type Codes */
238#define UAC2_DECODER_UNDEFINED 0x00
239#define UAC2_DECODER_OTHER 0x01
240#define UAC2_DECODER_MPEG 0x02
241#define UAC2_DECODER_AC3 0x03
242#define UAC2_DECODER_WMA 0x04
243#define UAC2_DECODER_DTS 0x05
244
245/* A.17.1 Clock Source Control Selectors */
246#define UAC2_CS_UNDEFINED 0x00
247#define UAC2_CS_CONTROL_SAM_FREQ 0x01
248#define UAC2_CS_CONTROL_CLOCK_VALID 0x02
249
250/* A.17.2 Clock Selector Control Selectors */
251#define UAC2_CX_UNDEFINED 0x00
252#define UAC2_CX_CLOCK_SELECTOR 0x01
253
254/* A.17.3 Clock Multiplier Control Selectors */
255#define UAC2_CM_UNDEFINED 0x00
256#define UAC2_CM_NUMERATOR 0x01
257#define UAC2_CM_DENOMINTATOR 0x02
258
259/* A.17.4 Terminal Control Selectors */
260#define UAC2_TE_UNDEFINED 0x00
261#define UAC2_TE_COPY_PROTECT 0x01
262#define UAC2_TE_CONNECTOR 0x02
263#define UAC2_TE_OVERLOAD 0x03
264#define UAC2_TE_CLUSTER 0x04
265#define UAC2_TE_UNDERFLOW 0x05
266#define UAC2_TE_OVERFLOW 0x06
267#define UAC2_TE_LATENCY 0x07
268
269/* A.17.5 Mixer Control Selectors */
270#define UAC2_MU_UNDEFINED 0x00
271#define UAC2_MU_MIXER 0x01
272#define UAC2_MU_CLUSTER 0x02
273#define UAC2_MU_UNDERFLOW 0x03
274#define UAC2_MU_OVERFLOW 0x04
275#define UAC2_MU_LATENCY 0x05
276
277/* A.17.6 Selector Control Selectors */
278#define UAC2_SU_UNDEFINED 0x00
279#define UAC2_SU_SELECTOR 0x01
280#define UAC2_SU_LATENCY 0x02
281
282/* A.17.7 Feature Unit Control Selectors */
283/* see audio.h for the rest, which is identical to v1 */
284#define UAC2_FU_INPUT_GAIN 0x0b
285#define UAC2_FU_INPUT_GAIN_PAD 0x0c
286#define UAC2_FU_PHASE_INVERTER 0x0d
287#define UAC2_FU_UNDERFLOW 0x0e
288#define UAC2_FU_OVERFLOW 0x0f
289#define UAC2_FU_LATENCY 0x10
290
291/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */
292#define UAC2_PE_UNDEFINED 0x00
293#define UAC2_PE_ENABLE 0x01
294#define UAC2_PE_CENTERFREQ 0x02
295#define UAC2_PE_QFACTOR 0x03
296#define UAC2_PE_GAIN 0x04
297#define UAC2_PE_UNDERFLOW 0x05
298#define UAC2_PE_OVERFLOW 0x06
299#define UAC2_PE_LATENCY 0x07
300
301/* A.17.8.2 Reverberation Effect Unit Control Selectors */
302#define UAC2_RV_UNDEFINED 0x00
303#define UAC2_RV_ENABLE 0x01
304#define UAC2_RV_TYPE 0x02
305#define UAC2_RV_LEVEL 0x03
306#define UAC2_RV_TIME 0x04
307#define UAC2_RV_FEEDBACK 0x05
308#define UAC2_RV_PREDELAY 0x06
309#define UAC2_RV_DENSITY 0x07
310#define UAC2_RV_HIFREQ_ROLLOFF 0x08
311#define UAC2_RV_UNDERFLOW 0x09
312#define UAC2_RV_OVERFLOW 0x0a
313#define UAC2_RV_LATENCY 0x0b
314
315/* A.17.8.3 Modulation Delay Effect Control Selectors */
316#define UAC2_MD_UNDEFINED 0x00
317#define UAC2_MD_ENABLE 0x01
318#define UAC2_MD_BALANCE 0x02
319#define UAC2_MD_RATE 0x03
320#define UAC2_MD_DEPTH 0x04
321#define UAC2_MD_TIME 0x05
322#define UAC2_MD_FEEDBACK 0x06
323#define UAC2_MD_UNDERFLOW 0x07
324#define UAC2_MD_OVERFLOW 0x08
325#define UAC2_MD_LATENCY 0x09
326
327/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */
328#define UAC2_DR_UNDEFINED 0x00
329#define UAC2_DR_ENABLE 0x01
330#define UAC2_DR_COMPRESSION_RATE 0x02
331#define UAC2_DR_MAXAMPL 0x03
332#define UAC2_DR_THRESHOLD 0x04
333#define UAC2_DR_ATTACK_TIME 0x05
334#define UAC2_DR_RELEASE_TIME 0x06
335#define UAC2_DR_UNDEFLOW 0x07
336#define UAC2_DR_OVERFLOW 0x08
337#define UAC2_DR_LATENCY 0x09
338
339/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */
340#define UAC2_UD_UNDEFINED 0x00
341#define UAC2_UD_ENABLE 0x01
342#define UAC2_UD_MODE_SELECT 0x02
343#define UAC2_UD_CLUSTER 0x03
344#define UAC2_UD_UNDERFLOW 0x04
345#define UAC2_UD_OVERFLOW 0x05
346#define UAC2_UD_LATENCY 0x06
347
348/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */
349#define UAC2_DP_UNDEFINED 0x00
350#define UAC2_DP_ENABLE 0x01
351#define UAC2_DP_MODE_SELECT 0x02
352#define UAC2_DP_CLUSTER 0x03
353#define UAC2_DP_UNDERFFLOW 0x04
354#define UAC2_DP_OVERFLOW 0x05
355#define UAC2_DP_LATENCY 0x06
356
357/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */
358#define UAC2_ST_EXT_UNDEFINED 0x00
359#define UAC2_ST_EXT_ENABLE 0x01
360#define UAC2_ST_EXT_WIDTH 0x02
361#define UAC2_ST_EXT_UNDEFLOW 0x03
362#define UAC2_ST_EXT_OVERFLOW 0x04
363#define UAC2_ST_EXT_LATENCY 0x05
364
365/* A.17.10 Extension Unit Control Selectors */
366#define UAC2_XU_UNDEFINED 0x00
367#define UAC2_XU_ENABLE 0x01
368#define UAC2_XU_CLUSTER 0x02
369#define UAC2_XU_UNDERFLOW 0x03
370#define UAC2_XU_OVERFLOW 0x04
371#define UAC2_XU_LATENCY 0x05
372
373/* A.17.11 AudioStreaming Interface Control Selectors */
374#define UAC2_AS_UNDEFINED 0x00
375#define UAC2_AS_ACT_ALT_SETTING 0x01
376#define UAC2_AS_VAL_ALT_SETTINGS 0x02
377#define UAC2_AS_AUDIO_DATA_FORMAT 0x03
378
379/* A.17.12 Encoder Control Selectors */
380#define UAC2_EN_UNDEFINED 0x00
381#define UAC2_EN_BIT_RATE 0x01
382#define UAC2_EN_QUALITY 0x02
383#define UAC2_EN_VBR 0x03
384#define UAC2_EN_TYPE 0x04
385#define UAC2_EN_UNDERFLOW 0x05
386#define UAC2_EN_OVERFLOW 0x06
387#define UAC2_EN_ENCODER_ERROR 0x07
388#define UAC2_EN_PARAM1 0x08
389#define UAC2_EN_PARAM2 0x09
390#define UAC2_EN_PARAM3 0x0a
391#define UAC2_EN_PARAM4 0x0b
392#define UAC2_EN_PARAM5 0x0c
393#define UAC2_EN_PARAM6 0x0d
394#define UAC2_EN_PARAM7 0x0e
395#define UAC2_EN_PARAM8 0x0f
396
397/* A.17.13.1 MPEG Decoder Control Selectors */
398#define UAC2_MPEG_UNDEFINED 0x00
399#define UAC2_MPEG_DUAL_CHANNEL 0x01
400#define UAC2_MPEG_SECOND_STEREO 0x02
401#define UAC2_MPEG_MULTILINGUAL 0x03
402#define UAC2_MPEG_DYN_RANGE 0x04
403#define UAC2_MPEG_SCALING 0x05
404#define UAC2_MPEG_HILO_SCALING 0x06
405#define UAC2_MPEG_UNDERFLOW 0x07
406#define UAC2_MPEG_OVERFLOW 0x08
407#define UAC2_MPEG_DECODER_ERROR 0x09
408
409/* A17.13.2 AC3 Decoder Control Selectors */
410#define UAC2_AC3_UNDEFINED 0x00
411#define UAC2_AC3_MODE 0x01
412#define UAC2_AC3_DYN_RANGE 0x02
413#define UAC2_AC3_SCALING 0x03
414#define UAC2_AC3_HILO_SCALING 0x04
415#define UAC2_AC3_UNDERFLOW 0x05
416#define UAC2_AC3_OVERFLOW 0x06
417#define UAC2_AC3_DECODER_ERROR 0x07
418
419/* A17.13.3 WMA Decoder Control Selectors */
420#define UAC2_WMA_UNDEFINED 0x00
421#define UAC2_WMA_UNDERFLOW 0x01
422#define UAC2_WMA_OVERFLOW 0x02
423#define UAC2_WMA_DECODER_ERROR 0x03
424
425/* A17.13.4 DTS Decoder Control Selectors */
426#define UAC2_DTS_UNDEFINED 0x00
427#define UAC2_DTS_UNDERFLOW 0x01
428#define UAC2_DTS_OVERFLOW 0x02
429#define UAC2_DTS_DECODER_ERROR 0x03
430
431/* A17.14 Endpoint Control Selectors */
432#define UAC2_EP_CS_UNDEFINED 0x00
433#define UAC2_EP_CS_PITCH 0x01
434#define UAC2_EP_CS_DATA_OVERRUN 0x02
435#define UAC2_EP_CS_DATA_UNDERRUN 0x03
436
437#endif /* __LINUX_USB_AUDIO_V2_H */
438
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 4d3e450e2b03..a54b8255d75f 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -13,6 +13,9 @@
13 * Comments below reference relevant sections of that document: 13 * Comments below reference relevant sections of that document:
14 * 14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf 15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
16 */ 19 */
17 20
18#ifndef __LINUX_USB_AUDIO_H 21#ifndef __LINUX_USB_AUDIO_H
@@ -20,14 +23,15 @@
20 23
21#include <linux/types.h> 24#include <linux/types.h>
22 25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
23/* A.2 Audio Interface Subclass Codes */ 30/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 31#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 33#define USB_SUBCLASS_MIDISTREAMING 0x03
27 34
28#define UAC_VERSION_1 0x00
29#define UAC_VERSION_2 0x20
30
31/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ 35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
32#define UAC_HEADER 0x01 36#define UAC_HEADER 0x01
33#define UAC_INPUT_TERMINAL 0x02 37#define UAC_INPUT_TERMINAL 0x02
@@ -35,23 +39,23 @@
35#define UAC_MIXER_UNIT 0x04 39#define UAC_MIXER_UNIT 0x04
36#define UAC_SELECTOR_UNIT 0x05 40#define UAC_SELECTOR_UNIT 0x05
37#define UAC_FEATURE_UNIT 0x06 41#define UAC_FEATURE_UNIT 0x06
38#define UAC_PROCESSING_UNIT_V1 0x07 42#define UAC1_PROCESSING_UNIT 0x07
39#define UAC_EXTENSION_UNIT_V1 0x08 43#define UAC1_EXTENSION_UNIT 0x08
40
41/* UAC v2.0 types */
42#define UAC_EFFECT_UNIT 0x07
43#define UAC_PROCESSING_UNIT_V2 0x08
44#define UAC_EXTENSION_UNIT_V2 0x09
45#define UAC_CLOCK_SOURCE 0x0a
46#define UAC_CLOCK_SELECTOR 0x0b
47#define UAC_CLOCK_MULTIPLIER 0x0c
48#define UAC_SAMPLE_RATE_CONVERTER 0x0d
49 44
50/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
51#define UAC_AS_GENERAL 0x01 46#define UAC_AS_GENERAL 0x01
52#define UAC_FORMAT_TYPE 0x02 47#define UAC_FORMAT_TYPE 0x02
53#define UAC_FORMAT_SPECIFIC 0x03 48#define UAC_FORMAT_SPECIFIC 0x03
54 49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
55/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ 59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
56#define UAC_EP_GENERAL 0x01 60#define UAC_EP_GENERAL 0x01
57 61
@@ -78,9 +82,59 @@
78 82
79#define UAC_GET_STAT 0xff 83#define UAC_GET_STAT 0xff
80 84
81/* Audio class v2.0 handles all the parameter calls differently */ 85/* A.10 Control Selector Codes */
82#define UAC2_CS_CUR 0x01 86
83#define UAC2_CS_RANGE 0x02 87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
84 138
85/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ 139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
86#define UAC_MS_HEADER 0x01 140#define UAC_MS_HEADER 0x01
@@ -97,7 +151,7 @@
97 151
98/* Terminal Control Selectors */ 152/* Terminal Control Selectors */
99/* 4.3.2 Class-Specific AC Interface Descriptor */ 153/* 4.3.2 Class-Specific AC Interface Descriptor */
100struct uac_ac_header_descriptor_v1 { 154struct uac1_ac_header_descriptor {
101 __u8 bLength; /* 8 + n */ 155 __u8 bLength; /* 8 + n */
102 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
103 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ 157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
@@ -110,8 +164,8 @@ struct uac_ac_header_descriptor_v1 {
110#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) 164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
111 165
112/* As above, but more useful for defining your own descriptors: */ 166/* As above, but more useful for defining your own descriptors: */
113#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
114struct uac_ac_header_descriptor_v1_##n { \ 168struct uac1_ac_header_descriptor_##n { \
115 __u8 bLength; \ 169 __u8 bLength; \
116 __u8 bDescriptorType; \ 170 __u8 bDescriptorType; \
117 __u8 bDescriptorSubtype; \ 171 __u8 bDescriptorSubtype; \
@@ -151,7 +205,7 @@ struct uac_input_terminal_descriptor {
151#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
152 206
153/* 4.3.2.2 Output Terminal Descriptor */ 207/* 4.3.2.2 Output Terminal Descriptor */
154struct uac_output_terminal_descriptor_v1 { 208struct uac1_output_terminal_descriptor {
155 __u8 bLength; /* in bytes: 9 */ 209 __u8 bLength; /* in bytes: 9 */
156 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
157 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -178,7 +232,7 @@ struct uac_output_terminal_descriptor_v1 {
178#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) 232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
179 233
180/* As above, but more useful for defining your own descriptors: */ 234/* As above, but more useful for defining your own descriptors: */
181#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ 235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
182struct uac_feature_unit_descriptor_##ch { \ 236struct uac_feature_unit_descriptor_##ch { \
183 __u8 bLength; \ 237 __u8 bLength; \
184 __u8 bDescriptorType; \ 238 __u8 bDescriptorType; \
@@ -190,8 +244,158 @@ struct uac_feature_unit_descriptor_##ch { \
190 __u8 iFeature; \ 244 __u8 iFeature; \
191} __attribute__ ((packed)) 245} __attribute__ ((packed))
192 246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
193/* 4.5.2 Class-Specific AS Interface Descriptor */ 397/* 4.5.2 Class-Specific AS Interface Descriptor */
194struct uac_as_header_descriptor_v1 { 398struct uac1_as_header_descriptor {
195 __u8 bLength; /* in bytes: 7 */ 399 __u8 bLength; /* in bytes: 7 */
196 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
197 __u8 bDescriptorSubtype; /* AS_GENERAL */ 401 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -200,19 +404,6 @@ struct uac_as_header_descriptor_v1 {
200 __le16 wFormatTag; /* The Audio Data Format */ 404 __le16 wFormatTag; /* The Audio Data Format */
201} __attribute__ ((packed)); 405} __attribute__ ((packed));
202 406
203struct uac_as_header_descriptor_v2 {
204 __u8 bLength;
205 __u8 bDescriptorType;
206 __u8 bDescriptorSubtype;
207 __u8 bTerminalLink;
208 __u8 bmControls;
209 __u8 bFormatType;
210 __u32 bmFormats;
211 __u8 bNrChannels;
212 __u32 bmChannelConfig;
213 __u8 iChannelNames;
214} __attribute__((packed));
215
216#define UAC_DT_AS_HEADER_SIZE 7 407#define UAC_DT_AS_HEADER_SIZE 7
217 408
218/* Formats - A.1.1 Audio Data Format Type I Codes */ 409/* Formats - A.1.1 Audio Data Format Type I Codes */
@@ -250,7 +441,7 @@ struct uac_format_type_i_discrete_descriptor {
250 __u8 tSamFreq[][3]; 441 __u8 tSamFreq[][3];
251} __attribute__ ((packed)); 442} __attribute__ ((packed));
252 443
253#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ 444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
254struct uac_format_type_i_discrete_descriptor_##n { \ 445struct uac_format_type_i_discrete_descriptor_##n { \
255 __u8 bLength; \ 446 __u8 bLength; \
256 __u8 bDescriptorType; \ 447 __u8 bDescriptorType; \
@@ -277,7 +468,6 @@ struct uac_format_type_i_ext_descriptor {
277 __u8 bSideBandProtocol; 468 __u8 bSideBandProtocol;
278} __attribute__((packed)); 469} __attribute__((packed));
279 470
280
281/* Formats - Audio Data Format Type I Codes */ 471/* Formats - Audio Data Format Type I Codes */
282 472
283#define UAC_FORMAT_TYPE_II_MPEG 0x1001 473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
@@ -329,61 +519,28 @@ struct uac_iso_endpoint_descriptor {
329 __u8 bmAttributes; 519 __u8 bmAttributes;
330 __u8 bLockDelayUnits; 520 __u8 bLockDelayUnits;
331 __le16 wLockDelay; 521 __le16 wLockDelay;
332}; 522} __attribute__((packed));
333#define UAC_ISO_ENDPOINT_DESC_SIZE 7 523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
334 524
335#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
336#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
337#define UAC_EP_CS_ATTR_FILL_MAX 0x80 527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
338 528
339/* Audio class v2.0: CLOCK_SOURCE descriptor */ 529/* status word format (3.7.1.1) */
340 530
341struct uac_clock_source_descriptor { 531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
342 __u8 bLength; 532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
343 __u8 bDescriptorType; 533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
344 __u8 bDescriptorSubtype; 534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
345 __u8 bClockID;
346 __u8 bmAttributes;
347 __u8 bmControls;
348 __u8 bAssocTerminal;
349 __u8 iClockSource;
350} __attribute__((packed));
351 535
352/* A.10.2 Feature Unit Control Selectors */ 536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
353 538
354struct uac_feature_unit_descriptor { 539struct uac1_status_word {
355 __u8 bLength; 540 __u8 bStatusType;
356 __u8 bDescriptorType; 541 __u8 bOriginator;
357 __u8 bDescriptorSubtype;
358 __u8 bUnitID;
359 __u8 bSourceID;
360 __u8 bControlSize;
361 __u8 controls[0]; /* variable length */
362} __attribute__((packed)); 542} __attribute__((packed));
363 543
364#define UAC_FU_CONTROL_UNDEFINED 0x00
365#define UAC_MUTE_CONTROL 0x01
366#define UAC_VOLUME_CONTROL 0x02
367#define UAC_BASS_CONTROL 0x03
368#define UAC_MID_CONTROL 0x04
369#define UAC_TREBLE_CONTROL 0x05
370#define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06
371#define UAC_AUTOMATIC_GAIN_CONTROL 0x07
372#define UAC_DELAY_CONTROL 0x08
373#define UAC_BASS_BOOST_CONTROL 0x09
374#define UAC_LOUDNESS_CONTROL 0x0a
375
376#define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1))
377#define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1))
378#define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1))
379#define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1))
380#define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1))
381#define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1))
382#define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1))
383#define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1))
384#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))
385#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1))
386
387#ifdef __KERNEL__ 544#ifdef __KERNEL__
388 545
389struct usb_audio_control { 546struct usb_audio_control {
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index c24124a42ce5..c117a68d04a7 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -18,6 +18,7 @@
18#define USB_CDC_SUBCLASS_MDLM 0x0a 18#define USB_CDC_SUBCLASS_MDLM 0x0a
19#define USB_CDC_SUBCLASS_OBEX 0x0b 19#define USB_CDC_SUBCLASS_OBEX 0x0b
20#define USB_CDC_SUBCLASS_EEM 0x0c 20#define USB_CDC_SUBCLASS_EEM 0x0c
21#define USB_CDC_SUBCLASS_NCM 0x0d
21 22
22#define USB_CDC_PROTO_NONE 0 23#define USB_CDC_PROTO_NONE 0
23 24
@@ -49,6 +50,7 @@
49#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ 50#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
50#define USB_CDC_DMM_TYPE 0x14 51#define USB_CDC_DMM_TYPE 0x14
51#define USB_CDC_OBEX_TYPE 0x15 52#define USB_CDC_OBEX_TYPE 0x15
53#define USB_CDC_NCM_TYPE 0x1a
52 54
53/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 55/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
54struct usb_cdc_header_desc { 56struct usb_cdc_header_desc {
@@ -174,6 +176,15 @@ struct usb_cdc_obex_desc {
174 __le16 bcdVersion; 176 __le16 bcdVersion;
175} __attribute__ ((packed)); 177} __attribute__ ((packed));
176 178
179/* "NCM Control Model Functional Descriptor" */
180struct usb_cdc_ncm_desc {
181 __u8 bLength;
182 __u8 bDescriptorType;
183 __u8 bDescriptorSubType;
184
185 __le16 bcdNcmVersion;
186 __u8 bmNetworkCapabilities;
187} __attribute__ ((packed));
177/*-------------------------------------------------------------------------*/ 188/*-------------------------------------------------------------------------*/
178 189
179/* 190/*
@@ -197,6 +208,17 @@ struct usb_cdc_obex_desc {
197#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 208#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
198#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 209#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
199#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 210#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
211#define USB_CDC_GET_NTB_PARAMETERS 0x80
212#define USB_CDC_GET_NET_ADDRESS 0x81
213#define USB_CDC_SET_NET_ADDRESS 0x82
214#define USB_CDC_GET_NTB_FORMAT 0x83
215#define USB_CDC_SET_NTB_FORMAT 0x84
216#define USB_CDC_GET_NTB_INPUT_SIZE 0x85
217#define USB_CDC_SET_NTB_INPUT_SIZE 0x86
218#define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87
219#define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88
220#define USB_CDC_GET_CRC_MODE 0x89
221#define USB_CDC_SET_CRC_MODE 0x8a
200 222
201/* Line Coding Structure from CDC spec 6.2.13 */ 223/* Line Coding Structure from CDC spec 6.2.13 */
202struct usb_cdc_line_coding { 224struct usb_cdc_line_coding {
@@ -247,4 +269,76 @@ struct usb_cdc_notification {
247 __le16 wLength; 269 __le16 wLength;
248} __attribute__ ((packed)); 270} __attribute__ ((packed));
249 271
272/*-------------------------------------------------------------------------*/
273
274/*
275 * Class Specific structures and constants
276 *
277 * CDC NCM parameter structure, CDC NCM subclass 6.2.1
278 *
279 */
280
281struct usb_cdc_ncm_ntb_parameter {
282 __le16 wLength;
283 __le16 bmNtbFormatSupported;
284 __le32 dwNtbInMaxSize;
285 __le16 wNdpInDivisor;
286 __le16 wNdpInPayloadRemainder;
287 __le16 wNdpInAlignment;
288 __le16 wPadding1;
289 __le32 dwNtbOutMaxSize;
290 __le16 wNdpOutDivisor;
291 __le16 wNdpOutPayloadRemainder;
292 __le16 wNdpOutAlignment;
293 __le16 wPadding2;
294} __attribute__ ((packed));
295
296/*
297 * CDC NCM transfer headers, CDC NCM subclass 3.2
298 */
299
300#define NCM_NTH16_SIGN 0x484D434E /* NCMH */
301#define NCM_NTH32_SIGN 0x686D636E /* ncmh */
302
303struct usb_cdc_ncm_nth16 {
304 __le32 dwSignature;
305 __le16 wHeaderLength;
306 __le16 wSequence;
307 __le16 wBlockLength;
308 __le16 wFpIndex;
309} __attribute__ ((packed));
310
311struct usb_cdc_ncm_nth32 {
312 __le32 dwSignature;
313 __le16 wHeaderLength;
314 __le16 wSequence;
315 __le32 dwBlockLength;
316 __le32 dwFpIndex;
317} __attribute__ ((packed));
318
319/*
320 * CDC NCM datagram pointers, CDC NCM subclass 3.3
321 */
322
323#define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
324#define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
325#define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327
328struct usb_cdc_ncm_ndp16 {
329 __le32 dwSignature;
330 __le16 wLength;
331 __le16 wNextFpIndex;
332 __u8 data[0];
333} __attribute__ ((packed));
334
335struct usb_cdc_ncm_ndp32 {
336 __le32 dwSignature;
337 __le16 wLength;
338 __le16 wReserved6;
339 __le32 dwNextFpIndex;
340 __le32 dwReserved12;
341 __u8 data[0];
342} __attribute__ ((packed));
343
250#endif /* __LINUX_USB_CDC_H */ 344#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
new file mode 100644
index 000000000000..119194c85d10
--- /dev/null
+++ b/include/linux/usb/ch11.h
@@ -0,0 +1,167 @@
1/*
2 * This file holds Hub protocol constants and data structures that are
3 * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
4 *
5 * It is used/shared between the USB core, the HCDs and couple of other USB
6 * drivers.
7 */
8
9#ifndef __LINUX_CH11_H
10#define __LINUX_CH11_H
11
12#include <linux/types.h> /* __u8 etc */
13
14/*
15 * Hub request types
16 */
17
18#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
19#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
20
21/*
22 * Hub class requests
23 * See USB 2.0 spec Table 11-16
24 */
25#define HUB_CLEAR_TT_BUFFER 8
26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11
29
30/*
31 * Hub Class feature numbers
32 * See USB 2.0 spec Table 11-17
33 */
34#define C_HUB_LOCAL_POWER 0
35#define C_HUB_OVER_CURRENT 1
36
37/*
38 * Port feature numbers
39 * See USB 2.0 spec Table 11-17
40 */
41#define USB_PORT_FEAT_CONNECTION 0
42#define USB_PORT_FEAT_ENABLE 1
43#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
44#define USB_PORT_FEAT_OVER_CURRENT 3
45#define USB_PORT_FEAT_RESET 4
46#define USB_PORT_FEAT_L1 5 /* L1 suspend */
47#define USB_PORT_FEAT_POWER 8
48#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
49#define USB_PORT_FEAT_C_CONNECTION 16
50#define USB_PORT_FEAT_C_ENABLE 17
51#define USB_PORT_FEAT_C_SUSPEND 18
52#define USB_PORT_FEAT_C_OVER_CURRENT 19
53#define USB_PORT_FEAT_C_RESET 20
54#define USB_PORT_FEAT_TEST 21
55#define USB_PORT_FEAT_INDICATOR 22
56#define USB_PORT_FEAT_C_PORT_L1 23
57
58/*
59 * Hub Status and Hub Change results
60 * See USB 2.0 spec Table 11-19 and Table 11-20
61 */
62struct usb_port_status {
63 __le16 wPortStatus;
64 __le16 wPortChange;
65} __attribute__ ((packed));
66
67/*
68 * wPortStatus bit field
69 * See USB 2.0 spec Table 11-21
70 */
71#define USB_PORT_STAT_CONNECTION 0x0001
72#define USB_PORT_STAT_ENABLE 0x0002
73#define USB_PORT_STAT_SUSPEND 0x0004
74#define USB_PORT_STAT_OVERCURRENT 0x0008
75#define USB_PORT_STAT_RESET 0x0010
76#define USB_PORT_STAT_L1 0x0020
77/* bits 6 to 7 are reserved */
78#define USB_PORT_STAT_POWER 0x0100
79#define USB_PORT_STAT_LOW_SPEED 0x0200
80#define USB_PORT_STAT_HIGH_SPEED 0x0400
81#define USB_PORT_STAT_TEST 0x0800
82#define USB_PORT_STAT_INDICATOR 0x1000
83/* bits 13 to 15 are reserved */
84#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
85
86/*
87 * wPortChange bit field
88 * See USB 2.0 spec Table 11-22
89 * Bits 0 to 4 shown, bits 5 to 15 are reserved
90 */
91#define USB_PORT_STAT_C_CONNECTION 0x0001
92#define USB_PORT_STAT_C_ENABLE 0x0002
93#define USB_PORT_STAT_C_SUSPEND 0x0004
94#define USB_PORT_STAT_C_OVERCURRENT 0x0008
95#define USB_PORT_STAT_C_RESET 0x0010
96#define USB_PORT_STAT_C_L1 0x0020
97
98/*
99 * wHubCharacteristics (masks)
100 * See USB 2.0 spec Table 11-13, offset 3
101 */
102#define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */
103#define HUB_CHAR_COMPOUND 0x0004 /* D2 */
104#define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */
105#define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */
106#define HUB_CHAR_PORTIND 0x0080 /* D7 */
107
108struct usb_hub_status {
109 __le16 wHubStatus;
110 __le16 wHubChange;
111} __attribute__ ((packed));
112
113/*
114 * Hub Status & Hub Change bit masks
115 * See USB 2.0 spec Table 11-19 and Table 11-20
116 * Bits 0 and 1 for wHubStatus and wHubChange
117 * Bits 2 to 15 are reserved for both
118 */
119#define HUB_STATUS_LOCAL_POWER 0x0001
120#define HUB_STATUS_OVERCURRENT 0x0002
121#define HUB_CHANGE_LOCAL_POWER 0x0001
122#define HUB_CHANGE_OVERCURRENT 0x0002
123
124
125/*
126 * Hub descriptor
127 * See USB 2.0 spec Table 11-13
128 */
129
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
131#define USB_DT_HUB_NONVAR_SIZE 7
132
133struct usb_hub_descriptor {
134 __u8 bDescLength;
135 __u8 bDescriptorType;
136 __u8 bNbrPorts;
137 __le16 wHubCharacteristics;
138 __u8 bPwrOn2PwrGood;
139 __u8 bHubContrCurrent;
140 /* add 1 bit for hub status change; round to bytes */
141 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
142 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
143} __attribute__ ((packed));
144
145
146/* port indicator status selectors, tables 11-7 and 11-25 */
147#define HUB_LED_AUTO 0
148#define HUB_LED_AMBER 1
149#define HUB_LED_GREEN 2
150#define HUB_LED_OFF 3
151
152enum hub_led_mode {
153 INDICATOR_AUTO = 0,
154 INDICATOR_CYCLE,
155 /* software blinks for attention: software, hardware, reserved */
156 INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
157 INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
158 INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
159} __attribute__ ((packed));
160
161/* Transaction Translator Think Times, in bits */
162#define HUB_TTTT_8_BITS 0x00
163#define HUB_TTTT_16_BITS 0x20
164#define HUB_TTTT_24_BITS 0x40
165#define HUB_TTTT_32_BITS 0x60
166
167#endif /* __LINUX_CH11_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index e58369ff8168..da2ed77d3e8d 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the T10 UAS specification */
195#define USB_DT_PIPE_USAGE 0x24
194/* From the USB 3.0 spec */ 196/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30 197#define USB_DT_SS_ENDPOINT_COMP 0x30
196 198
@@ -475,7 +477,7 @@ static inline int usb_endpoint_xfer_isoc(
475static inline int usb_endpoint_is_bulk_in( 477static inline int usb_endpoint_is_bulk_in(
476 const struct usb_endpoint_descriptor *epd) 478 const struct usb_endpoint_descriptor *epd)
477{ 479{
478 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 480 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
479} 481}
480 482
481/** 483/**
@@ -488,7 +490,7 @@ static inline int usb_endpoint_is_bulk_in(
488static inline int usb_endpoint_is_bulk_out( 490static inline int usb_endpoint_is_bulk_out(
489 const struct usb_endpoint_descriptor *epd) 491 const struct usb_endpoint_descriptor *epd)
490{ 492{
491 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 493 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
492} 494}
493 495
494/** 496/**
@@ -501,7 +503,7 @@ static inline int usb_endpoint_is_bulk_out(
501static inline int usb_endpoint_is_int_in( 503static inline int usb_endpoint_is_int_in(
502 const struct usb_endpoint_descriptor *epd) 504 const struct usb_endpoint_descriptor *epd)
503{ 505{
504 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 506 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
505} 507}
506 508
507/** 509/**
@@ -514,7 +516,7 @@ static inline int usb_endpoint_is_int_in(
514static inline int usb_endpoint_is_int_out( 516static inline int usb_endpoint_is_int_out(
515 const struct usb_endpoint_descriptor *epd) 517 const struct usb_endpoint_descriptor *epd)
516{ 518{
517 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 519 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
518} 520}
519 521
520/** 522/**
@@ -527,7 +529,7 @@ static inline int usb_endpoint_is_int_out(
527static inline int usb_endpoint_is_isoc_in( 529static inline int usb_endpoint_is_isoc_in(
528 const struct usb_endpoint_descriptor *epd) 530 const struct usb_endpoint_descriptor *epd)
529{ 531{
530 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 532 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
531} 533}
532 534
533/** 535/**
@@ -540,7 +542,7 @@ static inline int usb_endpoint_is_isoc_in(
540static inline int usb_endpoint_is_isoc_out( 542static inline int usb_endpoint_is_isoc_out(
541 const struct usb_endpoint_descriptor *epd) 543 const struct usb_endpoint_descriptor *epd)
542{ 544{
543 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 545 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
544} 546}
545 547
546/*-------------------------------------------------------------------------*/ 548/*-------------------------------------------------------------------------*/
@@ -556,6 +558,8 @@ struct usb_ss_ep_comp_descriptor {
556} __attribute__ ((packed)); 558} __attribute__ ((packed));
557 559
558#define USB_DT_SS_EP_COMP_SIZE 6 560#define USB_DT_SS_EP_COMP_SIZE 6
561/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
562#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f))
559 563
560/*-------------------------------------------------------------------------*/ 564/*-------------------------------------------------------------------------*/
561 565
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 738ea1a691cb..890bc1472190 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -276,6 +276,8 @@ struct usb_composite_driver {
276 int (*bind)(struct usb_composite_dev *); 276 int (*bind)(struct usb_composite_dev *);
277 int (*unbind)(struct usb_composite_dev *); 277 int (*unbind)(struct usb_composite_dev *);
278 278
279 void (*disconnect)(struct usb_composite_dev *);
280
279 /* global suspend hooks */ 281 /* global suspend hooks */
280 void (*suspend)(struct usb_composite_dev *); 282 void (*suspend)(struct usb_composite_dev *);
281 void (*resume)(struct usb_composite_dev *); 283 void (*resume)(struct usb_composite_dev *);
@@ -326,6 +328,7 @@ struct usb_composite_dev {
326 328
327 /* private: */ 329 /* private: */
328 /* internals */ 330 /* internals */
331 unsigned int suspended:1;
329 struct usb_device_descriptor desc; 332 struct usb_device_descriptor desc;
330 struct list_head configs; 333 struct list_head configs;
331 struct usb_composite_driver *driver; 334 struct usb_composite_driver *driver;
@@ -341,6 +344,10 @@ struct usb_composite_dev {
341}; 344};
342 345
343extern int usb_string_id(struct usb_composite_dev *c); 346extern int usb_string_id(struct usb_composite_dev *c);
347extern int usb_string_ids_tab(struct usb_composite_dev *c,
348 struct usb_string *str);
349extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
350
344 351
345/* messaging utils */ 352/* messaging utils */
346#define DBG(d, fmt, args...) \ 353#define DBG(d, fmt, args...) \
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index af4b86f3aca3..2e262cb15425 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -39,13 +39,19 @@ struct ehci_caps {
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ 39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40 40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */ 41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42/* EHCI 1.1 addendum */
43#define HCC_32FRAME_PERIODIC_LIST(p) ((p)&(1 << 19))
44#define HCC_PER_PORT_CHANGE_EVENT(p) ((p)&(1 << 18))
45#define HCC_LPM(p) ((p)&(1 << 17))
46#define HCC_HW_PREFETCH(p) ((p)&(1 << 16))
47
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ 48#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ 49#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ 50#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ 51#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ 52#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ 53#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
48 u8 portroute [8]; /* nibbles for routing - offset 0xC */ 54 u8 portroute[8]; /* nibbles for routing - offset 0xC */
49} __attribute__ ((packed)); 55} __attribute__ ((packed));
50 56
51 57
@@ -54,6 +60,13 @@ struct ehci_regs {
54 60
55 /* USBCMD: offset 0x00 */ 61 /* USBCMD: offset 0x00 */
56 u32 command; 62 u32 command;
63
64/* EHCI 1.1 addendum */
65#define CMD_HIRD (0xf<<24) /* host initiated resume duration */
66#define CMD_PPCEE (1<<15) /* per port change event enable */
67#define CMD_FSP (1<<14) /* fully synchronized prefetch */
68#define CMD_ASPE (1<<13) /* async schedule prefetch enable */
69#define CMD_PSPE (1<<12) /* periodic schedule prefetch enable */
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ 70/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */ 71#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ 72#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
@@ -67,6 +80,7 @@ struct ehci_regs {
67 80
68 /* USBSTS: offset 0x04 */ 81 /* USBSTS: offset 0x04 */
69 u32 status; 82 u32 status;
83#define STS_PPCE_MASK (0xff<<16) /* Per-Port change event 1-16 */
70#define STS_ASS (1<<15) /* Async Schedule Status */ 84#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */ 85#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */ 86#define STS_RECL (1<<13) /* Reclamation */
@@ -92,14 +106,22 @@ struct ehci_regs {
92 /* ASYNCLISTADDR: offset 0x18 */ 106 /* ASYNCLISTADDR: offset 0x18 */
93 u32 async_next; /* address of next async queue head */ 107 u32 async_next; /* address of next async queue head */
94 108
95 u32 reserved [9]; 109 u32 reserved[9];
96 110
97 /* CONFIGFLAG: offset 0x40 */ 111 /* CONFIGFLAG: offset 0x40 */
98 u32 configured_flag; 112 u32 configured_flag;
99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */ 113#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
100 114
101 /* PORTSC: offset 0x44 */ 115 /* PORTSC: offset 0x44 */
102 u32 port_status [0]; /* up to N_PORTS */ 116 u32 port_status[0]; /* up to N_PORTS */
117/* EHCI 1.1 addendum */
118#define PORTSC_SUSPEND_STS_ACK 0
119#define PORTSC_SUSPEND_STS_NYET 1
120#define PORTSC_SUSPEND_STS_STALL 2
121#define PORTSC_SUSPEND_STS_ERR 3
122
123#define PORT_DEV_ADDR (0x7f<<25) /* device address */
124#define PORT_SSTS (0x3<<23) /* suspend status */
103/* 31:23 reserved */ 125/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ 126#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
@@ -115,6 +137,7 @@ struct ehci_regs {
115#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ 137#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
116/* 11:10 for detecting lowspeed devices (reset vs release ownership) */ 138/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
117/* 9 reserved */ 139/* 9 reserved */
140#define PORT_LPM (1<<9) /* LPM transaction */
118#define PORT_RESET (1<<8) /* reset port */ 141#define PORT_RESET (1<<8) /* reset port */
119#define PORT_SUSPEND (1<<7) /* suspend port */ 142#define PORT_SUSPEND (1<<7) /* suspend port */
120#define PORT_RESUME (1<<6) /* resume it */ 143#define PORT_RESUME (1<<6) /* resume it */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
new file mode 100644
index 000000000000..6f649c13193b
--- /dev/null
+++ b/include/linux/usb/functionfs.h
@@ -0,0 +1,199 @@
1#ifndef __LINUX_FUNCTIONFS_H__
2#define __LINUX_FUNCTIONFS_H__ 1
3
4
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | lenght | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string ther is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168#ifdef __KERNEL__
169
170struct ffs_data;
171struct usb_composite_dev;
172struct usb_configuration;
173
174
175static int functionfs_init(void) __attribute__((warn_unused_result));
176static void functionfs_cleanup(void);
177
178static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
179 __attribute__((warn_unused_result, nonnull));
180static void functionfs_unbind(struct ffs_data *ffs)
181 __attribute__((nonnull));
182
183static int functionfs_bind_config(struct usb_composite_dev *cdev,
184 struct usb_configuration *c,
185 struct ffs_data *ffs)
186 __attribute__((warn_unused_result, nonnull));
187
188
189static int functionfs_ready_callback(struct ffs_data *ffs)
190 __attribute__((warn_unused_result, nonnull));
191static void functionfs_closed_callback(struct ffs_data *ffs)
192 __attribute__((nonnull));
193static int functionfs_check_dev_callback(const char *dev_name)
194 __attribute__((warn_unused_result, nonnull));
195
196
197#endif
198
199#endif
diff --git a/include/linux/usb/g_hid.h b/include/linux/usb/g_hid.h
new file mode 100644
index 000000000000..50f5745df28c
--- /dev/null
+++ b/include/linux/usb/g_hid.h
@@ -0,0 +1,32 @@
1/*
2 * g_hid.h -- Header file for USB HID gadget driver
3 *
4 * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __LINUX_USB_G_HID_H
22#define __LINUX_USB_G_HID_H
23
24struct hidg_func_descriptor {
25 unsigned char subclass;
26 unsigned char protocol;
27 unsigned short report_length;
28 unsigned short report_desc_length;
29 unsigned char report_desc[];
30};
31
32#endif /* __LINUX_USB_G_HID_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index f4b7ca516cdd..d3ef42d7d2f0 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -494,9 +494,13 @@ static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
494 { dev_set_drvdata(&gadget->dev, data); } 494 { dev_set_drvdata(&gadget->dev, data); }
495static inline void *get_gadget_data(struct usb_gadget *gadget) 495static inline void *get_gadget_data(struct usb_gadget *gadget)
496 { return dev_get_drvdata(&gadget->dev); } 496 { return dev_get_drvdata(&gadget->dev); }
497static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
498{
499 return container_of(dev, struct usb_gadget, dev);
500}
497 501
498/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ 502/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
499#define gadget_for_each_ep(tmp,gadget) \ 503#define gadget_for_each_ep(tmp, gadget) \
500 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) 504 list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
501 505
502 506
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index 612102e4d75e..0bb12e0d4f8f 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -19,7 +19,7 @@
19#define __LINUX_USB_GADGETFS_H 19#define __LINUX_USB_GADGETFS_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <asm/ioctl.h> 22#include <linux/ioctl.h>
23 23
24#include <linux/usb/ch9.h> 24#include <linux/usb/ch9.h>
25 25
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
new file mode 100644
index 000000000000..3b571f1ffbb3
--- /dev/null
+++ b/include/linux/usb/hcd.h
@@ -0,0 +1,644 @@
1/*
2 * Copyright (c) 2001-2002 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __USB_CORE_HCD_H
20#define __USB_CORE_HCD_H
21
22#ifdef __KERNEL__
23
24#include <linux/rwsem.h>
25
26#define MAX_TOPO_LEVEL 6
27
28/* This file contains declarations of usbcore internals that are mostly
29 * used or exposed by Host Controller Drivers.
30 */
31
32/*
33 * USB Packet IDs (PIDs)
34 */
35#define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */
36#define USB_PID_OUT 0xe1
37#define USB_PID_ACK 0xd2
38#define USB_PID_DATA0 0xc3
39#define USB_PID_PING 0xb4 /* USB 2.0 */
40#define USB_PID_SOF 0xa5
41#define USB_PID_NYET 0x96 /* USB 2.0 */
42#define USB_PID_DATA2 0x87 /* USB 2.0 */
43#define USB_PID_SPLIT 0x78 /* USB 2.0 */
44#define USB_PID_IN 0x69
45#define USB_PID_NAK 0x5a
46#define USB_PID_DATA1 0x4b
47#define USB_PID_PREAMBLE 0x3c /* Token mode */
48#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
49#define USB_PID_SETUP 0x2d
50#define USB_PID_STALL 0x1e
51#define USB_PID_MDATA 0x0f /* USB 2.0 */
52
53/*-------------------------------------------------------------------------*/
54
55/*
56 * USB Host Controller Driver (usb_hcd) framework
57 *
58 * Since "struct usb_bus" is so thin, you can't share much code in it.
59 * This framework is a layer over that, and should be more sharable.
60 *
61 * @authorized_default: Specifies if new devices are authorized to
62 * connect by default or they require explicit
63 * user space authorization; this bit is settable
64 * through /sys/class/usb_host/X/authorized_default.
65 * For the rest is RO, so we don't lock to r/w it.
66 */
67
68/*-------------------------------------------------------------------------*/
69
70struct usb_hcd {
71
72 /*
73 * housekeeping
74 */
75 struct usb_bus self; /* hcd is-a bus */
76 struct kref kref; /* reference counter */
77
78 const char *product_desc; /* product/vendor string */
79 char irq_descr[24]; /* driver + bus # */
80
81 struct timer_list rh_timer; /* drives root-hub polling */
82 struct urb *status_urb; /* the current status urb */
83#ifdef CONFIG_USB_SUSPEND
84 struct work_struct wakeup_work; /* for remote wakeup */
85#endif
86
87 /*
88 * hardware info/state
89 */
90 const struct hc_driver *driver; /* hw-specific hooks */
91
92 /* Flags that need to be manipulated atomically because they can
93 * change while the host controller is running. Always use
94 * set_bit() or clear_bit() to change their values.
95 */
96 unsigned long flags;
97#define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */
98#define HCD_FLAG_SAW_IRQ 1
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
102
103 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit().
105 */
106#define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE))
107#define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ))
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
111
112 /* Flags that get set only during HCD registration or removal. */
113 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */
115
116 /* The next flag is a stopgap, to be removed when all the HCDs
117 * support the new root-hub polling mechanism. */
118 unsigned uses_new_polling:1;
119 unsigned wireless:1; /* Wireless USB HCD */
120 unsigned authorized_default:1;
121 unsigned has_tt:1; /* Integrated TT in root hub */
122
123 int irq; /* irq allocated */
124 void __iomem *regs; /* device memory/io */
125 u64 rsrc_start; /* memory/io resource start */
126 u64 rsrc_len; /* memory/io resource length */
127 unsigned power_budget; /* in mA, 0 = no limit */
128
129 /* bandwidth_mutex should be taken before adding or removing
130 * any new bus bandwidth constraints:
131 * 1. Before adding a configuration for a new device.
132 * 2. Before removing the configuration to put the device into
133 * the addressed state.
134 * 3. Before selecting a different configuration.
135 * 4. Before selecting an alternate interface setting.
136 *
137 * bandwidth_mutex should be dropped after a successful control message
138 * to the device, or resetting the bandwidth after a failed attempt.
139 */
140 struct mutex bandwidth_mutex;
141
142
143#define HCD_BUFFER_POOLS 4
144 struct dma_pool *pool[HCD_BUFFER_POOLS];
145
146 int state;
147# define __ACTIVE 0x01
148# define __SUSPEND 0x04
149# define __TRANSIENT 0x80
150
151# define HC_STATE_HALT 0
152# define HC_STATE_RUNNING (__ACTIVE)
153# define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE)
154# define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT)
155# define HC_STATE_SUSPENDED (__SUSPEND)
156
157#define HC_IS_RUNNING(state) ((state) & __ACTIVE)
158#define HC_IS_SUSPENDED(state) ((state) & __SUSPEND)
159
160 /* more shared queuing code would be good; it should support
161 * smarter scheduling, handle transaction translators, etc;
162 * input size of periodic table to an interrupt scheduler.
163 * (ohci 32, uhci 1024, ehci 256/512/1024).
164 */
165
166 /* The HC driver's private data is stored at the end of
167 * this structure.
168 */
169 unsigned long hcd_priv[0]
170 __attribute__ ((aligned(sizeof(unsigned long))));
171};
172
173/* 2.4 does this a bit differently ... */
174static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd)
175{
176 return &hcd->self;
177}
178
179static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus)
180{
181 return container_of(bus, struct usb_hcd, self);
182}
183
184struct hcd_timeout { /* timeouts we allocate */
185 struct list_head timeout_list;
186 struct timer_list timer;
187};
188
189/*-------------------------------------------------------------------------*/
190
191
192struct hc_driver {
193 const char *description; /* "ehci-hcd" etc */
194 const char *product_desc; /* product/vendor string */
195 size_t hcd_priv_size; /* size of private data */
196
197 /* irq handler */
198 irqreturn_t (*irq) (struct usb_hcd *hcd);
199
200 int flags;
201#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
202#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
203#define HCD_USB11 0x0010 /* USB 1.1 */
204#define HCD_USB2 0x0020 /* USB 2.0 */
205#define HCD_USB3 0x0040 /* USB 3.0 */
206#define HCD_MASK 0x0070
207
208 /* called to init HCD and root hub */
209 int (*reset) (struct usb_hcd *hcd);
210 int (*start) (struct usb_hcd *hcd);
211
212 /* NOTE: these suspend/resume calls relate to the HC as
213 * a whole, not just the root hub; they're for PCI bus glue.
214 */
215 /* called after suspending the hub, before entering D3 etc */
216 int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup);
217
218 /* called after entering D0 (etc), before resuming the hub */
219 int (*pci_resume)(struct usb_hcd *hcd, bool hibernated);
220
221 /* cleanly make HCD stop writing memory and doing I/O */
222 void (*stop) (struct usb_hcd *hcd);
223
224 /* shutdown HCD */
225 void (*shutdown) (struct usb_hcd *hcd);
226
227 /* return current frame number */
228 int (*get_frame_number) (struct usb_hcd *hcd);
229
230 /* manage i/o requests, device state */
231 int (*urb_enqueue)(struct usb_hcd *hcd,
232 struct urb *urb, gfp_t mem_flags);
233 int (*urb_dequeue)(struct usb_hcd *hcd,
234 struct urb *urb, int status);
235
236 /* hw synch, freeing endpoint resources that urb_dequeue can't */
237 void (*endpoint_disable)(struct usb_hcd *hcd,
238 struct usb_host_endpoint *ep);
239
240 /* (optional) reset any endpoint state such as sequence number
241 and current window */
242 void (*endpoint_reset)(struct usb_hcd *hcd,
243 struct usb_host_endpoint *ep);
244
245 /* root hub support */
246 int (*hub_status_data) (struct usb_hcd *hcd, char *buf);
247 int (*hub_control) (struct usb_hcd *hcd,
248 u16 typeReq, u16 wValue, u16 wIndex,
249 char *buf, u16 wLength);
250 int (*bus_suspend)(struct usb_hcd *);
251 int (*bus_resume)(struct usb_hcd *);
252 int (*start_port_reset)(struct usb_hcd *, unsigned port_num);
253
254 /* force handover of high-speed port to full-speed companion */
255 void (*relinquish_port)(struct usb_hcd *, int);
256 /* has a port been handed over to a companion? */
257 int (*port_handed_over)(struct usb_hcd *, int);
258
259 /* CLEAR_TT_BUFFER completion callback */
260 void (*clear_tt_buffer_complete)(struct usb_hcd *,
261 struct usb_host_endpoint *);
262
263 /* xHCI specific functions */
264 /* Called by usb_alloc_dev to alloc HC device structures */
265 int (*alloc_dev)(struct usb_hcd *, struct usb_device *);
266 /* Called by usb_disconnect to free HC device structures */
267 void (*free_dev)(struct usb_hcd *, struct usb_device *);
268 /* Change a group of bulk endpoints to support multiple stream IDs */
269 int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev,
270 struct usb_host_endpoint **eps, unsigned int num_eps,
271 unsigned int num_streams, gfp_t mem_flags);
272 /* Reverts a group of bulk endpoints back to not using stream IDs.
273 * Can fail if we run out of memory.
274 */
275 int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev,
276 struct usb_host_endpoint **eps, unsigned int num_eps,
277 gfp_t mem_flags);
278
279 /* Bandwidth computation functions */
280 /* Note that add_endpoint() can only be called once per endpoint before
281 * check_bandwidth() or reset_bandwidth() must be called.
282 * drop_endpoint() can only be called once per endpoint also.
283 * A call to xhci_drop_endpoint() followed by a call to
284 * xhci_add_endpoint() will add the endpoint to the schedule with
285 * possibly new parameters denoted by a different endpoint descriptor
286 * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a
287 * call to xhci_drop_endpoint() is not allowed.
288 */
289 /* Allocate endpoint resources and add them to a new schedule */
290 int (*add_endpoint)(struct usb_hcd *, struct usb_device *,
291 struct usb_host_endpoint *);
292 /* Drop an endpoint from a new schedule */
293 int (*drop_endpoint)(struct usb_hcd *, struct usb_device *,
294 struct usb_host_endpoint *);
295 /* Check that a new hardware configuration, set using
296 * endpoint_enable and endpoint_disable, does not exceed bus
297 * bandwidth. This must be called before any set configuration
298 * or set interface requests are sent to the device.
299 */
300 int (*check_bandwidth)(struct usb_hcd *, struct usb_device *);
301 /* Reset the device schedule to the last known good schedule,
302 * which was set from a previous successful call to
303 * check_bandwidth(). This reverts any add_endpoint() and
304 * drop_endpoint() calls since that last successful call.
305 * Used for when a check_bandwidth() call fails due to resource
306 * or bandwidth constraints.
307 */
308 void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
309 /* Returns the hardware-chosen device address */
310 int (*address_device)(struct usb_hcd *, struct usb_device *udev);
311 /* Notifies the HCD after a hub descriptor is fetched.
312 * Will block.
313 */
314 int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev,
315 struct usb_tt *tt, gfp_t mem_flags);
316 int (*reset_device)(struct usb_hcd *, struct usb_device *);
317 /* Notifies the HCD after a device is connected and its
318 * address is set
319 */
320 int (*update_device)(struct usb_hcd *, struct usb_device *);
321};
322
323extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
324extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
325 int status);
326extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb);
327
328extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
329extern int usb_hcd_unlink_urb(struct urb *urb, int status);
330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
331 int status);
332extern void usb_hcd_flush_endpoint(struct usb_device *udev,
333 struct usb_host_endpoint *ep);
334extern void usb_hcd_disable_endpoint(struct usb_device *udev,
335 struct usb_host_endpoint *ep);
336extern void usb_hcd_reset_endpoint(struct usb_device *udev,
337 struct usb_host_endpoint *ep);
338extern void usb_hcd_synchronize_unlinks(struct usb_device *udev);
339extern int usb_hcd_alloc_bandwidth(struct usb_device *udev,
340 struct usb_host_config *new_config,
341 struct usb_host_interface *old_alt,
342 struct usb_host_interface *new_alt);
343extern int usb_hcd_get_frame_number(struct usb_device *udev);
344
345extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
346 struct device *dev, const char *bus_name);
347extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
348extern void usb_put_hcd(struct usb_hcd *hcd);
349extern int usb_add_hcd(struct usb_hcd *hcd,
350 unsigned int irqnum, unsigned long irqflags);
351extern void usb_remove_hcd(struct usb_hcd *hcd);
352
353struct platform_device;
354extern void usb_hcd_platform_shutdown(struct platform_device *dev);
355
356#ifdef CONFIG_PCI
357struct pci_dev;
358struct pci_device_id;
359extern int usb_hcd_pci_probe(struct pci_dev *dev,
360 const struct pci_device_id *id);
361extern void usb_hcd_pci_remove(struct pci_dev *dev);
362extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
363
364#ifdef CONFIG_PM_SLEEP
365extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
366#endif
367#endif /* CONFIG_PCI */
368
369/* pci-ish (pdev null is ok) buffer alloc/mapping support */
370int hcd_buffer_create(struct usb_hcd *hcd);
371void hcd_buffer_destroy(struct usb_hcd *hcd);
372
373void *hcd_buffer_alloc(struct usb_bus *bus, size_t size,
374 gfp_t mem_flags, dma_addr_t *dma);
375void hcd_buffer_free(struct usb_bus *bus, size_t size,
376 void *addr, dma_addr_t dma);
377
378/* generic bus glue, needed for host controllers that don't use PCI */
379extern irqreturn_t usb_hcd_irq(int irq, void *__hcd);
380
381extern void usb_hc_died(struct usb_hcd *hcd);
382extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd);
383
384/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
385#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
386#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
387#define usb_settoggle(dev, ep, out, bit) \
388 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
389 ((bit) << (ep)))
390
391/* -------------------------------------------------------------------------- */
392
393/* Enumeration is only for the hub driver, or HCD virtual root hubs */
394extern struct usb_device *usb_alloc_dev(struct usb_device *parent,
395 struct usb_bus *, unsigned port);
396extern int usb_new_device(struct usb_device *dev);
397extern void usb_disconnect(struct usb_device **);
398
399extern int usb_get_configuration(struct usb_device *dev);
400extern void usb_destroy_configuration(struct usb_device *dev);
401
402/*-------------------------------------------------------------------------*/
403
404/*
405 * HCD Root Hub support
406 */
407
408#include <linux/usb/ch11.h>
409
410/*
411 * As of USB 2.0, full/low speed devices are segregated into trees.
412 * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
413 * The other type grows from high speed hubs when they connect to
414 * full/low speed devices using "Transaction Translators" (TTs).
415 *
416 * TTs should only be known to the hub driver, and high speed bus
417 * drivers (only EHCI for now). They affect periodic scheduling and
418 * sometimes control/bulk error recovery.
419 */
420
421struct usb_device;
422
423struct usb_tt {
424 struct usb_device *hub; /* upstream highspeed hub */
425 int multi; /* true means one TT per port */
426 unsigned think_time; /* think time in ns */
427
428 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
429 spinlock_t lock;
430 struct list_head clear_list; /* of usb_tt_clear */
431 struct work_struct clear_work;
432};
433
434struct usb_tt_clear {
435 struct list_head clear_list;
436 unsigned tt;
437 u16 devinfo;
438 struct usb_hcd *hcd;
439 struct usb_host_endpoint *ep;
440};
441
442extern int usb_hub_clear_tt_buffer(struct urb *urb);
443extern void usb_ep0_reinit(struct usb_device *);
444
445/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
446#define DeviceRequest \
447 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
448#define DeviceOutRequest \
449 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8)
450
451#define InterfaceRequest \
452 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
453
454#define EndpointRequest \
455 ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
456#define EndpointOutRequest \
457 ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
458
459/* class requests from the USB 2.0 hub spec, table 11-15 */
460/* GetBusState and SetHubDescriptor are optional, omitted */
461#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
462#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
463#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
464#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
465#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
466#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
467#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
468
469
470/*-------------------------------------------------------------------------*/
471
472/*
473 * Generic bandwidth allocation constants/support
474 */
475#define FRAME_TIME_USECS 1000L
476#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
477 /* Trying not to use worst-case bit-stuffing
478 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
479 /* bytecount = data payload byte count */
480
481#define NS_TO_US(ns) ((ns + 500L) / 1000L)
482 /* convert & round nanoseconds to microseconds */
483
484
485/*
486 * Full/low speed bandwidth allocation constants/support.
487 */
488#define BW_HOST_DELAY 1000L /* nanoseconds */
489#define BW_HUB_LS_SETUP 333L /* nanoseconds */
490 /* 4 full-speed bit times (est.) */
491
492#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
493#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
494#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
495
496/*
497 * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed
498 * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed
499 * to preallocate bandwidth)
500 */
501#define USB2_HOST_DELAY 5 /* nsec, guess */
502#define HS_NSECS(bytes) (((55 * 8 * 2083) \
503 + (2083UL * (3 + BitTime(bytes))))/1000 \
504 + USB2_HOST_DELAY)
505#define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \
506 + (2083UL * (3 + BitTime(bytes))))/1000 \
507 + USB2_HOST_DELAY)
508#define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes))
509#define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes))
510
511extern long usb_calc_bus_time(int speed, int is_input,
512 int isoc, int bytecount);
513
514/*-------------------------------------------------------------------------*/
515
516extern void usb_set_device_state(struct usb_device *udev,
517 enum usb_device_state new_state);
518
519/*-------------------------------------------------------------------------*/
520
521/* exported only within usbcore */
522
523extern struct list_head usb_bus_list;
524extern struct mutex usb_bus_list_lock;
525extern wait_queue_head_t usb_kill_urb_queue;
526
527extern int usb_find_interface_driver(struct usb_device *dev,
528 struct usb_interface *interface);
529
530#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN))
531
532#ifdef CONFIG_PM
533extern void usb_root_hub_lost_power(struct usb_device *rhdev);
534extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);
535extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);
536#endif /* CONFIG_PM */
537
538#ifdef CONFIG_USB_SUSPEND
539extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);
540#else
541static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)
542{
543 return;
544}
545#endif /* CONFIG_USB_SUSPEND */
546
547
548/*
549 * USB device fs stuff
550 */
551
552#ifdef CONFIG_USB_DEVICEFS
553
554/*
555 * these are expected to be called from the USB core/hub thread
556 * with the kernel lock held
557 */
558extern void usbfs_update_special(void);
559extern int usbfs_init(void);
560extern void usbfs_cleanup(void);
561
562#else /* CONFIG_USB_DEVICEFS */
563
564static inline void usbfs_update_special(void) {}
565static inline int usbfs_init(void) { return 0; }
566static inline void usbfs_cleanup(void) { }
567
568#endif /* CONFIG_USB_DEVICEFS */
569
570/*-------------------------------------------------------------------------*/
571
572#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
573
574struct usb_mon_operations {
575 void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
576 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
577 void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status);
578 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
579};
580
581extern struct usb_mon_operations *mon_ops;
582
583static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)
584{
585 if (bus->monitored)
586 (*mon_ops->urb_submit)(bus, urb);
587}
588
589static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
590 int error)
591{
592 if (bus->monitored)
593 (*mon_ops->urb_submit_error)(bus, urb, error);
594}
595
596static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
597 int status)
598{
599 if (bus->monitored)
600 (*mon_ops->urb_complete)(bus, urb, status);
601}
602
603int usb_mon_register(struct usb_mon_operations *ops);
604void usb_mon_deregister(void);
605
606#else
607
608static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
609static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
610 int error) {}
611static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
612 int status) {}
613
614#endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */
615
616/*-------------------------------------------------------------------------*/
617
618/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
619/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
620#define bitmap DeviceRemovable
621
622
623/*-------------------------------------------------------------------------*/
624
625/* random stuff */
626
627#define RUN_CONTEXT (in_irq() ? "in_irq" \
628 : (in_interrupt() ? "in_interrupt" : "can sleep"))
629
630
631/* This rwsem is for use only by the hub driver and ehci-hcd.
632 * Nobody else should touch it.
633 */
634extern struct rw_semaphore ehci_cf_port_reset_rwsem;
635
636/* Keep track of which host controller drivers are loaded */
637#define USB_UHCI_LOADED 0
638#define USB_OHCI_LOADED 1
639#define USB_EHCI_LOADED 2
640extern unsigned long usb_hcds_loaded;
641
642#endif /* __KERNEL__ */
643
644#endif /* __USB_CORE_HCD_H */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
index c949178a6530..2d2d1bbad9d2 100644
--- a/include/linux/usb/langwell_udc.h
+++ b/include/linux/usb/langwell_udc.h
@@ -181,7 +181,7 @@ struct langwell_op_regs {
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ 181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */ 182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */ 183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */ 184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */ 185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */ 186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */ 187#define PORTS_SUSP BIT(7) /* suspend */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 7acef0234c0e..ee2dd1d506ed 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -22,12 +22,47 @@ enum musb_mode {
22 22
23struct clk; 23struct clk;
24 24
25enum musb_fifo_style {
26 FIFO_RXTX,
27 FIFO_TX,
28 FIFO_RX
29} __attribute__ ((packed));
30
31enum musb_buf_mode {
32 BUF_SINGLE,
33 BUF_DOUBLE
34} __attribute__ ((packed));
35
36struct musb_fifo_cfg {
37 u8 hw_ep_num;
38 enum musb_fifo_style style;
39 enum musb_buf_mode mode;
40 u16 maxpacket;
41};
42
43#define MUSB_EP_FIFO(ep, st, m, pkt) \
44{ \
45 .hw_ep_num = ep, \
46 .style = st, \
47 .mode = m, \
48 .maxpacket = pkt, \
49}
50
51#define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
52 MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
53
54#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
55 MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
56
25struct musb_hdrc_eps_bits { 57struct musb_hdrc_eps_bits {
26 const char name[16]; 58 const char name[16];
27 u8 bits; 59 u8 bits;
28}; 60};
29 61
30struct musb_hdrc_config { 62struct musb_hdrc_config {
63 struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
64 unsigned fifo_cfg_size; /* size of the fifo configuration */
65
31 /* MUSB configuration-specific details */ 66 /* MUSB configuration-specific details */
32 unsigned multipoint:1; /* multipoint device */ 67 unsigned multipoint:1; /* multipoint device */
33 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ 68 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
@@ -51,8 +86,9 @@ struct musb_hdrc_config {
51 86
52 struct musb_hdrc_eps_bits *eps_bits __deprecated; 87 struct musb_hdrc_eps_bits *eps_bits __deprecated;
53#ifdef CONFIG_BLACKFIN 88#ifdef CONFIG_BLACKFIN
54 /* A GPIO controlling VRSEL in Blackfin */ 89 /* A GPIO controlling VRSEL in Blackfin */
55 unsigned int gpio_vrsel; 90 unsigned int gpio_vrsel;
91 unsigned int gpio_vrsel_active;
56#endif 92#endif
57 93
58}; 94};
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h
new file mode 100644
index 000000000000..006d1064c8b2
--- /dev/null
+++ b/include/linux/usb/ncm.h
@@ -0,0 +1,114 @@
1/*
2 * USB CDC NCM auxiliary definitions
3 */
4
5#ifndef __LINUX_USB_NCM_H
6#define __LINUX_USB_NCM_H
7
8#include <linux/types.h>
9#include <linux/usb/cdc.h>
10#include <asm/unaligned.h>
11
12#define NCM_NTB_MIN_IN_SIZE 2048
13#define NCM_NTB_MIN_OUT_SIZE 2048
14
15#define NCM_CONTROL_TIMEOUT (5 * 1000)
16
17/* bmNetworkCapabilities */
18
19#define NCM_NCAP_ETH_FILTER (1 << 0)
20#define NCM_NCAP_NET_ADDRESS (1 << 1)
21#define NCM_NCAP_ENCAP_COMM (1 << 2)
22#define NCM_NCAP_MAX_DGRAM (1 << 3)
23#define NCM_NCAP_CRC_MODE (1 << 4)
24
25/*
26 * Here are options for NCM Datagram Pointer table (NDP) parser.
27 * There are 2 different formats: NDP16 and NDP32 in the spec (ch. 3),
28 * in NDP16 offsets and sizes fields are 1 16bit word wide,
29 * in NDP32 -- 2 16bit words wide. Also signatures are different.
30 * To make the parser code the same, put the differences in the structure,
31 * and switch pointers to the structures when the format is changed.
32 */
33
34struct ndp_parser_opts {
35 u32 nth_sign;
36 u32 ndp_sign;
37 unsigned nth_size;
38 unsigned ndp_size;
39 unsigned ndplen_align;
40 /* sizes in u16 units */
41 unsigned dgram_item_len; /* index or length */
42 unsigned block_length;
43 unsigned fp_index;
44 unsigned reserved1;
45 unsigned reserved2;
46 unsigned next_fp_index;
47};
48
49#define INIT_NDP16_OPTS { \
50 .nth_sign = NCM_NTH16_SIGN, \
51 .ndp_sign = NCM_NDP16_NOCRC_SIGN, \
52 .nth_size = sizeof(struct usb_cdc_ncm_nth16), \
53 .ndp_size = sizeof(struct usb_cdc_ncm_ndp16), \
54 .ndplen_align = 4, \
55 .dgram_item_len = 1, \
56 .block_length = 1, \
57 .fp_index = 1, \
58 .reserved1 = 0, \
59 .reserved2 = 0, \
60 .next_fp_index = 1, \
61 }
62
63
64#define INIT_NDP32_OPTS { \
65 .nth_sign = NCM_NTH32_SIGN, \
66 .ndp_sign = NCM_NDP32_NOCRC_SIGN, \
67 .nth_size = sizeof(struct usb_cdc_ncm_nth32), \
68 .ndp_size = sizeof(struct usb_cdc_ncm_ndp32), \
69 .ndplen_align = 8, \
70 .dgram_item_len = 2, \
71 .block_length = 2, \
72 .fp_index = 2, \
73 .reserved1 = 1, \
74 .reserved2 = 2, \
75 .next_fp_index = 2, \
76 }
77
78static inline void put_ncm(__le16 **p, unsigned size, unsigned val)
79{
80 switch (size) {
81 case 1:
82 put_unaligned_le16((u16)val, *p);
83 break;
84 case 2:
85 put_unaligned_le32((u32)val, *p);
86
87 break;
88 default:
89 BUG();
90 }
91
92 *p += size;
93}
94
95static inline unsigned get_ncm(__le16 **p, unsigned size)
96{
97 unsigned tmp;
98
99 switch (size) {
100 case 1:
101 tmp = get_unaligned_le16(*p);
102 break;
103 case 2:
104 tmp = get_unaligned_le32(*p);
105 break;
106 default:
107 BUG();
108 }
109
110 *p += size;
111 return tmp;
112}
113
114#endif /* __LINUX_USB_NCM_H */
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index 96ca549a778d..148b8fa5b1a2 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -353,7 +353,7 @@ struct net2280_dma_regs { /* [11.7] */
353#define DMA_TRANSACTION_DONE_INTERRUPT 24 353#define DMA_TRANSACTION_DONE_INTERRUPT 24
354#define DMA_ABORT 1 354#define DMA_ABORT 1
355#define DMA_START 0 355#define DMA_START 0
356 u32 _unused0 [2]; 356 u32 _unused0[2];
357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ 357 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
358 u32 dmacount; 358 u32 dmacount;
359#define VALID_BIT 31 359#define VALID_BIT 31
@@ -374,7 +374,7 @@ struct net2280_dep_regs { /* [11.8] */
374 u32 dep_cfg; 374 u32 dep_cfg;
375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ 375 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
376 u32 dep_rsp; 376 u32 dep_rsp;
377 u32 _unused [2]; 377 u32 _unused[2];
378} __attribute__ ((packed)); 378} __attribute__ ((packed));
379 379
380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs 380/* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs
@@ -437,7 +437,7 @@ struct net2280_ep_regs { /* [11.9] */
437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ 437 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
438 u32 ep_avail; 438 u32 ep_avail;
439 u32 ep_data; 439 u32 ep_data;
440 u32 _unused0 [2]; 440 u32 _unused0[2];
441} __attribute__ ((packed)); 441} __attribute__ ((packed));
442 442
443#endif /* __LINUX_USB_NET2280_H */ 443#endif /* __LINUX_USB_NET2280_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f8302d036a76..545cba73ccaf 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,13 +43,6 @@ enum usb_xceiv_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46#define USB_OTG_PULLUP_ID (1 << 0)
47#define USB_OTG_PULLDOWN_DP (1 << 1)
48#define USB_OTG_PULLDOWN_DM (1 << 2)
49#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
50#define USB_OTG_DRV_VBUS (1 << 4)
51#define USB_OTG_DRV_VBUS_EXT (1 << 5)
52
53struct otg_transceiver; 46struct otg_transceiver;
54 47
55/* for transceivers connected thru an ULPI interface, the user must 48/* for transceivers connected thru an ULPI interface, the user must
@@ -146,10 +139,10 @@ static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
146 return -EINVAL; 139 return -EINVAL;
147} 140}
148 141
149static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) 142static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg)
150{ 143{
151 if (otg->io_ops && otg->io_ops->write) 144 if (otg->io_ops && otg->io_ops->write)
152 return otg->io_ops->write(otg, reg, val); 145 return otg->io_ops->write(otg, val, reg);
153 146
154 return -EINVAL; 147 return -EINVAL;
155} 148}
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 0a555dd131fc..3e93de7ecbc3 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -22,4 +22,12 @@
22/*device will morph if reset, don't use reset for handling errors */ 22/*device will morph if reset, don't use reset for handling errors */
23#define USB_QUIRK_RESET_MORPHS 0x00000010 23#define USB_QUIRK_RESET_MORPHS 0x00000010
24 24
25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */
27#define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
28
29/* device needs a pause during initialization, after we read the device
30 descriptor */
31#define USB_QUIRK_DELAY_INIT 0x00000040
32
25#endif /* __LINUX_USB_QUIRKS_H */ 33#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 1ef1ebc2b04f..05ef52861988 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -34,10 +34,10 @@
34struct rndis_msg_hdr { 34struct rndis_msg_hdr {
35 __le32 msg_type; /* RNDIS_MSG_* */ 35 __le32 msg_type; /* RNDIS_MSG_* */
36 __le32 msg_len; 36 __le32 msg_len;
37 // followed by data that varies between messages 37 /* followed by data that varies between messages */
38 __le32 request_id; 38 __le32 request_id;
39 __le32 status; 39 __le32 status;
40 // ... and more 40 /* ... and more */
41} __attribute__ ((packed)); 41} __attribute__ ((packed));
42 42
43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ 43/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
@@ -92,67 +92,67 @@ struct rndis_msg_hdr {
92 92
93struct rndis_data_hdr { 93struct rndis_data_hdr {
94 __le32 msg_type; /* RNDIS_MSG_PACKET */ 94 __le32 msg_type; /* RNDIS_MSG_PACKET */
95 __le32 msg_len; // rndis_data_hdr + data_len + pad 95 __le32 msg_len; /* rndis_data_hdr + data_len + pad */
96 __le32 data_offset; // 36 -- right after header 96 __le32 data_offset; /* 36 -- right after header */
97 __le32 data_len; // ... real packet size 97 __le32 data_len; /* ... real packet size */
98 98
99 __le32 oob_data_offset; // zero 99 __le32 oob_data_offset; /* zero */
100 __le32 oob_data_len; // zero 100 __le32 oob_data_len; /* zero */
101 __le32 num_oob; // zero 101 __le32 num_oob; /* zero */
102 __le32 packet_data_offset; // zero 102 __le32 packet_data_offset; /* zero */
103 103
104 __le32 packet_data_len; // zero 104 __le32 packet_data_len; /* zero */
105 __le32 vc_handle; // zero 105 __le32 vc_handle; /* zero */
106 __le32 reserved; // zero 106 __le32 reserved; /* zero */
107} __attribute__ ((packed)); 107} __attribute__ ((packed));
108 108
109struct rndis_init { /* OUT */ 109struct rndis_init { /* OUT */
110 // header and: 110 /* header and: */
111 __le32 msg_type; /* RNDIS_MSG_INIT */ 111 __le32 msg_type; /* RNDIS_MSG_INIT */
112 __le32 msg_len; // 24 112 __le32 msg_len; /* 24 */
113 __le32 request_id; 113 __le32 request_id;
114 __le32 major_version; // of rndis (1.0) 114 __le32 major_version; /* of rndis (1.0) */
115 __le32 minor_version; 115 __le32 minor_version;
116 __le32 max_transfer_size; 116 __le32 max_transfer_size;
117} __attribute__ ((packed)); 117} __attribute__ ((packed));
118 118
119struct rndis_init_c { /* IN */ 119struct rndis_init_c { /* IN */
120 // header and: 120 /* header and: */
121 __le32 msg_type; /* RNDIS_MSG_INIT_C */ 121 __le32 msg_type; /* RNDIS_MSG_INIT_C */
122 __le32 msg_len; 122 __le32 msg_len;
123 __le32 request_id; 123 __le32 request_id;
124 __le32 status; 124 __le32 status;
125 __le32 major_version; // of rndis (1.0) 125 __le32 major_version; /* of rndis (1.0) */
126 __le32 minor_version; 126 __le32 minor_version;
127 __le32 device_flags; 127 __le32 device_flags;
128 __le32 medium; // zero == 802.3 128 __le32 medium; /* zero == 802.3 */
129 __le32 max_packets_per_message; 129 __le32 max_packets_per_message;
130 __le32 max_transfer_size; 130 __le32 max_transfer_size;
131 __le32 packet_alignment; // max 7; (1<<n) bytes 131 __le32 packet_alignment; /* max 7; (1<<n) bytes */
132 __le32 af_list_offset; // zero 132 __le32 af_list_offset; /* zero */
133 __le32 af_list_size; // zero 133 __le32 af_list_size; /* zero */
134} __attribute__ ((packed)); 134} __attribute__ ((packed));
135 135
136struct rndis_halt { /* OUT (no reply) */ 136struct rndis_halt { /* OUT (no reply) */
137 // header and: 137 /* header and: */
138 __le32 msg_type; /* RNDIS_MSG_HALT */ 138 __le32 msg_type; /* RNDIS_MSG_HALT */
139 __le32 msg_len; 139 __le32 msg_len;
140 __le32 request_id; 140 __le32 request_id;
141} __attribute__ ((packed)); 141} __attribute__ ((packed));
142 142
143struct rndis_query { /* OUT */ 143struct rndis_query { /* OUT */
144 // header and: 144 /* header and: */
145 __le32 msg_type; /* RNDIS_MSG_QUERY */ 145 __le32 msg_type; /* RNDIS_MSG_QUERY */
146 __le32 msg_len; 146 __le32 msg_len;
147 __le32 request_id; 147 __le32 request_id;
148 __le32 oid; 148 __le32 oid;
149 __le32 len; 149 __le32 len;
150 __le32 offset; 150 __le32 offset;
151/*?*/ __le32 handle; // zero 151/*?*/ __le32 handle; /* zero */
152} __attribute__ ((packed)); 152} __attribute__ ((packed));
153 153
154struct rndis_query_c { /* IN */ 154struct rndis_query_c { /* IN */
155 // header and: 155 /* header and: */
156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */ 156 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
157 __le32 msg_len; 157 __le32 msg_len;
158 __le32 request_id; 158 __le32 request_id;
@@ -162,18 +162,18 @@ struct rndis_query_c { /* IN */
162} __attribute__ ((packed)); 162} __attribute__ ((packed));
163 163
164struct rndis_set { /* OUT */ 164struct rndis_set { /* OUT */
165 // header and: 165 /* header and: */
166 __le32 msg_type; /* RNDIS_MSG_SET */ 166 __le32 msg_type; /* RNDIS_MSG_SET */
167 __le32 msg_len; 167 __le32 msg_len;
168 __le32 request_id; 168 __le32 request_id;
169 __le32 oid; 169 __le32 oid;
170 __le32 len; 170 __le32 len;
171 __le32 offset; 171 __le32 offset;
172/*?*/ __le32 handle; // zero 172/*?*/ __le32 handle; /* zero */
173} __attribute__ ((packed)); 173} __attribute__ ((packed));
174 174
175struct rndis_set_c { /* IN */ 175struct rndis_set_c { /* IN */
176 // header and: 176 /* header and: */
177 __le32 msg_type; /* RNDIS_MSG_SET_C */ 177 __le32 msg_type; /* RNDIS_MSG_SET_C */
178 __le32 msg_len; 178 __le32 msg_len;
179 __le32 request_id; 179 __le32 request_id;
@@ -181,14 +181,14 @@ struct rndis_set_c { /* IN */
181} __attribute__ ((packed)); 181} __attribute__ ((packed));
182 182
183struct rndis_reset { /* IN */ 183struct rndis_reset { /* IN */
184 // header and: 184 /* header and: */
185 __le32 msg_type; /* RNDIS_MSG_RESET */ 185 __le32 msg_type; /* RNDIS_MSG_RESET */
186 __le32 msg_len; 186 __le32 msg_len;
187 __le32 reserved; 187 __le32 reserved;
188} __attribute__ ((packed)); 188} __attribute__ ((packed));
189 189
190struct rndis_reset_c { /* OUT */ 190struct rndis_reset_c { /* OUT */
191 // header and: 191 /* header and: */
192 __le32 msg_type; /* RNDIS_MSG_RESET_C */ 192 __le32 msg_type; /* RNDIS_MSG_RESET_C */
193 __le32 msg_len; 193 __le32 msg_len;
194 __le32 status; 194 __le32 status;
@@ -196,7 +196,7 @@ struct rndis_reset_c { /* OUT */
196} __attribute__ ((packed)); 196} __attribute__ ((packed));
197 197
198struct rndis_indicate { /* IN (unrequested) */ 198struct rndis_indicate { /* IN (unrequested) */
199 // header and: 199 /* header and: */
200 __le32 msg_type; /* RNDIS_MSG_INDICATE */ 200 __le32 msg_type; /* RNDIS_MSG_INDICATE */
201 __le32 msg_len; 201 __le32 msg_len;
202 __le32 status; 202 __le32 status;
@@ -208,14 +208,14 @@ struct rndis_indicate { /* IN (unrequested) */
208} __attribute__ ((packed)); 208} __attribute__ ((packed));
209 209
210struct rndis_keepalive { /* OUT (optionally IN) */ 210struct rndis_keepalive { /* OUT (optionally IN) */
211 // header and: 211 /* header and: */
212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ 212 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
213 __le32 msg_len; 213 __le32 msg_len;
214 __le32 request_id; 214 __le32 request_id;
215} __attribute__ ((packed)); 215} __attribute__ ((packed));
216 216
217struct rndis_keepalive_c { /* IN (optionally OUT) */ 217struct rndis_keepalive_c { /* IN (optionally OUT) */
218 // header and: 218 /* header and: */
219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ 219 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
220 __le32 msg_len; 220 __le32 msg_len;
221 __le32 request_id; 221 __le32 request_id;
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0a458b861933..84a4c44c208b 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -35,6 +35,9 @@ enum port_dev_state {
35 PORT_UNREGISTERING, 35 PORT_UNREGISTERING,
36}; 36};
37 37
38/* USB serial flags */
39#define USB_SERIAL_WRITE_BUSY 0
40
38/** 41/**
39 * usb_serial_port: structure for the specific ports of a device. 42 * usb_serial_port: structure for the specific ports of a device.
40 * @serial: pointer back to the struct usb_serial owner of this port. 43 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -49,7 +52,7 @@ enum port_dev_state {
49 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. 52 * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes.
50 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. 53 * @interrupt_out_urb: pointer to the interrupt out struct urb for this port.
51 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe 54 * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe
52 * for this port. 55 * for this port.
53 * @bulk_in_buffer: pointer to the bulk in buffer for this port. 56 * @bulk_in_buffer: pointer to the bulk in buffer for this port.
54 * @bulk_in_size: the size of the bulk_in_buffer, in bytes. 57 * @bulk_in_size: the size of the bulk_in_buffer, in bytes.
55 * @read_urb: pointer to the bulk in struct urb for this port. 58 * @read_urb: pointer to the bulk in struct urb for this port.
@@ -60,13 +63,17 @@ enum port_dev_state {
60 * @write_urb: pointer to the bulk out struct urb for this port. 63 * @write_urb: pointer to the bulk out struct urb for this port.
61 * @write_fifo: kfifo used to buffer outgoing data 64 * @write_fifo: kfifo used to buffer outgoing data
62 * @write_urb_busy: port`s writing status 65 * @write_urb_busy: port`s writing status
66 * @bulk_out_buffers: pointers to the bulk out buffers for this port
67 * @write_urbs: pointers to the bulk out urbs for this port
68 * @write_urbs_free: status bitmap the for bulk out urbs
69 * @tx_bytes: number of bytes currently in host stack queues
63 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this 70 * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this
64 * port. 71 * port.
72 * @flags: usb serial port flags
65 * @write_wait: a wait_queue_head_t used by the port. 73 * @write_wait: a wait_queue_head_t used by the port.
66 * @work: work queue entry for the line discipline waking up. 74 * @work: work queue entry for the line discipline waking up.
67 * @throttled: nonzero if the read urb is inactive to throttle the device 75 * @throttled: nonzero if the read urb is inactive to throttle the device
68 * @throttle_req: nonzero if the tty wants to throttle us 76 * @throttle_req: nonzero if the tty wants to throttle us
69 * @console: attached usb serial console
70 * @dev: pointer to the serial device 77 * @dev: pointer to the serial device
71 * 78 *
72 * This structure is used by the usb-serial core and drivers for the specific 79 * This structure is used by the usb-serial core and drivers for the specific
@@ -97,16 +104,19 @@ struct usb_serial_port {
97 struct urb *write_urb; 104 struct urb *write_urb;
98 struct kfifo write_fifo; 105 struct kfifo write_fifo;
99 int write_urb_busy; 106 int write_urb_busy;
107
108 unsigned char *bulk_out_buffers[2];
109 struct urb *write_urbs[2];
110 unsigned long write_urbs_free;
100 __u8 bulk_out_endpointAddress; 111 __u8 bulk_out_endpointAddress;
101 112
102 int tx_bytes_flight; 113 int tx_bytes;
103 int urbs_in_flight;
104 114
115 unsigned long flags;
105 wait_queue_head_t write_wait; 116 wait_queue_head_t write_wait;
106 struct work_struct work; 117 struct work_struct work;
107 char throttled; 118 char throttled;
108 char throttle_req; 119 char throttle_req;
109 char console;
110 unsigned long sysrq; /* sysrq timeout */ 120 unsigned long sysrq; /* sysrq timeout */
111 struct device dev; 121 struct device dev;
112 enum port_dev_state dev_state; 122 enum port_dev_state dev_state;
@@ -181,6 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * @id_table: pointer to a list of usb_device_id structures that define all 191 * @id_table: pointer to a list of usb_device_id structures that define all
182 * of the devices this structure can support. 192 * of the devices this structure can support.
183 * @num_ports: the number of different ports this device will have. 193 * @num_ports: the number of different ports this device will have.
194 * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
184 * @calc_num_ports: pointer to a function to determine how many ports this 196 * @calc_num_ports: pointer to a function to determine how many ports this
185 * device has dynamically. It will be called after the probe() 197 * device has dynamically. It will be called after the probe()
186 * callback is called, but before attach() 198 * callback is called, but before attach()
@@ -223,7 +235,9 @@ struct usb_serial_driver {
223 struct device_driver driver; 235 struct device_driver driver;
224 struct usb_driver *usb_driver; 236 struct usb_driver *usb_driver;
225 struct usb_dynids dynids; 237 struct usb_dynids dynids;
226 int max_in_flight_urbs; 238
239 size_t bulk_in_size;
240 size_t bulk_out_size;
227 241
228 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 242 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
229 int (*attach)(struct usb_serial *serial); 243 int (*attach)(struct usb_serial *serial);
@@ -269,6 +283,11 @@ struct usb_serial_driver {
269 void (*write_int_callback)(struct urb *urb); 283 void (*write_int_callback)(struct urb *urb);
270 void (*read_bulk_callback)(struct urb *urb); 284 void (*read_bulk_callback)(struct urb *urb);
271 void (*write_bulk_callback)(struct urb *urb); 285 void (*write_bulk_callback)(struct urb *urb);
286 /* Called by the generic read bulk callback */
287 void (*process_read_urb)(struct urb *urb);
288 /* Called by the generic write implementation */
289 int (*prepare_write_buffer)(struct usb_serial_port *port,
290 void *dest, size_t size);
272}; 291};
273#define to_usb_serial_driver(d) \ 292#define to_usb_serial_driver(d) \
274 container_of(d, struct usb_serial_driver, driver) 293 container_of(d, struct usb_serial_driver, driver)
@@ -318,8 +337,11 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial);
318extern void usb_serial_generic_release(struct usb_serial *serial); 337extern void usb_serial_generic_release(struct usb_serial *serial);
319extern int usb_serial_generic_register(int debug); 338extern int usb_serial_generic_register(int debug);
320extern void usb_serial_generic_deregister(void); 339extern void usb_serial_generic_deregister(void);
321extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, 340extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
322 gfp_t mem_flags); 341 gfp_t mem_flags);
342extern void usb_serial_generic_process_read_urb(struct urb *urb);
343extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
344 void *dest, size_t size);
323extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, 345extern int usb_serial_handle_sysrq_char(struct tty_struct *tty,
324 struct usb_serial_port *port, 346 struct usb_serial_port *port,
325 unsigned int ch); 347 unsigned int ch);
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 20675c6ebc4d..82b1507f4735 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -1,6 +1,186 @@
1/*
2 * ulpi.h -- ULPI defines and function prorotypes
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * This software is distributed under the terms of the GNU General
7 * Public License ("GPL") as published by the Free Software Foundation,
8 * version 2 of that License.
9 */
10
1#ifndef __LINUX_USB_ULPI_H 11#ifndef __LINUX_USB_ULPI_H
2#define __LINUX_USB_ULPI_H 12#define __LINUX_USB_ULPI_H
3 13
14#include <linux/usb/otg.h>
15/*-------------------------------------------------------------------------*/
16
17/*
18 * ULPI Flags
19 */
20#define ULPI_OTG_ID_PULLUP (1 << 0)
21#define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1)
22#define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2)
23#define ULPI_OTG_DISCHRGVBUS (1 << 3)
24#define ULPI_OTG_CHRGVBUS (1 << 4)
25#define ULPI_OTG_DRVVBUS (1 << 5)
26#define ULPI_OTG_DRVVBUS_EXT (1 << 6)
27#define ULPI_OTG_EXTVBUSIND (1 << 7)
28
29#define ULPI_IC_6PIN_SERIAL (1 << 8)
30#define ULPI_IC_3PIN_SERIAL (1 << 9)
31#define ULPI_IC_CARKIT (1 << 10)
32#define ULPI_IC_CLKSUSPM (1 << 11)
33#define ULPI_IC_AUTORESUME (1 << 12)
34#define ULPI_IC_EXTVBUS_INDINV (1 << 13)
35#define ULPI_IC_IND_PASSTHRU (1 << 14)
36#define ULPI_IC_PROTECT_DIS (1 << 15)
37
38#define ULPI_FC_HS (1 << 16)
39#define ULPI_FC_FS (1 << 17)
40#define ULPI_FC_LS (1 << 18)
41#define ULPI_FC_FS4LS (1 << 19)
42#define ULPI_FC_TERMSEL (1 << 20)
43#define ULPI_FC_OP_NORM (1 << 21)
44#define ULPI_FC_OP_NODRV (1 << 22)
45#define ULPI_FC_OP_DIS_NRZI (1 << 23)
46#define ULPI_FC_OP_NSYNC_NEOP (1 << 24)
47#define ULPI_FC_RST (1 << 25)
48#define ULPI_FC_SUSPM (1 << 26)
49
50/*-------------------------------------------------------------------------*/
51
52/*
53 * Macros for Set and Clear
54 * See ULPI 1.1 specification to find the registers with Set and Clear offsets
55 */
56#define ULPI_SET(a) (a + 1)
57#define ULPI_CLR(a) (a + 2)
58
59/*-------------------------------------------------------------------------*/
60
61/*
62 * Register Map
63 */
64#define ULPI_VENDOR_ID_LOW 0x00
65#define ULPI_VENDOR_ID_HIGH 0x01
66#define ULPI_PRODUCT_ID_LOW 0x02
67#define ULPI_PRODUCT_ID_HIGH 0x03
68#define ULPI_FUNC_CTRL 0x04
69#define ULPI_IFC_CTRL 0x07
70#define ULPI_OTG_CTRL 0x0a
71#define ULPI_USB_INT_EN_RISE 0x0d
72#define ULPI_USB_INT_EN_FALL 0x10
73#define ULPI_USB_INT_STS 0x13
74#define ULPI_USB_INT_LATCH 0x14
75#define ULPI_DEBUG 0x15
76#define ULPI_SCRATCH 0x16
77/* Optional Carkit Registers */
78#define ULPI_CARCIT_CTRL 0x19
79#define ULPI_CARCIT_INT_DELAY 0x1c
80#define ULPI_CARCIT_INT_EN 0x1d
81#define ULPI_CARCIT_INT_STS 0x20
82#define ULPI_CARCIT_INT_LATCH 0x21
83#define ULPI_CARCIT_PLS_CTRL 0x22
84/* Other Optional Registers */
85#define ULPI_TX_POS_WIDTH 0x25
86#define ULPI_TX_NEG_WIDTH 0x26
87#define ULPI_POLARITY_RECOVERY 0x27
88/* Access Extended Register Set */
89#define ULPI_ACCESS_EXTENDED 0x2f
90/* Vendor Specific */
91#define ULPI_VENDOR_SPECIFIC 0x30
92/* Extended Registers */
93#define ULPI_EXT_VENDOR_SPECIFIC 0x80
94
95/*-------------------------------------------------------------------------*/
96
97/*
98 * Register Bits
99 */
100
101/* Function Control */
102#define ULPI_FUNC_CTRL_XCVRSEL (1 << 0)
103#define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0)
104#define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0)
105#define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0)
106#define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0)
107#define ULPI_FUNC_CTRL_FS4LS (3 << 0)
108#define ULPI_FUNC_CTRL_TERMSELECT (1 << 2)
109#define ULPI_FUNC_CTRL_OPMODE (1 << 3)
110#define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3)
111#define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3)
112#define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3)
113#define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3)
114#define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3)
115#define ULPI_FUNC_CTRL_RESET (1 << 5)
116#define ULPI_FUNC_CTRL_SUSPENDM (1 << 6)
117
118/* Interface Control */
119#define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0)
120#define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1)
121#define ULPI_IFC_CTRL_CARKITMODE (1 << 2)
122#define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3)
123#define ULPI_IFC_CTRL_AUTORESUME (1 << 4)
124#define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5)
125#define ULPI_IFC_CTRL_PASSTHRU (1 << 6)
126#define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7)
127
128/* OTG Control */
129#define ULPI_OTG_CTRL_ID_PULLUP (1 << 0)
130#define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1)
131#define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2)
132#define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3)
133#define ULPI_OTG_CTRL_CHRGVBUS (1 << 4)
134#define ULPI_OTG_CTRL_DRVVBUS (1 << 5)
135#define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6)
136#define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7)
137
138/* USB Interrupt Enable Rising,
139 * USB Interrupt Enable Falling,
140 * USB Interrupt Status and
141 * USB Interrupt Latch
142 */
143#define ULPI_INT_HOST_DISCONNECT (1 << 0)
144#define ULPI_INT_VBUS_VALID (1 << 1)
145#define ULPI_INT_SESS_VALID (1 << 2)
146#define ULPI_INT_SESS_END (1 << 3)
147#define ULPI_INT_IDGRD (1 << 4)
148
149/* Debug */
150#define ULPI_DEBUG_LINESTATE0 (1 << 0)
151#define ULPI_DEBUG_LINESTATE1 (1 << 1)
152
153/* Carkit Control */
154#define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0)
155#define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1)
156#define ULPI_CARKIT_CTRL_TXDEN (1 << 2)
157#define ULPI_CARKIT_CTRL_RXDEN (1 << 3)
158#define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4)
159#define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5)
160#define ULPI_CARKIT_CTRL_MICEN (1 << 6)
161
162/* Carkit Interrupt Enable */
163#define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0)
164#define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1)
165#define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2)
166#define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3)
167#define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4)
168
169/* Carkit Interrupt Status and
170 * Carkit Interrupt Latch
171 */
172#define ULPI_CARKIT_INT_IDFLOAT (1 << 0)
173#define ULPI_CARKIT_INT_CARINTDET (1 << 1)
174#define ULPI_CARKIT_INT_DP (1 << 2)
175
176/* Carkit Pulse Control*/
177#define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0)
178#define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1)
179#define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2)
180#define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3)
181
182/*-------------------------------------------------------------------------*/
183
4struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
5 unsigned int flags); 185 unsigned int flags);
6 186
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index df1e83dd9a54..7ae27a473818 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -43,7 +43,7 @@ struct usbnet {
43 /* protocol/interface state */ 43 /* protocol/interface state */
44 struct net_device *net; 44 struct net_device *net;
45 int msg_enable; 45 int msg_enable;
46 unsigned long data [5]; 46 unsigned long data[5];
47 u32 xid; 47 u32 xid;
48 u32 hard_mtu; /* count any extra framing */ 48 u32 hard_mtu; /* count any extra framing */
49 size_t rx_urb_size; /* size for rx urbs */ 49 size_t rx_urb_size; /* size for rx urbs */
@@ -148,8 +148,8 @@ struct driver_info {
148 * much everything except custom framing and chip-specific stuff. 148 * much everything except custom framing and chip-specific stuff.
149 */ 149 */
150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); 150extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
151extern int usbnet_suspend (struct usb_interface *, pm_message_t ); 151extern int usbnet_suspend(struct usb_interface *, pm_message_t);
152extern int usbnet_resume (struct usb_interface *); 152extern int usbnet_resume(struct usb_interface *);
153extern void usbnet_disconnect(struct usb_interface *); 153extern void usbnet_disconnect(struct usb_interface *);
154 154
155 155
@@ -165,8 +165,8 @@ struct cdc_state {
165 struct usb_interface *data; 165 struct usb_interface *data;
166}; 166};
167 167
168extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *); 168extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
169extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); 169extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
170 170
171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
@@ -189,29 +189,31 @@ struct skb_data { /* skb->cb is one of these */
189 size_t length; 189 size_t length;
190}; 190};
191 191
192extern int usbnet_open (struct net_device *net); 192extern int usbnet_open(struct net_device *net);
193extern int usbnet_stop (struct net_device *net); 193extern int usbnet_stop(struct net_device *net);
194extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, 194extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
195 struct net_device *net); 195 struct net_device *net);
196extern void usbnet_tx_timeout (struct net_device *net); 196extern void usbnet_tx_timeout(struct net_device *net);
197extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 197extern int usbnet_change_mtu(struct net_device *net, int new_mtu);
198 198
199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 199extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
200extern int usbnet_get_ethernet_addr(struct usbnet *, int); 200extern int usbnet_get_ethernet_addr(struct usbnet *, int);
201extern void usbnet_defer_kevent (struct usbnet *, int); 201extern void usbnet_defer_kevent(struct usbnet *, int);
202extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 202extern void usbnet_skb_return(struct usbnet *, struct sk_buff *);
203extern void usbnet_unlink_rx_urbs(struct usbnet *); 203extern void usbnet_unlink_rx_urbs(struct usbnet *);
204 204
205extern void usbnet_pause_rx(struct usbnet *); 205extern void usbnet_pause_rx(struct usbnet *);
206extern void usbnet_resume_rx(struct usbnet *); 206extern void usbnet_resume_rx(struct usbnet *);
207extern void usbnet_purge_paused_rxq(struct usbnet *); 207extern void usbnet_purge_paused_rxq(struct usbnet *);
208 208
209extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); 209extern int usbnet_get_settings(struct net_device *net,
210extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); 210 struct ethtool_cmd *cmd);
211extern u32 usbnet_get_link (struct net_device *net); 211extern int usbnet_set_settings(struct net_device *net,
212extern u32 usbnet_get_msglevel (struct net_device *); 212 struct ethtool_cmd *cmd);
213extern void usbnet_set_msglevel (struct net_device *, u32); 213extern u32 usbnet_get_link(struct net_device *net);
214extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); 214extern u32 usbnet_get_msglevel(struct net_device *);
215extern void usbnet_set_msglevel(struct net_device *, u32);
216extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);
215extern int usbnet_nway_reset(struct net_device *net); 217extern int usbnet_nway_reset(struct net_device *net);
216 218
217#endif /* __LINUX_USB_USBNET_H */ 219#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/video.h b/include/linux/usb/video.h
index be436d9ee479..3b3b95e01f71 100644
--- a/include/linux/usb/video.h
+++ b/include/linux/usb/video.h
@@ -160,5 +160,409 @@
160#define UVC_STATUS_TYPE_CONTROL 1 160#define UVC_STATUS_TYPE_CONTROL 1
161#define UVC_STATUS_TYPE_STREAMING 2 161#define UVC_STATUS_TYPE_STREAMING 2
162 162
163/* 2.4.3.3. Payload Header Information */
164#define UVC_STREAM_EOH (1 << 7)
165#define UVC_STREAM_ERR (1 << 6)
166#define UVC_STREAM_STI (1 << 5)
167#define UVC_STREAM_RES (1 << 4)
168#define UVC_STREAM_SCR (1 << 3)
169#define UVC_STREAM_PTS (1 << 2)
170#define UVC_STREAM_EOF (1 << 1)
171#define UVC_STREAM_FID (1 << 0)
172
173/* 4.1.2. Control Capabilities */
174#define UVC_CONTROL_CAP_GET (1 << 0)
175#define UVC_CONTROL_CAP_SET (1 << 1)
176#define UVC_CONTROL_CAP_DISABLED (1 << 2)
177#define UVC_CONTROL_CAP_AUTOUPDATE (1 << 3)
178#define UVC_CONTROL_CAP_ASYNCHRONOUS (1 << 4)
179
180/* ------------------------------------------------------------------------
181 * UVC structures
182 */
183
184/* All UVC descriptors have these 3 fields at the beginning */
185struct uvc_descriptor_header {
186 __u8 bLength;
187 __u8 bDescriptorType;
188 __u8 bDescriptorSubType;
189} __attribute__((packed));
190
191/* 3.7.2. Video Control Interface Header Descriptor */
192struct uvc_header_descriptor {
193 __u8 bLength;
194 __u8 bDescriptorType;
195 __u8 bDescriptorSubType;
196 __u16 bcdUVC;
197 __u16 wTotalLength;
198 __u32 dwClockFrequency;
199 __u8 bInCollection;
200 __u8 baInterfaceNr[];
201} __attribute__((__packed__));
202
203#define UVC_DT_HEADER_SIZE(n) (12+(n))
204
205#define UVC_HEADER_DESCRIPTOR(n) \
206 uvc_header_descriptor_##n
207
208#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
209struct UVC_HEADER_DESCRIPTOR(n) { \
210 __u8 bLength; \
211 __u8 bDescriptorType; \
212 __u8 bDescriptorSubType; \
213 __u16 bcdUVC; \
214 __u16 wTotalLength; \
215 __u32 dwClockFrequency; \
216 __u8 bInCollection; \
217 __u8 baInterfaceNr[n]; \
218} __attribute__ ((packed))
219
220/* 3.7.2.1. Input Terminal Descriptor */
221struct uvc_input_terminal_descriptor {
222 __u8 bLength;
223 __u8 bDescriptorType;
224 __u8 bDescriptorSubType;
225 __u8 bTerminalID;
226 __u16 wTerminalType;
227 __u8 bAssocTerminal;
228 __u8 iTerminal;
229} __attribute__((__packed__));
230
231#define UVC_DT_INPUT_TERMINAL_SIZE 8
232
233/* 3.7.2.2. Output Terminal Descriptor */
234struct uvc_output_terminal_descriptor {
235 __u8 bLength;
236 __u8 bDescriptorType;
237 __u8 bDescriptorSubType;
238 __u8 bTerminalID;
239 __u16 wTerminalType;
240 __u8 bAssocTerminal;
241 __u8 bSourceID;
242 __u8 iTerminal;
243} __attribute__((__packed__));
244
245#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
246
247/* 3.7.2.3. Camera Terminal Descriptor */
248struct uvc_camera_terminal_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubType;
252 __u8 bTerminalID;
253 __u16 wTerminalType;
254 __u8 bAssocTerminal;
255 __u8 iTerminal;
256 __u16 wObjectiveFocalLengthMin;
257 __u16 wObjectiveFocalLengthMax;
258 __u16 wOcularFocalLength;
259 __u8 bControlSize;
260 __u8 bmControls[3];
261} __attribute__((__packed__));
262
263#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
264
265/* 3.7.2.4. Selector Unit Descriptor */
266struct uvc_selector_unit_descriptor {
267 __u8 bLength;
268 __u8 bDescriptorType;
269 __u8 bDescriptorSubType;
270 __u8 bUnitID;
271 __u8 bNrInPins;
272 __u8 baSourceID[0];
273 __u8 iSelector;
274} __attribute__((__packed__));
275
276#define UVC_DT_SELECTOR_UNIT_SIZE(n) (6+(n))
277
278#define UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
279 uvc_selector_unit_descriptor_##n
280
281#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n) \
282struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
283 __u8 bLength; \
284 __u8 bDescriptorType; \
285 __u8 bDescriptorSubType; \
286 __u8 bUnitID; \
287 __u8 bNrInPins; \
288 __u8 baSourceID[n]; \
289 __u8 iSelector; \
290} __attribute__ ((packed))
291
292/* 3.7.2.5. Processing Unit Descriptor */
293struct uvc_processing_unit_descriptor {
294 __u8 bLength;
295 __u8 bDescriptorType;
296 __u8 bDescriptorSubType;
297 __u8 bUnitID;
298 __u8 bSourceID;
299 __u16 wMaxMultiplier;
300 __u8 bControlSize;
301 __u8 bmControls[2];
302 __u8 iProcessing;
303} __attribute__((__packed__));
304
305#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
306
307/* 3.7.2.6. Extension Unit Descriptor */
308struct uvc_extension_unit_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311 __u8 bDescriptorSubType;
312 __u8 bUnitID;
313 __u8 guidExtensionCode[16];
314 __u8 bNumControls;
315 __u8 bNrInPins;
316 __u8 baSourceID[0];
317 __u8 bControlSize;
318 __u8 bmControls[0];
319 __u8 iExtension;
320} __attribute__((__packed__));
321
322#define UVC_DT_EXTENSION_UNIT_SIZE(p, n) (24+(p)+(n))
323
324#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
325 uvc_extension_unit_descriptor_##p_##n
326
327#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
328struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
329 __u8 bLength; \
330 __u8 bDescriptorType; \
331 __u8 bDescriptorSubType; \
332 __u8 bUnitID; \
333 __u8 guidExtensionCode[16]; \
334 __u8 bNumControls; \
335 __u8 bNrInPins; \
336 __u8 baSourceID[p]; \
337 __u8 bControlSize; \
338 __u8 bmControls[n]; \
339 __u8 iExtension; \
340} __attribute__ ((packed))
341
342/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
343struct uvc_control_endpoint_descriptor {
344 __u8 bLength;
345 __u8 bDescriptorType;
346 __u8 bDescriptorSubType;
347 __u16 wMaxTransferSize;
348} __attribute__((__packed__));
349
350#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
351
352/* 3.9.2.1. Input Header Descriptor */
353struct uvc_input_header_descriptor {
354 __u8 bLength;
355 __u8 bDescriptorType;
356 __u8 bDescriptorSubType;
357 __u8 bNumFormats;
358 __u16 wTotalLength;
359 __u8 bEndpointAddress;
360 __u8 bmInfo;
361 __u8 bTerminalLink;
362 __u8 bStillCaptureMethod;
363 __u8 bTriggerSupport;
364 __u8 bTriggerUsage;
365 __u8 bControlSize;
366 __u8 bmaControls[];
367} __attribute__((__packed__));
368
369#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
370
371#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
372 uvc_input_header_descriptor_##n_##p
373
374#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
375struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
376 __u8 bLength; \
377 __u8 bDescriptorType; \
378 __u8 bDescriptorSubType; \
379 __u8 bNumFormats; \
380 __u16 wTotalLength; \
381 __u8 bEndpointAddress; \
382 __u8 bmInfo; \
383 __u8 bTerminalLink; \
384 __u8 bStillCaptureMethod; \
385 __u8 bTriggerSupport; \
386 __u8 bTriggerUsage; \
387 __u8 bControlSize; \
388 __u8 bmaControls[p][n]; \
389} __attribute__ ((packed))
390
391/* 3.9.2.2. Output Header Descriptor */
392struct uvc_output_header_descriptor {
393 __u8 bLength;
394 __u8 bDescriptorType;
395 __u8 bDescriptorSubType;
396 __u8 bNumFormats;
397 __u16 wTotalLength;
398 __u8 bEndpointAddress;
399 __u8 bTerminalLink;
400 __u8 bControlSize;
401 __u8 bmaControls[];
402} __attribute__((__packed__));
403
404#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
405
406#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
407 uvc_output_header_descriptor_##n_##p
408
409#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
410struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
411 __u8 bLength; \
412 __u8 bDescriptorType; \
413 __u8 bDescriptorSubType; \
414 __u8 bNumFormats; \
415 __u16 wTotalLength; \
416 __u8 bEndpointAddress; \
417 __u8 bTerminalLink; \
418 __u8 bControlSize; \
419 __u8 bmaControls[p][n]; \
420} __attribute__ ((packed))
421
422/* 3.9.2.6. Color matching descriptor */
423struct uvc_color_matching_descriptor {
424 __u8 bLength;
425 __u8 bDescriptorType;
426 __u8 bDescriptorSubType;
427 __u8 bColorPrimaries;
428 __u8 bTransferCharacteristics;
429 __u8 bMatrixCoefficients;
430} __attribute__((__packed__));
431
432#define UVC_DT_COLOR_MATCHING_SIZE 6
433
434/* 4.3.1.1. Video Probe and Commit Controls */
435struct uvc_streaming_control {
436 __u16 bmHint;
437 __u8 bFormatIndex;
438 __u8 bFrameIndex;
439 __u32 dwFrameInterval;
440 __u16 wKeyFrameRate;
441 __u16 wPFrameRate;
442 __u16 wCompQuality;
443 __u16 wCompWindowSize;
444 __u16 wDelay;
445 __u32 dwMaxVideoFrameSize;
446 __u32 dwMaxPayloadTransferSize;
447 __u32 dwClockFrequency;
448 __u8 bmFramingInfo;
449 __u8 bPreferedVersion;
450 __u8 bMinVersion;
451 __u8 bMaxVersion;
452} __attribute__((__packed__));
453
454/* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
455struct uvc_format_uncompressed {
456 __u8 bLength;
457 __u8 bDescriptorType;
458 __u8 bDescriptorSubType;
459 __u8 bFormatIndex;
460 __u8 bNumFrameDescriptors;
461 __u8 guidFormat[16];
462 __u8 bBitsPerPixel;
463 __u8 bDefaultFrameIndex;
464 __u8 bAspectRatioX;
465 __u8 bAspectRatioY;
466 __u8 bmInterfaceFlags;
467 __u8 bCopyProtect;
468} __attribute__((__packed__));
469
470#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE 27
471
472/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
473struct uvc_frame_uncompressed {
474 __u8 bLength;
475 __u8 bDescriptorType;
476 __u8 bDescriptorSubType;
477 __u8 bFrameIndex;
478 __u8 bmCapabilities;
479 __u16 wWidth;
480 __u16 wHeight;
481 __u32 dwMinBitRate;
482 __u32 dwMaxBitRate;
483 __u32 dwMaxVideoFrameBufferSize;
484 __u32 dwDefaultFrameInterval;
485 __u8 bFrameIntervalType;
486 __u32 dwFrameInterval[];
487} __attribute__((__packed__));
488
489#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
490
491#define UVC_FRAME_UNCOMPRESSED(n) \
492 uvc_frame_uncompressed_##n
493
494#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
495struct UVC_FRAME_UNCOMPRESSED(n) { \
496 __u8 bLength; \
497 __u8 bDescriptorType; \
498 __u8 bDescriptorSubType; \
499 __u8 bFrameIndex; \
500 __u8 bmCapabilities; \
501 __u16 wWidth; \
502 __u16 wHeight; \
503 __u32 dwMinBitRate; \
504 __u32 dwMaxBitRate; \
505 __u32 dwMaxVideoFrameBufferSize; \
506 __u32 dwDefaultFrameInterval; \
507 __u8 bFrameIntervalType; \
508 __u32 dwFrameInterval[n]; \
509} __attribute__ ((packed))
510
511/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
512struct uvc_format_mjpeg {
513 __u8 bLength;
514 __u8 bDescriptorType;
515 __u8 bDescriptorSubType;
516 __u8 bFormatIndex;
517 __u8 bNumFrameDescriptors;
518 __u8 bmFlags;
519 __u8 bDefaultFrameIndex;
520 __u8 bAspectRatioX;
521 __u8 bAspectRatioY;
522 __u8 bmInterfaceFlags;
523 __u8 bCopyProtect;
524} __attribute__((__packed__));
525
526#define UVC_DT_FORMAT_MJPEG_SIZE 11
527
528/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
529struct uvc_frame_mjpeg {
530 __u8 bLength;
531 __u8 bDescriptorType;
532 __u8 bDescriptorSubType;
533 __u8 bFrameIndex;
534 __u8 bmCapabilities;
535 __u16 wWidth;
536 __u16 wHeight;
537 __u32 dwMinBitRate;
538 __u32 dwMaxBitRate;
539 __u32 dwMaxVideoFrameBufferSize;
540 __u32 dwDefaultFrameInterval;
541 __u8 bFrameIntervalType;
542 __u32 dwFrameInterval[];
543} __attribute__((__packed__));
544
545#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
546
547#define UVC_FRAME_MJPEG(n) \
548 uvc_frame_mjpeg_##n
549
550#define DECLARE_UVC_FRAME_MJPEG(n) \
551struct UVC_FRAME_MJPEG(n) { \
552 __u8 bLength; \
553 __u8 bDescriptorType; \
554 __u8 bDescriptorSubType; \
555 __u8 bFrameIndex; \
556 __u8 bmCapabilities; \
557 __u16 wWidth; \
558 __u16 wHeight; \
559 __u32 dwMinBitRate; \
560 __u32 dwMaxBitRate; \
561 __u32 dwMaxVideoFrameBufferSize; \
562 __u32 dwDefaultFrameInterval; \
563 __u8 bFrameIntervalType; \
564 __u32 dwFrameInterval[n]; \
565} __attribute__ ((packed))
566
163#endif /* __LINUX_USB_VIDEO_H */ 567#endif /* __LINUX_USB_VIDEO_H */
164 568
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index fb7c359bdfba..f9dec37f617b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -87,7 +87,7 @@ enum rpipe_crs {
87 * FIXME: explain rpipes 87 * FIXME: explain rpipes
88 */ 88 */
89struct usb_rpipe_descriptor { 89struct usb_rpipe_descriptor {
90 u8 bLength; 90 u8 bLength;
91 u8 bDescriptorType; 91 u8 bDescriptorType;
92 __le16 wRPipeIndex; 92 __le16 wRPipeIndex;
93 __le16 wRequests; 93 __le16 wRequests;
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index cc4f45361dbb..8178156711f9 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -36,6 +36,9 @@ static inline void put_user_ns(struct user_namespace *ns)
36 kref_put(&ns->kref, free_user_ns); 36 kref_put(&ns->kref, free_user_ns);
37} 37}
38 38
39uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t uid);
40gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t gid);
41
39#else 42#else
40 43
41static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 44static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
@@ -52,6 +55,17 @@ static inline void put_user_ns(struct user_namespace *ns)
52{ 55{
53} 56}
54 57
58static inline uid_t user_ns_map_uid(struct user_namespace *to,
59 const struct cred *cred, uid_t uid)
60{
61 return uid;
62}
63static inline gid_t user_ns_map_gid(struct user_namespace *to,
64 const struct cred *cred, gid_t gid)
65{
66 return gid;
67}
68
55#endif 69#endif
56 70
57#endif /* _LINUX_USER_H */ 71#endif /* _LINUX_USER_H */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
new file mode 100644
index 000000000000..5b7efbfcee4e
--- /dev/null
+++ b/include/linux/uuid.h
@@ -0,0 +1,70 @@
1/*
2 * UUID/GUID definition
3 *
4 * Copyright (C) 2010, Intel Corp.
5 * Huang Ying <ying.huang@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License version
9 * 2 as published by the Free Software Foundation;
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef _LINUX_UUID_H_
22#define _LINUX_UUID_H_
23
24#include <linux/types.h>
25#include <linux/string.h>
26
27typedef struct {
28 __u8 b[16];
29} uuid_le;
30
31typedef struct {
32 __u8 b[16];
33} uuid_be;
34
35#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
36((uuid_le) \
37{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
38 (b) & 0xff, ((b) >> 8) & 0xff, \
39 (c) & 0xff, ((c) >> 8) & 0xff, \
40 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
41
42#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
43((uuid_be) \
44{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
45 ((b) >> 8) & 0xff, (b) & 0xff, \
46 ((c) >> 8) & 0xff, (c) & 0xff, \
47 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
48
49#define NULL_UUID_LE \
50 UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
51 0x00, 0x00, 0x00, 0x00)
52
53#define NULL_UUID_BE \
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00)
56
57static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
58{
59 return memcmp(&u1, &u2, sizeof(uuid_le));
60}
61
62static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
63{
64 return memcmp(&u1, &u2, sizeof(uuid_be));
65}
66
67extern void uuid_le_gen(uuid_le *u);
68extern void uuid_be_gen(uuid_be *u);
69
70#endif
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2dfaa293ae8c..814f294d4cd0 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -5,9 +5,31 @@
5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org> 5 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com> 6 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org> 7 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS
27 * IN THE SOFTWARE.
28 *
8 */ 29 */
9 30
10#ifndef LINUX_VGA_H 31#ifndef LINUX_VGA_H
32#define LINUX_VGA_H
11 33
12#include <asm/vga.h> 34#include <asm/vga.h>
13 35
diff --git a/include/linux/via-core.h b/include/linux/via-core.h
new file mode 100644
index 000000000000..7ffb521e1a7a
--- /dev/null
+++ b/include/linux/via-core.h
@@ -0,0 +1,219 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2009-2010 Jonathan Corbet <corbet@lwn.net>
5 * Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation;
10 * either version 2, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
14 * the implied warranty of MERCHANTABILITY or FITNESS FOR
15 * A PARTICULAR PURPOSE.See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __VIA_CORE_H__
25#define __VIA_CORE_H__
26#include <linux/types.h>
27#include <linux/io.h>
28#include <linux/spinlock.h>
29#include <linux/pci.h>
30
31/*
32 * A description of each known serial I2C/GPIO port.
33 */
34enum via_port_type {
35 VIA_PORT_NONE = 0,
36 VIA_PORT_I2C,
37 VIA_PORT_GPIO,
38};
39
40enum via_port_mode {
41 VIA_MODE_OFF = 0,
42 VIA_MODE_I2C, /* Used as I2C port */
43 VIA_MODE_GPIO, /* Two GPIO ports */
44};
45
46enum viafb_i2c_adap {
47 VIA_PORT_26 = 0,
48 VIA_PORT_31,
49 VIA_PORT_25,
50 VIA_PORT_2C,
51 VIA_PORT_3D,
52};
53#define VIAFB_NUM_PORTS 5
54
55struct via_port_cfg {
56 enum via_port_type type;
57 enum via_port_mode mode;
58 u16 io_port;
59 u8 ioport_index;
60};
61
62/*
63 * This is the global viafb "device" containing stuff needed by
64 * all subdevs.
65 */
66struct viafb_dev {
67 struct pci_dev *pdev;
68 int chip_type;
69 struct via_port_cfg *port_cfg;
70 /*
71 * Spinlock for access to device registers. Not yet
72 * globally used.
73 */
74 spinlock_t reg_lock;
75 /*
76 * The framebuffer MMIO region. Little, if anything, touches
77 * this memory directly, and certainly nothing outside of the
78 * framebuffer device itself. We *do* have to be able to allocate
79 * chunks of this memory for other devices, though.
80 */
81 unsigned long fbmem_start;
82 long fbmem_len;
83 void __iomem *fbmem;
84#if defined(CONFIG_FB_VIA_CAMERA) || defined(CONFIG_FB_VIA_CAMERA_MODULE)
85 long camera_fbmem_offset;
86 long camera_fbmem_size;
87#endif
88 /*
89 * The MMIO region for device registers.
90 */
91 unsigned long engine_start;
92 unsigned long engine_len;
93 void __iomem *engine_mmio;
94
95};
96
97/*
98 * Interrupt management.
99 */
100
101void viafb_irq_enable(u32 mask);
102void viafb_irq_disable(u32 mask);
103
104/*
105 * The global interrupt control register and its bits.
106 */
107#define VDE_INTERRUPT 0x200 /* Video interrupt flags/masks */
108#define VDE_I_DVISENSE 0x00000001 /* DVI sense int status */
109#define VDE_I_VBLANK 0x00000002 /* Vertical blank status */
110#define VDE_I_MCCFI 0x00000004 /* MCE compl. frame int status */
111#define VDE_I_VSYNC 0x00000008 /* VGA VSYNC int status */
112#define VDE_I_DMA0DDONE 0x00000010 /* DMA 0 descr done */
113#define VDE_I_DMA0TDONE 0x00000020 /* DMA 0 transfer done */
114#define VDE_I_DMA1DDONE 0x00000040 /* DMA 1 descr done */
115#define VDE_I_DMA1TDONE 0x00000080 /* DMA 1 transfer done */
116#define VDE_I_C1AV 0x00000100 /* Cap Eng 1 act vid end */
117#define VDE_I_HQV0 0x00000200 /* First HQV engine */
118#define VDE_I_HQV1 0x00000400 /* Second HQV engine */
119#define VDE_I_HQV1EN 0x00000800 /* Second HQV engine enable */
120#define VDE_I_C0AV 0x00001000 /* Cap Eng 0 act vid end */
121#define VDE_I_C0VBI 0x00002000 /* Cap Eng 0 VBI end */
122#define VDE_I_C1VBI 0x00004000 /* Cap Eng 1 VBI end */
123#define VDE_I_VSYNC2 0x00008000 /* Sec. Disp. VSYNC */
124#define VDE_I_DVISNSEN 0x00010000 /* DVI sense enable */
125#define VDE_I_VSYNC2EN 0x00020000 /* Sec Disp VSYNC enable */
126#define VDE_I_MCCFIEN 0x00040000 /* MC comp frame int mask enable */
127#define VDE_I_VSYNCEN 0x00080000 /* VSYNC enable */
128#define VDE_I_DMA0DDEN 0x00100000 /* DMA 0 descr done enable */
129#define VDE_I_DMA0TDEN 0x00200000 /* DMA 0 trans done enable */
130#define VDE_I_DMA1DDEN 0x00400000 /* DMA 1 descr done enable */
131#define VDE_I_DMA1TDEN 0x00800000 /* DMA 1 trans done enable */
132#define VDE_I_C1AVEN 0x01000000 /* cap 1 act vid end enable */
133#define VDE_I_HQV0EN 0x02000000 /* First hqv engine enable */
134#define VDE_I_C1VBIEN 0x04000000 /* Cap 1 VBI end enable */
135#define VDE_I_LVDSSI 0x08000000 /* LVDS sense interrupt */
136#define VDE_I_C0AVEN 0x10000000 /* Cap 0 act vid end enable */
137#define VDE_I_C0VBIEN 0x20000000 /* Cap 0 VBI end enable */
138#define VDE_I_LVDSSIEN 0x40000000 /* LVDS Sense enable */
139#define VDE_I_ENABLE 0x80000000 /* Global interrupt enable */
140
141/*
142 * DMA management.
143 */
144int viafb_request_dma(void);
145void viafb_release_dma(void);
146/* void viafb_dma_copy_out(unsigned int offset, dma_addr_t paddr, int len); */
147int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
148
149/*
150 * DMA Controller registers.
151 */
152#define VDMA_MR0 0xe00 /* Mod reg 0 */
153#define VDMA_MR_CHAIN 0x01 /* Chaining mode */
154#define VDMA_MR_TDIE 0x02 /* Transfer done int enable */
155#define VDMA_CSR0 0xe04 /* Control/status */
156#define VDMA_C_ENABLE 0x01 /* DMA Enable */
157#define VDMA_C_START 0x02 /* Start a transfer */
158#define VDMA_C_ABORT 0x04 /* Abort a transfer */
159#define VDMA_C_DONE 0x08 /* Transfer is done */
160#define VDMA_MARL0 0xe20 /* Mem addr low */
161#define VDMA_MARH0 0xe24 /* Mem addr high */
162#define VDMA_DAR0 0xe28 /* Device address */
163#define VDMA_DQWCR0 0xe2c /* Count (16-byte) */
164#define VDMA_TMR0 0xe30 /* Tile mode reg */
165#define VDMA_DPRL0 0xe34 /* Not sure */
166#define VDMA_DPR_IN 0x08 /* Inbound transfer to FB */
167#define VDMA_DPRH0 0xe38
168#define VDMA_PMR0 (0xe00 + 0x134) /* Pitch mode */
169
170/*
171 * Useful stuff that probably belongs somewhere global.
172 */
173#define VGA_WIDTH 640
174#define VGA_HEIGHT 480
175
176/*
177 * Indexed port operations. Note that these are all multi-op
178 * functions; every invocation will be racy if you're not holding
179 * reg_lock.
180 */
181
182#define VIAStatus 0x3DA /* Non-indexed port */
183#define VIACR 0x3D4
184#define VIASR 0x3C4
185#define VIAGR 0x3CE
186#define VIAAR 0x3C0
187
188static inline u8 via_read_reg(u16 port, u8 index)
189{
190 outb(index, port);
191 return inb(port + 1);
192}
193
194static inline void via_write_reg(u16 port, u8 index, u8 data)
195{
196 outb(index, port);
197 outb(data, port + 1);
198}
199
200static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
201{
202 u8 old;
203
204 outb(index, port);
205 old = inb(port + 1);
206 outb((data & mask) | (old & ~mask), port + 1);
207}
208
209#define VIA_MISC_REG_READ 0x03CC
210#define VIA_MISC_REG_WRITE 0x03C2
211
212static inline void via_write_misc_reg_mask(u8 data, u8 mask)
213{
214 u8 old = inb(VIA_MISC_REG_READ);
215 outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
216}
217
218
219#endif /* __VIA_CORE_H__ */
diff --git a/include/linux/via-gpio.h b/include/linux/via-gpio.h
new file mode 100644
index 000000000000..8281aea3dd6d
--- /dev/null
+++ b/include/linux/via-gpio.h
@@ -0,0 +1,14 @@
1/*
2 * Support for viafb GPIO ports.
3 *
4 * Copyright 2009 Jonathan Corbet <corbet@lwn.net>
5 * Distributable under version 2 of the GNU General Public License.
6 */
7
8#ifndef __VIA_GPIO_H__
9#define __VIA_GPIO_H__
10
11extern int viafb_gpio_lookup(const char *name);
12extern int viafb_gpio_init(void);
13extern void viafb_gpio_exit(void);
14#endif
diff --git a/include/linux/via_i2c.h b/include/linux/via_i2c.h
new file mode 100644
index 000000000000..44532e468c05
--- /dev/null
+++ b/include/linux/via_i2c.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public
7 * License as published by the Free Software Foundation;
8 * either version 2, or (at your option) any later version.
9
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
12 * the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE.See the GNU General Public License
14 * for more details.
15
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#ifndef __VIA_I2C_H__
22#define __VIA_I2C_H__
23
24#include <linux/i2c.h>
25#include <linux/i2c-algo-bit.h>
26
27struct via_i2c_stuff {
28 u16 i2c_port; /* GPIO or I2C port */
29 u16 is_active; /* Being used as I2C? */
30 struct i2c_adapter adapter;
31 struct i2c_algo_bit_data algo;
32};
33
34
35int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata);
36int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data);
37int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len);
38struct i2c_adapter *viafb_find_i2c_adapter(enum viafb_i2c_adap which);
39
40extern int viafb_i2c_init(void);
41extern void viafb_i2c_exit(void);
42#endif /* __VIA_I2C_H__ */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 3793d168b44d..61490c6dcdbd 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -160,16 +160,6 @@ enum v4l2_buf_type {
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 160 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 161};
162 162
163enum v4l2_ctrl_type {
164 V4L2_CTRL_TYPE_INTEGER = 1,
165 V4L2_CTRL_TYPE_BOOLEAN = 2,
166 V4L2_CTRL_TYPE_MENU = 3,
167 V4L2_CTRL_TYPE_BUTTON = 4,
168 V4L2_CTRL_TYPE_INTEGER64 = 5,
169 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
170 V4L2_CTRL_TYPE_STRING = 7,
171};
172
173enum v4l2_tuner_type { 163enum v4l2_tuner_type {
174 V4L2_TUNER_RADIO = 1, 164 V4L2_TUNER_RADIO = 1,
175 V4L2_TUNER_ANALOG_TV = 2, 165 V4L2_TUNER_ANALOG_TV = 2,
@@ -287,6 +277,7 @@ struct v4l2_pix_format {
287#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ 277#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
288#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ 278#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
289#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ 279#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
280#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
290#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ 281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
291#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ 282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
292#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ 283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
@@ -294,6 +285,8 @@ struct v4l2_pix_format {
294 285
295/* Grey formats */ 286/* Grey formats */
296#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 287#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
288#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
289#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
297#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ 290#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
298#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ 291#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
299 292
@@ -369,6 +362,7 @@ struct v4l2_pix_format {
369#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ 362#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
370#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ 363#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
371#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ 364#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
365#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
372 366
373/* 367/*
374 * F O R M A T E N U M E R A T I O N 368 * F O R M A T E N U M E R A T I O N
@@ -549,6 +543,8 @@ struct v4l2_buffer {
549#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 543#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
550#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 544#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
551#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 545#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
546/* Buffer is ready, but the data contained within is corrupted. */
547#define V4L2_BUF_FLAG_ERROR 0x0040
552#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 548#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
553#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ 549#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
554 550
@@ -939,6 +935,16 @@ struct v4l2_ext_controls {
939#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 935#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
940#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 936#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
941 937
938enum v4l2_ctrl_type {
939 V4L2_CTRL_TYPE_INTEGER = 1,
940 V4L2_CTRL_TYPE_BOOLEAN = 2,
941 V4L2_CTRL_TYPE_MENU = 3,
942 V4L2_CTRL_TYPE_BUTTON = 4,
943 V4L2_CTRL_TYPE_INTEGER64 = 5,
944 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
945 V4L2_CTRL_TYPE_STRING = 7,
946};
947
942/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 948/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
943struct v4l2_queryctrl { 949struct v4l2_queryctrl {
944 __u32 id; 950 __u32 id;
@@ -1023,14 +1029,24 @@ enum v4l2_colorfx {
1023 V4L2_COLORFX_NONE = 0, 1029 V4L2_COLORFX_NONE = 0,
1024 V4L2_COLORFX_BW = 1, 1030 V4L2_COLORFX_BW = 1,
1025 V4L2_COLORFX_SEPIA = 2, 1031 V4L2_COLORFX_SEPIA = 2,
1032 V4L2_COLORFX_NEGATIVE = 3,
1033 V4L2_COLORFX_EMBOSS = 4,
1034 V4L2_COLORFX_SKETCH = 5,
1035 V4L2_COLORFX_SKY_BLUE = 6,
1036 V4L2_COLORFX_GRASS_GREEN = 7,
1037 V4L2_COLORFX_SKIN_WHITEN = 8,
1038 V4L2_COLORFX_VIVID = 9,
1026}; 1039};
1027#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) 1040#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1028#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) 1041#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1029 1042
1030#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) 1043#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1031#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) 1044#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1045
1046#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1047
1032/* last CID + 1 */ 1048/* last CID + 1 */
1033#define V4L2_CID_LASTP1 (V4L2_CID_BASE+36) 1049#define V4L2_CID_LASTP1 (V4L2_CID_BASE+37)
1034 1050
1035/* MPEG-class control IDs defined by V4L2 */ 1051/* MPEG-class control IDs defined by V4L2 */
1036#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1052#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1276,6 +1292,9 @@ enum v4l2_exposure_auto_type {
1276 1292
1277#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) 1293#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1278 1294
1295#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1296#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1297
1279/* FM Modulator class control IDs */ 1298/* FM Modulator class control IDs */
1280#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) 1299#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1281#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) 1300#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
@@ -1621,6 +1640,38 @@ struct v4l2_streamparm {
1621}; 1640};
1622 1641
1623/* 1642/*
1643 * E V E N T S
1644 */
1645
1646#define V4L2_EVENT_ALL 0
1647#define V4L2_EVENT_VSYNC 1
1648#define V4L2_EVENT_EOS 2
1649#define V4L2_EVENT_PRIVATE_START 0x08000000
1650
1651/* Payload for V4L2_EVENT_VSYNC */
1652struct v4l2_event_vsync {
1653 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1654 __u8 field;
1655} __attribute__ ((packed));
1656
1657struct v4l2_event {
1658 __u32 type;
1659 union {
1660 struct v4l2_event_vsync vsync;
1661 __u8 data[64];
1662 } u;
1663 __u32 pending;
1664 __u32 sequence;
1665 struct timespec timestamp;
1666 __u32 reserved[9];
1667};
1668
1669struct v4l2_event_subscription {
1670 __u32 type;
1671 __u32 reserved[7];
1672};
1673
1674/*
1624 * A D V A N C E D D E B U G G I N G 1675 * A D V A N C E D D E B U G G I N G
1625 * 1676 *
1626 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! 1677 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
@@ -1742,6 +1793,9 @@ struct v4l2_dbg_chip_ident {
1742#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) 1793#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1743#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) 1794#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1744#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) 1795#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1796#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
1797#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
1798#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
1745 1799
1746/* Reminder: when adding new ioctls please add support for them to 1800/* Reminder: when adding new ioctls please add support for them to
1747 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1801 drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 40d1709bdbf4..aff5b4f74041 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/device.h> 8#include <linux/device.h>
9#include <linux/mod_devicetable.h> 9#include <linux/mod_devicetable.h>
10#include <linux/gfp.h>
10 11
11/** 12/**
12 * virtqueue - a queue to register buffers for sending or receiving. 13 * virtqueue - a queue to register buffers for sending or receiving.
@@ -14,7 +15,6 @@
14 * @callback: the function to call when buffers are consumed (can be NULL). 15 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging) 16 * @name: the name of this virtqueue (mainly for debugging)
16 * @vdev: the virtio device this queue was created for. 17 * @vdev: the virtio device this queue was created for.
17 * @vq_ops: the operations for this virtqueue (see below).
18 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
19 */ 19 */
20struct virtqueue { 20struct virtqueue {
@@ -22,60 +22,71 @@ struct virtqueue {
22 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name; 23 const char *name;
24 struct virtio_device *vdev; 24 struct virtio_device *vdev;
25 struct virtqueue_ops *vq_ops;
26 void *priv; 25 void *priv;
27}; 26};
28 27
29/** 28/**
30 * virtqueue_ops - operations for virtqueue abstraction layer 29 * operations for virtqueue
31 * @add_buf: expose buffer to other end 30 * virtqueue_add_buf: expose buffer to other end
32 * vq: the struct virtqueue we're talking about. 31 * vq: the struct virtqueue we're talking about.
33 * sg: the description of the buffer(s). 32 * sg: the description of the buffer(s).
34 * out_num: the number of sg readable by other side 33 * out_num: the number of sg readable by other side
35 * in_num: the number of sg which are writable (after readable ones) 34 * in_num: the number of sg which are writable (after readable ones)
36 * data: the token identifying the buffer. 35 * data: the token identifying the buffer.
36 * gfp: how to do memory allocations (if necessary).
37 * Returns remaining capacity of queue (sg segments) or a negative error. 37 * Returns remaining capacity of queue (sg segments) or a negative error.
38 * @kick: update after add_buf 38 * virtqueue_kick: update after add_buf
39 * vq: the struct virtqueue 39 * vq: the struct virtqueue
40 * After one or more add_buf calls, invoke this to kick the other side. 40 * After one or more add_buf calls, invoke this to kick the other side.
41 * @get_buf: get the next used buffer 41 * virtqueue_get_buf: get the next used buffer
42 * vq: the struct virtqueue we're talking about. 42 * vq: the struct virtqueue we're talking about.
43 * len: the length written into the buffer 43 * len: the length written into the buffer
44 * Returns NULL or the "data" token handed to add_buf. 44 * Returns NULL or the "data" token handed to add_buf.
45 * @disable_cb: disable callbacks 45 * virtqueue_disable_cb: disable callbacks
46 * vq: the struct virtqueue we're talking about. 46 * vq: the struct virtqueue we're talking about.
47 * Note that this is not necessarily synchronous, hence unreliable and only 47 * Note that this is not necessarily synchronous, hence unreliable and only
48 * useful as an optimization. 48 * useful as an optimization.
49 * @enable_cb: restart callbacks after disable_cb. 49 * virtqueue_enable_cb: restart callbacks after disable_cb.
50 * vq: the struct virtqueue we're talking about. 50 * vq: the struct virtqueue we're talking about.
51 * This re-enables callbacks; it returns "false" if there are pending 51 * This re-enables callbacks; it returns "false" if there are pending
52 * buffers in the queue, to detect a possible race between the driver 52 * buffers in the queue, to detect a possible race between the driver
53 * checking for more work, and enabling callbacks. 53 * checking for more work, and enabling callbacks.
54 * @detach_unused_buf: detach first unused buffer 54 * virtqueue_detach_unused_buf: detach first unused buffer
55 * vq: the struct virtqueue we're talking about. 55 * vq: the struct virtqueue we're talking about.
56 * Returns NULL or the "data" token handed to add_buf 56 * Returns NULL or the "data" token handed to add_buf
57 * 57 *
58 * Locking rules are straightforward: the driver is responsible for 58 * Locking rules are straightforward: the driver is responsible for
59 * locking. No two operations may be invoked simultaneously, with the exception 59 * locking. No two operations may be invoked simultaneously, with the exception
60 * of @disable_cb. 60 * of virtqueue_disable_cb.
61 * 61 *
62 * All operations can be called in any context. 62 * All operations can be called in any context.
63 */ 63 */
64struct virtqueue_ops {
65 int (*add_buf)(struct virtqueue *vq,
66 struct scatterlist sg[],
67 unsigned int out_num,
68 unsigned int in_num,
69 void *data);
70 64
71 void (*kick)(struct virtqueue *vq); 65int virtqueue_add_buf_gfp(struct virtqueue *vq,
66 struct scatterlist sg[],
67 unsigned int out_num,
68 unsigned int in_num,
69 void *data,
70 gfp_t gfp);
72 71
73 void *(*get_buf)(struct virtqueue *vq, unsigned int *len); 72static inline int virtqueue_add_buf(struct virtqueue *vq,
73 struct scatterlist sg[],
74 unsigned int out_num,
75 unsigned int in_num,
76 void *data)
77{
78 return virtqueue_add_buf_gfp(vq, sg, out_num, in_num, data, GFP_ATOMIC);
79}
74 80
75 void (*disable_cb)(struct virtqueue *vq); 81void virtqueue_kick(struct virtqueue *vq);
76 bool (*enable_cb)(struct virtqueue *vq); 82
77 void *(*detach_unused_buf)(struct virtqueue *vq); 83void *virtqueue_get_buf(struct virtqueue *vq, unsigned int *len);
78}; 84
85void virtqueue_disable_cb(struct virtqueue *vq);
86
87bool virtqueue_enable_cb(struct virtqueue *vq);
88
89void *virtqueue_detach_unused_buf(struct virtqueue *vq);
79 90
80/** 91/**
81 * virtio_device - representation of a device using virtio 92 * virtio_device - representation of a device using virtio
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h
index 5cf11765146b..1faa80d92f05 100644
--- a/include/linux/virtio_9p.h
+++ b/include/linux/virtio_9p.h
@@ -2,8 +2,10 @@
2#define _LINUX_VIRTIO_9P_H 2#define _LINUX_VIRTIO_9P_H
3/* This header is BSD licensed so anyone can use the definitions to implement 3/* This header is BSD licensed so anyone can use the definitions to implement
4 * compatible drivers/servers. */ 4 * compatible drivers/servers. */
5#include <linux/types.h>
5#include <linux/virtio_ids.h> 6#include <linux/virtio_ids.h>
6#include <linux/virtio_config.h> 7#include <linux/virtio_config.h>
8#include <linux/types.h>
7 9
8/* The feature bitmap for virtio 9P */ 10/* The feature bitmap for virtio 9P */
9 11
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index e52029e98919..167720d695ed 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -17,6 +17,8 @@
17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */ 17#define VIRTIO_BLK_F_FLUSH 9 /* Cache flush command support */
18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ 18#define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */
19 19
20#define VIRTIO_BLK_ID_BYTES 20 /* ID string length */
21
20struct virtio_blk_config { 22struct virtio_blk_config {
21 /* The capacity (in 512-byte sectors). */ 23 /* The capacity (in 512-byte sectors). */
22 __u64 capacity; 24 __u64 capacity;
@@ -67,6 +69,9 @@ struct virtio_blk_config {
67/* Cache flush command */ 69/* Cache flush command */
68#define VIRTIO_BLK_T_FLUSH 4 70#define VIRTIO_BLK_T_FLUSH 4
69 71
72/* Get device ID command */
73#define VIRTIO_BLK_T_GET_ID 8
74
70/* Barrier before this op. */ 75/* Barrier before this op. */
71#define VIRTIO_BLK_T_BARRIER 0x80000000 76#define VIRTIO_BLK_T_BARRIER 0x80000000
72 77
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index 92228a8fbcbc..a85064db8f94 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -12,14 +12,39 @@
12 12
13/* Feature bits */ 13/* Feature bits */
14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */ 14#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
15#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
16
17#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
15 18
16struct virtio_console_config { 19struct virtio_console_config {
17 /* colums of the screens */ 20 /* colums of the screens */
18 __u16 cols; 21 __u16 cols;
19 /* rows of the screens */ 22 /* rows of the screens */
20 __u16 rows; 23 __u16 rows;
24 /* max. number of ports this device can hold */
25 __u32 max_nr_ports;
21} __attribute__((packed)); 26} __attribute__((packed));
22 27
28/*
29 * A message that's passed between the Host and the Guest for a
30 * particular port.
31 */
32struct virtio_console_control {
33 __u32 id; /* Port number */
34 __u16 event; /* The kind of control event (see below) */
35 __u16 value; /* Extra information for the key */
36};
37
38/* Some events for control messages */
39#define VIRTIO_CONSOLE_DEVICE_READY 0
40#define VIRTIO_CONSOLE_PORT_ADD 1
41#define VIRTIO_CONSOLE_PORT_REMOVE 2
42#define VIRTIO_CONSOLE_PORT_READY 3
43#define VIRTIO_CONSOLE_CONSOLE_PORT 4
44#define VIRTIO_CONSOLE_RESIZE 5
45#define VIRTIO_CONSOLE_PORT_OPEN 6
46#define VIRTIO_CONSOLE_PORT_NAME 7
47
23#ifdef __KERNEL__ 48#ifdef __KERNEL__
24int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 49int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
25#endif /* __KERNEL__ */ 50#endif /* __KERNEL__ */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 227c2a585e4f..de05e96e0a70 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -30,7 +30,7 @@ struct vm_struct {
30 unsigned long flags; 30 unsigned long flags;
31 struct page **pages; 31 struct page **pages;
32 unsigned int nr_pages; 32 unsigned int nr_pages;
33 unsigned long phys_addr; 33 phys_addr_t phys_addr;
34 void *caller; 34 void *caller;
35}; 35};
36 36
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 117f0dd8ad03..7f43ccdc1d38 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -43,6 +43,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
43 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 43 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
44 KSWAPD_SKIP_CONGESTION_WAIT, 44 KSWAPD_SKIP_CONGESTION_WAIT,
45 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 45 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
46#ifdef CONFIG_COMPACTION
47 COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED,
48 COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
49#endif
46#ifdef CONFIG_HUGETLB_PAGE 50#ifdef CONFIG_HUGETLB_PAGE
47 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 51 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
48#endif 52#endif
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 7f56db4a79f0..6625cc1ab758 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -76,17 +76,52 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 ((vc)->vc_toggle_meta ? 0x80 : 0)]) 77 ((vc)->vc_toggle_meta ? 0x80 : 0)])
78#else 78#else
79#define con_set_trans_old(arg) (0) 79static inline int con_set_trans_old(unsigned char __user *table)
80#define con_get_trans_old(arg) (-EINVAL) 80{
81#define con_set_trans_new(arg) (0) 81 return 0;
82#define con_get_trans_new(arg) (-EINVAL) 82}
83#define con_clear_unimap(vc, ui) (0) 83static inline int con_get_trans_old(unsigned char __user *table)
84#define con_set_unimap(vc, ct, list) (0) 84{
85#define con_set_default_unimap(vc) (0) 85 return -EINVAL;
86#define con_copy_unimap(d, s) (0) 86}
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL) 87static inline int con_set_trans_new(unsigned short __user *table)
88#define con_free_unimap(vc) do { ; } while (0) 88{
89#define con_protect_unimap(vc, rdonly) do { ; } while (0) 89 return 0;
90}
91static inline int con_get_trans_new(unsigned short __user *table)
92{
93 return -EINVAL;
94}
95static inline int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
96{
97 return 0;
98}
99static inline
100int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
101{
102 return 0;
103}
104static inline
105int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
106 struct unipair __user *list)
107{
108 return -EINVAL;
109}
110static inline int con_set_default_unimap(struct vc_data *vc)
111{
112 return 0;
113}
114static inline void con_free_unimap(struct vc_data *vc)
115{
116}
117static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
118{
119}
120static inline
121int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
122{
123 return 0;
124}
90 125
91#define vc_translate(vc, c) (c) 126#define vc_translate(vc, c) (c)
92#endif 127#endif
@@ -100,6 +135,13 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last,
100 int deflt); 135 int deflt);
101int vty_init(const struct file_operations *console_fops); 136int vty_init(const struct file_operations *console_fops);
102 137
138static inline bool vt_force_oops_output(struct vc_data *vc)
139{
140 if (oops_in_progress && vc->vc_panic_force_write)
141 return true;
142 return false;
143}
144
103/* 145/*
104 * vc_screen.c shares this temporary buffer with the console write code so that 146 * vc_screen.c shares this temporary buffer with the console write code so that
105 * we can easily avoid touching user space while holding the console spinlock. 147 * we can easily avoid touching user space while holding the console spinlock.
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a48e16b77d5e..0836ccc57121 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -127,12 +127,26 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
127/* 127/*
128 * Used for wake-one threads: 128 * Used for wake-one threads:
129 */ 129 */
130static inline void __add_wait_queue_exclusive(wait_queue_head_t *q,
131 wait_queue_t *wait)
132{
133 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue(q, wait);
135}
136
130static inline void __add_wait_queue_tail(wait_queue_head_t *head, 137static inline void __add_wait_queue_tail(wait_queue_head_t *head,
131 wait_queue_t *new) 138 wait_queue_t *new)
132{ 139{
133 list_add_tail(&new->task_list, &head->task_list); 140 list_add_tail(&new->task_list, &head->task_list);
134} 141}
135 142
143static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q,
144 wait_queue_t *wait)
145{
146 wait->flags |= WQ_FLAG_EXCLUSIVE;
147 __add_wait_queue_tail(q, wait);
148}
149
136static inline void __remove_wait_queue(wait_queue_head_t *head, 150static inline void __remove_wait_queue(wait_queue_head_t *head,
137 wait_queue_t *old) 151 wait_queue_t *old)
138{ 152{
@@ -362,6 +376,155 @@ do { \
362 __ret; \ 376 __ret; \
363}) 377})
364 378
379
380#define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \
381({ \
382 int __ret = 0; \
383 DEFINE_WAIT(__wait); \
384 if (exclusive) \
385 __wait.flags |= WQ_FLAG_EXCLUSIVE; \
386 do { \
387 if (likely(list_empty(&__wait.task_list))) \
388 __add_wait_queue_tail(&(wq), &__wait); \
389 set_current_state(TASK_INTERRUPTIBLE); \
390 if (signal_pending(current)) { \
391 __ret = -ERESTARTSYS; \
392 break; \
393 } \
394 if (irq) \
395 spin_unlock_irq(&(wq).lock); \
396 else \
397 spin_unlock(&(wq).lock); \
398 schedule(); \
399 if (irq) \
400 spin_lock_irq(&(wq).lock); \
401 else \
402 spin_lock(&(wq).lock); \
403 } while (!(condition)); \
404 __remove_wait_queue(&(wq), &__wait); \
405 __set_current_state(TASK_RUNNING); \
406 __ret; \
407})
408
409
410/**
411 * wait_event_interruptible_locked - sleep until a condition gets true
412 * @wq: the waitqueue to wait on
413 * @condition: a C expression for the event to wait for
414 *
415 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
416 * @condition evaluates to true or a signal is received.
417 * The @condition is checked each time the waitqueue @wq is woken up.
418 *
419 * It must be called with wq.lock being held. This spinlock is
420 * unlocked while sleeping but @condition testing is done while lock
421 * is held and when this macro exits the lock is held.
422 *
423 * The lock is locked/unlocked using spin_lock()/spin_unlock()
424 * functions which must match the way they are locked/unlocked outside
425 * of this macro.
426 *
427 * wake_up_locked() has to be called after changing any variable that could
428 * change the result of the wait condition.
429 *
430 * The function will return -ERESTARTSYS if it was interrupted by a
431 * signal and 0 if @condition evaluated to true.
432 */
433#define wait_event_interruptible_locked(wq, condition) \
434 ((condition) \
435 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0))
436
437/**
438 * wait_event_interruptible_locked_irq - sleep until a condition gets true
439 * @wq: the waitqueue to wait on
440 * @condition: a C expression for the event to wait for
441 *
442 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
443 * @condition evaluates to true or a signal is received.
444 * The @condition is checked each time the waitqueue @wq is woken up.
445 *
446 * It must be called with wq.lock being held. This spinlock is
447 * unlocked while sleeping but @condition testing is done while lock
448 * is held and when this macro exits the lock is held.
449 *
450 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
451 * functions which must match the way they are locked/unlocked outside
452 * of this macro.
453 *
454 * wake_up_locked() has to be called after changing any variable that could
455 * change the result of the wait condition.
456 *
457 * The function will return -ERESTARTSYS if it was interrupted by a
458 * signal and 0 if @condition evaluated to true.
459 */
460#define wait_event_interruptible_locked_irq(wq, condition) \
461 ((condition) \
462 ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1))
463
464/**
465 * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true
466 * @wq: the waitqueue to wait on
467 * @condition: a C expression for the event to wait for
468 *
469 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
470 * @condition evaluates to true or a signal is received.
471 * The @condition is checked each time the waitqueue @wq is woken up.
472 *
473 * It must be called with wq.lock being held. This spinlock is
474 * unlocked while sleeping but @condition testing is done while lock
475 * is held and when this macro exits the lock is held.
476 *
477 * The lock is locked/unlocked using spin_lock()/spin_unlock()
478 * functions which must match the way they are locked/unlocked outside
479 * of this macro.
480 *
481 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
482 * set thus when other process waits process on the list if this
483 * process is awaken further processes are not considered.
484 *
485 * wake_up_locked() has to be called after changing any variable that could
486 * change the result of the wait condition.
487 *
488 * The function will return -ERESTARTSYS if it was interrupted by a
489 * signal and 0 if @condition evaluated to true.
490 */
491#define wait_event_interruptible_exclusive_locked(wq, condition) \
492 ((condition) \
493 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0))
494
495/**
496 * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true
497 * @wq: the waitqueue to wait on
498 * @condition: a C expression for the event to wait for
499 *
500 * The process is put to sleep (TASK_INTERRUPTIBLE) until the
501 * @condition evaluates to true or a signal is received.
502 * The @condition is checked each time the waitqueue @wq is woken up.
503 *
504 * It must be called with wq.lock being held. This spinlock is
505 * unlocked while sleeping but @condition testing is done while lock
506 * is held and when this macro exits the lock is held.
507 *
508 * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq()
509 * functions which must match the way they are locked/unlocked outside
510 * of this macro.
511 *
512 * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag
513 * set thus when other process waits process on the list if this
514 * process is awaken further processes are not considered.
515 *
516 * wake_up_locked() has to be called after changing any variable that could
517 * change the result of the wait condition.
518 *
519 * The function will return -ERESTARTSYS if it was interrupted by a
520 * signal and 0 if @condition evaluated to true.
521 */
522#define wait_event_interruptible_exclusive_locked_irq(wq, condition) \
523 ((condition) \
524 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
525
526
527
365#define __wait_event_killable(wq, condition, ret) \ 528#define __wait_event_killable(wq, condition, ret) \
366do { \ 529do { \
367 DEFINE_WAIT(__wait); \ 530 DEFINE_WAIT(__wait); \
@@ -404,25 +567,6 @@ do { \
404}) 567})
405 568
406/* 569/*
407 * Must be called with the spinlock in the wait_queue_head_t held.
408 */
409static inline void add_wait_queue_exclusive_locked(wait_queue_head_t *q,
410 wait_queue_t * wait)
411{
412 wait->flags |= WQ_FLAG_EXCLUSIVE;
413 __add_wait_queue_tail(q, wait);
414}
415
416/*
417 * Must be called with the spinlock in the wait_queue_head_t held.
418 */
419static inline void remove_wait_queue_locked(wait_queue_head_t *q,
420 wait_queue_t * wait)
421{
422 __remove_wait_queue(q, wait);
423}
424
425/*
426 * These are the old interfaces to sleep waiting for an event. 570 * These are the old interfaces to sleep waiting for an event.
427 * They are racy. DO NOT use them, use the wait_event* interfaces above. 571 * They are racy. DO NOT use them, use the wait_event* interfaces above.
428 * We plan to remove these interfaces. 572 * We plan to remove these interfaces.
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 5b4c6c772a9b..e6827eedf18b 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -346,6 +346,8 @@
346#define SIOCIWFIRST 0x8B00 346#define SIOCIWFIRST 0x8B00
347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ 347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) 348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
349#define IW_HANDLER(id, func) \
350 [IW_IOCTL_IDX(id)] = func
349 351
350/* Odd : get (world access), even : set (root access) */ 352/* Odd : get (world access), even : set (root access) */
351#define IW_IS_SET(cmd) (!((cmd) & 0x1)) 353#define IW_IS_SET(cmd) (!((cmd) & 0x1))
@@ -648,7 +650,7 @@
648 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ 650 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
649#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ 651#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \
650 (cmd - SIOCIWFIRSTPRIV + 0x60) : \ 652 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
651 (cmd - SIOCSIWCOMMIT)) 653 (cmd - SIOCIWFIRST))
652#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) 654#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5)
653#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) 655#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
654/* Event capability constants - event autogenerated by the kernel 656/* Event capability constants - event autogenerated by the kernel
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
index ac95ce6606ac..c76fe2392506 100644
--- a/include/linux/wlp.h
+++ b/include/linux/wlp.h
@@ -300,7 +300,7 @@ struct wlp_ie {
300 __le16 cycle_param; 300 __le16 cycle_param;
301 __le16 acw_anchor_addr; 301 __le16 acw_anchor_addr;
302 u8 wssid_hash_list[]; 302 u8 wssid_hash_list[];
303} __attribute__((packed)); 303} __packed;
304 304
305static inline int wlp_ie_hash_length(struct wlp_ie *ie) 305static inline int wlp_ie_hash_length(struct wlp_ie *ie)
306{ 306{
@@ -324,7 +324,7 @@ static inline void wlp_ie_set_hash_length(struct wlp_ie *ie, int hash_length)
324 */ 324 */
325struct wlp_nonce { 325struct wlp_nonce {
326 u8 data[16]; 326 u8 data[16];
327} __attribute__((packed)); 327} __packed;
328 328
329/** 329/**
330 * WLP UUID 330 * WLP UUID
@@ -336,7 +336,7 @@ struct wlp_nonce {
336 */ 336 */
337struct wlp_uuid { 337struct wlp_uuid {
338 u8 data[16]; 338 u8 data[16];
339} __attribute__((packed)); 339} __packed;
340 340
341 341
342/** 342/**
@@ -348,7 +348,7 @@ struct wlp_dev_type {
348 u8 OUI[3]; 348 u8 OUI[3];
349 u8 OUIsubdiv; 349 u8 OUIsubdiv;
350 __le16 subID; 350 __le16 subID;
351} __attribute__((packed)); 351} __packed;
352 352
353/** 353/**
354 * WLP frame header 354 * WLP frame header
@@ -357,7 +357,7 @@ struct wlp_dev_type {
357struct wlp_frame_hdr { 357struct wlp_frame_hdr {
358 __le16 mux_hdr; /* WLP_PROTOCOL_ID */ 358 __le16 mux_hdr; /* WLP_PROTOCOL_ID */
359 enum wlp_frame_type type:8; 359 enum wlp_frame_type type:8;
360} __attribute__((packed)); 360} __packed;
361 361
362/** 362/**
363 * WLP attribute field header 363 * WLP attribute field header
@@ -368,7 +368,7 @@ struct wlp_frame_hdr {
368struct wlp_attr_hdr { 368struct wlp_attr_hdr {
369 __le16 type; 369 __le16 type;
370 __le16 length; 370 __le16 length;
371} __attribute__((packed)); 371} __packed;
372 372
373/** 373/**
374 * Device information commonly used together 374 * Device information commonly used together
@@ -401,13 +401,13 @@ struct wlp_device_info {
401struct wlp_attr_##name { \ 401struct wlp_attr_##name { \
402 struct wlp_attr_hdr hdr; \ 402 struct wlp_attr_hdr hdr; \
403 type name; \ 403 type name; \
404} __attribute__((packed)); 404} __packed;
405 405
406#define wlp_attr_array(type, name) \ 406#define wlp_attr_array(type, name) \
407struct wlp_attr_##name { \ 407struct wlp_attr_##name { \
408 struct wlp_attr_hdr hdr; \ 408 struct wlp_attr_hdr hdr; \
409 type name[]; \ 409 type name[]; \
410} __attribute__((packed)); 410} __packed;
411 411
412/** 412/**
413 * WLP association attribute fields 413 * WLP association attribute fields
@@ -483,7 +483,7 @@ struct wlp_wss_info {
483 struct wlp_attr_accept_enrl accept; 483 struct wlp_attr_accept_enrl accept;
484 struct wlp_attr_wss_sec_status sec_stat; 484 struct wlp_attr_wss_sec_status sec_stat;
485 struct wlp_attr_wss_bcast bcast; 485 struct wlp_attr_wss_bcast bcast;
486} __attribute__((packed)); 486} __packed;
487 487
488/* WLP WSS Information */ 488/* WLP WSS Information */
489wlp_attr_array(struct wlp_wss_info, wss_info) 489wlp_attr_array(struct wlp_wss_info, wss_info)
@@ -520,7 +520,7 @@ wlp_attr(u8, wlp_assc_err)
520struct wlp_frame_std_abbrv_hdr { 520struct wlp_frame_std_abbrv_hdr {
521 struct wlp_frame_hdr hdr; 521 struct wlp_frame_hdr hdr;
522 u8 tag; 522 u8 tag;
523} __attribute__((packed)); 523} __packed;
524 524
525/** 525/**
526 * WLP association frames 526 * WLP association frames
@@ -533,7 +533,7 @@ struct wlp_frame_assoc {
533 struct wlp_attr_version version; 533 struct wlp_attr_version version;
534 struct wlp_attr_msg_type msg_type; 534 struct wlp_attr_msg_type msg_type;
535 u8 attr[]; 535 u8 attr[];
536} __attribute__((packed)); 536} __packed;
537 537
538/* Ethernet to dev address mapping */ 538/* Ethernet to dev address mapping */
539struct wlp_eda { 539struct wlp_eda {
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
deleted file mode 100644
index a1d6419c2ff8..000000000000
--- a/include/linux/wm97xx_batt.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef _LINUX_WM97XX_BAT_H
2#define _LINUX_WM97XX_BAT_H
3
4#include <linux/wm97xx.h>
5
6#warning This file will be removed soon, use wm97xx.h instead!
7
8#define wm97xx_batt_info wm97xx_batt_pdata
9
10#ifdef CONFIG_BATTERY_WM97XX
11void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
12#else
13static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
14#endif
15
16#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 9466e860d8c2..4f9d277bcd9a 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -9,6 +9,7 @@
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/lockdep.h> 11#include <linux/lockdep.h>
12#include <linux/threads.h>
12#include <asm/atomic.h> 13#include <asm/atomic.h>
13 14
14struct workqueue_struct; 15struct workqueue_struct;
@@ -22,12 +23,59 @@ typedef void (*work_func_t)(struct work_struct *work);
22 */ 23 */
23#define work_data_bits(work) ((unsigned long *)(&(work)->data)) 24#define work_data_bits(work) ((unsigned long *)(&(work)->data))
24 25
26enum {
27 WORK_STRUCT_PENDING_BIT = 0, /* work item is pending execution */
28 WORK_STRUCT_CWQ_BIT = 1, /* data points to cwq */
29 WORK_STRUCT_LINKED_BIT = 2, /* next work is linked to this one */
30#ifdef CONFIG_DEBUG_OBJECTS_WORK
31 WORK_STRUCT_STATIC_BIT = 3, /* static initializer (debugobjects) */
32 WORK_STRUCT_COLOR_SHIFT = 4, /* color for workqueue flushing */
33#else
34 WORK_STRUCT_COLOR_SHIFT = 3, /* color for workqueue flushing */
35#endif
36
37 WORK_STRUCT_COLOR_BITS = 4,
38
39 WORK_STRUCT_PENDING = 1 << WORK_STRUCT_PENDING_BIT,
40 WORK_STRUCT_CWQ = 1 << WORK_STRUCT_CWQ_BIT,
41 WORK_STRUCT_LINKED = 1 << WORK_STRUCT_LINKED_BIT,
42#ifdef CONFIG_DEBUG_OBJECTS_WORK
43 WORK_STRUCT_STATIC = 1 << WORK_STRUCT_STATIC_BIT,
44#else
45 WORK_STRUCT_STATIC = 0,
46#endif
47
48 /*
49 * The last color is no color used for works which don't
50 * participate in workqueue flushing.
51 */
52 WORK_NR_COLORS = (1 << WORK_STRUCT_COLOR_BITS) - 1,
53 WORK_NO_COLOR = WORK_NR_COLORS,
54
55 /* special cpu IDs */
56 WORK_CPU_UNBOUND = NR_CPUS,
57 WORK_CPU_NONE = NR_CPUS + 1,
58 WORK_CPU_LAST = WORK_CPU_NONE,
59
60 /*
61 * Reserve 7 bits off of cwq pointer w/ debugobjects turned
62 * off. This makes cwqs aligned to 128 bytes which isn't too
63 * excessive while allowing 15 workqueue flush colors.
64 */
65 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
66 WORK_STRUCT_COLOR_BITS,
67
68 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
69 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
70 WORK_STRUCT_NO_CPU = WORK_CPU_NONE << WORK_STRUCT_FLAG_BITS,
71
72 /* bit mask for work_busy() return values */
73 WORK_BUSY_PENDING = 1 << 0,
74 WORK_BUSY_RUNNING = 1 << 1,
75};
76
25struct work_struct { 77struct work_struct {
26 atomic_long_t data; 78 atomic_long_t data;
27#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
28#define WORK_STRUCT_STATIC 1 /* static initializer (debugobjects) */
29#define WORK_STRUCT_FLAG_MASK (3UL)
30#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
31 struct list_head entry; 79 struct list_head entry;
32 work_func_t func; 80 work_func_t func;
33#ifdef CONFIG_LOCKDEP 81#ifdef CONFIG_LOCKDEP
@@ -35,8 +83,9 @@ struct work_struct {
35#endif 83#endif
36}; 84};
37 85
38#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) 86#define WORK_DATA_INIT() ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU)
39#define WORK_DATA_STATIC_INIT() ATOMIC_LONG_INIT(2) 87#define WORK_DATA_STATIC_INIT() \
88 ATOMIC_LONG_INIT(WORK_STRUCT_NO_CPU | WORK_STRUCT_STATIC)
40 89
41struct delayed_work { 90struct delayed_work {
42 struct work_struct work; 91 struct work_struct work;
@@ -96,9 +145,14 @@ struct execute_work {
96#ifdef CONFIG_DEBUG_OBJECTS_WORK 145#ifdef CONFIG_DEBUG_OBJECTS_WORK
97extern void __init_work(struct work_struct *work, int onstack); 146extern void __init_work(struct work_struct *work, int onstack);
98extern void destroy_work_on_stack(struct work_struct *work); 147extern void destroy_work_on_stack(struct work_struct *work);
148static inline unsigned int work_static(struct work_struct *work)
149{
150 return *work_data_bits(work) & WORK_STRUCT_STATIC;
151}
99#else 152#else
100static inline void __init_work(struct work_struct *work, int onstack) { } 153static inline void __init_work(struct work_struct *work, int onstack) { }
101static inline void destroy_work_on_stack(struct work_struct *work) { } 154static inline void destroy_work_on_stack(struct work_struct *work) { }
155static inline unsigned int work_static(struct work_struct *work) { return 0; }
102#endif 156#endif
103 157
104/* 158/*
@@ -162,7 +216,7 @@ static inline void destroy_work_on_stack(struct work_struct *work) { }
162 * @work: The work item in question 216 * @work: The work item in question
163 */ 217 */
164#define work_pending(work) \ 218#define work_pending(work) \
165 test_bit(WORK_STRUCT_PENDING, work_data_bits(work)) 219 test_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
166 220
167/** 221/**
168 * delayed_work_pending - Find out whether a delayable work item is currently 222 * delayed_work_pending - Find out whether a delayable work item is currently
@@ -177,16 +231,56 @@ static inline void destroy_work_on_stack(struct work_struct *work) { }
177 * @work: The work item in question 231 * @work: The work item in question
178 */ 232 */
179#define work_clear_pending(work) \ 233#define work_clear_pending(work) \
180 clear_bit(WORK_STRUCT_PENDING, work_data_bits(work)) 234 clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work))
235
236enum {
237 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */
238 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
239 WQ_FREEZEABLE = 1 << 2, /* freeze during suspend */
240 WQ_RESCUER = 1 << 3, /* has an rescue worker */
241 WQ_HIGHPRI = 1 << 4, /* high priority */
242 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
243
244 WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
245 WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
246 WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
247};
181 248
249/* unbound wq's aren't per-cpu, scale max_active according to #cpus */
250#define WQ_UNBOUND_MAX_ACTIVE \
251 max_t(int, WQ_MAX_ACTIVE, num_possible_cpus() * WQ_MAX_UNBOUND_PER_CPU)
252
253/*
254 * System-wide workqueues which are always present.
255 *
256 * system_wq is the one used by schedule[_delayed]_work[_on]().
257 * Multi-CPU multi-threaded. There are users which expect relatively
258 * short queue flush time. Don't queue works which can run for too
259 * long.
260 *
261 * system_long_wq is similar to system_wq but may host long running
262 * works. Queue flushing might take relatively long.
263 *
264 * system_nrt_wq is non-reentrant and guarantees that any given work
265 * item is never executed in parallel by multiple CPUs. Queue
266 * flushing might take relatively long.
267 *
268 * system_unbound_wq is unbound workqueue. Workers are not bound to
269 * any specific CPU, not concurrency managed, and all queued works are
270 * executed immediately as long as max_active limit is not reached and
271 * resources are available.
272 */
273extern struct workqueue_struct *system_wq;
274extern struct workqueue_struct *system_long_wq;
275extern struct workqueue_struct *system_nrt_wq;
276extern struct workqueue_struct *system_unbound_wq;
182 277
183extern struct workqueue_struct * 278extern struct workqueue_struct *
184__create_workqueue_key(const char *name, int singlethread, 279__alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
185 int freezeable, int rt, struct lock_class_key *key, 280 struct lock_class_key *key, const char *lock_name);
186 const char *lock_name);
187 281
188#ifdef CONFIG_LOCKDEP 282#ifdef CONFIG_LOCKDEP
189#define __create_workqueue(name, singlethread, freezeable, rt) \ 283#define alloc_workqueue(name, flags, max_active) \
190({ \ 284({ \
191 static struct lock_class_key __key; \ 285 static struct lock_class_key __key; \
192 const char *__lock_name; \ 286 const char *__lock_name; \
@@ -196,20 +290,20 @@ __create_workqueue_key(const char *name, int singlethread,
196 else \ 290 else \
197 __lock_name = #name; \ 291 __lock_name = #name; \
198 \ 292 \
199 __create_workqueue_key((name), (singlethread), \ 293 __alloc_workqueue_key((name), (flags), (max_active), \
200 (freezeable), (rt), &__key, \ 294 &__key, __lock_name); \
201 __lock_name); \
202}) 295})
203#else 296#else
204#define __create_workqueue(name, singlethread, freezeable, rt) \ 297#define alloc_workqueue(name, flags, max_active) \
205 __create_workqueue_key((name), (singlethread), (freezeable), (rt), \ 298 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL)
206 NULL, NULL)
207#endif 299#endif
208 300
209#define create_workqueue(name) __create_workqueue((name), 0, 0, 0) 301#define create_workqueue(name) \
210#define create_rt_workqueue(name) __create_workqueue((name), 0, 0, 1) 302 alloc_workqueue((name), WQ_RESCUER, 1)
211#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1, 0) 303#define create_freezeable_workqueue(name) \
212#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0, 0) 304 alloc_workqueue((name), WQ_FREEZEABLE | WQ_UNBOUND | WQ_RESCUER, 1)
305#define create_singlethread_workqueue(name) \
306 alloc_workqueue((name), WQ_UNBOUND | WQ_RESCUER, 1)
213 307
214extern void destroy_workqueue(struct workqueue_struct *wq); 308extern void destroy_workqueue(struct workqueue_struct *wq);
215 309
@@ -231,16 +325,19 @@ extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay)
231extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, 325extern int schedule_delayed_work_on(int cpu, struct delayed_work *work,
232 unsigned long delay); 326 unsigned long delay);
233extern int schedule_on_each_cpu(work_func_t func); 327extern int schedule_on_each_cpu(work_func_t func);
234extern int current_is_keventd(void);
235extern int keventd_up(void); 328extern int keventd_up(void);
236 329
237extern void init_workqueues(void);
238int execute_in_process_context(work_func_t fn, struct execute_work *); 330int execute_in_process_context(work_func_t fn, struct execute_work *);
239 331
240extern int flush_work(struct work_struct *work); 332extern int flush_work(struct work_struct *work);
241
242extern int cancel_work_sync(struct work_struct *work); 333extern int cancel_work_sync(struct work_struct *work);
243 334
335extern void workqueue_set_max_active(struct workqueue_struct *wq,
336 int max_active);
337extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq);
338extern unsigned int work_cpu(struct work_struct *work);
339extern unsigned int work_busy(struct work_struct *work);
340
244/* 341/*
245 * Kill off a pending schedule_delayed_work(). Note that the work callback 342 * Kill off a pending schedule_delayed_work(). Note that the work callback
246 * function may still be running on return from cancel_delayed_work(), unless 343 * function may still be running on return from cancel_delayed_work(), unless
@@ -297,4 +394,15 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
297#else 394#else
298long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); 395long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg);
299#endif /* CONFIG_SMP */ 396#endif /* CONFIG_SMP */
397
398#ifdef CONFIG_FREEZER
399extern void freeze_workqueues_begin(void);
400extern bool freeze_workqueues_busy(void);
401extern void thaw_workqueues(void);
402#endif /* CONFIG_FREEZER */
403
404#ifdef CONFIG_LOCKDEP
405int in_workqueue_context(struct workqueue_struct *wq);
406#endif
407
300#endif 408#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 36520ded3e06..c24eca71e80c 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -27,10 +27,6 @@ enum writeback_sync_modes {
27 * in a manner such that unspecified fields are set to zero. 27 * in a manner such that unspecified fields are set to zero.
28 */ 28 */
29struct writeback_control { 29struct writeback_control {
30 struct backing_dev_info *bdi; /* If !NULL, only write back this
31 queue */
32 struct super_block *sb; /* if !NULL, only write inodes from
33 this super_block */
34 enum writeback_sync_modes sync_mode; 30 enum writeback_sync_modes sync_mode;
35 unsigned long *older_than_this; /* If !NULL, only write back inodes 31 unsigned long *older_than_this; /* If !NULL, only write back inodes
36 older than this */ 32 older than this */
@@ -56,15 +52,6 @@ struct writeback_control {
56 unsigned for_reclaim:1; /* Invoked from the page allocator */ 52 unsigned for_reclaim:1; /* Invoked from the page allocator */
57 unsigned range_cyclic:1; /* range_start is cyclic */ 53 unsigned range_cyclic:1; /* range_start is cyclic */
58 unsigned more_io:1; /* more io to be dispatched */ 54 unsigned more_io:1; /* more io to be dispatched */
59 /*
60 * write_cache_pages() won't update wbc->nr_to_write and
61 * mapping->writeback_index if no_nrwrite_index_update
62 * is set. write_cache_pages() may write more than we
63 * requested and we want to make sure nr_to_write and
64 * writeback_index are updated in a consistent manner
65 * so we use a single control to update them
66 */
67 unsigned no_nrwrite_index_update:1;
68}; 55};
69 56
70/* 57/*
@@ -75,7 +62,8 @@ int inode_wait(void *);
75void writeback_inodes_sb(struct super_block *); 62void writeback_inodes_sb(struct super_block *);
76int writeback_inodes_sb_if_idle(struct super_block *); 63int writeback_inodes_sb_if_idle(struct super_block *);
77void sync_inodes_sb(struct super_block *); 64void sync_inodes_sb(struct super_block *);
78void writeback_inodes_wbc(struct writeback_control *wbc); 65void writeback_inodes_wb(struct bdi_writeback *wb,
66 struct writeback_control *wbc);
79long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 67long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
80void wakeup_flusher_threads(long nr_pages); 68void wakeup_flusher_threads(long nr_pages);
81 69
@@ -96,8 +84,14 @@ static inline void inode_sync_wait(struct inode *inode)
96/* 84/*
97 * mm/page-writeback.c 85 * mm/page-writeback.c
98 */ 86 */
99void laptop_io_completion(void); 87#ifdef CONFIG_BLOCK
88void laptop_io_completion(struct backing_dev_info *info);
100void laptop_sync_completion(void); 89void laptop_sync_completion(void);
90void laptop_mode_sync(struct work_struct *work);
91void laptop_mode_timer_fn(unsigned long data);
92#else
93static inline void laptop_sync_completion(void) { }
94#endif
101void throttle_vm_writeout(gfp_t gfp_mask); 95void throttle_vm_writeout(gfp_t gfp_mask);
102 96
103/* These are exported to sysctl. */ 97/* These are exported to sysctl. */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index fb9b7e6e1e2d..f1e5bde4b35a 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -33,11 +33,25 @@
33#define XATTR_USER_PREFIX "user." 33#define XATTR_USER_PREFIX "user."
34#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1) 34#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
35 35
36/* Security namespace */
37#define XATTR_SELINUX_SUFFIX "selinux"
38#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
39
40#define XATTR_SMACK_SUFFIX "SMACK64"
41#define XATTR_SMACK_IPIN "SMACK64IPIN"
42#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
43#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
44#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
45#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
46
47#define XATTR_CAPS_SUFFIX "capability"
48#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
49
36struct inode; 50struct inode;
37struct dentry; 51struct dentry;
38 52
39struct xattr_handler { 53struct xattr_handler {
40 char *prefix; 54 const char *prefix;
41 int flags; /* fs private flags passed back to the handlers */ 55 int flags; /* fs private flags passed back to the handlers */
42 size_t (*list)(struct dentry *dentry, char *list, size_t list_size, 56 size_t (*list)(struct dentry *dentry, char *list, size_t list_size,
43 const char *name, size_t name_len, int handler_flags); 57 const char *name, size_t name_len, int handler_flags);
diff --git a/include/linux/z2_battery.h b/include/linux/z2_battery.h
new file mode 100644
index 000000000000..7b9750404d22
--- /dev/null
+++ b/include/linux/z2_battery.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_Z2_BATTERY_H
2#define _LINUX_Z2_BATTERY_H
3
4struct z2_battery_info {
5 int batt_I2C_bus;
6 int batt_I2C_addr;
7 int batt_I2C_reg;
8 int charge_gpio;
9 int min_voltage;
10 int max_voltage;
11 int batt_div;
12 int batt_mult;
13 int batt_tech;
14 char *batt_name;
15};
16
17#endif
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index 913bfc226dda..7bf9db525e9e 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -38,8 +38,6 @@
38typedef __u32 zorro_id; 38typedef __u32 zorro_id;
39 39
40 40
41#define ZORRO_WILDCARD (0xffffffff) /* not official */
42
43/* Include the ID list */ 41/* Include the ID list */
44#include <linux/zorro_ids.h> 42#include <linux/zorro_ids.h>
45 43
@@ -116,6 +114,7 @@ struct ConfigDev {
116 114
117#include <linux/init.h> 115#include <linux/init.h>
118#include <linux/ioport.h> 116#include <linux/ioport.h>
117#include <linux/mod_devicetable.h>
119 118
120#include <asm/zorro.h> 119#include <asm/zorro.h>
121 120
@@ -142,29 +141,10 @@ struct zorro_dev {
142 * Zorro bus 141 * Zorro bus
143 */ 142 */
144 143
145struct zorro_bus {
146 struct list_head devices; /* list of devices on this bus */
147 unsigned int num_resources; /* number of resources */
148 struct resource resources[4]; /* address space routed to this bus */
149 struct device dev;
150 char name[10];
151};
152
153extern struct zorro_bus zorro_bus; /* single Zorro bus */
154extern struct bus_type zorro_bus_type; 144extern struct bus_type zorro_bus_type;
155 145
156 146
157 /* 147 /*
158 * Zorro device IDs
159 */
160
161struct zorro_device_id {
162 zorro_id id; /* Device ID or ZORRO_WILDCARD */
163 unsigned long driver_data; /* Data private to the driver */
164};
165
166
167 /*
168 * Zorro device drivers 148 * Zorro device drivers
169 */ 149 */
170 150