aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acoutput.h12
-rw-r--r--include/acpi/acpi_bus.h3
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/actbl.h16
-rw-r--r--include/acpi/actbl2.h64
-rw-r--r--include/acpi/apei.h5
-rw-r--r--include/asm-generic/bitops.h3
-rw-r--r--include/asm-generic/bitops/ext2-atomic.h4
-rw-r--r--include/asm-generic/bitops/ext2-non-atomic.h20
-rw-r--r--include/asm-generic/bitops/le.h89
-rw-r--r--include/asm-generic/bitops/minix-le.h17
-rw-r--r--include/asm-generic/bitops/minix.h15
-rw-r--r--include/asm-generic/bug.h28
-rw-r--r--include/asm-generic/cputime.h3
-rw-r--r--include/asm-generic/errno.h2
-rw-r--r--include/asm-generic/fcntl.h4
-rw-r--r--include/asm-generic/ftrace.h16
-rw-r--r--include/asm-generic/futex.h7
-rw-r--r--include/asm-generic/io.h33
-rw-r--r--include/asm-generic/ioctls.h1
-rw-r--r--include/asm-generic/sections.h1
-rw-r--r--include/asm-generic/sizes.h47
-rw-r--r--include/asm-generic/types.h27
-rw-r--r--include/asm-generic/uaccess.h8
-rw-r--r--include/asm-generic/unistd.h10
-rw-r--r--include/asm-generic/user.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h41
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/drm.h17
-rw-r--r--include/drm/drmP.h122
-rw-r--r--include/drm/drm_crtc.h13
-rw-r--r--include/drm/drm_hashtab.h6
-rw-r--r--include/drm/drm_mm.h49
-rw-r--r--include/drm/drm_mode.h29
-rw-r--r--include/drm/drm_pciids.h14
-rw-r--r--include/drm/drm_usb.h15
-rw-r--r--include/drm/i830_drm.h342
-rw-r--r--include/drm/i915_drm.h1
-rw-r--r--include/drm/nouveau_drm.h1
-rw-r--r--include/drm/radeon_drm.h1
-rw-r--r--include/drm/ttm/ttm_bo_driver.h6
-rw-r--r--include/drm/ttm/ttm_page_alloc.h8
-rw-r--r--include/keys/rxrpc-type.h1
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi_io.h3
-rw-r--r--include/linux/aer.h24
-rw-r--r--include/linux/amba/bus.h8
-rw-r--r--include/linux/amba/clcd.h90
-rw-r--r--include/linux/amba/mmci.h17
-rw-r--r--include/linux/ata.h163
-rw-r--r--include/linux/audit.h2
-rw-r--r--include/linux/backlight.h9
-rw-r--r--include/linux/bch.h79
-rw-r--r--include/linux/blkdev.h9
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/capability.h52
-rw-r--r--include/linux/ceph/ceph_fs.h19
-rw-r--r--include/linux/ceph/libceph.h1
-rw-r--r--include/linux/ceph/messenger.h2
-rw-r--r--include/linux/ceph/osd_client.h57
-rw-r--r--include/linux/ceph/rados.h39
-rw-r--r--include/linux/cgroup.h4
-rw-r--r--include/linux/cgroup_subsys.h4
-rw-r--r--include/linux/compaction.h9
-rw-r--r--include/linux/compiler-gcc.h8
-rw-r--r--include/linux/compiler-gcc3.h8
-rw-r--r--include/linux/compiler-gcc4.h8
-rw-r--r--include/linux/connector.h12
-rw-r--r--include/linux/cper.h2
-rw-r--r--include/linux/cpu_rmap.h73
-rw-r--r--include/linux/cpufreq.h11
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/cred.h4
-rw-r--r--include/linux/davinci_emac.h1
-rw-r--r--include/linux/dcache.h3
-rw-r--r--include/linux/dcbnl.h113
-rw-r--r--include/linux/dccp.h2
-rw-r--r--include/linux/debugobjects.h5
-rw-r--r--include/linux/device.h13
-rw-r--r--include/linux/dm-ioctl.h12
-rw-r--r--include/linux/dmi.h47
-rw-r--r--include/linux/dw_dmac.h44
-rw-r--r--include/linux/dynamic_debug.h8
-rw-r--r--include/linux/efi.h37
-rw-r--r--include/linux/elevator.h1
-rw-r--r--include/linux/err.h8
-rw-r--r--include/linux/ethtool.h128
-rw-r--r--include/linux/exportfs.h9
-rw-r--r--include/linux/ext3_fs.h13
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fcntl.h1
-rw-r--r--include/linux/file.h2
-rw-r--r--include/linux/firewire.h9
-rw-r--r--include/linux/firmware.h4
-rw-r--r--include/linux/fs.h72
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/genhd.h12
-rw-r--r--include/linux/gfp.h13
-rw-r--r--include/linux/hardirq.h9
-rw-r--r--include/linux/hid-roccat.h29
-rw-r--r--include/linux/hid.h5
-rw-r--r--include/linux/hidraw.h3
-rw-r--r--include/linux/hrtimer.h24
-rw-r--r--include/linux/hwspinlock.h292
-rw-r--r--include/linux/i2c-id.h37
-rw-r--r--include/linux/i2c-tegra.h25
-rw-r--r--include/linux/i2c.h20
-rw-r--r--include/linux/i2c/ads1015.h36
-rw-r--r--include/linux/i2c/atmel_mxt_ts.h (renamed from include/linux/i2c/qt602240_ts.h)34
-rw-r--r--include/linux/i2c/max6639.h14
-rw-r--r--include/linux/i2c/mcs.h1
-rw-r--r--include/linux/i2c/pmbus.h45
-rw-r--r--include/linux/i2c/pxa-i2c.h82
-rw-r--r--include/linux/i2c/twl.h6
-rw-r--r--include/linux/i2c/twl4030-madc.h141
-rw-r--r--include/linux/icmpv6.h4
-rw-r--r--include/linux/ieee80211.h3
-rw-r--r--include/linux/if.h9
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_ppp.h16
-rw-r--r--include/linux/igmp.h2
-rw-r--r--include/linux/ima.h6
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/input-polldev.h4
-rw-r--r--include/linux/input.h12
-rw-r--r--include/linux/interrupt.h85
-rw-r--r--include/linux/ip_vs.h8
-rw-r--r--include/linux/ipc_namespace.h10
-rw-r--r--include/linux/irq.h372
-rw-r--r--include/linux/irqdesc.h115
-rw-r--r--include/linux/jbd2.h28
-rw-r--r--include/linux/jiffies.h1
-rw-r--r--include/linux/journal-head.h7
-rw-r--r--include/linux/kallsyms.h7
-rw-r--r--include/linux/kbd_kern.h5
-rw-r--r--include/linux/kd.h1
-rw-r--r--include/linux/kernel.h70
-rw-r--r--include/linux/key-type.h14
-rw-r--r--include/linux/key.h5
-rw-r--r--include/linux/keyctl.h2
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kobject.h10
-rw-r--r--include/linux/kthread.h16
-rw-r--r--include/linux/kvm_host.h31
-rw-r--r--include/linux/led-lm3530.h107
-rw-r--r--include/linux/leds.h7
-rw-r--r--include/linux/libata.h10
-rw-r--r--include/linux/magic.h2
-rw-r--r--include/linux/media.h132
-rw-r--r--include/linux/memcontrol.h27
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/mfd/88pm860x.h20
-rw-r--r--include/linux/mfd/ab8500.h4
-rw-r--r--include/linux/mfd/ab8500/gpadc.h32
-rw-r--r--include/linux/mfd/ab8500/sysctrl.h254
-rw-r--r--include/linux/mfd/abx500.h1
-rw-r--r--include/linux/mfd/core.h54
-rw-r--r--include/linux/mfd/max8997-private.h347
-rw-r--r--include/linux/mfd/max8997.h114
-rw-r--r--include/linux/mfd/mc13xxx.h3
-rw-r--r--include/linux/mfd/ti_ssp.h93
-rw-r--r--include/linux/mfd/tps6105x.h101
-rw-r--r--include/linux/mfd/wl1273-core.h2
-rw-r--r--include/linux/mfd/wm831x/pdata.h9
-rw-r--r--include/linux/mfd/wm8994/core.h5
-rw-r--r--include/linux/mfd/wm8994/pdata.h12
-rw-r--r--include/linux/mfd/wm8994/registers.h2
-rw-r--r--include/linux/micrel_phy.h16
-rw-r--r--include/linux/mlx4/device.h51
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/linux/mm.h53
-rw-r--r--include/linux/mm_types.h8
-rw-r--r--include/linux/mmc/boot.h7
-rw-r--r--include/linux/mmc/card.h6
-rw-r--r--include/linux/mmc/core.h1
-rw-r--r--include/linux/mmc/dw_mmc.h15
-rw-r--r--include/linux/mmc/mmc.h3
-rw-r--r--include/linux/mmc/sh_mmcif.h3
-rw-r--r--include/linux/mmzone.h2
-rw-r--r--include/linux/msm_mdp.h1
-rw-r--r--include/linux/mtd/blktrans.h3
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/latch-addr-flash.h29
-rw-r--r--include/linux/mtd/nand.h3
-rw-r--r--include/linux/mtd/nand_bch.h72
-rw-r--r--include/linux/mtd/onenand.h1
-rw-r--r--include/linux/mtd/onenand_regs.h1
-rw-r--r--include/linux/mtd/ubi.h22
-rw-r--r--include/linux/namei.h9
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h308
-rw-r--r--include/linux/netfilter.h27
-rw-r--r--include/linux/netfilter/Kbuild7
-rw-r--r--include/linux/netfilter/ipset/Kbuild4
-rw-r--r--include/linux/netfilter/ipset/ip_set.h452
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h1074
-rw-r--r--include/linux/netfilter/ipset/ip_set_bitmap.h31
-rw-r--r--include/linux/netfilter/ipset/ip_set_getport.h31
-rw-r--r--include/linux/netfilter/ipset/ip_set_hash.h26
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h27
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h127
-rw-r--r--include/linux/netfilter/ipset/pfxlen.h35
-rw-r--r--include/linux/netfilter/nf_conntrack_snmp.h9
-rw-r--r--include/linux/netfilter/nfnetlink.h3
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h9
-rw-r--r--include/linux/netfilter/nfnetlink_log.h4
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h4
-rw-r--r--include/linux/netfilter/x_tables.h3
-rw-r--r--include/linux/netfilter/xt_AUDIT.h30
-rw-r--r--include/linux/netfilter/xt_CT.h12
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h6
-rw-r--r--include/linux/netfilter/xt_TCPOPTSTRIP.h4
-rw-r--r--include/linux/netfilter/xt_TPROXY.h10
-rw-r--r--include/linux/netfilter/xt_addrtype.h44
-rw-r--r--include/linux/netfilter/xt_cluster.h10
-rw-r--r--include/linux/netfilter/xt_comment.h2
-rw-r--r--include/linux/netfilter/xt_connbytes.h4
-rw-r--r--include/linux/netfilter/xt_connlimit.h16
-rw-r--r--include/linux/netfilter/xt_conntrack.h15
-rw-r--r--include/linux/netfilter/xt_devgroup.h21
-rw-r--r--include/linux/netfilter/xt_quota.h8
-rw-r--r--include/linux/netfilter/xt_set.h56
-rw-r--r--include/linux/netfilter/xt_socket.h2
-rw-r--r--include/linux/netfilter/xt_time.h16
-rw-r--r--include/linux/netfilter/xt_u32.h18
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_among.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_arp.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_ip.h14
-rw-r--r--include/linux/netfilter_bridge/ebt_ip6.h25
-rw-r--r--include/linux/netfilter_bridge/ebt_limit.h10
-rw-r--r--include/linux/netfilter_bridge/ebt_log.h8
-rw-r--r--include/linux/netfilter_bridge/ebt_mark_m.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h12
-rw-r--r--include/linux/netfilter_bridge/ebt_pkttype.h6
-rw-r--r--include/linux/netfilter_bridge/ebt_stp.h26
-rw-r--r--include/linux/netfilter_bridge/ebt_ulog.h4
-rw-r--r--include/linux/netfilter_bridge/ebt_vlan.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ECN.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_SAME.h8
-rw-r--r--include/linux/netfilter_ipv4/ipt_TTL.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_addrtype.h16
-rw-r--r--include/linux/netfilter_ipv4/ipt_ah.h6
-rw-r--r--include/linux/netfilter_ipv4/ipt_ecn.h10
-rw-r--r--include/linux/netfilter_ipv4/ipt_ttl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_HL.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_REJECT.h4
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ah.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_frag.h10
-rw-r--r--include/linux/netfilter_ipv6/ip6t_hl.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_ipv6header.h8
-rw-r--r--include/linux/netfilter_ipv6/ip6t_mh.h6
-rw-r--r--include/linux/netfilter_ipv6/ip6t_opts.h12
-rw-r--r--include/linux/netfilter_ipv6/ip6t_rt.h13
-rw-r--r--include/linux/netlink.h4
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h12
-rw-r--r--include/linux/nfs_fs_sb.h14
-rw-r--r--include/linux/nfs_idmap.h9
-rw-r--r--include/linux/nfs_iostat.h2
-rw-r--r--include/linux/nfs_page.h13
-rw-r--r--include/linux/nfs_xdr.h86
-rw-r--r--include/linux/nilfs2_fs.h32
-rw-r--r--include/linux/nl80211.h3
-rw-r--r--include/linux/node.h6
-rw-r--r--include/linux/of.h18
-rw-r--r--include/linux/of_device.h5
-rw-r--r--include/linux/of_pci.h9
-rw-r--r--include/linux/of_platform.h21
-rw-r--r--include/linux/omap3isp.h646
-rw-r--r--include/linux/oprofile.h7
-rw-r--r--include/linux/page-flags.h2
-rw-r--r--include/linux/page_cgroup.h90
-rw-r--r--include/linux/pagemap.h5
-rw-r--r--include/linux/pata_arasan_cf_data.h49
-rw-r--r--include/linux/pci-aspm.h4
-rw-r--r--include/linux/pci.h13
-rw-r--r--include/linux/pci_ids.h9
-rw-r--r--include/linux/percpu.h128
-rw-r--r--include/linux/perf_event.h50
-rw-r--r--include/linux/phonet.h4
-rw-r--r--include/linux/pid.h11
-rw-r--r--include/linux/pkt_sched.h107
-rw-r--r--include/linux/platform_data/msm_serial_hs.h49
-rw-r--r--include/linux/platform_data/tegra_usb.h31
-rw-r--r--include/linux/platform_data/uio_pruss.h25
-rw-r--r--include/linux/platform_device.h11
-rw-r--r--include/linux/plist.h47
-rw-r--r--include/linux/pm.h29
-rw-r--r--include/linux/pm_runtime.h6
-rw-r--r--include/linux/pm_wakeup.h8
-rw-r--r--include/linux/posix-clock.h150
-rw-r--r--include/linux/posix-timers.h44
-rw-r--r--include/linux/power/bq20z75.h39
-rw-r--r--include/linux/power/bq27x00_battery.h19
-rw-r--r--include/linux/power_supply.h47
-rw-r--r--include/linux/proc_fs.h2
-rw-r--r--include/linux/pstore.h60
-rw-r--r--include/linux/ptrace.h3
-rw-r--r--include/linux/pwm_backlight.h3
-rw-r--r--include/linux/quotaops.h2
-rw-r--r--include/linux/reiserfs_fs.h27
-rw-r--r--include/linux/reiserfs_xattr.h2
-rw-r--r--include/linux/res_counter.h72
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio.h25
-rw-r--r--include/linux/rio_drv.h7
-rw-r--r--include/linux/rmap.h45
-rw-r--r--include/linux/rtc.h5
-rw-r--r--include/linux/rwlock_types.h8
-rw-r--r--include/linux/rwsem-spinlock.h31
-rw-r--r--include/linux/rwsem.h53
-rw-r--r--include/linux/sched.h29
-rw-r--r--include/linux/security.h79
-rw-r--r--include/linux/serial_sci.h16
-rw-r--r--include/linux/sigma.h60
-rw-r--r--include/linux/skbuff.h16
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/slub_def.h9
-rw-r--r--include/linux/sm501.h8
-rw-r--r--include/linux/smp.h3
-rw-r--r--include/linux/smp_lock.h65
-rw-r--r--include/linux/sockios.h4
-rw-r--r--include/linux/spi/dw_spi.h233
-rw-r--r--include/linux/spi/ifx_modem.h19
-rw-r--r--include/linux/spi/mcp23s08.h15
-rw-r--r--include/linux/spi/spi_oc_tiny.h20
-rw-r--r--include/linux/spi/tsc2005.h41
-rw-r--r--include/linux/spinlock_types.h8
-rw-r--r--include/linux/ssb/ssb_regs.h7
-rw-r--r--include/linux/sunrpc/clnt.h1
-rw-r--r--include/linux/sunrpc/gss_api.h3
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/svga.h34
-rw-r--r--include/linux/swap.h10
-rw-r--r--include/linux/syscalls.h21
-rw-r--r--include/linux/syscore_ops.h29
-rw-r--r--include/linux/sysctl.h14
-rw-r--r--include/linux/sysdev.h7
-rw-r--r--include/linux/thread_info.h3
-rw-r--r--include/linux/ti_wilink_st.h76
-rw-r--r--include/linux/time.h14
-rw-r--r--include/linux/timex.h3
-rw-r--r--include/linux/tipc.h8
-rw-r--r--include/linux/tipc_config.h38
-rw-r--r--include/linux/tty.h7
-rw-r--r--include/linux/tty_driver.h13
-rw-r--r--include/linux/types.h6
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usb/Kbuild1
-rw-r--r--include/linux/usb/ch11.h46
-rw-r--r--include/linux/usb/ch9.h4
-rw-r--r--include/linux/usb/ehci_def.h4
-rw-r--r--include/linux/usb/hcd.h43
-rw-r--r--include/linux/usb/msm_hsusb.h2
-rw-r--r--include/linux/usb/otg.h7
-rw-r--r--include/linux/usb/serial.h9
-rw-r--r--include/linux/usb/ulpi.h5
-rw-r--r--include/linux/utsname.h10
-rw-r--r--include/linux/v4l2-mediabus.h108
-rw-r--r--include/linux/v4l2-subdev.h141
-rw-r--r--include/linux/videodev2.h146
-rw-r--r--include/linux/vmstat.h4
-rw-r--r--include/linux/vt_kern.h8
-rw-r--r--include/linux/workqueue.h4
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xattr.h2
-rw-r--r--include/linux/xfrm.h13
-rw-r--r--include/linux/zlib.h11
-rw-r--r--include/media/media-device.h95
-rw-r--r--include/media/media-devnode.h97
-rw-r--r--include/media/media-entity.h151
-rw-r--r--include/media/noon010pc30.h28
-rw-r--r--include/media/rc-map.h6
-rw-r--r--include/media/s5p_fimc.h (renamed from include/media/s3c_fimc.h)27
-rw-r--r--include/media/soc_camera.h24
-rw-r--r--include/media/soc_mediabus.h4
-rw-r--r--include/media/tuner.h16
-rw-r--r--include/media/v4l2-chip-ident.h4
-rw-r--r--include/media/v4l2-common.h15
-rw-r--r--include/media/v4l2-dev.h46
-rw-r--r--include/media/v4l2-device.h24
-rw-r--r--include/media/v4l2-fh.h29
-rw-r--r--include/media/v4l2-ioctl.h18
-rw-r--r--include/media/v4l2-mediabus.h61
-rw-r--r--include/media/v4l2-mem2mem.h58
-rw-r--r--include/media/v4l2-subdev.h113
-rw-r--r--include/media/videobuf2-core.h380
-rw-r--r--include/media/videobuf2-dma-contig.h32
-rw-r--r--include/media/videobuf2-dma-sg.h32
-rw-r--r--include/media/videobuf2-memops.h45
-rw-r--r--include/media/videobuf2-vmalloc.h20
-rw-r--r--include/media/wm8775.h9
-rw-r--r--include/net/9p/9p.h12
-rw-r--r--include/net/9p/client.h1
-rw-r--r--include/net/9p/transport.h9
-rw-r--r--include/net/bluetooth/bluetooth.h33
-rw-r--r--include/net/bluetooth/hci.h139
-rw-r--r--include/net/bluetooth/hci_core.h173
-rw-r--r--include/net/bluetooth/l2cap.h53
-rw-r--r--include/net/bluetooth/mgmt.h171
-rw-r--r--include/net/bluetooth/smp.h76
-rw-r--r--include/net/cfg80211.h19
-rw-r--r--include/net/dcbnl.h9
-rw-r--r--include/net/dn.h6
-rw-r--r--include/net/dn_fib.h8
-rw-r--r--include/net/dn_route.h8
-rw-r--r--include/net/dst.h142
-rw-r--r--include/net/dst_ops.h1
-rw-r--r--include/net/flow.h204
-rw-r--r--include/net/icmp.h3
-rw-r--r--include/net/ieee80211_radiotap.h25
-rw-r--r--include/net/inet_sock.h31
-rw-r--r--include/net/inetpeer.h44
-rw-r--r--include/net/ip.h16
-rw-r--r--include/net/ip6_fib.h5
-rw-r--r--include/net/ip6_route.h4
-rw-r--r--include/net/ip_fib.h55
-rw-r--r--include/net/ip_vs.h475
-rw-r--r--include/net/ipv6.h28
-rw-r--r--include/net/irda/ircomm_tty.h6
-rw-r--r--include/net/mac80211.h106
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/netevent.h1
-rw-r--r--include/net/netfilter/nf_conntrack.h23
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h12
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h6
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h2
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h65
-rw-r--r--include/net/netfilter/nf_nat.h6
-rw-r--r--include/net/netfilter/nf_nat_core.h4
-rw-r--r--include/net/netlink.h9
-rw-r--r--include/net/netns/conntrack.h4
-rw-r--r--include/net/netns/ipv4.h2
-rw-r--r--include/net/phonet/pep.h23
-rw-r--r--include/net/phonet/phonet.h1
-rw-r--r--include/net/protocol.h4
-rw-r--r--include/net/route.h165
-rw-r--r--include/net/sch_generic.h60
-rw-r--r--include/net/snmp.h4
-rw-r--r--include/net/sock.h9
-rw-r--r--include/net/tcp.h16
-rw-r--r--include/net/transp_v6.h4
-rw-r--r--include/net/udp.h13
-rw-r--r--include/net/udplite.h12
-rw-r--r--include/net/xfrm.h214
-rw-r--r--include/scsi/fc/fc_ns.h11
-rw-r--r--include/scsi/fc_encode.h26
-rw-r--r--include/scsi/libfc.h74
-rw-r--r--include/scsi/libfcoe.h105
-rw-r--r--include/scsi/libiscsi.h8
-rw-r--r--include/scsi/libiscsi_tcp.h1
-rw-r--r--include/scsi/sas_ata.h22
-rw-r--r--include/scsi/scsi.h5
-rw-r--r--include/scsi/scsi_device.h3
-rw-r--r--include/scsi/scsi_transport_iscsi.h6
-rw-r--r--include/sound/ac97_codec.h5
-rw-r--r--include/sound/control.h2
-rw-r--r--include/sound/cs4271.h24
-rw-r--r--include/sound/hdspm.h179
-rw-r--r--include/sound/mixer_oss.h3
-rw-r--r--include/sound/pcm.h91
-rw-r--r--include/sound/sh_fsi.h76
-rw-r--r--include/sound/soc-dapm.h16
-rw-r--r--include/sound/soc.h147
-rw-r--r--include/sound/tlv320aic32x4.h31
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/wm8903.h20
-rw-r--r--include/sound/wm9081.h9
-rw-r--r--include/staging/altera.h49
-rw-r--r--include/target/target_core_base.h73
-rw-r--r--include/target/target_core_configfs.h4
-rw-r--r--include/target/target_core_fabric_ops.h2
-rw-r--r--include/target/target_core_tmr.h52
-rw-r--r--include/target/target_core_transport.h6
-rw-r--r--include/trace/events/asoc.h25
-rw-r--r--include/trace/events/bkl.h61
-rw-r--r--include/trace/events/ext4.h775
-rw-r--r--include/trace/events/jbd2.h78
-rw-r--r--include/trace/events/mce.h8
-rw-r--r--include/trace/events/module.h5
-rw-r--r--include/trace/events/scsi.h28
-rw-r--r--include/trace/events/skb.h4
-rw-r--r--include/video/atmel_lcdc.h1
-rw-r--r--include/video/sh_mobile_lcdc.h10
-rw-r--r--include/xen/balloon.h25
-rw-r--r--include/xen/events.h38
-rw-r--r--include/xen/gntalloc.h82
-rw-r--r--include/xen/gntdev.h31
-rw-r--r--include/xen/interface/io/blkif.h37
-rw-r--r--include/xen/interface/io/netif.h80
-rw-r--r--include/xen/interface/sched.h34
-rw-r--r--include/xen/interface/xen.h4
-rw-r--r--include/xen/xen-ops.h6
-rw-r--r--include/xen/xenbus.h2
499 files changed, 14837 insertions, 3586 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index ef1cef77d32b..d7bd661bfae7 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -183,13 +183,19 @@
183 183
184#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) 184#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
185/* 185/*
186 * Module name is included in both debug and non-debug versions primarily for 186 * The module name is used primarily for error and debug messages.
187 * error messages. The __FILE__ macro is not very useful for this, because it 187 * The __FILE__ macro is not very useful for this, because it
188 * often includes the entire pathname to the module 188 * usually includes the entire pathname to the module making the
189 * debug output difficult to read.
189 */ 190 */
190#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; 191#define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name;
191#else 192#else
193/*
194 * For the no-debug and no-error-msg cases, we must at least define
195 * a null module name.
196 */
192#define ACPI_MODULE_NAME(name) 197#define ACPI_MODULE_NAME(name)
198#define _acpi_module_name ""
193#endif 199#endif
194 200
195/* 201/*
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 78ca429929f7..3a10ef5914eb 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -250,7 +250,6 @@ struct acpi_device_wakeup {
250 struct acpi_handle_list resources; 250 struct acpi_handle_list resources;
251 struct acpi_device_wakeup_flags flags; 251 struct acpi_device_wakeup_flags flags;
252 int prepare_count; 252 int prepare_count;
253 int run_wake_count;
254}; 253};
255 254
256/* Device */ 255/* Device */
@@ -381,7 +380,7 @@ struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
381int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 380int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
382int acpi_disable_wakeup_device_power(struct acpi_device *dev); 381int acpi_disable_wakeup_device_power(struct acpi_device *dev);
383 382
384#ifdef CONFIG_PM_OPS 383#ifdef CONFIG_PM
385int acpi_pm_device_sleep_state(struct device *, int *); 384int acpi_pm_device_sleep_state(struct device *, int *);
386#else 385#else
387static inline int acpi_pm_device_sleep_state(struct device *d, int *p) 386static inline int acpi_pm_device_sleep_state(struct device *d, int *p)
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e46ec95a8ada..f6ad63d25b73 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,7 +47,7 @@
47 47
48/* Current ACPICA subsystem version in YYYYMMDD format */ 48/* Current ACPICA subsystem version in YYYYMMDD format */
49 49
50#define ACPI_CA_VERSION 0x20110112 50#define ACPI_CA_VERSION 0x20110316
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 7e42bfee0e29..d41c94885211 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -343,4 +343,20 @@ struct acpi_table_desc {
343#include <acpi/actbl1.h> 343#include <acpi/actbl1.h>
344#include <acpi/actbl2.h> 344#include <acpi/actbl2.h>
345 345
346/*
347 * Sizes of the various flavors of FADT. We need to look closely
348 * at the FADT length because the version number essentially tells
349 * us nothing because of many BIOS bugs where the version does not
350 * match the expected length. In other words, the length of the
351 * FADT is the bottom line as to what the version really is.
352 *
353 * For reference, the values below are as follows:
354 * FADT V1 size: 0x74
355 * FADT V2 size: 0x84
356 * FADT V3+ size: 0xF4
357 */
358#define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4)
359#define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3)
360#define ACPI_FADT_V3_SIZE (u32) (sizeof (struct acpi_table_fadt))
361
346#endif /* __ACTBL_H__ */ 362#endif /* __ACTBL_H__ */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 0fc15dfb2e22..58bdd0545c5a 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: actbl2.h - ACPI Specification Revision 2.0 Tables 3 * Name: actbl2.h - ACPI Table Definitions (tables not in ACPI spec)
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
@@ -716,6 +716,68 @@ struct acpi_table_mchi {
716 716
717/******************************************************************************* 717/*******************************************************************************
718 * 718 *
719 * SLIC - Software Licensing Description Table
720 * Version 1
721 *
722 * Conforms to "OEM Activation 2.0 for Windows Vista Operating Systems",
723 * Copyright 2006
724 *
725 ******************************************************************************/
726
727/* Basic SLIC table is only the common ACPI header */
728
729struct acpi_table_slic {
730 struct acpi_table_header header; /* Common ACPI table header */
731};
732
733/* Common SLIC subtable header */
734
735struct acpi_slic_header {
736 u32 type;
737 u32 length;
738};
739
740/* Values for Type field above */
741
742enum acpi_slic_type {
743 ACPI_SLIC_TYPE_PUBLIC_KEY = 0,
744 ACPI_SLIC_TYPE_WINDOWS_MARKER = 1,
745 ACPI_SLIC_TYPE_RESERVED = 2 /* 2 and greater are reserved */
746};
747
748/*
749 * SLIC Sub-tables, correspond to Type in struct acpi_slic_header
750 */
751
752/* 0: Public Key Structure */
753
754struct acpi_slic_key {
755 struct acpi_slic_header header;
756 u8 key_type;
757 u8 version;
758 u16 reserved;
759 u32 algorithm;
760 char magic[4];
761 u32 bit_length;
762 u32 exponent;
763 u8 modulus[128];
764};
765
766/* 1: Windows Marker Structure */
767
768struct acpi_slic_marker {
769 struct acpi_slic_header header;
770 u32 version;
771 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
772 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
773 char windows_flag[8];
774 u32 slic_version;
775 u8 reserved[16];
776 u8 signature[128];
777};
778
779/*******************************************************************************
780 *
719 * SPCR - Serial Port Console Redirection table 781 * SPCR - Serial Port Console Redirection table
720 * Version 1 782 * Version 1
721 * 783 *
diff --git a/include/acpi/apei.h b/include/acpi/apei.h
index c4dbb132d902..e67b523a50e1 100644
--- a/include/acpi/apei.h
+++ b/include/acpi/apei.h
@@ -30,10 +30,11 @@ int apei_hest_parse(apei_hest_func_t func, void *data);
30 30
31int erst_write(const struct cper_record_header *record); 31int erst_write(const struct cper_record_header *record);
32ssize_t erst_get_record_count(void); 32ssize_t erst_get_record_count(void);
33int erst_get_next_record_id(u64 *record_id); 33int erst_get_record_id_begin(int *pos);
34int erst_get_record_id_next(int *pos, u64 *record_id);
35void erst_get_record_id_end(void);
34ssize_t erst_read(u64 record_id, struct cper_record_header *record, 36ssize_t erst_read(u64 record_id, struct cper_record_header *record,
35 size_t buflen); 37 size_t buflen);
36ssize_t erst_read_next(struct cper_record_header *record, size_t buflen);
37int erst_clear(u64 record_id); 38int erst_clear(u64 record_id);
38 39
39#endif 40#endif
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index a54f4421a24d..280ca7a96f75 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -38,8 +38,7 @@
38 38
39#include <asm-generic/bitops/atomic.h> 39#include <asm-generic/bitops/atomic.h>
40#include <asm-generic/bitops/non-atomic.h> 40#include <asm-generic/bitops/non-atomic.h>
41#include <asm-generic/bitops/ext2-non-atomic.h> 41#include <asm-generic/bitops/le.h>
42#include <asm-generic/bitops/ext2-atomic.h> 42#include <asm-generic/bitops/ext2-atomic.h>
43#include <asm-generic/bitops/minix.h>
44 43
45#endif /* __ASM_GENERIC_BITOPS_H */ 44#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/bitops/ext2-atomic.h b/include/asm-generic/bitops/ext2-atomic.h
index ab1c875efb74..ecf1c9d8a7cc 100644
--- a/include/asm-generic/bitops/ext2-atomic.h
+++ b/include/asm-generic/bitops/ext2-atomic.h
@@ -5,7 +5,7 @@
5 ({ \ 5 ({ \
6 int ret; \ 6 int ret; \
7 spin_lock(lock); \ 7 spin_lock(lock); \
8 ret = ext2_set_bit((nr), (unsigned long *)(addr)); \ 8 ret = __test_and_set_bit_le(nr, addr); \
9 spin_unlock(lock); \ 9 spin_unlock(lock); \
10 ret; \ 10 ret; \
11 }) 11 })
@@ -14,7 +14,7 @@
14 ({ \ 14 ({ \
15 int ret; \ 15 int ret; \
16 spin_lock(lock); \ 16 spin_lock(lock); \
17 ret = ext2_clear_bit((nr), (unsigned long *)(addr)); \ 17 ret = __test_and_clear_bit_le(nr, addr); \
18 spin_unlock(lock); \ 18 spin_unlock(lock); \
19 ret; \ 19 ret; \
20 }) 20 })
diff --git a/include/asm-generic/bitops/ext2-non-atomic.h b/include/asm-generic/bitops/ext2-non-atomic.h
deleted file mode 100644
index 63cf822431a2..000000000000
--- a/include/asm-generic/bitops/ext2-non-atomic.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
2#define _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define ext2_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define ext2_clear_bit(nr,addr) \
9 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
10
11#define ext2_test_bit(nr,addr) \
12 generic_test_le_bit((nr),(unsigned long *)(addr))
13#define ext2_find_first_zero_bit(addr, size) \
14 generic_find_first_zero_le_bit((unsigned long *)(addr), (size))
15#define ext2_find_next_zero_bit(addr, size, off) \
16 generic_find_next_zero_le_bit((unsigned long *)(addr), (size), (off))
17#define ext2_find_next_bit(addr, size, off) \
18 generic_find_next_le_bit((unsigned long *)(addr), (size), (off))
19
20#endif /* _ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index 80e3bf13b2b9..946a21b1b5dc 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -4,54 +4,77 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/byteorder.h> 5#include <asm/byteorder.h>
6 6
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
9
10#if defined(__LITTLE_ENDIAN) 7#if defined(__LITTLE_ENDIAN)
11 8
12#define generic_test_le_bit(nr, addr) test_bit(nr, addr) 9#define BITOP_LE_SWIZZLE 0
13#define generic___set_le_bit(nr, addr) __set_bit(nr, addr)
14#define generic___clear_le_bit(nr, addr) __clear_bit(nr, addr)
15 10
16#define generic_test_and_set_le_bit(nr, addr) test_and_set_bit(nr, addr) 11static inline unsigned long find_next_zero_bit_le(const void *addr,
17#define generic_test_and_clear_le_bit(nr, addr) test_and_clear_bit(nr, addr) 12 unsigned long size, unsigned long offset)
13{
14 return find_next_zero_bit(addr, size, offset);
15}
18 16
19#define generic___test_and_set_le_bit(nr, addr) __test_and_set_bit(nr, addr) 17static inline unsigned long find_next_bit_le(const void *addr,
20#define generic___test_and_clear_le_bit(nr, addr) __test_and_clear_bit(nr, addr) 18 unsigned long size, unsigned long offset)
19{
20 return find_next_bit(addr, size, offset);
21}
21 22
22#define generic_find_next_zero_le_bit(addr, size, offset) find_next_zero_bit(addr, size, offset) 23static inline unsigned long find_first_zero_bit_le(const void *addr,
23#define generic_find_next_le_bit(addr, size, offset) \ 24 unsigned long size)
24 find_next_bit(addr, size, offset) 25{
26 return find_first_zero_bit(addr, size);
27}
25 28
26#elif defined(__BIG_ENDIAN) 29#elif defined(__BIG_ENDIAN)
27 30
28#define generic_test_le_bit(nr, addr) \ 31#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
29 test_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
30#define generic___set_le_bit(nr, addr) \
31 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
32#define generic___clear_le_bit(nr, addr) \
33 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
34
35#define generic_test_and_set_le_bit(nr, addr) \
36 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
37#define generic_test_and_clear_le_bit(nr, addr) \
38 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
39
40#define generic___test_and_set_le_bit(nr, addr) \
41 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
42#define generic___test_and_clear_le_bit(nr, addr) \
43 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
44 32
45extern unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, 33extern unsigned long find_next_zero_bit_le(const void *addr,
46 unsigned long size, unsigned long offset); 34 unsigned long size, unsigned long offset);
47extern unsigned long generic_find_next_le_bit(const unsigned long *addr, 35extern unsigned long find_next_bit_le(const void *addr,
48 unsigned long size, unsigned long offset); 36 unsigned long size, unsigned long offset);
49 37
38#define find_first_zero_bit_le(addr, size) \
39 find_next_zero_bit_le((addr), (size), 0)
40
50#else 41#else
51#error "Please fix <asm/byteorder.h>" 42#error "Please fix <asm/byteorder.h>"
52#endif 43#endif
53 44
54#define generic_find_first_zero_le_bit(addr, size) \ 45static inline int test_bit_le(int nr, const void *addr)
55 generic_find_next_zero_le_bit((addr), (size), 0) 46{
47 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
48}
49
50static inline void __set_bit_le(int nr, void *addr)
51{
52 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
53}
54
55static inline void __clear_bit_le(int nr, void *addr)
56{
57 __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
58}
59
60static inline int test_and_set_bit_le(int nr, void *addr)
61{
62 return test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
63}
64
65static inline int test_and_clear_bit_le(int nr, void *addr)
66{
67 return test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
68}
69
70static inline int __test_and_set_bit_le(int nr, void *addr)
71{
72 return __test_and_set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
73}
74
75static inline int __test_and_clear_bit_le(int nr, void *addr)
76{
77 return __test_and_clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
78}
56 79
57#endif /* _ASM_GENERIC_BITOPS_LE_H_ */ 80#endif /* _ASM_GENERIC_BITOPS_LE_H_ */
diff --git a/include/asm-generic/bitops/minix-le.h b/include/asm-generic/bitops/minix-le.h
deleted file mode 100644
index 4a981c1bb1ae..000000000000
--- a/include/asm-generic/bitops/minix-le.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_LE_H_
2#define _ASM_GENERIC_BITOPS_MINIX_LE_H_
3
4#include <asm-generic/bitops/le.h>
5
6#define minix_test_and_set_bit(nr,addr) \
7 generic___test_and_set_le_bit((nr),(unsigned long *)(addr))
8#define minix_set_bit(nr,addr) \
9 generic___set_le_bit((nr),(unsigned long *)(addr))
10#define minix_test_and_clear_bit(nr,addr) \
11 generic___test_and_clear_le_bit((nr),(unsigned long *)(addr))
12#define minix_test_bit(nr,addr) \
13 generic_test_le_bit((nr),(unsigned long *)(addr))
14#define minix_find_first_zero_bit(addr,size) \
15 generic_find_first_zero_le_bit((unsigned long *)(addr),(size))
16
17#endif /* _ASM_GENERIC_BITOPS_MINIX_LE_H_ */
diff --git a/include/asm-generic/bitops/minix.h b/include/asm-generic/bitops/minix.h
deleted file mode 100644
index 91f42e87aa51..000000000000
--- a/include/asm-generic/bitops/minix.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_GENERIC_BITOPS_MINIX_H_
2#define _ASM_GENERIC_BITOPS_MINIX_H_
3
4#define minix_test_and_set_bit(nr,addr) \
5 __test_and_set_bit((nr),(unsigned long *)(addr))
6#define minix_set_bit(nr,addr) \
7 __set_bit((nr),(unsigned long *)(addr))
8#define minix_test_and_clear_bit(nr,addr) \
9 __test_and_clear_bit((nr),(unsigned long *)(addr))
10#define minix_test_bit(nr,addr) \
11 test_bit((nr),(unsigned long *)(addr))
12#define minix_find_first_zero_bit(addr,size) \
13 find_first_zero_bit((unsigned long *)(addr),(size))
14
15#endif /* _ASM_GENERIC_BITOPS_MINIX_H_ */
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c2c9ba032d46..f2d2faf4d9ae 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -165,10 +165,36 @@ extern void warn_slowpath_null(const char *file, const int line);
165#define WARN_ON_RATELIMIT(condition, state) \ 165#define WARN_ON_RATELIMIT(condition, state) \
166 WARN_ON((condition) && __ratelimit(state)) 166 WARN_ON((condition) && __ratelimit(state))
167 167
168/*
169 * WARN_ON_SMP() is for cases that the warning is either
170 * meaningless for !SMP or may even cause failures.
171 * This is usually used for cases that we have
172 * WARN_ON(!spin_is_locked(&lock)) checks, as spin_is_locked()
173 * returns 0 for uniprocessor settings.
174 * It can also be used with values that are only defined
175 * on SMP:
176 *
177 * struct foo {
178 * [...]
179 * #ifdef CONFIG_SMP
180 * int bar;
181 * #endif
182 * };
183 *
184 * void func(struct foo *zoot)
185 * {
186 * WARN_ON_SMP(!zoot->bar);
187 *
188 * For CONFIG_SMP, WARN_ON_SMP() should act the same as WARN_ON(),
189 * and should be a nop and return false for uniprocessor.
190 *
191 * if (WARN_ON_SMP(x)) returns true only when CONFIG_SMP is set
192 * and x is true.
193 */
168#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
169# define WARN_ON_SMP(x) WARN_ON(x) 195# define WARN_ON_SMP(x) WARN_ON(x)
170#else 196#else
171# define WARN_ON_SMP(x) do { } while (0) 197# define WARN_ON_SMP(x) ({0;})
172#endif 198#endif
173 199
174#endif 200#endif
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 2bcc5c7c22a6..61e03dd7939e 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -30,6 +30,9 @@ typedef u64 cputime64_t;
30#define cputime64_to_jiffies64(__ct) (__ct) 30#define cputime64_to_jiffies64(__ct) (__ct)
31#define jiffies64_to_cputime64(__jif) (__jif) 31#define jiffies64_to_cputime64(__jif) (__jif)
32#define cputime_to_cputime64(__ct) ((u64) __ct) 32#define cputime_to_cputime64(__ct) ((u64) __ct)
33#define cputime64_gt(__a, __b) ((__a) > (__b))
34
35#define nsecs_to_cputime64(__ct) nsecs_to_jiffies64(__ct)
33 36
34 37
35/* 38/*
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h
index 28cc03bf19e6..a1331ce50445 100644
--- a/include/asm-generic/errno.h
+++ b/include/asm-generic/errno.h
@@ -108,4 +108,6 @@
108 108
109#define ERFKILL 132 /* Operation not possible due to RF-kill */ 109#define ERFKILL 132 /* Operation not possible due to RF-kill */
110 110
111#define EHWPOISON 133 /* Memory page has hardware error */
112
111#endif 113#endif
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
index 0fc16e3f0bfc..84793c7025e2 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/asm-generic/fcntl.h
@@ -80,6 +80,10 @@
80#define O_SYNC (__O_SYNC|O_DSYNC) 80#define O_SYNC (__O_SYNC|O_DSYNC)
81#endif 81#endif
82 82
83#ifndef O_PATH
84#define O_PATH 010000000
85#endif
86
83#ifndef O_NDELAY 87#ifndef O_NDELAY
84#define O_NDELAY O_NONBLOCK 88#define O_NDELAY O_NONBLOCK
85#endif 89#endif
diff --git a/include/asm-generic/ftrace.h b/include/asm-generic/ftrace.h
new file mode 100644
index 000000000000..51abba9ea7ad
--- /dev/null
+++ b/include/asm-generic/ftrace.h
@@ -0,0 +1,16 @@
1/*
2 * linux/include/asm-generic/ftrace.h
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#ifndef __ASM_GENERIC_FTRACE_H__
9#define __ASM_GENERIC_FTRACE_H__
10
11/*
12 * Not all architectures need their own ftrace.h, the most
13 * common definitions are already in linux/ftrace.h.
14 */
15
16#endif /* __ASM_GENERIC_FTRACE_H__ */
diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h
index 3c2344f48136..01f227e14254 100644
--- a/include/asm-generic/futex.h
+++ b/include/asm-generic/futex.h
@@ -6,7 +6,7 @@
6#include <asm/errno.h> 6#include <asm/errno.h>
7 7
8static inline int 8static inline int
9futex_atomic_op_inuser (int encoded_op, int __user *uaddr) 9futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
10{ 10{
11 int op = (encoded_op >> 28) & 7; 11 int op = (encoded_op >> 28) & 7;
12 int cmp = (encoded_op >> 24) & 15; 12 int cmp = (encoded_op >> 24) & 15;
@@ -16,7 +16,7 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
16 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 16 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
17 oparg = 1 << oparg; 17 oparg = 1 << oparg;
18 18
19 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int))) 19 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
20 return -EFAULT; 20 return -EFAULT;
21 21
22 pagefault_disable(); 22 pagefault_disable();
@@ -48,7 +48,8 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
48} 48}
49 49
50static inline int 50static inline int
51futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) 51futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
52 u32 oldval, u32 newval)
52{ 53{
53 return -ENOSYS; 54 return -ENOSYS;
54} 55}
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 4644c9a7f724..e0ffa3ddb02a 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -94,6 +94,10 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
94#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr) 94#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
95#endif 95#endif
96 96
97#ifndef PCI_IOBASE
98#define PCI_IOBASE ((void __iomem *) 0)
99#endif
100
97/*****************************************************************************/ 101/*****************************************************************************/
98/* 102/*
99 * traditional input/output functions 103 * traditional input/output functions
@@ -101,32 +105,32 @@ static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
101 105
102static inline u8 inb(unsigned long addr) 106static inline u8 inb(unsigned long addr)
103{ 107{
104 return readb((volatile void __iomem *) addr); 108 return readb(addr + PCI_IOBASE);
105} 109}
106 110
107static inline u16 inw(unsigned long addr) 111static inline u16 inw(unsigned long addr)
108{ 112{
109 return readw((volatile void __iomem *) addr); 113 return readw(addr + PCI_IOBASE);
110} 114}
111 115
112static inline u32 inl(unsigned long addr) 116static inline u32 inl(unsigned long addr)
113{ 117{
114 return readl((volatile void __iomem *) addr); 118 return readl(addr + PCI_IOBASE);
115} 119}
116 120
117static inline void outb(u8 b, unsigned long addr) 121static inline void outb(u8 b, unsigned long addr)
118{ 122{
119 writeb(b, (volatile void __iomem *) addr); 123 writeb(b, addr + PCI_IOBASE);
120} 124}
121 125
122static inline void outw(u16 b, unsigned long addr) 126static inline void outw(u16 b, unsigned long addr)
123{ 127{
124 writew(b, (volatile void __iomem *) addr); 128 writew(b, addr + PCI_IOBASE);
125} 129}
126 130
127static inline void outl(u32 b, unsigned long addr) 131static inline void outl(u32 b, unsigned long addr)
128{ 132{
129 writel(b, (volatile void __iomem *) addr); 133 writel(b, addr + PCI_IOBASE);
130} 134}
131 135
132#define inb_p(addr) inb(addr) 136#define inb_p(addr) inb(addr)
@@ -213,32 +217,32 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
213 217
214static inline void readsl(const void __iomem *addr, void *buf, int len) 218static inline void readsl(const void __iomem *addr, void *buf, int len)
215{ 219{
216 insl((unsigned long)addr, buf, len); 220 insl(addr - PCI_IOBASE, buf, len);
217} 221}
218 222
219static inline void readsw(const void __iomem *addr, void *buf, int len) 223static inline void readsw(const void __iomem *addr, void *buf, int len)
220{ 224{
221 insw((unsigned long)addr, buf, len); 225 insw(addr - PCI_IOBASE, buf, len);
222} 226}
223 227
224static inline void readsb(const void __iomem *addr, void *buf, int len) 228static inline void readsb(const void __iomem *addr, void *buf, int len)
225{ 229{
226 insb((unsigned long)addr, buf, len); 230 insb(addr - PCI_IOBASE, buf, len);
227} 231}
228 232
229static inline void writesl(const void __iomem *addr, const void *buf, int len) 233static inline void writesl(const void __iomem *addr, const void *buf, int len)
230{ 234{
231 outsl((unsigned long)addr, buf, len); 235 outsl(addr - PCI_IOBASE, buf, len);
232} 236}
233 237
234static inline void writesw(const void __iomem *addr, const void *buf, int len) 238static inline void writesw(const void __iomem *addr, const void *buf, int len)
235{ 239{
236 outsw((unsigned long)addr, buf, len); 240 outsw(addr - PCI_IOBASE, buf, len);
237} 241}
238 242
239static inline void writesb(const void __iomem *addr, const void *buf, int len) 243static inline void writesb(const void __iomem *addr, const void *buf, int len)
240{ 244{
241 outsb((unsigned long)addr, buf, len); 245 outsb(addr - PCI_IOBASE, buf, len);
242} 246}
243 247
244#ifndef CONFIG_GENERIC_IOMAP 248#ifndef CONFIG_GENERIC_IOMAP
@@ -269,8 +273,9 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
269 outsl((unsigned long) (p), (src), (count)) 273 outsl((unsigned long) (p), (src), (count))
270#endif /* CONFIG_GENERIC_IOMAP */ 274#endif /* CONFIG_GENERIC_IOMAP */
271 275
272 276#ifndef IO_SPACE_LIMIT
273#define IO_SPACE_LIMIT 0xffffffff 277#define IO_SPACE_LIMIT 0xffff
278#endif
274 279
275#ifdef __KERNEL__ 280#ifdef __KERNEL__
276 281
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
index 3f3f2d189fb8..199975fac395 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/asm-generic/ioctls.h
@@ -73,6 +73,7 @@
73#define TCSETXF 0x5434 73#define TCSETXF 0x5434
74#define TCSETXW 0x5435 74#define TCSETXW 0x5435
75#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ 75#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
76#define TIOCVHANGUP 0x5437
76 77
77#define FIONCLEX 0x5450 78#define FIONCLEX 0x5450
78#define FIOCLEX 0x5451 79#define FIOCLEX 0x5451
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index b3bfabc258f3..c1a1216e29ce 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -11,6 +11,7 @@ extern char _sinittext[], _einittext[];
11extern char _end[]; 11extern char _end[];
12extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[]; 12extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
13extern char __kprobes_text_start[], __kprobes_text_end[]; 13extern char __kprobes_text_start[], __kprobes_text_end[];
14extern char __entry_text_start[], __entry_text_end[];
14extern char __initdata_begin[], __initdata_end[]; 15extern char __initdata_begin[], __initdata_end[];
15extern char __start_rodata[], __end_rodata[]; 16extern char __start_rodata[], __end_rodata[];
16 17
diff --git a/include/asm-generic/sizes.h b/include/asm-generic/sizes.h
new file mode 100644
index 000000000000..ea5d4ef81061
--- /dev/null
+++ b/include/asm-generic/sizes.h
@@ -0,0 +1,47 @@
1/*
2 * linux/include/asm-generic/sizes.h
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#ifndef __ASM_GENERIC_SIZES_H__
9#define __ASM_GENERIC_SIZES_H__
10
11#define SZ_1 0x00000001
12#define SZ_2 0x00000002
13#define SZ_4 0x00000004
14#define SZ_8 0x00000008
15#define SZ_16 0x00000010
16#define SZ_32 0x00000020
17#define SZ_64 0x00000040
18#define SZ_128 0x00000080
19#define SZ_256 0x00000100
20#define SZ_512 0x00000200
21
22#define SZ_1K 0x00000400
23#define SZ_2K 0x00000800
24#define SZ_4K 0x00001000
25#define SZ_8K 0x00002000
26#define SZ_16K 0x00004000
27#define SZ_32K 0x00008000
28#define SZ_64K 0x00010000
29#define SZ_128K 0x00020000
30#define SZ_256K 0x00040000
31#define SZ_512K 0x00080000
32
33#define SZ_1M 0x00100000
34#define SZ_2M 0x00200000
35#define SZ_4M 0x00400000
36#define SZ_8M 0x00800000
37#define SZ_16M 0x01000000
38#define SZ_32M 0x02000000
39#define SZ_64M 0x04000000
40#define SZ_128M 0x08000000
41#define SZ_256M 0x10000000
42#define SZ_512M 0x20000000
43
44#define SZ_1G 0x40000000
45#define SZ_2G 0x80000000
46
47#endif /* __ASM_GENERIC_SIZES_H__ */
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
index fba7d33ca3f2..7a0f69e6c618 100644
--- a/include/asm-generic/types.h
+++ b/include/asm-generic/types.h
@@ -12,31 +12,4 @@ typedef unsigned short umode_t;
12 12
13#endif /* __ASSEMBLY__ */ 13#endif /* __ASSEMBLY__ */
14 14
15/*
16 * These aren't exported outside the kernel to avoid name space clashes
17 */
18#ifdef __KERNEL__
19#ifndef __ASSEMBLY__
20/*
21 * DMA addresses may be very different from physical addresses
22 * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit
23 * systems, while sparc64 uses 32 bit DMA addresses for 64 bit
24 * physical addresses.
25 * This default defines dma_addr_t to have the same size as
26 * phys_addr_t, which is the most common way.
27 * Do not define the dma64_addr_t type, which never really
28 * worked.
29 */
30#ifndef dma_addr_t
31#ifdef CONFIG_PHYS_ADDR_T_64BIT
32typedef u64 dma_addr_t;
33#else
34typedef u32 dma_addr_t;
35#endif /* CONFIG_PHYS_ADDR_T_64BIT */
36#endif /* dma_addr_t */
37
38#endif /* __ASSEMBLY__ */
39
40#endif /* __KERNEL__ */
41
42#endif /* _ASM_GENERIC_TYPES_H */ 15#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index b218b8513d04..ac68c999b6c2 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -288,14 +288,16 @@ strncpy_from_user(char *dst, const char __user *src, long count)
288 * 288 *
289 * Return 0 on exception, a value greater than N if too long 289 * Return 0 on exception, a value greater than N if too long
290 */ 290 */
291#ifndef strnlen_user 291#ifndef __strnlen_user
292#define __strnlen_user strnlen
293#endif
294
292static inline long strnlen_user(const char __user *src, long n) 295static inline long strnlen_user(const char __user *src, long n)
293{ 296{
294 if (!access_ok(VERIFY_READ, src, 1)) 297 if (!access_ok(VERIFY_READ, src, 1))
295 return 0; 298 return 0;
296 return strlen((void * __force)src) + 1; 299 return __strnlen_user(src, n);
297} 300}
298#endif
299 301
300static inline long strlen_user(const char __user *src) 302static inline long strlen_user(const char __user *src)
301{ 303{
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index b969770196c2..07c40d5149de 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -646,9 +646,17 @@ __SYSCALL(__NR_prlimit64, sys_prlimit64)
646__SYSCALL(__NR_fanotify_init, sys_fanotify_init) 646__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
647#define __NR_fanotify_mark 263 647#define __NR_fanotify_mark 263
648__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) 648__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
649#define __NR_name_to_handle_at 264
650__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
651#define __NR_open_by_handle_at 265
652__SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
653#define __NR_clock_adjtime 266
654__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
655#define __NR_syncfs 267
656__SYSCALL(__NR_syncfs, sys_syncfs)
649 657
650#undef __NR_syscalls 658#undef __NR_syscalls
651#define __NR_syscalls 264 659#define __NR_syscalls 268
652 660
653/* 661/*
654 * All syscalls below here should go away really, 662 * All syscalls below here should go away really,
diff --git a/include/asm-generic/user.h b/include/asm-generic/user.h
index 8b9c3c960aeb..35638c34700f 100644
--- a/include/asm-generic/user.h
+++ b/include/asm-generic/user.h
@@ -1,8 +1,8 @@
1#ifndef __ASM_GENERIC_USER_H 1#ifndef __ASM_GENERIC_USER_H
2#define __ASM_GENERIC_USER_H 2#define __ASM_GENERIC_USER_H
3/* 3/*
4 * This file may define a 'struct user' structure. However, it it only 4 * This file may define a 'struct user' structure. However, it is only
5 * used for a.out file, which are not supported on new architectures. 5 * used for a.out files, which are not supported on new architectures.
6 */ 6 */
7 7
8#endif /* __ASM_GENERIC_USER_H */ 8#endif /* __ASM_GENERIC_USER_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fe77e3395b40..32c45e5fe0ab 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -15,7 +15,7 @@
15 * HEAD_TEXT_SECTION 15 * HEAD_TEXT_SECTION
16 * INIT_TEXT_SECTION(PAGE_SIZE) 16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...) 17 * INIT_DATA_SECTION(...)
18 * PERCPU(PAGE_SIZE) 18 * PERCPU(CACHELINE_SIZE, PAGE_SIZE)
19 * __init_end = .; 19 * __init_end = .;
20 * 20 *
21 * _stext = .; 21 * _stext = .;
@@ -424,6 +424,12 @@
424 *(.kprobes.text) \ 424 *(.kprobes.text) \
425 VMLINUX_SYMBOL(__kprobes_text_end) = .; 425 VMLINUX_SYMBOL(__kprobes_text_end) = .;
426 426
427#define ENTRY_TEXT \
428 ALIGN_FUNCTION(); \
429 VMLINUX_SYMBOL(__entry_text_start) = .; \
430 *(.entry.text) \
431 VMLINUX_SYMBOL(__entry_text_end) = .;
432
427#ifdef CONFIG_FUNCTION_GRAPH_TRACER 433#ifdef CONFIG_FUNCTION_GRAPH_TRACER
428#define IRQENTRY_TEXT \ 434#define IRQENTRY_TEXT \
429 ALIGN_FUNCTION(); \ 435 ALIGN_FUNCTION(); \
@@ -683,13 +689,18 @@
683 689
684/** 690/**
685 * PERCPU_VADDR - define output section for percpu area 691 * PERCPU_VADDR - define output section for percpu area
692 * @cacheline: cacheline size
686 * @vaddr: explicit base address (optional) 693 * @vaddr: explicit base address (optional)
687 * @phdr: destination PHDR (optional) 694 * @phdr: destination PHDR (optional)
688 * 695 *
689 * Macro which expands to output section for percpu area. If @vaddr 696 * Macro which expands to output section for percpu area.
690 * is not blank, it specifies explicit base address and all percpu 697 *
691 * symbols will be offset from the given address. If blank, @vaddr 698 * @cacheline is used to align subsections to avoid false cacheline
692 * always equals @laddr + LOAD_OFFSET. 699 * sharing between subsections for different purposes.
700 *
701 * If @vaddr is not blank, it specifies explicit base address and all
702 * percpu symbols will be offset from the given address. If blank,
703 * @vaddr always equals @laddr + LOAD_OFFSET.
693 * 704 *
694 * @phdr defines the output PHDR to use if not blank. Be warned that 705 * @phdr defines the output PHDR to use if not blank. Be warned that
695 * output PHDR is sticky. If @phdr is specified, the next output 706 * output PHDR is sticky. If @phdr is specified, the next output
@@ -700,7 +711,7 @@
700 * If there is no need to put the percpu section at a predetermined 711 * If there is no need to put the percpu section at a predetermined
701 * address, use PERCPU(). 712 * address, use PERCPU().
702 */ 713 */
703#define PERCPU_VADDR(vaddr, phdr) \ 714#define PERCPU_VADDR(cacheline, vaddr, phdr) \
704 VMLINUX_SYMBOL(__per_cpu_load) = .; \ 715 VMLINUX_SYMBOL(__per_cpu_load) = .; \
705 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \ 716 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
706 - LOAD_OFFSET) { \ 717 - LOAD_OFFSET) { \
@@ -708,7 +719,9 @@
708 *(.data..percpu..first) \ 719 *(.data..percpu..first) \
709 . = ALIGN(PAGE_SIZE); \ 720 . = ALIGN(PAGE_SIZE); \
710 *(.data..percpu..page_aligned) \ 721 *(.data..percpu..page_aligned) \
722 . = ALIGN(cacheline); \
711 *(.data..percpu..readmostly) \ 723 *(.data..percpu..readmostly) \
724 . = ALIGN(cacheline); \
712 *(.data..percpu) \ 725 *(.data..percpu) \
713 *(.data..percpu..shared_aligned) \ 726 *(.data..percpu..shared_aligned) \
714 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 727 VMLINUX_SYMBOL(__per_cpu_end) = .; \
@@ -717,18 +730,18 @@
717 730
718/** 731/**
719 * PERCPU - define output section for percpu area, simple version 732 * PERCPU - define output section for percpu area, simple version
733 * @cacheline: cacheline size
720 * @align: required alignment 734 * @align: required alignment
721 * 735 *
722 * Align to @align and outputs output section for percpu area. This 736 * Align to @align and outputs output section for percpu area. This macro
723 * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and 737 * doesn't manipulate @vaddr or @phdr and __per_cpu_load and
724 * __per_cpu_start will be identical. 738 * __per_cpu_start will be identical.
725 * 739 *
726 * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except 740 * This macro is equivalent to ALIGN(@align); PERCPU_VADDR(@cacheline,,)
727 * that __per_cpu_load is defined as a relative symbol against 741 * except that __per_cpu_load is defined as a relative symbol against
728 * .data..percpu which is required for relocatable x86_32 742 * .data..percpu which is required for relocatable x86_32 configuration.
729 * configuration.
730 */ 743 */
731#define PERCPU(align) \ 744#define PERCPU(cacheline, align) \
732 . = ALIGN(align); \ 745 . = ALIGN(align); \
733 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ 746 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
734 VMLINUX_SYMBOL(__per_cpu_load) = .; \ 747 VMLINUX_SYMBOL(__per_cpu_load) = .; \
@@ -736,7 +749,9 @@
736 *(.data..percpu..first) \ 749 *(.data..percpu..first) \
737 . = ALIGN(PAGE_SIZE); \ 750 . = ALIGN(PAGE_SIZE); \
738 *(.data..percpu..page_aligned) \ 751 *(.data..percpu..page_aligned) \
752 . = ALIGN(cacheline); \
739 *(.data..percpu..readmostly) \ 753 *(.data..percpu..readmostly) \
754 . = ALIGN(cacheline); \
740 *(.data..percpu) \ 755 *(.data..percpu) \
741 *(.data..percpu..shared_aligned) \ 756 *(.data..percpu..shared_aligned) \
742 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 757 VMLINUX_SYMBOL(__per_cpu_end) = .; \
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index ffec177f3481..3a60ac889520 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -2,7 +2,6 @@ header-y += drm.h
2header-y += drm_mode.h 2header-y += drm_mode.h
3header-y += drm_sarea.h 3header-y += drm_sarea.h
4header-y += i810_drm.h 4header-y += i810_drm.h
5header-y += i830_drm.h
6header-y += i915_drm.h 5header-y += i915_drm.h
7header-y += mga_drm.h 6header-y += mga_drm.h
8header-y += nouveau_drm.h 7header-y += nouveau_drm.h
diff --git a/include/drm/drm.h b/include/drm/drm.h
index e5f70617dec5..4be33b4ca2f8 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -463,12 +463,15 @@ struct drm_irq_busid {
463enum drm_vblank_seq_type { 463enum drm_vblank_seq_type {
464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ 464 _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */
465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ 465 _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */
466 /* bits 1-6 are reserved for high crtcs */
467 _DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
466 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */ 468 _DRM_VBLANK_EVENT = 0x4000000, /**< Send event instead of blocking */
467 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */ 469 _DRM_VBLANK_FLIP = 0x8000000, /**< Scheduled buffer swap should flip */
468 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ 470 _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */
469 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ 471 _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */
470 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */ 472 _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking, unsupported */
471}; 473};
474#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
472 475
473#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) 476#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
474#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \ 477#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
@@ -608,6 +611,12 @@ struct drm_gem_open {
608 __u64 size; 611 __u64 size;
609}; 612};
610 613
614/** DRM_IOCTL_GET_CAP ioctl argument type */
615struct drm_get_cap {
616 __u64 capability;
617 __u64 value;
618};
619
611#include "drm_mode.h" 620#include "drm_mode.h"
612 621
613#define DRM_IOCTL_BASE 'd' 622#define DRM_IOCTL_BASE 'd'
@@ -628,6 +637,7 @@ struct drm_gem_open {
628#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 637#define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close)
629#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 638#define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink)
630#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) 639#define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open)
640#define DRM_IOCTL_GET_CAP DRM_IOWR(0x0c, struct drm_get_cap)
631 641
632#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) 642#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique)
633#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) 643#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth)
@@ -701,6 +711,10 @@ struct drm_gem_open {
701#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 711#define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
702#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 712#define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
703 713
714#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
715#define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb)
716#define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
717
704/** 718/**
705 * Device specific ioctls should only be in their respective headers 719 * Device specific ioctls should only be in their respective headers
706 * The device specific ioctl range is from 0x40 to 0x99. 720 * The device specific ioctl range is from 0x40 to 0x99.
@@ -741,6 +755,9 @@ struct drm_event_vblank {
741 __u32 reserved; 755 __u32 reserved;
742}; 756};
743 757
758#define DRM_CAP_DUMB_BUFFER 0x1
759#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
760
744/* typedef area */ 761/* typedef area */
745#ifndef __KERNEL__ 762#ifndef __KERNEL__
746typedef struct drm_clip_rect drm_clip_rect_t; 763typedef struct drm_clip_rect drm_clip_rect_t;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 348843b80150..ad5770f2315c 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -145,7 +145,10 @@ extern void drm_ut_debug_printk(unsigned int request_level,
145#define DRIVER_IRQ_VBL2 0x800 145#define DRIVER_IRQ_VBL2 0x800
146#define DRIVER_GEM 0x1000 146#define DRIVER_GEM 0x1000
147#define DRIVER_MODESET 0x2000 147#define DRIVER_MODESET 0x2000
148#define DRIVER_USE_PLATFORM_DEVICE 0x4000 148
149#define DRIVER_BUS_PCI 0x1
150#define DRIVER_BUS_PLATFORM 0x2
151#define DRIVER_BUS_USB 0x3
149 152
150/***********************************************************************/ 153/***********************************************************************/
151/** \name Begin the DRM... */ 154/** \name Begin the DRM... */
@@ -698,6 +701,19 @@ struct drm_master {
698#define DRM_SCANOUTPOS_INVBL (1 << 1) 701#define DRM_SCANOUTPOS_INVBL (1 << 1)
699#define DRM_SCANOUTPOS_ACCURATE (1 << 2) 702#define DRM_SCANOUTPOS_ACCURATE (1 << 2)
700 703
704struct drm_bus {
705 int bus_type;
706 int (*get_irq)(struct drm_device *dev);
707 const char *(*get_name)(struct drm_device *dev);
708 int (*set_busid)(struct drm_device *dev, struct drm_master *master);
709 int (*set_unique)(struct drm_device *dev, struct drm_master *master,
710 struct drm_unique *unique);
711 int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
712 /* hooks that are for PCI */
713 int (*agp_init)(struct drm_device *dev);
714
715};
716
701/** 717/**
702 * DRM driver structure. This structure represent the common code for 718 * DRM driver structure. This structure represent the common code for
703 * a family of cards. There will one drm_device for each card present 719 * a family of cards. There will one drm_device for each card present
@@ -880,6 +896,17 @@ struct drm_driver {
880 /* vga arb irq handler */ 896 /* vga arb irq handler */
881 void (*vgaarb_irq)(struct drm_device *dev, bool state); 897 void (*vgaarb_irq)(struct drm_device *dev, bool state);
882 898
899 /* dumb alloc support */
900 int (*dumb_create)(struct drm_file *file_priv,
901 struct drm_device *dev,
902 struct drm_mode_create_dumb *args);
903 int (*dumb_map_offset)(struct drm_file *file_priv,
904 struct drm_device *dev, uint32_t handle,
905 uint64_t *offset);
906 int (*dumb_destroy)(struct drm_file *file_priv,
907 struct drm_device *dev,
908 uint32_t handle);
909
883 /* Driver private ops for this object */ 910 /* Driver private ops for this object */
884 struct vm_operations_struct *gem_vm_ops; 911 struct vm_operations_struct *gem_vm_ops;
885 912
@@ -895,8 +922,13 @@ struct drm_driver {
895 struct drm_ioctl_desc *ioctls; 922 struct drm_ioctl_desc *ioctls;
896 int num_ioctls; 923 int num_ioctls;
897 struct file_operations fops; 924 struct file_operations fops;
898 struct pci_driver pci_driver; 925 union {
899 struct platform_device *platform_device; 926 struct pci_driver *pci;
927 struct platform_device *platform_device;
928 struct usb_driver *usb;
929 } kdriver;
930 struct drm_bus *bus;
931
900 /* List of devices hanging off this driver */ 932 /* List of devices hanging off this driver */
901 struct list_head device_list; 933 struct list_head device_list;
902}; 934};
@@ -1099,6 +1131,7 @@ struct drm_device {
1099#endif 1131#endif
1100 1132
1101 struct platform_device *platformdev; /**< Platform device struture */ 1133 struct platform_device *platformdev; /**< Platform device struture */
1134 struct usb_device *usbdev;
1102 1135
1103 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1136 struct drm_sg_mem *sg; /**< Scatter gather memory */
1104 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 1137 unsigned int num_crtcs; /**< Number of CRTCs on this device */
@@ -1136,28 +1169,9 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
1136 1169
1137static inline int drm_dev_to_irq(struct drm_device *dev) 1170static inline int drm_dev_to_irq(struct drm_device *dev)
1138{ 1171{
1139 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1172 return dev->driver->bus->get_irq(dev);
1140 return platform_get_irq(dev->platformdev, 0);
1141 else
1142 return dev->pdev->irq;
1143} 1173}
1144 1174
1145static inline int drm_get_pci_domain(struct drm_device *dev)
1146{
1147 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1148 return 0;
1149
1150#ifndef __alpha__
1151 /* For historical reasons, drm_get_pci_domain() is busticated
1152 * on most archs and has to remain so for userspace interface
1153 * < 1.4, except on alpha which was right from the beginning
1154 */
1155 if (dev->if_version < 0x10004)
1156 return 0;
1157#endif /* __alpha__ */
1158
1159 return pci_domain_nr(dev->pdev->bus);
1160}
1161 1175
1162#if __OS_HAS_AGP 1176#if __OS_HAS_AGP
1163static inline int drm_core_has_AGP(struct drm_device *dev) 1177static inline int drm_core_has_AGP(struct drm_device *dev)
@@ -1211,8 +1225,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
1211/*@{*/ 1225/*@{*/
1212 1226
1213 /* Driver support (drm_drv.h) */ 1227 /* Driver support (drm_drv.h) */
1214extern int drm_init(struct drm_driver *driver);
1215extern void drm_exit(struct drm_driver *driver);
1216extern long drm_ioctl(struct file *filp, 1228extern long drm_ioctl(struct file *filp,
1217 unsigned int cmd, unsigned long arg); 1229 unsigned int cmd, unsigned long arg);
1218extern long drm_compat_ioctl(struct file *filp, 1230extern long drm_compat_ioctl(struct file *filp,
@@ -1264,6 +1276,8 @@ extern int drm_getclient(struct drm_device *dev, void *data,
1264 struct drm_file *file_priv); 1276 struct drm_file *file_priv);
1265extern int drm_getstats(struct drm_device *dev, void *data, 1277extern int drm_getstats(struct drm_device *dev, void *data,
1266 struct drm_file *file_priv); 1278 struct drm_file *file_priv);
1279extern int drm_getcap(struct drm_device *dev, void *data,
1280 struct drm_file *file_priv);
1267extern int drm_setversion(struct drm_device *dev, void *data, 1281extern int drm_setversion(struct drm_device *dev, void *data,
1268 struct drm_file *file_priv); 1282 struct drm_file *file_priv);
1269extern int drm_noop(struct drm_device *dev, void *data, 1283extern int drm_noop(struct drm_device *dev, void *data,
@@ -1422,11 +1436,7 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
1422struct drm_master *drm_master_create(struct drm_minor *minor); 1436struct drm_master *drm_master_create(struct drm_minor *minor);
1423extern struct drm_master *drm_master_get(struct drm_master *master); 1437extern struct drm_master *drm_master_get(struct drm_master *master);
1424extern void drm_master_put(struct drm_master **master); 1438extern void drm_master_put(struct drm_master **master);
1425extern int drm_get_pci_dev(struct pci_dev *pdev, 1439
1426 const struct pci_device_id *ent,
1427 struct drm_driver *driver);
1428extern int drm_get_platform_dev(struct platform_device *pdev,
1429 struct drm_driver *driver);
1430extern void drm_put_dev(struct drm_device *dev); 1440extern void drm_put_dev(struct drm_device *dev);
1431extern int drm_put_minor(struct drm_minor **minor); 1441extern int drm_put_minor(struct drm_minor **minor);
1432extern unsigned int drm_debug; 1442extern unsigned int drm_debug;
@@ -1544,6 +1554,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj)
1544int drm_gem_handle_create(struct drm_file *file_priv, 1554int drm_gem_handle_create(struct drm_file *file_priv,
1545 struct drm_gem_object *obj, 1555 struct drm_gem_object *obj,
1546 u32 *handlep); 1556 u32 *handlep);
1557int drm_gem_handle_delete(struct drm_file *filp, u32 handle);
1547 1558
1548static inline void 1559static inline void
1549drm_gem_object_handle_reference(struct drm_gem_object *obj) 1560drm_gem_object_handle_reference(struct drm_gem_object *obj)
@@ -1616,11 +1627,21 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1616 return NULL; 1627 return NULL;
1617} 1628}
1618 1629
1619static __inline__ int drm_device_is_agp(struct drm_device *dev) 1630static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1620{ 1631{
1621 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) 1632}
1622 return 0;
1623 1633
1634#include "drm_mem_util.h"
1635
1636extern int drm_fill_in_dev(struct drm_device *dev,
1637 const struct pci_device_id *ent,
1638 struct drm_driver *driver);
1639int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type);
1640/*@}*/
1641
1642/* PCI section */
1643static __inline__ int drm_pci_device_is_agp(struct drm_device *dev)
1644{
1624 if (dev->driver->device_is_agp != NULL) { 1645 if (dev->driver->device_is_agp != NULL) {
1625 int err = (*dev->driver->device_is_agp) (dev); 1646 int err = (*dev->driver->device_is_agp) (dev);
1626 1647
@@ -1632,35 +1653,26 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev)
1632 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); 1653 return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
1633} 1654}
1634 1655
1635static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1636{
1637 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1638 return 0;
1639 else
1640 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1641}
1642 1656
1643static __inline__ void drm_core_dropmap(struct drm_local_map *map) 1657static __inline__ int drm_pci_device_is_pcie(struct drm_device *dev)
1644{ 1658{
1659 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1645} 1660}
1646 1661
1647#include "drm_mem_util.h"
1648
1649static inline void *drm_get_device(struct drm_device *dev)
1650{
1651 if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
1652 return dev->platformdev;
1653 else
1654 return dev->pdev;
1655}
1656 1662
1657extern int drm_platform_init(struct drm_driver *driver); 1663extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver);
1658extern int drm_pci_init(struct drm_driver *driver); 1664extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver);
1659extern int drm_fill_in_dev(struct drm_device *dev, 1665extern int drm_get_pci_dev(struct pci_dev *pdev,
1660 const struct pci_device_id *ent, 1666 const struct pci_device_id *ent,
1661 struct drm_driver *driver); 1667 struct drm_driver *driver);
1662int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); 1668
1663/*@}*/ 1669
1670/* platform section */
1671extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device);
1672extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device);
1673
1674extern int drm_get_platform_dev(struct platform_device *pdev,
1675 struct drm_driver *driver);
1664 1676
1665#endif /* __KERNEL__ */ 1677#endif /* __KERNEL__ */
1666#endif 1678#endif
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 801be59f4f15..60edf9be31e5 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -659,7 +659,7 @@ extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid
659extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode); 659extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
660extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode); 660extern void drm_mode_remove(struct drm_connector *connector, struct drm_display_mode *mode);
661extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, 661extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
662 struct drm_display_mode *mode); 662 const struct drm_display_mode *mode);
663extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); 663extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode);
664extern void drm_mode_config_init(struct drm_device *dev); 664extern void drm_mode_config_init(struct drm_device *dev);
665extern void drm_mode_config_reset(struct drm_device *dev); 665extern void drm_mode_config_reset(struct drm_device *dev);
@@ -685,8 +685,8 @@ extern void drm_mode_validate_size(struct drm_device *dev,
685extern void drm_mode_prune_invalid(struct drm_device *dev, 685extern void drm_mode_prune_invalid(struct drm_device *dev,
686 struct list_head *mode_list, bool verbose); 686 struct list_head *mode_list, bool verbose);
687extern void drm_mode_sort(struct list_head *mode_list); 687extern void drm_mode_sort(struct list_head *mode_list);
688extern int drm_mode_hsync(struct drm_display_mode *mode); 688extern int drm_mode_hsync(const struct drm_display_mode *mode);
689extern int drm_mode_vrefresh(struct drm_display_mode *mode); 689extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
690extern void drm_mode_set_crtcinfo(struct drm_display_mode *p, 690extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
691 int adjust_flags); 691 int adjust_flags);
692extern void drm_mode_connector_list_update(struct drm_connector *connector); 692extern void drm_mode_connector_list_update(struct drm_connector *connector);
@@ -798,4 +798,11 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
798extern bool drm_edid_is_valid(struct edid *edid); 798extern bool drm_edid_is_valid(struct edid *edid);
799struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 799struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
800 int hsize, int vsize, int fresh); 800 int hsize, int vsize, int fresh);
801
802extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
803 void *data, struct drm_file *file_priv);
804extern int drm_mode_mmap_dumb_ioctl(struct drm_device *dev,
805 void *data, struct drm_file *file_priv);
806extern int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
807 void *data, struct drm_file *file_priv);
801#endif /* __DRM_CRTC_H__ */ 808#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index 0af087a4d3b3..3650d5d011ee 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -45,14 +45,10 @@ struct drm_hash_item {
45}; 45};
46 46
47struct drm_open_hash { 47struct drm_open_hash {
48 unsigned int size;
49 unsigned int order;
50 unsigned int fill;
51 struct hlist_head *table; 48 struct hlist_head *table;
52 int use_vmalloc; 49 u8 order;
53}; 50};
54 51
55
56extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order); 52extern int drm_ht_create(struct drm_open_hash *ht, unsigned int order);
57extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item); 53extern int drm_ht_insert_item(struct drm_open_hash *ht, struct drm_hash_item *item);
58extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item, 54extern int drm_ht_just_insert_please(struct drm_open_hash *ht, struct drm_hash_item *item,
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index e39177778601..b1e7809e5e15 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -42,23 +42,25 @@
42#endif 42#endif
43 43
44struct drm_mm_node { 44struct drm_mm_node {
45 struct list_head free_stack;
46 struct list_head node_list; 45 struct list_head node_list;
47 unsigned free : 1; 46 struct list_head hole_stack;
47 unsigned hole_follows : 1;
48 unsigned scanned_block : 1; 48 unsigned scanned_block : 1;
49 unsigned scanned_prev_free : 1; 49 unsigned scanned_prev_free : 1;
50 unsigned scanned_next_free : 1; 50 unsigned scanned_next_free : 1;
51 unsigned scanned_preceeds_hole : 1;
52 unsigned allocated : 1;
51 unsigned long start; 53 unsigned long start;
52 unsigned long size; 54 unsigned long size;
53 struct drm_mm *mm; 55 struct drm_mm *mm;
54}; 56};
55 57
56struct drm_mm { 58struct drm_mm {
57 /* List of free memory blocks, most recently freed ordered. */ 59 /* List of all memory nodes that immediatly preceed a free hole. */
58 struct list_head free_stack; 60 struct list_head hole_stack;
59 /* List of all memory nodes, ordered according to the (increasing) start 61 /* head_node.node_list is the list of all memory nodes, ordered
60 * address of the memory node. */ 62 * according to the (increasing) start address of the memory node. */
61 struct list_head node_list; 63 struct drm_mm_node head_node;
62 struct list_head unused_nodes; 64 struct list_head unused_nodes;
63 int num_unused; 65 int num_unused;
64 spinlock_t unused_lock; 66 spinlock_t unused_lock;
@@ -70,8 +72,28 @@ struct drm_mm {
70 unsigned scanned_blocks; 72 unsigned scanned_blocks;
71 unsigned long scan_start; 73 unsigned long scan_start;
72 unsigned long scan_end; 74 unsigned long scan_end;
75 struct drm_mm_node *prev_scanned_node;
73}; 76};
74 77
78static inline bool drm_mm_node_allocated(struct drm_mm_node *node)
79{
80 return node->allocated;
81}
82
83static inline bool drm_mm_initialized(struct drm_mm *mm)
84{
85 return mm->hole_stack.next;
86}
87#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
88 &(mm)->head_node.node_list, \
89 node_list);
90#define drm_mm_for_each_scanned_node_reverse(entry, n, mm) \
91 for (entry = (mm)->prev_scanned_node, \
92 next = entry ? list_entry(entry->node_list.next, \
93 struct drm_mm_node, node_list) : NULL; \
94 entry != NULL; entry = next, \
95 next = entry ? list_entry(entry->node_list.next, \
96 struct drm_mm_node, node_list) : NULL) \
75/* 97/*
76 * Basic range manager support (drm_mm.c) 98 * Basic range manager support (drm_mm.c)
77 */ 99 */
@@ -118,7 +140,15 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
118 return drm_mm_get_block_range_generic(parent, size, alignment, 140 return drm_mm_get_block_range_generic(parent, size, alignment,
119 start, end, 1); 141 start, end, 1);
120} 142}
143extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node,
144 unsigned long size, unsigned alignment);
145extern int drm_mm_insert_node_in_range(struct drm_mm *mm,
146 struct drm_mm_node *node,
147 unsigned long size, unsigned alignment,
148 unsigned long start, unsigned long end);
121extern void drm_mm_put_block(struct drm_mm_node *cur); 149extern void drm_mm_put_block(struct drm_mm_node *cur);
150extern void drm_mm_remove_node(struct drm_mm_node *node);
151extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
122extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, 152extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
123 unsigned long size, 153 unsigned long size,
124 unsigned alignment, 154 unsigned alignment,
@@ -134,11 +164,6 @@ extern int drm_mm_init(struct drm_mm *mm, unsigned long start,
134 unsigned long size); 164 unsigned long size);
135extern void drm_mm_takedown(struct drm_mm *mm); 165extern void drm_mm_takedown(struct drm_mm *mm);
136extern int drm_mm_clean(struct drm_mm *mm); 166extern int drm_mm_clean(struct drm_mm *mm);
137extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
138extern int drm_mm_remove_space_from_tail(struct drm_mm *mm,
139 unsigned long size);
140extern int drm_mm_add_space_to_tail(struct drm_mm *mm,
141 unsigned long size, int atomic);
142extern int drm_mm_pre_get(struct drm_mm *mm); 167extern int drm_mm_pre_get(struct drm_mm *mm);
143 168
144static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block) 169static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 0fc7397c8f1f..ae6b7a3dbec7 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -344,4 +344,33 @@ struct drm_mode_crtc_page_flip {
344 __u64 user_data; 344 __u64 user_data;
345}; 345};
346 346
347/* create a dumb scanout buffer */
348struct drm_mode_create_dumb {
349 uint32_t height;
350 uint32_t width;
351 uint32_t bpp;
352 uint32_t flags;
353 /* handle, pitch, size will be returned */
354 uint32_t handle;
355 uint32_t pitch;
356 uint64_t size;
357};
358
359/* set up for mmap of a dumb scanout buffer */
360struct drm_mode_map_dumb {
361 /** Handle for the object being mapped. */
362 __u32 handle;
363 __u32 pad;
364 /**
365 * Fake offset to use for subsequent mmap call
366 *
367 * This is a fixed-size type for 32/64 compatibility.
368 */
369 __u64 offset;
370};
371
372struct drm_mode_destroy_dumb {
373 uint32_t handle;
374};
375
347#endif 376#endif
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index 5ff1194dc2ea..820ee9029482 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -141,6 +141,20 @@
141 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 141 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 142 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 143 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x6700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x6703, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x6704, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x6705, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x6706, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x6707, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x6708, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x6709, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x6718, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x6719, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x671c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x671d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CAYMAN|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 158 {0x1002, 0x6720, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 159 {0x1002, 0x6721, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \ 160 {0x1002, 0x6722, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BARTS|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/drm_usb.h b/include/drm/drm_usb.h
new file mode 100644
index 000000000000..33506c11da8b
--- /dev/null
+++ b/include/drm/drm_usb.h
@@ -0,0 +1,15 @@
1#ifndef DRM_USB_H
2#define DRM_USB_H
3
4#include <drmP.h>
5
6#include <linux/usb.h>
7
8extern int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver);
9extern void drm_usb_exit(struct drm_driver *driver, struct usb_driver *udriver);
10
11int drm_get_usb_dev(struct usb_interface *interface,
12 const struct usb_device_id *id,
13 struct drm_driver *driver);
14
15#endif
diff --git a/include/drm/i830_drm.h b/include/drm/i830_drm.h
deleted file mode 100644
index 61315c29b8f3..000000000000
--- a/include/drm/i830_drm.h
+++ /dev/null
@@ -1,342 +0,0 @@
1#ifndef _I830_DRM_H_
2#define _I830_DRM_H_
3
4/* WARNING: These defines must be the same as what the Xserver uses.
5 * if you change them, you must change the defines in the Xserver.
6 *
7 * KW: Actually, you can't ever change them because doing so would
8 * break backwards compatibility.
9 */
10
11#ifndef _I830_DEFINES_
12#define _I830_DEFINES_
13
14#define I830_DMA_BUF_ORDER 12
15#define I830_DMA_BUF_SZ (1<<I830_DMA_BUF_ORDER)
16#define I830_DMA_BUF_NR 256
17#define I830_NR_SAREA_CLIPRECTS 8
18
19/* Each region is a minimum of 64k, and there are at most 64 of them.
20 */
21#define I830_NR_TEX_REGIONS 64
22#define I830_LOG_MIN_TEX_REGION_SIZE 16
23
24/* KW: These aren't correct but someone set them to two and then
25 * released the module. Now we can't change them as doing so would
26 * break backwards compatibility.
27 */
28#define I830_TEXTURE_COUNT 2
29#define I830_TEXBLEND_COUNT I830_TEXTURE_COUNT
30
31#define I830_TEXBLEND_SIZE 12 /* (4 args + op) * 2 + COLOR_FACTOR */
32
33#define I830_UPLOAD_CTX 0x1
34#define I830_UPLOAD_BUFFERS 0x2
35#define I830_UPLOAD_CLIPRECTS 0x4
36#define I830_UPLOAD_TEX0_IMAGE 0x100 /* handled clientside */
37#define I830_UPLOAD_TEX0_CUBE 0x200 /* handled clientside */
38#define I830_UPLOAD_TEX1_IMAGE 0x400 /* handled clientside */
39#define I830_UPLOAD_TEX1_CUBE 0x800 /* handled clientside */
40#define I830_UPLOAD_TEX2_IMAGE 0x1000 /* handled clientside */
41#define I830_UPLOAD_TEX2_CUBE 0x2000 /* handled clientside */
42#define I830_UPLOAD_TEX3_IMAGE 0x4000 /* handled clientside */
43#define I830_UPLOAD_TEX3_CUBE 0x8000 /* handled clientside */
44#define I830_UPLOAD_TEX_N_IMAGE(n) (0x100 << (n * 2))
45#define I830_UPLOAD_TEX_N_CUBE(n) (0x200 << (n * 2))
46#define I830_UPLOAD_TEXIMAGE_MASK 0xff00
47#define I830_UPLOAD_TEX0 0x10000
48#define I830_UPLOAD_TEX1 0x20000
49#define I830_UPLOAD_TEX2 0x40000
50#define I830_UPLOAD_TEX3 0x80000
51#define I830_UPLOAD_TEX_N(n) (0x10000 << (n))
52#define I830_UPLOAD_TEX_MASK 0xf0000
53#define I830_UPLOAD_TEXBLEND0 0x100000
54#define I830_UPLOAD_TEXBLEND1 0x200000
55#define I830_UPLOAD_TEXBLEND2 0x400000
56#define I830_UPLOAD_TEXBLEND3 0x800000
57#define I830_UPLOAD_TEXBLEND_N(n) (0x100000 << (n))
58#define I830_UPLOAD_TEXBLEND_MASK 0xf00000
59#define I830_UPLOAD_TEX_PALETTE_N(n) (0x1000000 << (n))
60#define I830_UPLOAD_TEX_PALETTE_SHARED 0x4000000
61#define I830_UPLOAD_STIPPLE 0x8000000
62
63/* Indices into buf.Setup where various bits of state are mirrored per
64 * context and per buffer. These can be fired at the card as a unit,
65 * or in a piecewise fashion as required.
66 */
67
68/* Destbuffer state
69 * - backbuffer linear offset and pitch -- invarient in the current dri
70 * - zbuffer linear offset and pitch -- also invarient
71 * - drawing origin in back and depth buffers.
72 *
73 * Keep the depth/back buffer state here to accommodate private buffers
74 * in the future.
75 */
76
77#define I830_DESTREG_CBUFADDR 0
78#define I830_DESTREG_DBUFADDR 1
79#define I830_DESTREG_DV0 2
80#define I830_DESTREG_DV1 3
81#define I830_DESTREG_SENABLE 4
82#define I830_DESTREG_SR0 5
83#define I830_DESTREG_SR1 6
84#define I830_DESTREG_SR2 7
85#define I830_DESTREG_DR0 8
86#define I830_DESTREG_DR1 9
87#define I830_DESTREG_DR2 10
88#define I830_DESTREG_DR3 11
89#define I830_DESTREG_DR4 12
90#define I830_DEST_SETUP_SIZE 13
91
92/* Context state
93 */
94#define I830_CTXREG_STATE1 0
95#define I830_CTXREG_STATE2 1
96#define I830_CTXREG_STATE3 2
97#define I830_CTXREG_STATE4 3
98#define I830_CTXREG_STATE5 4
99#define I830_CTXREG_IALPHAB 5
100#define I830_CTXREG_STENCILTST 6
101#define I830_CTXREG_ENABLES_1 7
102#define I830_CTXREG_ENABLES_2 8
103#define I830_CTXREG_AA 9
104#define I830_CTXREG_FOGCOLOR 10
105#define I830_CTXREG_BLENDCOLR0 11
106#define I830_CTXREG_BLENDCOLR 12 /* Dword 1 of 2 dword command */
107#define I830_CTXREG_VF 13
108#define I830_CTXREG_VF2 14
109#define I830_CTXREG_MCSB0 15
110#define I830_CTXREG_MCSB1 16
111#define I830_CTX_SETUP_SIZE 17
112
113/* 1.3: Stipple state
114 */
115#define I830_STPREG_ST0 0
116#define I830_STPREG_ST1 1
117#define I830_STP_SETUP_SIZE 2
118
119/* Texture state (per tex unit)
120 */
121
122#define I830_TEXREG_MI0 0 /* GFX_OP_MAP_INFO (6 dwords) */
123#define I830_TEXREG_MI1 1
124#define I830_TEXREG_MI2 2
125#define I830_TEXREG_MI3 3
126#define I830_TEXREG_MI4 4
127#define I830_TEXREG_MI5 5
128#define I830_TEXREG_MF 6 /* GFX_OP_MAP_FILTER */
129#define I830_TEXREG_MLC 7 /* GFX_OP_MAP_LOD_CTL */
130#define I830_TEXREG_MLL 8 /* GFX_OP_MAP_LOD_LIMITS */
131#define I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS */
132#define I830_TEX_SETUP_SIZE 10
133
134#define I830_TEXREG_TM0LI 0 /* load immediate 2 texture map n */
135#define I830_TEXREG_TM0S0 1
136#define I830_TEXREG_TM0S1 2
137#define I830_TEXREG_TM0S2 3
138#define I830_TEXREG_TM0S3 4
139#define I830_TEXREG_TM0S4 5
140#define I830_TEXREG_NOP0 6 /* noop */
141#define I830_TEXREG_NOP1 7 /* noop */
142#define I830_TEXREG_NOP2 8 /* noop */
143#define __I830_TEXREG_MCS 9 /* GFX_OP_MAP_COORD_SETS -- shared */
144#define __I830_TEX_SETUP_SIZE 10
145
146#define I830_FRONT 0x1
147#define I830_BACK 0x2
148#define I830_DEPTH 0x4
149
150#endif /* _I830_DEFINES_ */
151
152typedef struct _drm_i830_init {
153 enum {
154 I830_INIT_DMA = 0x01,
155 I830_CLEANUP_DMA = 0x02
156 } func;
157 unsigned int mmio_offset;
158 unsigned int buffers_offset;
159 int sarea_priv_offset;
160 unsigned int ring_start;
161 unsigned int ring_end;
162 unsigned int ring_size;
163 unsigned int front_offset;
164 unsigned int back_offset;
165 unsigned int depth_offset;
166 unsigned int w;
167 unsigned int h;
168 unsigned int pitch;
169 unsigned int pitch_bits;
170 unsigned int back_pitch;
171 unsigned int depth_pitch;
172 unsigned int cpp;
173} drm_i830_init_t;
174
175/* Warning: If you change the SAREA structure you must change the Xserver
176 * structure as well */
177
178typedef struct _drm_i830_tex_region {
179 unsigned char next, prev; /* indices to form a circular LRU */
180 unsigned char in_use; /* owned by a client, or free? */
181 int age; /* tracked by clients to update local LRU's */
182} drm_i830_tex_region_t;
183
184typedef struct _drm_i830_sarea {
185 unsigned int ContextState[I830_CTX_SETUP_SIZE];
186 unsigned int BufferState[I830_DEST_SETUP_SIZE];
187 unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE];
188 unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
189 unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT];
190 unsigned int Palette[2][256];
191 unsigned int dirty;
192
193 unsigned int nbox;
194 struct drm_clip_rect boxes[I830_NR_SAREA_CLIPRECTS];
195
196 /* Maintain an LRU of contiguous regions of texture space. If
197 * you think you own a region of texture memory, and it has an
198 * age different to the one you set, then you are mistaken and
199 * it has been stolen by another client. If global texAge
200 * hasn't changed, there is no need to walk the list.
201 *
202 * These regions can be used as a proxy for the fine-grained
203 * texture information of other clients - by maintaining them
204 * in the same lru which is used to age their own textures,
205 * clients have an approximate lru for the whole of global
206 * texture space, and can make informed decisions as to which
207 * areas to kick out. There is no need to choose whether to
208 * kick out your own texture or someone else's - simply eject
209 * them all in LRU order.
210 */
211
212 drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS + 1];
213 /* Last elt is sentinal */
214 int texAge; /* last time texture was uploaded */
215 int last_enqueue; /* last time a buffer was enqueued */
216 int last_dispatch; /* age of the most recently dispatched buffer */
217 int last_quiescent; /* */
218 int ctxOwner; /* last context to upload state */
219
220 int vertex_prim;
221
222 int pf_enabled; /* is pageflipping allowed? */
223 int pf_active;
224 int pf_current_page; /* which buffer is being displayed? */
225
226 int perf_boxes; /* performance boxes to be displayed */
227
228 /* Here's the state for texunits 2,3:
229 */
230 unsigned int TexState2[I830_TEX_SETUP_SIZE];
231 unsigned int TexBlendState2[I830_TEXBLEND_SIZE];
232 unsigned int TexBlendStateWordsUsed2;
233
234 unsigned int TexState3[I830_TEX_SETUP_SIZE];
235 unsigned int TexBlendState3[I830_TEXBLEND_SIZE];
236 unsigned int TexBlendStateWordsUsed3;
237
238 unsigned int StippleState[I830_STP_SETUP_SIZE];
239} drm_i830_sarea_t;
240
241/* Flags for perf_boxes
242 */
243#define I830_BOX_RING_EMPTY 0x1 /* populated by kernel */
244#define I830_BOX_FLIP 0x2 /* populated by kernel */
245#define I830_BOX_WAIT 0x4 /* populated by kernel & client */
246#define I830_BOX_TEXTURE_LOAD 0x8 /* populated by kernel */
247#define I830_BOX_LOST_CONTEXT 0x10 /* populated by client */
248
249/* I830 specific ioctls
250 * The device specific ioctl range is 0x40 to 0x79.
251 */
252#define DRM_I830_INIT 0x00
253#define DRM_I830_VERTEX 0x01
254#define DRM_I830_CLEAR 0x02
255#define DRM_I830_FLUSH 0x03
256#define DRM_I830_GETAGE 0x04
257#define DRM_I830_GETBUF 0x05
258#define DRM_I830_SWAP 0x06
259#define DRM_I830_COPY 0x07
260#define DRM_I830_DOCOPY 0x08
261#define DRM_I830_FLIP 0x09
262#define DRM_I830_IRQ_EMIT 0x0a
263#define DRM_I830_IRQ_WAIT 0x0b
264#define DRM_I830_GETPARAM 0x0c
265#define DRM_I830_SETPARAM 0x0d
266
267#define DRM_IOCTL_I830_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_INIT, drm_i830_init_t)
268#define DRM_IOCTL_I830_VERTEX DRM_IOW( DRM_COMMAND_BASE + DRM_I830_VERTEX, drm_i830_vertex_t)
269#define DRM_IOCTL_I830_CLEAR DRM_IOW( DRM_COMMAND_BASE + DRM_I830_CLEAR, drm_i830_clear_t)
270#define DRM_IOCTL_I830_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLUSH)
271#define DRM_IOCTL_I830_GETAGE DRM_IO ( DRM_COMMAND_BASE + DRM_I830_GETAGE)
272#define DRM_IOCTL_I830_GETBUF DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETBUF, drm_i830_dma_t)
273#define DRM_IOCTL_I830_SWAP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_SWAP)
274#define DRM_IOCTL_I830_COPY DRM_IOW( DRM_COMMAND_BASE + DRM_I830_COPY, drm_i830_copy_t)
275#define DRM_IOCTL_I830_DOCOPY DRM_IO ( DRM_COMMAND_BASE + DRM_I830_DOCOPY)
276#define DRM_IOCTL_I830_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I830_FLIP)
277#define DRM_IOCTL_I830_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_IRQ_EMIT, drm_i830_irq_emit_t)
278#define DRM_IOCTL_I830_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I830_IRQ_WAIT, drm_i830_irq_wait_t)
279#define DRM_IOCTL_I830_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_GETPARAM, drm_i830_getparam_t)
280#define DRM_IOCTL_I830_SETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I830_SETPARAM, drm_i830_setparam_t)
281
282typedef struct _drm_i830_clear {
283 int clear_color;
284 int clear_depth;
285 int flags;
286 unsigned int clear_colormask;
287 unsigned int clear_depthmask;
288} drm_i830_clear_t;
289
290/* These may be placeholders if we have more cliprects than
291 * I830_NR_SAREA_CLIPRECTS. In that case, the client sets discard to
292 * false, indicating that the buffer will be dispatched again with a
293 * new set of cliprects.
294 */
295typedef struct _drm_i830_vertex {
296 int idx; /* buffer index */
297 int used; /* nr bytes in use */
298 int discard; /* client is finished with the buffer? */
299} drm_i830_vertex_t;
300
301typedef struct _drm_i830_copy_t {
302 int idx; /* buffer index */
303 int used; /* nr bytes in use */
304 void __user *address; /* Address to copy from */
305} drm_i830_copy_t;
306
307typedef struct drm_i830_dma {
308 void __user *virtual;
309 int request_idx;
310 int request_size;
311 int granted;
312} drm_i830_dma_t;
313
314/* 1.3: Userspace can request & wait on irq's:
315 */
316typedef struct drm_i830_irq_emit {
317 int __user *irq_seq;
318} drm_i830_irq_emit_t;
319
320typedef struct drm_i830_irq_wait {
321 int irq_seq;
322} drm_i830_irq_wait_t;
323
324/* 1.3: New ioctl to query kernel params:
325 */
326#define I830_PARAM_IRQ_ACTIVE 1
327
328typedef struct drm_i830_getparam {
329 int param;
330 int __user *value;
331} drm_i830_getparam_t;
332
333/* 1.3: New ioctl to set kernel params:
334 */
335#define I830_SETPARAM_USE_MI_BATCHBUFFER_START 1
336
337typedef struct drm_i830_setparam {
338 int param;
339 int value;
340} drm_i830_setparam_t;
341
342#endif /* _I830_DRM_H_ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 0039f1f97ad8..c4d6dbfa3ff4 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -290,6 +290,7 @@ typedef struct drm_i915_irq_wait {
290#define I915_PARAM_HAS_RELAXED_FENCING 12 290#define I915_PARAM_HAS_RELAXED_FENCING 12
291#define I915_PARAM_HAS_COHERENT_RINGS 13 291#define I915_PARAM_HAS_COHERENT_RINGS 13
292#define I915_PARAM_HAS_EXEC_CONSTANTS 14 292#define I915_PARAM_HAS_EXEC_CONSTANTS 14
293#define I915_PARAM_HAS_RELAXED_DELTA 15
293 294
294typedef struct drm_i915_getparam { 295typedef struct drm_i915_getparam {
295 int param; 296 int param;
diff --git a/include/drm/nouveau_drm.h b/include/drm/nouveau_drm.h
index e2cfe80f6fca..5edd3a76fffa 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/drm/nouveau_drm.h
@@ -94,6 +94,7 @@ struct drm_nouveau_setparam {
94#define NOUVEAU_GEM_DOMAIN_GART (1 << 2) 94#define NOUVEAU_GEM_DOMAIN_GART (1 << 2)
95#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3) 95#define NOUVEAU_GEM_DOMAIN_MAPPABLE (1 << 3)
96 96
97#define NOUVEAU_GEM_TILE_COMP 0x00030000 /* nv50-only */
97#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00 98#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
98#define NOUVEAU_GEM_TILE_16BPP 0x00000001 99#define NOUVEAU_GEM_TILE_16BPP 0x00000001
99#define NOUVEAU_GEM_TILE_32BPP 0x00000002 100#define NOUVEAU_GEM_TILE_32BPP 0x00000002
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index e5c607a02d57..3dec41cf8342 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -908,6 +908,7 @@ struct drm_radeon_cs {
908#define RADEON_INFO_WANT_HYPERZ 0x07 908#define RADEON_INFO_WANT_HYPERZ 0x07
909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */ 909#define RADEON_INFO_WANT_CMASK 0x08 /* get access to CMASK on r300 */
910#define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */ 910#define RADEON_INFO_CLOCK_CRYSTAL_FREQ 0x09 /* clock crystal frequency */
911#define RADEON_INFO_NUM_BACKENDS 0x0a /* DB/backends for r600+ - need for OQ */
911 912
912struct drm_radeon_info { 913struct drm_radeon_info {
913 uint32_t request; 914 uint32_t request;
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 1da8af6ac884..efed0820d9fa 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -50,13 +50,15 @@ struct ttm_backend_func {
50 * @pages: Array of pointers to ttm pages. 50 * @pages: Array of pointers to ttm pages.
51 * @dummy_read_page: Page to be used instead of NULL pages in the 51 * @dummy_read_page: Page to be used instead of NULL pages in the
52 * array @pages. 52 * array @pages.
53 * @dma_addrs: Array of DMA (bus) address of the ttm pages.
53 * 54 *
54 * Populate the backend with ttm pages. Depending on the backend, 55 * Populate the backend with ttm pages. Depending on the backend,
55 * it may or may not copy the @pages array. 56 * it may or may not copy the @pages array.
56 */ 57 */
57 int (*populate) (struct ttm_backend *backend, 58 int (*populate) (struct ttm_backend *backend,
58 unsigned long num_pages, struct page **pages, 59 unsigned long num_pages, struct page **pages,
59 struct page *dummy_read_page); 60 struct page *dummy_read_page,
61 dma_addr_t *dma_addrs);
60 /** 62 /**
61 * struct ttm_backend_func member clear 63 * struct ttm_backend_func member clear
62 * 64 *
@@ -149,6 +151,7 @@ enum ttm_caching_state {
149 * @swap_storage: Pointer to shmem struct file for swap storage. 151 * @swap_storage: Pointer to shmem struct file for swap storage.
150 * @caching_state: The current caching state of the pages. 152 * @caching_state: The current caching state of the pages.
151 * @state: The current binding state of the pages. 153 * @state: The current binding state of the pages.
154 * @dma_address: The DMA (bus) addresses of the pages (if TTM_PAGE_FLAG_DMA32)
152 * 155 *
153 * This is a structure holding the pages, caching- and aperture binding 156 * This is a structure holding the pages, caching- and aperture binding
154 * status for a buffer object that isn't backed by fixed (VRAM / AGP) 157 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
@@ -173,6 +176,7 @@ struct ttm_tt {
173 tt_unbound, 176 tt_unbound,
174 tt_unpopulated, 177 tt_unpopulated,
175 } state; 178 } state;
179 dma_addr_t *dma_address;
176}; 180};
177 181
178#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ 182#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 116821448c38..8062890f725e 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -36,11 +36,13 @@
36 * @flags: ttm flags for page allocation. 36 * @flags: ttm flags for page allocation.
37 * @cstate: ttm caching state for the page. 37 * @cstate: ttm caching state for the page.
38 * @count: number of pages to allocate. 38 * @count: number of pages to allocate.
39 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
39 */ 40 */
40int ttm_get_pages(struct list_head *pages, 41int ttm_get_pages(struct list_head *pages,
41 int flags, 42 int flags,
42 enum ttm_caching_state cstate, 43 enum ttm_caching_state cstate,
43 unsigned count); 44 unsigned count,
45 dma_addr_t *dma_address);
44/** 46/**
45 * Put linked list of pages to pool. 47 * Put linked list of pages to pool.
46 * 48 *
@@ -49,11 +51,13 @@ int ttm_get_pages(struct list_head *pages,
49 * count. 51 * count.
50 * @flags: ttm flags for page allocation. 52 * @flags: ttm flags for page allocation.
51 * @cstate: ttm caching state. 53 * @cstate: ttm caching state.
54 * @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).
52 */ 55 */
53void ttm_put_pages(struct list_head *pages, 56void ttm_put_pages(struct list_head *pages,
54 unsigned page_count, 57 unsigned page_count,
55 int flags, 58 int flags,
56 enum ttm_caching_state cstate); 59 enum ttm_caching_state cstate,
60 dma_addr_t *dma_address);
57/** 61/**
58 * Initialize pool allocator. 62 * Initialize pool allocator.
59 */ 63 */
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h
index 5cb86c307f5d..fc4875433817 100644
--- a/include/keys/rxrpc-type.h
+++ b/include/keys/rxrpc-type.h
@@ -99,7 +99,6 @@ struct rxrpc_key_token {
99 * structure of raw payloads passed to add_key() or instantiate key 99 * structure of raw payloads passed to add_key() or instantiate key
100 */ 100 */
101struct rxrpc_key_data_v1 { 101struct rxrpc_key_data_v1 {
102 u32 kif_version; /* 1 */
103 u16 security_index; 102 u16 security_index;
104 u16 ticket_length; 103 u16 ticket_length;
105 u32 expiry; /* time_t */ 104 u32 expiry; /* time_t */
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index b0ada6f37dd6..75cf611641e6 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -233,6 +233,7 @@ header-y += magic.h
233header-y += major.h 233header-y += major.h
234header-y += map_to_7segment.h 234header-y += map_to_7segment.h
235header-y += matroxfb.h 235header-y += matroxfb.h
236header-y += media.h
236header-y += mempolicy.h 237header-y += mempolicy.h
237header-y += meye.h 238header-y += meye.h
238header-y += mii.h 239header-y += mii.h
@@ -276,6 +277,7 @@ header-y += nfsacl.h
276header-y += nl80211.h 277header-y += nl80211.h
277header-y += nubus.h 278header-y += nubus.h
278header-y += nvram.h 279header-y += nvram.h
280header-y += omap3isp.h
279header-y += omapfb.h 281header-y += omapfb.h
280header-y += oom.h 282header-y += oom.h
281header-y += param.h 283header-y += param.h
@@ -370,6 +372,8 @@ header-y += unistd.h
370header-y += usbdevice_fs.h 372header-y += usbdevice_fs.h
371header-y += utime.h 373header-y += utime.h
372header-y += utsname.h 374header-y += utsname.h
375header-y += v4l2-mediabus.h
376header-y += v4l2-subdev.h
373header-y += veth.h 377header-y += veth.h
374header-y += vhost.h 378header-y += vhost.h
375header-y += videodev2.h 379header-y += videodev2.h
diff --git a/include/linux/acpi_io.h b/include/linux/acpi_io.h
index 7180013a4a3a..4afd7102459d 100644
--- a/include/linux/acpi_io.h
+++ b/include/linux/acpi_io.h
@@ -10,7 +10,6 @@ static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
10 return ioremap_cache(phys, size); 10 return ioremap_cache(phys, size);
11} 11}
12 12
13int acpi_os_map_generic_address(struct acpi_generic_address *addr); 13void __iomem *acpi_os_get_iomem(acpi_physical_address phys, unsigned int size);
14void acpi_os_unmap_generic_address(struct acpi_generic_address *addr);
15 14
16#endif 15#endif
diff --git a/include/linux/aer.h b/include/linux/aer.h
index f7df1eefc107..8414de22a779 100644
--- a/include/linux/aer.h
+++ b/include/linux/aer.h
@@ -7,6 +7,28 @@
7#ifndef _AER_H_ 7#ifndef _AER_H_
8#define _AER_H_ 8#define _AER_H_
9 9
10struct aer_header_log_regs {
11 unsigned int dw0;
12 unsigned int dw1;
13 unsigned int dw2;
14 unsigned int dw3;
15};
16
17struct aer_capability_regs {
18 u32 header;
19 u32 uncor_status;
20 u32 uncor_mask;
21 u32 uncor_severity;
22 u32 cor_status;
23 u32 cor_mask;
24 u32 cap_control;
25 struct aer_header_log_regs header_log;
26 u32 root_command;
27 u32 root_status;
28 u16 cor_err_source;
29 u16 uncor_err_source;
30};
31
10#if defined(CONFIG_PCIEAER) 32#if defined(CONFIG_PCIEAER)
11/* pci-e port driver needs this function to enable aer */ 33/* pci-e port driver needs this function to enable aer */
12extern int pci_enable_pcie_error_reporting(struct pci_dev *dev); 34extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
@@ -27,5 +49,7 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
27} 49}
28#endif 50#endif
29 51
52extern void cper_print_aer(const char *prefix, int cper_severity,
53 struct aer_capability_regs *aer);
30#endif //_AER_H_ 54#endif //_AER_H_
31 55
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 9e7f259346e1..fcbbe71a3cc1 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -43,12 +43,12 @@ struct amba_id {
43 43
44struct amba_driver { 44struct amba_driver {
45 struct device_driver drv; 45 struct device_driver drv;
46 int (*probe)(struct amba_device *, struct amba_id *); 46 int (*probe)(struct amba_device *, const struct amba_id *);
47 int (*remove)(struct amba_device *); 47 int (*remove)(struct amba_device *);
48 void (*shutdown)(struct amba_device *); 48 void (*shutdown)(struct amba_device *);
49 int (*suspend)(struct amba_device *, pm_message_t); 49 int (*suspend)(struct amba_device *, pm_message_t);
50 int (*resume)(struct amba_device *); 50 int (*resume)(struct amba_device *);
51 struct amba_id *id_table; 51 const struct amba_id *id_table;
52}; 52};
53 53
54enum amba_vendor { 54enum amba_vendor {
@@ -56,6 +56,10 @@ enum amba_vendor {
56 AMBA_VENDOR_ST = 0x80, 56 AMBA_VENDOR_ST = 0x80,
57}; 57};
58 58
59extern struct bus_type amba_bustype;
60
61#define to_amba_device(d) container_of(d, struct amba_device, dev)
62
59#define amba_get_drvdata(d) dev_get_drvdata(&d->dev) 63#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
60#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p) 64#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
61 65
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index be33b3affc8a..24d26efd1432 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -53,6 +53,7 @@
53#define CNTL_LCDBPP8 (3 << 1) 53#define CNTL_LCDBPP8 (3 << 1)
54#define CNTL_LCDBPP16 (4 << 1) 54#define CNTL_LCDBPP16 (4 << 1)
55#define CNTL_LCDBPP16_565 (6 << 1) 55#define CNTL_LCDBPP16_565 (6 << 1)
56#define CNTL_LCDBPP16_444 (7 << 1)
56#define CNTL_LCDBPP24 (5 << 1) 57#define CNTL_LCDBPP24 (5 << 1)
57#define CNTL_LCDBW (1 << 4) 58#define CNTL_LCDBW (1 << 4)
58#define CNTL_LCDTFT (1 << 5) 59#define CNTL_LCDTFT (1 << 5)
@@ -66,6 +67,32 @@
66#define CNTL_LDMAFIFOTIME (1 << 15) 67#define CNTL_LDMAFIFOTIME (1 << 15)
67#define CNTL_WATERMARK (1 << 16) 68#define CNTL_WATERMARK (1 << 16)
68 69
70enum {
71 /* individual formats */
72 CLCD_CAP_RGB444 = (1 << 0),
73 CLCD_CAP_RGB5551 = (1 << 1),
74 CLCD_CAP_RGB565 = (1 << 2),
75 CLCD_CAP_RGB888 = (1 << 3),
76 CLCD_CAP_BGR444 = (1 << 4),
77 CLCD_CAP_BGR5551 = (1 << 5),
78 CLCD_CAP_BGR565 = (1 << 6),
79 CLCD_CAP_BGR888 = (1 << 7),
80
81 /* connection layouts */
82 CLCD_CAP_444 = CLCD_CAP_RGB444 | CLCD_CAP_BGR444,
83 CLCD_CAP_5551 = CLCD_CAP_RGB5551 | CLCD_CAP_BGR5551,
84 CLCD_CAP_565 = CLCD_CAP_RGB565 | CLCD_CAP_BGR565,
85 CLCD_CAP_888 = CLCD_CAP_RGB888 | CLCD_CAP_BGR888,
86
87 /* red/blue ordering */
88 CLCD_CAP_RGB = CLCD_CAP_RGB444 | CLCD_CAP_RGB5551 |
89 CLCD_CAP_RGB565 | CLCD_CAP_RGB888,
90 CLCD_CAP_BGR = CLCD_CAP_BGR444 | CLCD_CAP_BGR5551 |
91 CLCD_CAP_BGR565 | CLCD_CAP_BGR888,
92
93 CLCD_CAP_ALL = CLCD_CAP_BGR | CLCD_CAP_RGB,
94};
95
69struct clcd_panel { 96struct clcd_panel {
70 struct fb_videomode mode; 97 struct fb_videomode mode;
71 signed short width; /* width in mm */ 98 signed short width; /* width in mm */
@@ -73,6 +100,7 @@ struct clcd_panel {
73 u32 tim2; 100 u32 tim2;
74 u32 tim3; 101 u32 tim3;
75 u32 cntl; 102 u32 cntl;
103 u32 caps;
76 unsigned int bpp:8, 104 unsigned int bpp:8,
77 fixedtimings:1, 105 fixedtimings:1,
78 grayscale:1; 106 grayscale:1;
@@ -97,6 +125,11 @@ struct clcd_board {
97 const char *name; 125 const char *name;
98 126
99 /* 127 /*
128 * Optional. Hardware capability flags.
129 */
130 u32 caps;
131
132 /*
100 * Optional. Check whether the var structure is acceptable 133 * Optional. Check whether the var structure is acceptable
101 * for this display. 134 * for this display.
102 */ 135 */
@@ -155,34 +188,35 @@ struct clcd_fb {
155 188
156static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs) 189static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
157{ 190{
191 struct fb_var_screeninfo *var = &fb->fb.var;
158 u32 val, cpl; 192 u32 val, cpl;
159 193
160 /* 194 /*
161 * Program the CLCD controller registers and start the CLCD 195 * Program the CLCD controller registers and start the CLCD
162 */ 196 */
163 val = ((fb->fb.var.xres / 16) - 1) << 2; 197 val = ((var->xres / 16) - 1) << 2;
164 val |= (fb->fb.var.hsync_len - 1) << 8; 198 val |= (var->hsync_len - 1) << 8;
165 val |= (fb->fb.var.right_margin - 1) << 16; 199 val |= (var->right_margin - 1) << 16;
166 val |= (fb->fb.var.left_margin - 1) << 24; 200 val |= (var->left_margin - 1) << 24;
167 regs->tim0 = val; 201 regs->tim0 = val;
168 202
169 val = fb->fb.var.yres; 203 val = var->yres;
170 if (fb->panel->cntl & CNTL_LCDDUAL) 204 if (fb->panel->cntl & CNTL_LCDDUAL)
171 val /= 2; 205 val /= 2;
172 val -= 1; 206 val -= 1;
173 val |= (fb->fb.var.vsync_len - 1) << 10; 207 val |= (var->vsync_len - 1) << 10;
174 val |= fb->fb.var.lower_margin << 16; 208 val |= var->lower_margin << 16;
175 val |= fb->fb.var.upper_margin << 24; 209 val |= var->upper_margin << 24;
176 regs->tim1 = val; 210 regs->tim1 = val;
177 211
178 val = fb->panel->tim2; 212 val = fb->panel->tim2;
179 val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS; 213 val |= var->sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
180 val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS; 214 val |= var->sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
181 215
182 cpl = fb->fb.var.xres_virtual; 216 cpl = var->xres_virtual;
183 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */ 217 if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
184 /* / 1 */; 218 /* / 1 */;
185 else if (!fb->fb.var.grayscale) /* STN color */ 219 else if (!var->grayscale) /* STN color */
186 cpl = cpl * 8 / 3; 220 cpl = cpl * 8 / 3;
187 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */ 221 else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
188 cpl /= 8; 222 cpl /= 8;
@@ -194,10 +228,22 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
194 regs->tim3 = fb->panel->tim3; 228 regs->tim3 = fb->panel->tim3;
195 229
196 val = fb->panel->cntl; 230 val = fb->panel->cntl;
197 if (fb->fb.var.grayscale) 231 if (var->grayscale)
198 val |= CNTL_LCDBW; 232 val |= CNTL_LCDBW;
199 233
200 switch (fb->fb.var.bits_per_pixel) { 234 if (fb->panel->caps && fb->board->caps &&
235 var->bits_per_pixel >= 16) {
236 /*
237 * if board and panel supply capabilities, we can support
238 * changing BGR/RGB depending on supplied parameters
239 */
240 if (var->red.offset == 0)
241 val &= ~CNTL_BGR;
242 else
243 val |= CNTL_BGR;
244 }
245
246 switch (var->bits_per_pixel) {
201 case 1: 247 case 1:
202 val |= CNTL_LCDBPP1; 248 val |= CNTL_LCDBPP1;
203 break; 249 break;
@@ -212,15 +258,17 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
212 break; 258 break;
213 case 16: 259 case 16:
214 /* 260 /*
215 * PL110 cannot choose between 5551 and 565 modes in 261 * PL110 cannot choose between 5551 and 565 modes in its
216 * its control register 262 * control register. It is possible to use 565 with
263 * custom external wiring.
217 */ 264 */
218 if ((fb->dev->periphid & 0x000fffff) == 0x00041110) 265 if (amba_part(fb->dev) == 0x110 ||
266 var->green.length == 5)
219 val |= CNTL_LCDBPP16; 267 val |= CNTL_LCDBPP16;
220 else if (fb->fb.var.green.length == 5) 268 else if (var->green.length == 6)
221 val |= CNTL_LCDBPP16;
222 else
223 val |= CNTL_LCDBPP16_565; 269 val |= CNTL_LCDBPP16_565;
270 else
271 val |= CNTL_LCDBPP16_444;
224 break; 272 break;
225 case 32: 273 case 32:
226 val |= CNTL_LCDBPP24; 274 val |= CNTL_LCDBPP24;
@@ -228,7 +276,7 @@ static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
228 } 276 }
229 277
230 regs->cntl = val; 278 regs->cntl = val;
231 regs->pixclock = fb->fb.var.pixclock; 279 regs->pixclock = var->pixclock;
232} 280}
233 281
234static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var) 282static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index f4ee9acc9721..f60227088b7b 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -6,6 +6,9 @@
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8 8
9/* Just some dummy forwarding */
10struct dma_chan;
11
9/** 12/**
10 * struct mmci_platform_data - platform configuration for the MMCI 13 * struct mmci_platform_data - platform configuration for the MMCI
11 * (also known as PL180) block. 14 * (also known as PL180) block.
@@ -27,6 +30,17 @@
27 * @cd_invert: true if the gpio_cd pin value is active low 30 * @cd_invert: true if the gpio_cd pin value is active low
28 * @capabilities: the capabilities of the block as implemented in 31 * @capabilities: the capabilities of the block as implemented in
29 * this platform, signify anything MMC_CAP_* from mmc/host.h 32 * this platform, signify anything MMC_CAP_* from mmc/host.h
33 * @dma_filter: function used to select an apropriate RX and TX
34 * DMA channel to be used for DMA, if and only if you're deploying the
35 * generic DMA engine
36 * @dma_rx_param: parameter passed to the DMA allocation
37 * filter in order to select an apropriate RX channel. If
38 * there is a bidirectional RX+TX channel, then just specify
39 * this and leave dma_tx_param set to NULL
40 * @dma_tx_param: parameter passed to the DMA allocation
41 * filter in order to select an apropriate TX channel. If this
42 * is NULL the driver will attempt to use the RX channel as a
43 * bidirectional channel
30 */ 44 */
31struct mmci_platform_data { 45struct mmci_platform_data {
32 unsigned int f_max; 46 unsigned int f_max;
@@ -38,6 +52,9 @@ struct mmci_platform_data {
38 int gpio_cd; 52 int gpio_cd;
39 bool cd_invert; 53 bool cd_invert;
40 unsigned long capabilities; 54 unsigned long capabilities;
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param;
57 void *dma_tx_param;
41}; 58};
42 59
43#endif 60#endif
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 0c4929fa34d3..32df2b6ef0e0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -89,6 +89,7 @@ enum {
89 ATA_ID_SPG = 98, 89 ATA_ID_SPG = 98,
90 ATA_ID_LBA_CAPACITY_2 = 100, 90 ATA_ID_LBA_CAPACITY_2 = 100,
91 ATA_ID_SECTOR_SIZE = 106, 91 ATA_ID_SECTOR_SIZE = 106,
92 ATA_ID_WWN = 108,
92 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */ 93 ATA_ID_LOGICAL_SECTOR_SIZE = 117, /* and 118 */
93 ATA_ID_LAST_LUN = 126, 94 ATA_ID_LAST_LUN = 126,
94 ATA_ID_DLF = 128, 95 ATA_ID_DLF = 128,
@@ -103,6 +104,7 @@ enum {
103 ATA_ID_SERNO_LEN = 20, 104 ATA_ID_SERNO_LEN = 20,
104 ATA_ID_FW_REV_LEN = 8, 105 ATA_ID_FW_REV_LEN = 8,
105 ATA_ID_PROD_LEN = 40, 106 ATA_ID_PROD_LEN = 40,
107 ATA_ID_WWN_LEN = 8,
106 108
107 ATA_PCI_CTL_OFS = 2, 109 ATA_PCI_CTL_OFS = 2,
108 110
@@ -598,42 +600,42 @@ static inline bool ata_id_has_dipm(const u16 *id)
598} 600}
599 601
600 602
601static inline int ata_id_has_fua(const u16 *id) 603static inline bool ata_id_has_fua(const u16 *id)
602{ 604{
603 if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000) 605 if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000)
604 return 0; 606 return false;
605 return id[ATA_ID_CFSSE] & (1 << 6); 607 return id[ATA_ID_CFSSE] & (1 << 6);
606} 608}
607 609
608static inline int ata_id_has_flush(const u16 *id) 610static inline bool ata_id_has_flush(const u16 *id)
609{ 611{
610 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 612 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
611 return 0; 613 return false;
612 return id[ATA_ID_COMMAND_SET_2] & (1 << 12); 614 return id[ATA_ID_COMMAND_SET_2] & (1 << 12);
613} 615}
614 616
615static inline int ata_id_flush_enabled(const u16 *id) 617static inline bool ata_id_flush_enabled(const u16 *id)
616{ 618{
617 if (ata_id_has_flush(id) == 0) 619 if (ata_id_has_flush(id) == 0)
618 return 0; 620 return false;
619 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 621 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
620 return 0; 622 return false;
621 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12); 623 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12);
622} 624}
623 625
624static inline int ata_id_has_flush_ext(const u16 *id) 626static inline bool ata_id_has_flush_ext(const u16 *id)
625{ 627{
626 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 628 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
627 return 0; 629 return false;
628 return id[ATA_ID_COMMAND_SET_2] & (1 << 13); 630 return id[ATA_ID_COMMAND_SET_2] & (1 << 13);
629} 631}
630 632
631static inline int ata_id_flush_ext_enabled(const u16 *id) 633static inline bool ata_id_flush_ext_enabled(const u16 *id)
632{ 634{
633 if (ata_id_has_flush_ext(id) == 0) 635 if (ata_id_has_flush_ext(id) == 0)
634 return 0; 636 return false;
635 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 637 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
636 return 0; 638 return false;
637 /* 639 /*
638 * some Maxtor disks have bit 13 defined incorrectly 640 * some Maxtor disks have bit 13 defined incorrectly
639 * so check bit 10 too 641 * so check bit 10 too
@@ -686,64 +688,64 @@ static inline u16 ata_id_logical_sector_offset(const u16 *id,
686 return 0; 688 return 0;
687} 689}
688 690
689static inline int ata_id_has_lba48(const u16 *id) 691static inline bool ata_id_has_lba48(const u16 *id)
690{ 692{
691 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 693 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
692 return 0; 694 return false;
693 if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2)) 695 if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2))
694 return 0; 696 return false;
695 return id[ATA_ID_COMMAND_SET_2] & (1 << 10); 697 return id[ATA_ID_COMMAND_SET_2] & (1 << 10);
696} 698}
697 699
698static inline int ata_id_lba48_enabled(const u16 *id) 700static inline bool ata_id_lba48_enabled(const u16 *id)
699{ 701{
700 if (ata_id_has_lba48(id) == 0) 702 if (ata_id_has_lba48(id) == 0)
701 return 0; 703 return false;
702 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 704 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
703 return 0; 705 return false;
704 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10); 706 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10);
705} 707}
706 708
707static inline int ata_id_hpa_enabled(const u16 *id) 709static inline bool ata_id_hpa_enabled(const u16 *id)
708{ 710{
709 /* Yes children, word 83 valid bits cover word 82 data */ 711 /* Yes children, word 83 valid bits cover word 82 data */
710 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 712 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
711 return 0; 713 return false;
712 /* And 87 covers 85-87 */ 714 /* And 87 covers 85-87 */
713 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 715 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
714 return 0; 716 return false;
715 /* Check command sets enabled as well as supported */ 717 /* Check command sets enabled as well as supported */
716 if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0) 718 if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0)
717 return 0; 719 return false;
718 return id[ATA_ID_COMMAND_SET_1] & (1 << 10); 720 return id[ATA_ID_COMMAND_SET_1] & (1 << 10);
719} 721}
720 722
721static inline int ata_id_has_wcache(const u16 *id) 723static inline bool ata_id_has_wcache(const u16 *id)
722{ 724{
723 /* Yes children, word 83 valid bits cover word 82 data */ 725 /* Yes children, word 83 valid bits cover word 82 data */
724 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 726 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
725 return 0; 727 return false;
726 return id[ATA_ID_COMMAND_SET_1] & (1 << 5); 728 return id[ATA_ID_COMMAND_SET_1] & (1 << 5);
727} 729}
728 730
729static inline int ata_id_has_pm(const u16 *id) 731static inline bool ata_id_has_pm(const u16 *id)
730{ 732{
731 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000) 733 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
732 return 0; 734 return false;
733 return id[ATA_ID_COMMAND_SET_1] & (1 << 3); 735 return id[ATA_ID_COMMAND_SET_1] & (1 << 3);
734} 736}
735 737
736static inline int ata_id_rahead_enabled(const u16 *id) 738static inline bool ata_id_rahead_enabled(const u16 *id)
737{ 739{
738 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 740 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
739 return 0; 741 return false;
740 return id[ATA_ID_CFS_ENABLE_1] & (1 << 6); 742 return id[ATA_ID_CFS_ENABLE_1] & (1 << 6);
741} 743}
742 744
743static inline int ata_id_wcache_enabled(const u16 *id) 745static inline bool ata_id_wcache_enabled(const u16 *id)
744{ 746{
745 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000) 747 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
746 return 0; 748 return false;
747 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5); 749 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
748} 750}
749 751
@@ -773,7 +775,7 @@ static inline unsigned int ata_id_major_version(const u16 *id)
773 return mver; 775 return mver;
774} 776}
775 777
776static inline int ata_id_is_sata(const u16 *id) 778static inline bool ata_id_is_sata(const u16 *id)
777{ 779{
778 /* 780 /*
779 * See if word 93 is 0 AND drive is at least ATA-5 compatible 781 * See if word 93 is 0 AND drive is at least ATA-5 compatible
@@ -782,37 +784,40 @@ static inline int ata_id_is_sata(const u16 *id)
782 * 0x0000 and 0xffff along with the earlier ATA revisions... 784 * 0x0000 and 0xffff along with the earlier ATA revisions...
783 */ 785 */
784 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020) 786 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
785 return 1; 787 return true;
786 return 0; 788 return false;
787} 789}
788 790
789static inline int ata_id_has_tpm(const u16 *id) 791static inline bool ata_id_has_tpm(const u16 *id)
790{ 792{
791 /* The TPM bits are only valid on ATA8 */ 793 /* The TPM bits are only valid on ATA8 */
792 if (ata_id_major_version(id) < 8) 794 if (ata_id_major_version(id) < 8)
793 return 0; 795 return false;
794 if ((id[48] & 0xC000) != 0x4000) 796 if ((id[48] & 0xC000) != 0x4000)
795 return 0; 797 return false;
796 return id[48] & (1 << 0); 798 return id[48] & (1 << 0);
797} 799}
798 800
799static inline int ata_id_has_dword_io(const u16 *id) 801static inline bool ata_id_has_dword_io(const u16 *id)
800{ 802{
801 /* ATA 8 reuses this flag for "trusted" computing */ 803 /* ATA 8 reuses this flag for "trusted" computing */
802 if (ata_id_major_version(id) > 7) 804 if (ata_id_major_version(id) > 7)
803 return 0; 805 return false;
804 if (id[ATA_ID_DWORD_IO] & (1 << 0)) 806 return id[ATA_ID_DWORD_IO] & (1 << 0);
805 return 1;
806 return 0;
807} 807}
808 808
809static inline int ata_id_has_unload(const u16 *id) 809static inline bool ata_id_has_unload(const u16 *id)
810{ 810{
811 if (ata_id_major_version(id) >= 7 && 811 if (ata_id_major_version(id) >= 7 &&
812 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 && 812 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
813 id[ATA_ID_CFSSE] & (1 << 13)) 813 id[ATA_ID_CFSSE] & (1 << 13))
814 return 1; 814 return true;
815 return 0; 815 return false;
816}
817
818static inline bool ata_id_has_wwn(const u16 *id)
819{
820 return (id[ATA_ID_CSF_DEFAULT] & 0xC100) == 0x4100;
816} 821}
817 822
818static inline int ata_id_form_factor(const u16 *id) 823static inline int ata_id_form_factor(const u16 *id)
@@ -843,25 +848,25 @@ static inline int ata_id_rotation_rate(const u16 *id)
843 return val; 848 return val;
844} 849}
845 850
846static inline int ata_id_has_trim(const u16 *id) 851static inline bool ata_id_has_trim(const u16 *id)
847{ 852{
848 if (ata_id_major_version(id) >= 7 && 853 if (ata_id_major_version(id) >= 7 &&
849 (id[ATA_ID_DATA_SET_MGMT] & 1)) 854 (id[ATA_ID_DATA_SET_MGMT] & 1))
850 return 1; 855 return true;
851 return 0; 856 return false;
852} 857}
853 858
854static inline int ata_id_has_zero_after_trim(const u16 *id) 859static inline bool ata_id_has_zero_after_trim(const u16 *id)
855{ 860{
856 /* DSM supported, deterministic read, and read zero after trim set */ 861 /* DSM supported, deterministic read, and read zero after trim set */
857 if (ata_id_has_trim(id) && 862 if (ata_id_has_trim(id) &&
858 (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020) 863 (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020)
859 return 1; 864 return true;
860 865
861 return 0; 866 return false;
862} 867}
863 868
864static inline int ata_id_current_chs_valid(const u16 *id) 869static inline bool ata_id_current_chs_valid(const u16 *id)
865{ 870{
866 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 871 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
867 has not been issued to the device then the values of 872 has not been issued to the device then the values of
@@ -873,11 +878,11 @@ static inline int ata_id_current_chs_valid(const u16 *id)
873 id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */ 878 id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */
874} 879}
875 880
876static inline int ata_id_is_cfa(const u16 *id) 881static inline bool ata_id_is_cfa(const u16 *id)
877{ 882{
878 if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */ 883 if ((id[ATA_ID_CONFIG] == 0x848A) || /* Traditional CF */
879 (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */ 884 (id[ATA_ID_CONFIG] == 0x844A)) /* Delkin Devices CF */
880 return 1; 885 return true;
881 /* 886 /*
882 * CF specs don't require specific value in the word 0 anymore and yet 887 * CF specs don't require specific value in the word 0 anymore and yet
883 * they forbid to report the ATA version in the word 80 and require the 888 * they forbid to report the ATA version in the word 80 and require the
@@ -886,44 +891,40 @@ static inline int ata_id_is_cfa(const u16 *id)
886 * and while those that don't indicate CFA feature support need some 891 * and while those that don't indicate CFA feature support need some
887 * sort of quirk list, it seems impractical for the ones that do... 892 * sort of quirk list, it seems impractical for the ones that do...
888 */ 893 */
889 if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004) 894 return (id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004;
890 return 1;
891 return 0;
892} 895}
893 896
894static inline int ata_id_is_ssd(const u16 *id) 897static inline bool ata_id_is_ssd(const u16 *id)
895{ 898{
896 return id[ATA_ID_ROT_SPEED] == 0x01; 899 return id[ATA_ID_ROT_SPEED] == 0x01;
897} 900}
898 901
899static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio) 902static inline bool ata_id_pio_need_iordy(const u16 *id, const u8 pio)
900{ 903{
901 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */ 904 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
902 if (pio > 4 && ata_id_is_cfa(id)) 905 if (pio > 4 && ata_id_is_cfa(id))
903 return 0; 906 return false;
904 /* For PIO3 and higher it is mandatory. */ 907 /* For PIO3 and higher it is mandatory. */
905 if (pio > 2) 908 if (pio > 2)
906 return 1; 909 return true;
907 /* Turn it on when possible. */ 910 /* Turn it on when possible. */
908 if (ata_id_has_iordy(id)) 911 return ata_id_has_iordy(id);
909 return 1;
910 return 0;
911} 912}
912 913
913static inline int ata_drive_40wire(const u16 *dev_id) 914static inline bool ata_drive_40wire(const u16 *dev_id)
914{ 915{
915 if (ata_id_is_sata(dev_id)) 916 if (ata_id_is_sata(dev_id))
916 return 0; /* SATA */ 917 return false; /* SATA */
917 if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000) 918 if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000)
918 return 0; /* 80 wire */ 919 return false; /* 80 wire */
919 return 1; 920 return true;
920} 921}
921 922
922static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 923static inline bool ata_drive_40wire_relaxed(const u16 *dev_id)
923{ 924{
924 if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000) 925 if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000)
925 return 0; /* 80 wire */ 926 return false; /* 80 wire */
926 return 1; 927 return true;
927} 928}
928 929
929static inline int atapi_cdb_len(const u16 *dev_id) 930static inline int atapi_cdb_len(const u16 *dev_id)
@@ -936,12 +937,12 @@ static inline int atapi_cdb_len(const u16 *dev_id)
936 } 937 }
937} 938}
938 939
939static inline int atapi_command_packet_set(const u16 *dev_id) 940static inline bool atapi_command_packet_set(const u16 *dev_id)
940{ 941{
941 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f; 942 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;
942} 943}
943 944
944static inline int atapi_id_dmadir(const u16 *dev_id) 945static inline bool atapi_id_dmadir(const u16 *dev_id)
945{ 946{
946 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); 947 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
947} 948}
@@ -954,13 +955,13 @@ static inline int atapi_id_dmadir(const u16 *dev_id)
954 * 955 *
955 * It is called only once for each device. 956 * It is called only once for each device.
956 */ 957 */
957static inline int ata_id_is_lba_capacity_ok(u16 *id) 958static inline bool ata_id_is_lba_capacity_ok(u16 *id)
958{ 959{
959 unsigned long lba_sects, chs_sects, head, tail; 960 unsigned long lba_sects, chs_sects, head, tail;
960 961
961 /* No non-LBA info .. so valid! */ 962 /* No non-LBA info .. so valid! */
962 if (id[ATA_ID_CYLS] == 0) 963 if (id[ATA_ID_CYLS] == 0)
963 return 1; 964 return true;
964 965
965 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY); 966 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
966 967
@@ -975,13 +976,13 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id)
975 id[ATA_ID_SECTORS] == 63 && 976 id[ATA_ID_SECTORS] == 63 &&
976 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) && 977 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
977 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS])) 978 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS]))
978 return 1; 979 return true;
979 980
980 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS]; 981 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
981 982
982 /* perform a rough sanity check on lba_sects: within 10% is OK */ 983 /* perform a rough sanity check on lba_sects: within 10% is OK */
983 if (lba_sects - chs_sects < chs_sects/10) 984 if (lba_sects - chs_sects < chs_sects/10)
984 return 1; 985 return true;
985 986
986 /* some drives have the word order reversed */ 987 /* some drives have the word order reversed */
987 head = (lba_sects >> 16) & 0xffff; 988 head = (lba_sects >> 16) & 0xffff;
@@ -990,10 +991,10 @@ static inline int ata_id_is_lba_capacity_ok(u16 *id)
990 991
991 if (lba_sects - chs_sects < chs_sects/10) { 992 if (lba_sects - chs_sects < chs_sects/10) {
992 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects); 993 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects);
993 return 1; /* LBA capacity is (now) good */ 994 return true; /* LBA capacity is (now) good */
994 } 995 }
995 996
996 return 0; /* LBA capacity value may be bad */ 997 return false; /* LBA capacity value may be bad */
997} 998}
998 999
999static inline void ata_id_to_hd_driveid(u16 *id) 1000static inline void ata_id_to_hd_driveid(u16 *id)
@@ -1051,19 +1052,19 @@ static inline int is_multi_taskfile(struct ata_taskfile *tf)
1051 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); 1052 (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
1052} 1053}
1053 1054
1054static inline int ata_ok(u8 status) 1055static inline bool ata_ok(u8 status)
1055{ 1056{
1056 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) 1057 return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
1057 == ATA_DRDY); 1058 == ATA_DRDY);
1058} 1059}
1059 1060
1060static inline int lba_28_ok(u64 block, u32 n_block) 1061static inline bool lba_28_ok(u64 block, u32 n_block)
1061{ 1062{
1062 /* check the ending block number: must be LESS THAN 0x0fffffff */ 1063 /* check the ending block number: must be LESS THAN 0x0fffffff */
1063 return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256); 1064 return ((block + n_block) < ((1 << 28) - 1)) && (n_block <= 256);
1064} 1065}
1065 1066
1066static inline int lba_48_ok(u64 block, u32 n_block) 1067static inline bool lba_48_ok(u64 block, u32 n_block)
1067{ 1068{
1068 /* check the ending block number */ 1069 /* check the ending block number */
1069 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); 1070 return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 359df0487690..9d339eb27881 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -103,6 +103,8 @@
103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */ 103#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ 104#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ 105#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
106#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
107#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
106 108
107#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 109#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
108#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 110#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 4a3d52e545e1..5ffc6dda4675 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -32,6 +32,13 @@ enum backlight_update_reason {
32 BACKLIGHT_UPDATE_SYSFS, 32 BACKLIGHT_UPDATE_SYSFS,
33}; 33};
34 34
35enum backlight_type {
36 BACKLIGHT_RAW = 1,
37 BACKLIGHT_PLATFORM,
38 BACKLIGHT_FIRMWARE,
39 BACKLIGHT_TYPE_MAX,
40};
41
35struct backlight_device; 42struct backlight_device;
36struct fb_info; 43struct fb_info;
37 44
@@ -62,6 +69,8 @@ struct backlight_properties {
62 /* FB Blanking active? (values as for power) */ 69 /* FB Blanking active? (values as for power) */
63 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ 70 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
64 int fb_blank; 71 int fb_blank;
72 /* Backlight type */
73 enum backlight_type type;
65 /* Flags used to signal drivers of state changes */ 74 /* Flags used to signal drivers of state changes */
66 /* Upper 4 bits are reserved for driver internal use */ 75 /* Upper 4 bits are reserved for driver internal use */
67 unsigned int state; 76 unsigned int state;
diff --git a/include/linux/bch.h b/include/linux/bch.h
new file mode 100644
index 000000000000..295b4ef153bb
--- /dev/null
+++ b/include/linux/bch.h
@@ -0,0 +1,79 @@
1/*
2 * Generic binary BCH encoding/decoding library
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 version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * Copyright © 2011 Parrot S.A.
18 *
19 * Author: Ivan Djelic <ivan.djelic@parrot.com>
20 *
21 * Description:
22 *
23 * This library provides runtime configurable encoding/decoding of binary
24 * Bose-Chaudhuri-Hocquenghem (BCH) codes.
25*/
26#ifndef _BCH_H
27#define _BCH_H
28
29#include <linux/types.h>
30
31/**
32 * struct bch_control - BCH control structure
33 * @m: Galois field order
34 * @n: maximum codeword size in bits (= 2^m-1)
35 * @t: error correction capability in bits
36 * @ecc_bits: ecc exact size in bits, i.e. generator polynomial degree (<=m*t)
37 * @ecc_bytes: ecc max size (m*t bits) in bytes
38 * @a_pow_tab: Galois field GF(2^m) exponentiation lookup table
39 * @a_log_tab: Galois field GF(2^m) log lookup table
40 * @mod8_tab: remainder generator polynomial lookup tables
41 * @ecc_buf: ecc parity words buffer
42 * @ecc_buf2: ecc parity words buffer
43 * @xi_tab: GF(2^m) base for solving degree 2 polynomial roots
44 * @syn: syndrome buffer
45 * @cache: log-based polynomial representation buffer
46 * @elp: error locator polynomial
47 * @poly_2t: temporary polynomials of degree 2t
48 */
49struct bch_control {
50 unsigned int m;
51 unsigned int n;
52 unsigned int t;
53 unsigned int ecc_bits;
54 unsigned int ecc_bytes;
55/* private: */
56 uint16_t *a_pow_tab;
57 uint16_t *a_log_tab;
58 uint32_t *mod8_tab;
59 uint32_t *ecc_buf;
60 uint32_t *ecc_buf2;
61 unsigned int *xi_tab;
62 unsigned int *syn;
63 int *cache;
64 struct gf_poly *elp;
65 struct gf_poly *poly_2t[4];
66};
67
68struct bch_control *init_bch(int m, int t, unsigned int prim_poly);
69
70void free_bch(struct bch_control *bch);
71
72void encode_bch(struct bch_control *bch, const uint8_t *data,
73 unsigned int len, uint8_t *ecc);
74
75int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
76 const uint8_t *recv_ecc, const uint8_t *calc_ecc,
77 const unsigned int *syn, unsigned int *errloc);
78
79#endif /* _BCH_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 91fa428fa2c1..16a902f099ac 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1297,15 +1297,18 @@ static inline long nr_blockdev_pages(void)
1297 return 0; 1297 return 0;
1298} 1298}
1299 1299
1300static inline void blk_start_plug(struct list_head *list) 1300struct blk_plug {
1301};
1302
1303static inline void blk_start_plug(struct blk_plug *plug)
1301{ 1304{
1302} 1305}
1303 1306
1304static inline void blk_finish_plug(struct list_head *list) 1307static inline void blk_finish_plug(struct blk_plug *plug)
1305{ 1308{
1306} 1309}
1307 1310
1308static inline void blk_flush_plug(struct task_struct *tsk) 1311static inline void blk_flush_plug(struct task_struct *task)
1309{ 1312{
1310} 1313}
1311 1314
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 499dfe982a0e..b8613e806aa9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -19,10 +19,6 @@ extern unsigned long min_low_pfn;
19 */ 19 */
20extern unsigned long max_pfn; 20extern unsigned long max_pfn;
21 21
22#ifdef CONFIG_CRASH_DUMP
23extern unsigned long saved_max_pfn;
24#endif
25
26#ifndef CONFIG_NO_BOOTMEM 22#ifndef CONFIG_NO_BOOTMEM
27/* 23/*
28 * node_bootmem_map is a map pointer - the bits represent all physical 24 * node_bootmem_map is a map pointer - the bits represent all physical
diff --git a/include/linux/capability.h b/include/linux/capability.h
index fb16a3699b99..16ee8b49a200 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -368,6 +368,15 @@ struct cpu_vfs_cap_data {
368 368
369#ifdef __KERNEL__ 369#ifdef __KERNEL__
370 370
371struct dentry;
372struct user_namespace;
373
374struct user_namespace *current_user_ns(void);
375
376extern const kernel_cap_t __cap_empty_set;
377extern const kernel_cap_t __cap_full_set;
378extern const kernel_cap_t __cap_init_eff_set;
379
371/* 380/*
372 * Internal kernel functions only 381 * Internal kernel functions only
373 */ 382 */
@@ -530,40 +539,27 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
530 cap_intersect(permitted, __cap_nfsd_set)); 539 cap_intersect(permitted, __cap_nfsd_set));
531} 540}
532 541
533extern const kernel_cap_t __cap_empty_set; 542extern bool has_capability(struct task_struct *t, int cap);
534extern const kernel_cap_t __cap_full_set; 543extern bool has_ns_capability(struct task_struct *t,
535extern const kernel_cap_t __cap_init_eff_set; 544 struct user_namespace *ns, int cap);
536 545extern bool has_capability_noaudit(struct task_struct *t, int cap);
537/** 546extern bool capable(int cap);
538 * has_capability - Determine if a task has a superior capability available 547extern bool ns_capable(struct user_namespace *ns, int cap);
539 * @t: The task in question 548extern bool task_ns_capable(struct task_struct *t, int cap);
540 * @cap: The capability to be tested for
541 *
542 * Return true if the specified task has the given superior capability
543 * currently in effect, false if not.
544 *
545 * Note that this does not set PF_SUPERPRIV on the task.
546 */
547#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
548 549
549/** 550/**
550 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited) 551 * nsown_capable - Check superior capability to one's own user_ns
551 * @t: The task in question 552 * @cap: The capability in question
552 * @cap: The capability to be tested for
553 * 553 *
554 * Return true if the specified task has the given superior capability 554 * Return true if the current task has the given superior capability
555 * currently in effect, false if not, but don't write an audit message for the 555 * targeted at its own user namespace.
556 * check.
557 *
558 * Note that this does not set PF_SUPERPRIV on the task.
559 */ 556 */
560#define has_capability_noaudit(t, cap) \ 557static inline bool nsown_capable(int cap)
561 (security_real_capable_noaudit((t), (cap)) == 0) 558{
562 559 return ns_capable(current_user_ns(), cap);
563extern int capable(int cap); 560}
564 561
565/* audit system wants to get cap info from files as well */ 562/* audit system wants to get cap info from files as well */
566struct dentry;
567extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 563extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
568 564
569#endif /* __KERNEL__ */ 565#endif /* __KERNEL__ */
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 09dcc0c2ffd5..b8e995fbd867 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -136,9 +136,18 @@ struct ceph_dir_layout {
136 136
137 137
138/* osd */ 138/* osd */
139#define CEPH_MSG_OSD_MAP 41 139#define CEPH_MSG_OSD_MAP 41
140#define CEPH_MSG_OSD_OP 42 140#define CEPH_MSG_OSD_OP 42
141#define CEPH_MSG_OSD_OPREPLY 43 141#define CEPH_MSG_OSD_OPREPLY 43
142#define CEPH_MSG_WATCH_NOTIFY 44
143
144
145/* watch-notify operations */
146enum {
147 WATCH_NOTIFY = 1, /* notifying watcher */
148 WATCH_NOTIFY_COMPLETE = 2, /* notifier notified when done */
149};
150
142 151
143/* pool operations */ 152/* pool operations */
144enum { 153enum {
@@ -213,8 +222,10 @@ struct ceph_client_mount {
213 struct ceph_mon_request_header monhdr; 222 struct ceph_mon_request_header monhdr;
214} __attribute__ ((packed)); 223} __attribute__ ((packed));
215 224
225#define CEPH_SUBSCRIBE_ONETIME 1 /* i want only 1 update after have */
226
216struct ceph_mon_subscribe_item { 227struct ceph_mon_subscribe_item {
217 __le64 have_version; __le64 have; 228 __le64 have_version; __le64 have;
218 __u8 onetime; 229 __u8 onetime;
219} __attribute__ ((packed)); 230} __attribute__ ((packed));
220 231
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 72c72bfccb88..0d2e0fffb470 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -71,7 +71,6 @@ struct ceph_options {
71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ 71#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */
72#define CEPH_OSD_KEEPALIVE_DEFAULT 5 72#define CEPH_OSD_KEEPALIVE_DEFAULT 5
73#define CEPH_OSD_IDLE_TTL_DEFAULT 60 73#define CEPH_OSD_IDLE_TTL_DEFAULT 60
74#define CEPH_MOUNT_RSIZE_DEFAULT (512*1024) /* readahead */
75 74
76#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) 75#define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024)
77#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) 76#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024)
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index c3011beac30d..31d91a64838b 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -123,6 +123,7 @@ struct ceph_msg_pos {
123#define SOCK_CLOSED 11 /* socket state changed to closed */ 123#define SOCK_CLOSED 11 /* socket state changed to closed */
124#define OPENING 13 /* open connection w/ (possibly new) peer */ 124#define OPENING 13 /* open connection w/ (possibly new) peer */
125#define DEAD 14 /* dead, about to kfree */ 125#define DEAD 14 /* dead, about to kfree */
126#define BACKOFF 15
126 127
127/* 128/*
128 * A single connection with another host. 129 * A single connection with another host.
@@ -160,7 +161,6 @@ struct ceph_connection {
160 struct list_head out_queue; 161 struct list_head out_queue;
161 struct list_head out_sent; /* sending or sent but unacked */ 162 struct list_head out_sent; /* sending or sent but unacked */
162 u64 out_seq; /* last message queued for send */ 163 u64 out_seq; /* last message queued for send */
163 bool out_keepalive_pending;
164 164
165 u64 in_seq, in_seq_acked; /* last message received, acked */ 165 u64 in_seq, in_seq_acked; /* last message received, acked */
166 166
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index a1af29648fb5..f88eacb111d4 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -32,6 +32,7 @@ struct ceph_osd {
32 struct rb_node o_node; 32 struct rb_node o_node;
33 struct ceph_connection o_con; 33 struct ceph_connection o_con;
34 struct list_head o_requests; 34 struct list_head o_requests;
35 struct list_head o_linger_requests;
35 struct list_head o_osd_lru; 36 struct list_head o_osd_lru;
36 struct ceph_authorizer *o_authorizer; 37 struct ceph_authorizer *o_authorizer;
37 void *o_authorizer_buf, *o_authorizer_reply_buf; 38 void *o_authorizer_buf, *o_authorizer_reply_buf;
@@ -47,6 +48,8 @@ struct ceph_osd_request {
47 struct rb_node r_node; 48 struct rb_node r_node;
48 struct list_head r_req_lru_item; 49 struct list_head r_req_lru_item;
49 struct list_head r_osd_item; 50 struct list_head r_osd_item;
51 struct list_head r_linger_item;
52 struct list_head r_linger_osd;
50 struct ceph_osd *r_osd; 53 struct ceph_osd *r_osd;
51 struct ceph_pg r_pgid; 54 struct ceph_pg r_pgid;
52 int r_pg_osds[CEPH_PG_MAX_SIZE]; 55 int r_pg_osds[CEPH_PG_MAX_SIZE];
@@ -59,6 +62,7 @@ struct ceph_osd_request {
59 int r_flags; /* any additional flags for the osd */ 62 int r_flags; /* any additional flags for the osd */
60 u32 r_sent; /* >0 if r_request is sending/sent */ 63 u32 r_sent; /* >0 if r_request is sending/sent */
61 int r_got_reply; 64 int r_got_reply;
65 int r_linger;
62 66
63 struct ceph_osd_client *r_osdc; 67 struct ceph_osd_client *r_osdc;
64 struct kref r_kref; 68 struct kref r_kref;
@@ -74,7 +78,6 @@ struct ceph_osd_request {
74 char r_oid[40]; /* object name */ 78 char r_oid[40]; /* object name */
75 int r_oid_len; 79 int r_oid_len;
76 unsigned long r_stamp; /* send OR check time */ 80 unsigned long r_stamp; /* send OR check time */
77 bool r_resend; /* msg send failed, needs retry */
78 81
79 struct ceph_file_layout r_file_layout; 82 struct ceph_file_layout r_file_layout;
80 struct ceph_snap_context *r_snapc; /* snap context for writes */ 83 struct ceph_snap_context *r_snapc; /* snap context for writes */
@@ -90,6 +93,26 @@ struct ceph_osd_request {
90 struct ceph_pagelist *r_trail; /* trailing part of the data */ 93 struct ceph_pagelist *r_trail; /* trailing part of the data */
91}; 94};
92 95
96struct ceph_osd_event {
97 u64 cookie;
98 int one_shot;
99 struct ceph_osd_client *osdc;
100 void (*cb)(u64, u64, u8, void *);
101 void *data;
102 struct rb_node node;
103 struct list_head osd_node;
104 struct kref kref;
105 struct completion completion;
106};
107
108struct ceph_osd_event_work {
109 struct work_struct work;
110 struct ceph_osd_event *event;
111 u64 ver;
112 u64 notify_id;
113 u8 opcode;
114};
115
93struct ceph_osd_client { 116struct ceph_osd_client {
94 struct ceph_client *client; 117 struct ceph_client *client;
95 118
@@ -104,7 +127,10 @@ struct ceph_osd_client {
104 u64 timeout_tid; /* tid of timeout triggering rq */ 127 u64 timeout_tid; /* tid of timeout triggering rq */
105 u64 last_tid; /* tid of last request */ 128 u64 last_tid; /* tid of last request */
106 struct rb_root requests; /* pending requests */ 129 struct rb_root requests; /* pending requests */
107 struct list_head req_lru; /* pending requests lru */ 130 struct list_head req_lru; /* in-flight lru */
131 struct list_head req_unsent; /* unsent/need-resend queue */
132 struct list_head req_notarget; /* map to no osd */
133 struct list_head req_linger; /* lingering requests */
108 int num_requests; 134 int num_requests;
109 struct delayed_work timeout_work; 135 struct delayed_work timeout_work;
110 struct delayed_work osds_timeout_work; 136 struct delayed_work osds_timeout_work;
@@ -116,6 +142,12 @@ struct ceph_osd_client {
116 142
117 struct ceph_msgpool msgpool_op; 143 struct ceph_msgpool msgpool_op;
118 struct ceph_msgpool msgpool_op_reply; 144 struct ceph_msgpool msgpool_op_reply;
145
146 spinlock_t event_lock;
147 struct rb_root event_tree;
148 u64 event_count;
149
150 struct workqueue_struct *notify_wq;
119}; 151};
120 152
121struct ceph_osd_req_op { 153struct ceph_osd_req_op {
@@ -150,6 +182,13 @@ struct ceph_osd_req_op {
150 struct { 182 struct {
151 u64 snapid; 183 u64 snapid;
152 } snap; 184 } snap;
185 struct {
186 u64 cookie;
187 u64 ver;
188 __u8 flag;
189 u32 prot_ver;
190 u32 timeout;
191 } watch;
153 }; 192 };
154 u32 payload_len; 193 u32 payload_len;
155}; 194};
@@ -198,6 +237,11 @@ extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
198 bool use_mempool, int num_reply, 237 bool use_mempool, int num_reply,
199 int page_align); 238 int page_align);
200 239
240extern void ceph_osdc_set_request_linger(struct ceph_osd_client *osdc,
241 struct ceph_osd_request *req);
242extern void ceph_osdc_unregister_linger_request(struct ceph_osd_client *osdc,
243 struct ceph_osd_request *req);
244
201static inline void ceph_osdc_get_request(struct ceph_osd_request *req) 245static inline void ceph_osdc_get_request(struct ceph_osd_request *req)
202{ 246{
203 kref_get(&req->r_kref); 247 kref_get(&req->r_kref);
@@ -233,5 +277,14 @@ extern int ceph_osdc_writepages(struct ceph_osd_client *osdc,
233 struct page **pages, int nr_pages, 277 struct page **pages, int nr_pages,
234 int flags, int do_sync, bool nofail); 278 int flags, int do_sync, bool nofail);
235 279
280/* watch/notify events */
281extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
282 void (*event_cb)(u64, u64, u8, void *),
283 int one_shot, void *data,
284 struct ceph_osd_event **pevent);
285extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
286extern int ceph_osdc_wait_event(struct ceph_osd_event *event,
287 unsigned long timeout);
288extern void ceph_osdc_put_event(struct ceph_osd_event *event);
236#endif 289#endif
237 290
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 6d5247f2e81b..0a99099801a4 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -12,9 +12,9 @@
12 * osdmap encoding versions 12 * osdmap encoding versions
13 */ 13 */
14#define CEPH_OSDMAP_INC_VERSION 5 14#define CEPH_OSDMAP_INC_VERSION 5
15#define CEPH_OSDMAP_INC_VERSION_EXT 5 15#define CEPH_OSDMAP_INC_VERSION_EXT 6
16#define CEPH_OSDMAP_VERSION 5 16#define CEPH_OSDMAP_VERSION 5
17#define CEPH_OSDMAP_VERSION_EXT 5 17#define CEPH_OSDMAP_VERSION_EXT 6
18 18
19/* 19/*
20 * fs id 20 * fs id
@@ -181,9 +181,17 @@ enum {
181 /* read */ 181 /* read */
182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1, 182 CEPH_OSD_OP_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 1,
183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2, 183 CEPH_OSD_OP_STAT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 2,
184 CEPH_OSD_OP_MAPEXT = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 3,
184 185
185 /* fancy read */ 186 /* fancy read */
186 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4, 187 CEPH_OSD_OP_MASKTRUNC = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 4,
188 CEPH_OSD_OP_SPARSE_READ = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 5,
189
190 CEPH_OSD_OP_NOTIFY = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 6,
191 CEPH_OSD_OP_NOTIFY_ACK = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 7,
192
193 /* versioning */
194 CEPH_OSD_OP_ASSERT_VER = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 8,
187 195
188 /* write */ 196 /* write */
189 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1, 197 CEPH_OSD_OP_WRITE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 1,
@@ -205,6 +213,8 @@ enum {
205 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13, 213 CEPH_OSD_OP_CREATE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 13,
206 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14, 214 CEPH_OSD_OP_ROLLBACK= CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 14,
207 215
216 CEPH_OSD_OP_WATCH = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 15,
217
208 /** attrs **/ 218 /** attrs **/
209 /* read */ 219 /* read */
210 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1, 220 CEPH_OSD_OP_GETXATTR = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_ATTR | 1,
@@ -218,11 +228,14 @@ enum {
218 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4, 228 CEPH_OSD_OP_RMXATTR = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_ATTR | 4,
219 229
220 /** subop **/ 230 /** subop **/
221 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1, 231 CEPH_OSD_OP_PULL = CEPH_OSD_OP_MODE_SUB | 1,
222 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2, 232 CEPH_OSD_OP_PUSH = CEPH_OSD_OP_MODE_SUB | 2,
223 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3, 233 CEPH_OSD_OP_BALANCEREADS = CEPH_OSD_OP_MODE_SUB | 3,
224 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4, 234 CEPH_OSD_OP_UNBALANCEREADS = CEPH_OSD_OP_MODE_SUB | 4,
225 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5, 235 CEPH_OSD_OP_SCRUB = CEPH_OSD_OP_MODE_SUB | 5,
236 CEPH_OSD_OP_SCRUB_RESERVE = CEPH_OSD_OP_MODE_SUB | 6,
237 CEPH_OSD_OP_SCRUB_UNRESERVE = CEPH_OSD_OP_MODE_SUB | 7,
238 CEPH_OSD_OP_SCRUB_STOP = CEPH_OSD_OP_MODE_SUB | 8,
226 239
227 /** lock **/ 240 /** lock **/
228 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1, 241 CEPH_OSD_OP_WRLOCK = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_LOCK | 1,
@@ -328,6 +341,8 @@ enum {
328 CEPH_OSD_CMPXATTR_MODE_U64 = 2 341 CEPH_OSD_CMPXATTR_MODE_U64 = 2
329}; 342};
330 343
344#define RADOS_NOTIFY_VER 1
345
331/* 346/*
332 * an individual object operation. each may be accompanied by some data 347 * an individual object operation. each may be accompanied by some data
333 * payload 348 * payload
@@ -359,7 +374,12 @@ struct ceph_osd_op {
359 struct { 374 struct {
360 __le64 snapid; 375 __le64 snapid;
361 } __attribute__ ((packed)) snap; 376 } __attribute__ ((packed)) snap;
362 }; 377 struct {
378 __le64 cookie;
379 __le64 ver;
380 __u8 flag; /* 0 = unwatch, 1 = watch */
381 } __attribute__ ((packed)) watch;
382};
363 __le32 payload_len; 383 __le32 payload_len;
364} __attribute__ ((packed)); 384} __attribute__ ((packed));
365 385
@@ -402,4 +422,5 @@ struct ceph_osd_reply_head {
402} __attribute__ ((packed)); 422} __attribute__ ((packed));
403 423
404 424
425
405#endif 426#endif
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ce104e33cd22..e654fa239916 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -474,7 +474,8 @@ struct cgroup_subsys {
474 struct cgroup *old_cgrp, struct task_struct *tsk, 474 struct cgroup *old_cgrp, struct task_struct *tsk,
475 bool threadgroup); 475 bool threadgroup);
476 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 476 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
477 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); 477 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
478 struct cgroup *old_cgrp, struct task_struct *task);
478 int (*populate)(struct cgroup_subsys *ss, 479 int (*populate)(struct cgroup_subsys *ss,
479 struct cgroup *cgrp); 480 struct cgroup *cgrp);
480 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 481 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
@@ -626,6 +627,7 @@ bool css_is_ancestor(struct cgroup_subsys_state *cg,
626/* Get id and depth of css */ 627/* Get id and depth of css */
627unsigned short css_id(struct cgroup_subsys_state *css); 628unsigned short css_id(struct cgroup_subsys_state *css);
628unsigned short css_depth(struct cgroup_subsys_state *css); 629unsigned short css_depth(struct cgroup_subsys_state *css);
630struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id);
629 631
630#else /* !CONFIG_CGROUPS */ 632#else /* !CONFIG_CGROUPS */
631 633
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ccefff02b6cb..cdbfcb8780ec 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -65,4 +65,8 @@ SUBSYS(net_cls)
65SUBSYS(blkio) 65SUBSYS(blkio)
66#endif 66#endif
67 67
68#ifdef CONFIG_CGROUP_PERF
69SUBSYS(perf)
70#endif
71
68/* */ 72/* */
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index dfa2ed4c0d26..cc9f7a428649 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -11,9 +11,6 @@
11/* The full zone was compacted */ 11/* The full zone was compacted */
12#define COMPACT_COMPLETE 3 12#define COMPACT_COMPLETE 3
13 13
14#define COMPACT_MODE_DIRECT_RECLAIM 0
15#define COMPACT_MODE_KSWAPD 1
16
17#ifdef CONFIG_COMPACTION 14#ifdef CONFIG_COMPACTION
18extern int sysctl_compact_memory; 15extern int sysctl_compact_memory;
19extern int sysctl_compaction_handler(struct ctl_table *table, int write, 16extern int sysctl_compaction_handler(struct ctl_table *table, int write,
@@ -28,8 +25,7 @@ extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
28 bool sync); 25 bool sync);
29extern unsigned long compaction_suitable(struct zone *zone, int order); 26extern unsigned long compaction_suitable(struct zone *zone, int order);
30extern unsigned long compact_zone_order(struct zone *zone, int order, 27extern unsigned long compact_zone_order(struct zone *zone, int order,
31 gfp_t gfp_mask, bool sync, 28 gfp_t gfp_mask, bool sync);
32 int compact_mode);
33 29
34/* Do not skip compaction more than 64 times */ 30/* Do not skip compaction more than 64 times */
35#define COMPACT_MAX_DEFER_SHIFT 6 31#define COMPACT_MAX_DEFER_SHIFT 6
@@ -74,8 +70,7 @@ static inline unsigned long compaction_suitable(struct zone *zone, int order)
74} 70}
75 71
76static inline unsigned long compact_zone_order(struct zone *zone, int order, 72static inline unsigned long compact_zone_order(struct zone *zone, int order,
77 gfp_t gfp_mask, bool sync, 73 gfp_t gfp_mask, bool sync)
78 int compact_mode)
79{ 74{
80 return COMPACT_CONTINUE; 75 return COMPACT_CONTINUE;
81} 76}
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 16508bcddacc..cb4c1eb7778e 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -92,3 +92,11 @@
92#if !defined(__noclone) 92#if !defined(__noclone)
93#define __noclone /* not needed */ 93#define __noclone /* not needed */
94#endif 94#endif
95
96/*
97 * A trick to suppress uninitialized variable warning without generating any
98 * code
99 */
100#define uninitialized_var(x) x = x
101
102#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index b721129e0469..37d412436d0f 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -21,11 +21,3 @@
21# error "GCOV profiling support for gcc versions below 3.4 not included" 21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */ 22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */ 23#endif /* CONFIG_GCOV_KERNEL */
24
25/*
26 * A trick to suppress uninitialized variable warning without generating any
27 * code
28 */
29#define uninitialized_var(x) x = x
30
31#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index fcfa5b9a4317..64b7c003fd7a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -12,13 +12,6 @@
12#define __used __attribute__((__used__)) 12#define __used __attribute__((__used__))
13#define __must_check __attribute__((warn_unused_result)) 13#define __must_check __attribute__((warn_unused_result))
14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 14#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
15#define __always_inline inline __attribute__((always_inline))
16
17/*
18 * A trick to suppress uninitialized variable warning without generating any
19 * code
20 */
21#define uninitialized_var(x) x = x
22 15
23#if __GNUC_MINOR__ >= 3 16#if __GNUC_MINOR__ >= 3
24/* Mark functions as cold. gcc will assume any path leading to a call 17/* Mark functions as cold. gcc will assume any path leading to a call
@@ -53,7 +46,6 @@
53#define __noclone __attribute__((__noclone__)) 46#define __noclone __attribute__((__noclone__))
54 47
55#endif 48#endif
56
57#endif 49#endif
58 50
59#if __GNUC_MINOR__ > 0 51#if __GNUC_MINOR__ > 0
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 7e8ca75d2dad..bcafc942e5e4 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -42,8 +42,9 @@
42#define CN_VAL_DM_USERSPACE_LOG 0x1 42#define CN_VAL_DM_USERSPACE_LOG 0x1
43#define CN_IDX_DRBD 0x8 43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1 44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */
45 46
46#define CN_NETLINK_USERS 8 47#define CN_NETLINK_USERS 9
47 48
48/* 49/*
49 * Maximum connector's message size. 50 * Maximum connector's message size.
@@ -128,14 +129,17 @@ struct cn_dev {
128 struct cn_queue_dev *cbdev; 129 struct cn_queue_dev *cbdev;
129}; 130};
130 131
131int cn_add_callback(struct cb_id *, char *, void (*callback) (struct cn_msg *, struct netlink_skb_parms *)); 132int cn_add_callback(struct cb_id *id, const char *name,
133 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
132void cn_del_callback(struct cb_id *); 134void cn_del_callback(struct cb_id *);
133int cn_netlink_send(struct cn_msg *, u32, gfp_t); 135int cn_netlink_send(struct cn_msg *, u32, gfp_t);
134 136
135int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 137int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
138 struct cb_id *id,
139 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
136void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id); 140void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
137 141
138struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *); 142struct cn_queue_dev *cn_queue_alloc_dev(const char *name, struct sock *);
139void cn_queue_free_dev(struct cn_queue_dev *dev); 143void cn_queue_free_dev(struct cn_queue_dev *dev);
140 144
141int cn_cb_equal(struct cb_id *, struct cb_id *); 145int cn_cb_equal(struct cb_id *, struct cb_id *);
diff --git a/include/linux/cper.h b/include/linux/cper.h
index 3104aaff5dd0..372a25839fd1 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -388,5 +388,7 @@ struct cper_sec_pcie {
388#pragma pack() 388#pragma pack()
389 389
390u64 cper_next_record_id(void); 390u64 cper_next_record_id(void);
391void cper_print_bits(const char *prefix, unsigned int bits,
392 const char *strs[], unsigned int strs_size);
391 393
392#endif 394#endif
diff --git a/include/linux/cpu_rmap.h b/include/linux/cpu_rmap.h
new file mode 100644
index 000000000000..473771a528c0
--- /dev/null
+++ b/include/linux/cpu_rmap.h
@@ -0,0 +1,73 @@
1/*
2 * cpu_rmap.c: CPU affinity reverse-map support
3 * Copyright 2011 Solarflare Communications Inc.
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 version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#include <linux/cpumask.h>
11#include <linux/gfp.h>
12#include <linux/slab.h>
13
14/**
15 * struct cpu_rmap - CPU affinity reverse-map
16 * @size: Number of objects to be reverse-mapped
17 * @used: Number of objects added
18 * @obj: Pointer to array of object pointers
19 * @near: For each CPU, the index and distance to the nearest object,
20 * based on affinity masks
21 */
22struct cpu_rmap {
23 u16 size, used;
24 void **obj;
25 struct {
26 u16 index;
27 u16 dist;
28 } near[0];
29};
30#define CPU_RMAP_DIST_INF 0xffff
31
32extern struct cpu_rmap *alloc_cpu_rmap(unsigned int size, gfp_t flags);
33
34/**
35 * free_cpu_rmap - free CPU affinity reverse-map
36 * @rmap: Reverse-map allocated with alloc_cpu_rmap(), or %NULL
37 */
38static inline void free_cpu_rmap(struct cpu_rmap *rmap)
39{
40 kfree(rmap);
41}
42
43extern int cpu_rmap_add(struct cpu_rmap *rmap, void *obj);
44extern int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
45 const struct cpumask *affinity);
46
47static inline u16 cpu_rmap_lookup_index(struct cpu_rmap *rmap, unsigned int cpu)
48{
49 return rmap->near[cpu].index;
50}
51
52static inline void *cpu_rmap_lookup_obj(struct cpu_rmap *rmap, unsigned int cpu)
53{
54 return rmap->obj[rmap->near[cpu].index];
55}
56
57#ifdef CONFIG_GENERIC_HARDIRQS
58
59/**
60 * alloc_irq_cpu_rmap - allocate CPU affinity reverse-map for IRQs
61 * @size: Number of objects to be mapped
62 *
63 * Must be called in process context.
64 */
65static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size)
66{
67 return alloc_cpu_rmap(size, GFP_KERNEL);
68}
69extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
70
71extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
72
73#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index c3e9de8321c6..9343dd3de858 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -230,7 +230,7 @@ struct cpufreq_driver {
230 int (*bios_limit) (int cpu, unsigned int *limit); 230 int (*bios_limit) (int cpu, unsigned int *limit);
231 231
232 int (*exit) (struct cpufreq_policy *policy); 232 int (*exit) (struct cpufreq_policy *policy);
233 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 233 int (*suspend) (struct cpufreq_policy *policy);
234 int (*resume) (struct cpufreq_policy *policy); 234 int (*resume) (struct cpufreq_policy *policy);
235 struct freq_attr **attr; 235 struct freq_attr **attr;
236}; 236};
@@ -281,19 +281,10 @@ __ATTR(_name, 0444, show_##_name, NULL)
281static struct freq_attr _name = \ 281static struct freq_attr _name = \
282__ATTR(_name, _perm, show_##_name, NULL) 282__ATTR(_name, _perm, show_##_name, NULL)
283 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) \ 284#define cpufreq_freq_attr_rw(_name) \
289static struct freq_attr _name = \ 285static struct freq_attr _name = \
290__ATTR(_name, 0644, show_##_name, store_##_name) 286__ATTR(_name, 0644, show_##_name, store_##_name)
291 287
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
297struct global_attr { 288struct global_attr {
298 struct attribute attr; 289 struct attribute attr;
299 ssize_t (*show)(struct kobject *kobj, 290 ssize_t (*show)(struct kobject *kobj,
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index e20dd1f9b40a..391a259b2cc9 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,7 +11,7 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)data, length) 14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 15
16/* 16/*
17 * Helpers for hash table generation of ethernet nics: 17 * Helpers for hash table generation of ethernet nics:
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 4aaeab376446..9aeeb0ba2003 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -354,9 +354,11 @@ static inline void put_cred(const struct cred *_cred)
354#define current_fsgid() (current_cred_xxx(fsgid)) 354#define current_fsgid() (current_cred_xxx(fsgid))
355#define current_cap() (current_cred_xxx(cap_effective)) 355#define current_cap() (current_cred_xxx(cap_effective))
356#define current_user() (current_cred_xxx(user)) 356#define current_user() (current_cred_xxx(user))
357#define current_user_ns() (current_cred_xxx(user)->user_ns) 357#define _current_user_ns() (current_cred_xxx(user)->user_ns)
358#define current_security() (current_cred_xxx(security)) 358#define current_security() (current_cred_xxx(security))
359 359
360extern struct user_namespace *current_user_ns(void);
361
360#define current_uid_gid(_uid, _gid) \ 362#define current_uid_gid(_uid, _gid) \
361do { \ 363do { \
362 const struct cred *__cred; \ 364 const struct cred *__cred; \
diff --git a/include/linux/davinci_emac.h b/include/linux/davinci_emac.h
index 5dd428532f79..542888504994 100644
--- a/include/linux/davinci_emac.h
+++ b/include/linux/davinci_emac.h
@@ -36,6 +36,7 @@ struct emac_platform_data {
36 36
37 u8 rmii_en; 37 u8 rmii_en;
38 u8 version; 38 u8 version;
39 bool no_bd_ram;
39 void (*interrupt_enable) (void); 40 void (*interrupt_enable) (void);
40 void (*interrupt_disable) (void); 41 void (*interrupt_disable) (void);
41}; 42};
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index f958c19e3ca5..f2afed4fa945 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -168,7 +168,7 @@ struct dentry_operations {
168 void (*d_iput)(struct dentry *, struct inode *); 168 void (*d_iput)(struct dentry *, struct inode *);
169 char *(*d_dname)(struct dentry *, char *, int); 169 char *(*d_dname)(struct dentry *, char *, int);
170 struct vfsmount *(*d_automount)(struct path *); 170 struct vfsmount *(*d_automount)(struct path *);
171 int (*d_manage)(struct dentry *, bool, bool); 171 int (*d_manage)(struct dentry *, bool);
172} ____cacheline_aligned; 172} ____cacheline_aligned;
173 173
174/* 174/*
@@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
416 return dentry->d_flags & DCACHE_MOUNTED; 416 return dentry->d_flags & DCACHE_MOUNTED;
417} 417}
418 418
419extern struct vfsmount *lookup_mnt(struct path *);
420extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 419extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
421 420
422extern int sysctl_vfs_cache_pressure; 421extern int sysctl_vfs_cache_pressure;
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
index 66900e3c6eb1..c52280047e2c 100644
--- a/include/linux/dcbnl.h
+++ b/include/linux/dcbnl.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2008, Intel Corporation. 2 * Copyright (c) 2008-2011, Intel Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -25,9 +25,14 @@
25/* IEEE 802.1Qaz std supported values */ 25/* IEEE 802.1Qaz std supported values */
26#define IEEE_8021QAZ_MAX_TCS 8 26#define IEEE_8021QAZ_MAX_TCS 8
27 27
28#define IEEE_8021QAZ_TSA_STRICT 0
29#define IEEE_8021QAZ_TSA_CB_SHAPER 1
30#define IEEE_8021QAZ_TSA_ETS 2
31#define IEEE_8021QAZ_TSA_VENDOR 255
32
28/* This structure contains the IEEE 802.1Qaz ETS managed object 33/* This structure contains the IEEE 802.1Qaz ETS managed object
29 * 34 *
30 * @willing: willing bit in ETS configuratin TLV 35 * @willing: willing bit in ETS configuration TLV
31 * @ets_cap: indicates supported capacity of ets feature 36 * @ets_cap: indicates supported capacity of ets feature
32 * @cbs: credit based shaper ets algorithm supported 37 * @cbs: credit based shaper ets algorithm supported
33 * @tc_tx_bw: tc tx bandwidth indexed by traffic class 38 * @tc_tx_bw: tc tx bandwidth indexed by traffic class
@@ -82,6 +87,50 @@ struct ieee_pfc {
82 __u64 indications[IEEE_8021QAZ_MAX_TCS]; 87 __u64 indications[IEEE_8021QAZ_MAX_TCS];
83}; 88};
84 89
90/* CEE DCBX std supported values */
91#define CEE_DCBX_MAX_PGS 8
92#define CEE_DCBX_MAX_PRIO 8
93
94/**
95 * struct cee_pg - CEE Priority-Group managed object
96 *
97 * @willing: willing bit in the PG tlv
98 * @error: error bit in the PG tlv
99 * @pg_en: enable bit of the PG feature
100 * @tcs_supported: number of traffic classes supported
101 * @pg_bw: bandwidth percentage for each priority group
102 * @prio_pg: priority to PG mapping indexed by priority
103 */
104struct cee_pg {
105 __u8 willing;
106 __u8 error;
107 __u8 pg_en;
108 __u8 tcs_supported;
109 __u8 pg_bw[CEE_DCBX_MAX_PGS];
110 __u8 prio_pg[CEE_DCBX_MAX_PGS];
111};
112
113/**
114 * struct cee_pfc - CEE PFC managed object
115 *
116 * @willing: willing bit in the PFC tlv
117 * @error: error bit in the PFC tlv
118 * @pfc_en: bitmap indicating pfc enabled traffic classes
119 * @tcs_supported: number of traffic classes supported
120 */
121struct cee_pfc {
122 __u8 willing;
123 __u8 error;
124 __u8 pfc_en;
125 __u8 tcs_supported;
126};
127
128/* IEEE 802.1Qaz std supported values */
129#define IEEE_8021QAZ_APP_SEL_ETHERTYPE 1
130#define IEEE_8021QAZ_APP_SEL_STREAM 2
131#define IEEE_8021QAZ_APP_SEL_DGRAM 3
132#define IEEE_8021QAZ_APP_SEL_ANY 4
133
85/* This structure contains the IEEE 802.1Qaz APP managed object. This 134/* This structure contains the IEEE 802.1Qaz APP managed object. This
86 * object is also used for the CEE std as well. There is no difference 135 * object is also used for the CEE std as well. There is no difference
87 * between the objects. 136 * between the objects.
@@ -105,6 +154,20 @@ struct dcb_app {
105 __u16 protocol; 154 __u16 protocol;
106}; 155};
107 156
157/**
158 * struct dcb_peer_app_info - APP feature information sent by the peer
159 *
160 * @willing: willing bit in the peer APP tlv
161 * @error: error bit in the peer APP tlv
162 *
163 * In addition to this information the full peer APP tlv also contains
164 * a table of 'app_count' APP objects defined above.
165 */
166struct dcb_peer_app_info {
167 __u8 willing;
168 __u8 error;
169};
170
108struct dcbmsg { 171struct dcbmsg {
109 __u8 dcb_family; 172 __u8 dcb_family;
110 __u8 cmd; 173 __u8 cmd;
@@ -139,6 +202,7 @@ struct dcbmsg {
139 * @DCB_CMD_SDCBX: set DCBX engine configuration 202 * @DCB_CMD_SDCBX: set DCBX engine configuration
140 * @DCB_CMD_GFEATCFG: get DCBX features flags 203 * @DCB_CMD_GFEATCFG: get DCBX features flags
141 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags 204 * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
205 * @DCB_CMD_CEE_GET: get CEE aggregated configuration
142 */ 206 */
143enum dcbnl_commands { 207enum dcbnl_commands {
144 DCB_CMD_UNDEFINED, 208 DCB_CMD_UNDEFINED,
@@ -181,6 +245,8 @@ enum dcbnl_commands {
181 DCB_CMD_GFEATCFG, 245 DCB_CMD_GFEATCFG,
182 DCB_CMD_SFEATCFG, 246 DCB_CMD_SFEATCFG,
183 247
248 DCB_CMD_CEE_GET,
249
184 __DCB_CMD_ENUM_MAX, 250 __DCB_CMD_ENUM_MAX,
185 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1, 251 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
186}; 252};
@@ -203,6 +269,7 @@ enum dcbnl_commands {
203 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED) 269 * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
204 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8) 270 * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
205 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED) 271 * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
272 * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED)
206 */ 273 */
207enum dcbnl_attrs { 274enum dcbnl_attrs {
208 DCB_ATTR_UNDEFINED, 275 DCB_ATTR_UNDEFINED,
@@ -226,15 +293,32 @@ enum dcbnl_attrs {
226 DCB_ATTR_DCBX, 293 DCB_ATTR_DCBX,
227 DCB_ATTR_FEATCFG, 294 DCB_ATTR_FEATCFG,
228 295
296 /* CEE nested attributes */
297 DCB_ATTR_CEE,
298
229 __DCB_ATTR_ENUM_MAX, 299 __DCB_ATTR_ENUM_MAX,
230 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1, 300 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
231}; 301};
232 302
303/**
304 * enum ieee_attrs - IEEE 802.1Qaz get/set attributes
305 *
306 * @DCB_ATTR_IEEE_UNSPEC: unspecified
307 * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration
308 * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration
309 * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration
310 * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only
311 * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only
312 * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only
313 */
233enum ieee_attrs { 314enum ieee_attrs {
234 DCB_ATTR_IEEE_UNSPEC, 315 DCB_ATTR_IEEE_UNSPEC,
235 DCB_ATTR_IEEE_ETS, 316 DCB_ATTR_IEEE_ETS,
236 DCB_ATTR_IEEE_PFC, 317 DCB_ATTR_IEEE_PFC,
237 DCB_ATTR_IEEE_APP_TABLE, 318 DCB_ATTR_IEEE_APP_TABLE,
319 DCB_ATTR_IEEE_PEER_ETS,
320 DCB_ATTR_IEEE_PEER_PFC,
321 DCB_ATTR_IEEE_PEER_APP,
238 __DCB_ATTR_IEEE_MAX 322 __DCB_ATTR_IEEE_MAX
239}; 323};
240#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1) 324#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
@@ -247,6 +331,31 @@ enum ieee_attrs_app {
247#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1) 331#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
248 332
249/** 333/**
334 * enum cee_attrs - CEE DCBX get attributes
335 *
336 * @DCB_ATTR_CEE_UNSPEC: unspecified
337 * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
338 * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
339 * @DCB_ATTR_CEE_PEER_APP: peer APP tlv - get only
340 */
341enum cee_attrs {
342 DCB_ATTR_CEE_UNSPEC,
343 DCB_ATTR_CEE_PEER_PG,
344 DCB_ATTR_CEE_PEER_PFC,
345 DCB_ATTR_CEE_PEER_APP_TABLE,
346 __DCB_ATTR_CEE_MAX
347};
348#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
349
350enum peer_app_attr {
351 DCB_ATTR_CEE_PEER_APP_UNSPEC,
352 DCB_ATTR_CEE_PEER_APP_INFO,
353 DCB_ATTR_CEE_PEER_APP,
354 __DCB_ATTR_CEE_PEER_APP_MAX
355};
356#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
357
358/**
250 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs 359 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
251 * 360 *
252 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors 361 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 010e2d87ed75..d638e85dc501 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -279,8 +279,6 @@ enum dccp_state {
279 DCCP_MAX_STATES 279 DCCP_MAX_STATES
280}; 280};
281 281
282#define DCCP_STATE_MASK 0x1f
283
284enum { 282enum {
285 DCCPF_OPEN = TCPF_ESTABLISHED, 283 DCCPF_OPEN = TCPF_ESTABLISHED,
286 DCCPF_REQUESTING = TCPF_SYN_SENT, 284 DCCPF_REQUESTING = TCPF_SYN_SENT,
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
index 597692f1fc8d..65970b811e22 100644
--- a/include/linux/debugobjects.h
+++ b/include/linux/debugobjects.h
@@ -34,7 +34,10 @@ struct debug_obj {
34 34
35/** 35/**
36 * struct debug_obj_descr - object type specific debug description structure 36 * struct debug_obj_descr - object type specific debug description structure
37 *
37 * @name: name of the object typee 38 * @name: name of the object typee
39 * @debug_hint: function returning address, which have associated
40 * kernel symbol, to allow identify the object
38 * @fixup_init: fixup function, which is called when the init check 41 * @fixup_init: fixup function, which is called when the init check
39 * fails 42 * fails
40 * @fixup_activate: fixup function, which is called when the activate check 43 * @fixup_activate: fixup function, which is called when the activate check
@@ -46,7 +49,7 @@ struct debug_obj {
46 */ 49 */
47struct debug_obj_descr { 50struct debug_obj_descr {
48 const char *name; 51 const char *name;
49 52 void *(*debug_hint) (void *addr);
50 int (*fixup_init) (void *addr, enum debug_obj_state state); 53 int (*fixup_init) (void *addr, enum debug_obj_state state);
51 int (*fixup_activate) (void *addr, enum debug_obj_state state); 54 int (*fixup_activate) (void *addr, enum debug_obj_state state);
52 int (*fixup_destroy) (void *addr, enum debug_obj_state state); 55 int (*fixup_destroy) (void *addr, enum debug_obj_state state);
diff --git a/include/linux/device.h b/include/linux/device.h
index 1bf5cf0b4513..ab8dfc095709 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -128,9 +128,7 @@ struct device_driver {
128 128
129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ 129 bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
130 130
131#if defined(CONFIG_OF)
132 const struct of_device_id *of_match_table; 131 const struct of_device_id *of_match_table;
133#endif
134 132
135 int (*probe) (struct device *dev); 133 int (*probe) (struct device *dev);
136 int (*remove) (struct device *dev); 134 int (*remove) (struct device *dev);
@@ -422,6 +420,7 @@ struct device {
422 void *platform_data; /* Platform specific data, device 420 void *platform_data; /* Platform specific data, device
423 core doesn't touch it */ 421 core doesn't touch it */
424 struct dev_pm_info power; 422 struct dev_pm_info power;
423 struct dev_power_domain *pwr_domain;
425 424
426#ifdef CONFIG_NUMA 425#ifdef CONFIG_NUMA
427 int numa_node; /* NUMA node this device is close to */ 426 int numa_node; /* NUMA node this device is close to */
@@ -441,9 +440,9 @@ struct device {
441 override */ 440 override */
442 /* arch specific additions */ 441 /* arch specific additions */
443 struct dev_archdata archdata; 442 struct dev_archdata archdata;
444#ifdef CONFIG_OF 443
445 struct device_node *of_node; 444 struct device_node *of_node; /* associated device tree node */
446#endif 445 const struct of_device_id *of_match; /* matching of_device_id from driver */
447 446
448 dev_t devt; /* dev_t, creates the sysfs "dev" */ 447 dev_t devt; /* dev_t, creates the sysfs "dev" */
449 448
@@ -634,8 +633,12 @@ static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
634/* drivers/base/power/shutdown.c */ 633/* drivers/base/power/shutdown.c */
635extern void device_shutdown(void); 634extern void device_shutdown(void);
636 635
636#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
637/* drivers/base/sys.c */ 637/* drivers/base/sys.c */
638extern void sysdev_shutdown(void); 638extern void sysdev_shutdown(void);
639#else
640static inline void sysdev_shutdown(void) { }
641#endif
639 642
640/* debugging and troubleshooting/diagnostic helpers. */ 643/* debugging and troubleshooting/diagnostic helpers. */
641extern const char *dev_driver_string(const struct device *dev); 644extern const char *dev_driver_string(const struct device *dev);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index 78bbf47bbb96..3708455ee6c3 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 19 270#define DM_VERSION_MINOR 20
271#define DM_VERSION_PATCHLEVEL 1 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2011-01-07)" 272#define DM_VERSION_EXTRA "-ioctl (2011-02-02)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -328,4 +328,10 @@ enum {
328 */ 328 */
329#define DM_UUID_FLAG (1 << 14) /* In */ 329#define DM_UUID_FLAG (1 << 14) /* In */
330 330
331/*
332 * If set, all buffers are wiped after use. Use when sending
333 * or requesting sensitive data such as an encryption key.
334 */
335#define DM_SECURE_DATA_FLAG (1 << 15) /* In */
336
331#endif /* _LINUX_DM_IOCTL_H */ 337#endif /* _LINUX_DM_IOCTL_H */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 90e087f8d951..f156cca25ad0 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -23,6 +23,53 @@ enum dmi_device_type {
23 DMI_DEV_TYPE_DEV_ONBOARD = -3, 23 DMI_DEV_TYPE_DEV_ONBOARD = -3,
24}; 24};
25 25
26enum dmi_entry_type {
27 DMI_ENTRY_BIOS = 0,
28 DMI_ENTRY_SYSTEM,
29 DMI_ENTRY_BASEBOARD,
30 DMI_ENTRY_CHASSIS,
31 DMI_ENTRY_PROCESSOR,
32 DMI_ENTRY_MEM_CONTROLLER,
33 DMI_ENTRY_MEM_MODULE,
34 DMI_ENTRY_CACHE,
35 DMI_ENTRY_PORT_CONNECTOR,
36 DMI_ENTRY_SYSTEM_SLOT,
37 DMI_ENTRY_ONBOARD_DEVICE,
38 DMI_ENTRY_OEMSTRINGS,
39 DMI_ENTRY_SYSCONF,
40 DMI_ENTRY_BIOS_LANG,
41 DMI_ENTRY_GROUP_ASSOC,
42 DMI_ENTRY_SYSTEM_EVENT_LOG,
43 DMI_ENTRY_PHYS_MEM_ARRAY,
44 DMI_ENTRY_MEM_DEVICE,
45 DMI_ENTRY_32_MEM_ERROR,
46 DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR,
47 DMI_ENTRY_MEM_DEV_MAPPED_ADDR,
48 DMI_ENTRY_BUILTIN_POINTING_DEV,
49 DMI_ENTRY_PORTABLE_BATTERY,
50 DMI_ENTRY_SYSTEM_RESET,
51 DMI_ENTRY_HW_SECURITY,
52 DMI_ENTRY_SYSTEM_POWER_CONTROLS,
53 DMI_ENTRY_VOLTAGE_PROBE,
54 DMI_ENTRY_COOLING_DEV,
55 DMI_ENTRY_TEMP_PROBE,
56 DMI_ENTRY_ELECTRICAL_CURRENT_PROBE,
57 DMI_ENTRY_OOB_REMOTE_ACCESS,
58 DMI_ENTRY_BIS_ENTRY,
59 DMI_ENTRY_SYSTEM_BOOT,
60 DMI_ENTRY_MGMT_DEV,
61 DMI_ENTRY_MGMT_DEV_COMPONENT,
62 DMI_ENTRY_MGMT_DEV_THRES,
63 DMI_ENTRY_MEM_CHANNEL,
64 DMI_ENTRY_IPMI_DEV,
65 DMI_ENTRY_SYS_POWER_SUPPLY,
66 DMI_ENTRY_ADDITIONAL,
67 DMI_ENTRY_ONBOARD_DEV_EXT,
68 DMI_ENTRY_MGMT_CONTROLLER_HOST,
69 DMI_ENTRY_INACTIVE = 126,
70 DMI_ENTRY_END_OF_TABLE = 127,
71};
72
26struct dmi_header { 73struct dmi_header {
27 u8 type; 74 u8 type;
28 u8 length; 75 u8 length;
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index c8aad713a046..6998d9376ef9 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -16,9 +16,18 @@
16/** 16/**
17 * struct dw_dma_platform_data - Controller configuration parameters 17 * struct dw_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8) 18 * @nr_channels: Number of channels supported by hardware (max 8)
19 * @is_private: The device channels should be marked as private and not for
20 * by the general purpose DMA channel allocator.
19 */ 21 */
20struct dw_dma_platform_data { 22struct dw_dma_platform_data {
21 unsigned int nr_channels; 23 unsigned int nr_channels;
24 bool is_private;
25#define CHAN_ALLOCATION_ASCENDING 0 /* zero to seven */
26#define CHAN_ALLOCATION_DESCENDING 1 /* seven to zero */
27 unsigned char chan_allocation_order;
28#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
29#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
30 unsigned char chan_priority;
22}; 31};
23 32
24/** 33/**
@@ -33,6 +42,30 @@ enum dw_dma_slave_width {
33 DW_DMA_SLAVE_WIDTH_32BIT, 42 DW_DMA_SLAVE_WIDTH_32BIT,
34}; 43};
35 44
45/* bursts size */
46enum dw_dma_msize {
47 DW_DMA_MSIZE_1,
48 DW_DMA_MSIZE_4,
49 DW_DMA_MSIZE_8,
50 DW_DMA_MSIZE_16,
51 DW_DMA_MSIZE_32,
52 DW_DMA_MSIZE_64,
53 DW_DMA_MSIZE_128,
54 DW_DMA_MSIZE_256,
55};
56
57/* flow controller */
58enum dw_dma_fc {
59 DW_DMA_FC_D_M2M,
60 DW_DMA_FC_D_M2P,
61 DW_DMA_FC_D_P2M,
62 DW_DMA_FC_D_P2P,
63 DW_DMA_FC_P_P2M,
64 DW_DMA_FC_SP_P2P,
65 DW_DMA_FC_P_M2P,
66 DW_DMA_FC_DP_P2P,
67};
68
36/** 69/**
37 * struct dw_dma_slave - Controller-specific information about a slave 70 * struct dw_dma_slave - Controller-specific information about a slave
38 * 71 *
@@ -44,6 +77,11 @@ enum dw_dma_slave_width {
44 * @reg_width: peripheral register width 77 * @reg_width: peripheral register width
45 * @cfg_hi: Platform-specific initializer for the CFG_HI register 78 * @cfg_hi: Platform-specific initializer for the CFG_HI register
46 * @cfg_lo: Platform-specific initializer for the CFG_LO register 79 * @cfg_lo: Platform-specific initializer for the CFG_LO register
80 * @src_master: src master for transfers on allocated channel.
81 * @dst_master: dest master for transfers on allocated channel.
82 * @src_msize: src burst size.
83 * @dst_msize: dest burst size.
84 * @fc: flow controller for DMA transfer
47 */ 85 */
48struct dw_dma_slave { 86struct dw_dma_slave {
49 struct device *dma_dev; 87 struct device *dma_dev;
@@ -52,6 +90,11 @@ struct dw_dma_slave {
52 enum dw_dma_slave_width reg_width; 90 enum dw_dma_slave_width reg_width;
53 u32 cfg_hi; 91 u32 cfg_hi;
54 u32 cfg_lo; 92 u32 cfg_lo;
93 u8 src_master;
94 u8 dst_master;
95 u8 src_msize;
96 u8 dst_msize;
97 u8 fc;
55}; 98};
56 99
57/* Platform-configurable bits in CFG_HI */ 100/* Platform-configurable bits in CFG_HI */
@@ -62,7 +105,6 @@ struct dw_dma_slave {
62#define DWC_CFGH_DST_PER(x) ((x) << 11) 105#define DWC_CFGH_DST_PER(x) ((x) << 11)
63 106
64/* Platform-configurable bits in CFG_LO */ 107/* Platform-configurable bits in CFG_LO */
65#define DWC_CFGL_PRIO(x) ((x) << 5) /* priority */
66#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */ 108#define DWC_CFGL_LOCK_CH_XFER (0 << 12) /* scope of LOCK_CH */
67#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12) 109#define DWC_CFGL_LOCK_CH_BLOCK (1 << 12)
68#define DWC_CFGL_LOCK_CH_XACT (2 << 12) 110#define DWC_CFGL_LOCK_CH_XACT (2 << 12)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 1c70028f81f9..0c9653f11c18 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -31,6 +31,10 @@ struct _ddebug {
31 * writes commands to <debugfs>/dynamic_debug/control 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_INCL_MODNAME (1<<1)
35#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
36#define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
37#define _DPRINTK_FLAGS_INCL_TID (1<<4)
34#define _DPRINTK_FLAGS_DEFAULT 0 38#define _DPRINTK_FLAGS_DEFAULT 0
35 unsigned int flags:8; 39 unsigned int flags:8;
36 char enabled; 40 char enabled;
@@ -42,6 +46,8 @@ int ddebug_add_module(struct _ddebug *tab, unsigned int n,
42 46
43#if defined(CONFIG_DYNAMIC_DEBUG) 47#if defined(CONFIG_DYNAMIC_DEBUG)
44extern int ddebug_remove_module(const char *mod_name); 48extern int ddebug_remove_module(const char *mod_name);
49extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
50 __attribute__ ((format (printf, 2, 3)));
45 51
46#define dynamic_pr_debug(fmt, ...) do { \ 52#define dynamic_pr_debug(fmt, ...) do { \
47 static struct _ddebug descriptor \ 53 static struct _ddebug descriptor \
@@ -50,7 +56,7 @@ extern int ddebug_remove_module(const char *mod_name);
50 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \ 56 { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
51 _DPRINTK_FLAGS_DEFAULT }; \ 57 _DPRINTK_FLAGS_DEFAULT }; \
52 if (unlikely(descriptor.enabled)) \ 58 if (unlikely(descriptor.enabled)) \
53 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \ 59 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
54 } while (0) 60 } while (0)
55 61
56 62
diff --git a/include/linux/efi.h b/include/linux/efi.h
index fb737bc19a8c..33fa1203024e 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -397,4 +397,41 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
397 *addr &= PAGE_MASK; 397 *addr &= PAGE_MASK;
398} 398}
399 399
400#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)
401/*
402 * EFI Variable support.
403 *
404 * Different firmware drivers can expose their EFI-like variables using
405 * the following.
406 */
407
408struct efivar_operations {
409 efi_get_variable_t *get_variable;
410 efi_get_next_variable_t *get_next_variable;
411 efi_set_variable_t *set_variable;
412};
413
414struct efivars {
415 /*
416 * ->lock protects two things:
417 * 1) ->list - adds, removals, reads, writes
418 * 2) ops.[gs]et_variable() calls.
419 * It must not be held when creating sysfs entries or calling kmalloc.
420 * ops.get_next_variable() is only called from register_efivars(),
421 * which is protected by the BKL, so that path is safe.
422 */
423 spinlock_t lock;
424 struct list_head list;
425 struct kset *kset;
426 struct bin_attribute *new_var, *del_var;
427 const struct efivar_operations *ops;
428};
429
430int register_efivars(struct efivars *efivars,
431 const struct efivar_operations *ops,
432 struct kobject *parent_kobj);
433void unregister_efivars(struct efivars *efivars);
434
435#endif /* CONFIG_EFI_VARS */
436
400#endif /* _LINUX_EFI_H */ 437#endif /* _LINUX_EFI_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index ec6f72b84477..d93efcc44570 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -166,6 +166,7 @@ extern struct request *elv_rb_find(struct rb_root *, sector_t);
166#define ELEVATOR_INSERT_SORT 3 166#define ELEVATOR_INSERT_SORT 3
167#define ELEVATOR_INSERT_REQUEUE 4 167#define ELEVATOR_INSERT_REQUEUE 4
168#define ELEVATOR_INSERT_FLUSH 5 168#define ELEVATOR_INSERT_FLUSH 5
169#define ELEVATOR_INSERT_SORT_MERGE 6
169 170
170/* 171/*
171 * return values from elevator_may_queue_fn 172 * return values from elevator_may_queue_fn
diff --git a/include/linux/err.h b/include/linux/err.h
index 448afc12c78a..f2edce25a76b 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -52,6 +52,14 @@ static inline void * __must_check ERR_CAST(const void *ptr)
52 return (void *) ptr; 52 return (void *) ptr;
53} 53}
54 54
55static inline int __must_check PTR_RET(const void *ptr)
56{
57 if (IS_ERR(ptr))
58 return PTR_ERR(ptr);
59 else
60 return 0;
61}
62
55#endif 63#endif
56 64
57#endif /* _LINUX_ERR_H */ 65#endif /* _LINUX_ERR_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 1908929204a9..ae757bcf1280 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -13,6 +13,9 @@
13#ifndef _LINUX_ETHTOOL_H 13#ifndef _LINUX_ETHTOOL_H
14#define _LINUX_ETHTOOL_H 14#define _LINUX_ETHTOOL_H
15 15
16#ifdef __KERNEL__
17#include <linux/compat.h>
18#endif
16#include <linux/types.h> 19#include <linux/types.h>
17#include <linux/if_ether.h> 20#include <linux/if_ether.h>
18 21
@@ -251,6 +254,7 @@ enum ethtool_stringset {
251 ETH_SS_STATS, 254 ETH_SS_STATS,
252 ETH_SS_PRIV_FLAGS, 255 ETH_SS_PRIV_FLAGS,
253 ETH_SS_NTUPLE_FILTERS, 256 ETH_SS_NTUPLE_FILTERS,
257 ETH_SS_FEATURES,
254}; 258};
255 259
256/* for passing string sets for data tagging */ 260/* for passing string sets for data tagging */
@@ -449,6 +453,37 @@ struct ethtool_rxnfc {
449 __u32 rule_locs[0]; 453 __u32 rule_locs[0];
450}; 454};
451 455
456#ifdef __KERNEL__
457#ifdef CONFIG_COMPAT
458
459struct compat_ethtool_rx_flow_spec {
460 u32 flow_type;
461 union {
462 struct ethtool_tcpip4_spec tcp_ip4_spec;
463 struct ethtool_tcpip4_spec udp_ip4_spec;
464 struct ethtool_tcpip4_spec sctp_ip4_spec;
465 struct ethtool_ah_espip4_spec ah_ip4_spec;
466 struct ethtool_ah_espip4_spec esp_ip4_spec;
467 struct ethtool_usrip4_spec usr_ip4_spec;
468 struct ethhdr ether_spec;
469 u8 hdata[72];
470 } h_u, m_u;
471 compat_u64 ring_cookie;
472 u32 location;
473};
474
475struct compat_ethtool_rxnfc {
476 u32 cmd;
477 u32 flow_type;
478 compat_u64 data;
479 struct compat_ethtool_rx_flow_spec fs;
480 u32 rule_cnt;
481 u32 rule_locs[0];
482};
483
484#endif /* CONFIG_COMPAT */
485#endif /* __KERNEL__ */
486
452/** 487/**
453 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection 488 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
454 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR 489 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
@@ -523,10 +558,99 @@ struct ethtool_flash {
523 char data[ETHTOOL_FLASH_MAX_FILENAME]; 558 char data[ETHTOOL_FLASH_MAX_FILENAME];
524}; 559};
525 560
561/* for returning and changing feature sets */
562
563/**
564 * struct ethtool_get_features_block - block with state of 32 features
565 * @available: mask of changeable features
566 * @requested: mask of features requested to be enabled if possible
567 * @active: mask of currently enabled features
568 * @never_changed: mask of features not changeable for any device
569 */
570struct ethtool_get_features_block {
571 __u32 available;
572 __u32 requested;
573 __u32 active;
574 __u32 never_changed;
575};
576
577/**
578 * struct ethtool_gfeatures - command to get state of device's features
579 * @cmd: command number = %ETHTOOL_GFEATURES
580 * @size: in: number of elements in the features[] array;
581 * out: number of elements in features[] needed to hold all features
582 * @features: state of features
583 */
584struct ethtool_gfeatures {
585 __u32 cmd;
586 __u32 size;
587 struct ethtool_get_features_block features[0];
588};
589
590/**
591 * struct ethtool_set_features_block - block with request for 32 features
592 * @valid: mask of features to be changed
593 * @requested: values of features to be changed
594 */
595struct ethtool_set_features_block {
596 __u32 valid;
597 __u32 requested;
598};
599
600/**
601 * struct ethtool_sfeatures - command to request change in device's features
602 * @cmd: command number = %ETHTOOL_SFEATURES
603 * @size: array size of the features[] array
604 * @features: feature change masks
605 */
606struct ethtool_sfeatures {
607 __u32 cmd;
608 __u32 size;
609 struct ethtool_set_features_block features[0];
610};
611
612/*
613 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
614 * values of corresponding bits in features[].requested. Bits in .requested
615 * not set in .valid or not changeable are ignored.
616 *
617 * Returns %EINVAL when .valid contains undefined or never-changable bits
618 * or size is not equal to required number of features words (32-bit blocks).
619 * Returns >= 0 if request was completed; bits set in the value mean:
620 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
621 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
622 * those bits were ignored.
623 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
624 * resulting state of bits masked by .valid is not equal to .requested.
625 * Probably there are other device-specific constraints on some features
626 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
627 * here as though ignored bits were cleared.
628 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
629 * compatibility functions. Requested offload state cannot be properly
630 * managed by kernel.
631 *
632 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
633 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
634 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
635 * significant bit in features[0] fields. Empty strings mark undefined features.
636 */
637enum ethtool_sfeatures_retval_bits {
638 ETHTOOL_F_UNSUPPORTED__BIT,
639 ETHTOOL_F_WISH__BIT,
640 ETHTOOL_F_COMPAT__BIT,
641};
642
643#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
644#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
645#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
646
526#ifdef __KERNEL__ 647#ifdef __KERNEL__
527 648
528#include <linux/rculist.h> 649#include <linux/rculist.h>
529 650
651/* needed by dev_disable_lro() */
652extern int __ethtool_set_flags(struct net_device *dev, u32 flags);
653
530struct ethtool_rx_ntuple_flow_spec_container { 654struct ethtool_rx_ntuple_flow_spec_container {
531 struct ethtool_rx_ntuple_flow_spec fs; 655 struct ethtool_rx_ntuple_flow_spec fs;
532 struct list_head list; 656 struct list_head list;
@@ -543,7 +667,6 @@ struct net_device;
543 667
544/* Some generic methods drivers may use in their ethtool_ops */ 668/* Some generic methods drivers may use in their ethtool_ops */
545u32 ethtool_op_get_link(struct net_device *dev); 669u32 ethtool_op_get_link(struct net_device *dev);
546u32 ethtool_op_get_rx_csum(struct net_device *dev);
547u32 ethtool_op_get_tx_csum(struct net_device *dev); 670u32 ethtool_op_get_tx_csum(struct net_device *dev);
548int ethtool_op_set_tx_csum(struct net_device *dev, u32 data); 671int ethtool_op_set_tx_csum(struct net_device *dev, u32 data);
549int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data); 672int ethtool_op_set_tx_hw_csum(struct net_device *dev, u32 data);
@@ -744,6 +867,9 @@ struct ethtool_ops {
744#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */ 867#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
745#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */ 868#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
746 869
870#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
871#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
872
747/* compatibility with older code */ 873/* compatibility with older code */
748#define SPARC_ETH_GSET ETHTOOL_GSET 874#define SPARC_ETH_GSET ETHTOOL_GSET
749#define SPARC_ETH_SSET ETHTOOL_SSET 875#define SPARC_ETH_SSET ETHTOOL_SSET
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 28028988c862..33a42f24b275 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -8,6 +8,9 @@ struct inode;
8struct super_block; 8struct super_block;
9struct vfsmount; 9struct vfsmount;
10 10
11/* limit the handle size to NFSv4 handle size now */
12#define MAX_HANDLE_SZ 128
13
11/* 14/*
12 * The fileid_type identifies how the file within the filesystem is encoded. 15 * The fileid_type identifies how the file within the filesystem is encoded.
13 * In theory this is freely set and parsed by the filesystem, but we try to 16 * In theory this is freely set and parsed by the filesystem, but we try to
@@ -121,8 +124,10 @@ struct fid {
121 * set, the encode_fh() should store sufficient information so that a good 124 * set, the encode_fh() should store sufficient information so that a good
122 * attempt can be made to find not only the file but also it's place in the 125 * attempt can be made to find not only the file but also it's place in the
123 * filesystem. This typically means storing a reference to de->d_parent in 126 * filesystem. This typically means storing a reference to de->d_parent in
124 * the filehandle fragment. encode_fh() should return the number of bytes 127 * the filehandle fragment. encode_fh() should return the fileid_type on
125 * stored or a negative error code such as %-ENOSPC 128 * success and on error returns 255 (if the space needed to encode fh is
129 * greater than @max_len*4 bytes). On error @max_len contains the minimum
130 * size(in 4 byte unit) needed to encode the file handle.
126 * 131 *
127 * fh_to_dentry: 132 * fh_to_dentry:
128 * @fh_to_dentry is given a &struct super_block (@sb) and a file handle 133 * @fh_to_dentry is given a &struct super_block (@sb) and a file handle
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 65990ef612f5..85c1d302c12e 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -418,13 +418,13 @@ struct ext3_inode {
418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS 418#define EXT2_MOUNT_DATA_FLAGS EXT3_MOUNT_DATA_FLAGS
419#endif 419#endif
420 420
421#define ext3_set_bit ext2_set_bit 421#define ext3_set_bit __test_and_set_bit_le
422#define ext3_set_bit_atomic ext2_set_bit_atomic 422#define ext3_set_bit_atomic ext2_set_bit_atomic
423#define ext3_clear_bit ext2_clear_bit 423#define ext3_clear_bit __test_and_clear_bit_le
424#define ext3_clear_bit_atomic ext2_clear_bit_atomic 424#define ext3_clear_bit_atomic ext2_clear_bit_atomic
425#define ext3_test_bit ext2_test_bit 425#define ext3_test_bit test_bit_le
426#define ext3_find_first_zero_bit ext2_find_first_zero_bit 426#define ext3_find_first_zero_bit find_first_zero_bit_le
427#define ext3_find_next_zero_bit ext2_find_next_zero_bit 427#define ext3_find_next_zero_bit find_next_zero_bit_le
428 428
429/* 429/*
430 * Maximal mount counts between two filesystem checks 430 * Maximal mount counts between two filesystem checks
@@ -884,7 +884,8 @@ extern int ext3fs_dirhash(const char *name, int len, struct
884 dx_hash_info *hinfo); 884 dx_hash_info *hinfo);
885 885
886/* ialloc.c */ 886/* ialloc.c */
887extern struct inode * ext3_new_inode (handle_t *, struct inode *, int); 887extern struct inode * ext3_new_inode (handle_t *, struct inode *,
888 const struct qstr *, int);
888extern void ext3_free_inode (handle_t *, struct inode *); 889extern void ext3_free_inode (handle_t *, struct inode *);
889extern struct inode * ext3_orphan_get (struct super_block *, unsigned long); 890extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
890extern unsigned long ext3_count_free_inodes (struct super_block *); 891extern unsigned long ext3_count_free_inodes (struct super_block *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 68ba85a00c06..b2a36391d2a1 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -152,6 +152,8 @@
152#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */ 152#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
153#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */ 153#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
154 154
155#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
156
155struct fb_fix_screeninfo { 157struct fb_fix_screeninfo {
156 char id[16]; /* identification string eg "TT Builtin" */ 158 char id[16]; /* identification string eg "TT Builtin" */
157 unsigned long smem_start; /* Start of frame buffer mem */ 159 unsigned long smem_start; /* Start of frame buffer mem */
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index a562fa5fb4e3..f550f894ba15 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -46,6 +46,7 @@
46 unlinking file. */ 46 unlinking file. */
47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ 47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ 48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
49#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
49 50
50#ifdef __KERNEL__ 51#ifdef __KERNEL__
51 52
diff --git a/include/linux/file.h b/include/linux/file.h
index e85baebf6279..21a79958541c 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -29,6 +29,8 @@ static inline void fput_light(struct file *file, int fput_needed)
29 29
30extern struct file *fget(unsigned int fd); 30extern struct file *fget(unsigned int fd);
31extern struct file *fget_light(unsigned int fd, int *fput_needed); 31extern struct file *fget_light(unsigned int fd, int *fput_needed);
32extern struct file *fget_raw(unsigned int fd);
33extern struct file *fget_raw_light(unsigned int fd, int *fput_needed);
32extern void set_close_on_exec(unsigned int fd, int flag); 34extern void set_close_on_exec(unsigned int fd, int flag);
33extern void put_filp(struct file *); 35extern void put_filp(struct file *);
34extern int alloc_fd(unsigned start, unsigned flags); 36extern int alloc_fd(unsigned start, unsigned flags);
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index 9a3f5f9383f6..c64f3680d4f1 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -42,6 +42,10 @@
42#define CSR_BROADCAST_CHANNEL 0x234 42#define CSR_BROADCAST_CHANNEL 0x234
43#define CSR_CONFIG_ROM 0x400 43#define CSR_CONFIG_ROM 0x400
44#define CSR_CONFIG_ROM_END 0x800 44#define CSR_CONFIG_ROM_END 0x800
45#define CSR_OMPR 0x900
46#define CSR_OPCR(i) (0x904 + (i) * 4)
47#define CSR_IMPR 0x980
48#define CSR_IPCR(i) (0x984 + (i) * 4)
45#define CSR_FCP_COMMAND 0xB00 49#define CSR_FCP_COMMAND 0xB00
46#define CSR_FCP_RESPONSE 0xD00 50#define CSR_FCP_RESPONSE 0xD00
47#define CSR_FCP_END 0xF00 51#define CSR_FCP_END 0xF00
@@ -89,7 +93,7 @@ struct fw_card {
89 int current_tlabel; 93 int current_tlabel;
90 u64 tlabel_mask; 94 u64 tlabel_mask;
91 struct list_head transaction_list; 95 struct list_head transaction_list;
92 unsigned long reset_jiffies; 96 u64 reset_jiffies;
93 97
94 u32 split_timeout_hi; 98 u32 split_timeout_hi;
95 u32 split_timeout_lo; 99 u32 split_timeout_lo;
@@ -441,5 +445,8 @@ int fw_iso_context_start(struct fw_iso_context *ctx,
441 int cycle, int sync, int tags); 445 int cycle, int sync, int tags);
442int fw_iso_context_stop(struct fw_iso_context *ctx); 446int fw_iso_context_stop(struct fw_iso_context *ctx);
443void fw_iso_context_destroy(struct fw_iso_context *ctx); 447void fw_iso_context_destroy(struct fw_iso_context *ctx);
448void fw_iso_resource_manage(struct fw_card *card, int generation,
449 u64 channels_mask, int *channel, int *bandwidth,
450 bool allocate, __be32 buffer[2]);
444 451
445#endif /* _LINUX_FIREWIRE_H */ 452#endif /* _LINUX_FIREWIRE_H */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 53d1e6c4f848..21b3e7588abd 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -39,7 +39,7 @@ struct builtin_fw {
39int request_firmware(const struct firmware **fw, const char *name, 39int request_firmware(const struct firmware **fw, const char *name,
40 struct device *device); 40 struct device *device);
41int request_firmware_nowait( 41int request_firmware_nowait(
42 struct module *module, int uevent, 42 struct module *module, bool uevent,
43 const char *name, struct device *device, gfp_t gfp, void *context, 43 const char *name, struct device *device, gfp_t gfp, void *context,
44 void (*cont)(const struct firmware *fw, void *context)); 44 void (*cont)(const struct firmware *fw, void *context));
45 45
@@ -52,7 +52,7 @@ static inline int request_firmware(const struct firmware **fw,
52 return -EINVAL; 52 return -EINVAL;
53} 53}
54static inline int request_firmware_nowait( 54static inline int request_firmware_nowait(
55 struct module *module, int uevent, 55 struct module *module, bool uevent,
56 const char *name, struct device *device, gfp_t gfp, void *context, 56 const char *name, struct device *device, gfp_t gfp, void *context,
57 void (*cont)(const struct firmware *fw, void *context)) 57 void (*cont)(const struct firmware *fw, void *context))
58{ 58{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b95199daa5eb..b677bd77f2d6 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -102,6 +102,9 @@ struct inodes_stat_t {
102/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ 102/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
103#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) 103#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000)
104 104
105/* File is opened with O_PATH; almost nothing can be done with it */
106#define FMODE_PATH ((__force fmode_t)0x4000)
107
105/* File was opened by fanotify and shouldn't generate fanotify events */ 108/* File was opened by fanotify and shouldn't generate fanotify events */
106#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 109#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
107 110
@@ -648,9 +651,9 @@ struct address_space {
648 651
649struct block_device { 652struct block_device {
650 dev_t bd_dev; /* not a kdev_t - it's a search key */ 653 dev_t bd_dev; /* not a kdev_t - it's a search key */
654 int bd_openers;
651 struct inode * bd_inode; /* will die */ 655 struct inode * bd_inode; /* will die */
652 struct super_block * bd_super; 656 struct super_block * bd_super;
653 int bd_openers;
654 struct mutex bd_mutex; /* open/close mutex */ 657 struct mutex bd_mutex; /* open/close mutex */
655 struct list_head bd_inodes; 658 struct list_head bd_inodes;
656 void * bd_claiming; 659 void * bd_claiming;
@@ -787,8 +790,7 @@ struct inode {
787#endif 790#endif
788 791
789#ifdef CONFIG_IMA 792#ifdef CONFIG_IMA
790 /* protected by i_lock */ 793 atomic_t i_readcount; /* struct files open RO */
791 unsigned int i_readcount; /* struct files open RO */
792#endif 794#endif
793 atomic_t i_writecount; 795 atomic_t i_writecount;
794#ifdef CONFIG_SECURITY 796#ifdef CONFIG_SECURITY
@@ -967,6 +969,13 @@ struct file {
967#endif 969#endif
968}; 970};
969 971
972struct file_handle {
973 __u32 handle_bytes;
974 int handle_type;
975 /* file identifier */
976 unsigned char f_handle[0];
977};
978
970#define get_file(x) atomic_long_inc(&(x)->f_count) 979#define get_file(x) atomic_long_inc(&(x)->f_count)
971#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 980#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
972#define file_count(x) atomic_long_read(&(x)->f_count) 981#define file_count(x) atomic_long_read(&(x)->f_count)
@@ -1390,6 +1399,7 @@ struct super_block {
1390 wait_queue_head_t s_wait_unfrozen; 1399 wait_queue_head_t s_wait_unfrozen;
1391 1400
1392 char s_id[32]; /* Informational name */ 1401 char s_id[32]; /* Informational name */
1402 u8 s_uuid[16]; /* UUID */
1393 1403
1394 void *s_fs_info; /* Filesystem private info */ 1404 void *s_fs_info; /* Filesystem private info */
1395 fmode_t s_mode; 1405 fmode_t s_mode;
@@ -1436,8 +1446,13 @@ enum {
1436#define put_fs_excl() atomic_dec(&current->fs_excl) 1446#define put_fs_excl() atomic_dec(&current->fs_excl)
1437#define has_fs_excl() atomic_read(&current->fs_excl) 1447#define has_fs_excl() atomic_read(&current->fs_excl)
1438 1448
1439#define is_owner_or_cap(inode) \ 1449/*
1440 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER)) 1450 * until VFS tracks user namespaces for inodes, just make all files
1451 * belong to init_user_ns
1452 */
1453extern struct user_namespace init_user_ns;
1454#define inode_userns(inode) (&init_user_ns)
1455extern bool inode_owner_or_capable(const struct inode *inode);
1441 1456
1442/* not quite ready to be deprecated, but... */ 1457/* not quite ready to be deprecated, but... */
1443extern void lock_super(struct super_block *); 1458extern void lock_super(struct super_block *);
@@ -1610,6 +1625,8 @@ struct super_operations {
1610 void (*umount_begin) (struct super_block *); 1625 void (*umount_begin) (struct super_block *);
1611 1626
1612 int (*show_options)(struct seq_file *, struct vfsmount *); 1627 int (*show_options)(struct seq_file *, struct vfsmount *);
1628 int (*show_devname)(struct seq_file *, struct vfsmount *);
1629 int (*show_path)(struct seq_file *, struct vfsmount *);
1613 int (*show_stats)(struct seq_file *, struct vfsmount *); 1630 int (*show_stats)(struct seq_file *, struct vfsmount *);
1614#ifdef CONFIG_QUOTA 1631#ifdef CONFIG_QUOTA
1615 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1632 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
@@ -1619,7 +1636,7 @@ struct super_operations {
1619}; 1636};
1620 1637
1621/* 1638/*
1622 * Inode state bits. Protected by inode_lock. 1639 * Inode state bits. Protected by inode->i_lock
1623 * 1640 *
1624 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1641 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
1625 * I_DIRTY_DATASYNC and I_DIRTY_PAGES. 1642 * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
@@ -1773,8 +1790,6 @@ int sync_inode_metadata(struct inode *inode, int wait);
1773struct file_system_type { 1790struct file_system_type {
1774 const char *name; 1791 const char *name;
1775 int fs_flags; 1792 int fs_flags;
1776 int (*get_sb) (struct file_system_type *, int,
1777 const char *, void *, struct vfsmount *);
1778 struct dentry *(*mount) (struct file_system_type *, int, 1793 struct dentry *(*mount) (struct file_system_type *, int,
1779 const char *, void *); 1794 const char *, void *);
1780 void (*kill_sb) (struct super_block *); 1795 void (*kill_sb) (struct super_block *);
@@ -1797,24 +1812,12 @@ extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags,
1797extern struct dentry *mount_bdev(struct file_system_type *fs_type, 1812extern struct dentry *mount_bdev(struct file_system_type *fs_type,
1798 int flags, const char *dev_name, void *data, 1813 int flags, const char *dev_name, void *data,
1799 int (*fill_super)(struct super_block *, void *, int)); 1814 int (*fill_super)(struct super_block *, void *, int));
1800extern int get_sb_bdev(struct file_system_type *fs_type,
1801 int flags, const char *dev_name, void *data,
1802 int (*fill_super)(struct super_block *, void *, int),
1803 struct vfsmount *mnt);
1804extern struct dentry *mount_single(struct file_system_type *fs_type, 1815extern struct dentry *mount_single(struct file_system_type *fs_type,
1805 int flags, void *data, 1816 int flags, void *data,
1806 int (*fill_super)(struct super_block *, void *, int)); 1817 int (*fill_super)(struct super_block *, void *, int));
1807extern int get_sb_single(struct file_system_type *fs_type,
1808 int flags, void *data,
1809 int (*fill_super)(struct super_block *, void *, int),
1810 struct vfsmount *mnt);
1811extern struct dentry *mount_nodev(struct file_system_type *fs_type, 1818extern struct dentry *mount_nodev(struct file_system_type *fs_type,
1812 int flags, void *data, 1819 int flags, void *data,
1813 int (*fill_super)(struct super_block *, void *, int)); 1820 int (*fill_super)(struct super_block *, void *, int));
1814extern int get_sb_nodev(struct file_system_type *fs_type,
1815 int flags, void *data,
1816 int (*fill_super)(struct super_block *, void *, int),
1817 struct vfsmount *mnt);
1818void generic_shutdown_super(struct super_block *sb); 1821void generic_shutdown_super(struct super_block *sb);
1819void kill_block_super(struct super_block *sb); 1822void kill_block_super(struct super_block *sb);
1820void kill_anon_super(struct super_block *sb); 1823void kill_anon_super(struct super_block *sb);
@@ -1830,7 +1833,6 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
1830 const struct super_operations *ops, 1833 const struct super_operations *ops,
1831 const struct dentry_operations *dops, 1834 const struct dentry_operations *dops,
1832 unsigned long); 1835 unsigned long);
1833extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1834 1836
1835static inline void sb_mark_dirty(struct super_block *sb) 1837static inline void sb_mark_dirty(struct super_block *sb)
1836{ 1838{
@@ -1863,6 +1865,8 @@ extern void drop_collected_mounts(struct vfsmount *);
1863extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1865extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1864 struct vfsmount *); 1866 struct vfsmount *);
1865extern int vfs_statfs(struct path *, struct kstatfs *); 1867extern int vfs_statfs(struct path *, struct kstatfs *);
1868extern int user_statfs(const char __user *, struct kstatfs *);
1869extern int fd_statfs(int, struct kstatfs *);
1866extern int statfs_by_dentry(struct dentry *, struct kstatfs *); 1870extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1867extern int freeze_super(struct super_block *super); 1871extern int freeze_super(struct super_block *super);
1868extern int thaw_super(struct super_block *super); 1872extern int thaw_super(struct super_block *super);
@@ -1979,6 +1983,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset,
1979extern long do_sys_open(int dfd, const char __user *filename, int flags, 1983extern long do_sys_open(int dfd, const char __user *filename, int flags,
1980 int mode); 1984 int mode);
1981extern struct file *filp_open(const char *, int, int); 1985extern struct file *filp_open(const char *, int, int);
1986extern struct file *file_open_root(struct dentry *, struct vfsmount *,
1987 const char *, int);
1982extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, 1988extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1983 const struct cred *); 1989 const struct cred *);
1984extern int filp_close(struct file *, fl_owner_t id); 1990extern int filp_close(struct file *, fl_owner_t id);
@@ -2189,15 +2195,31 @@ static inline void allow_write_access(struct file *file)
2189 if (file) 2195 if (file)
2190 atomic_inc(&file->f_path.dentry->d_inode->i_writecount); 2196 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
2191} 2197}
2198#ifdef CONFIG_IMA
2199static inline void i_readcount_dec(struct inode *inode)
2200{
2201 BUG_ON(!atomic_read(&inode->i_readcount));
2202 atomic_dec(&inode->i_readcount);
2203}
2204static inline void i_readcount_inc(struct inode *inode)
2205{
2206 atomic_inc(&inode->i_readcount);
2207}
2208#else
2209static inline void i_readcount_dec(struct inode *inode)
2210{
2211 return;
2212}
2213static inline void i_readcount_inc(struct inode *inode)
2214{
2215 return;
2216}
2217#endif
2192extern int do_pipe_flags(int *, int); 2218extern int do_pipe_flags(int *, int);
2193extern struct file *create_read_pipe(struct file *f, int flags); 2219extern struct file *create_read_pipe(struct file *f, int flags);
2194extern struct file *create_write_pipe(int flags); 2220extern struct file *create_write_pipe(int flags);
2195extern void free_write_pipe(struct file *); 2221extern void free_write_pipe(struct file *);
2196 2222
2197extern struct file *do_filp_open(int dfd, const char *pathname,
2198 int open_flag, int mode, int acc_mode);
2199extern int may_open(struct path *, int, int);
2200
2201extern int kernel_read(struct file *, loff_t, char *, unsigned long); 2223extern int kernel_read(struct file *, loff_t, char *, unsigned long);
2202extern struct file * open_exec(const char *); 2224extern struct file * open_exec(const char *);
2203 2225
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index dcd6a7c3a435..ca29e03c1fac 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -428,6 +428,7 @@ extern void unregister_ftrace_graph(void);
428 428
429extern void ftrace_graph_init_task(struct task_struct *t); 429extern void ftrace_graph_init_task(struct task_struct *t);
430extern void ftrace_graph_exit_task(struct task_struct *t); 430extern void ftrace_graph_exit_task(struct task_struct *t);
431extern void ftrace_graph_init_idle_task(struct task_struct *t, int cpu);
431 432
432static inline int task_curr_ret_stack(struct task_struct *t) 433static inline int task_curr_ret_stack(struct task_struct *t)
433{ 434{
@@ -451,6 +452,7 @@ static inline void unpause_graph_tracing(void)
451 452
452static inline void ftrace_graph_init_task(struct task_struct *t) { } 453static inline void ftrace_graph_init_task(struct task_struct *t) { }
453static inline void ftrace_graph_exit_task(struct task_struct *t) { } 454static inline void ftrace_graph_exit_task(struct task_struct *t) { }
455static inline void ftrace_graph_init_idle_task(struct task_struct *t, int cpu) { }
454 456
455static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc, 457static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
456 trace_func_graph_ent_t entryfunc) 458 trace_func_graph_ent_t entryfunc)
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 47e3997f7b5c..22b32af1b5ec 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -37,7 +37,6 @@ struct trace_entry {
37 unsigned char flags; 37 unsigned char flags;
38 unsigned char preempt_count; 38 unsigned char preempt_count;
39 int pid; 39 int pid;
40 int lock_depth;
41}; 40};
42 41
43#define FTRACE_MAX_EVENT \ 42#define FTRACE_MAX_EVENT \
@@ -208,7 +207,6 @@ struct ftrace_event_call {
208 207
209#define PERF_MAX_TRACE_SIZE 2048 208#define PERF_MAX_TRACE_SIZE 2048
210 209
211#define MAX_FILTER_PRED 32
212#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ 210#define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */
213 211
214extern void destroy_preds(struct ftrace_event_call *call); 212extern void destroy_preds(struct ftrace_event_call *call);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index c0d5f6945c1e..d764a426e9fd 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -109,7 +109,7 @@ struct hd_struct {
109 int make_it_fail; 109 int make_it_fail;
110#endif 110#endif
111 unsigned long stamp; 111 unsigned long stamp;
112 int in_flight[2]; 112 atomic_t in_flight[2];
113#ifdef CONFIG_SMP 113#ifdef CONFIG_SMP
114 struct disk_stats __percpu *dkstats; 114 struct disk_stats __percpu *dkstats;
115#else 115#else
@@ -370,21 +370,21 @@ static inline void free_part_stats(struct hd_struct *part)
370 370
371static inline void part_inc_in_flight(struct hd_struct *part, int rw) 371static inline void part_inc_in_flight(struct hd_struct *part, int rw)
372{ 372{
373 part->in_flight[rw]++; 373 atomic_inc(&part->in_flight[rw]);
374 if (part->partno) 374 if (part->partno)
375 part_to_disk(part)->part0.in_flight[rw]++; 375 atomic_inc(&part_to_disk(part)->part0.in_flight[rw]);
376} 376}
377 377
378static inline void part_dec_in_flight(struct hd_struct *part, int rw) 378static inline void part_dec_in_flight(struct hd_struct *part, int rw)
379{ 379{
380 part->in_flight[rw]--; 380 atomic_dec(&part->in_flight[rw]);
381 if (part->partno) 381 if (part->partno)
382 part_to_disk(part)->part0.in_flight[rw]--; 382 atomic_dec(&part_to_disk(part)->part0.in_flight[rw]);
383} 383}
384 384
385static inline int part_in_flight(struct hd_struct *part) 385static inline int part_in_flight(struct hd_struct *part)
386{ 386{
387 return part->in_flight[0] + part->in_flight[1]; 387 return atomic_read(&part->in_flight[0]) + atomic_read(&part->in_flight[1]);
388} 388}
389 389
390static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk) 390static inline struct partition_meta_info *alloc_part_info(struct gendisk *disk)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0b84c61607e8..bfb8f934521e 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -35,6 +35,7 @@ struct vm_area_struct;
35#define ___GFP_NOTRACK 0 35#define ___GFP_NOTRACK 0
36#endif 36#endif
37#define ___GFP_NO_KSWAPD 0x400000u 37#define ___GFP_NO_KSWAPD 0x400000u
38#define ___GFP_OTHER_NODE 0x800000u
38 39
39/* 40/*
40 * GFP bitmasks.. 41 * GFP bitmasks..
@@ -83,6 +84,7 @@ struct vm_area_struct;
83#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 84#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
84 85
85#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD) 86#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
87#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
86 88
87/* 89/*
88 * This may seem redundant, but it's a way of annotating false positives vs. 90 * This may seem redundant, but it's a way of annotating false positives vs.
@@ -332,16 +334,19 @@ alloc_pages(gfp_t gfp_mask, unsigned int order)
332 return alloc_pages_current(gfp_mask, order); 334 return alloc_pages_current(gfp_mask, order);
333} 335}
334extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, 336extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
335 struct vm_area_struct *vma, unsigned long addr); 337 struct vm_area_struct *vma, unsigned long addr,
338 int node);
336#else 339#else
337#define alloc_pages(gfp_mask, order) \ 340#define alloc_pages(gfp_mask, order) \
338 alloc_pages_node(numa_node_id(), gfp_mask, order) 341 alloc_pages_node(numa_node_id(), gfp_mask, order)
339#define alloc_pages_vma(gfp_mask, order, vma, addr) \ 342#define alloc_pages_vma(gfp_mask, order, vma, addr, node) \
340 alloc_pages(gfp_mask, order) 343 alloc_pages(gfp_mask, order)
341#endif 344#endif
342#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) 345#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
343#define alloc_page_vma(gfp_mask, vma, addr) \ 346#define alloc_page_vma(gfp_mask, vma, addr) \
344 alloc_pages_vma(gfp_mask, 0, vma, addr) 347 alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id())
348#define alloc_page_vma_node(gfp_mask, vma, addr, node) \
349 alloc_pages_vma(gfp_mask, 0, vma, addr, node)
345 350
346extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); 351extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
347extern unsigned long get_zeroed_page(gfp_t gfp_mask); 352extern unsigned long get_zeroed_page(gfp_t gfp_mask);
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 32f9fd6619b4..ba362171e8ae 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -93,13 +93,6 @@
93 */ 93 */
94#define in_nmi() (preempt_count() & NMI_MASK) 94#define in_nmi() (preempt_count() & NMI_MASK)
95 95
96#if defined(CONFIG_PREEMPT) && defined(CONFIG_BKL)
97# include <linux/sched.h>
98# define PREEMPT_INATOMIC_BASE (current->lock_depth >= 0)
99#else
100# define PREEMPT_INATOMIC_BASE 0
101#endif
102
103#if defined(CONFIG_PREEMPT) 96#if defined(CONFIG_PREEMPT)
104# define PREEMPT_CHECK_OFFSET 1 97# define PREEMPT_CHECK_OFFSET 1
105#else 98#else
@@ -113,7 +106,7 @@
113 * used in the general case to determine whether sleeping is possible. 106 * used in the general case to determine whether sleeping is possible.
114 * Do not use in_atomic() in driver code. 107 * Do not use in_atomic() in driver code.
115 */ 108 */
116#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_INATOMIC_BASE) 109#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
117 110
118/* 111/*
119 * Check whether we were atomic before we did preempt_disable(): 112 * Check whether we were atomic before we did preempt_disable():
diff --git a/include/linux/hid-roccat.h b/include/linux/hid-roccat.h
new file mode 100644
index 000000000000..24e1ca01f9a0
--- /dev/null
+++ b/include/linux/hid-roccat.h
@@ -0,0 +1,29 @@
1#ifndef __HID_ROCCAT_H
2#define __HID_ROCCAT_H
3
4/*
5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 */
14
15#include <linux/hid.h>
16#include <linux/types.h>
17
18#define ROCCATIOCGREPSIZE _IOR('H', 0xf1, int)
19
20#ifdef __KERNEL__
21
22int roccat_connect(struct class *klass, struct hid_device *hid,
23 int report_size);
24void roccat_disconnect(int minor);
25int roccat_report_event(int minor, u8 const *data);
26
27#endif
28
29#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index d91c25e253c8..bb29bb1dbd2f 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -504,6 +504,9 @@ struct hid_device { /* device report descriptor */
504 struct hid_usage *, __s32); 504 struct hid_usage *, __s32);
505 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 505 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
506 506
507 /* handler for raw input (Get_Report) data, used by hidraw */
508 int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
509
507 /* handler for raw output data, used by hidraw */ 510 /* handler for raw output data, used by hidraw */
508 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); 511 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
509 512
@@ -638,7 +641,7 @@ struct hid_driver {
638 struct hid_input *hidinput, struct hid_field *field, 641 struct hid_input *hidinput, struct hid_field *field,
639 struct hid_usage *usage, unsigned long **bit, int *max); 642 struct hid_usage *usage, unsigned long **bit, int *max);
640 void (*feature_mapping)(struct hid_device *hdev, 643 void (*feature_mapping)(struct hid_device *hdev,
641 struct hid_input *hidinput, struct hid_field *field, 644 struct hid_field *field,
642 struct hid_usage *usage); 645 struct hid_usage *usage);
643#ifdef CONFIG_PM 646#ifdef CONFIG_PM
644 int (*suspend)(struct hid_device *hdev, pm_message_t message); 647 int (*suspend)(struct hid_device *hdev, pm_message_t message);
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index dd8d69269176..4b88e697c4e9 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -35,6 +35,9 @@ struct hidraw_devinfo {
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) 35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len) 36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len) 37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
38/* The first byte of SFEATURE and GFEATURE is the report number */
39#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
40#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
38 41
39#define HIDRAW_FIRST_MINOR 0 42#define HIDRAW_FIRST_MINOR 0
40#define HIDRAW_MAX_DEVICES 64 43#define HIDRAW_MAX_DEVICES 64
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index f376ddc64c4d..62f500c724f9 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -54,11 +54,13 @@ enum hrtimer_restart {
54 * 0x00 inactive 54 * 0x00 inactive
55 * 0x01 enqueued into rbtree 55 * 0x01 enqueued into rbtree
56 * 0x02 callback function running 56 * 0x02 callback function running
57 * 0x04 timer is migrated to another cpu
57 * 58 *
58 * Special cases: 59 * Special cases:
59 * 0x03 callback function running and enqueued 60 * 0x03 callback function running and enqueued
60 * (was requeued on another CPU) 61 * (was requeued on another CPU)
61 * 0x09 timer was migrated on CPU hotunplug 62 * 0x05 timer was migrated on CPU hotunplug
63 *
62 * The "callback function running and enqueued" status is only possible on 64 * The "callback function running and enqueued" status is only possible on
63 * SMP. It happens for example when a posix timer expired and the callback 65 * SMP. It happens for example when a posix timer expired and the callback
64 * queued a signal. Between dropping the lock which protects the posix timer 66 * queued a signal. Between dropping the lock which protects the posix timer
@@ -67,8 +69,11 @@ enum hrtimer_restart {
67 * as otherwise the timer could be removed before the softirq code finishes the 69 * as otherwise the timer could be removed before the softirq code finishes the
68 * the handling of the timer. 70 * the handling of the timer.
69 * 71 *
70 * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state to 72 * The HRTIMER_STATE_ENQUEUED bit is always or'ed to the current state
71 * preserve the HRTIMER_STATE_CALLBACK bit in the above scenario. 73 * to preserve the HRTIMER_STATE_CALLBACK in the above scenario. This
74 * also affects HRTIMER_STATE_MIGRATE where the preservation is not
75 * necessary. HRTIMER_STATE_MIGRATE is cleared after the timer is
76 * enqueued on the new cpu.
72 * 77 *
73 * All state transitions are protected by cpu_base->lock. 78 * All state transitions are protected by cpu_base->lock.
74 */ 79 */
@@ -148,7 +153,12 @@ struct hrtimer_clock_base {
148#endif 153#endif
149}; 154};
150 155
151#define HRTIMER_MAX_CLOCK_BASES 2 156enum hrtimer_base_type {
157 HRTIMER_BASE_REALTIME,
158 HRTIMER_BASE_MONOTONIC,
159 HRTIMER_BASE_BOOTTIME,
160 HRTIMER_MAX_CLOCK_BASES,
161};
152 162
153/* 163/*
154 * struct hrtimer_cpu_base - the per cpu clock bases 164 * struct hrtimer_cpu_base - the per cpu clock bases
@@ -308,6 +318,7 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer)
308 318
309extern ktime_t ktime_get(void); 319extern ktime_t ktime_get(void);
310extern ktime_t ktime_get_real(void); 320extern ktime_t ktime_get_real(void);
321extern ktime_t ktime_get_boottime(void);
311 322
312 323
313DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 324DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
@@ -370,8 +381,9 @@ extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
370extern ktime_t hrtimer_get_next_event(void); 381extern ktime_t hrtimer_get_next_event(void);
371 382
372/* 383/*
373 * A timer is active, when it is enqueued into the rbtree or the callback 384 * A timer is active, when it is enqueued into the rbtree or the
374 * function is running. 385 * callback function is running or it's in the state of being migrated
386 * to another cpu.
375 */ 387 */
376static inline int hrtimer_active(const struct hrtimer *timer) 388static inline int hrtimer_active(const struct hrtimer *timer)
377{ 389{
diff --git a/include/linux/hwspinlock.h b/include/linux/hwspinlock.h
new file mode 100644
index 000000000000..8390efc457eb
--- /dev/null
+++ b/include/linux/hwspinlock.h
@@ -0,0 +1,292 @@
1/*
2 * Hardware spinlock public header
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Contact: Ohad Ben-Cohen <ohad@wizery.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_HWSPINLOCK_H
19#define __LINUX_HWSPINLOCK_H
20
21#include <linux/err.h>
22#include <linux/sched.h>
23
24/* hwspinlock mode argument */
25#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
26#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
27
28struct hwspinlock;
29
30#if defined(CONFIG_HWSPINLOCK) || defined(CONFIG_HWSPINLOCK_MODULE)
31
32int hwspin_lock_register(struct hwspinlock *lock);
33struct hwspinlock *hwspin_lock_unregister(unsigned int id);
34struct hwspinlock *hwspin_lock_request(void);
35struct hwspinlock *hwspin_lock_request_specific(unsigned int id);
36int hwspin_lock_free(struct hwspinlock *hwlock);
37int hwspin_lock_get_id(struct hwspinlock *hwlock);
38int __hwspin_lock_timeout(struct hwspinlock *, unsigned int, int,
39 unsigned long *);
40int __hwspin_trylock(struct hwspinlock *, int, unsigned long *);
41void __hwspin_unlock(struct hwspinlock *, int, unsigned long *);
42
43#else /* !CONFIG_HWSPINLOCK */
44
45/*
46 * We don't want these functions to fail if CONFIG_HWSPINLOCK is not
47 * enabled. We prefer to silently succeed in this case, and let the
48 * code path get compiled away. This way, if CONFIG_HWSPINLOCK is not
49 * required on a given setup, users will still work.
50 *
51 * The only exception is hwspin_lock_register/hwspin_lock_unregister, with which
52 * we _do_ want users to fail (no point in registering hwspinlock instances if
53 * the framework is not available).
54 *
55 * Note: ERR_PTR(-ENODEV) will still be considered a success for NULL-checking
56 * users. Others, which care, can still check this with IS_ERR.
57 */
58static inline struct hwspinlock *hwspin_lock_request(void)
59{
60 return ERR_PTR(-ENODEV);
61}
62
63static inline struct hwspinlock *hwspin_lock_request_specific(unsigned int id)
64{
65 return ERR_PTR(-ENODEV);
66}
67
68static inline int hwspin_lock_free(struct hwspinlock *hwlock)
69{
70 return 0;
71}
72
73static inline
74int __hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to,
75 int mode, unsigned long *flags)
76{
77 return 0;
78}
79
80static inline
81int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
82{
83 return 0;
84}
85
86static inline
87void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
88{
89 return 0;
90}
91
92static inline int hwspin_lock_get_id(struct hwspinlock *hwlock)
93{
94 return 0;
95}
96
97static inline int hwspin_lock_register(struct hwspinlock *hwlock)
98{
99 return -ENODEV;
100}
101
102static inline struct hwspinlock *hwspin_lock_unregister(unsigned int id)
103{
104 return NULL;
105}
106
107#endif /* !CONFIG_HWSPINLOCK */
108
109/**
110 * hwspin_trylock_irqsave() - try to lock an hwspinlock, disable interrupts
111 * @hwlock: an hwspinlock which we want to trylock
112 * @flags: a pointer to where the caller's interrupt state will be saved at
113 *
114 * This function attempts to lock the underlying hwspinlock, and will
115 * immediately fail if the hwspinlock is already locked.
116 *
117 * Upon a successful return from this function, preemption and local
118 * interrupts are disabled (previous interrupts state is saved at @flags),
119 * so the caller must not sleep, and is advised to release the hwspinlock
120 * as soon as possible.
121 *
122 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
123 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
124 */
125static inline
126int hwspin_trylock_irqsave(struct hwspinlock *hwlock, unsigned long *flags)
127{
128 return __hwspin_trylock(hwlock, HWLOCK_IRQSTATE, flags);
129}
130
131/**
132 * hwspin_trylock_irq() - try to lock an hwspinlock, disable interrupts
133 * @hwlock: an hwspinlock which we want to trylock
134 *
135 * This function attempts to lock the underlying hwspinlock, and will
136 * immediately fail if the hwspinlock is already locked.
137 *
138 * Upon a successful return from this function, preemption and local
139 * interrupts are disabled, so the caller must not sleep, and is advised
140 * to release the hwspinlock as soon as possible.
141 *
142 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
143 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
144 */
145static inline int hwspin_trylock_irq(struct hwspinlock *hwlock)
146{
147 return __hwspin_trylock(hwlock, HWLOCK_IRQ, NULL);
148}
149
150/**
151 * hwspin_trylock() - attempt to lock a specific hwspinlock
152 * @hwlock: an hwspinlock which we want to trylock
153 *
154 * This function attempts to lock an hwspinlock, and will immediately fail
155 * if the hwspinlock is already taken.
156 *
157 * Upon a successful return from this function, preemption is disabled,
158 * so the caller must not sleep, and is advised to release the hwspinlock
159 * as soon as possible. This is required in order to minimize remote cores
160 * polling on the hardware interconnect.
161 *
162 * Returns 0 if we successfully locked the hwspinlock, -EBUSY if
163 * the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
164 */
165static inline int hwspin_trylock(struct hwspinlock *hwlock)
166{
167 return __hwspin_trylock(hwlock, 0, NULL);
168}
169
170/**
171 * hwspin_lock_timeout_irqsave() - lock hwspinlock, with timeout, disable irqs
172 * @hwlock: the hwspinlock to be locked
173 * @to: timeout value in msecs
174 * @flags: a pointer to where the caller's interrupt state will be saved at
175 *
176 * This function locks the underlying @hwlock. If the @hwlock
177 * is already taken, the function will busy loop waiting for it to
178 * be released, but give up when @timeout msecs have elapsed.
179 *
180 * Upon a successful return from this function, preemption and local interrupts
181 * are disabled (plus previous interrupt state is saved), so the caller must
182 * not sleep, and is advised to release the hwspinlock as soon as possible.
183 *
184 * Returns 0 when the @hwlock was successfully taken, and an appropriate
185 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
186 * busy after @timeout msecs). The function will never sleep.
187 */
188static inline int hwspin_lock_timeout_irqsave(struct hwspinlock *hwlock,
189 unsigned int to, unsigned long *flags)
190{
191 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQSTATE, flags);
192}
193
194/**
195 * hwspin_lock_timeout_irq() - lock hwspinlock, with timeout, disable irqs
196 * @hwlock: the hwspinlock to be locked
197 * @to: timeout value in msecs
198 *
199 * This function locks the underlying @hwlock. If the @hwlock
200 * is already taken, the function will busy loop waiting for it to
201 * be released, but give up when @timeout msecs have elapsed.
202 *
203 * Upon a successful return from this function, preemption and local interrupts
204 * are disabled so the caller must not sleep, and is advised to release the
205 * hwspinlock as soon as possible.
206 *
207 * Returns 0 when the @hwlock was successfully taken, and an appropriate
208 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
209 * busy after @timeout msecs). The function will never sleep.
210 */
211static inline
212int hwspin_lock_timeout_irq(struct hwspinlock *hwlock, unsigned int to)
213{
214 return __hwspin_lock_timeout(hwlock, to, HWLOCK_IRQ, NULL);
215}
216
217/**
218 * hwspin_lock_timeout() - lock an hwspinlock with timeout limit
219 * @hwlock: the hwspinlock to be locked
220 * @to: timeout value in msecs
221 *
222 * This function locks the underlying @hwlock. If the @hwlock
223 * is already taken, the function will busy loop waiting for it to
224 * be released, but give up when @timeout msecs have elapsed.
225 *
226 * Upon a successful return from this function, preemption is disabled
227 * so the caller must not sleep, and is advised to release the hwspinlock
228 * as soon as possible.
229 * This is required in order to minimize remote cores polling on the
230 * hardware interconnect.
231 *
232 * Returns 0 when the @hwlock was successfully taken, and an appropriate
233 * error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
234 * busy after @timeout msecs). The function will never sleep.
235 */
236static inline
237int hwspin_lock_timeout(struct hwspinlock *hwlock, unsigned int to)
238{
239 return __hwspin_lock_timeout(hwlock, to, 0, NULL);
240}
241
242/**
243 * hwspin_unlock_irqrestore() - unlock hwspinlock, restore irq state
244 * @hwlock: a previously-acquired hwspinlock which we want to unlock
245 * @flags: previous caller's interrupt state to restore
246 *
247 * This function will unlock a specific hwspinlock, enable preemption and
248 * restore the previous state of the local interrupts. It should be used
249 * to undo, e.g., hwspin_trylock_irqsave().
250 *
251 * @hwlock must be already locked before calling this function: it is a bug
252 * to call unlock on a @hwlock that is already unlocked.
253 */
254static inline void hwspin_unlock_irqrestore(struct hwspinlock *hwlock,
255 unsigned long *flags)
256{
257 __hwspin_unlock(hwlock, HWLOCK_IRQSTATE, flags);
258}
259
260/**
261 * hwspin_unlock_irq() - unlock hwspinlock, enable interrupts
262 * @hwlock: a previously-acquired hwspinlock which we want to unlock
263 *
264 * This function will unlock a specific hwspinlock, enable preemption and
265 * enable local interrupts. Should be used to undo hwspin_lock_irq().
266 *
267 * @hwlock must be already locked (e.g. by hwspin_trylock_irq()) before
268 * calling this function: it is a bug to call unlock on a @hwlock that is
269 * already unlocked.
270 */
271static inline void hwspin_unlock_irq(struct hwspinlock *hwlock)
272{
273 __hwspin_unlock(hwlock, HWLOCK_IRQ, NULL);
274}
275
276/**
277 * hwspin_unlock() - unlock hwspinlock
278 * @hwlock: a previously-acquired hwspinlock which we want to unlock
279 *
280 * This function will unlock a specific hwspinlock and enable preemption
281 * back.
282 *
283 * @hwlock must be already locked (e.g. by hwspin_trylock()) before calling
284 * this function: it is a bug to call unlock on a @hwlock that is already
285 * unlocked.
286 */
287static inline void hwspin_unlock(struct hwspinlock *hwlock)
288{
289 __hwspin_unlock(hwlock, 0, NULL);
290}
291
292#endif /* __LINUX_HWSPINLOCK_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
deleted file mode 100644
index 4bef5c557160..000000000000
--- a/include/linux/i2c-id.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/* ------------------------------------------------------------------------- */
2/* */
3/* i2c-id.h - identifier values for i2c drivers and adapters */
4/* */
5/* ------------------------------------------------------------------------- */
6/* Copyright (C) 1995-1999 Simon G. Vogl
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 LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H
25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
30/*
31 * ---- Adapter types ----------------------------------------------------
32 */
33
34/* --- Bit algorithm adapters */
35#define I2C_HW_B_CX2388x 0x01001b /* connexant 2388x based tv cards */
36
37#endif /* LINUX_I2C_ID_H */
diff --git a/include/linux/i2c-tegra.h b/include/linux/i2c-tegra.h
new file mode 100644
index 000000000000..9c85da49857a
--- /dev/null
+++ b/include/linux/i2c-tegra.h
@@ -0,0 +1,25 @@
1/*
2 * drivers/i2c/busses/i2c-tegra.c
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
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 */
17
18#ifndef _LINUX_I2C_TEGRA_H
19#define _LINUX_I2C_TEGRA_H
20
21struct tegra_i2c_platform_data {
22 unsigned long bus_clk_rate;
23};
24
25#endif /* _LINUX_I2C_TEGRA_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 903576df88dc..f1e3ff5880a9 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -29,7 +29,6 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/i2c-id.h>
33#include <linux/mod_devicetable.h> 32#include <linux/mod_devicetable.h>
34#include <linux/device.h> /* for struct device */ 33#include <linux/device.h> /* for struct device */
35#include <linux/sched.h> /* for completion */ 34#include <linux/sched.h> /* for completion */
@@ -105,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
105/** 104/**
106 * struct i2c_driver - represent an I2C device driver 105 * struct i2c_driver - represent an I2C device driver
107 * @class: What kind of i2c device we instantiate (for detect) 106 * @class: What kind of i2c device we instantiate (for detect)
108 * @attach_adapter: Callback for bus addition (for legacy drivers) 107 * @attach_adapter: Callback for bus addition (deprecated)
109 * @detach_adapter: Callback for bus removal (for legacy drivers) 108 * @detach_adapter: Callback for bus removal (deprecated)
110 * @probe: Callback for device binding 109 * @probe: Callback for device binding
111 * @remove: Callback for device unbinding 110 * @remove: Callback for device unbinding
112 * @shutdown: Callback for device shutdown 111 * @shutdown: Callback for device shutdown
@@ -144,11 +143,11 @@ struct i2c_driver {
144 unsigned int class; 143 unsigned int class;
145 144
146 /* Notifies the driver that a new bus has appeared or is about to be 145 /* Notifies the driver that a new bus has appeared or is about to be
147 * removed. You should avoid using this if you can, it will probably 146 * removed. You should avoid using this, it will be removed in a
148 * be removed in a near future. 147 * near future.
149 */ 148 */
150 int (*attach_adapter)(struct i2c_adapter *); 149 int (*attach_adapter)(struct i2c_adapter *) __deprecated;
151 int (*detach_adapter)(struct i2c_adapter *); 150 int (*detach_adapter)(struct i2c_adapter *) __deprecated;
152 151
153 /* Standard driver model interfaces */ 152 /* Standard driver model interfaces */
154 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 153 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
@@ -258,9 +257,7 @@ struct i2c_board_info {
258 unsigned short addr; 257 unsigned short addr;
259 void *platform_data; 258 void *platform_data;
260 struct dev_archdata *archdata; 259 struct dev_archdata *archdata;
261#ifdef CONFIG_OF
262 struct device_node *of_node; 260 struct device_node *of_node;
263#endif
264 int irq; 261 int irq;
265}; 262};
266 263
@@ -356,7 +353,6 @@ struct i2c_algorithm {
356 */ 353 */
357struct i2c_adapter { 354struct i2c_adapter {
358 struct module *owner; 355 struct module *owner;
359 unsigned int id __deprecated;
360 unsigned int class; /* classes to allow probing for */ 356 unsigned int class; /* classes to allow probing for */
361 const struct i2c_algorithm *algo; /* the algorithm to access the bus */ 357 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
362 void *algo_data; 358 void *algo_data;
@@ -398,6 +394,8 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
398 return NULL; 394 return NULL;
399} 395}
400 396
397int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *));
398
401/* Adapter locking functions, exported for shared pin cases */ 399/* Adapter locking functions, exported for shared pin cases */
402void i2c_lock_adapter(struct i2c_adapter *); 400void i2c_lock_adapter(struct i2c_adapter *);
403void i2c_unlock_adapter(struct i2c_adapter *); 401void i2c_unlock_adapter(struct i2c_adapter *);
@@ -449,7 +447,7 @@ extern void i2c_release_client(struct i2c_client *client);
449extern void i2c_clients_command(struct i2c_adapter *adap, 447extern void i2c_clients_command(struct i2c_adapter *adap,
450 unsigned int cmd, void *arg); 448 unsigned int cmd, void *arg);
451 449
452extern struct i2c_adapter *i2c_get_adapter(int id); 450extern struct i2c_adapter *i2c_get_adapter(int nr);
453extern void i2c_put_adapter(struct i2c_adapter *adap); 451extern void i2c_put_adapter(struct i2c_adapter *adap);
454 452
455 453
diff --git a/include/linux/i2c/ads1015.h b/include/linux/i2c/ads1015.h
new file mode 100644
index 000000000000..d5aa2a045669
--- /dev/null
+++ b/include/linux/i2c/ads1015.h
@@ -0,0 +1,36 @@
1/*
2 * Platform Data for ADS1015 12-bit 4-input ADC
3 * (C) Copyright 2010
4 * Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef LINUX_ADS1015_H
22#define LINUX_ADS1015_H
23
24#define ADS1015_CHANNELS 8
25
26struct ads1015_channel_data {
27 bool enabled;
28 unsigned int pga;
29 unsigned int data_rate;
30};
31
32struct ads1015_platform_data {
33 struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
34};
35
36#endif /* LINUX_ADS1015_H */
diff --git a/include/linux/i2c/qt602240_ts.h b/include/linux/i2c/atmel_mxt_ts.h
index c5033e101094..f027f7a63511 100644
--- a/include/linux/i2c/qt602240_ts.h
+++ b/include/linux/i2c/atmel_mxt_ts.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * AT42QT602240/ATMXT224 Touchscreen driver 2 * Atmel maXTouch Touchscreen driver
3 * 3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd 4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com> 5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
@@ -10,21 +10,26 @@
10 * option) any later version. 10 * option) any later version.
11 */ 11 */
12 12
13#ifndef __LINUX_QT602240_TS_H 13#ifndef __LINUX_ATMEL_MXT_TS_H
14#define __LINUX_QT602240_TS_H 14#define __LINUX_ATMEL_MXT_TS_H
15
16#include <linux/types.h>
15 17
16/* Orient */ 18/* Orient */
17#define QT602240_NORMAL 0x0 19#define MXT_NORMAL 0x0
18#define QT602240_DIAGONAL 0x1 20#define MXT_DIAGONAL 0x1
19#define QT602240_HORIZONTAL_FLIP 0x2 21#define MXT_HORIZONTAL_FLIP 0x2
20#define QT602240_ROTATED_90_COUNTER 0x3 22#define MXT_ROTATED_90_COUNTER 0x3
21#define QT602240_VERTICAL_FLIP 0x4 23#define MXT_VERTICAL_FLIP 0x4
22#define QT602240_ROTATED_90 0x5 24#define MXT_ROTATED_90 0x5
23#define QT602240_ROTATED_180 0x6 25#define MXT_ROTATED_180 0x6
24#define QT602240_DIAGONAL_COUNTER 0x7 26#define MXT_DIAGONAL_COUNTER 0x7
27
28/* The platform data for the Atmel maXTouch touchscreen driver */
29struct mxt_platform_data {
30 const u8 *config;
31 size_t config_length;
25 32
26/* The platform data for the AT42QT602240/ATMXT224 touchscreen driver */
27struct qt602240_platform_data {
28 unsigned int x_line; 33 unsigned int x_line;
29 unsigned int y_line; 34 unsigned int y_line;
30 unsigned int x_size; 35 unsigned int x_size;
@@ -33,6 +38,7 @@ struct qt602240_platform_data {
33 unsigned int threshold; 38 unsigned int threshold;
34 unsigned int voltage; 39 unsigned int voltage;
35 unsigned char orient; 40 unsigned char orient;
41 unsigned long irqflags;
36}; 42};
37 43
38#endif /* __LINUX_QT602240_TS_H */ 44#endif /* __LINUX_ATMEL_MXT_TS_H */
diff --git a/include/linux/i2c/max6639.h b/include/linux/i2c/max6639.h
new file mode 100644
index 000000000000..6011c42034da
--- /dev/null
+++ b/include/linux/i2c/max6639.h
@@ -0,0 +1,14 @@
1#ifndef _LINUX_MAX6639_H
2#define _LINUX_MAX6639_H
3
4#include <linux/types.h>
5
6/* platform data for the MAX6639 temperature sensor and fan control */
7
8struct max6639_platform_data {
9 bool pwm_polarity; /* Polarity low (0) or high (1, default) */
10 int ppr; /* Pulses per rotation 1..4 (default == 2) */
11 int rpm_range; /* 2000, 4000 (default), 8000 or 16000 */
12};
13
14#endif /* _LINUX_MAX6639_H */
diff --git a/include/linux/i2c/mcs.h b/include/linux/i2c/mcs.h
index 725ae7c313ff..61bb18a4fd3c 100644
--- a/include/linux/i2c/mcs.h
+++ b/include/linux/i2c/mcs.h
@@ -18,6 +18,7 @@
18#define MCS_KEY_CODE(v) ((v) & 0xffff) 18#define MCS_KEY_CODE(v) ((v) & 0xffff)
19 19
20struct mcs_platform_data { 20struct mcs_platform_data {
21 void (*poweron)(bool);
21 void (*cfg_pin)(void); 22 void (*cfg_pin)(void);
22 23
23 /* touchscreen */ 24 /* touchscreen */
diff --git a/include/linux/i2c/pmbus.h b/include/linux/i2c/pmbus.h
new file mode 100644
index 000000000000..69280db02c41
--- /dev/null
+++ b/include/linux/i2c/pmbus.h
@@ -0,0 +1,45 @@
1/*
2 * Hardware monitoring driver for PMBus devices
3 *
4 * Copyright (c) 2010, 2011 Ericsson AB.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _PMBUS_H_
22#define _PMBUS_H_
23
24/* flags */
25
26/*
27 * PMBUS_SKIP_STATUS_CHECK
28 *
29 * During register detection, skip checking the status register for
30 * communication or command errors.
31 *
32 * Some PMBus chips respond with valid data when trying to read an unsupported
33 * register. For such chips, checking the status register is mandatory when
34 * trying to determine if a chip register exists or not.
35 * Other PMBus chips don't support the STATUS_CML register, or report
36 * communication errors for no explicable reason. For such chips, checking
37 * the status register must be disabled.
38 */
39#define PMBUS_SKIP_STATUS_CHECK (1 << 0)
40
41struct pmbus_platform_data {
42 u32 flags; /* Device specific flags */
43};
44
45#endif /* _PMBUS_H_ */
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
new file mode 100644
index 000000000000..1a9f65e6ec0f
--- /dev/null
+++ b/include/linux/i2c/pxa-i2c.h
@@ -0,0 +1,82 @@
1/*
2 * i2c_pxa.h
3 *
4 * Copyright (C) 2002 Intrinsyc Software 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 */
11#ifndef _I2C_PXA_H_
12#define _I2C_PXA_H_
13
14#if 0
15#define DEF_TIMEOUT 3
16#else
17/* need a longer timeout if we're dealing with the fact we may well be
18 * looking at a multi-master environment
19*/
20#define DEF_TIMEOUT 32
21#endif
22
23#define BUS_ERROR (-EREMOTEIO)
24#define XFER_NAKED (-ECONNREFUSED)
25#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
26
27/* ICR initialize bit values
28*
29* 15. FM 0 (100 Khz operation)
30* 14. UR 0 (No unit reset)
31* 13. SADIE 0 (Disables the unit from interrupting on slave addresses
32* matching its slave address)
33* 12. ALDIE 0 (Disables the unit from interrupt when it loses arbitration
34* in master mode)
35* 11. SSDIE 0 (Disables interrupts from a slave stop detected, in slave mode)
36* 10. BEIE 1 (Enable interrupts from detected bus errors, no ACK sent)
37* 9. IRFIE 1 (Enable interrupts from full buffer received)
38* 8. ITEIE 1 (Enables the I2C unit to interrupt when transmit buffer empty)
39* 7. GCD 1 (Disables i2c unit response to general call messages as a slave)
40* 6. IUE 0 (Disable unit until we change settings)
41* 5. SCLE 1 (Enables the i2c clock output for master mode (drives SCL)
42* 4. MA 0 (Only send stop with the ICR stop bit)
43* 3. TB 0 (We are not transmitting a byte initially)
44* 2. ACKNAK 0 (Send an ACK after the unit receives a byte)
45* 1. STOP 0 (Do not send a STOP)
46* 0. START 0 (Do not send a START)
47*
48*/
49#define I2C_ICR_INIT (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE)
50
51/* I2C status register init values
52 *
53 * 10. BED 1 (Clear bus error detected)
54 * 9. SAD 1 (Clear slave address detected)
55 * 7. IRF 1 (Clear IDBR Receive Full)
56 * 6. ITE 1 (Clear IDBR Transmit Empty)
57 * 5. ALD 1 (Clear Arbitration Loss Detected)
58 * 4. SSD 1 (Clear Slave Stop Detected)
59 */
60#define I2C_ISR_INIT 0x7FF /* status register init */
61
62struct i2c_slave_client;
63
64struct i2c_pxa_platform_data {
65 unsigned int slave_addr;
66 struct i2c_slave_client *slave;
67 unsigned int class;
68 unsigned int use_pio :1;
69 unsigned int fast_mode :1;
70};
71
72extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
73
74#ifdef CONFIG_PXA27x
75extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info);
76#endif
77
78#ifdef CONFIG_PXA3xx
79extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info);
80#endif
81
82#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 61b9609e55f2..0c0d1ae79981 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -600,6 +600,8 @@ struct twl4030_usb_data {
600 int (*phy_power)(struct device *dev, int iD, int on); 600 int (*phy_power)(struct device *dev, int iD, int on);
601 /* enable/disable phy clocks */ 601 /* enable/disable phy clocks */
602 int (*phy_set_clock)(struct device *dev, int on); 602 int (*phy_set_clock)(struct device *dev, int on);
603 /* suspend/resume of phy */
604 int (*phy_suspend)(struct device *dev, int suspend);
603}; 605};
604 606
605struct twl4030_ins { 607struct twl4030_ins {
@@ -637,7 +639,6 @@ extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
637extern int twl4030_remove_script(u8 flags); 639extern int twl4030_remove_script(u8 flags);
638 640
639struct twl4030_codec_audio_data { 641struct twl4030_codec_audio_data {
640 unsigned int audio_mclk; /* not used, will be removed */
641 unsigned int digimic_delay; /* in ms */ 642 unsigned int digimic_delay; /* in ms */
642 unsigned int ramp_delay_value; 643 unsigned int ramp_delay_value;
643 unsigned int offset_cncl_path; 644 unsigned int offset_cncl_path;
@@ -648,7 +649,6 @@ struct twl4030_codec_audio_data {
648}; 649};
649 650
650struct twl4030_codec_vibra_data { 651struct twl4030_codec_vibra_data {
651 unsigned int audio_mclk;
652 unsigned int coexist; 652 unsigned int coexist;
653}; 653};
654 654
@@ -698,6 +698,7 @@ struct twl4030_platform_data {
698 struct regulator_init_data *vana; 698 struct regulator_init_data *vana;
699 struct regulator_init_data *vcxio; 699 struct regulator_init_data *vcxio;
700 struct regulator_init_data *vusb; 700 struct regulator_init_data *vusb;
701 struct regulator_init_data *clk32kg;
701}; 702};
702 703
703/*----------------------------------------------------------------------*/ 704/*----------------------------------------------------------------------*/
@@ -777,5 +778,6 @@ static inline int twl4030charger_usb_en(int enable) { return 0; }
777 778
778/* INTERNAL LDOs */ 779/* INTERNAL LDOs */
779#define TWL6030_REG_VRTC 47 780#define TWL6030_REG_VRTC 47
781#define TWL6030_REG_CLK32KG 48
780 782
781#endif /* End of __TWL4030_H */ 783#endif /* End of __TWL4030_H */
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
new file mode 100644
index 000000000000..6427d298fbfc
--- /dev/null
+++ b/include/linux/i2c/twl4030-madc.h
@@ -0,0 +1,141 @@
1/*
2 * twl4030_madc.h - Header for TWL4030 MADC
3 *
4 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 * J Keerthy <j-keerthy@ti.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
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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
19 * 02110-1301 USA
20 *
21 */
22
23#ifndef _TWL4030_MADC_H
24#define _TWL4030_MADC_H
25
26struct twl4030_madc_conversion_method {
27 u8 sel;
28 u8 avg;
29 u8 rbase;
30 u8 ctrl;
31};
32
33#define TWL4030_MADC_MAX_CHANNELS 16
34
35
36/*
37 * twl4030_madc_request- madc request packet for channel conversion
38 * @channels: 16 bit bitmap for individual channels
39 * @do_avgP: sample the input channel for 4 consecutive cycles
40 * @method: RT, SW1, SW2
41 * @type: Polling or interrupt based method
42 */
43
44struct twl4030_madc_request {
45 unsigned long channels;
46 u16 do_avg;
47 u16 method;
48 u16 type;
49 bool active;
50 bool result_pending;
51 int rbuf[TWL4030_MADC_MAX_CHANNELS];
52 void (*func_cb)(int len, int channels, int *buf);
53};
54
55enum conversion_methods {
56 TWL4030_MADC_RT,
57 TWL4030_MADC_SW1,
58 TWL4030_MADC_SW2,
59 TWL4030_MADC_NUM_METHODS
60};
61
62enum sample_type {
63 TWL4030_MADC_WAIT,
64 TWL4030_MADC_IRQ_ONESHOT,
65 TWL4030_MADC_IRQ_REARM
66};
67
68#define TWL4030_MADC_CTRL1 0x00
69#define TWL4030_MADC_CTRL2 0x01
70
71#define TWL4030_MADC_RTSELECT_LSB 0x02
72#define TWL4030_MADC_SW1SELECT_LSB 0x06
73#define TWL4030_MADC_SW2SELECT_LSB 0x0A
74
75#define TWL4030_MADC_RTAVERAGE_LSB 0x04
76#define TWL4030_MADC_SW1AVERAGE_LSB 0x08
77#define TWL4030_MADC_SW2AVERAGE_LSB 0x0C
78
79#define TWL4030_MADC_CTRL_SW1 0x12
80#define TWL4030_MADC_CTRL_SW2 0x13
81
82#define TWL4030_MADC_RTCH0_LSB 0x17
83#define TWL4030_MADC_GPCH0_LSB 0x37
84
85#define TWL4030_MADC_MADCON (1 << 0) /* MADC power on */
86#define TWL4030_MADC_BUSY (1 << 0) /* MADC busy */
87/* MADC conversion completion */
88#define TWL4030_MADC_EOC_SW (1 << 1)
89/* MADC SWx start conversion */
90#define TWL4030_MADC_SW_START (1 << 5)
91#define TWL4030_MADC_ADCIN0 (1 << 0)
92#define TWL4030_MADC_ADCIN1 (1 << 1)
93#define TWL4030_MADC_ADCIN2 (1 << 2)
94#define TWL4030_MADC_ADCIN3 (1 << 3)
95#define TWL4030_MADC_ADCIN4 (1 << 4)
96#define TWL4030_MADC_ADCIN5 (1 << 5)
97#define TWL4030_MADC_ADCIN6 (1 << 6)
98#define TWL4030_MADC_ADCIN7 (1 << 7)
99#define TWL4030_MADC_ADCIN8 (1 << 8)
100#define TWL4030_MADC_ADCIN9 (1 << 9)
101#define TWL4030_MADC_ADCIN10 (1 << 10)
102#define TWL4030_MADC_ADCIN11 (1 << 11)
103#define TWL4030_MADC_ADCIN12 (1 << 12)
104#define TWL4030_MADC_ADCIN13 (1 << 13)
105#define TWL4030_MADC_ADCIN14 (1 << 14)
106#define TWL4030_MADC_ADCIN15 (1 << 15)
107
108/* Fixed channels */
109#define TWL4030_MADC_BTEMP TWL4030_MADC_ADCIN1
110#define TWL4030_MADC_VBUS TWL4030_MADC_ADCIN8
111#define TWL4030_MADC_VBKB TWL4030_MADC_ADCIN9
112#define TWL4030_MADC_ICHG TWL4030_MADC_ADCIN10
113#define TWL4030_MADC_VCHG TWL4030_MADC_ADCIN11
114#define TWL4030_MADC_VBAT TWL4030_MADC_ADCIN12
115
116/* Step size and prescaler ratio */
117#define TEMP_STEP_SIZE 147
118#define TEMP_PSR_R 100
119#define CURR_STEP_SIZE 147
120#define CURR_PSR_R1 44
121#define CURR_PSR_R2 88
122
123#define TWL4030_BCI_BCICTL1 0x23
124#define TWL4030_BCI_CGAIN 0x020
125#define TWL4030_BCI_MESBAT (1 << 1)
126#define TWL4030_BCI_TYPEN (1 << 4)
127#define TWL4030_BCI_ITHEN (1 << 3)
128
129#define REG_BCICTL2 0x024
130#define TWL4030_BCI_ITHSENS 0x007
131
132struct twl4030_madc_user_parms {
133 int channel;
134 int average;
135 int status;
136 u16 result;
137};
138
139int twl4030_madc_conversion(struct twl4030_madc_request *conv);
140int twl4030_get_madc_conversion(int channel_no);
141#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 4c4c74ec5987..ba45e6bc0764 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -183,10 +183,10 @@ extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 u8 code, int pos); 184 u8 code, int pos);
185 185
186struct flowi; 186struct flowi6;
187struct in6_addr; 187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk, 188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl, 189 struct flowi6 *fl6,
190 u8 type, 190 u8 type,
191 const struct in6_addr *saddr, 191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr, 192 const struct in6_addr *daddr,
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 294169e31364..2d1c6117d92c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1325,6 +1325,9 @@ enum {
1325/* Although the spec says 8 I'm seeing 6 in practice */ 1325/* Although the spec says 8 I'm seeing 6 in practice */
1326#define IEEE80211_COUNTRY_IE_MIN_LEN 6 1326#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1327 1327
1328/* The Country String field of the element shall be 3 octets in length */
1329#define IEEE80211_COUNTRY_STRING_LEN 3
1330
1328/* 1331/*
1329 * For regulatory extension stuff see IEEE 802.11-2007 1332 * For regulatory extension stuff see IEEE 802.11-2007
1330 * Annex I (page 1141) and Annex J (page 1147). Also 1333 * Annex I (page 1141) and Annex J (page 1147). Also
diff --git a/include/linux/if.h b/include/linux/if.h
index 123959927745..3bc63e6a02f7 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -71,11 +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 */ 74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
75#define IFF_DISABLE_NETPOLL 0x2000 /* disable netpoll at run-time */ 75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
76#define IFF_MACVLAN_PORT 0x4000 /* device used as macvlan port */ 76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_BRIDGE_PORT 0x8000 /* device used as bridge port */ 77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78#define IFF_OVS_DATAPATH 0x10000 /* device used as Open vSwitch
79 * datapath port */ 78 * datapath port */
80 79
81#define IF_GET_IFACE 0x0001 /* for querying only */ 80#define IF_GET_IFACE 0x0001 /* for querying only */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 6485d2a89bec..f4a2e6b1b864 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -135,6 +135,7 @@ enum {
135 IFLA_VF_PORTS, 135 IFLA_VF_PORTS,
136 IFLA_PORT_SELF, 136 IFLA_PORT_SELF,
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */
138 __IFLA_MAX 139 __IFLA_MAX
139}; 140};
140 141
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index fcef103aa3f6..c9ad38322576 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -114,14 +114,14 @@ struct pppol2tp_ioc_stats {
114 __u16 tunnel_id; /* redundant */ 114 __u16 tunnel_id; /* redundant */
115 __u16 session_id; /* if zero, get tunnel stats */ 115 __u16 session_id; /* if zero, get tunnel stats */
116 __u32 using_ipsec:1; /* valid only for session_id == 0 */ 116 __u32 using_ipsec:1; /* valid only for session_id == 0 */
117 aligned_u64 tx_packets; 117 __aligned_u64 tx_packets;
118 aligned_u64 tx_bytes; 118 __aligned_u64 tx_bytes;
119 aligned_u64 tx_errors; 119 __aligned_u64 tx_errors;
120 aligned_u64 rx_packets; 120 __aligned_u64 rx_packets;
121 aligned_u64 rx_bytes; 121 __aligned_u64 rx_bytes;
122 aligned_u64 rx_seq_discards; 122 __aligned_u64 rx_seq_discards;
123 aligned_u64 rx_oos_packets; 123 __aligned_u64 rx_oos_packets;
124 aligned_u64 rx_errors; 124 __aligned_u64 rx_errors;
125}; 125};
126 126
127#define ifr__name b.ifr_ifrn.ifrn_name 127#define ifr__name b.ifr_ifrn.ifrn_name
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 74cfcff0148b..82de336b8155 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -217,7 +217,7 @@ struct ip_mc_list {
217#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) 217#define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value)
218#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value) 218#define IGMPV3_MRC(value) IGMPV3_EXP(0x80, 4, 3, value)
219 219
220extern int ip_check_mc(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto); 220extern int ip_check_mc_rcu(struct in_device *dev, __be32 mc_addr, __be32 src_addr, u16 proto);
221extern int igmp_rcv(struct sk_buff *); 221extern int igmp_rcv(struct sk_buff *);
222extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr); 222extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
223extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr); 223extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 975837e7d6c0..09e6e62f9953 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -20,7 +20,6 @@ extern void ima_inode_free(struct inode *inode);
20extern int ima_file_check(struct file *file, int mask); 20extern int ima_file_check(struct file *file, int mask);
21extern void ima_file_free(struct file *file); 21extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot); 22extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_counts_get(struct file *file);
24 23
25#else 24#else
26static inline int ima_bprm_check(struct linux_binprm *bprm) 25static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -53,10 +52,5 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
53 return 0; 52 return 0;
54} 53}
55 54
56static inline void ima_counts_get(struct file *file)
57{
58 return;
59}
60
61#endif /* CONFIG_IMA_H */ 55#endif /* CONFIG_IMA_H */
62#endif /* _LINUX_IMA_H */ 56#endif /* _LINUX_IMA_H */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index ae8fdc54e0c0..5f8146695b7f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -144,6 +144,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY) 144#define IN_DEV_ARP_NOTIFY(in_dev) IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
145 145
146struct in_ifaddr { 146struct in_ifaddr {
147 struct hlist_node hash;
147 struct in_ifaddr *ifa_next; 148 struct in_ifaddr *ifa_next;
148 struct in_device *ifa_dev; 149 struct in_device *ifa_dev;
149 struct rcu_head rcu_head; 150 struct rcu_head rcu_head;
diff --git a/include/linux/input-polldev.h b/include/linux/input-polldev.h
index 5e3dddf8f562..ce0b72464eb8 100644
--- a/include/linux/input-polldev.h
+++ b/include/linux/input-polldev.h
@@ -22,12 +22,12 @@
22 * @poll: driver-supplied method that polls the device and posts 22 * @poll: driver-supplied method that polls the device and posts
23 * input events (mandatory). 23 * input events (mandatory).
24 * @poll_interval: specifies how often the poll() method should be called. 24 * @poll_interval: specifies how often the poll() method should be called.
25 * Defaults to 500 msec unless overriden when registering the device. 25 * Defaults to 500 msec unless overridden when registering the device.
26 * @poll_interval_max: specifies upper bound for the poll interval. 26 * @poll_interval_max: specifies upper bound for the poll interval.
27 * Defaults to the initial value of @poll_interval. 27 * Defaults to the initial value of @poll_interval.
28 * @poll_interval_min: specifies lower bound for the poll interval. 28 * @poll_interval_min: specifies lower bound for the poll interval.
29 * Defaults to 0. 29 * Defaults to 0.
30 * @input: input device structire associated with the polled device. 30 * @input: input device structure associated with the polled device.
31 * Must be properly initialized by the driver (id, name, phys, bits). 31 * Must be properly initialized by the driver (id, name, phys, bits).
32 * 32 *
33 * Polled input device provides a skeleton for supporting simple input 33 * Polled input device provides a skeleton for supporting simple input
diff --git a/include/linux/input.h b/include/linux/input.h
index e428382ca28a..056ae8a5bd9b 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1154,8 +1154,6 @@ struct ff_effect {
1154 * sparse keymaps. If not supplied default mechanism will be used. 1154 * sparse keymaps. If not supplied default mechanism will be used.
1155 * The method is being called while holding event_lock and thus must 1155 * The method is being called while holding event_lock and thus must
1156 * not sleep 1156 * not sleep
1157 * @getkeycode_new: transition method
1158 * @setkeycode_new: transition method
1159 * @ff: force feedback structure associated with the device if device 1157 * @ff: force feedback structure associated with the device if device
1160 * supports force feedback effects 1158 * supports force feedback effects
1161 * @repeat_key: stores key code of the last key pressed; used to implement 1159 * @repeat_key: stores key code of the last key pressed; used to implement
@@ -1234,14 +1232,10 @@ struct input_dev {
1234 void *keycode; 1232 void *keycode;
1235 1233
1236 int (*setkeycode)(struct input_dev *dev, 1234 int (*setkeycode)(struct input_dev *dev,
1237 unsigned int scancode, unsigned int keycode); 1235 const struct input_keymap_entry *ke,
1236 unsigned int *old_keycode);
1238 int (*getkeycode)(struct input_dev *dev, 1237 int (*getkeycode)(struct input_dev *dev,
1239 unsigned int scancode, unsigned int *keycode); 1238 struct input_keymap_entry *ke);
1240 int (*setkeycode_new)(struct input_dev *dev,
1241 const struct input_keymap_entry *ke,
1242 unsigned int *old_keycode);
1243 int (*getkeycode_new)(struct input_dev *dev,
1244 struct input_keymap_entry *ke);
1245 1239
1246 struct ff_device *ff; 1240 struct ff_device *ff;
1247 1241
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 55e0d4253e49..59b72ca1c5d1 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,6 +14,8 @@
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/percpu.h> 15#include <linux/percpu.h>
16#include <linux/hrtimer.h> 16#include <linux/hrtimer.h>
17#include <linux/kref.h>
18#include <linux/workqueue.h>
17 19
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/ptrace.h> 21#include <asm/ptrace.h>
@@ -55,7 +57,8 @@
55 * Used by threaded interrupts which need to keep the 57 * Used by threaded interrupts which need to keep the
56 * irq line disabled until the threaded handler has been run. 58 * irq line disabled until the threaded handler has been run.
57 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend 59 * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
58 * 60 * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
61 * IRQF_NO_THREAD - Interrupt cannot be threaded
59 */ 62 */
60#define IRQF_DISABLED 0x00000020 63#define IRQF_DISABLED 0x00000020
61#define IRQF_SAMPLE_RANDOM 0x00000040 64#define IRQF_SAMPLE_RANDOM 0x00000040
@@ -67,22 +70,10 @@
67#define IRQF_IRQPOLL 0x00001000 70#define IRQF_IRQPOLL 0x00001000
68#define IRQF_ONESHOT 0x00002000 71#define IRQF_ONESHOT 0x00002000
69#define IRQF_NO_SUSPEND 0x00004000 72#define IRQF_NO_SUSPEND 0x00004000
73#define IRQF_FORCE_RESUME 0x00008000
74#define IRQF_NO_THREAD 0x00010000
70 75
71#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) 76#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
72
73/*
74 * Bits used by threaded handlers:
75 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
76 * IRQTF_DIED - handler thread died
77 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
78 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
79 */
80enum {
81 IRQTF_RUNTHREAD,
82 IRQTF_DIED,
83 IRQTF_WARNED,
84 IRQTF_AFFINITY,
85};
86 77
87/* 78/*
88 * These values can be returned by request_any_context_irq() and 79 * These values can be returned by request_any_context_irq() and
@@ -110,6 +101,7 @@ typedef irqreturn_t (*irq_handler_t)(int, void *);
110 * @thread_fn: interupt handler function for threaded interrupts 101 * @thread_fn: interupt handler function for threaded interrupts
111 * @thread: thread pointer for threaded interrupts 102 * @thread: thread pointer for threaded interrupts
112 * @thread_flags: flags related to @thread 103 * @thread_flags: flags related to @thread
104 * @thread_mask: bitmask for keeping track of @thread activity
113 */ 105 */
114struct irqaction { 106struct irqaction {
115 irq_handler_t handler; 107 irq_handler_t handler;
@@ -120,6 +112,7 @@ struct irqaction {
120 irq_handler_t thread_fn; 112 irq_handler_t thread_fn;
121 struct task_struct *thread; 113 struct task_struct *thread;
122 unsigned long thread_flags; 114 unsigned long thread_flags;
115 unsigned long thread_mask;
123 const char *name; 116 const char *name;
124 struct proc_dir_entry *dir; 117 struct proc_dir_entry *dir;
125} ____cacheline_internodealigned_in_smp; 118} ____cacheline_internodealigned_in_smp;
@@ -240,6 +233,35 @@ extern int irq_can_set_affinity(unsigned int irq);
240extern int irq_select_affinity(unsigned int irq); 233extern int irq_select_affinity(unsigned int irq);
241 234
242extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); 235extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m);
236
237/**
238 * struct irq_affinity_notify - context for notification of IRQ affinity changes
239 * @irq: Interrupt to which notification applies
240 * @kref: Reference count, for internal use
241 * @work: Work item, for internal use
242 * @notify: Function to be called on change. This will be
243 * called in process context.
244 * @release: Function to be called on release. This will be
245 * called in process context. Once registered, the
246 * structure must only be freed when this function is
247 * called or later.
248 */
249struct irq_affinity_notify {
250 unsigned int irq;
251 struct kref kref;
252 struct work_struct work;
253 void (*notify)(struct irq_affinity_notify *, const cpumask_t *mask);
254 void (*release)(struct kref *ref);
255};
256
257extern int
258irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify);
259
260static inline void irq_run_affinity_notifiers(void)
261{
262 flush_scheduled_work();
263}
264
243#else /* CONFIG_SMP */ 265#else /* CONFIG_SMP */
244 266
245static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m) 267static inline int irq_set_affinity(unsigned int irq, const struct cpumask *m)
@@ -255,7 +277,7 @@ static inline int irq_can_set_affinity(unsigned int irq)
255static inline int irq_select_affinity(unsigned int irq) { return 0; } 277static inline int irq_select_affinity(unsigned int irq) { return 0; }
256 278
257static inline int irq_set_affinity_hint(unsigned int irq, 279static inline int irq_set_affinity_hint(unsigned int irq,
258 const struct cpumask *m) 280 const struct cpumask *m)
259{ 281{
260 return -EINVAL; 282 return -EINVAL;
261} 283}
@@ -314,16 +336,24 @@ static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long
314} 336}
315 337
316/* IRQ wakeup (PM) control: */ 338/* IRQ wakeup (PM) control: */
317extern int set_irq_wake(unsigned int irq, unsigned int on); 339extern int irq_set_irq_wake(unsigned int irq, unsigned int on);
340
341#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
342/* Please do not use: Use the replacement functions instead */
343static inline int set_irq_wake(unsigned int irq, unsigned int on)
344{
345 return irq_set_irq_wake(irq, on);
346}
347#endif
318 348
319static inline int enable_irq_wake(unsigned int irq) 349static inline int enable_irq_wake(unsigned int irq)
320{ 350{
321 return set_irq_wake(irq, 1); 351 return irq_set_irq_wake(irq, 1);
322} 352}
323 353
324static inline int disable_irq_wake(unsigned int irq) 354static inline int disable_irq_wake(unsigned int irq)
325{ 355{
326 return set_irq_wake(irq, 0); 356 return irq_set_irq_wake(irq, 0);
327} 357}
328 358
329#else /* !CONFIG_GENERIC_HARDIRQS */ 359#else /* !CONFIG_GENERIC_HARDIRQS */
@@ -353,6 +383,13 @@ static inline int disable_irq_wake(unsigned int irq)
353} 383}
354#endif /* CONFIG_GENERIC_HARDIRQS */ 384#endif /* CONFIG_GENERIC_HARDIRQS */
355 385
386
387#ifdef CONFIG_IRQ_FORCED_THREADING
388extern bool force_irqthreads;
389#else
390#define force_irqthreads (0)
391#endif
392
356#ifndef __ARCH_SET_SOFTIRQ_PENDING 393#ifndef __ARCH_SET_SOFTIRQ_PENDING
357#define set_softirq_pending(x) (local_softirq_pending() = (x)) 394#define set_softirq_pending(x) (local_softirq_pending() = (x))
358#define or_softirq_pending(x) (local_softirq_pending() |= (x)) 395#define or_softirq_pending(x) (local_softirq_pending() |= (x))
@@ -426,6 +463,13 @@ extern void raise_softirq(unsigned int nr);
426 */ 463 */
427DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); 464DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
428 465
466DECLARE_PER_CPU(struct task_struct *, ksoftirqd);
467
468static inline struct task_struct *this_cpu_ksoftirqd(void)
469{
470 return this_cpu_read(ksoftirqd);
471}
472
429/* Try to send a softirq to a remote cpu. If this cannot be done, the 473/* Try to send a softirq to a remote cpu. If this cannot be done, the
430 * work will be queued to the local cpu. 474 * work will be queued to the local cpu.
431 */ 475 */
@@ -645,6 +689,7 @@ static inline void init_irq_proc(void)
645 689
646struct seq_file; 690struct seq_file;
647int show_interrupts(struct seq_file *p, void *v); 691int show_interrupts(struct seq_file *p, void *v);
692int arch_show_interrupts(struct seq_file *p, int prec);
648 693
649extern int early_irq_init(void); 694extern int early_irq_init(void);
650extern int arch_probe_nr_irqs(void); 695extern int arch_probe_nr_irqs(void);
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
index 5f43a3b2e3ad..4deb3834d62c 100644
--- a/include/linux/ip_vs.h
+++ b/include/linux/ip_vs.h
@@ -89,6 +89,14 @@
89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */ 89#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */ 90#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */
91 91
92#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
93 IP_VS_CONN_F_NOOUTPUT | \
94 IP_VS_CONN_F_INACTIVE | \
95 IP_VS_CONN_F_SEQ_MASK | \
96 IP_VS_CONN_F_NO_CPORT | \
97 IP_VS_CONN_F_TEMPLATE \
98 )
99
92/* Flags that are not sent to backup server start from bit 16 */ 100/* Flags that are not sent to backup server start from bit 16 */
93#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */ 101#define IP_VS_CONN_F_NFCT (1 << 16) /* use netfilter conntrack */
94 102
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 51952989ad42..a6d1655f9607 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -5,6 +5,7 @@
5#include <linux/idr.h> 5#include <linux/idr.h>
6#include <linux/rwsem.h> 6#include <linux/rwsem.h>
7#include <linux/notifier.h> 7#include <linux/notifier.h>
8#include <linux/nsproxy.h>
8 9
9/* 10/*
10 * ipc namespace events 11 * ipc namespace events
@@ -15,6 +16,7 @@
15 16
16#define IPCNS_CALLBACK_PRI 0 17#define IPCNS_CALLBACK_PRI 0
17 18
19struct user_namespace;
18 20
19struct ipc_ids { 21struct ipc_ids {
20 int in_use; 22 int in_use;
@@ -56,6 +58,8 @@ struct ipc_namespace {
56 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */ 58 unsigned int mq_msg_max; /* initialized to DFLT_MSGMAX */
57 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */ 59 unsigned int mq_msgsize_max; /* initialized to DFLT_MSGSIZEMAX */
58 60
61 /* user_ns which owns the ipc ns */
62 struct user_namespace *user_ns;
59}; 63};
60 64
61extern struct ipc_namespace init_ipc_ns; 65extern struct ipc_namespace init_ipc_ns;
@@ -90,7 +94,7 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
90 94
91#if defined(CONFIG_IPC_NS) 95#if defined(CONFIG_IPC_NS)
92extern struct ipc_namespace *copy_ipcs(unsigned long flags, 96extern struct ipc_namespace *copy_ipcs(unsigned long flags,
93 struct ipc_namespace *ns); 97 struct task_struct *tsk);
94static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 98static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
95{ 99{
96 if (ns) 100 if (ns)
@@ -101,12 +105,12 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
101extern void put_ipc_ns(struct ipc_namespace *ns); 105extern void put_ipc_ns(struct ipc_namespace *ns);
102#else 106#else
103static inline struct ipc_namespace *copy_ipcs(unsigned long flags, 107static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
104 struct ipc_namespace *ns) 108 struct task_struct *tsk)
105{ 109{
106 if (flags & CLONE_NEWIPC) 110 if (flags & CLONE_NEWIPC)
107 return ERR_PTR(-EINVAL); 111 return ERR_PTR(-EINVAL);
108 112
109 return ns; 113 return tsk->nsproxy->ipc_ns;
110} 114}
111 115
112static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 116static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 80fcb53057bc..5d876c9b3a3d 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -28,62 +28,106 @@
28#include <asm/ptrace.h> 28#include <asm/ptrace.h>
29#include <asm/irq_regs.h> 29#include <asm/irq_regs.h>
30 30
31struct seq_file;
31struct irq_desc; 32struct irq_desc;
33struct irq_data;
32typedef void (*irq_flow_handler_t)(unsigned int irq, 34typedef void (*irq_flow_handler_t)(unsigned int irq,
33 struct irq_desc *desc); 35 struct irq_desc *desc);
34 36typedef void (*irq_preflow_handler_t)(struct irq_data *data);
35 37
36/* 38/*
37 * IRQ line status. 39 * IRQ line status.
38 * 40 *
39 * Bits 0-7 are reserved for the IRQF_* bits in linux/interrupt.h 41 * Bits 0-7 are the same as the IRQF_* bits in linux/interrupt.h
42 *
43 * IRQ_TYPE_NONE - default, unspecified type
44 * IRQ_TYPE_EDGE_RISING - rising edge triggered
45 * IRQ_TYPE_EDGE_FALLING - falling edge triggered
46 * IRQ_TYPE_EDGE_BOTH - rising and falling edge triggered
47 * IRQ_TYPE_LEVEL_HIGH - high level triggered
48 * IRQ_TYPE_LEVEL_LOW - low level triggered
49 * IRQ_TYPE_LEVEL_MASK - Mask to filter out the level bits
50 * IRQ_TYPE_SENSE_MASK - Mask for all the above bits
51 * IRQ_TYPE_PROBE - Special flag for probing in progress
52 *
53 * Bits which can be modified via irq_set/clear/modify_status_flags()
54 * IRQ_LEVEL - Interrupt is level type. Will be also
55 * updated in the code when the above trigger
56 * bits are modified via set_irq_type()
57 * IRQ_PER_CPU - Mark an interrupt PER_CPU. Will protect
58 * it from affinity setting
59 * IRQ_NOPROBE - Interrupt cannot be probed by autoprobing
60 * IRQ_NOREQUEST - Interrupt cannot be requested via
61 * request_irq()
62 * IRQ_NOAUTOEN - Interrupt is not automatically enabled in
63 * request/setup_irq()
64 * IRQ_NO_BALANCING - Interrupt cannot be balanced (affinity set)
65 * IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context
66 * IRQ_NESTED_TRHEAD - Interrupt nests into another thread
67 *
68 * Deprecated bits. They are kept updated as long as
69 * CONFIG_GENERIC_HARDIRQS_NO_COMPAT is not set. Will go away soon. These bits
70 * are internal state of the core code and if you really need to acces
71 * them then talk to the genirq maintainer instead of hacking
72 * something weird.
40 * 73 *
41 * IRQ types
42 */ 74 */
43#define IRQ_TYPE_NONE 0x00000000 /* Default, unspecified type */ 75enum {
44#define IRQ_TYPE_EDGE_RISING 0x00000001 /* Edge rising type */ 76 IRQ_TYPE_NONE = 0x00000000,
45#define IRQ_TYPE_EDGE_FALLING 0x00000002 /* Edge falling type */ 77 IRQ_TYPE_EDGE_RISING = 0x00000001,
46#define IRQ_TYPE_EDGE_BOTH (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING) 78 IRQ_TYPE_EDGE_FALLING = 0x00000002,
47#define IRQ_TYPE_LEVEL_HIGH 0x00000004 /* Level high type */ 79 IRQ_TYPE_EDGE_BOTH = (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING),
48#define IRQ_TYPE_LEVEL_LOW 0x00000008 /* Level low type */ 80 IRQ_TYPE_LEVEL_HIGH = 0x00000004,
49#define IRQ_TYPE_SENSE_MASK 0x0000000f /* Mask of the above */ 81 IRQ_TYPE_LEVEL_LOW = 0x00000008,
50#define IRQ_TYPE_PROBE 0x00000010 /* Probing in progress */ 82 IRQ_TYPE_LEVEL_MASK = (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH),
51 83 IRQ_TYPE_SENSE_MASK = 0x0000000f,
52/* Internal flags */ 84
53#define IRQ_INPROGRESS 0x00000100 /* IRQ handler active - do not enter! */ 85 IRQ_TYPE_PROBE = 0x00000010,
54#define IRQ_DISABLED 0x00000200 /* IRQ disabled - do not enter! */ 86
55#define IRQ_PENDING 0x00000400 /* IRQ pending - replay on enable */ 87 IRQ_LEVEL = (1 << 8),
56#define IRQ_REPLAY 0x00000800 /* IRQ has been replayed but not acked yet */ 88 IRQ_PER_CPU = (1 << 9),
57#define IRQ_AUTODETECT 0x00001000 /* IRQ is being autodetected */ 89 IRQ_NOPROBE = (1 << 10),
58#define IRQ_WAITING 0x00002000 /* IRQ not yet seen - for autodetection */ 90 IRQ_NOREQUEST = (1 << 11),
59#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */ 91 IRQ_NOAUTOEN = (1 << 12),
60#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */ 92 IRQ_NO_BALANCING = (1 << 13),
61#define IRQ_PER_CPU 0x00010000 /* IRQ is per CPU */ 93 IRQ_MOVE_PCNTXT = (1 << 14),
62#define IRQ_NOPROBE 0x00020000 /* IRQ is not valid for probing */ 94 IRQ_NESTED_THREAD = (1 << 15),
63#define IRQ_NOREQUEST 0x00040000 /* IRQ cannot be requested */ 95
64#define IRQ_NOAUTOEN 0x00080000 /* IRQ will not be enabled on request irq */ 96#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
65#define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ 97 IRQ_INPROGRESS = (1 << 16),
66#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 98 IRQ_REPLAY = (1 << 17),
67#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 99 IRQ_WAITING = (1 << 18),
68#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 100 IRQ_DISABLED = (1 << 19),
69#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ 101 IRQ_PENDING = (1 << 20),
70#define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ 102 IRQ_MASKED = (1 << 21),
71#define IRQ_SUSPENDED 0x04000000 /* IRQ has gone through suspend sequence */ 103 IRQ_MOVE_PENDING = (1 << 22),
72#define IRQ_ONESHOT 0x08000000 /* IRQ is not unmasked after hardirq */ 104 IRQ_AFFINITY_SET = (1 << 23),
73#define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */ 105 IRQ_WAKEUP = (1 << 24),
106#endif
107};
74 108
75#define IRQF_MODIFY_MASK \ 109#define IRQF_MODIFY_MASK \
76 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \ 110 (IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
77 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \ 111 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
78 IRQ_PER_CPU) 112 IRQ_PER_CPU | IRQ_NESTED_THREAD)
79 113
80#ifdef CONFIG_IRQ_PER_CPU 114#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
81# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 115
82# define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING) 116static inline __deprecated bool CHECK_IRQ_PER_CPU(unsigned int status)
83#else 117{
84# define CHECK_IRQ_PER_CPU(var) 0 118 return status & IRQ_PER_CPU;
85# define IRQ_NO_BALANCING_MASK IRQ_NO_BALANCING 119}
86#endif 120
121/*
122 * Return value for chip->irq_set_affinity()
123 *
124 * IRQ_SET_MASK_OK - OK, core updates irq_data.affinity
125 * IRQ_SET_MASK_NOCPY - OK, chip did update irq_data.affinity
126 */
127enum {
128 IRQ_SET_MASK_OK = 0,
129 IRQ_SET_MASK_OK_NOCOPY,
130};
87 131
88struct msi_desc; 132struct msi_desc;
89 133
@@ -91,6 +135,8 @@ struct msi_desc;
91 * struct irq_data - per irq and irq chip data passed down to chip functions 135 * struct irq_data - per irq and irq chip data passed down to chip functions
92 * @irq: interrupt number 136 * @irq: interrupt number
93 * @node: node index useful for balancing 137 * @node: node index useful for balancing
138 * @state_use_accessor: status information for irq chip functions.
139 * Use accessor functions to deal with it
94 * @chip: low level interrupt hardware access 140 * @chip: low level interrupt hardware access
95 * @handler_data: per-IRQ data for the irq_chip methods 141 * @handler_data: per-IRQ data for the irq_chip methods
96 * @chip_data: platform-specific per-chip private data for the chip 142 * @chip_data: platform-specific per-chip private data for the chip
@@ -105,6 +151,7 @@ struct msi_desc;
105struct irq_data { 151struct irq_data {
106 unsigned int irq; 152 unsigned int irq;
107 unsigned int node; 153 unsigned int node;
154 unsigned int state_use_accessors;
108 struct irq_chip *chip; 155 struct irq_chip *chip;
109 void *handler_data; 156 void *handler_data;
110 void *chip_data; 157 void *chip_data;
@@ -114,6 +161,80 @@ struct irq_data {
114#endif 161#endif
115}; 162};
116 163
164/*
165 * Bit masks for irq_data.state
166 *
167 * IRQD_TRIGGER_MASK - Mask for the trigger type bits
168 * IRQD_SETAFFINITY_PENDING - Affinity setting is pending
169 * IRQD_NO_BALANCING - Balancing disabled for this IRQ
170 * IRQD_PER_CPU - Interrupt is per cpu
171 * IRQD_AFFINITY_SET - Interrupt affinity was set
172 * IRQD_LEVEL - Interrupt is level triggered
173 * IRQD_WAKEUP_STATE - Interrupt is configured for wakeup
174 * from suspend
175 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
176 * context
177 */
178enum {
179 IRQD_TRIGGER_MASK = 0xf,
180 IRQD_SETAFFINITY_PENDING = (1 << 8),
181 IRQD_NO_BALANCING = (1 << 10),
182 IRQD_PER_CPU = (1 << 11),
183 IRQD_AFFINITY_SET = (1 << 12),
184 IRQD_LEVEL = (1 << 13),
185 IRQD_WAKEUP_STATE = (1 << 14),
186 IRQD_MOVE_PCNTXT = (1 << 15),
187};
188
189static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
190{
191 return d->state_use_accessors & IRQD_SETAFFINITY_PENDING;
192}
193
194static inline bool irqd_is_per_cpu(struct irq_data *d)
195{
196 return d->state_use_accessors & IRQD_PER_CPU;
197}
198
199static inline bool irqd_can_balance(struct irq_data *d)
200{
201 return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING));
202}
203
204static inline bool irqd_affinity_was_set(struct irq_data *d)
205{
206 return d->state_use_accessors & IRQD_AFFINITY_SET;
207}
208
209static inline u32 irqd_get_trigger_type(struct irq_data *d)
210{
211 return d->state_use_accessors & IRQD_TRIGGER_MASK;
212}
213
214/*
215 * Must only be called inside irq_chip.irq_set_type() functions.
216 */
217static inline void irqd_set_trigger_type(struct irq_data *d, u32 type)
218{
219 d->state_use_accessors &= ~IRQD_TRIGGER_MASK;
220 d->state_use_accessors |= type & IRQD_TRIGGER_MASK;
221}
222
223static inline bool irqd_is_level_type(struct irq_data *d)
224{
225 return d->state_use_accessors & IRQD_LEVEL;
226}
227
228static inline bool irqd_is_wakeup_set(struct irq_data *d)
229{
230 return d->state_use_accessors & IRQD_WAKEUP_STATE;
231}
232
233static inline bool irqd_can_move_in_process_context(struct irq_data *d)
234{
235 return d->state_use_accessors & IRQD_MOVE_PCNTXT;
236}
237
117/** 238/**
118 * struct irq_chip - hardware interrupt chip descriptor 239 * struct irq_chip - hardware interrupt chip descriptor
119 * 240 *
@@ -150,6 +271,8 @@ struct irq_data {
150 * @irq_set_wake: enable/disable power-management wake-on of an IRQ 271 * @irq_set_wake: enable/disable power-management wake-on of an IRQ
151 * @irq_bus_lock: function to lock access to slow bus (i2c) chips 272 * @irq_bus_lock: function to lock access to slow bus (i2c) chips
152 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips 273 * @irq_bus_sync_unlock:function to sync and unlock slow bus (i2c) chips
274 * @irq_print_chip: optional to print special chip info in show_interrupts
275 * @flags: chip specific flags
153 * 276 *
154 * @release: release function solely used by UML 277 * @release: release function solely used by UML
155 */ 278 */
@@ -196,12 +319,29 @@ struct irq_chip {
196 void (*irq_bus_lock)(struct irq_data *data); 319 void (*irq_bus_lock)(struct irq_data *data);
197 void (*irq_bus_sync_unlock)(struct irq_data *data); 320 void (*irq_bus_sync_unlock)(struct irq_data *data);
198 321
322 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
323
324 unsigned long flags;
325
199 /* Currently used only by UML, might disappear one day.*/ 326 /* Currently used only by UML, might disappear one day.*/
200#ifdef CONFIG_IRQ_RELEASE_METHOD 327#ifdef CONFIG_IRQ_RELEASE_METHOD
201 void (*release)(unsigned int irq, void *dev_id); 328 void (*release)(unsigned int irq, void *dev_id);
202#endif 329#endif
203}; 330};
204 331
332/*
333 * irq_chip specific flags
334 *
335 * IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
336 * IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
337 * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
338 */
339enum {
340 IRQCHIP_SET_TYPE_MASKED = (1 << 0),
341 IRQCHIP_EOI_IF_HANDLED = (1 << 1),
342 IRQCHIP_MASK_ON_SUSPEND = (1 << 2),
343};
344
205/* This include will go away once we isolated irq_desc usage to core code */ 345/* This include will go away once we isolated irq_desc usage to core code */
206#include <linux/irqdesc.h> 346#include <linux/irqdesc.h>
207 347
@@ -218,7 +358,7 @@ struct irq_chip {
218# define ARCH_IRQ_INIT_FLAGS 0 358# define ARCH_IRQ_INIT_FLAGS 0
219#endif 359#endif
220 360
221#define IRQ_DEFAULT_INIT_FLAGS (IRQ_DISABLED | ARCH_IRQ_INIT_FLAGS) 361#define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
222 362
223struct irqaction; 363struct irqaction;
224extern int setup_irq(unsigned int irq, struct irqaction *new); 364extern int setup_irq(unsigned int irq, struct irqaction *new);
@@ -229,9 +369,13 @@ extern void remove_irq(unsigned int irq, struct irqaction *act);
229#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) 369#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ)
230void move_native_irq(int irq); 370void move_native_irq(int irq);
231void move_masked_irq(int irq); 371void move_masked_irq(int irq);
372void irq_move_irq(struct irq_data *data);
373void irq_move_masked_irq(struct irq_data *data);
232#else 374#else
233static inline void move_native_irq(int irq) { } 375static inline void move_native_irq(int irq) { }
234static inline void move_masked_irq(int irq) { } 376static inline void move_masked_irq(int irq) { }
377static inline void irq_move_irq(struct irq_data *data) { }
378static inline void irq_move_masked_irq(struct irq_data *data) { }
235#endif 379#endif
236 380
237extern int no_irq_affinity; 381extern int no_irq_affinity;
@@ -267,23 +411,23 @@ extern struct irq_chip no_irq_chip;
267extern struct irq_chip dummy_irq_chip; 411extern struct irq_chip dummy_irq_chip;
268 412
269extern void 413extern void
270set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip, 414irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
271 irq_flow_handler_t handle);
272extern void
273set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
274 irq_flow_handler_t handle, const char *name); 415 irq_flow_handler_t handle, const char *name);
275 416
417static inline void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *chip,
418 irq_flow_handler_t handle)
419{
420 irq_set_chip_and_handler_name(irq, chip, handle, NULL);
421}
422
276extern void 423extern void
277__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 424__irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
278 const char *name); 425 const char *name);
279 426
280/*
281 * Set a highlevel flow handler for a given IRQ:
282 */
283static inline void 427static inline void
284set_irq_handler(unsigned int irq, irq_flow_handler_t handle) 428irq_set_handler(unsigned int irq, irq_flow_handler_t handle)
285{ 429{
286 __set_irq_handler(irq, handle, 0, NULL); 430 __irq_set_handler(irq, handle, 0, NULL);
287} 431}
288 432
289/* 433/*
@@ -292,14 +436,11 @@ set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
292 * IRQ_NOREQUEST and IRQ_NOPROBE) 436 * IRQ_NOREQUEST and IRQ_NOPROBE)
293 */ 437 */
294static inline void 438static inline void
295set_irq_chained_handler(unsigned int irq, 439irq_set_chained_handler(unsigned int irq, irq_flow_handler_t handle)
296 irq_flow_handler_t handle)
297{ 440{
298 __set_irq_handler(irq, handle, 1, NULL); 441 __irq_set_handler(irq, handle, 1, NULL);
299} 442}
300 443
301extern void set_irq_nested_thread(unsigned int irq, int nest);
302
303void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set); 444void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set);
304 445
305static inline void irq_set_status_flags(unsigned int irq, unsigned long set) 446static inline void irq_set_status_flags(unsigned int irq, unsigned long set)
@@ -312,16 +453,24 @@ static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr)
312 irq_modify_status(irq, clr, 0); 453 irq_modify_status(irq, clr, 0);
313} 454}
314 455
315static inline void set_irq_noprobe(unsigned int irq) 456static inline void irq_set_noprobe(unsigned int irq)
316{ 457{
317 irq_modify_status(irq, 0, IRQ_NOPROBE); 458 irq_modify_status(irq, 0, IRQ_NOPROBE);
318} 459}
319 460
320static inline void set_irq_probe(unsigned int irq) 461static inline void irq_set_probe(unsigned int irq)
321{ 462{
322 irq_modify_status(irq, IRQ_NOPROBE, 0); 463 irq_modify_status(irq, IRQ_NOPROBE, 0);
323} 464}
324 465
466static inline void irq_set_nested_thread(unsigned int irq, bool nest)
467{
468 if (nest)
469 irq_set_status_flags(irq, IRQ_NESTED_THREAD);
470 else
471 irq_clear_status_flags(irq, IRQ_NESTED_THREAD);
472}
473
325/* Handle dynamic irq creation and destruction */ 474/* Handle dynamic irq creation and destruction */
326extern unsigned int create_irq_nr(unsigned int irq_want, int node); 475extern unsigned int create_irq_nr(unsigned int irq_want, int node);
327extern int create_irq(void); 476extern int create_irq(void);
@@ -338,14 +487,14 @@ static inline void dynamic_irq_init(unsigned int irq)
338} 487}
339 488
340/* Set/get chip/data for an IRQ: */ 489/* Set/get chip/data for an IRQ: */
341extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); 490extern int irq_set_chip(unsigned int irq, struct irq_chip *chip);
342extern int set_irq_data(unsigned int irq, void *data); 491extern int irq_set_handler_data(unsigned int irq, void *data);
343extern int set_irq_chip_data(unsigned int irq, void *data); 492extern int irq_set_chip_data(unsigned int irq, void *data);
344extern int set_irq_type(unsigned int irq, unsigned int type); 493extern int irq_set_irq_type(unsigned int irq, unsigned int type);
345extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); 494extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
346extern struct irq_data *irq_get_irq_data(unsigned int irq); 495extern struct irq_data *irq_get_irq_data(unsigned int irq);
347 496
348static inline struct irq_chip *get_irq_chip(unsigned int irq) 497static inline struct irq_chip *irq_get_chip(unsigned int irq)
349{ 498{
350 struct irq_data *d = irq_get_irq_data(irq); 499 struct irq_data *d = irq_get_irq_data(irq);
351 return d ? d->chip : NULL; 500 return d ? d->chip : NULL;
@@ -356,7 +505,7 @@ static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d)
356 return d->chip; 505 return d->chip;
357} 506}
358 507
359static inline void *get_irq_chip_data(unsigned int irq) 508static inline void *irq_get_chip_data(unsigned int irq)
360{ 509{
361 struct irq_data *d = irq_get_irq_data(irq); 510 struct irq_data *d = irq_get_irq_data(irq);
362 return d ? d->chip_data : NULL; 511 return d ? d->chip_data : NULL;
@@ -367,18 +516,18 @@ static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
367 return d->chip_data; 516 return d->chip_data;
368} 517}
369 518
370static inline void *get_irq_data(unsigned int irq) 519static inline void *irq_get_handler_data(unsigned int irq)
371{ 520{
372 struct irq_data *d = irq_get_irq_data(irq); 521 struct irq_data *d = irq_get_irq_data(irq);
373 return d ? d->handler_data : NULL; 522 return d ? d->handler_data : NULL;
374} 523}
375 524
376static inline void *irq_data_get_irq_data(struct irq_data *d) 525static inline void *irq_data_get_irq_handler_data(struct irq_data *d)
377{ 526{
378 return d->handler_data; 527 return d->handler_data;
379} 528}
380 529
381static inline struct msi_desc *get_irq_msi(unsigned int irq) 530static inline struct msi_desc *irq_get_msi_desc(unsigned int irq)
382{ 531{
383 struct irq_data *d = irq_get_irq_data(irq); 532 struct irq_data *d = irq_get_irq_data(irq);
384 return d ? d->msi_desc : NULL; 533 return d ? d->msi_desc : NULL;
@@ -389,6 +538,89 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
389 return d->msi_desc; 538 return d->msi_desc;
390} 539}
391 540
541#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
542/* Please do not use: Use the replacement functions instead */
543static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip)
544{
545 return irq_set_chip(irq, chip);
546}
547static inline int set_irq_data(unsigned int irq, void *data)
548{
549 return irq_set_handler_data(irq, data);
550}
551static inline int set_irq_chip_data(unsigned int irq, void *data)
552{
553 return irq_set_chip_data(irq, data);
554}
555static inline int set_irq_type(unsigned int irq, unsigned int type)
556{
557 return irq_set_irq_type(irq, type);
558}
559static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry)
560{
561 return irq_set_msi_desc(irq, entry);
562}
563static inline struct irq_chip *get_irq_chip(unsigned int irq)
564{
565 return irq_get_chip(irq);
566}
567static inline void *get_irq_chip_data(unsigned int irq)
568{
569 return irq_get_chip_data(irq);
570}
571static inline void *get_irq_data(unsigned int irq)
572{
573 return irq_get_handler_data(irq);
574}
575static inline void *irq_data_get_irq_data(struct irq_data *d)
576{
577 return irq_data_get_irq_handler_data(d);
578}
579static inline struct msi_desc *get_irq_msi(unsigned int irq)
580{
581 return irq_get_msi_desc(irq);
582}
583static inline void set_irq_noprobe(unsigned int irq)
584{
585 irq_set_noprobe(irq);
586}
587static inline void set_irq_probe(unsigned int irq)
588{
589 irq_set_probe(irq);
590}
591static inline void set_irq_nested_thread(unsigned int irq, int nest)
592{
593 irq_set_nested_thread(irq, nest);
594}
595static inline void
596set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
597 irq_flow_handler_t handle, const char *name)
598{
599 irq_set_chip_and_handler_name(irq, chip, handle, name);
600}
601static inline void
602set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
603 irq_flow_handler_t handle)
604{
605 irq_set_chip_and_handler(irq, chip, handle);
606}
607static inline void
608__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
609 const char *name)
610{
611 __irq_set_handler(irq, handle, is_chained, name);
612}
613static inline void set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
614{
615 irq_set_handler(irq, handle);
616}
617static inline void
618set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle)
619{
620 irq_set_chained_handler(irq, handle);
621}
622#endif
623
392int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); 624int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);
393void irq_free_descs(unsigned int irq, unsigned int cnt); 625void irq_free_descs(unsigned int irq, unsigned int cnt);
394int irq_reserve_irqs(unsigned int from, unsigned int cnt); 626int irq_reserve_irqs(unsigned int from, unsigned int cnt);
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index c1a95b7b58de..15e6c3905f41 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -8,6 +8,7 @@
8 * For now it's included from <linux/irq.h> 8 * For now it's included from <linux/irq.h>
9 */ 9 */
10 10
11struct irq_affinity_notify;
11struct proc_dir_entry; 12struct proc_dir_entry;
12struct timer_rand_state; 13struct timer_rand_state;
13/** 14/**
@@ -18,13 +19,16 @@ struct timer_rand_state;
18 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 19 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
19 * @action: the irq action chain 20 * @action: the irq action chain
20 * @status: status information 21 * @status: status information
22 * @core_internal_state__do_not_mess_with_it: core internal status information
21 * @depth: disable-depth, for nested irq_disable() calls 23 * @depth: disable-depth, for nested irq_disable() calls
22 * @wake_depth: enable depth, for multiple set_irq_wake() callers 24 * @wake_depth: enable depth, for multiple set_irq_wake() callers
23 * @irq_count: stats field to detect stalled irqs 25 * @irq_count: stats field to detect stalled irqs
24 * @last_unhandled: aging timer for unhandled count 26 * @last_unhandled: aging timer for unhandled count
25 * @irqs_unhandled: stats field for spurious unhandled interrupts 27 * @irqs_unhandled: stats field for spurious unhandled interrupts
26 * @lock: locking for SMP 28 * @lock: locking for SMP
29 * @affinity_notify: context for notification of affinity changes
27 * @pending_mask: pending rebalanced interrupts 30 * @pending_mask: pending rebalanced interrupts
31 * @threads_oneshot: bitfield to handle shared oneshot threads
28 * @threads_active: number of irqaction threads currently running 32 * @threads_active: number of irqaction threads currently running
29 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 33 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
30 * @dir: /proc/irq/ procfs entry 34 * @dir: /proc/irq/ procfs entry
@@ -45,6 +49,7 @@ struct irq_desc {
45 struct { 49 struct {
46 unsigned int irq; 50 unsigned int irq;
47 unsigned int node; 51 unsigned int node;
52 unsigned int pad_do_not_even_think_about_it;
48 struct irq_chip *chip; 53 struct irq_chip *chip;
49 void *handler_data; 54 void *handler_data;
50 void *chip_data; 55 void *chip_data;
@@ -59,9 +64,16 @@ struct irq_desc {
59 struct timer_rand_state *timer_rand_state; 64 struct timer_rand_state *timer_rand_state;
60 unsigned int __percpu *kstat_irqs; 65 unsigned int __percpu *kstat_irqs;
61 irq_flow_handler_t handle_irq; 66 irq_flow_handler_t handle_irq;
67#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
68 irq_preflow_handler_t preflow_handler;
69#endif
62 struct irqaction *action; /* IRQ action list */ 70 struct irqaction *action; /* IRQ action list */
71#ifdef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
72 unsigned int status_use_accessors;
73#else
63 unsigned int status; /* IRQ status */ 74 unsigned int status; /* IRQ status */
64 75#endif
76 unsigned int core_internal_state__do_not_mess_with_it;
65 unsigned int depth; /* nested irq disables */ 77 unsigned int depth; /* nested irq disables */
66 unsigned int wake_depth; /* nested wake enables */ 78 unsigned int wake_depth; /* nested wake enables */
67 unsigned int irq_count; /* For detecting broken IRQs */ 79 unsigned int irq_count; /* For detecting broken IRQs */
@@ -70,10 +82,12 @@ struct irq_desc {
70 raw_spinlock_t lock; 82 raw_spinlock_t lock;
71#ifdef CONFIG_SMP 83#ifdef CONFIG_SMP
72 const struct cpumask *affinity_hint; 84 const struct cpumask *affinity_hint;
85 struct irq_affinity_notify *affinity_notify;
73#ifdef CONFIG_GENERIC_PENDING_IRQ 86#ifdef CONFIG_GENERIC_PENDING_IRQ
74 cpumask_var_t pending_mask; 87 cpumask_var_t pending_mask;
75#endif 88#endif
76#endif 89#endif
90 unsigned long threads_oneshot;
77 atomic_t threads_active; 91 atomic_t threads_active;
78 wait_queue_head_t wait_for_threads; 92 wait_queue_head_t wait_for_threads;
79#ifdef CONFIG_PROC_FS 93#ifdef CONFIG_PROC_FS
@@ -86,19 +100,53 @@ struct irq_desc {
86extern struct irq_desc irq_desc[NR_IRQS]; 100extern struct irq_desc irq_desc[NR_IRQS];
87#endif 101#endif
88 102
89/* Will be removed once the last users in power and sh are gone */ 103#ifdef CONFIG_GENERIC_HARDIRQS
90extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node); 104
91static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node) 105static inline struct irq_data *irq_desc_get_irq_data(struct irq_desc *desc)
92{ 106{
93 return desc; 107 return &desc->irq_data;
94} 108}
95 109
96#ifdef CONFIG_GENERIC_HARDIRQS 110static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc)
111{
112 return desc->irq_data.chip;
113}
114
115static inline void *irq_desc_get_chip_data(struct irq_desc *desc)
116{
117 return desc->irq_data.chip_data;
118}
119
120static inline void *irq_desc_get_handler_data(struct irq_desc *desc)
121{
122 return desc->irq_data.handler_data;
123}
97 124
98#define get_irq_desc_chip(desc) ((desc)->irq_data.chip) 125static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
99#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data) 126{
100#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data) 127 return desc->irq_data.msi_desc;
101#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) 128}
129
130#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
131static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc)
132{
133 return irq_desc_get_chip(desc);
134}
135static inline void *get_irq_desc_data(struct irq_desc *desc)
136{
137 return irq_desc_get_handler_data(desc);
138}
139
140static inline void *get_irq_desc_chip_data(struct irq_desc *desc)
141{
142 return irq_desc_get_chip_data(desc);
143}
144
145static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc)
146{
147 return irq_desc_get_msi_desc(desc);
148}
149#endif
102 150
103/* 151/*
104 * Architectures call this to let the generic IRQ layer 152 * Architectures call this to let the generic IRQ layer
@@ -123,23 +171,64 @@ static inline int irq_has_action(unsigned int irq)
123 return desc->action != NULL; 171 return desc->action != NULL;
124} 172}
125 173
126static inline int irq_balancing_disabled(unsigned int irq) 174/* caller has locked the irq_desc and both params are valid */
175static inline void __irq_set_handler_locked(unsigned int irq,
176 irq_flow_handler_t handler)
127{ 177{
128 struct irq_desc *desc; 178 struct irq_desc *desc;
129 179
130 desc = irq_to_desc(irq); 180 desc = irq_to_desc(irq);
131 return desc->status & IRQ_NO_BALANCING_MASK; 181 desc->handle_irq = handler;
132} 182}
133 183
134/* caller has locked the irq_desc and both params are valid */ 184/* caller has locked the irq_desc and both params are valid */
185static inline void
186__irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip,
187 irq_flow_handler_t handler, const char *name)
188{
189 struct irq_desc *desc;
190
191 desc = irq_to_desc(irq);
192 irq_desc_get_irq_data(desc)->chip = chip;
193 desc->handle_irq = handler;
194 desc->name = name;
195}
196
197#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
135static inline void __set_irq_handler_unlocked(int irq, 198static inline void __set_irq_handler_unlocked(int irq,
136 irq_flow_handler_t handler) 199 irq_flow_handler_t handler)
137{ 200{
201 __irq_set_handler_locked(irq, handler);
202}
203
204static inline int irq_balancing_disabled(unsigned int irq)
205{
138 struct irq_desc *desc; 206 struct irq_desc *desc;
139 207
140 desc = irq_to_desc(irq); 208 desc = irq_to_desc(irq);
141 desc->handle_irq = handler; 209 return desc->status & IRQ_NO_BALANCING_MASK;
210}
211#endif
212
213static inline void
214irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
215{
216 struct irq_desc *desc = irq_to_desc(irq);
217
218 if (desc)
219 lockdep_set_class(&desc->lock, class);
142} 220}
221
222#ifdef CONFIG_IRQ_PREFLOW_FASTEOI
223static inline void
224__irq_set_preflow_handler(unsigned int irq, irq_preflow_handler_t handler)
225{
226 struct irq_desc *desc;
227
228 desc = irq_to_desc(irq);
229 desc->preflow_handler = handler;
230}
231#endif
143#endif 232#endif
144 233
145#endif 234#endif
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 27e79c27ba08..a32dcaec04e1 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -432,13 +432,35 @@ struct jbd2_journal_handle
432 int h_err; 432 int h_err;
433 433
434 /* Flags [no locking] */ 434 /* Flags [no locking] */
435 unsigned int h_sync: 1; /* sync-on-close */ 435 unsigned int h_sync:1; /* sync-on-close */
436 unsigned int h_jdata: 1; /* force data journaling */ 436 unsigned int h_jdata:1; /* force data journaling */
437 unsigned int h_aborted: 1; /* fatal error on handle */ 437 unsigned int h_aborted:1; /* fatal error on handle */
438 unsigned int h_cowing:1; /* COWing block to snapshot */
439
440 /* Number of buffers requested by user:
441 * (before adding the COW credits factor) */
442 unsigned int h_base_credits:14;
443
444 /* Number of buffers the user is allowed to dirty:
445 * (counts only buffers dirtied when !h_cowing) */
446 unsigned int h_user_credits:14;
447
438 448
439#ifdef CONFIG_DEBUG_LOCK_ALLOC 449#ifdef CONFIG_DEBUG_LOCK_ALLOC
440 struct lockdep_map h_lockdep_map; 450 struct lockdep_map h_lockdep_map;
441#endif 451#endif
452
453#ifdef CONFIG_JBD2_DEBUG
454 /* COW debugging counters: */
455 unsigned int h_cow_moved; /* blocks moved to snapshot */
456 unsigned int h_cow_copied; /* blocks copied to snapshot */
457 unsigned int h_cow_ok_jh; /* blocks already COWed during current
458 transaction */
459 unsigned int h_cow_ok_bitmap; /* blocks not set in COW bitmap */
460 unsigned int h_cow_ok_mapped;/* blocks already mapped in snapshot */
461 unsigned int h_cow_bitmaps; /* COW bitmaps created */
462 unsigned int h_cow_excluded; /* blocks set in exclude bitmap */
463#endif
442}; 464};
443 465
444 466
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 6811f4bfc6e7..922aa313c9f9 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -307,6 +307,7 @@ extern clock_t jiffies_to_clock_t(long x);
307extern unsigned long clock_t_to_jiffies(unsigned long x); 307extern unsigned long clock_t_to_jiffies(unsigned long x);
308extern u64 jiffies_64_to_clock_t(u64 x); 308extern u64 jiffies_64_to_clock_t(u64 x);
309extern u64 nsec_to_clock_t(u64 x); 309extern u64 nsec_to_clock_t(u64 x);
310extern u64 nsecs_to_jiffies64(u64 n);
310extern unsigned long nsecs_to_jiffies(u64 n); 311extern unsigned long nsecs_to_jiffies(u64 n);
311 312
312#define TIMESTAMP_SIZE 30 313#define TIMESTAMP_SIZE 30
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index 525aac3c97df..44e95d0a721f 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -41,6 +41,13 @@ struct journal_head {
41 unsigned b_modified; 41 unsigned b_modified;
42 42
43 /* 43 /*
44 * This feild tracks the last transaction id in which this buffer
45 * has been cowed
46 * [jbd_lock_bh_state()]
47 */
48 unsigned b_cow_tid;
49
50 /*
44 * Copy of the buffer data frozen for writing to the log. 51 * Copy of the buffer data frozen for writing to the log.
45 * [jbd_lock_bh_state()] 52 * [jbd_lock_bh_state()]
46 */ 53 */
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index d8e9b3d1c23c..0df513b7a9f8 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -36,6 +36,7 @@ const char *kallsyms_lookup(unsigned long addr,
36 36
37/* Look up a kernel symbol and return it in a text buffer. */ 37/* Look up a kernel symbol and return it in a text buffer. */
38extern int sprint_symbol(char *buffer, unsigned long address); 38extern int sprint_symbol(char *buffer, unsigned long address);
39extern int sprint_backtrace(char *buffer, unsigned long address);
39 40
40/* Look up a kernel symbol and print it to the kernel messages. */ 41/* Look up a kernel symbol and print it to the kernel messages. */
41extern void __print_symbol(const char *fmt, unsigned long address); 42extern void __print_symbol(const char *fmt, unsigned long address);
@@ -79,6 +80,12 @@ static inline int sprint_symbol(char *buffer, unsigned long addr)
79 return 0; 80 return 0;
80} 81}
81 82
83static inline int sprint_backtrace(char *buffer, unsigned long addr)
84{
85 *buffer = '\0';
86 return 0;
87}
88
82static inline int lookup_symbol_name(unsigned long addr, char *symname) 89static inline int lookup_symbol_name(unsigned long addr, char *symname)
83{ 90{
84 return -ERANGE; 91 return -ERANGE;
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index 506ad20c18f8..ec2d17bc1f1e 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -50,11 +50,12 @@ struct kbd_struct {
50#define VC_CAPSLOCK 2 /* capslock mode */ 50#define VC_CAPSLOCK 2 /* capslock mode */
51#define VC_KANALOCK 3 /* kanalock mode */ 51#define VC_KANALOCK 3 /* kanalock mode */
52 52
53 unsigned char kbdmode:2; /* one 2-bit value */ 53 unsigned char kbdmode:3; /* one 3-bit value */
54#define VC_XLATE 0 /* translate keycodes using keymap */ 54#define VC_XLATE 0 /* translate keycodes using keymap */
55#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ 55#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */
56#define VC_RAW 2 /* raw (scancode) mode */ 56#define VC_RAW 2 /* raw (scancode) mode */
57#define VC_UNICODE 3 /* Unicode mode */ 57#define VC_UNICODE 3 /* Unicode mode */
58#define VC_OFF 4 /* disabled mode */
58 59
59 unsigned char modeflags:5; 60 unsigned char modeflags:5;
60#define VC_APPLIC 0 /* application key mode */ 61#define VC_APPLIC 0 /* application key mode */
@@ -158,7 +159,7 @@ static inline void con_schedule_flip(struct tty_struct *t)
158 if (t->buf.tail != NULL) 159 if (t->buf.tail != NULL)
159 t->buf.tail->commit = t->buf.tail->used; 160 t->buf.tail->commit = t->buf.tail->used;
160 spin_unlock_irqrestore(&t->buf.lock, flags); 161 spin_unlock_irqrestore(&t->buf.lock, flags);
161 schedule_delayed_work(&t->buf.work, 0); 162 schedule_work(&t->buf.work);
162} 163}
163 164
164#endif 165#endif
diff --git a/include/linux/kd.h b/include/linux/kd.h
index 15f2853ea58f..c36d8476db55 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -81,6 +81,7 @@ struct unimapinit {
81#define K_XLATE 0x01 81#define K_XLATE 0x01
82#define K_MEDIUMRAW 0x02 82#define K_MEDIUMRAW 0x02
83#define K_UNICODE 0x03 83#define K_UNICODE 0x03
84#define K_OFF 0x04
84#define KDGKBMODE 0x4B44 /* gets current keyboard mode */ 85#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
85#define KDSKBMODE 0x4B45 /* sets current keyboard mode */ 86#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
86 87
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2fe6e84894a4..00cec4dc0ae2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -187,14 +187,76 @@ NORET_TYPE void do_exit(long error_code)
187 ATTRIB_NORET; 187 ATTRIB_NORET;
188NORET_TYPE void complete_and_exit(struct completion *, long) 188NORET_TYPE void complete_and_exit(struct completion *, long)
189 ATTRIB_NORET; 189 ATTRIB_NORET;
190
191/* Internal, do not use. */
192int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
193int __must_check _kstrtol(const char *s, unsigned int base, long *res);
194
195int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
196int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
197static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
198{
199 /*
200 * We want to shortcut function call, but
201 * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
202 */
203 if (sizeof(unsigned long) == sizeof(unsigned long long) &&
204 __alignof__(unsigned long) == __alignof__(unsigned long long))
205 return kstrtoull(s, base, (unsigned long long *)res);
206 else
207 return _kstrtoul(s, base, res);
208}
209
210static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
211{
212 /*
213 * We want to shortcut function call, but
214 * __builtin_types_compatible_p(long, long long) = 0.
215 */
216 if (sizeof(long) == sizeof(long long) &&
217 __alignof__(long) == __alignof__(long long))
218 return kstrtoll(s, base, (long long *)res);
219 else
220 return _kstrtol(s, base, res);
221}
222
223int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
224int __must_check kstrtoint(const char *s, unsigned int base, int *res);
225
226static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
227{
228 return kstrtoull(s, base, res);
229}
230
231static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
232{
233 return kstrtoll(s, base, res);
234}
235
236static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
237{
238 return kstrtouint(s, base, res);
239}
240
241static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
242{
243 return kstrtoint(s, base, res);
244}
245
246int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
247int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
248int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
249int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
250
190extern unsigned long simple_strtoul(const char *,char **,unsigned int); 251extern unsigned long simple_strtoul(const char *,char **,unsigned int);
191extern long simple_strtol(const char *,char **,unsigned int); 252extern long simple_strtol(const char *,char **,unsigned int);
192extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 253extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
193extern long long simple_strtoll(const char *,char **,unsigned int); 254extern long long simple_strtoll(const char *,char **,unsigned int);
194extern int __must_check strict_strtoul(const char *, unsigned int, unsigned long *); 255#define strict_strtoul kstrtoul
195extern int __must_check strict_strtol(const char *, unsigned int, long *); 256#define strict_strtol kstrtol
196extern int __must_check strict_strtoull(const char *, unsigned int, unsigned long long *); 257#define strict_strtoull kstrtoull
197extern int __must_check strict_strtoll(const char *, unsigned int, long long *); 258#define strict_strtoll kstrtoll
259
198extern int sprintf(char * buf, const char * fmt, ...) 260extern int sprintf(char * buf, const char * fmt, ...)
199 __attribute__ ((format (printf, 2, 3))); 261 __attribute__ ((format (printf, 2, 3)));
200extern int vsprintf(char *buf, const char *, va_list) 262extern int vsprintf(char *buf, const char *, va_list)
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index 65833d4d5998..9efd081bb31e 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -41,6 +41,9 @@ struct key_type {
41 */ 41 */
42 size_t def_datalen; 42 size_t def_datalen;
43 43
44 /* vet a description */
45 int (*vet_description)(const char *description);
46
44 /* instantiate a key of this type 47 /* instantiate a key of this type
45 * - this method should call key_payload_reserve() to determine if the 48 * - this method should call key_payload_reserve() to determine if the
46 * user's quota will hold the payload 49 * user's quota will hold the payload
@@ -102,11 +105,20 @@ extern int key_instantiate_and_link(struct key *key,
102 size_t datalen, 105 size_t datalen,
103 struct key *keyring, 106 struct key *keyring,
104 struct key *instkey); 107 struct key *instkey);
105extern int key_negate_and_link(struct key *key, 108extern int key_reject_and_link(struct key *key,
106 unsigned timeout, 109 unsigned timeout,
110 unsigned error,
107 struct key *keyring, 111 struct key *keyring,
108 struct key *instkey); 112 struct key *instkey);
109extern void complete_request_key(struct key_construction *cons, int error); 113extern void complete_request_key(struct key_construction *cons, int error);
110 114
115static inline int key_negate_and_link(struct key *key,
116 unsigned timeout,
117 struct key *keyring,
118 struct key *instkey)
119{
120 return key_reject_and_link(key, timeout, ENOKEY, keyring, instkey);
121}
122
111#endif /* CONFIG_KEYS */ 123#endif /* CONFIG_KEYS */
112#endif /* _LINUX_KEY_TYPE_H */ 124#endif /* _LINUX_KEY_TYPE_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 3db0adce1fda..b2bb01719561 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -170,6 +170,7 @@ struct key {
170 struct list_head link; 170 struct list_head link;
171 unsigned long x[2]; 171 unsigned long x[2];
172 void *p[2]; 172 void *p[2];
173 int reject_error;
173 } type_data; 174 } type_data;
174 175
175 /* key data 176 /* key data
@@ -275,6 +276,10 @@ static inline key_serial_t key_serial(struct key *key)
275 return key ? key->serial : 0; 276 return key ? key->serial : 0;
276} 277}
277 278
279#define rcu_dereference_key(KEY) \
280 (rcu_dereference_protected((KEY)->payload.rcudata, \
281 rwsem_is_locked(&((struct key *)(KEY))->sem)))
282
278#ifdef CONFIG_SYSCTL 283#ifdef CONFIG_SYSCTL
279extern ctl_table key_sysctls[]; 284extern ctl_table key_sysctls[];
280#endif 285#endif
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index bd383f1944fb..9b0b865ce622 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -53,5 +53,7 @@
53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */ 53#define KEYCTL_ASSUME_AUTHORITY 16 /* assume request_key() authorisation */
54#define KEYCTL_GET_SECURITY 17 /* get key security label */ 54#define KEYCTL_GET_SECURITY 17 /* get key security label */
55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */ 55#define KEYCTL_SESSION_TO_PARENT 18 /* apply session keyring to parent process */
56#define KEYCTL_REJECT 19 /* reject a partially constructed key */
57#define KEYCTL_INSTANTIATE_IOV 20 /* instantiate a partially constructed key */
56 58
57#endif /* _LINUX_KEYCTL_H */ 59#endif /* _LINUX_KEYCTL_H */
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 092e4250a458..10ca03d0a250 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -297,6 +297,7 @@ extern int
297kgdb_handle_exception(int ex_vector, int signo, int err_code, 297kgdb_handle_exception(int ex_vector, int signo, int err_code,
298 struct pt_regs *regs); 298 struct pt_regs *regs);
299extern int kgdb_nmicallback(int cpu, void *regs); 299extern int kgdb_nmicallback(int cpu, void *regs);
300extern void gdbstub_exit(int status);
300 301
301extern int kgdb_single_step; 302extern int kgdb_single_step;
302extern atomic_t kgdb_active; 303extern atomic_t kgdb_active;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 8f6d12151048..9229b64ee3aa 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -85,11 +85,13 @@ static inline const char *kobject_name(const struct kobject *kobj)
85extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); 85extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
86extern int __must_check kobject_add(struct kobject *kobj, 86extern int __must_check kobject_add(struct kobject *kobj,
87 struct kobject *parent, 87 struct kobject *parent,
88 const char *fmt, ...); 88 const char *fmt, ...)
89 __attribute__((format(printf, 3, 4)));
89extern int __must_check kobject_init_and_add(struct kobject *kobj, 90extern int __must_check kobject_init_and_add(struct kobject *kobj,
90 struct kobj_type *ktype, 91 struct kobj_type *ktype,
91 struct kobject *parent, 92 struct kobject *parent,
92 const char *fmt, ...); 93 const char *fmt, ...)
94 __attribute__((format(printf, 4, 5)));
93 95
94extern void kobject_del(struct kobject *kobj); 96extern void kobject_del(struct kobject *kobj);
95 97
@@ -224,8 +226,8 @@ static inline int kobject_uevent_env(struct kobject *kobj,
224 char *envp[]) 226 char *envp[])
225{ return 0; } 227{ return 0; }
226 228
227static inline int add_uevent_var(struct kobj_uevent_env *env, 229static inline __attribute__((format(printf, 2, 3)))
228 const char *format, ...) 230int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
229{ return 0; } 231{ return 0; }
230 232
231static inline int kobject_action_type(const char *buf, size_t count, 233static inline int kobject_action_type(const char *buf, size_t count,
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index ce0775aa64c3..1e923e5e88e8 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -4,10 +4,15 @@
4#include <linux/err.h> 4#include <linux/err.h>
5#include <linux/sched.h> 5#include <linux/sched.h>
6 6
7struct task_struct *kthread_create(int (*threadfn)(void *data), 7struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
8 void *data, 8 void *data,
9 const char namefmt[], ...) 9 int node,
10 __attribute__((format(printf, 3, 4))); 10 const char namefmt[], ...)
11 __attribute__((format(printf, 4, 5)));
12
13#define kthread_create(threadfn, data, namefmt, arg...) \
14 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg)
15
11 16
12/** 17/**
13 * kthread_run - create and wake a thread. 18 * kthread_run - create and wake a thread.
@@ -34,6 +39,7 @@ void *kthread_data(struct task_struct *k);
34 39
35int kthreadd(void *unused); 40int kthreadd(void *unused);
36extern struct task_struct *kthreadd_task; 41extern struct task_struct *kthreadd_task;
42extern int tsk_fork_get_node(struct task_struct *tsk);
37 43
38/* 44/*
39 * Simple work processor based on kthread. 45 * Simple work processor based on kthread.
@@ -64,7 +70,7 @@ struct kthread_work {
64}; 70};
65 71
66#define KTHREAD_WORKER_INIT(worker) { \ 72#define KTHREAD_WORKER_INIT(worker) { \
67 .lock = SPIN_LOCK_UNLOCKED, \ 73 .lock = __SPIN_LOCK_UNLOCKED((worker).lock), \
68 .work_list = LIST_HEAD_INIT((worker).work_list), \ 74 .work_list = LIST_HEAD_INIT((worker).work_list), \
69 } 75 }
70 76
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b5021db21858..ab428552af8e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -43,6 +43,7 @@
43#define KVM_REQ_DEACTIVATE_FPU 10 43#define KVM_REQ_DEACTIVATE_FPU 10
44#define KVM_REQ_EVENT 11 44#define KVM_REQ_EVENT 11
45#define KVM_REQ_APF_HALT 12 45#define KVM_REQ_APF_HALT 12
46#define KVM_REQ_NMI 13
46 47
47#define KVM_USERSPACE_IRQ_SOURCE_ID 0 48#define KVM_USERSPACE_IRQ_SOURCE_ID 0
48 49
@@ -98,23 +99,31 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn,
98int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 99int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
99#endif 100#endif
100 101
102enum {
103 OUTSIDE_GUEST_MODE,
104 IN_GUEST_MODE,
105 EXITING_GUEST_MODE
106};
107
101struct kvm_vcpu { 108struct kvm_vcpu {
102 struct kvm *kvm; 109 struct kvm *kvm;
103#ifdef CONFIG_PREEMPT_NOTIFIERS 110#ifdef CONFIG_PREEMPT_NOTIFIERS
104 struct preempt_notifier preempt_notifier; 111 struct preempt_notifier preempt_notifier;
105#endif 112#endif
113 int cpu;
106 int vcpu_id; 114 int vcpu_id;
107 struct mutex mutex; 115 int srcu_idx;
108 int cpu; 116 int mode;
109 atomic_t guest_mode;
110 struct kvm_run *run;
111 unsigned long requests; 117 unsigned long requests;
112 unsigned long guest_debug; 118 unsigned long guest_debug;
113 int srcu_idx; 119
120 struct mutex mutex;
121 struct kvm_run *run;
114 122
115 int fpu_active; 123 int fpu_active;
116 int guest_fpu_loaded, guest_xcr0_loaded; 124 int guest_fpu_loaded, guest_xcr0_loaded;
117 wait_queue_head_t wq; 125 wait_queue_head_t wq;
126 struct pid *pid;
118 int sigset_active; 127 int sigset_active;
119 sigset_t sigset; 128 sigset_t sigset;
120 struct kvm_vcpu_stat stat; 129 struct kvm_vcpu_stat stat;
@@ -140,6 +149,11 @@ struct kvm_vcpu {
140 struct kvm_vcpu_arch arch; 149 struct kvm_vcpu_arch arch;
141}; 150};
142 151
152static inline int kvm_vcpu_exiting_guest_mode(struct kvm_vcpu *vcpu)
153{
154 return cmpxchg(&vcpu->mode, IN_GUEST_MODE, EXITING_GUEST_MODE);
155}
156
143/* 157/*
144 * Some of the bitops functions do not support too long bitmaps. 158 * Some of the bitops functions do not support too long bitmaps.
145 * This number must be determined not to exceed such limits. 159 * This number must be determined not to exceed such limits.
@@ -212,7 +226,6 @@ struct kvm_memslots {
212 226
213struct kvm { 227struct kvm {
214 spinlock_t mmu_lock; 228 spinlock_t mmu_lock;
215 raw_spinlock_t requests_lock;
216 struct mutex slots_lock; 229 struct mutex slots_lock;
217 struct mm_struct *mm; /* userspace tied to this vm */ 230 struct mm_struct *mm; /* userspace tied to this vm */
218 struct kvm_memslots *memslots; 231 struct kvm_memslots *memslots;
@@ -223,6 +236,7 @@ struct kvm {
223#endif 236#endif
224 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; 237 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
225 atomic_t online_vcpus; 238 atomic_t online_vcpus;
239 int last_boosted_vcpu;
226 struct list_head vm_list; 240 struct list_head vm_list;
227 struct mutex lock; 241 struct mutex lock;
228 struct kvm_io_bus *buses[KVM_NR_BUSES]; 242 struct kvm_io_bus *buses[KVM_NR_BUSES];
@@ -719,11 +733,6 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
719 set_bit(req, &vcpu->requests); 733 set_bit(req, &vcpu->requests);
720} 734}
721 735
722static inline bool kvm_make_check_request(int req, struct kvm_vcpu *vcpu)
723{
724 return test_and_set_bit(req, &vcpu->requests);
725}
726
727static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu) 736static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
728{ 737{
729 if (test_bit(req, &vcpu->requests)) { 738 if (test_bit(req, &vcpu->requests)) {
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h
new file mode 100644
index 000000000000..bb69d20da0dc
--- /dev/null
+++ b/include/linux/led-lm3530.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA.
3 * Copyright (C) 2009 Motorola, Inc.
4 *
5 * License Terms: GNU General Public License v2
6 *
7 * Simple driver for National Semiconductor LM35330 Backlight driver chip
8 *
9 * Author: Shreshtha Kumar SAHU <shreshthakumar.sahu@stericsson.com>
10 * based on leds-lm3530.c by Dan Murphy <D.Murphy@motorola.com>
11 */
12
13#ifndef _LINUX_LED_LM3530_H__
14#define _LINUX_LED_LM3530_H__
15
16#define LM3530_FS_CURR_5mA (0) /* Full Scale Current */
17#define LM3530_FS_CURR_8mA (1)
18#define LM3530_FS_CURR_12mA (2)
19#define LM3530_FS_CURR_15mA (3)
20#define LM3530_FS_CURR_19mA (4)
21#define LM3530_FS_CURR_22mA (5)
22#define LM3530_FS_CURR_26mA (6)
23#define LM3530_FS_CURR_29mA (7)
24
25#define LM3530_ALS_AVRG_TIME_32ms (0) /* ALS Averaging Time */
26#define LM3530_ALS_AVRG_TIME_64ms (1)
27#define LM3530_ALS_AVRG_TIME_128ms (2)
28#define LM3530_ALS_AVRG_TIME_256ms (3)
29#define LM3530_ALS_AVRG_TIME_512ms (4)
30#define LM3530_ALS_AVRG_TIME_1024ms (5)
31#define LM3530_ALS_AVRG_TIME_2048ms (6)
32#define LM3530_ALS_AVRG_TIME_4096ms (7)
33
34#define LM3530_RAMP_TIME_1ms (0) /* Brigtness Ramp Time */
35#define LM3530_RAMP_TIME_130ms (1) /* Max to 0 and vice versa */
36#define LM3530_RAMP_TIME_260ms (2)
37#define LM3530_RAMP_TIME_520ms (3)
38#define LM3530_RAMP_TIME_1s (4)
39#define LM3530_RAMP_TIME_2s (5)
40#define LM3530_RAMP_TIME_4s (6)
41#define LM3530_RAMP_TIME_8s (7)
42
43/* ALS Resistor Select */
44#define LM3530_ALS_IMPD_Z (0x00) /* ALS Impedence */
45#define LM3530_ALS_IMPD_13_53kOhm (0x01)
46#define LM3530_ALS_IMPD_9_01kOhm (0x02)
47#define LM3530_ALS_IMPD_5_41kOhm (0x03)
48#define LM3530_ALS_IMPD_2_27kOhm (0x04)
49#define LM3530_ALS_IMPD_1_94kOhm (0x05)
50#define LM3530_ALS_IMPD_1_81kOhm (0x06)
51#define LM3530_ALS_IMPD_1_6kOhm (0x07)
52#define LM3530_ALS_IMPD_1_138kOhm (0x08)
53#define LM3530_ALS_IMPD_1_05kOhm (0x09)
54#define LM3530_ALS_IMPD_1_011kOhm (0x0A)
55#define LM3530_ALS_IMPD_941Ohm (0x0B)
56#define LM3530_ALS_IMPD_759Ohm (0x0C)
57#define LM3530_ALS_IMPD_719Ohm (0x0D)
58#define LM3530_ALS_IMPD_700Ohm (0x0E)
59#define LM3530_ALS_IMPD_667Ohm (0x0F)
60
61enum lm3530_mode {
62 LM3530_BL_MODE_MANUAL = 0, /* "man" */
63 LM3530_BL_MODE_ALS, /* "als" */
64 LM3530_BL_MODE_PWM, /* "pwm" */
65};
66
67/* ALS input select */
68enum lm3530_als_mode {
69 LM3530_INPUT_AVRG = 0, /* ALS1 and ALS2 input average */
70 LM3530_INPUT_ALS1, /* ALS1 Input */
71 LM3530_INPUT_ALS2, /* ALS2 Input */
72 LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */
73};
74
75/**
76 * struct lm3530_platform_data
77 * @mode: mode of operation i.e. Manual, ALS or PWM
78 * @als_input_mode: select source of ALS input - ALS1/2 or average
79 * @max_current: full scale LED current
80 * @pwm_pol_hi: PWM input polarity - active high/active low
81 * @als_avrg_time: ALS input averaging time
82 * @brt_ramp_law: brightness mapping mode - exponential/linear
83 * @brt_ramp_fall: rate of fall of led current
84 * @brt_ramp_rise: rate of rise of led current
85 * @als1_resistor_sel: internal resistance from ALS1 input to ground
86 * @als2_resistor_sel: internal resistance from ALS2 input to ground
87 * @brt_val: brightness value (0-255)
88 */
89struct lm3530_platform_data {
90 enum lm3530_mode mode;
91 enum lm3530_als_mode als_input_mode;
92
93 u8 max_current;
94 bool pwm_pol_hi;
95 u8 als_avrg_time;
96
97 bool brt_ramp_law;
98 u8 brt_ramp_fall;
99 u8 brt_ramp_rise;
100
101 u8 als1_resistor_sel;
102 u8 als2_resistor_sel;
103
104 u8 brt_val;
105};
106
107#endif /* _LINUX_LED_LM3530_H__ */
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 0f19df9e37b0..61e0340a4b77 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -145,6 +145,9 @@ extern void led_trigger_register_simple(const char *name,
145extern void led_trigger_unregister_simple(struct led_trigger *trigger); 145extern void led_trigger_unregister_simple(struct led_trigger *trigger);
146extern void led_trigger_event(struct led_trigger *trigger, 146extern void led_trigger_event(struct led_trigger *trigger,
147 enum led_brightness event); 147 enum led_brightness event);
148extern void led_trigger_blink(struct led_trigger *trigger,
149 unsigned long *delay_on,
150 unsigned long *delay_off);
148 151
149#else 152#else
150 153
@@ -194,11 +197,11 @@ struct gpio_led {
194 197
195struct gpio_led_platform_data { 198struct gpio_led_platform_data {
196 int num_leds; 199 int num_leds;
197 struct gpio_led *leds; 200 const struct gpio_led *leds;
198 201
199#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */ 202#define GPIO_LED_NO_BLINK_LOW 0 /* No blink GPIO state low */
200#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */ 203#define GPIO_LED_NO_BLINK_HIGH 1 /* No blink GPIO state high */
201#define GPIO_LED_BLINK 2 /* Plase, blink */ 204#define GPIO_LED_BLINK 2 /* Please, blink */
202 int (*gpio_blink_set)(unsigned gpio, int state, 205 int (*gpio_blink_set)(unsigned gpio, int state,
203 unsigned long *delay_on, 206 unsigned long *delay_on,
204 unsigned long *delay_off); 207 unsigned long *delay_off);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c9c5d7ad1a2b..c71f46960f39 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -179,10 +179,6 @@ enum {
179 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 179 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
180 /* (doesn't imply presence) */ 180 /* (doesn't imply presence) */
181 ATA_FLAG_SATA = (1 << 1), 181 ATA_FLAG_SATA = (1 << 1),
182 ATA_FLAG_NO_LEGACY = (1 << 2), /* no legacy mode check */
183 ATA_FLAG_MMIO = (1 << 3), /* use MMIO, not PIO */
184 ATA_FLAG_SRST = (1 << 4), /* (obsolete) use ATA SRST, not E.D.D. */
185 ATA_FLAG_SATA_RESET = (1 << 5), /* (obsolete) use COMRESET */
186 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */ 182 ATA_FLAG_NO_ATAPI = (1 << 6), /* No ATAPI support */
187 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */ 183 ATA_FLAG_PIO_DMA = (1 << 7), /* PIO cmds via DMA */
188 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */ 184 ATA_FLAG_PIO_LBA48 = (1 << 8), /* Host DMA engine is LBA28 only */
@@ -198,7 +194,6 @@ enum {
198 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 194 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
199 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 195 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
200 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 196 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
201 ATA_FLAG_LPM = (1 << 20), /* driver can handle LPM */
202 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure 197 ATA_FLAG_EM = (1 << 21), /* driver supports enclosure
203 * management */ 198 * management */
204 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity 199 ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
@@ -1050,6 +1045,8 @@ extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
1050 int queue_depth, int reason); 1045 int queue_depth, int reason);
1051extern struct ata_device *ata_dev_pair(struct ata_device *adev); 1046extern struct ata_device *ata_dev_pair(struct ata_device *adev);
1052extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); 1047extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
1048extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap);
1049extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q);
1053 1050
1054extern int ata_cable_40wire(struct ata_port *ap); 1051extern int ata_cable_40wire(struct ata_port *ap);
1055extern int ata_cable_80wire(struct ata_port *ap); 1052extern int ata_cable_80wire(struct ata_port *ap);
@@ -1613,6 +1610,9 @@ extern void ata_sff_irq_on(struct ata_port *ap);
1613extern void ata_sff_irq_clear(struct ata_port *ap); 1610extern void ata_sff_irq_clear(struct ata_port *ap);
1614extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, 1611extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc,
1615 u8 status, int in_wq); 1612 u8 status, int in_wq);
1613extern void ata_sff_queue_work(struct work_struct *work);
1614extern void ata_sff_queue_delayed_work(struct delayed_work *dwork,
1615 unsigned long delay);
1616extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay); 1616extern void ata_sff_queue_pio_task(struct ata_link *link, unsigned long delay);
1617extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); 1617extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc);
1618extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); 1618extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc);
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 62730ea2b56e..1e5df2af8d84 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -23,10 +23,12 @@
23#define XENFS_SUPER_MAGIC 0xabba1974 23#define XENFS_SUPER_MAGIC 0xabba1974
24#define EXT4_SUPER_MAGIC 0xEF53 24#define EXT4_SUPER_MAGIC 0xEF53
25#define BTRFS_SUPER_MAGIC 0x9123683E 25#define BTRFS_SUPER_MAGIC 0x9123683E
26#define NILFS_SUPER_MAGIC 0x3434
26#define HPFS_SUPER_MAGIC 0xf995e849 27#define HPFS_SUPER_MAGIC 0xf995e849
27#define ISOFS_SUPER_MAGIC 0x9660 28#define ISOFS_SUPER_MAGIC 0x9660
28#define JFFS2_SUPER_MAGIC 0x72b6 29#define JFFS2_SUPER_MAGIC 0x72b6
29#define ANON_INODE_FS_MAGIC 0x09041934 30#define ANON_INODE_FS_MAGIC 0x09041934
31#define PSTOREFS_MAGIC 0x6165676C
30 32
31#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ 33#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
32#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ 34#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
diff --git a/include/linux/media.h b/include/linux/media.h
new file mode 100644
index 000000000000..0ef883327de2
--- /dev/null
+++ b/include/linux/media.h
@@ -0,0 +1,132 @@
1/*
2 * Multimedia device API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
11 * published by the Free Software Foundation.
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_MEDIA_H
24#define __LINUX_MEDIA_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/version.h>
29
30#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
31
32struct media_device_info {
33 char driver[16];
34 char model[32];
35 char serial[40];
36 char bus_info[32];
37 __u32 media_version;
38 __u32 hw_revision;
39 __u32 driver_version;
40 __u32 reserved[31];
41};
42
43#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31)
44
45#define MEDIA_ENT_TYPE_SHIFT 16
46#define MEDIA_ENT_TYPE_MASK 0x00ff0000
47#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff
48
49#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT)
50#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
51#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
52#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
53#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
54
55#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
56#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
57#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2)
58#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3)
59
60#define MEDIA_ENT_FL_DEFAULT (1 << 0)
61
62struct media_entity_desc {
63 __u32 id;
64 char name[32];
65 __u32 type;
66 __u32 revision;
67 __u32 flags;
68 __u32 group_id;
69 __u16 pads;
70 __u16 links;
71
72 __u32 reserved[4];
73
74 union {
75 /* Node specifications */
76 struct {
77 __u32 major;
78 __u32 minor;
79 } v4l;
80 struct {
81 __u32 major;
82 __u32 minor;
83 } fb;
84 struct {
85 __u32 card;
86 __u32 device;
87 __u32 subdevice;
88 } alsa;
89 int dvb;
90
91 /* Sub-device specifications */
92 /* Nothing needed yet */
93 __u8 raw[184];
94 };
95};
96
97#define MEDIA_PAD_FL_SINK (1 << 0)
98#define MEDIA_PAD_FL_SOURCE (1 << 1)
99
100struct media_pad_desc {
101 __u32 entity; /* entity ID */
102 __u16 index; /* pad index */
103 __u32 flags; /* pad flags */
104 __u32 reserved[2];
105};
106
107#define MEDIA_LNK_FL_ENABLED (1 << 0)
108#define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
109#define MEDIA_LNK_FL_DYNAMIC (1 << 2)
110
111struct media_link_desc {
112 struct media_pad_desc source;
113 struct media_pad_desc sink;
114 __u32 flags;
115 __u32 reserved[2];
116};
117
118struct media_links_enum {
119 __u32 entity;
120 /* Should have enough room for pads elements */
121 struct media_pad_desc __user *pads;
122 /* Should have enough room for links elements */
123 struct media_link_desc __user *links;
124 __u32 reserved[4];
125};
126
127#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info)
128#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc)
129#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
130#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
131
132#endif /* __LINUX_MEDIA_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index f512e189be5a..5a5ce7055839 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -62,6 +62,7 @@ extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
62 gfp_t gfp_mask); 62 gfp_t gfp_mask);
63extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru); 63extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
64extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru); 64extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
65extern void mem_cgroup_rotate_reclaimable_page(struct page *page);
65extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru); 66extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
66extern void mem_cgroup_del_lru(struct page *page); 67extern void mem_cgroup_del_lru(struct page *page);
67extern void mem_cgroup_move_lists(struct page *page, 68extern void mem_cgroup_move_lists(struct page *page,
@@ -96,7 +97,7 @@ extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
96 97
97extern int 98extern int
98mem_cgroup_prepare_migration(struct page *page, 99mem_cgroup_prepare_migration(struct page *page,
99 struct page *newpage, struct mem_cgroup **ptr); 100 struct page *newpage, struct mem_cgroup **ptr, gfp_t gfp_mask);
100extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 101extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
101 struct page *oldpage, struct page *newpage, bool migration_ok); 102 struct page *oldpage, struct page *newpage, bool migration_ok);
102 103
@@ -150,6 +151,10 @@ u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
150void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail); 151void mem_cgroup_split_huge_fixup(struct page *head, struct page *tail);
151#endif 152#endif
152 153
154#ifdef CONFIG_DEBUG_VM
155bool mem_cgroup_bad_page_check(struct page *page);
156void mem_cgroup_print_bad_page(struct page *page);
157#endif
153#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
154struct mem_cgroup; 159struct mem_cgroup;
155 160
@@ -211,6 +216,11 @@ static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
211 return ; 216 return ;
212} 217}
213 218
219static inline inline void mem_cgroup_rotate_reclaimable_page(struct page *page)
220{
221 return ;
222}
223
214static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru) 224static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
215{ 225{
216 return ; 226 return ;
@@ -249,7 +259,7 @@ static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
249 259
250static inline int 260static inline int
251mem_cgroup_prepare_migration(struct page *page, struct page *newpage, 261mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
252 struct mem_cgroup **ptr) 262 struct mem_cgroup **ptr, gfp_t gfp_mask)
253{ 263{
254 return 0; 264 return 0;
255} 265}
@@ -346,5 +356,18 @@ static inline void mem_cgroup_split_huge_fixup(struct page *head,
346 356
347#endif /* CONFIG_CGROUP_MEM_CONT */ 357#endif /* CONFIG_CGROUP_MEM_CONT */
348 358
359#if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
360static inline bool
361mem_cgroup_bad_page_check(struct page *page)
362{
363 return false;
364}
365
366static inline void
367mem_cgroup_print_bad_page(struct page *page)
368{
369}
370#endif
371
349#endif /* _LINUX_MEMCONTROL_H */ 372#endif /* _LINUX_MEMCONTROL_H */
350 373
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 06c1fa0a5c7b..e1e3b2b84f85 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -21,7 +21,8 @@
21#include <linux/mutex.h> 21#include <linux/mutex.h>
22 22
23struct memory_block { 23struct memory_block {
24 unsigned long phys_index; 24 unsigned long start_section_nr;
25 unsigned long end_section_nr;
25 unsigned long state; 26 unsigned long state;
26 int section_count; 27 int section_count;
27 28
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 4db1fbd8969e..8fba7972ff5f 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -131,9 +131,11 @@ enum {
131 PM8607_ID_LDO8, 131 PM8607_ID_LDO8,
132 PM8607_ID_LDO9, 132 PM8607_ID_LDO9,
133 PM8607_ID_LDO10, 133 PM8607_ID_LDO10,
134 PM8607_ID_LDO11,
134 PM8607_ID_LDO12, 135 PM8607_ID_LDO12,
135 PM8607_ID_LDO13, 136 PM8607_ID_LDO13,
136 PM8607_ID_LDO14, 137 PM8607_ID_LDO14,
138 PM8607_ID_LDO15,
137 139
138 PM8607_ID_RG_MAX, 140 PM8607_ID_RG_MAX,
139}; 141};
@@ -310,8 +312,6 @@ struct pm860x_chip {
310 312
311}; 313};
312 314
313#define PM8607_MAX_REGULATOR PM8607_ID_RG_MAX /* 3 Bucks, 13 LDOs */
314
315enum { 315enum {
316 GI2C_PORT = 0, 316 GI2C_PORT = 0,
317 PI2C_PORT, 317 PI2C_PORT,
@@ -351,23 +351,31 @@ struct pm860x_platform_data {
351 struct pm860x_led_pdata *led; 351 struct pm860x_led_pdata *led;
352 struct pm860x_touch_pdata *touch; 352 struct pm860x_touch_pdata *touch;
353 struct pm860x_power_pdata *power; 353 struct pm860x_power_pdata *power;
354 struct regulator_init_data *regulator;
354 355
355 unsigned short companion_addr; /* I2C address of companion chip */ 356 unsigned short companion_addr; /* I2C address of companion chip */
356 int i2c_port; /* Controlled by GI2C or PI2C */ 357 int i2c_port; /* Controlled by GI2C or PI2C */
357 int irq_mode; /* Clear interrupt by read/write(0/1) */ 358 int irq_mode; /* Clear interrupt by read/write(0/1) */
358 int irq_base; /* IRQ base number of 88pm860x */ 359 int irq_base; /* IRQ base number of 88pm860x */
359 struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; 360 int num_leds;
361 int num_backlights;
362 int num_regulators;
360}; 363};
361 364
362extern char pm860x_backlight_name[][MFD_NAME_SIZE];
363extern char pm860x_led_name[][MFD_NAME_SIZE];
364
365extern int pm860x_reg_read(struct i2c_client *, int); 365extern int pm860x_reg_read(struct i2c_client *, int);
366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); 366extern int pm860x_reg_write(struct i2c_client *, int, unsigned char);
367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); 367extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *);
368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *); 368extern int pm860x_bulk_write(struct i2c_client *, int, int, unsigned char *);
369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char, 369extern int pm860x_set_bits(struct i2c_client *, int, unsigned char,
370 unsigned char); 370 unsigned char);
371extern int pm860x_page_reg_read(struct i2c_client *, int);
372extern int pm860x_page_reg_write(struct i2c_client *, int, unsigned char);
373extern int pm860x_page_bulk_read(struct i2c_client *, int, int,
374 unsigned char *);
375extern int pm860x_page_bulk_write(struct i2c_client *, int, int,
376 unsigned char *);
377extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char,
378 unsigned char);
371 379
372extern int pm860x_device_init(struct pm860x_chip *chip, 380extern int pm860x_device_init(struct pm860x_chip *chip,
373 struct pm860x_platform_data *pdata) __devinit ; 381 struct pm860x_platform_data *pdata) __devinit ;
diff --git a/include/linux/mfd/ab8500.h b/include/linux/mfd/ab8500.h
index 37f56b7c4c15..56f8dea72152 100644
--- a/include/linux/mfd/ab8500.h
+++ b/include/linux/mfd/ab8500.h
@@ -111,8 +111,8 @@
111 * @dev: parent device 111 * @dev: parent device
112 * @lock: read/write operations lock 112 * @lock: read/write operations lock
113 * @irq_lock: genirq bus lock 113 * @irq_lock: genirq bus lock
114 * @revision: chip revision
115 * @irq: irq line 114 * @irq: irq line
115 * @chip_id: chip revision id
116 * @write: register write 116 * @write: register write
117 * @read: register read 117 * @read: register read
118 * @rx_buf: rx buf for SPI 118 * @rx_buf: rx buf for SPI
@@ -124,7 +124,7 @@ struct ab8500 {
124 struct device *dev; 124 struct device *dev;
125 struct mutex lock; 125 struct mutex lock;
126 struct mutex irq_lock; 126 struct mutex irq_lock;
127 int revision; 127
128 int irq_base; 128 int irq_base;
129 int irq; 129 int irq;
130 u8 chip_id; 130 u8 chip_id;
diff --git a/include/linux/mfd/ab8500/gpadc.h b/include/linux/mfd/ab8500/gpadc.h
new file mode 100644
index 000000000000..46b954011f16
--- /dev/null
+++ b/include/linux/mfd/ab8500/gpadc.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright (C) 2010 ST-Ericsson SA
3 * Licensed under GPLv2.
4 *
5 * Author: Arun R Murthy <arun.murthy@stericsson.com>
6 * Author: Daniel Willerud <daniel.willerud@stericsson.com>
7 */
8
9#ifndef _AB8500_GPADC_H
10#define _AB8500_GPADC_H
11
12/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */
13#define BAT_CTRL 0x01
14#define BTEMP_BALL 0x02
15#define MAIN_CHARGER_V 0x03
16#define ACC_DETECT1 0x04
17#define ACC_DETECT2 0x05
18#define ADC_AUX1 0x06
19#define ADC_AUX2 0x07
20#define MAIN_BAT_V 0x08
21#define VBUS_V 0x09
22#define MAIN_CHARGER_C 0x0A
23#define USB_CHARGER_C 0x0B
24#define BK_BAT_V 0x0C
25#define DIE_TEMP 0x0D
26
27struct ab8500_gpadc;
28
29struct ab8500_gpadc *ab8500_gpadc_get(char *name);
30int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 input);
31
32#endif /* _AB8500_GPADC_H */
diff --git a/include/linux/mfd/ab8500/sysctrl.h b/include/linux/mfd/ab8500/sysctrl.h
new file mode 100644
index 000000000000..10da0291f8f8
--- /dev/null
+++ b/include/linux/mfd/ab8500/sysctrl.h
@@ -0,0 +1,254 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> for ST Ericsson.
4 * License terms: GNU General Public License (GPL) version 2
5 */
6#ifndef __AB8500_SYSCTRL_H
7#define __AB8500_SYSCTRL_H
8
9#include <linux/bitops.h>
10
11#ifdef CONFIG_AB8500_CORE
12
13int ab8500_sysctrl_read(u16 reg, u8 *value);
14int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value);
15
16#else
17
18static inline int ab8500_sysctrl_read(u16 reg, u8 *value)
19{
20 return 0;
21}
22
23static inline int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value)
24{
25 return 0;
26}
27
28#endif /* CONFIG_AB8500_CORE */
29
30static inline int ab8500_sysctrl_set(u16 reg, u8 bits)
31{
32 return ab8500_sysctrl_write(reg, bits, bits);
33}
34
35static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)
36{
37 return ab8500_sysctrl_write(reg, bits, 0);
38}
39
40/* Registers */
41#define AB8500_TURNONSTATUS 0x100
42#define AB8500_RESETSTATUS 0x101
43#define AB8500_PONKEY1PRESSSTATUS 0x102
44#define AB8500_SYSCLKREQSTATUS 0x142
45#define AB8500_STW4500CTRL1 0x180
46#define AB8500_STW4500CTRL2 0x181
47#define AB8500_STW4500CTRL3 0x200
48#define AB8500_MAINWDOGCTRL 0x201
49#define AB8500_MAINWDOGTIMER 0x202
50#define AB8500_LOWBAT 0x203
51#define AB8500_BATTOK 0x204
52#define AB8500_SYSCLKTIMER 0x205
53#define AB8500_SMPSCLKCTRL 0x206
54#define AB8500_SMPSCLKSEL1 0x207
55#define AB8500_SMPSCLKSEL2 0x208
56#define AB8500_SMPSCLKSEL3 0x209
57#define AB8500_SYSULPCLKCONF 0x20A
58#define AB8500_SYSULPCLKCTRL1 0x20B
59#define AB8500_SYSCLKCTRL 0x20C
60#define AB8500_SYSCLKREQ1VALID 0x20D
61#define AB8500_SYSTEMCTRLSUP 0x20F
62#define AB8500_SYSCLKREQ1RFCLKBUF 0x210
63#define AB8500_SYSCLKREQ2RFCLKBUF 0x211
64#define AB8500_SYSCLKREQ3RFCLKBUF 0x212
65#define AB8500_SYSCLKREQ4RFCLKBUF 0x213
66#define AB8500_SYSCLKREQ5RFCLKBUF 0x214
67#define AB8500_SYSCLKREQ6RFCLKBUF 0x215
68#define AB8500_SYSCLKREQ7RFCLKBUF 0x216
69#define AB8500_SYSCLKREQ8RFCLKBUF 0x217
70#define AB8500_DITHERCLKCTRL 0x220
71#define AB8500_SWATCTRL 0x230
72#define AB8500_HIQCLKCTRL 0x232
73#define AB8500_VSIMSYSCLKCTRL 0x233
74
75/* Bits */
76#define AB8500_TURNONSTATUS_PORNVBAT BIT(0)
77#define AB8500_TURNONSTATUS_PONKEY1DBF BIT(1)
78#define AB8500_TURNONSTATUS_PONKEY2DBF BIT(2)
79#define AB8500_TURNONSTATUS_RTCALARM BIT(3)
80#define AB8500_TURNONSTATUS_MAINCHDET BIT(4)
81#define AB8500_TURNONSTATUS_VBUSDET BIT(5)
82#define AB8500_TURNONSTATUS_USBIDDETECT BIT(6)
83
84#define AB8500_RESETSTATUS_RESETN4500NSTATUS BIT(0)
85#define AB8500_RESETSTATUS_SWRESETN4500NSTATUS BIT(2)
86
87#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_MASK 0x7F
88#define AB8500_PONKEY1PRESSSTATUS_PONKEY1PRESSTIME_SHIFT 0
89
90#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ1STATUS BIT(0)
91#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ2STATUS BIT(1)
92#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ3STATUS BIT(2)
93#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ4STATUS BIT(3)
94#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ5STATUS BIT(4)
95#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ6STATUS BIT(5)
96#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ7STATUS BIT(6)
97#define AB8500_SYSCLKREQSTATUS_SYSCLKREQ8STATUS BIT(7)
98
99#define AB8500_STW4500CTRL1_SWOFF BIT(0)
100#define AB8500_STW4500CTRL1_SWRESET4500N BIT(1)
101#define AB8500_STW4500CTRL1_THDB8500SWOFF BIT(2)
102
103#define AB8500_STW4500CTRL2_RESETNVAUX1VALID BIT(0)
104#define AB8500_STW4500CTRL2_RESETNVAUX2VALID BIT(1)
105#define AB8500_STW4500CTRL2_RESETNVAUX3VALID BIT(2)
106#define AB8500_STW4500CTRL2_RESETNVMODVALID BIT(3)
107#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY1VALID BIT(4)
108#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY2VALID BIT(5)
109#define AB8500_STW4500CTRL2_RESETNVEXTSUPPLY3VALID BIT(6)
110#define AB8500_STW4500CTRL2_RESETNVSMPS1VALID BIT(7)
111
112#define AB8500_STW4500CTRL3_CLK32KOUT2DIS BIT(0)
113#define AB8500_STW4500CTRL3_RESETAUDN BIT(1)
114#define AB8500_STW4500CTRL3_RESETDENCN BIT(2)
115#define AB8500_STW4500CTRL3_THSDENA BIT(3)
116
117#define AB8500_MAINWDOGCTRL_MAINWDOGENA BIT(0)
118#define AB8500_MAINWDOGCTRL_MAINWDOGKICK BIT(1)
119#define AB8500_MAINWDOGCTRL_WDEXPTURNONVALID BIT(4)
120
121#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_MASK 0x7F
122#define AB8500_MAINWDOGTIMER_MAINWDOGTIMER_SHIFT 0
123
124#define AB8500_LOWBAT_LOWBATENA BIT(0)
125#define AB8500_LOWBAT_LOWBAT_MASK 0x7E
126#define AB8500_LOWBAT_LOWBAT_SHIFT 1
127
128#define AB8500_BATTOK_BATTOKSEL0THF_MASK 0x0F
129#define AB8500_BATTOK_BATTOKSEL0THF_SHIFT 0
130#define AB8500_BATTOK_BATTOKSEL1THF_MASK 0xF0
131#define AB8500_BATTOK_BATTOKSEL1THF_SHIFT 4
132
133#define AB8500_SYSCLKTIMER_SYSCLKTIMER_MASK 0x0F
134#define AB8500_SYSCLKTIMER_SYSCLKTIMER_SHIFT 0
135#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_MASK 0xF0
136#define AB8500_SYSCLKTIMER_SYSCLKTIMERADJ_SHIFT 4
137
138#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_MASK 0x03
139#define AB8500_SMPSCLKCTRL_SMPSCLKINTSEL_SHIFT 0
140#define AB8500_SMPSCLKCTRL_3M2CLKINTENA BIT(2)
141
142#define AB8500_SMPSCLKSEL1_VARMCLKSEL_MASK 0x07
143#define AB8500_SMPSCLKSEL1_VARMCLKSEL_SHIFT 0
144#define AB8500_SMPSCLKSEL1_VAPECLKSEL_MASK 0x38
145#define AB8500_SMPSCLKSEL1_VAPECLKSEL_SHIFT 3
146
147#define AB8500_SMPSCLKSEL2_VMODCLKSEL_MASK 0x07
148#define AB8500_SMPSCLKSEL2_VMODCLKSEL_SHIFT 0
149#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_MASK 0x38
150#define AB8500_SMPSCLKSEL2_VSMPS1CLKSEL_SHIFT 3
151
152#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_MASK 0x07
153#define AB8500_SMPSCLKSEL3_VSMPS2CLKSEL_SHIFT 0
154#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_MASK 0x38
155#define AB8500_SMPSCLKSEL3_VSMPS3CLKSEL_SHIFT 3
156
157#define AB8500_SYSULPCLKCONF_ULPCLKCONF_MASK 0x03
158#define AB8500_SYSULPCLKCONF_ULPCLKCONF_SHIFT 0
159#define AB8500_SYSULPCLKCONF_CLK27MHZSTRE BIT(2)
160#define AB8500_SYSULPCLKCONF_TVOUTCLKDELN BIT(3)
161#define AB8500_SYSULPCLKCONF_TVOUTCLKINV BIT(4)
162#define AB8500_SYSULPCLKCONF_ULPCLKSTRE BIT(5)
163#define AB8500_SYSULPCLKCONF_CLK27MHZBUFENA BIT(6)
164#define AB8500_SYSULPCLKCONF_CLK27MHZPDENA BIT(7)
165
166#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_MASK 0x03
167#define AB8500_SYSULPCLKCTRL1_SYSULPCLKINTSEL_SHIFT 0
168#define AB8500_SYSULPCLKCTRL1_ULPCLKREQ BIT(2)
169#define AB8500_SYSULPCLKCTRL1_4500SYSCLKREQ BIT(3)
170#define AB8500_SYSULPCLKCTRL1_AUDIOCLKENA BIT(4)
171#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF2REQ BIT(5)
172#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF3REQ BIT(6)
173#define AB8500_SYSULPCLKCTRL1_SYSCLKBUF4REQ BIT(7)
174
175#define AB8500_SYSCLKCTRL_TVOUTPLLENA BIT(0)
176#define AB8500_SYSCLKCTRL_TVOUTCLKENA BIT(1)
177#define AB8500_SYSCLKCTRL_USBCLKENA BIT(2)
178
179#define AB8500_SYSCLKREQ1VALID_SYSCLKREQ1VALID BIT(0)
180#define AB8500_SYSCLKREQ1VALID_ULPCLKREQ1VALID BIT(1)
181#define AB8500_SYSCLKREQ1VALID_USBSYSCLKREQ1VALID BIT(2)
182
183#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_MASK 0x03
184#define AB8500_SYSTEMCTRLSUP_EXTSUP12LPNCLKSEL_SHIFT 0
185#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_MASK 0x0C
186#define AB8500_SYSTEMCTRLSUP_EXTSUP3LPNCLKSEL_SHIFT 2
187#define AB8500_SYSTEMCTRLSUP_INTDB8500NOD BIT(4)
188
189#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF2 BIT(2)
190#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF3 BIT(3)
191#define AB8500_SYSCLKREQ1RFCLKBUF_SYSCLKREQ1RFCLKBUF4 BIT(4)
192
193#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF2 BIT(2)
194#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF3 BIT(3)
195#define AB8500_SYSCLKREQ2RFCLKBUF_SYSCLKREQ2RFCLKBUF4 BIT(4)
196
197#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF2 BIT(2)
198#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF3 BIT(3)
199#define AB8500_SYSCLKREQ3RFCLKBUF_SYSCLKREQ3RFCLKBUF4 BIT(4)
200
201#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF2 BIT(2)
202#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF3 BIT(3)
203#define AB8500_SYSCLKREQ4RFCLKBUF_SYSCLKREQ4RFCLKBUF4 BIT(4)
204
205#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF2 BIT(2)
206#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF3 BIT(3)
207#define AB8500_SYSCLKREQ5RFCLKBUF_SYSCLKREQ5RFCLKBUF4 BIT(4)
208
209#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF2 BIT(2)
210#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF3 BIT(3)
211#define AB8500_SYSCLKREQ6RFCLKBUF_SYSCLKREQ6RFCLKBUF4 BIT(4)
212
213#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF2 BIT(2)
214#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF3 BIT(3)
215#define AB8500_SYSCLKREQ7RFCLKBUF_SYSCLKREQ7RFCLKBUF4 BIT(4)
216
217#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF2 BIT(2)
218#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF3 BIT(3)
219#define AB8500_SYSCLKREQ8RFCLKBUF_SYSCLKREQ8RFCLKBUF4 BIT(4)
220
221#define AB8500_DITHERCLKCTRL_VARMDITHERENA BIT(0)
222#define AB8500_DITHERCLKCTRL_VSMPS3DITHERENA BIT(1)
223#define AB8500_DITHERCLKCTRL_VSMPS1DITHERENA BIT(2)
224#define AB8500_DITHERCLKCTRL_VSMPS2DITHERENA BIT(3)
225#define AB8500_DITHERCLKCTRL_VMODDITHERENA BIT(4)
226#define AB8500_DITHERCLKCTRL_VAPEDITHERENA BIT(5)
227#define AB8500_DITHERCLKCTRL_DITHERDEL_MASK 0xC0
228#define AB8500_DITHERCLKCTRL_DITHERDEL_SHIFT 6
229
230#define AB8500_SWATCTRL_UPDATERF BIT(0)
231#define AB8500_SWATCTRL_SWATENABLE BIT(1)
232#define AB8500_SWATCTRL_RFOFFTIMER_MASK 0x1C
233#define AB8500_SWATCTRL_RFOFFTIMER_SHIFT 2
234#define AB8500_SWATCTRL_SWATBIT5 BIT(6)
235
236#define AB8500_HIQCLKCTRL_SYSCLKREQ1HIQENAVALID BIT(0)
237#define AB8500_HIQCLKCTRL_SYSCLKREQ2HIQENAVALID BIT(1)
238#define AB8500_HIQCLKCTRL_SYSCLKREQ3HIQENAVALID BIT(2)
239#define AB8500_HIQCLKCTRL_SYSCLKREQ4HIQENAVALID BIT(3)
240#define AB8500_HIQCLKCTRL_SYSCLKREQ5HIQENAVALID BIT(4)
241#define AB8500_HIQCLKCTRL_SYSCLKREQ6HIQENAVALID BIT(5)
242#define AB8500_HIQCLKCTRL_SYSCLKREQ7HIQENAVALID BIT(6)
243#define AB8500_HIQCLKCTRL_SYSCLKREQ8HIQENAVALID BIT(7)
244
245#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ1VALID BIT(0)
246#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ2VALID BIT(1)
247#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ3VALID BIT(2)
248#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ4VALID BIT(3)
249#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ5VALID BIT(4)
250#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ6VALID BIT(5)
251#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ7VALID BIT(6)
252#define AB8500_VSIMSYSCLKCTRL_VSIMSYSCLKREQ8VALID BIT(7)
253
254#endif /* __AB8500_SYSCTRL_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 67bd6f7ecf32..7d9b6ae1c203 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -186,7 +186,6 @@ struct abx500_init_settings {
186struct ab3550_platform_data { 186struct ab3550_platform_data {
187 struct {unsigned int base; unsigned int count; } irq; 187 struct {unsigned int base; unsigned int count; } irq;
188 void *dev_data[AB3550_NUM_DEVICES]; 188 void *dev_data[AB3550_NUM_DEVICES];
189 size_t dev_data_sz[AB3550_NUM_DEVICES];
190 struct abx500_init_settings *init_settings; 189 struct abx500_init_settings *init_settings;
191 unsigned int init_settings_sz; 190 unsigned int init_settings_sz;
192}; 191};
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 835996e167e1..1408bf8eed5f 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -25,22 +25,20 @@ struct mfd_cell {
25 const char *name; 25 const char *name;
26 int id; 26 int id;
27 27
28 /* refcounting for multiple drivers to use a single cell */
29 atomic_t *usage_count;
28 int (*enable)(struct platform_device *dev); 30 int (*enable)(struct platform_device *dev);
29 int (*disable)(struct platform_device *dev); 31 int (*disable)(struct platform_device *dev);
32
30 int (*suspend)(struct platform_device *dev); 33 int (*suspend)(struct platform_device *dev);
31 int (*resume)(struct platform_device *dev); 34 int (*resume)(struct platform_device *dev);
32 35
33 /* driver-specific data for MFD-aware "cell" drivers */ 36 /* mfd_data can be used to pass data to client drivers */
34 void *driver_data; 37 void *mfd_data;
35
36 /* platform_data can be used to either pass data to "generic"
37 driver or as a hook to mfd_cell for the "cell" drivers */
38 void *platform_data;
39 size_t data_size;
40 38
41 /* 39 /*
42 * This resources can be specified relatively to the parent device. 40 * These resources can be specified relative to the parent device.
43 * For accessing device you should use resources from device 41 * For accessing hardware you should use resources from the platform dev
44 */ 42 */
45 int num_resources; 43 int num_resources;
46 const struct resource *resources; 44 const struct resource *resources;
@@ -55,11 +53,47 @@ struct mfd_cell {
55 bool pm_runtime_no_callbacks; 53 bool pm_runtime_no_callbacks;
56}; 54};
57 55
56/*
57 * Convenience functions for clients using shared cells. Refcounting
58 * happens automatically, with the cell's enable/disable callbacks
59 * being called only when a device is first being enabled or no other
60 * clients are making use of it.
61 */
62extern int mfd_cell_enable(struct platform_device *pdev);
63extern int mfd_cell_disable(struct platform_device *pdev);
64
65/*
66 * Given a platform device that's been created by mfd_add_devices(), fetch
67 * the mfd_cell that created it.
68 */
69static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
70{
71 return pdev->dev.platform_data;
72}
73
74/*
75 * Given a platform device that's been created by mfd_add_devices(), fetch
76 * the .mfd_data entry from the mfd_cell that created it.
77 */
78static inline void *mfd_get_data(struct platform_device *pdev)
79{
80 return mfd_get_cell(pdev)->mfd_data;
81}
82
58extern int mfd_add_devices(struct device *parent, int id, 83extern int mfd_add_devices(struct device *parent, int id,
59 const struct mfd_cell *cells, int n_devs, 84 struct mfd_cell *cells, int n_devs,
60 struct resource *mem_base, 85 struct resource *mem_base,
61 int irq_base); 86 int irq_base);
62 87
63extern void mfd_remove_devices(struct device *parent); 88extern void mfd_remove_devices(struct device *parent);
64 89
90/*
91 * For MFD drivers with clients sharing access to resources, these create
92 * multiple platform devices per cell. Contention handling must still be
93 * handled via drivers (ie, with enable/disable hooks).
94 */
95extern int mfd_shared_platform_driver_register(struct platform_driver *drv,
96 const char *cellname);
97extern void mfd_shared_platform_driver_unregister(struct platform_driver *drv);
98
65#endif 99#endif
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
new file mode 100644
index 000000000000..93a9477e075f
--- /dev/null
+++ b/include/linux/mfd/max8997-private.h
@@ -0,0 +1,347 @@
1/*
2 * max8997.h - Voltage regulator driver for the Maxim 8997
3 *
4 * Copyright (C) 2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_MAX8997_PRIV_H
23#define __LINUX_MFD_MAX8997_PRIV_H
24
25#include <linux/i2c.h>
26
27enum max8997_pmic_reg {
28 MAX8997_REG_PMIC_ID0 = 0x00,
29 MAX8997_REG_PMIC_ID1 = 0x01,
30 MAX8997_REG_INTSRC = 0x02,
31 MAX8997_REG_INT1 = 0x03,
32 MAX8997_REG_INT2 = 0x04,
33 MAX8997_REG_INT3 = 0x05,
34 MAX8997_REG_INT4 = 0x06,
35
36 MAX8997_REG_INT1MSK = 0x08,
37 MAX8997_REG_INT2MSK = 0x09,
38 MAX8997_REG_INT3MSK = 0x0a,
39 MAX8997_REG_INT4MSK = 0x0b,
40
41 MAX8997_REG_STATUS1 = 0x0d,
42 MAX8997_REG_STATUS2 = 0x0e,
43 MAX8997_REG_STATUS3 = 0x0f,
44 MAX8997_REG_STATUS4 = 0x10,
45
46 MAX8997_REG_MAINCON1 = 0x13,
47 MAX8997_REG_MAINCON2 = 0x14,
48 MAX8997_REG_BUCKRAMP = 0x15,
49
50 MAX8997_REG_BUCK1CTRL = 0x18,
51 MAX8997_REG_BUCK1DVS1 = 0x19,
52 MAX8997_REG_BUCK1DVS2 = 0x1a,
53 MAX8997_REG_BUCK1DVS3 = 0x1b,
54 MAX8997_REG_BUCK1DVS4 = 0x1c,
55 MAX8997_REG_BUCK1DVS5 = 0x1d,
56 MAX8997_REG_BUCK1DVS6 = 0x1e,
57 MAX8997_REG_BUCK1DVS7 = 0x1f,
58 MAX8997_REG_BUCK1DVS8 = 0x20,
59 MAX8997_REG_BUCK2CTRL = 0x21,
60 MAX8997_REG_BUCK2DVS1 = 0x22,
61 MAX8997_REG_BUCK2DVS2 = 0x23,
62 MAX8997_REG_BUCK2DVS3 = 0x24,
63 MAX8997_REG_BUCK2DVS4 = 0x25,
64 MAX8997_REG_BUCK2DVS5 = 0x26,
65 MAX8997_REG_BUCK2DVS6 = 0x27,
66 MAX8997_REG_BUCK2DVS7 = 0x28,
67 MAX8997_REG_BUCK2DVS8 = 0x29,
68 MAX8997_REG_BUCK3CTRL = 0x2a,
69 MAX8997_REG_BUCK3DVS = 0x2b,
70 MAX8997_REG_BUCK4CTRL = 0x2c,
71 MAX8997_REG_BUCK4DVS = 0x2d,
72 MAX8997_REG_BUCK5CTRL = 0x2e,
73 MAX8997_REG_BUCK5DVS1 = 0x2f,
74 MAX8997_REG_BUCK5DVS2 = 0x30,
75 MAX8997_REG_BUCK5DVS3 = 0x31,
76 MAX8997_REG_BUCK5DVS4 = 0x32,
77 MAX8997_REG_BUCK5DVS5 = 0x33,
78 MAX8997_REG_BUCK5DVS6 = 0x34,
79 MAX8997_REG_BUCK5DVS7 = 0x35,
80 MAX8997_REG_BUCK5DVS8 = 0x36,
81 MAX8997_REG_BUCK6CTRL = 0x37,
82 MAX8997_REG_BUCK6BPSKIPCTRL = 0x38,
83 MAX8997_REG_BUCK7CTRL = 0x39,
84 MAX8997_REG_BUCK7DVS = 0x3a,
85 MAX8997_REG_LDO1CTRL = 0x3b,
86 MAX8997_REG_LDO2CTRL = 0x3c,
87 MAX8997_REG_LDO3CTRL = 0x3d,
88 MAX8997_REG_LDO4CTRL = 0x3e,
89 MAX8997_REG_LDO5CTRL = 0x3f,
90 MAX8997_REG_LDO6CTRL = 0x40,
91 MAX8997_REG_LDO7CTRL = 0x41,
92 MAX8997_REG_LDO8CTRL = 0x42,
93 MAX8997_REG_LDO9CTRL = 0x43,
94 MAX8997_REG_LDO10CTRL = 0x44,
95 MAX8997_REG_LDO11CTRL = 0x45,
96 MAX8997_REG_LDO12CTRL = 0x46,
97 MAX8997_REG_LDO13CTRL = 0x47,
98 MAX8997_REG_LDO14CTRL = 0x48,
99 MAX8997_REG_LDO15CTRL = 0x49,
100 MAX8997_REG_LDO16CTRL = 0x4a,
101 MAX8997_REG_LDO17CTRL = 0x4b,
102 MAX8997_REG_LDO18CTRL = 0x4c,
103 MAX8997_REG_LDO21CTRL = 0x4d,
104
105 MAX8997_REG_MBCCTRL1 = 0x50,
106 MAX8997_REG_MBCCTRL2 = 0x51,
107 MAX8997_REG_MBCCTRL3 = 0x52,
108 MAX8997_REG_MBCCTRL4 = 0x53,
109 MAX8997_REG_MBCCTRL5 = 0x54,
110 MAX8997_REG_MBCCTRL6 = 0x55,
111 MAX8997_REG_OTPCGHCVS = 0x56,
112
113 MAX8997_REG_SAFEOUTCTRL = 0x5a,
114
115 MAX8997_REG_LBCNFG1 = 0x5e,
116 MAX8997_REG_LBCNFG2 = 0x5f,
117 MAX8997_REG_BBCCTRL = 0x60,
118
119 MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */
120 MAX8997_REG_FLASH2_CUR = 0x64,
121 MAX8997_REG_MOVIE_CUR = 0x65,
122 MAX8997_REG_GSMB_CUR = 0x66,
123 MAX8997_REG_BOOST_CNTL = 0x67,
124 MAX8997_REG_LEN_CNTL = 0x68,
125 MAX8997_REG_FLASH_CNTL = 0x69,
126 MAX8997_REG_WDT_CNTL = 0x6a,
127 MAX8997_REG_MAXFLASH1 = 0x6b,
128 MAX8997_REG_MAXFLASH2 = 0x6c,
129 MAX8997_REG_FLASHSTATUS = 0x6d,
130 MAX8997_REG_FLASHSTATUSMASK = 0x6e,
131
132 MAX8997_REG_GPIOCNTL1 = 0x70,
133 MAX8997_REG_GPIOCNTL2 = 0x71,
134 MAX8997_REG_GPIOCNTL3 = 0x72,
135 MAX8997_REG_GPIOCNTL4 = 0x73,
136 MAX8997_REG_GPIOCNTL5 = 0x74,
137 MAX8997_REG_GPIOCNTL6 = 0x75,
138 MAX8997_REG_GPIOCNTL7 = 0x76,
139 MAX8997_REG_GPIOCNTL8 = 0x77,
140 MAX8997_REG_GPIOCNTL9 = 0x78,
141 MAX8997_REG_GPIOCNTL10 = 0x79,
142 MAX8997_REG_GPIOCNTL11 = 0x7a,
143 MAX8997_REG_GPIOCNTL12 = 0x7b,
144
145 MAX8997_REG_LDO1CONFIG = 0x80,
146 MAX8997_REG_LDO2CONFIG = 0x81,
147 MAX8997_REG_LDO3CONFIG = 0x82,
148 MAX8997_REG_LDO4CONFIG = 0x83,
149 MAX8997_REG_LDO5CONFIG = 0x84,
150 MAX8997_REG_LDO6CONFIG = 0x85,
151 MAX8997_REG_LDO7CONFIG = 0x86,
152 MAX8997_REG_LDO8CONFIG = 0x87,
153 MAX8997_REG_LDO9CONFIG = 0x88,
154 MAX8997_REG_LDO10CONFIG = 0x89,
155 MAX8997_REG_LDO11CONFIG = 0x8a,
156 MAX8997_REG_LDO12CONFIG = 0x8b,
157 MAX8997_REG_LDO13CONFIG = 0x8c,
158 MAX8997_REG_LDO14CONFIG = 0x8d,
159 MAX8997_REG_LDO15CONFIG = 0x8e,
160 MAX8997_REG_LDO16CONFIG = 0x8f,
161 MAX8997_REG_LDO17CONFIG = 0x90,
162 MAX8997_REG_LDO18CONFIG = 0x91,
163 MAX8997_REG_LDO21CONFIG = 0x92,
164
165 MAX8997_REG_DVSOKTIMER1 = 0x97,
166 MAX8997_REG_DVSOKTIMER2 = 0x98,
167 MAX8997_REG_DVSOKTIMER4 = 0x99,
168 MAX8997_REG_DVSOKTIMER5 = 0x9a,
169
170 MAX8997_REG_PMIC_END = 0x9b,
171};
172
173enum max8997_muic_reg {
174 MAX8997_MUIC_REG_ID = 0x0,
175 MAX8997_MUIC_REG_INT1 = 0x1,
176 MAX8997_MUIC_REG_INT2 = 0x2,
177 MAX8997_MUIC_REG_INT3 = 0x3,
178 MAX8997_MUIC_REG_STATUS1 = 0x4,
179 MAX8997_MUIC_REG_STATUS2 = 0x5,
180 MAX8997_MUIC_REG_STATUS3 = 0x6,
181 MAX8997_MUIC_REG_INTMASK1 = 0x7,
182 MAX8997_MUIC_REG_INTMASK2 = 0x8,
183 MAX8997_MUIC_REG_INTMASK3 = 0x9,
184 MAX8997_MUIC_REG_CDETCTRL = 0xa,
185
186 MAX8997_MUIC_REG_CONTROL1 = 0xc,
187 MAX8997_MUIC_REG_CONTROL2 = 0xd,
188 MAX8997_MUIC_REG_CONTROL3 = 0xe,
189
190 MAX8997_MUIC_REG_END = 0xf,
191};
192
193enum max8997_haptic_reg {
194 MAX8997_HAPTIC_REG_GENERAL = 0x00,
195 MAX8997_HAPTIC_REG_CONF1 = 0x01,
196 MAX8997_HAPTIC_REG_CONF2 = 0x02,
197 MAX8997_HAPTIC_REG_DRVCONF = 0x03,
198 MAX8997_HAPTIC_REG_CYCLECONF1 = 0x04,
199 MAX8997_HAPTIC_REG_CYCLECONF2 = 0x05,
200 MAX8997_HAPTIC_REG_SIGCONF1 = 0x06,
201 MAX8997_HAPTIC_REG_SIGCONF2 = 0x07,
202 MAX8997_HAPTIC_REG_SIGCONF3 = 0x08,
203 MAX8997_HAPTIC_REG_SIGCONF4 = 0x09,
204 MAX8997_HAPTIC_REG_SIGDC1 = 0x0a,
205 MAX8997_HAPTIC_REG_SIGDC2 = 0x0b,
206 MAX8997_HAPTIC_REG_SIGPWMDC1 = 0x0c,
207 MAX8997_HAPTIC_REG_SIGPWMDC2 = 0x0d,
208 MAX8997_HAPTIC_REG_SIGPWMDC3 = 0x0e,
209 MAX8997_HAPTIC_REG_SIGPWMDC4 = 0x0f,
210 MAX8997_HAPTIC_REG_MTR_REV = 0x10,
211
212 MAX8997_HAPTIC_REG_END = 0x11,
213};
214
215/* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
216enum max8997_rtc_reg {
217 MAX8997_RTC_CTRLMASK = 0x02,
218 MAX8997_RTC_CTRL = 0x03,
219 MAX8997_RTC_UPDATE1 = 0x04,
220 MAX8997_RTC_UPDATE2 = 0x05,
221 MAX8997_RTC_WTSR_SMPL = 0x06,
222
223 MAX8997_RTC_SEC = 0x10,
224 MAX8997_RTC_MIN = 0x11,
225 MAX8997_RTC_HOUR = 0x12,
226 MAX8997_RTC_DAY_OF_WEEK = 0x13,
227 MAX8997_RTC_MONTH = 0x14,
228 MAX8997_RTC_YEAR = 0x15,
229 MAX8997_RTC_DAY_OF_MONTH = 0x16,
230 MAX8997_RTC_ALARM1_SEC = 0x17,
231 MAX8997_RTC_ALARM1_MIN = 0x18,
232 MAX8997_RTC_ALARM1_HOUR = 0x19,
233 MAX8997_RTC_ALARM1_DAY_OF_WEEK = 0x1a,
234 MAX8997_RTC_ALARM1_MONTH = 0x1b,
235 MAX8997_RTC_ALARM1_YEAR = 0x1c,
236 MAX8997_RTC_ALARM1_DAY_OF_MONTH = 0x1d,
237 MAX8997_RTC_ALARM2_SEC = 0x1e,
238 MAX8997_RTC_ALARM2_MIN = 0x1f,
239 MAX8997_RTC_ALARM2_HOUR = 0x20,
240 MAX8997_RTC_ALARM2_DAY_OF_WEEK = 0x21,
241 MAX8997_RTC_ALARM2_MONTH = 0x22,
242 MAX8997_RTC_ALARM2_YEAR = 0x23,
243 MAX8997_RTC_ALARM2_DAY_OF_MONTH = 0x24,
244};
245
246enum max8997_irq_source {
247 PMIC_INT1 = 0,
248 PMIC_INT2,
249 PMIC_INT3,
250 PMIC_INT4,
251
252 FUEL_GAUGE, /* Ignored (MAX17042 driver handles) */
253
254 MUIC_INT1,
255 MUIC_INT2,
256 MUIC_INT3,
257
258 GPIO_LOW, /* Not implemented */
259 GPIO_HI, /* Not implemented */
260
261 FLASH_STATUS, /* Not implemented */
262
263 MAX8997_IRQ_GROUP_NR,
264};
265
266enum max8997_irq {
267 MAX8997_PMICIRQ_PWRONR,
268 MAX8997_PMICIRQ_PWRONF,
269 MAX8997_PMICIRQ_PWRON1SEC,
270 MAX8997_PMICIRQ_JIGONR,
271 MAX8997_PMICIRQ_JIGONF,
272 MAX8997_PMICIRQ_LOWBAT2,
273 MAX8997_PMICIRQ_LOWBAT1,
274
275 MAX8997_PMICIRQ_JIGR,
276 MAX8997_PMICIRQ_JIGF,
277 MAX8997_PMICIRQ_MR,
278 MAX8997_PMICIRQ_DVS1OK,
279 MAX8997_PMICIRQ_DVS2OK,
280 MAX8997_PMICIRQ_DVS3OK,
281 MAX8997_PMICIRQ_DVS4OK,
282
283 MAX8997_PMICIRQ_CHGINS,
284 MAX8997_PMICIRQ_CHGRM,
285 MAX8997_PMICIRQ_DCINOVP,
286 MAX8997_PMICIRQ_TOPOFFR,
287 MAX8997_PMICIRQ_CHGRSTF,
288 MAX8997_PMICIRQ_MBCHGTMEXPD,
289
290 MAX8997_PMICIRQ_RTC60S,
291 MAX8997_PMICIRQ_RTCA1,
292 MAX8997_PMICIRQ_RTCA2,
293 MAX8997_PMICIRQ_SMPL_INT,
294 MAX8997_PMICIRQ_RTC1S,
295 MAX8997_PMICIRQ_WTSR,
296
297 MAX8997_MUICIRQ_ADCError,
298 MAX8997_MUICIRQ_ADCLow,
299 MAX8997_MUICIRQ_ADC,
300
301 MAX8997_MUICIRQ_VBVolt,
302 MAX8997_MUICIRQ_DBChg,
303 MAX8997_MUICIRQ_DCDTmr,
304 MAX8997_MUICIRQ_ChgDetRun,
305 MAX8997_MUICIRQ_ChgTyp,
306
307 MAX8997_MUICIRQ_OVP,
308
309 MAX8997_IRQ_NR,
310};
311
312#define MAX8997_REG_BUCK1DVS(x) (MAX8997_REG_BUCK1DVS1 + (x) - 1)
313#define MAX8997_REG_BUCK2DVS(x) (MAX8997_REG_BUCK2DVS1 + (x) - 1)
314#define MAX8997_REG_BUCK5DVS(x) (MAX8997_REG_BUCK5DVS1 + (x) - 1)
315
316struct max8997_dev {
317 struct device *dev;
318 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
319 struct i2c_client *rtc; /* slave addr 0x0c */
320 struct i2c_client *haptic; /* slave addr 0x90 */
321 struct i2c_client *muic; /* slave addr 0x4a */
322 struct mutex iolock;
323
324 int type;
325 struct platform_device *battery; /* battery control (not fuel gauge) */
326
327 bool wakeup;
328
329 /* For hibernation */
330 u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END +
331 MAX8997_HAPTIC_REG_END];
332};
333
334enum max8997_types {
335 TYPE_MAX8997,
336 TYPE_MAX8966,
337};
338
339extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
340extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
341 u8 *buf);
342extern int max8997_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
343extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
344 u8 *buf);
345extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
346
347#endif /* __LINUX_MFD_MAX8997_PRIV_H */
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
new file mode 100644
index 000000000000..cb671b3451bf
--- /dev/null
+++ b/include/linux/mfd/max8997.h
@@ -0,0 +1,114 @@
1/*
2 * max8997.h - Driver for the Maxim 8997/8966
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * This driver is based on max8998.h
22 *
23 * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
24 * Except Fuel Gauge, every device shares the same I2C bus and included in
25 * this mfd driver. Although the fuel gauge is included in the chip, it is
26 * excluded from the driver because a) it has a different I2C bus from
27 * others and b) it can be enabled simply by using MAX17042 driver.
28 */
29
30#ifndef __LINUX_MFD_MAX8998_H
31#define __LINUX_MFD_MAX8998_H
32
33#include <linux/regulator/consumer.h>
34
35/* MAX8997/8966 regulator IDs */
36enum max8998_regulators {
37 MAX8997_LDO1 = 0,
38 MAX8997_LDO2,
39 MAX8997_LDO3,
40 MAX8997_LDO4,
41 MAX8997_LDO5,
42 MAX8997_LDO6,
43 MAX8997_LDO7,
44 MAX8997_LDO8,
45 MAX8997_LDO9,
46 MAX8997_LDO10,
47 MAX8997_LDO11,
48 MAX8997_LDO12,
49 MAX8997_LDO13,
50 MAX8997_LDO14,
51 MAX8997_LDO15,
52 MAX8997_LDO16,
53 MAX8997_LDO17,
54 MAX8997_LDO18,
55 MAX8997_LDO21,
56 MAX8997_BUCK1,
57 MAX8997_BUCK2,
58 MAX8997_BUCK3,
59 MAX8997_BUCK4,
60 MAX8997_BUCK5,
61 MAX8997_BUCK6,
62 MAX8997_BUCK7,
63 MAX8997_EN32KHZ_AP,
64 MAX8997_EN32KHZ_CP,
65 MAX8997_ENVICHG,
66 MAX8997_ESAFEOUT1,
67 MAX8997_ESAFEOUT2,
68 MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
69 MAX8997_CHARGER, /* charger current, MBCCTRL4 */
70 MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
71
72 MAX8997_REG_MAX,
73};
74
75struct max8997_regulator_data {
76 int id;
77 struct regulator_init_data *initdata;
78};
79
80struct max8997_platform_data {
81 bool wakeup;
82 /* IRQ: Not implemented */
83 /* ---- PMIC ---- */
84 struct max8997_regulator_data *regulators;
85 int num_regulators;
86
87 /*
88 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
89 * With buckx_gpiodvs enabled, the buckx cannot be controlled
90 * independently. To control buckx (of 1, 2, and 5) independently,
91 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
92 *
93 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
94 * on buckx will change the voltage of bucky at the same time.
95 *
96 */
97 bool ignore_gpiodvs_side_effect;
98 int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
99 int buck125_default_idx; /* Default value of SET1, 2, 3 */
100 unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
101 bool buck1_gpiodvs;
102 unsigned int buck2_voltage[8];
103 bool buck2_gpiodvs;
104 unsigned int buck5_voltage[8];
105 bool buck5_gpiodvs;
106
107 /* MUIC: Not implemented */
108 /* HAPTIC: Not implemented */
109 /* RTC: Not implemented */
110 /* Flash: Not implemented */
111 /* Charger control: Not implemented */
112};
113
114#endif /* __LINUX_MFD_MAX8998_H */
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index a1d391b40e68..c064beaaccb7 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -146,8 +146,7 @@ struct mc13xxx_platform_data {
146#define MC13XXX_USE_LED (1 << 5) 146#define MC13XXX_USE_LED (1 << 5)
147 unsigned int flags; 147 unsigned int flags;
148 148
149 int num_regulators; 149 struct mc13xxx_regulator_platform_data regulators;
150 struct mc13xxx_regulator_init_data *regulators;
151 struct mc13xxx_leds_platform_data *leds; 150 struct mc13xxx_leds_platform_data *leds;
152}; 151};
153 152
diff --git a/include/linux/mfd/ti_ssp.h b/include/linux/mfd/ti_ssp.h
new file mode 100644
index 000000000000..dbb4b43bd20e
--- /dev/null
+++ b/include/linux/mfd/ti_ssp.h
@@ -0,0 +1,93 @@
1/*
2 * Sequencer Serial Port (SSP) driver for Texas Instruments' SoCs
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 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 __TI_SSP_H__
22#define __TI_SSP_H__
23
24struct ti_ssp_dev_data {
25 const char *dev_name;
26 void *pdata;
27 size_t pdata_size;
28};
29
30struct ti_ssp_data {
31 unsigned long out_clock;
32 struct ti_ssp_dev_data dev_data[2];
33};
34
35struct ti_ssp_spi_data {
36 unsigned long iosel;
37 int num_cs;
38 void (*select)(int cs);
39};
40
41/*
42 * Sequencer port IO pin configuration bits. These do not correlate 1-1 with
43 * the hardware. The iosel field in the port data combines iosel1 and iosel2,
44 * and is therefore not a direct map to register space. It is best to use the
45 * macros below to construct iosel values.
46 *
47 * least significant 16 bits --> iosel1
48 * most significant 16 bits --> iosel2
49 */
50
51#define SSP_IN 0x0000
52#define SSP_DATA 0x0001
53#define SSP_CLOCK 0x0002
54#define SSP_CHIPSEL 0x0003
55#define SSP_OUT 0x0004
56#define SSP_PIN_SEL(pin, v) ((v) << ((pin) * 3))
57#define SSP_PIN_MASK(pin) SSP_PIN_SEL(pin, 0x7)
58#define SSP_INPUT_SEL(pin) ((pin) << 16)
59
60/* Sequencer port config bits */
61#define SSP_EARLY_DIN BIT(8)
62#define SSP_DELAY_DOUT BIT(9)
63
64/* Sequence map definitions */
65#define SSP_CLK_HIGH BIT(0)
66#define SSP_CLK_LOW 0
67#define SSP_DATA_HIGH BIT(1)
68#define SSP_DATA_LOW 0
69#define SSP_CS_HIGH BIT(2)
70#define SSP_CS_LOW 0
71#define SSP_OUT_MODE BIT(3)
72#define SSP_IN_MODE 0
73#define SSP_DATA_REG BIT(4)
74#define SSP_ADDR_REG 0
75
76#define SSP_OPCODE_DIRECT ((0x0) << 5)
77#define SSP_OPCODE_TOGGLE ((0x1) << 5)
78#define SSP_OPCODE_SHIFT ((0x2) << 5)
79#define SSP_OPCODE_BRANCH0 ((0x4) << 5)
80#define SSP_OPCODE_BRANCH1 ((0x5) << 5)
81#define SSP_OPCODE_BRANCH ((0x6) << 5)
82#define SSP_OPCODE_STOP ((0x7) << 5)
83#define SSP_BRANCH(addr) ((addr) << 8)
84#define SSP_COUNT(cycles) ((cycles) << 8)
85
86int ti_ssp_raw_read(struct device *dev);
87int ti_ssp_raw_write(struct device *dev, u32 val);
88int ti_ssp_load(struct device *dev, int offs, u32* prog, int len);
89int ti_ssp_run(struct device *dev, u32 pc, u32 input, u32 *output);
90int ti_ssp_set_mode(struct device *dev, int mode);
91int ti_ssp_set_iosel(struct device *dev, u32 iosel);
92
93#endif /* __TI_SSP_H__ */
diff --git a/include/linux/mfd/tps6105x.h b/include/linux/mfd/tps6105x.h
new file mode 100644
index 000000000000..386743dd931c
--- /dev/null
+++ b/include/linux/mfd/tps6105x.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (C) 2011 ST-Ericsson SA
3 * Written on behalf of Linaro for ST-Ericsson
4 *
5 * Author: Linus Walleij <linus.walleij@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9#ifndef MFD_TPS6105X_H
10#define MFD_TPS6105X_H
11
12#include <linux/i2c.h>
13#include <linux/regulator/machine.h>
14
15/*
16 * Register definitions to all subdrivers
17 */
18#define TPS6105X_REG_0 0x00
19#define TPS6105X_REG0_MODE_SHIFT 6
20#define TPS6105X_REG0_MODE_MASK (0x03<<6)
21/* These defines for both reg0 and reg1 */
22#define TPS6105X_REG0_MODE_SHUTDOWN 0x00
23#define TPS6105X_REG0_MODE_TORCH 0x01
24#define TPS6105X_REG0_MODE_TORCH_FLASH 0x02
25#define TPS6105X_REG0_MODE_VOLTAGE 0x03
26#define TPS6105X_REG0_VOLTAGE_SHIFT 4
27#define TPS6105X_REG0_VOLTAGE_MASK (3<<4)
28#define TPS6105X_REG0_VOLTAGE_450 0
29#define TPS6105X_REG0_VOLTAGE_500 1
30#define TPS6105X_REG0_VOLTAGE_525 2
31#define TPS6105X_REG0_VOLTAGE_500_2 3
32#define TPS6105X_REG0_DIMMING_SHIFT 3
33#define TPS6105X_REG0_TORCHC_SHIFT 0
34#define TPS6105X_REG0_TORCHC_MASK (7<<0)
35#define TPS6105X_REG0_TORCHC_0 0x00
36#define TPS6105X_REG0_TORCHC_50 0x01
37#define TPS6105X_REG0_TORCHC_75 0x02
38#define TPS6105X_REG0_TORCHC_100 0x03
39#define TPS6105X_REG0_TORCHC_150 0x04
40#define TPS6105X_REG0_TORCHC_200 0x05
41#define TPS6105X_REG0_TORCHC_250_400 0x06
42#define TPS6105X_REG0_TORCHC_250_500 0x07
43#define TPS6105X_REG_1 0x01
44#define TPS6105X_REG1_MODE_SHIFT 6
45#define TPS6105X_REG1_MODE_MASK (0x03<<6)
46#define TPS6105X_REG1_MODE_SHUTDOWN 0x00
47#define TPS6105X_REG1_MODE_TORCH 0x01
48#define TPS6105X_REG1_MODE_TORCH_FLASH 0x02
49#define TPS6105X_REG1_MODE_VOLTAGE 0x03
50#define TPS6105X_REG_2 0x02
51#define TPS6105X_REG_3 0x03
52
53/**
54 * enum tps6105x_mode - desired mode for the TPS6105x
55 * @TPS6105X_MODE_SHUTDOWN: this instance is inactive, not used for anything
56 * @TPS61905X_MODE_TORCH: this instance is used as a LED, usually a while
57 * LED, for example as backlight or flashlight. If this is set, the
58 * TPS6105X will register to the LED framework
59 * @TPS6105X_MODE_TORCH_FLASH: this instance is used as a flashgun, usually
60 * in a camera
61 * @TPS6105X_MODE_VOLTAGE: this instance is used as a voltage regulator and
62 * will register to the regulator framework
63 */
64enum tps6105x_mode {
65 TPS6105X_MODE_SHUTDOWN,
66 TPS6105X_MODE_TORCH,
67 TPS6105X_MODE_TORCH_FLASH,
68 TPS6105X_MODE_VOLTAGE,
69};
70
71/**
72 * struct tps6105x_platform_data - TPS61905x platform data
73 * @mode: what mode this instance shall be operated in,
74 * this is not selectable at runtime
75 * @regulator_data: initialization data for the voltage
76 * regulator if used as a voltage source
77 */
78struct tps6105x_platform_data {
79 enum tps6105x_mode mode;
80 struct regulator_init_data *regulator_data;
81};
82
83/**
84 * struct tps6105x - state holder for the TPS6105x drivers
85 * @mutex: mutex to serialize I2C accesses
86 * @i2c_client: corresponding I2C client
87 * @regulator: regulator device if used in voltage mode
88 */
89struct tps6105x {
90 struct tps6105x_platform_data *pdata;
91 struct mutex lock;
92 struct i2c_client *client;
93 struct regulator_dev *regulator;
94};
95
96extern int tps6105x_set(struct tps6105x *tps6105x, u8 reg, u8 value);
97extern int tps6105x_get(struct tps6105x *tps6105x, u8 reg, u8 *buf);
98extern int tps6105x_mask_and_set(struct tps6105x *tps6105x, u8 reg,
99 u8 bitmask, u8 bitvalues);
100
101#endif
diff --git a/include/linux/mfd/wl1273-core.h b/include/linux/mfd/wl1273-core.h
index 9787293eae5f..db2f3f454a1b 100644
--- a/include/linux/mfd/wl1273-core.h
+++ b/include/linux/mfd/wl1273-core.h
@@ -280,7 +280,9 @@ struct wl1273_core {
280 280
281 struct i2c_client *client; 281 struct i2c_client *client;
282 282
283 int (*read)(struct wl1273_core *core, u8, u16 *);
283 int (*write)(struct wl1273_core *core, u8, u16); 284 int (*write)(struct wl1273_core *core, u8, u16);
285 int (*write_data)(struct wl1273_core *core, u8 *, u16);
284 int (*set_audio)(struct wl1273_core *core, unsigned int); 286 int (*set_audio)(struct wl1273_core *core, unsigned int);
285 int (*set_volume)(struct wl1273_core *core, unsigned int); 287 int (*set_volume)(struct wl1273_core *core, unsigned int);
286}; 288};
diff --git a/include/linux/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h
index fd322aca33ba..afe4db49402d 100644
--- a/include/linux/mfd/wm831x/pdata.h
+++ b/include/linux/mfd/wm831x/pdata.h
@@ -80,7 +80,8 @@ struct wm831x_touch_pdata {
80 int isel; /** Current for pen down (uA) */ 80 int isel; /** Current for pen down (uA) */
81 int rpu; /** Pen down sensitivity resistor divider */ 81 int rpu; /** Pen down sensitivity resistor divider */
82 int pressure; /** Report pressure (boolean) */ 82 int pressure; /** Report pressure (boolean) */
83 int data_irq; /** Touch data ready IRQ */ 83 unsigned int data_irq; /** Touch data ready IRQ */
84 unsigned int pd_irq; /** Touch pendown detect IRQ */
84}; 85};
85 86
86enum wm831x_watchdog_action { 87enum wm831x_watchdog_action {
@@ -103,11 +104,17 @@ struct wm831x_watchdog_pdata {
103#define WM831X_MAX_ISINK 2 104#define WM831X_MAX_ISINK 2
104 105
105struct wm831x_pdata { 106struct wm831x_pdata {
107 /** Used to distinguish multiple WM831x chips */
108 int wm831x_num;
109
106 /** Called before subdevices are set up */ 110 /** Called before subdevices are set up */
107 int (*pre_init)(struct wm831x *wm831x); 111 int (*pre_init)(struct wm831x *wm831x);
108 /** Called after subdevices are set up */ 112 /** Called after subdevices are set up */
109 int (*post_init)(struct wm831x *wm831x); 113 int (*post_init)(struct wm831x *wm831x);
110 114
115 /** Put the /IRQ line into CMOS mode */
116 bool irq_cmos;
117
111 int irq_base; 118 int irq_base;
112 int gpio_base; 119 int gpio_base;
113 struct wm831x_backlight_pdata *backlight; 120 struct wm831x_backlight_pdata *backlight;
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 3fd36845ca45..f0b69cdae41c 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -59,7 +59,7 @@ struct wm8994 {
59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg, 59 int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
60 int bytes, void *dest); 60 int bytes, void *dest);
61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg, 61 int (*write_dev)(struct wm8994 *wm8994, unsigned short reg,
62 int bytes, void *src); 62 int bytes, const void *src);
63 63
64 void *control_data; 64 void *control_data;
65 65
@@ -71,6 +71,7 @@ struct wm8994 {
71 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; 71 u16 irq_masks_cache[WM8994_NUM_IRQ_REGS];
72 72
73 /* Used over suspend/resume */ 73 /* Used over suspend/resume */
74 bool suspended;
74 u16 ldo_regs[WM8994_NUM_LDO_REGS]; 75 u16 ldo_regs[WM8994_NUM_LDO_REGS];
75 u16 gpio_regs[WM8994_NUM_GPIO_REGS]; 76 u16 gpio_regs[WM8994_NUM_GPIO_REGS];
76 77
@@ -87,6 +88,8 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
87 unsigned short mask, unsigned short val); 88 unsigned short mask, unsigned short val);
88int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 89int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
89 int count, u16 *buf); 90 int count, u16 *buf);
91int wm8994_bulk_write(struct wm8994 *wm8994, unsigned short reg,
92 int count, const u16 *buf);
90 93
91 94
92/* Helper to save on boilerplate */ 95/* Helper to save on boilerplate */
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 9eab263658be..466b1c777aff 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -103,13 +103,21 @@ struct wm8994_pdata {
103 unsigned int lineout1fb:1; 103 unsigned int lineout1fb:1;
104 unsigned int lineout2fb:1; 104 unsigned int lineout2fb:1;
105 105
106 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ 106 /* IRQ for microphone detection if brought out directly as a
107 * signal.
108 */
109 int micdet_irq;
110
111 /* WM8994 microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
107 unsigned int micbias1_lvl:1; 112 unsigned int micbias1_lvl:1;
108 unsigned int micbias2_lvl:1; 113 unsigned int micbias2_lvl:1;
109 114
110 /* Jack detect threashold levels, see datasheet for values */ 115 /* WM8994 jack detect threashold levels, see datasheet for values */
111 unsigned int jd_scthr:2; 116 unsigned int jd_scthr:2;
112 unsigned int jd_thr:2; 117 unsigned int jd_thr:2;
118
119 /* WM8958 microphone bias configuration */
120 int micbias[2];
113}; 121};
114 122
115#endif 123#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index be072faec6f0..f3ee84284670 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -63,6 +63,8 @@
63#define WM8994_MICBIAS 0x3A 63#define WM8994_MICBIAS 0x3A
64#define WM8994_LDO_1 0x3B 64#define WM8994_LDO_1 0x3B
65#define WM8994_LDO_2 0x3C 65#define WM8994_LDO_2 0x3C
66#define WM8958_MICBIAS1 0x3D
67#define WM8958_MICBIAS2 0x3E
66#define WM8994_CHARGE_PUMP_1 0x4C 68#define WM8994_CHARGE_PUMP_1 0x4C
67#define WM8958_CHARGE_PUMP_2 0x4D 69#define WM8958_CHARGE_PUMP_2 0x4D
68#define WM8994_CLASS_W_1 0x51 70#define WM8994_CLASS_W_1 0x51
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
new file mode 100644
index 000000000000..dd8da342a991
--- /dev/null
+++ b/include/linux/micrel_phy.h
@@ -0,0 +1,16 @@
1#ifndef _MICREL_PHY_H
2#define _MICREL_PHY_H
3
4#define MICREL_PHY_ID_MASK 0x00fffff0
5
6#define PHY_ID_KSZ9021 0x00221611
7#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510
9#define PHY_ID_KS8051 0x00221550
10/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
11#define PHY_ID_KS8001 0x0022161A
12
13/* struct phy_device dev_flags definitions */
14#define MICREL_PHY_50MHZ_CLK 0x00000001
15
16#endif /* _MICREL_PHY_H */
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 049214642036..8985768e2c0d 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -39,6 +39,11 @@
39 39
40#include <asm/atomic.h> 40#include <asm/atomic.h>
41 41
42#define MAX_MSIX_P_PORT 17
43#define MAX_MSIX 64
44#define MSIX_LEGACY_SZ 4
45#define MIN_MSIX_P_PORT 5
46
42enum { 47enum {
43 MLX4_FLAG_MSI_X = 1 << 0, 48 MLX4_FLAG_MSI_X = 1 << 0,
44 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 49 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -145,8 +150,10 @@ enum {
145}; 150};
146 151
147enum mlx4_protocol { 152enum mlx4_protocol {
148 MLX4_PROTOCOL_IB, 153 MLX4_PROT_IB_IPV6 = 0,
149 MLX4_PROTOCOL_EN, 154 MLX4_PROT_ETH,
155 MLX4_PROT_IB_IPV4,
156 MLX4_PROT_FCOE
150}; 157};
151 158
152enum { 159enum {
@@ -173,6 +180,12 @@ enum mlx4_special_vlan_idx {
173 MLX4_VLAN_REGULAR 180 MLX4_VLAN_REGULAR
174}; 181};
175 182
183enum mlx4_steer_type {
184 MLX4_MC_STEER = 0,
185 MLX4_UC_STEER,
186 MLX4_NUM_STEERS
187};
188
176enum { 189enum {
177 MLX4_NUM_FEXCH = 64 * 1024, 190 MLX4_NUM_FEXCH = 64 * 1024,
178}; 191};
@@ -223,6 +236,7 @@ struct mlx4_caps {
223 int num_eqs; 236 int num_eqs;
224 int reserved_eqs; 237 int reserved_eqs;
225 int num_comp_vectors; 238 int num_comp_vectors;
239 int comp_pool;
226 int num_mpts; 240 int num_mpts;
227 int num_mtt_segs; 241 int num_mtt_segs;
228 int mtts_per_seg; 242 int mtts_per_seg;
@@ -245,6 +259,9 @@ struct mlx4_caps {
245 u16 stat_rate_support; 259 u16 stat_rate_support;
246 int udp_rss; 260 int udp_rss;
247 int loopback_support; 261 int loopback_support;
262 int vep_uc_steering;
263 int vep_mc_steering;
264 int wol;
248 u8 port_width_cap[MLX4_MAX_PORTS + 1]; 265 u8 port_width_cap[MLX4_MAX_PORTS + 1];
249 int max_gso_sz; 266 int max_gso_sz;
250 int reserved_qps_cnt[MLX4_NUM_QP_REGION]; 267 int reserved_qps_cnt[MLX4_NUM_QP_REGION];
@@ -334,6 +351,17 @@ struct mlx4_fmr {
334struct mlx4_uar { 351struct mlx4_uar {
335 unsigned long pfn; 352 unsigned long pfn;
336 int index; 353 int index;
354 struct list_head bf_list;
355 unsigned free_bf_bmap;
356 void __iomem *map;
357 void __iomem *bf_map;
358};
359
360struct mlx4_bf {
361 unsigned long offset;
362 int buf_size;
363 struct mlx4_uar *uar;
364 void __iomem *reg;
337}; 365};
338 366
339struct mlx4_cq { 367struct mlx4_cq {
@@ -415,7 +443,7 @@ struct mlx4_dev {
415 unsigned long flags; 443 unsigned long flags;
416 struct mlx4_caps caps; 444 struct mlx4_caps caps;
417 struct radix_tree_root qp_table_tree; 445 struct radix_tree_root qp_table_tree;
418 u32 rev_id; 446 u8 rev_id;
419 char board_id[MLX4_BOARD_ID_LEN]; 447 char board_id[MLX4_BOARD_ID_LEN];
420}; 448};
421 449
@@ -461,6 +489,8 @@ void mlx4_pd_free(struct mlx4_dev *dev, u32 pdn);
461 489
462int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar); 490int mlx4_uar_alloc(struct mlx4_dev *dev, struct mlx4_uar *uar);
463void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar); 491void mlx4_uar_free(struct mlx4_dev *dev, struct mlx4_uar *uar);
492int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf);
493void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf);
464 494
465int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift, 495int mlx4_mtt_init(struct mlx4_dev *dev, int npages, int page_shift,
466 struct mlx4_mtt *mtt); 496 struct mlx4_mtt *mtt);
@@ -508,9 +538,15 @@ int mlx4_multicast_attach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
508 int block_mcast_loopback, enum mlx4_protocol protocol); 538 int block_mcast_loopback, enum mlx4_protocol protocol);
509int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16], 539int mlx4_multicast_detach(struct mlx4_dev *dev, struct mlx4_qp *qp, u8 gid[16],
510 enum mlx4_protocol protocol); 540 enum mlx4_protocol protocol);
541int mlx4_multicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
542int mlx4_multicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
543int mlx4_unicast_promisc_add(struct mlx4_dev *dev, u32 qpn, u8 port);
544int mlx4_unicast_promisc_remove(struct mlx4_dev *dev, u32 qpn, u8 port);
545int mlx4_SET_MCAST_FLTR(struct mlx4_dev *dev, u8 port, u64 mac, u64 clear, u8 mode);
511 546
512int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *index); 547int mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *qpn, u8 wrap);
513void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index); 548void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int qpn);
549int mlx4_replace_mac(struct mlx4_dev *dev, u8 port, int qpn, u64 new_mac, u8 wrap);
514 550
515int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 551int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
516int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 552int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -526,5 +562,10 @@ void mlx4_fmr_unmap(struct mlx4_dev *dev, struct mlx4_fmr *fmr,
526int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr); 562int mlx4_fmr_free(struct mlx4_dev *dev, struct mlx4_fmr *fmr);
527int mlx4_SYNC_TPT(struct mlx4_dev *dev); 563int mlx4_SYNC_TPT(struct mlx4_dev *dev);
528int mlx4_test_interrupts(struct mlx4_dev *dev); 564int mlx4_test_interrupts(struct mlx4_dev *dev);
565int mlx4_assign_eq(struct mlx4_dev *dev, char* name , int* vector);
566void mlx4_release_eq(struct mlx4_dev *dev, int vec);
567
568int mlx4_wol_read(struct mlx4_dev *dev, u64 *config, int port);
569int mlx4_wol_write(struct mlx4_dev *dev, u64 config, int port);
529 570
530#endif /* MLX4_DEVICE_H */ 571#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 0eeb2a1a867c..9e9eb21056ca 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -303,6 +303,7 @@ struct mlx4_wqe_data_seg {
303 303
304enum { 304enum {
305 MLX4_INLINE_ALIGN = 64, 305 MLX4_INLINE_ALIGN = 64,
306 MLX4_INLINE_SEG = 1 << 31,
306}; 307};
307 308
308struct mlx4_wqe_inline_seg { 309struct mlx4_wqe_inline_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f6385fc17ad4..7606d7db96c9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -151,6 +151,7 @@ extern pgprot_t protection_map[16];
151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 151#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */ 152#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ 153#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
154#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
154 155
155/* 156/*
156 * This interface is used by x86 PAT code to identify a pfn mapping that is 157 * This interface is used by x86 PAT code to identify a pfn mapping that is
@@ -402,16 +403,23 @@ static inline void init_page_count(struct page *page)
402/* 403/*
403 * PageBuddy() indicate that the page is free and in the buddy system 404 * PageBuddy() indicate that the page is free and in the buddy system
404 * (see mm/page_alloc.c). 405 * (see mm/page_alloc.c).
406 *
407 * PAGE_BUDDY_MAPCOUNT_VALUE must be <= -2 but better not too close to
408 * -2 so that an underflow of the page_mapcount() won't be mistaken
409 * for a genuine PAGE_BUDDY_MAPCOUNT_VALUE. -128 can be created very
410 * efficiently by most CPU architectures.
405 */ 411 */
412#define PAGE_BUDDY_MAPCOUNT_VALUE (-128)
413
406static inline int PageBuddy(struct page *page) 414static inline int PageBuddy(struct page *page)
407{ 415{
408 return atomic_read(&page->_mapcount) == -2; 416 return atomic_read(&page->_mapcount) == PAGE_BUDDY_MAPCOUNT_VALUE;
409} 417}
410 418
411static inline void __SetPageBuddy(struct page *page) 419static inline void __SetPageBuddy(struct page *page)
412{ 420{
413 VM_BUG_ON(atomic_read(&page->_mapcount) != -1); 421 VM_BUG_ON(atomic_read(&page->_mapcount) != -1);
414 atomic_set(&page->_mapcount, -2); 422 atomic_set(&page->_mapcount, PAGE_BUDDY_MAPCOUNT_VALUE);
415} 423}
416 424
417static inline void __ClearPageBuddy(struct page *page) 425static inline void __ClearPageBuddy(struct page *page)
@@ -852,7 +860,14 @@ extern void pagefault_out_of_memory(void);
852 860
853#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 861#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
854 862
863/*
864 * Flags passed to show_mem() and __show_free_areas() to suppress output in
865 * various contexts.
866 */
867#define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */
868
855extern void show_free_areas(void); 869extern void show_free_areas(void);
870extern void __show_free_areas(unsigned int flags);
856 871
857int shmem_lock(struct file *file, int lock, struct user_struct *user); 872int shmem_lock(struct file *file, int lock, struct user_struct *user);
858struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 873struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
@@ -899,6 +914,9 @@ unsigned long unmap_vmas(struct mmu_gather **tlb,
899 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry 914 * @pgd_entry: if set, called for each non-empty PGD (top-level) entry
900 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry 915 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
901 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry 916 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
917 * this handler is required to be able to handle
918 * pmd_trans_huge() pmds. They may simply choose to
919 * split_huge_page() instead of handling it explicitly.
902 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry 920 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
903 * @pte_hole: if set, called for each hole at all levels 921 * @pte_hole: if set, called for each hole at all levels
904 * @hugetlb_entry: if set, called for each hugetlb entry 922 * @hugetlb_entry: if set, called for each hugetlb entry
@@ -964,7 +982,13 @@ static inline int handle_mm_fault(struct mm_struct *mm,
964 982
965extern int make_pages_present(unsigned long addr, unsigned long end); 983extern int make_pages_present(unsigned long addr, unsigned long end);
966extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 984extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
985extern int access_remote_vm(struct mm_struct *mm, unsigned long addr,
986 void *buf, int len, int write);
967 987
988int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
989 unsigned long start, int len, unsigned int foll_flags,
990 struct page **pages, struct vm_area_struct **vmas,
991 int *nonblocking);
968int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 992int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
969 unsigned long start, int nr_pages, int write, int force, 993 unsigned long start, int nr_pages, int write, int force,
970 struct page **pages, struct vm_area_struct **vmas); 994 struct page **pages, struct vm_area_struct **vmas);
@@ -1309,8 +1333,6 @@ int add_from_early_node_map(struct range *range, int az,
1309 int nr_range, int nid); 1333 int nr_range, int nid);
1310u64 __init find_memory_core_early(int nid, u64 size, u64 align, 1334u64 __init find_memory_core_early(int nid, u64 size, u64 align,
1311 u64 goal, u64 limit); 1335 u64 goal, u64 limit);
1312void *__alloc_memory_core_early(int nodeid, u64 size, u64 align,
1313 u64 goal, u64 limit);
1314typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1336typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
1315extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); 1337extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
1316extern void sparse_memory_present_with_active_regions(int nid); 1338extern void sparse_memory_present_with_active_regions(int nid);
@@ -1338,7 +1360,7 @@ extern void setup_per_zone_wmarks(void);
1338extern void calculate_zone_inactive_ratio(struct zone *zone); 1360extern void calculate_zone_inactive_ratio(struct zone *zone);
1339extern void mem_init(void); 1361extern void mem_init(void);
1340extern void __init mmap_init(void); 1362extern void __init mmap_init(void);
1341extern void show_mem(void); 1363extern void show_mem(unsigned int flags);
1342extern void si_meminfo(struct sysinfo * val); 1364extern void si_meminfo(struct sysinfo * val);
1343extern void si_meminfo_node(struct sysinfo *val, int nid); 1365extern void si_meminfo_node(struct sysinfo *val, int nid);
1344extern int after_bootmem; 1366extern int after_bootmem;
@@ -1528,8 +1550,11 @@ struct page *follow_page(struct vm_area_struct *, unsigned long address,
1528#define FOLL_GET 0x04 /* do get_page on page */ 1550#define FOLL_GET 0x04 /* do get_page on page */
1529#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */ 1551#define FOLL_DUMP 0x08 /* give error on hole if it would be zero */
1530#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */ 1552#define FOLL_FORCE 0x10 /* get_user_pages read/write w/o permission */
1553#define FOLL_NOWAIT 0x20 /* if a disk transfer is needed, start the IO
1554 * and return without waiting upon it */
1531#define FOLL_MLOCK 0x40 /* mark page as mlocked */ 1555#define FOLL_MLOCK 0x40 /* mark page as mlocked */
1532#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */ 1556#define FOLL_SPLIT 0x80 /* don't return transhuge pages, split them */
1557#define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */
1533 1558
1534typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, 1559typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
1535 void *data); 1560 void *data);
@@ -1568,13 +1593,13 @@ static inline bool kernel_page_present(struct page *page) { return true; }
1568#endif /* CONFIG_HIBERNATION */ 1593#endif /* CONFIG_HIBERNATION */
1569#endif 1594#endif
1570 1595
1571extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1596extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
1572#ifdef __HAVE_ARCH_GATE_AREA 1597#ifdef __HAVE_ARCH_GATE_AREA
1573int in_gate_area_no_task(unsigned long addr); 1598int in_gate_area_no_mm(unsigned long addr);
1574int in_gate_area(struct task_struct *task, unsigned long addr); 1599int in_gate_area(struct mm_struct *mm, unsigned long addr);
1575#else 1600#else
1576int in_gate_area_no_task(unsigned long addr); 1601int in_gate_area_no_mm(unsigned long addr);
1577#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) 1602#define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})
1578#endif /* __HAVE_ARCH_GATE_AREA */ 1603#endif /* __HAVE_ARCH_GATE_AREA */
1579 1604
1580int drop_caches_sysctl_handler(struct ctl_table *, int, 1605int drop_caches_sysctl_handler(struct ctl_table *, int,
@@ -1622,14 +1647,6 @@ extern int sysctl_memory_failure_recovery;
1622extern void shake_page(struct page *p, int access); 1647extern void shake_page(struct page *p, int access);
1623extern atomic_long_t mce_bad_pages; 1648extern atomic_long_t mce_bad_pages;
1624extern int soft_offline_page(struct page *page, int flags); 1649extern int soft_offline_page(struct page *page, int flags);
1625#ifdef CONFIG_MEMORY_FAILURE
1626int is_hwpoison_address(unsigned long addr);
1627#else
1628static inline int is_hwpoison_address(unsigned long addr)
1629{
1630 return 0;
1631}
1632#endif
1633 1650
1634extern void dump_page(struct page *page); 1651extern void dump_page(struct page *page);
1635 1652
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 26bc4e2cd275..02aa5619709b 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -237,8 +237,9 @@ struct mm_struct {
237 atomic_t mm_users; /* How many users with user space? */ 237 atomic_t mm_users; /* How many users with user space? */
238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
239 int map_count; /* number of VMAs */ 239 int map_count; /* number of VMAs */
240 struct rw_semaphore mmap_sem; 240
241 spinlock_t page_table_lock; /* Protects page tables and some counters */ 241 spinlock_t page_table_lock; /* Protects page tables and some counters */
242 struct rw_semaphore mmap_sem;
242 243
243 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung 244 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung
244 * together off init_mm.mmlist, and are protected 245 * together off init_mm.mmlist, and are protected
@@ -281,6 +282,9 @@ struct mm_struct {
281 unsigned int token_priority; 282 unsigned int token_priority;
282 unsigned int last_interval; 283 unsigned int last_interval;
283 284
285 /* How many tasks sharing this mm are OOM_DISABLE */
286 atomic_t oom_disable_count;
287
284 unsigned long flags; /* Must use atomic bitops to access the bits */ 288 unsigned long flags; /* Must use atomic bitops to access the bits */
285 289
286 struct core_state *core_state; /* coredumping support */ 290 struct core_state *core_state; /* coredumping support */
@@ -313,8 +317,6 @@ struct mm_struct {
313#ifdef CONFIG_TRANSPARENT_HUGEPAGE 317#ifdef CONFIG_TRANSPARENT_HUGEPAGE
314 pgtable_t pmd_huge_pte; /* protected by page_table_lock */ 318 pgtable_t pmd_huge_pte; /* protected by page_table_lock */
315#endif 319#endif
316 /* How many tasks sharing this mm are OOM_DISABLE */
317 atomic_t oom_disable_count;
318}; 320};
319 321
320/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */ 322/* Future-safe accessor for struct mm_struct's cpu_vm_mask. */
diff --git a/include/linux/mmc/boot.h b/include/linux/mmc/boot.h
new file mode 100644
index 000000000000..39d787c229cb
--- /dev/null
+++ b/include/linux/mmc/boot.h
@@ -0,0 +1,7 @@
1#ifndef MMC_BOOT_H
2#define MMC_BOOT_H
3
4enum { MMC_PROGRESS_ENTER, MMC_PROGRESS_INIT,
5 MMC_PROGRESS_LOAD, MMC_PROGRESS_DONE };
6
7#endif
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 8ce082781ccb..adb4888248be 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -54,6 +54,9 @@ struct mmc_ext_csd {
54 unsigned int sec_trim_mult; /* Secure trim multiplier */ 54 unsigned int sec_trim_mult; /* Secure trim multiplier */
55 unsigned int sec_erase_mult; /* Secure erase multiplier */ 55 unsigned int sec_erase_mult; /* Secure erase multiplier */
56 unsigned int trim_timeout; /* In milliseconds */ 56 unsigned int trim_timeout; /* In milliseconds */
57 bool enhanced_area_en; /* enable bit */
58 unsigned long long enhanced_area_offset; /* Units: Byte */
59 unsigned int enhanced_area_size; /* Units: KB */
57}; 60};
58 61
59struct sd_scr { 62struct sd_scr {
@@ -121,6 +124,7 @@ struct mmc_card {
121 /* for byte mode */ 124 /* for byte mode */
122#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ 125#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
123 /* (missing CIA registers) */ 126 /* (missing CIA registers) */
127#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
124 128
125 unsigned int erase_size; /* erase size in sectors */ 129 unsigned int erase_size; /* erase size in sectors */
126 unsigned int erase_shift; /* if erase unit is power 2 */ 130 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -148,6 +152,8 @@ struct mmc_card {
148 struct dentry *debugfs_root; 152 struct dentry *debugfs_root;
149}; 153};
150 154
155void mmc_fixup_device(struct mmc_card *dev);
156
151#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 157#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
152#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD) 158#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
153#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO) 159#define mmc_card_sdio(c) ((c)->type == MMC_TYPE_SDIO)
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 64e013f1cfb8..07f27af4dba5 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -160,6 +160,7 @@ extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
160 160
161extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort); 161extern int __mmc_claim_host(struct mmc_host *host, atomic_t *abort);
162extern void mmc_release_host(struct mmc_host *host); 162extern void mmc_release_host(struct mmc_host *host);
163extern void mmc_do_release_host(struct mmc_host *host);
163extern int mmc_try_claim_host(struct mmc_host *host); 164extern int mmc_try_claim_host(struct mmc_host *host);
164 165
165/** 166/**
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 16b0261763ed..c0207a770476 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -140,6 +140,7 @@ struct dw_mci {
140 u32 bus_hz; 140 u32 bus_hz;
141 u32 current_speed; 141 u32 current_speed;
142 u32 num_slots; 142 u32 num_slots;
143 u32 fifoth_val;
143 struct platform_device *pdev; 144 struct platform_device *pdev;
144 struct dw_mci_board *pdata; 145 struct dw_mci_board *pdata;
145 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 146 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
@@ -151,6 +152,8 @@ struct dw_mci {
151 152
152 /* Workaround flags */ 153 /* Workaround flags */
153 u32 quirks; 154 u32 quirks;
155
156 struct regulator *vmmc; /* Power regulator */
154}; 157};
155 158
156/* DMA ops for Internal/External DMAC interface */ 159/* DMA ops for Internal/External DMAC interface */
@@ -165,14 +168,14 @@ struct dw_mci_dma_ops {
165}; 168};
166 169
167/* IP Quirks/flags. */ 170/* IP Quirks/flags. */
168/* No special quirks or flags to cater for */
169#define DW_MCI_QUIRK_NONE 0
170/* DTO fix for command transmission with IDMAC configured */ 171/* DTO fix for command transmission with IDMAC configured */
171#define DW_MCI_QUIRK_IDMAC_DTO 1 172#define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
172/* delay needed between retries on some 2.11a implementations */ 173/* delay needed between retries on some 2.11a implementations */
173#define DW_MCI_QUIRK_RETRY_DELAY 2 174#define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
174/* High Speed Capable - Supports HS cards (upto 50MHz) */ 175/* High Speed Capable - Supports HS cards (upto 50MHz) */
175#define DW_MCI_QUIRK_HIGHSPEED 4 176#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
177/* Unreliable card detection */
178#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
176 179
177 180
178struct dma_pdata; 181struct dma_pdata;
@@ -192,6 +195,8 @@ struct dw_mci_board {
192 u32 quirks; /* Workaround / Quirk flags */ 195 u32 quirks; /* Workaround / Quirk flags */
193 unsigned int bus_hz; /* Bus speed */ 196 unsigned int bus_hz; /* Bus speed */
194 197
198 unsigned int caps; /* Capabilities */
199
195 /* delay in mS before detecting cards after interrupt */ 200 /* delay in mS before detecting cards after interrupt */
196 u32 detect_delay_ms; 201 u32 detect_delay_ms;
197 202
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 612301f85d14..264ba5451e3b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -253,6 +253,8 @@ struct _mmc_csd {
253 * EXT_CSD fields 253 * EXT_CSD fields
254 */ 254 */
255 255
256#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
257#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
256#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 258#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
257#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 259#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
258#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 260#define EXT_CSD_BUS_WIDTH 183 /* R/W */
@@ -262,6 +264,7 @@ struct _mmc_csd {
262#define EXT_CSD_CARD_TYPE 196 /* RO */ 264#define EXT_CSD_CARD_TYPE 196 /* RO */
263#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 265#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
264#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 266#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
267#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */
265#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ 268#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */
266#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ 269#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
267#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ 270#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 38d393092812..9eb9b4b96f55 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -104,9 +104,6 @@ static inline void sh_mmcif_writel(void __iomem *addr, int reg, u32 val)
104 104
105#define SH_MMCIF_BBS 512 /* boot block size */ 105#define SH_MMCIF_BBS 512 /* boot block size */
106 106
107enum { MMCIF_PROGRESS_ENTER, MMCIF_PROGRESS_INIT,
108 MMCIF_PROGRESS_LOAD, MMCIF_PROGRESS_DONE };
109
110static inline void sh_mmcif_boot_cmd_send(void __iomem *base, 107static inline void sh_mmcif_boot_cmd_send(void __iomem *base,
111 unsigned long cmd, unsigned long arg) 108 unsigned long cmd, unsigned long arg)
112{ 109{
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 02ecb0189b1d..e56f835274c9 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -472,7 +472,7 @@ static inline int zone_is_oom_locked(const struct zone *zone)
472#ifdef CONFIG_NUMA 472#ifdef CONFIG_NUMA
473 473
474/* 474/*
475 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 475 * The NUMA zonelists are doubled because we need zonelists that restrict the
476 * allocations to a single node for GFP_THISNODE. 476 * allocations to a single node for GFP_THISNODE.
477 * 477 *
478 * [0] : Zonelist with fallback 478 * [0] : Zonelist with fallback
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
index d11fe0f2f956..fe722c1fb61d 100644
--- a/include/linux/msm_mdp.h
+++ b/include/linux/msm_mdp.h
@@ -32,6 +32,7 @@ enum {
32 MDP_Y_CBCR_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 */ 33 MDP_RGBA_8888, /* ARGB 888 */
34 MDP_BGRA_8888, /* ABGR 888 */ 34 MDP_BGRA_8888, /* ABGR 888 */
35 MDP_RGBX_8888, /* RGBX 888 */
35 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */ 36 MDP_IMGTYPE_LIMIT /* Non valid image type after this enum */
36}; 37};
37 38
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 26529ebd59cc..1bbd9f289245 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -36,6 +36,7 @@ struct mtd_blktrans_dev {
36 struct mtd_info *mtd; 36 struct mtd_info *mtd;
37 struct mutex lock; 37 struct mutex lock;
38 int devnum; 38 int devnum;
39 bool bg_stop;
39 unsigned long size; 40 unsigned long size;
40 int readonly; 41 int readonly;
41 int open; 42 int open;
@@ -62,6 +63,7 @@ struct mtd_blktrans_ops {
62 unsigned long block, char *buffer); 63 unsigned long block, char *buffer);
63 int (*discard)(struct mtd_blktrans_dev *dev, 64 int (*discard)(struct mtd_blktrans_dev *dev,
64 unsigned long block, unsigned nr_blocks); 65 unsigned long block, unsigned nr_blocks);
66 void (*background)(struct mtd_blktrans_dev *dev);
65 67
66 /* Block layer ioctls */ 68 /* Block layer ioctls */
67 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); 69 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
@@ -85,6 +87,7 @@ extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr);
85extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); 87extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr);
86extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 88extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
87extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); 89extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);
90extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev);
88 91
89 92
90#endif /* __MTD_TRANS_H__ */ 93#endif /* __MTD_TRANS_H__ */
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index a9baee6864af..0d823f2dd667 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -535,6 +535,7 @@ struct cfi_fixup {
535#define CFI_MFR_CONTINUATION 0x007F 535#define CFI_MFR_CONTINUATION 0x007F
536 536
537#define CFI_MFR_AMD 0x0001 537#define CFI_MFR_AMD 0x0001
538#define CFI_MFR_AMIC 0x0037
538#define CFI_MFR_ATMEL 0x001F 539#define CFI_MFR_ATMEL 0x001F
539#define CFI_MFR_EON 0x001C 540#define CFI_MFR_EON 0x001C
540#define CFI_MFR_FUJITSU 0x0004 541#define CFI_MFR_FUJITSU 0x0004
diff --git a/include/linux/mtd/latch-addr-flash.h b/include/linux/mtd/latch-addr-flash.h
new file mode 100644
index 000000000000..e94b8e128074
--- /dev/null
+++ b/include/linux/mtd/latch-addr-flash.h
@@ -0,0 +1,29 @@
1/*
2 * Interface for NOR flash driver whose high address lines are latched
3 *
4 * Copyright © 2008 MontaVista Software, Inc. <source@mvista.com>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10#ifndef __LATCH_ADDR_FLASH__
11#define __LATCH_ADDR_FLASH__
12
13struct map_info;
14struct mtd_partition;
15
16struct latch_addr_flash_data {
17 unsigned int width;
18 unsigned int size;
19
20 int (*init)(void *data, int cs);
21 void (*done)(void *data);
22 void (*set_window)(unsigned long offset, void *data);
23 void *data;
24
25 unsigned int nr_parts;
26 struct mtd_partition *parts;
27};
28
29#endif
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 1f489b247a29..ae67ef56a8f5 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -140,6 +140,7 @@ typedef enum {
140 NAND_ECC_HW, 140 NAND_ECC_HW,
141 NAND_ECC_HW_SYNDROME, 141 NAND_ECC_HW_SYNDROME,
142 NAND_ECC_HW_OOB_FIRST, 142 NAND_ECC_HW_OOB_FIRST,
143 NAND_ECC_SOFT_BCH,
143} nand_ecc_modes_t; 144} nand_ecc_modes_t;
144 145
145/* 146/*
@@ -339,6 +340,7 @@ struct nand_hw_control {
339 * @prepad: padding information for syndrome based ecc generators 340 * @prepad: padding information for syndrome based ecc generators
340 * @postpad: padding information for syndrome based ecc generators 341 * @postpad: padding information for syndrome based ecc generators
341 * @layout: ECC layout control struct pointer 342 * @layout: ECC layout control struct pointer
343 * @priv: pointer to private ecc control data
342 * @hwctl: function to control hardware ecc generator. Must only 344 * @hwctl: function to control hardware ecc generator. Must only
343 * be provided if an hardware ECC is available 345 * be provided if an hardware ECC is available
344 * @calculate: function for ecc calculation or readback from ecc hardware 346 * @calculate: function for ecc calculation or readback from ecc hardware
@@ -362,6 +364,7 @@ struct nand_ecc_ctrl {
362 int prepad; 364 int prepad;
363 int postpad; 365 int postpad;
364 struct nand_ecclayout *layout; 366 struct nand_ecclayout *layout;
367 void *priv;
365 void (*hwctl)(struct mtd_info *mtd, int mode); 368 void (*hwctl)(struct mtd_info *mtd, int mode);
366 int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, 369 int (*calculate)(struct mtd_info *mtd, const uint8_t *dat,
367 uint8_t *ecc_code); 370 uint8_t *ecc_code);
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
new file mode 100644
index 000000000000..74acf5367556
--- /dev/null
+++ b/include/linux/mtd/nand_bch.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
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 file is the header for the NAND BCH ECC implementation.
9 */
10
11#ifndef __MTD_NAND_BCH_H__
12#define __MTD_NAND_BCH_H__
13
14struct mtd_info;
15struct nand_bch_control;
16
17#if defined(CONFIG_MTD_NAND_ECC_BCH)
18
19static inline int mtd_nand_has_bch(void) { return 1; }
20
21/*
22 * Calculate BCH ecc code
23 */
24int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
25 u_char *ecc_code);
26
27/*
28 * Detect and correct bit errors
29 */
30int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
31 u_char *calc_ecc);
32/*
33 * Initialize BCH encoder/decoder
34 */
35struct nand_bch_control *
36nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
37 unsigned int eccbytes, struct nand_ecclayout **ecclayout);
38/*
39 * Release BCH encoder/decoder resources
40 */
41void nand_bch_free(struct nand_bch_control *nbc);
42
43#else /* !CONFIG_MTD_NAND_ECC_BCH */
44
45static inline int mtd_nand_has_bch(void) { return 0; }
46
47static inline int
48nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
49 u_char *ecc_code)
50{
51 return -1;
52}
53
54static inline int
55nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
56 unsigned char *read_ecc, unsigned char *calc_ecc)
57{
58 return -1;
59}
60
61static inline struct nand_bch_control *
62nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
63 unsigned int eccbytes, struct nand_ecclayout **ecclayout)
64{
65 return NULL;
66}
67
68static inline void nand_bch_free(struct nand_bch_control *nbc) {}
69
70#endif /* CONFIG_MTD_NAND_ECC_BCH */
71
72#endif /* __MTD_NAND_BCH_H__ */
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index ae418e41d8f5..52b6f187bf49 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -198,6 +198,7 @@ struct onenand_chip {
198#define ONENAND_SKIP_UNLOCK_CHECK (0x0100) 198#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
199#define ONENAND_PAGEBUF_ALLOC (0x1000) 199#define ONENAND_PAGEBUF_ALLOC (0x1000)
200#define ONENAND_OOBBUF_ALLOC (0x2000) 200#define ONENAND_OOBBUF_ALLOC (0x2000)
201#define ONENAND_SKIP_INITIAL_UNLOCKING (0x4000)
201 202
202#define ONENAND_IS_4KB_PAGE(this) \ 203#define ONENAND_IS_4KB_PAGE(this) \
203 (this->options & ONENAND_HAS_4KB_PAGE) 204 (this->options & ONENAND_HAS_4KB_PAGE)
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index cd6f3b431195..d60130f88eed 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -168,6 +168,7 @@
168#define ONENAND_SYS_CFG1_INT (1 << 6) 168#define ONENAND_SYS_CFG1_INT (1 << 6)
169#define ONENAND_SYS_CFG1_IOBE (1 << 5) 169#define ONENAND_SYS_CFG1_IOBE (1 << 5)
170#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) 170#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4)
171#define ONENAND_SYS_CFG1_VHF (1 << 3)
171#define ONENAND_SYS_CFG1_HF (1 << 2) 172#define ONENAND_SYS_CFG1_HF (1 << 2)
172#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) 173#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1)
173 174
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index b31bd9e9bca3..84854edf4436 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -116,18 +116,40 @@ struct ubi_volume_info {
116 * struct ubi_device_info - UBI device description data structure. 116 * struct ubi_device_info - UBI device description data structure.
117 * @ubi_num: ubi device number 117 * @ubi_num: ubi device number
118 * @leb_size: logical eraseblock size on this UBI device 118 * @leb_size: logical eraseblock size on this UBI device
119 * @leb_start: starting offset of logical eraseblocks within physical
120 * eraseblocks
119 * @min_io_size: minimal I/O unit size 121 * @min_io_size: minimal I/O unit size
122 * @max_write_size: maximum amount of bytes the underlying flash can write at a
123 * time (MTD write buffer size)
120 * @ro_mode: if this device is in read-only mode 124 * @ro_mode: if this device is in read-only mode
121 * @cdev: UBI character device major and minor numbers 125 * @cdev: UBI character device major and minor numbers
122 * 126 *
123 * Note, @leb_size is the logical eraseblock size offered by the UBI device. 127 * Note, @leb_size is the logical eraseblock size offered by the UBI device.
124 * Volumes of this UBI device may have smaller logical eraseblock size if their 128 * Volumes of this UBI device may have smaller logical eraseblock size if their
125 * alignment is not equivalent to %1. 129 * alignment is not equivalent to %1.
130 *
131 * The @max_write_size field describes flash write maximum write unit. For
132 * example, NOR flash allows for changing individual bytes, so @min_io_size is
133 * %1. However, it does not mean than NOR flash has to write data byte-by-byte.
134 * Instead, CFI NOR flashes have a write-buffer of, e.g., 64 bytes, and when
135 * writing large chunks of data, they write 64-bytes at a time. Obviously, this
136 * improves write throughput.
137 *
138 * Also, the MTD device may have N interleaved (striped) flash chips
139 * underneath, in which case @min_io_size can be physical min. I/O size of
140 * single flash chip, while @max_write_size can be N * @min_io_size.
141 *
142 * The @max_write_size field is always greater or equivalent to @min_io_size.
143 * E.g., some NOR flashes may have (@min_io_size = 1, @max_write_size = 64). In
144 * contrast, NAND flashes usually have @min_io_size = @max_write_size = NAND
145 * page size.
126 */ 146 */
127struct ubi_device_info { 147struct ubi_device_info {
128 int ubi_num; 148 int ubi_num;
129 int leb_size; 149 int leb_size;
150 int leb_start;
130 int min_io_size; 151 int min_io_size;
152 int max_write_size;
131 int ro_mode; 153 int ro_mode;
132 dev_t cdev; 154 dev_t cdev;
133}; 155};
diff --git a/include/linux/namei.h b/include/linux/namei.h
index f276d4fa01fc..eba45ea10298 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -19,7 +19,6 @@ struct nameidata {
19 struct path path; 19 struct path path;
20 struct qstr last; 20 struct qstr last;
21 struct path root; 21 struct path root;
22 struct file *file;
23 struct inode *inode; /* path.dentry.d_inode */ 22 struct inode *inode; /* path.dentry.d_inode */
24 unsigned int flags; 23 unsigned int flags;
25 unsigned seq; 24 unsigned seq;
@@ -63,6 +62,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
63#define LOOKUP_EXCL 0x0400 62#define LOOKUP_EXCL 0x0400
64#define LOOKUP_RENAME_TARGET 0x0800 63#define LOOKUP_RENAME_TARGET 0x0800
65 64
65#define LOOKUP_JUMPED 0x1000
66#define LOOKUP_ROOT 0x2000
67#define LOOKUP_EMPTY 0x4000
68
66extern int user_path_at(int, const char __user *, unsigned, struct path *); 69extern int user_path_at(int, const char __user *, unsigned, struct path *);
67 70
68#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) 71#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
@@ -72,7 +75,7 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *);
72 75
73extern int kern_path(const char *, unsigned, struct path *); 76extern int kern_path(const char *, unsigned, struct path *);
74 77
75extern int path_lookup(const char *, unsigned, struct nameidata *); 78extern int kern_path_parent(const char *, struct nameidata *);
76extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 79extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
77 const char *, unsigned int, struct nameidata *); 80 const char *, unsigned int, struct nameidata *);
78 81
@@ -82,7 +85,7 @@ extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry
82extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 85extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
83 86
84extern int follow_down_one(struct path *); 87extern int follow_down_one(struct path *);
85extern int follow_down(struct path *, bool); 88extern int follow_down(struct path *);
86extern int follow_up(struct path *); 89extern int follow_up(struct path *);
87 90
88extern struct dentry *lock_rename(struct dentry *, struct dentry *); 91extern struct dentry *lock_rename(struct dentry *, struct dentry *);
diff --git a/include/linux/net.h b/include/linux/net.h
index 16faa130088c..94de83c0f877 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -118,6 +118,7 @@ enum sock_shutdown_cmd {
118}; 118};
119 119
120struct socket_wq { 120struct socket_wq {
121 /* Note: wait MUST be first field of socket_wq */
121 wait_queue_head_t wait; 122 wait_queue_head_t wait;
122 struct fasync_struct *fasync_list; 123 struct fasync_struct *fasync_list;
123 struct rcu_head rcu; 124 struct rcu_head rcu;
@@ -142,7 +143,7 @@ struct socket {
142 143
143 unsigned long flags; 144 unsigned long flags;
144 145
145 struct socket_wq *wq; 146 struct socket_wq __rcu *wq;
146 147
147 struct file *file; 148 struct file *file;
148 struct sock *sk; 149 struct sock *sk;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d971346b0340..5eeb2cd3631c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -138,6 +138,9 @@ static inline bool dev_xmit_complete(int rc)
138 138
139#define MAX_ADDR_LEN 32 /* Largest hardware address length */ 139#define MAX_ADDR_LEN 32 /* Largest hardware address length */
140 140
141/* Initial net device group. All devices belong to group 0 by default. */
142#define INIT_NETDEV_GROUP 0
143
141#ifdef __KERNEL__ 144#ifdef __KERNEL__
142/* 145/*
143 * Compute the worst case header length according to the protocols 146 * Compute the worst case header length according to the protocols
@@ -387,7 +390,55 @@ enum gro_result {
387}; 390};
388typedef enum gro_result gro_result_t; 391typedef enum gro_result gro_result_t;
389 392
390typedef struct sk_buff *rx_handler_func_t(struct sk_buff *skb); 393/*
394 * enum rx_handler_result - Possible return values for rx_handlers.
395 * @RX_HANDLER_CONSUMED: skb was consumed by rx_handler, do not process it
396 * further.
397 * @RX_HANDLER_ANOTHER: Do another round in receive path. This is indicated in
398 * case skb->dev was changed by rx_handler.
399 * @RX_HANDLER_EXACT: Force exact delivery, no wildcard.
400 * @RX_HANDLER_PASS: Do nothing, passe the skb as if no rx_handler was called.
401 *
402 * rx_handlers are functions called from inside __netif_receive_skb(), to do
403 * special processing of the skb, prior to delivery to protocol handlers.
404 *
405 * Currently, a net_device can only have a single rx_handler registered. Trying
406 * to register a second rx_handler will return -EBUSY.
407 *
408 * To register a rx_handler on a net_device, use netdev_rx_handler_register().
409 * To unregister a rx_handler on a net_device, use
410 * netdev_rx_handler_unregister().
411 *
412 * Upon return, rx_handler is expected to tell __netif_receive_skb() what to
413 * do with the skb.
414 *
415 * If the rx_handler consumed to skb in some way, it should return
416 * RX_HANDLER_CONSUMED. This is appropriate when the rx_handler arranged for
417 * the skb to be delivered in some other ways.
418 *
419 * If the rx_handler changed skb->dev, to divert the skb to another
420 * net_device, it should return RX_HANDLER_ANOTHER. The rx_handler for the
421 * new device will be called if it exists.
422 *
423 * If the rx_handler consider the skb should be ignored, it should return
424 * RX_HANDLER_EXACT. The skb will only be delivered to protocol handlers that
425 * are registred on exact device (ptype->dev == skb->dev).
426 *
427 * If the rx_handler didn't changed skb->dev, but want the skb to be normally
428 * delivered, it should return RX_HANDLER_PASS.
429 *
430 * A device without a registered rx_handler will behave as if rx_handler
431 * returned RX_HANDLER_PASS.
432 */
433
434enum rx_handler_result {
435 RX_HANDLER_CONSUMED,
436 RX_HANDLER_ANOTHER,
437 RX_HANDLER_EXACT,
438 RX_HANDLER_PASS,
439};
440typedef enum rx_handler_result rx_handler_result_t;
441typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **pskb);
391 442
392extern void __napi_schedule(struct napi_struct *n); 443extern void __napi_schedule(struct napi_struct *n);
393 444
@@ -551,14 +602,16 @@ struct rps_map {
551#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) 602#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16)))
552 603
553/* 604/*
554 * The rps_dev_flow structure contains the mapping of a flow to a CPU and the 605 * The rps_dev_flow structure contains the mapping of a flow to a CPU, the
555 * tail pointer for that CPU's input queue at the time of last enqueue. 606 * tail pointer for that CPU's input queue at the time of last enqueue, and
607 * a hardware filter index.
556 */ 608 */
557struct rps_dev_flow { 609struct rps_dev_flow {
558 u16 cpu; 610 u16 cpu;
559 u16 fill; 611 u16 filter;
560 unsigned int last_qtail; 612 unsigned int last_qtail;
561}; 613};
614#define RPS_NO_FILTER 0xffff
562 615
563/* 616/*
564 * The rps_dev_flow_table structure contains a table of flow mappings. 617 * The rps_dev_flow_table structure contains a table of flow mappings.
@@ -608,6 +661,11 @@ static inline void rps_reset_sock_flow(struct rps_sock_flow_table *table,
608 661
609extern struct rps_sock_flow_table __rcu *rps_sock_flow_table; 662extern struct rps_sock_flow_table __rcu *rps_sock_flow_table;
610 663
664#ifdef CONFIG_RFS_ACCEL
665extern bool rps_may_expire_flow(struct net_device *dev, u16 rxq_index,
666 u32 flow_id, u16 filter_id);
667#endif
668
611/* This structure contains an instance of an RX queue. */ 669/* This structure contains an instance of an RX queue. */
612struct netdev_rx_queue { 670struct netdev_rx_queue {
613 struct rps_map __rcu *rps_map; 671 struct rps_map __rcu *rps_map;
@@ -643,6 +701,14 @@ struct xps_dev_maps {
643 (nr_cpu_ids * sizeof(struct xps_map *))) 701 (nr_cpu_ids * sizeof(struct xps_map *)))
644#endif /* CONFIG_XPS */ 702#endif /* CONFIG_XPS */
645 703
704#define TC_MAX_QUEUE 16
705#define TC_BITMASK 15
706/* HW offloaded queuing disciplines txq count and offset maps */
707struct netdev_tc_txq {
708 u16 count;
709 u16 offset;
710};
711
646/* 712/*
647 * This structure defines the management hooks for network devices. 713 * This structure defines the management hooks for network devices.
648 * The following hooks can be defined; unless noted otherwise, they are 714 * The following hooks can be defined; unless noted otherwise, they are
@@ -753,6 +819,74 @@ struct xps_dev_maps {
753 * int (*ndo_set_vf_port)(struct net_device *dev, int vf, 819 * int (*ndo_set_vf_port)(struct net_device *dev, int vf,
754 * struct nlattr *port[]); 820 * struct nlattr *port[]);
755 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb); 821 * int (*ndo_get_vf_port)(struct net_device *dev, int vf, struct sk_buff *skb);
822 * int (*ndo_setup_tc)(struct net_device *dev, u8 tc)
823 * Called to setup 'tc' number of traffic classes in the net device. This
824 * is always called from the stack with the rtnl lock held and netif tx
825 * queues stopped. This allows the netdevice to perform queue management
826 * safely.
827 *
828 * Fiber Channel over Ethernet (FCoE) offload functions.
829 * int (*ndo_fcoe_enable)(struct net_device *dev);
830 * Called when the FCoE protocol stack wants to start using LLD for FCoE
831 * so the underlying device can perform whatever needed configuration or
832 * initialization to support acceleration of FCoE traffic.
833 *
834 * int (*ndo_fcoe_disable)(struct net_device *dev);
835 * Called when the FCoE protocol stack wants to stop using LLD for FCoE
836 * so the underlying device can perform whatever needed clean-ups to
837 * stop supporting acceleration of FCoE traffic.
838 *
839 * int (*ndo_fcoe_ddp_setup)(struct net_device *dev, u16 xid,
840 * struct scatterlist *sgl, unsigned int sgc);
841 * Called when the FCoE Initiator wants to initialize an I/O that
842 * is a possible candidate for Direct Data Placement (DDP). The LLD can
843 * perform necessary setup and returns 1 to indicate the device is set up
844 * successfully to perform DDP on this I/O, otherwise this returns 0.
845 *
846 * int (*ndo_fcoe_ddp_done)(struct net_device *dev, u16 xid);
847 * Called when the FCoE Initiator/Target is done with the DDPed I/O as
848 * indicated by the FC exchange id 'xid', so the underlying device can
849 * clean up and reuse resources for later DDP requests.
850 *
851 * int (*ndo_fcoe_ddp_target)(struct net_device *dev, u16 xid,
852 * struct scatterlist *sgl, unsigned int sgc);
853 * Called when the FCoE Target wants to initialize an I/O that
854 * is a possible candidate for Direct Data Placement (DDP). The LLD can
855 * perform necessary setup and returns 1 to indicate the device is set up
856 * successfully to perform DDP on this I/O, otherwise this returns 0.
857 *
858 * int (*ndo_fcoe_get_wwn)(struct net_device *dev, u64 *wwn, int type);
859 * Called when the underlying device wants to override default World Wide
860 * Name (WWN) generation mechanism in FCoE protocol stack to pass its own
861 * World Wide Port Name (WWPN) or World Wide Node Name (WWNN) to the FCoE
862 * protocol stack to use.
863 *
864 * RFS acceleration.
865 * int (*ndo_rx_flow_steer)(struct net_device *dev, const struct sk_buff *skb,
866 * u16 rxq_index, u32 flow_id);
867 * Set hardware filter for RFS. rxq_index is the target queue index;
868 * flow_id is a flow ID to be passed to rps_may_expire_flow() later.
869 * Return the filter ID on success, or a negative error code.
870 *
871 * Slave management functions (for bridge, bonding, etc). User should
872 * call netdev_set_master() to set dev->master properly.
873 * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
874 * Called to make another netdev an underling.
875 *
876 * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
877 * Called to release previously enslaved netdev.
878 *
879 * Feature/offload setting functions.
880 * u32 (*ndo_fix_features)(struct net_device *dev, u32 features);
881 * Adjusts the requested feature flags according to device-specific
882 * constraints, and returns the resulting flags. Must not modify
883 * the device state.
884 *
885 * int (*ndo_set_features)(struct net_device *dev, u32 features);
886 * Called to update device configuration to new features. Passed
887 * feature set might be less than what was returned by ndo_fix_features()).
888 * Must return >0 or -errno if it changed dev->features itself.
889 *
756 */ 890 */
757#define HAVE_NET_DEVICE_OPS 891#define HAVE_NET_DEVICE_OPS
758struct net_device_ops { 892struct net_device_ops {
@@ -811,6 +945,7 @@ struct net_device_ops {
811 struct nlattr *port[]); 945 struct nlattr *port[]);
812 int (*ndo_get_vf_port)(struct net_device *dev, 946 int (*ndo_get_vf_port)(struct net_device *dev,
813 int vf, struct sk_buff *skb); 947 int vf, struct sk_buff *skb);
948 int (*ndo_setup_tc)(struct net_device *dev, u8 tc);
814#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 949#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
815 int (*ndo_fcoe_enable)(struct net_device *dev); 950 int (*ndo_fcoe_enable)(struct net_device *dev);
816 int (*ndo_fcoe_disable)(struct net_device *dev); 951 int (*ndo_fcoe_disable)(struct net_device *dev);
@@ -820,11 +955,29 @@ struct net_device_ops {
820 unsigned int sgc); 955 unsigned int sgc);
821 int (*ndo_fcoe_ddp_done)(struct net_device *dev, 956 int (*ndo_fcoe_ddp_done)(struct net_device *dev,
822 u16 xid); 957 u16 xid);
958 int (*ndo_fcoe_ddp_target)(struct net_device *dev,
959 u16 xid,
960 struct scatterlist *sgl,
961 unsigned int sgc);
823#define NETDEV_FCOE_WWNN 0 962#define NETDEV_FCOE_WWNN 0
824#define NETDEV_FCOE_WWPN 1 963#define NETDEV_FCOE_WWPN 1
825 int (*ndo_fcoe_get_wwn)(struct net_device *dev, 964 int (*ndo_fcoe_get_wwn)(struct net_device *dev,
826 u64 *wwn, int type); 965 u64 *wwn, int type);
827#endif 966#endif
967#ifdef CONFIG_RFS_ACCEL
968 int (*ndo_rx_flow_steer)(struct net_device *dev,
969 const struct sk_buff *skb,
970 u16 rxq_index,
971 u32 flow_id);
972#endif
973 int (*ndo_add_slave)(struct net_device *dev,
974 struct net_device *slave_dev);
975 int (*ndo_del_slave)(struct net_device *dev,
976 struct net_device *slave_dev);
977 u32 (*ndo_fix_features)(struct net_device *dev,
978 u32 features);
979 int (*ndo_set_features)(struct net_device *dev,
980 u32 features);
828}; 981};
829 982
830/* 983/*
@@ -876,8 +1029,18 @@ struct net_device {
876 struct list_head napi_list; 1029 struct list_head napi_list;
877 struct list_head unreg_list; 1030 struct list_head unreg_list;
878 1031
879 /* Net device features */ 1032 /* currently active device features */
880 unsigned long features; 1033 u32 features;
1034 /* user-changeable features */
1035 u32 hw_features;
1036 /* user-requested features */
1037 u32 wanted_features;
1038 /* VLAN feature mask */
1039 u32 vlan_features;
1040
1041 /* Net device feature bits; if you change something,
1042 * also update netdev_features_strings[] in ethtool.c */
1043
881#define NETIF_F_SG 1 /* Scatter/gather IO. */ 1044#define NETIF_F_SG 1 /* Scatter/gather IO. */
882#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */ 1045#define NETIF_F_IP_CSUM 2 /* Can checksum TCP/UDP over IPv4. */
883#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */ 1046#define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
@@ -902,6 +1065,7 @@ struct net_device {
902#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/ 1065#define NETIF_F_FCOE_MTU (1 << 26) /* Supports max FCoE MTU, 2158 bytes*/
903#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */ 1066#define NETIF_F_NTUPLE (1 << 27) /* N-tuple filters supported */
904#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */ 1067#define NETIF_F_RXHASH (1 << 28) /* Receive hashing offload */
1068#define NETIF_F_RXCSUM (1 << 29) /* Receive checksumming offload */
905 1069
906 /* Segmentation offload features */ 1070 /* Segmentation offload features */
907#define NETIF_F_GSO_SHIFT 16 1071#define NETIF_F_GSO_SHIFT 16
@@ -913,6 +1077,12 @@ struct net_device {
913#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT) 1077#define NETIF_F_TSO6 (SKB_GSO_TCPV6 << NETIF_F_GSO_SHIFT)
914#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT) 1078#define NETIF_F_FSO (SKB_GSO_FCOE << NETIF_F_GSO_SHIFT)
915 1079
1080 /* Features valid for ethtool to change */
1081 /* = all defined minus driver/device-class-related */
1082#define NETIF_F_NEVER_CHANGE (NETIF_F_HIGHDMA | NETIF_F_VLAN_CHALLENGED | \
1083 NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
1084#define NETIF_F_ETHTOOL_BITS (0x3f3fffff & ~NETIF_F_NEVER_CHANGE)
1085
916 /* List of features with software fallbacks. */ 1086 /* List of features with software fallbacks. */
917#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \ 1087#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
918 NETIF_F_TSO6 | NETIF_F_UFO) 1088 NETIF_F_TSO6 | NETIF_F_UFO)
@@ -923,6 +1093,12 @@ struct net_device {
923#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM) 1093#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
924#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM) 1094#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
925 1095
1096#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
1097
1098#define NETIF_F_ALL_TX_OFFLOADS (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1099 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1100 NETIF_F_SCTP_CSUM | NETIF_F_FCOE_CRC)
1101
926 /* 1102 /*
927 * If one device supports one of these features, then enable them 1103 * If one device supports one of these features, then enable them
928 * for all in netdev_increment_features. 1104 * for all in netdev_increment_features.
@@ -931,6 +1107,9 @@ struct net_device {
931 NETIF_F_SG | NETIF_F_HIGHDMA | \ 1107 NETIF_F_SG | NETIF_F_HIGHDMA | \
932 NETIF_F_FRAGLIST) 1108 NETIF_F_FRAGLIST)
933 1109
1110 /* changeable features with no special hardware requirements */
1111#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
1112
934 /* Interface index. Unique device identifier */ 1113 /* Interface index. Unique device identifier */
935 int ifindex; 1114 int ifindex;
936 int iflink; 1115 int iflink;
@@ -1039,6 +1218,13 @@ struct net_device {
1039 1218
1040 /* Number of RX queues currently active in device */ 1219 /* Number of RX queues currently active in device */
1041 unsigned int real_num_rx_queues; 1220 unsigned int real_num_rx_queues;
1221
1222#ifdef CONFIG_RFS_ACCEL
1223 /* CPU reverse-mapping for RX completion interrupts, indexed
1224 * by RX queue number. Assigned by driver. This must only be
1225 * set if the ndo_rx_flow_steer operation is defined. */
1226 struct cpu_rmap *rx_cpu_rmap;
1227#endif
1042#endif 1228#endif
1043 1229
1044 rx_handler_func_t __rcu *rx_handler; 1230 rx_handler_func_t __rcu *rx_handler;
@@ -1132,9 +1318,6 @@ struct net_device {
1132 /* rtnetlink link ops */ 1318 /* rtnetlink link ops */
1133 const struct rtnl_link_ops *rtnl_link_ops; 1319 const struct rtnl_link_ops *rtnl_link_ops;
1134 1320
1135 /* VLAN feature mask */
1136 unsigned long vlan_features;
1137
1138 /* for setting kernel sock attribute on TCP connection setup */ 1321 /* for setting kernel sock attribute on TCP connection setup */
1139#define GSO_MAX_SIZE 65536 1322#define GSO_MAX_SIZE 65536
1140 unsigned int gso_max_size; 1323 unsigned int gso_max_size;
@@ -1143,6 +1326,9 @@ struct net_device {
1143 /* Data Center Bridging netlink ops */ 1326 /* Data Center Bridging netlink ops */
1144 const struct dcbnl_rtnl_ops *dcbnl_ops; 1327 const struct dcbnl_rtnl_ops *dcbnl_ops;
1145#endif 1328#endif
1329 u8 num_tc;
1330 struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE];
1331 u8 prio_tc_map[TC_BITMASK + 1];
1146 1332
1147#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) 1333#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
1148 /* max exchange id for FCoE LRO by ddp */ 1334 /* max exchange id for FCoE LRO by ddp */
@@ -1153,12 +1339,66 @@ struct net_device {
1153 1339
1154 /* phy device may attach itself for hardware timestamping */ 1340 /* phy device may attach itself for hardware timestamping */
1155 struct phy_device *phydev; 1341 struct phy_device *phydev;
1342
1343 /* group the device belongs to */
1344 int group;
1156}; 1345};
1157#define to_net_dev(d) container_of(d, struct net_device, dev) 1346#define to_net_dev(d) container_of(d, struct net_device, dev)
1158 1347
1159#define NETDEV_ALIGN 32 1348#define NETDEV_ALIGN 32
1160 1349
1161static inline 1350static inline
1351int netdev_get_prio_tc_map(const struct net_device *dev, u32 prio)
1352{
1353 return dev->prio_tc_map[prio & TC_BITMASK];
1354}
1355
1356static inline
1357int netdev_set_prio_tc_map(struct net_device *dev, u8 prio, u8 tc)
1358{
1359 if (tc >= dev->num_tc)
1360 return -EINVAL;
1361
1362 dev->prio_tc_map[prio & TC_BITMASK] = tc & TC_BITMASK;
1363 return 0;
1364}
1365
1366static inline
1367void netdev_reset_tc(struct net_device *dev)
1368{
1369 dev->num_tc = 0;
1370 memset(dev->tc_to_txq, 0, sizeof(dev->tc_to_txq));
1371 memset(dev->prio_tc_map, 0, sizeof(dev->prio_tc_map));
1372}
1373
1374static inline
1375int netdev_set_tc_queue(struct net_device *dev, u8 tc, u16 count, u16 offset)
1376{
1377 if (tc >= dev->num_tc)
1378 return -EINVAL;
1379
1380 dev->tc_to_txq[tc].count = count;
1381 dev->tc_to_txq[tc].offset = offset;
1382 return 0;
1383}
1384
1385static inline
1386int netdev_set_num_tc(struct net_device *dev, u8 num_tc)
1387{
1388 if (num_tc > TC_MAX_QUEUE)
1389 return -EINVAL;
1390
1391 dev->num_tc = num_tc;
1392 return 0;
1393}
1394
1395static inline
1396int netdev_get_num_tc(struct net_device *dev)
1397{
1398 return dev->num_tc;
1399}
1400
1401static inline
1162struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 1402struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
1163 unsigned int index) 1403 unsigned int index)
1164{ 1404{
@@ -1300,7 +1540,7 @@ struct packet_type {
1300 struct packet_type *, 1540 struct packet_type *,
1301 struct net_device *); 1541 struct net_device *);
1302 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1542 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
1303 int features); 1543 u32 features);
1304 int (*gso_send_check)(struct sk_buff *skb); 1544 int (*gso_send_check)(struct sk_buff *skb);
1305 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1545 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1306 struct sk_buff *skb); 1546 struct sk_buff *skb);
@@ -1345,7 +1585,7 @@ static inline struct net_device *next_net_device_rcu(struct net_device *dev)
1345 struct net *net; 1585 struct net *net;
1346 1586
1347 net = dev_net(dev); 1587 net = dev_net(dev);
1348 lh = rcu_dereference(dev->dev_list.next); 1588 lh = rcu_dereference(list_next_rcu(&dev->dev_list));
1349 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 1589 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1350} 1590}
1351 1591
@@ -1355,6 +1595,13 @@ static inline struct net_device *first_net_device(struct net *net)
1355 net_device_entry(net->dev_base_head.next); 1595 net_device_entry(net->dev_base_head.next);
1356} 1596}
1357 1597
1598static inline struct net_device *first_net_device_rcu(struct net *net)
1599{
1600 struct list_head *lh = rcu_dereference(list_next_rcu(&net->dev_base_head));
1601
1602 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
1603}
1604
1358extern int netdev_boot_setup_check(struct net_device *dev); 1605extern int netdev_boot_setup_check(struct net_device *dev);
1359extern unsigned long netdev_boot_base(const char *prefix, int unit); 1606extern unsigned long netdev_boot_base(const char *prefix, int unit);
1360extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type, 1607extern struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
@@ -1606,8 +1853,7 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev)
1606static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) 1853static inline void netif_tx_stop_queue(struct netdev_queue *dev_queue)
1607{ 1854{
1608 if (WARN_ON(!dev_queue)) { 1855 if (WARN_ON(!dev_queue)) {
1609 printk(KERN_INFO "netif_stop_queue() cannot be called before " 1856 pr_info("netif_stop_queue() cannot be called before register_netdev()\n");
1610 "register_netdev()");
1611 return; 1857 return;
1612 } 1858 }
1613 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state); 1859 set_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
@@ -1844,6 +2090,7 @@ extern int dev_set_alias(struct net_device *, const char *, size_t);
1844extern int dev_change_net_namespace(struct net_device *, 2090extern int dev_change_net_namespace(struct net_device *,
1845 struct net *, const char *); 2091 struct net *, const char *);
1846extern int dev_set_mtu(struct net_device *, int); 2092extern int dev_set_mtu(struct net_device *, int);
2093extern void dev_set_group(struct net_device *, int);
1847extern int dev_set_mac_address(struct net_device *, 2094extern int dev_set_mac_address(struct net_device *,
1848 struct sockaddr *); 2095 struct sockaddr *);
1849extern int dev_hard_start_xmit(struct sk_buff *skb, 2096extern int dev_hard_start_xmit(struct sk_buff *skb,
@@ -2267,8 +2514,10 @@ extern int netdev_max_backlog;
2267extern int netdev_tstamp_prequeue; 2514extern int netdev_tstamp_prequeue;
2268extern int weight_p; 2515extern int weight_p;
2269extern int netdev_set_master(struct net_device *dev, struct net_device *master); 2516extern int netdev_set_master(struct net_device *dev, struct net_device *master);
2517extern int netdev_set_bond_master(struct net_device *dev,
2518 struct net_device *master);
2270extern int skb_checksum_help(struct sk_buff *skb); 2519extern int skb_checksum_help(struct sk_buff *skb);
2271extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features); 2520extern struct sk_buff *skb_gso_segment(struct sk_buff *skb, u32 features);
2272#ifdef CONFIG_BUG 2521#ifdef CONFIG_BUG
2273extern void netdev_rx_csum_fault(struct net_device *dev); 2522extern void netdev_rx_csum_fault(struct net_device *dev);
2274#else 2523#else
@@ -2295,22 +2544,26 @@ extern char *netdev_drivername(const struct net_device *dev, char *buffer, int l
2295 2544
2296extern void linkwatch_run_queue(void); 2545extern void linkwatch_run_queue(void);
2297 2546
2298unsigned long netdev_increment_features(unsigned long all, unsigned long one, 2547static inline u32 netdev_get_wanted_features(struct net_device *dev)
2299 unsigned long mask); 2548{
2300unsigned long netdev_fix_features(unsigned long features, const char *name); 2549 return (dev->features & ~dev->hw_features) | dev->wanted_features;
2550}
2551u32 netdev_increment_features(u32 all, u32 one, u32 mask);
2552u32 netdev_fix_features(struct net_device *dev, u32 features);
2553void netdev_update_features(struct net_device *dev);
2301 2554
2302void netif_stacked_transfer_operstate(const struct net_device *rootdev, 2555void netif_stacked_transfer_operstate(const struct net_device *rootdev,
2303 struct net_device *dev); 2556 struct net_device *dev);
2304 2557
2305int netif_skb_features(struct sk_buff *skb); 2558u32 netif_skb_features(struct sk_buff *skb);
2306 2559
2307static inline int net_gso_ok(int features, int gso_type) 2560static inline int net_gso_ok(u32 features, int gso_type)
2308{ 2561{
2309 int feature = gso_type << NETIF_F_GSO_SHIFT; 2562 int feature = gso_type << NETIF_F_GSO_SHIFT;
2310 return (features & feature) == feature; 2563 return (features & feature) == feature;
2311} 2564}
2312 2565
2313static inline int skb_gso_ok(struct sk_buff *skb, int features) 2566static inline int skb_gso_ok(struct sk_buff *skb, u32 features)
2314{ 2567{
2315 return net_gso_ok(features, skb_shinfo(skb)->gso_type) && 2568 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
2316 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST)); 2569 (!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
@@ -2328,15 +2581,9 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
2328 dev->gso_max_size = size; 2581 dev->gso_max_size = size;
2329} 2582}
2330 2583
2331extern int __skb_bond_should_drop(struct sk_buff *skb, 2584static inline int netif_is_bond_slave(struct net_device *dev)
2332 struct net_device *master);
2333
2334static inline int skb_bond_should_drop(struct sk_buff *skb,
2335 struct net_device *master)
2336{ 2585{
2337 if (master) 2586 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2338 return __skb_bond_should_drop(skb, master);
2339 return 0;
2340} 2587}
2341 2588
2342extern struct pernet_operations __net_initdata loopback_net_ops; 2589extern struct pernet_operations __net_initdata loopback_net_ops;
@@ -2351,6 +2598,8 @@ static inline int dev_ethtool_get_settings(struct net_device *dev,
2351 2598
2352static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev) 2599static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
2353{ 2600{
2601 if (dev->hw_features & NETIF_F_RXCSUM)
2602 return !!(dev->features & NETIF_F_RXCSUM);
2354 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum) 2603 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
2355 return 0; 2604 return 0;
2356 return dev->ethtool_ops->get_rx_csum(dev); 2605 return dev->ethtool_ops->get_rx_csum(dev);
@@ -2392,6 +2641,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...)
2392extern int netdev_info(const struct net_device *dev, const char *format, ...) 2641extern int netdev_info(const struct net_device *dev, const char *format, ...)
2393 __attribute__ ((format (printf, 2, 3))); 2642 __attribute__ ((format (printf, 2, 3)));
2394 2643
2644#define MODULE_ALIAS_NETDEV(device) \
2645 MODULE_ALIAS("netdev-" device)
2646
2395#if defined(DEBUG) 2647#if defined(DEBUG)
2396#define netdev_dbg(__dev, format, args...) \ 2648#define netdev_dbg(__dev, format, args...) \
2397 netdev_printk(KERN_DEBUG, __dev, format, ##args) 2649 netdev_printk(KERN_DEBUG, __dev, format, ##args)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1893837b3966..eeec00abb664 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -24,16 +24,20 @@
24#define NF_MAX_VERDICT NF_STOP 24#define NF_MAX_VERDICT NF_STOP
25 25
26/* we overload the higher bits for encoding auxiliary data such as the queue 26/* we overload the higher bits for encoding auxiliary data such as the queue
27 * number. Not nice, but better than additional function arguments. */ 27 * number or errno values. Not nice, but better than additional function
28#define NF_VERDICT_MASK 0x0000ffff 28 * arguments. */
29#define NF_VERDICT_BITS 16 29#define NF_VERDICT_MASK 0x000000ff
30
31/* extra verdict flags have mask 0x0000ff00 */
32#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000
30 33
34/* queue number (NF_QUEUE) or errno (NF_DROP) */
31#define NF_VERDICT_QMASK 0xffff0000 35#define NF_VERDICT_QMASK 0xffff0000
32#define NF_VERDICT_QBITS 16 36#define NF_VERDICT_QBITS 16
33 37
34#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE) 38#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
35 39
36#define NF_DROP_ERR(x) (((-x) << NF_VERDICT_BITS) | NF_DROP) 40#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
37 41
38/* only for userspace compatibility */ 42/* only for userspace compatibility */
39#ifndef __KERNEL__ 43#ifndef __KERNEL__
@@ -41,6 +45,9 @@
41 <= 0x2000 is used for protocol-flags. */ 45 <= 0x2000 is used for protocol-flags. */
42#define NFC_UNKNOWN 0x4000 46#define NFC_UNKNOWN 0x4000
43#define NFC_ALTERED 0x8000 47#define NFC_ALTERED 0x8000
48
49/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
50#define NF_VERDICT_BITS 16
44#endif 51#endif
45 52
46enum nf_inet_hooks { 53enum nf_inet_hooks {
@@ -72,6 +79,10 @@ union nf_inet_addr {
72 79
73#ifdef __KERNEL__ 80#ifdef __KERNEL__
74#ifdef CONFIG_NETFILTER 81#ifdef CONFIG_NETFILTER
82static inline int NF_DROP_GETERR(int verdict)
83{
84 return -(verdict >> NF_VERDICT_QBITS);
85}
75 86
76static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, 87static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
77 const union nf_inet_addr *a2) 88 const union nf_inet_addr *a2)
@@ -267,7 +278,7 @@ struct nf_afinfo {
267 int route_key_size; 278 int route_key_size;
268}; 279};
269 280
270extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO]; 281extern const struct nf_afinfo __rcu *nf_afinfo[NFPROTO_NUMPROTO];
271static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) 282static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
272{ 283{
273 return rcu_dereference(nf_afinfo[family]); 284 return rcu_dereference(nf_afinfo[family]);
@@ -357,9 +368,9 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
357#endif /*CONFIG_NETFILTER*/ 368#endif /*CONFIG_NETFILTER*/
358 369
359#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 370#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
360extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *); 371extern void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *) __rcu;
361extern void nf_ct_attach(struct sk_buff *, struct sk_buff *); 372extern void nf_ct_attach(struct sk_buff *, struct sk_buff *);
362extern void (*nf_ct_destroy)(struct nf_conntrack *); 373extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
363#else 374#else
364static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 375static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
365#endif 376#endif
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 9d40effe7ca7..a1b410c76fc3 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -1,3 +1,5 @@
1header-y += ipset/
2
1header-y += nf_conntrack_common.h 3header-y += nf_conntrack_common.h
2header-y += nf_conntrack_ftp.h 4header-y += nf_conntrack_ftp.h
3header-y += nf_conntrack_sctp.h 5header-y += nf_conntrack_sctp.h
@@ -9,6 +11,7 @@ header-y += nfnetlink_conntrack.h
9header-y += nfnetlink_log.h 11header-y += nfnetlink_log.h
10header-y += nfnetlink_queue.h 12header-y += nfnetlink_queue.h
11header-y += x_tables.h 13header-y += x_tables.h
14header-y += xt_AUDIT.h
12header-y += xt_CHECKSUM.h 15header-y += xt_CHECKSUM.h
13header-y += xt_CLASSIFY.h 16header-y += xt_CLASSIFY.h
14header-y += xt_CONNMARK.h 17header-y += xt_CONNMARK.h
@@ -26,6 +29,7 @@ header-y += xt_TCPMSS.h
26header-y += xt_TCPOPTSTRIP.h 29header-y += xt_TCPOPTSTRIP.h
27header-y += xt_TEE.h 30header-y += xt_TEE.h
28header-y += xt_TPROXY.h 31header-y += xt_TPROXY.h
32header-y += xt_addrtype.h
29header-y += xt_cluster.h 33header-y += xt_cluster.h
30header-y += xt_comment.h 34header-y += xt_comment.h
31header-y += xt_connbytes.h 35header-y += xt_connbytes.h
@@ -34,6 +38,7 @@ header-y += xt_connmark.h
34header-y += xt_conntrack.h 38header-y += xt_conntrack.h
35header-y += xt_cpu.h 39header-y += xt_cpu.h
36header-y += xt_dccp.h 40header-y += xt_dccp.h
41header-y += xt_devgroup.h
37header-y += xt_dscp.h 42header-y += xt_dscp.h
38header-y += xt_esp.h 43header-y += xt_esp.h
39header-y += xt_hashlimit.h 44header-y += xt_hashlimit.h
@@ -54,7 +59,9 @@ header-y += xt_quota.h
54header-y += xt_rateest.h 59header-y += xt_rateest.h
55header-y += xt_realm.h 60header-y += xt_realm.h
56header-y += xt_recent.h 61header-y += xt_recent.h
62header-y += xt_set.h
57header-y += xt_sctp.h 63header-y += xt_sctp.h
64header-y += xt_socket.h
58header-y += xt_state.h 65header-y += xt_state.h
59header-y += xt_statistic.h 66header-y += xt_statistic.h
60header-y += xt_string.h 67header-y += xt_string.h
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild
new file mode 100644
index 000000000000..601fe71d34d5
--- /dev/null
+++ b/include/linux/netfilter/ipset/Kbuild
@@ -0,0 +1,4 @@
1header-y += ip_set.h
2header-y += ip_set_bitmap.h
3header-y += ip_set_hash.h
4header-y += ip_set_list.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
new file mode 100644
index 000000000000..ec333d83f3b4
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -0,0 +1,452 @@
1#ifndef _IP_SET_H
2#define _IP_SET_H
3
4/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
5 * Patrick Schaaf <bof@bof.de>
6 * Martin Josefsson <gandalf@wlug.westbo.se>
7 * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13
14/* The protocol version */
15#define IPSET_PROTOCOL 6
16
17/* The max length of strings including NUL: set and type identifiers */
18#define IPSET_MAXNAMELEN 32
19
20/* Message types and commands */
21enum ipset_cmd {
22 IPSET_CMD_NONE,
23 IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
24 IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
25 IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
26 IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
27 IPSET_CMD_RENAME, /* 5: Rename a set */
28 IPSET_CMD_SWAP, /* 6: Swap two sets */
29 IPSET_CMD_LIST, /* 7: List sets */
30 IPSET_CMD_SAVE, /* 8: Save sets */
31 IPSET_CMD_ADD, /* 9: Add an element to a set */
32 IPSET_CMD_DEL, /* 10: Delete an element from a set */
33 IPSET_CMD_TEST, /* 11: Test an element in a set */
34 IPSET_CMD_HEADER, /* 12: Get set header data only */
35 IPSET_CMD_TYPE, /* 13: Get set type */
36 IPSET_MSG_MAX, /* Netlink message commands */
37
38 /* Commands in userspace: */
39 IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
40 IPSET_CMD_HELP, /* 15: Get help */
41 IPSET_CMD_VERSION, /* 16: Get program version */
42 IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
43
44 IPSET_CMD_MAX,
45
46 IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
47};
48
49/* Attributes at command level */
50enum {
51 IPSET_ATTR_UNSPEC,
52 IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
53 IPSET_ATTR_SETNAME, /* 2: Name of the set */
54 IPSET_ATTR_TYPENAME, /* 3: Typename */
55 IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
56 IPSET_ATTR_REVISION, /* 4: Settype revision */
57 IPSET_ATTR_FAMILY, /* 5: Settype family */
58 IPSET_ATTR_FLAGS, /* 6: Flags at command level */
59 IPSET_ATTR_DATA, /* 7: Nested attributes */
60 IPSET_ATTR_ADT, /* 8: Multiple data containers */
61 IPSET_ATTR_LINENO, /* 9: Restore lineno */
62 IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
63 IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
64 __IPSET_ATTR_CMD_MAX,
65};
66#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
67
68/* CADT specific attributes */
69enum {
70 IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
71 IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
72 IPSET_ATTR_IP_TO, /* 2 */
73 IPSET_ATTR_CIDR, /* 3 */
74 IPSET_ATTR_PORT, /* 4 */
75 IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
76 IPSET_ATTR_PORT_TO, /* 5 */
77 IPSET_ATTR_TIMEOUT, /* 6 */
78 IPSET_ATTR_PROTO, /* 7 */
79 IPSET_ATTR_CADT_FLAGS, /* 8 */
80 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
81 /* Reserve empty slots */
82 IPSET_ATTR_CADT_MAX = 16,
83 /* Create-only specific attributes */
84 IPSET_ATTR_GC,
85 IPSET_ATTR_HASHSIZE,
86 IPSET_ATTR_MAXELEM,
87 IPSET_ATTR_NETMASK,
88 IPSET_ATTR_PROBES,
89 IPSET_ATTR_RESIZE,
90 IPSET_ATTR_SIZE,
91 /* Kernel-only */
92 IPSET_ATTR_ELEMENTS,
93 IPSET_ATTR_REFERENCES,
94 IPSET_ATTR_MEMSIZE,
95
96 __IPSET_ATTR_CREATE_MAX,
97};
98#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
99
100/* ADT specific attributes */
101enum {
102 IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
103 IPSET_ATTR_NAME,
104 IPSET_ATTR_NAMEREF,
105 IPSET_ATTR_IP2,
106 IPSET_ATTR_CIDR2,
107 __IPSET_ATTR_ADT_MAX,
108};
109#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
110
111/* IP specific attributes */
112enum {
113 IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
114 IPSET_ATTR_IPADDR_IPV6,
115 __IPSET_ATTR_IPADDR_MAX,
116};
117#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
118
119/* Error codes */
120enum ipset_errno {
121 IPSET_ERR_PRIVATE = 4096,
122 IPSET_ERR_PROTOCOL,
123 IPSET_ERR_FIND_TYPE,
124 IPSET_ERR_MAX_SETS,
125 IPSET_ERR_BUSY,
126 IPSET_ERR_EXIST_SETNAME2,
127 IPSET_ERR_TYPE_MISMATCH,
128 IPSET_ERR_EXIST,
129 IPSET_ERR_INVALID_CIDR,
130 IPSET_ERR_INVALID_NETMASK,
131 IPSET_ERR_INVALID_FAMILY,
132 IPSET_ERR_TIMEOUT,
133 IPSET_ERR_REFERENCED,
134 IPSET_ERR_IPADDR_IPV4,
135 IPSET_ERR_IPADDR_IPV6,
136
137 /* Type specific error codes */
138 IPSET_ERR_TYPE_SPECIFIC = 4352,
139};
140
141/* Flags at command level */
142enum ipset_cmd_flags {
143 IPSET_FLAG_BIT_EXIST = 0,
144 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
145};
146
147/* Flags at CADT attribute level */
148enum ipset_cadt_flags {
149 IPSET_FLAG_BIT_BEFORE = 0,
150 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
151};
152
153/* Commands with settype-specific attributes */
154enum ipset_adt {
155 IPSET_ADD,
156 IPSET_DEL,
157 IPSET_TEST,
158 IPSET_ADT_MAX,
159 IPSET_CREATE = IPSET_ADT_MAX,
160 IPSET_CADT_MAX,
161};
162
163#ifdef __KERNEL__
164#include <linux/ip.h>
165#include <linux/ipv6.h>
166#include <linux/netlink.h>
167#include <linux/netfilter.h>
168#include <linux/vmalloc.h>
169#include <net/netlink.h>
170
171/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
172 * and IPSET_INVALID_ID if you want to increase the max number of sets.
173 */
174typedef u16 ip_set_id_t;
175
176#define IPSET_INVALID_ID 65535
177
178enum ip_set_dim {
179 IPSET_DIM_ZERO = 0,
180 IPSET_DIM_ONE,
181 IPSET_DIM_TWO,
182 IPSET_DIM_THREE,
183 /* Max dimension in elements.
184 * If changed, new revision of iptables match/target is required.
185 */
186 IPSET_DIM_MAX = 6,
187};
188
189/* Option flags for kernel operations */
190enum ip_set_kopt {
191 IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
192 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
193 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
194 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
195};
196
197/* Set features */
198enum ip_set_feature {
199 IPSET_TYPE_IP_FLAG = 0,
200 IPSET_TYPE_IP = (1 << IPSET_TYPE_IP_FLAG),
201 IPSET_TYPE_PORT_FLAG = 1,
202 IPSET_TYPE_PORT = (1 << IPSET_TYPE_PORT_FLAG),
203 IPSET_TYPE_MAC_FLAG = 2,
204 IPSET_TYPE_MAC = (1 << IPSET_TYPE_MAC_FLAG),
205 IPSET_TYPE_IP2_FLAG = 3,
206 IPSET_TYPE_IP2 = (1 << IPSET_TYPE_IP2_FLAG),
207 IPSET_TYPE_NAME_FLAG = 4,
208 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
209 /* Strictly speaking not a feature, but a flag for dumping:
210 * this settype must be dumped last */
211 IPSET_DUMP_LAST_FLAG = 7,
212 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
213};
214
215struct ip_set;
216
217typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout);
218
219/* Set type, variant-specific part */
220struct ip_set_type_variant {
221 /* Kernelspace: test/add/del entries
222 * returns negative error code,
223 * zero for no match/success to add/delete
224 * positive for matching element */
225 int (*kadt)(struct ip_set *set, const struct sk_buff * skb,
226 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
227
228 /* Userspace: test/add/del entries
229 * returns negative error code,
230 * zero for no match/success to add/delete
231 * positive for matching element */
232 int (*uadt)(struct ip_set *set, struct nlattr *tb[],
233 enum ipset_adt adt, u32 *lineno, u32 flags);
234
235 /* Low level add/del/test functions */
236 ipset_adtfn adt[IPSET_ADT_MAX];
237
238 /* When adding entries and set is full, try to resize the set */
239 int (*resize)(struct ip_set *set, bool retried);
240 /* Destroy the set */
241 void (*destroy)(struct ip_set *set);
242 /* Flush the elements */
243 void (*flush)(struct ip_set *set);
244 /* Expire entries before listing */
245 void (*expire)(struct ip_set *set);
246 /* List set header data */
247 int (*head)(struct ip_set *set, struct sk_buff *skb);
248 /* List elements */
249 int (*list)(const struct ip_set *set, struct sk_buff *skb,
250 struct netlink_callback *cb);
251
252 /* Return true if "b" set is the same as "a"
253 * according to the create set parameters */
254 bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
255};
256
257/* The core set type structure */
258struct ip_set_type {
259 struct list_head list;
260
261 /* Typename */
262 char name[IPSET_MAXNAMELEN];
263 /* Protocol version */
264 u8 protocol;
265 /* Set features to control swapping */
266 u8 features;
267 /* Set type dimension */
268 u8 dimension;
269 /* Supported family: may be AF_UNSPEC for both AF_INET/AF_INET6 */
270 u8 family;
271 /* Type revision */
272 u8 revision;
273
274 /* Create set */
275 int (*create)(struct ip_set *set, struct nlattr *tb[], u32 flags);
276
277 /* Attribute policies */
278 const struct nla_policy create_policy[IPSET_ATTR_CREATE_MAX + 1];
279 const struct nla_policy adt_policy[IPSET_ATTR_ADT_MAX + 1];
280
281 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
282 struct module *me;
283};
284
285/* register and unregister set type */
286extern int ip_set_type_register(struct ip_set_type *set_type);
287extern void ip_set_type_unregister(struct ip_set_type *set_type);
288
289/* A generic IP set */
290struct ip_set {
291 /* The name of the set */
292 char name[IPSET_MAXNAMELEN];
293 /* Lock protecting the set data */
294 rwlock_t lock;
295 /* References to the set */
296 atomic_t ref;
297 /* The core set type */
298 struct ip_set_type *type;
299 /* The type variant doing the real job */
300 const struct ip_set_type_variant *variant;
301 /* The actual INET family of the set */
302 u8 family;
303 /* The type specific data */
304 void *data;
305};
306
307/* register and unregister set references */
308extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);
309extern void ip_set_put_byindex(ip_set_id_t index);
310extern const char * ip_set_name_byindex(ip_set_id_t index);
311extern ip_set_id_t ip_set_nfnl_get(const char *name);
312extern ip_set_id_t ip_set_nfnl_get_byindex(ip_set_id_t index);
313extern void ip_set_nfnl_put(ip_set_id_t index);
314
315/* API for iptables set match, and SET target */
316extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,
317 u8 family, u8 dim, u8 flags);
318extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,
319 u8 family, u8 dim, u8 flags);
320extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,
321 u8 family, u8 dim, u8 flags);
322
323/* Utility functions */
324extern void * ip_set_alloc(size_t size);
325extern void ip_set_free(void *members);
326extern int ip_set_get_ipaddr4(struct nlattr *nla, __be32 *ipaddr);
327extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr);
328
329static inline int
330ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr)
331{
332 __be32 ip;
333 int ret = ip_set_get_ipaddr4(nla, &ip);
334
335 if (ret)
336 return ret;
337 *ipaddr = ntohl(ip);
338 return 0;
339}
340
341/* Ignore IPSET_ERR_EXIST errors if asked to do so? */
342static inline bool
343ip_set_eexist(int ret, u32 flags)
344{
345 return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST);
346}
347
348/* Check the NLA_F_NET_BYTEORDER flag */
349static inline bool
350ip_set_attr_netorder(struct nlattr *tb[], int type)
351{
352 return tb[type] && (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
353}
354
355static inline bool
356ip_set_optattr_netorder(struct nlattr *tb[], int type)
357{
358 return !tb[type] || (tb[type]->nla_type & NLA_F_NET_BYTEORDER);
359}
360
361/* Useful converters */
362static inline u32
363ip_set_get_h32(const struct nlattr *attr)
364{
365 return ntohl(nla_get_be32(attr));
366}
367
368static inline u16
369ip_set_get_h16(const struct nlattr *attr)
370{
371 return ntohs(nla_get_be16(attr));
372}
373
374#define ipset_nest_start(skb, attr) nla_nest_start(skb, attr | NLA_F_NESTED)
375#define ipset_nest_end(skb, start) nla_nest_end(skb, start)
376
377#define NLA_PUT_IPADDR4(skb, type, ipaddr) \
378do { \
379 struct nlattr *__nested = ipset_nest_start(skb, type); \
380 \
381 if (!__nested) \
382 goto nla_put_failure; \
383 NLA_PUT_NET32(skb, IPSET_ATTR_IPADDR_IPV4, ipaddr); \
384 ipset_nest_end(skb, __nested); \
385} while (0)
386
387#define NLA_PUT_IPADDR6(skb, type, ipaddrptr) \
388do { \
389 struct nlattr *__nested = ipset_nest_start(skb, type); \
390 \
391 if (!__nested) \
392 goto nla_put_failure; \
393 NLA_PUT(skb, IPSET_ATTR_IPADDR_IPV6, \
394 sizeof(struct in6_addr), ipaddrptr); \
395 ipset_nest_end(skb, __nested); \
396} while (0)
397
398/* Get address from skbuff */
399static inline __be32
400ip4addr(const struct sk_buff *skb, bool src)
401{
402 return src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
403}
404
405static inline void
406ip4addrptr(const struct sk_buff *skb, bool src, __be32 *addr)
407{
408 *addr = src ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr;
409}
410
411static inline void
412ip6addrptr(const struct sk_buff *skb, bool src, struct in6_addr *addr)
413{
414 memcpy(addr, src ? &ipv6_hdr(skb)->saddr : &ipv6_hdr(skb)->daddr,
415 sizeof(*addr));
416}
417
418/* Calculate the bytes required to store the inclusive range of a-b */
419static inline int
420bitmap_bytes(u32 a, u32 b)
421{
422 return 4 * ((((b - a + 8) / 8) + 3) / 4);
423}
424
425/* Interface to iptables/ip6tables */
426
427#define SO_IP_SET 83
428
429union ip_set_name_index {
430 char name[IPSET_MAXNAMELEN];
431 ip_set_id_t index;
432};
433
434#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
435struct ip_set_req_get_set {
436 unsigned op;
437 unsigned version;
438 union ip_set_name_index set;
439};
440
441#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
442/* Uses ip_set_req_get_set */
443
444#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
445struct ip_set_req_version {
446 unsigned op;
447 unsigned version;
448};
449
450#endif /* __KERNEL__ */
451
452#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
new file mode 100644
index 000000000000..ec9d9bea1e37
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -0,0 +1,1074 @@
1#ifndef _IP_SET_AHASH_H
2#define _IP_SET_AHASH_H
3
4#include <linux/rcupdate.h>
5#include <linux/jhash.h>
6#include <linux/netfilter/ipset/ip_set_timeout.h>
7
8/* Hashing which uses arrays to resolve clashing. The hash table is resized
9 * (doubled) when searching becomes too long.
10 * Internally jhash is used with the assumption that the size of the
11 * stored data is a multiple of sizeof(u32). If storage supports timeout,
12 * the timeout field must be the last one in the data structure - that field
13 * is ignored when computing the hash key.
14 *
15 * Readers and resizing
16 *
17 * Resizing can be triggered by userspace command only, and those
18 * are serialized by the nfnl mutex. During resizing the set is
19 * read-locked, so the only possible concurrent operations are
20 * the kernel side readers. Those must be protected by proper RCU locking.
21 */
22
23/* Number of elements to store in an initial array block */
24#define AHASH_INIT_SIZE 4
25/* Max number of elements to store in an array block */
26#define AHASH_MAX_SIZE (3*4)
27
28/* A hash bucket */
29struct hbucket {
30 void *value; /* the array of the values */
31 u8 size; /* size of the array */
32 u8 pos; /* position of the first free entry */
33};
34
35/* The hash table: the table size stored here in order to make resizing easy */
36struct htable {
37 u8 htable_bits; /* size of hash table == 2^htable_bits */
38 struct hbucket bucket[0]; /* hashtable buckets */
39};
40
41#define hbucket(h, i) &((h)->bucket[i])
42
43/* Book-keeping of the prefixes added to the set */
44struct ip_set_hash_nets {
45 u8 cidr; /* the different cidr values in the set */
46 u32 nets; /* number of elements per cidr */
47};
48
49/* The generic ip_set hash structure */
50struct ip_set_hash {
51 struct htable *table; /* the hash table */
52 u32 maxelem; /* max elements in the hash */
53 u32 elements; /* current element (vs timeout) */
54 u32 initval; /* random jhash init value */
55 u32 timeout; /* timeout value, if enabled */
56 struct timer_list gc; /* garbage collection when timeout enabled */
57#ifdef IP_SET_HASH_WITH_NETMASK
58 u8 netmask; /* netmask value for subnets to store */
59#endif
60#ifdef IP_SET_HASH_WITH_NETS
61 struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */
62#endif
63};
64
65/* Compute htable_bits from the user input parameter hashsize */
66static u8
67htable_bits(u32 hashsize)
68{
69 /* Assume that hashsize == 2^htable_bits */
70 u8 bits = fls(hashsize - 1);
71 if (jhash_size(bits) != hashsize)
72 /* Round up to the first 2^n value */
73 bits = fls(hashsize);
74
75 return bits;
76}
77
78#ifdef IP_SET_HASH_WITH_NETS
79
80#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
81
82/* Network cidr size book keeping when the hash stores different
83 * sized networks */
84static void
85add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
86{
87 u8 i;
88
89 ++h->nets[cidr-1].nets;
90
91 pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
92
93 if (h->nets[cidr-1].nets > 1)
94 return;
95
96 /* New cidr size */
97 for (i = 0; i < host_mask && h->nets[i].cidr; i++) {
98 /* Add in increasing prefix order, so larger cidr first */
99 if (h->nets[i].cidr < cidr)
100 swap(h->nets[i].cidr, cidr);
101 }
102 if (i < host_mask)
103 h->nets[i].cidr = cidr;
104}
105
106static void
107del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask)
108{
109 u8 i;
110
111 --h->nets[cidr-1].nets;
112
113 pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets);
114
115 if (h->nets[cidr-1].nets != 0)
116 return;
117
118 /* All entries with this cidr size deleted, so cleanup h->cidr[] */
119 for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) {
120 if (h->nets[i].cidr == cidr)
121 h->nets[i].cidr = cidr = h->nets[i+1].cidr;
122 }
123 h->nets[i - 1].cidr = 0;
124}
125#endif
126
127/* Destroy the hashtable part of the set */
128static void
129ahash_destroy(struct htable *t)
130{
131 struct hbucket *n;
132 u32 i;
133
134 for (i = 0; i < jhash_size(t->htable_bits); i++) {
135 n = hbucket(t, i);
136 if (n->size)
137 /* FIXME: use slab cache */
138 kfree(n->value);
139 }
140
141 ip_set_free(t);
142}
143
144/* Calculate the actual memory size of the set data */
145static size_t
146ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask)
147{
148 u32 i;
149 struct htable *t = h->table;
150 size_t memsize = sizeof(*h)
151 + sizeof(*t)
152#ifdef IP_SET_HASH_WITH_NETS
153 + sizeof(struct ip_set_hash_nets) * host_mask
154#endif
155 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
156
157 for (i = 0; i < jhash_size(t->htable_bits); i++)
158 memsize += t->bucket[i].size * dsize;
159
160 return memsize;
161}
162
163/* Flush a hash type of set: destroy all elements */
164static void
165ip_set_hash_flush(struct ip_set *set)
166{
167 struct ip_set_hash *h = set->data;
168 struct htable *t = h->table;
169 struct hbucket *n;
170 u32 i;
171
172 for (i = 0; i < jhash_size(t->htable_bits); i++) {
173 n = hbucket(t, i);
174 if (n->size) {
175 n->size = n->pos = 0;
176 /* FIXME: use slab cache */
177 kfree(n->value);
178 }
179 }
180#ifdef IP_SET_HASH_WITH_NETS
181 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
182 * SET_HOST_MASK(set->family));
183#endif
184 h->elements = 0;
185}
186
187/* Destroy a hash type of set */
188static void
189ip_set_hash_destroy(struct ip_set *set)
190{
191 struct ip_set_hash *h = set->data;
192
193 if (with_timeout(h->timeout))
194 del_timer_sync(&h->gc);
195
196 ahash_destroy(h->table);
197 kfree(h);
198
199 set->data = NULL;
200}
201
202#define HKEY(data, initval, htable_bits) \
203(jhash2((u32 *)(data), sizeof(struct type_pf_elem)/sizeof(u32), initval) \
204 & jhash_mask(htable_bits))
205
206#endif /* _IP_SET_AHASH_H */
207
208#define CONCAT(a, b, c) a##b##c
209#define TOKEN(a, b, c) CONCAT(a, b, c)
210
211/* Type/family dependent function prototypes */
212
213#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
214#define type_pf_data_isnull TOKEN(TYPE, PF, _data_isnull)
215#define type_pf_data_copy TOKEN(TYPE, PF, _data_copy)
216#define type_pf_data_zero_out TOKEN(TYPE, PF, _data_zero_out)
217#define type_pf_data_netmask TOKEN(TYPE, PF, _data_netmask)
218#define type_pf_data_list TOKEN(TYPE, PF, _data_list)
219#define type_pf_data_tlist TOKEN(TYPE, PF, _data_tlist)
220
221#define type_pf_elem TOKEN(TYPE, PF, _elem)
222#define type_pf_telem TOKEN(TYPE, PF, _telem)
223#define type_pf_data_timeout TOKEN(TYPE, PF, _data_timeout)
224#define type_pf_data_expired TOKEN(TYPE, PF, _data_expired)
225#define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set)
226
227#define type_pf_elem_add TOKEN(TYPE, PF, _elem_add)
228#define type_pf_add TOKEN(TYPE, PF, _add)
229#define type_pf_del TOKEN(TYPE, PF, _del)
230#define type_pf_test_cidrs TOKEN(TYPE, PF, _test_cidrs)
231#define type_pf_test TOKEN(TYPE, PF, _test)
232
233#define type_pf_elem_tadd TOKEN(TYPE, PF, _elem_tadd)
234#define type_pf_del_telem TOKEN(TYPE, PF, _ahash_del_telem)
235#define type_pf_expire TOKEN(TYPE, PF, _expire)
236#define type_pf_tadd TOKEN(TYPE, PF, _tadd)
237#define type_pf_tdel TOKEN(TYPE, PF, _tdel)
238#define type_pf_ttest_cidrs TOKEN(TYPE, PF, _ahash_ttest_cidrs)
239#define type_pf_ttest TOKEN(TYPE, PF, _ahash_ttest)
240
241#define type_pf_resize TOKEN(TYPE, PF, _resize)
242#define type_pf_tresize TOKEN(TYPE, PF, _tresize)
243#define type_pf_flush ip_set_hash_flush
244#define type_pf_destroy ip_set_hash_destroy
245#define type_pf_head TOKEN(TYPE, PF, _head)
246#define type_pf_list TOKEN(TYPE, PF, _list)
247#define type_pf_tlist TOKEN(TYPE, PF, _tlist)
248#define type_pf_same_set TOKEN(TYPE, PF, _same_set)
249#define type_pf_kadt TOKEN(TYPE, PF, _kadt)
250#define type_pf_uadt TOKEN(TYPE, PF, _uadt)
251#define type_pf_gc TOKEN(TYPE, PF, _gc)
252#define type_pf_gc_init TOKEN(TYPE, PF, _gc_init)
253#define type_pf_variant TOKEN(TYPE, PF, _variant)
254#define type_pf_tvariant TOKEN(TYPE, PF, _tvariant)
255
256/* Flavour without timeout */
257
258/* Get the ith element from the array block n */
259#define ahash_data(n, i) \
260 ((struct type_pf_elem *)((n)->value) + (i))
261
262/* Add an element to the hash table when resizing the set:
263 * we spare the maintenance of the internal counters. */
264static int
265type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value)
266{
267 if (n->pos >= n->size) {
268 void *tmp;
269
270 if (n->size >= AHASH_MAX_SIZE)
271 /* Trigger rehashing */
272 return -EAGAIN;
273
274 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
275 * sizeof(struct type_pf_elem),
276 GFP_ATOMIC);
277 if (!tmp)
278 return -ENOMEM;
279 if (n->size) {
280 memcpy(tmp, n->value,
281 sizeof(struct type_pf_elem) * n->size);
282 kfree(n->value);
283 }
284 n->value = tmp;
285 n->size += AHASH_INIT_SIZE;
286 }
287 type_pf_data_copy(ahash_data(n, n->pos++), value);
288 return 0;
289}
290
291/* Resize a hash: create a new hash table with doubling the hashsize
292 * and inserting the elements to it. Repeat until we succeed or
293 * fail due to memory pressures. */
294static int
295type_pf_resize(struct ip_set *set, bool retried)
296{
297 struct ip_set_hash *h = set->data;
298 struct htable *t, *orig = h->table;
299 u8 htable_bits = orig->htable_bits;
300 const struct type_pf_elem *data;
301 struct hbucket *n, *m;
302 u32 i, j;
303 int ret;
304
305retry:
306 ret = 0;
307 htable_bits++;
308 pr_debug("attempt to resize set %s from %u to %u, t %p\n",
309 set->name, orig->htable_bits, htable_bits, orig);
310 if (!htable_bits)
311 /* In case we have plenty of memory :-) */
312 return -IPSET_ERR_HASH_FULL;
313 t = ip_set_alloc(sizeof(*t)
314 + jhash_size(htable_bits) * sizeof(struct hbucket));
315 if (!t)
316 return -ENOMEM;
317 t->htable_bits = htable_bits;
318
319 read_lock_bh(&set->lock);
320 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
321 n = hbucket(orig, i);
322 for (j = 0; j < n->pos; j++) {
323 data = ahash_data(n, j);
324 m = hbucket(t, HKEY(data, h->initval, htable_bits));
325 ret = type_pf_elem_add(m, data);
326 if (ret < 0) {
327 read_unlock_bh(&set->lock);
328 ahash_destroy(t);
329 if (ret == -EAGAIN)
330 goto retry;
331 return ret;
332 }
333 }
334 }
335
336 rcu_assign_pointer(h->table, t);
337 read_unlock_bh(&set->lock);
338
339 /* Give time to other readers of the set */
340 synchronize_rcu_bh();
341
342 pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
343 orig->htable_bits, orig, t->htable_bits, t);
344 ahash_destroy(orig);
345
346 return 0;
347}
348
349/* Add an element to a hash and update the internal counters when succeeded,
350 * otherwise report the proper error code. */
351static int
352type_pf_add(struct ip_set *set, void *value, u32 timeout)
353{
354 struct ip_set_hash *h = set->data;
355 struct htable *t;
356 const struct type_pf_elem *d = value;
357 struct hbucket *n;
358 int i, ret = 0;
359 u32 key;
360
361 if (h->elements >= h->maxelem)
362 return -IPSET_ERR_HASH_FULL;
363
364 rcu_read_lock_bh();
365 t = rcu_dereference_bh(h->table);
366 key = HKEY(value, h->initval, t->htable_bits);
367 n = hbucket(t, key);
368 for (i = 0; i < n->pos; i++)
369 if (type_pf_data_equal(ahash_data(n, i), d)) {
370 ret = -IPSET_ERR_EXIST;
371 goto out;
372 }
373
374 ret = type_pf_elem_add(n, value);
375 if (ret != 0)
376 goto out;
377
378#ifdef IP_SET_HASH_WITH_NETS
379 add_cidr(h, d->cidr, HOST_MASK);
380#endif
381 h->elements++;
382out:
383 rcu_read_unlock_bh();
384 return ret;
385}
386
387/* Delete an element from the hash: swap it with the last element
388 * and free up space if possible.
389 */
390static int
391type_pf_del(struct ip_set *set, void *value, u32 timeout)
392{
393 struct ip_set_hash *h = set->data;
394 struct htable *t = h->table;
395 const struct type_pf_elem *d = value;
396 struct hbucket *n;
397 int i;
398 struct type_pf_elem *data;
399 u32 key;
400
401 key = HKEY(value, h->initval, t->htable_bits);
402 n = hbucket(t, key);
403 for (i = 0; i < n->pos; i++) {
404 data = ahash_data(n, i);
405 if (!type_pf_data_equal(data, d))
406 continue;
407 if (i != n->pos - 1)
408 /* Not last one */
409 type_pf_data_copy(data, ahash_data(n, n->pos - 1));
410
411 n->pos--;
412 h->elements--;
413#ifdef IP_SET_HASH_WITH_NETS
414 del_cidr(h, d->cidr, HOST_MASK);
415#endif
416 if (n->pos + AHASH_INIT_SIZE < n->size) {
417 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
418 * sizeof(struct type_pf_elem),
419 GFP_ATOMIC);
420 if (!tmp)
421 return 0;
422 n->size -= AHASH_INIT_SIZE;
423 memcpy(tmp, n->value,
424 n->size * sizeof(struct type_pf_elem));
425 kfree(n->value);
426 n->value = tmp;
427 }
428 return 0;
429 }
430
431 return -IPSET_ERR_EXIST;
432}
433
434#ifdef IP_SET_HASH_WITH_NETS
435
436/* Special test function which takes into account the different network
437 * sizes added to the set */
438static int
439type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
440{
441 struct ip_set_hash *h = set->data;
442 struct htable *t = h->table;
443 struct hbucket *n;
444 const struct type_pf_elem *data;
445 int i, j = 0;
446 u32 key;
447 u8 host_mask = SET_HOST_MASK(set->family);
448
449 pr_debug("test by nets\n");
450 for (; j < host_mask && h->nets[j].cidr; j++) {
451 type_pf_data_netmask(d, h->nets[j].cidr);
452 key = HKEY(d, h->initval, t->htable_bits);
453 n = hbucket(t, key);
454 for (i = 0; i < n->pos; i++) {
455 data = ahash_data(n, i);
456 if (type_pf_data_equal(data, d))
457 return 1;
458 }
459 }
460 return 0;
461}
462#endif
463
464/* Test whether the element is added to the set */
465static int
466type_pf_test(struct ip_set *set, void *value, u32 timeout)
467{
468 struct ip_set_hash *h = set->data;
469 struct htable *t = h->table;
470 struct type_pf_elem *d = value;
471 struct hbucket *n;
472 const struct type_pf_elem *data;
473 int i;
474 u32 key;
475
476#ifdef IP_SET_HASH_WITH_NETS
477 /* If we test an IP address and not a network address,
478 * try all possible network sizes */
479 if (d->cidr == SET_HOST_MASK(set->family))
480 return type_pf_test_cidrs(set, d, timeout);
481#endif
482
483 key = HKEY(d, h->initval, t->htable_bits);
484 n = hbucket(t, key);
485 for (i = 0; i < n->pos; i++) {
486 data = ahash_data(n, i);
487 if (type_pf_data_equal(data, d))
488 return 1;
489 }
490 return 0;
491}
492
493/* Reply a HEADER request: fill out the header part of the set */
494static int
495type_pf_head(struct ip_set *set, struct sk_buff *skb)
496{
497 const struct ip_set_hash *h = set->data;
498 struct nlattr *nested;
499 size_t memsize;
500
501 read_lock_bh(&set->lock);
502 memsize = ahash_memsize(h, with_timeout(h->timeout)
503 ? sizeof(struct type_pf_telem)
504 : sizeof(struct type_pf_elem),
505 set->family == AF_INET ? 32 : 128);
506 read_unlock_bh(&set->lock);
507
508 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
509 if (!nested)
510 goto nla_put_failure;
511 NLA_PUT_NET32(skb, IPSET_ATTR_HASHSIZE,
512 htonl(jhash_size(h->table->htable_bits)));
513 NLA_PUT_NET32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem));
514#ifdef IP_SET_HASH_WITH_NETMASK
515 if (h->netmask != HOST_MASK)
516 NLA_PUT_U8(skb, IPSET_ATTR_NETMASK, h->netmask);
517#endif
518 NLA_PUT_NET32(skb, IPSET_ATTR_REFERENCES,
519 htonl(atomic_read(&set->ref) - 1));
520 NLA_PUT_NET32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize));
521 if (with_timeout(h->timeout))
522 NLA_PUT_NET32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout));
523 ipset_nest_end(skb, nested);
524
525 return 0;
526nla_put_failure:
527 return -EMSGSIZE;
528}
529
530/* Reply a LIST/SAVE request: dump the elements of the specified set */
531static int
532type_pf_list(const struct ip_set *set,
533 struct sk_buff *skb, struct netlink_callback *cb)
534{
535 const struct ip_set_hash *h = set->data;
536 const struct htable *t = h->table;
537 struct nlattr *atd, *nested;
538 const struct hbucket *n;
539 const struct type_pf_elem *data;
540 u32 first = cb->args[2];
541 /* We assume that one hash bucket fills into one page */
542 void *incomplete;
543 int i;
544
545 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
546 if (!atd)
547 return -EMSGSIZE;
548 pr_debug("list hash set %s\n", set->name);
549 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
550 incomplete = skb_tail_pointer(skb);
551 n = hbucket(t, cb->args[2]);
552 pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n);
553 for (i = 0; i < n->pos; i++) {
554 data = ahash_data(n, i);
555 pr_debug("list hash %lu hbucket %p i %u, data %p\n",
556 cb->args[2], n, i, data);
557 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
558 if (!nested) {
559 if (cb->args[2] == first) {
560 nla_nest_cancel(skb, atd);
561 return -EMSGSIZE;
562 } else
563 goto nla_put_failure;
564 }
565 if (type_pf_data_list(skb, data))
566 goto nla_put_failure;
567 ipset_nest_end(skb, nested);
568 }
569 }
570 ipset_nest_end(skb, atd);
571 /* Set listing finished */
572 cb->args[2] = 0;
573
574 return 0;
575
576nla_put_failure:
577 nlmsg_trim(skb, incomplete);
578 ipset_nest_end(skb, atd);
579 if (unlikely(first == cb->args[2])) {
580 pr_warning("Can't list set %s: one bucket does not fit into "
581 "a message. Please report it!\n", set->name);
582 cb->args[2] = 0;
583 return -EMSGSIZE;
584 }
585 return 0;
586}
587
588static int
589type_pf_kadt(struct ip_set *set, const struct sk_buff * skb,
590 enum ipset_adt adt, u8 pf, u8 dim, u8 flags);
591static int
592type_pf_uadt(struct ip_set *set, struct nlattr *tb[],
593 enum ipset_adt adt, u32 *lineno, u32 flags);
594
595static const struct ip_set_type_variant type_pf_variant = {
596 .kadt = type_pf_kadt,
597 .uadt = type_pf_uadt,
598 .adt = {
599 [IPSET_ADD] = type_pf_add,
600 [IPSET_DEL] = type_pf_del,
601 [IPSET_TEST] = type_pf_test,
602 },
603 .destroy = type_pf_destroy,
604 .flush = type_pf_flush,
605 .head = type_pf_head,
606 .list = type_pf_list,
607 .resize = type_pf_resize,
608 .same_set = type_pf_same_set,
609};
610
611/* Flavour with timeout support */
612
613#define ahash_tdata(n, i) \
614 (struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i))
615
616static inline u32
617type_pf_data_timeout(const struct type_pf_elem *data)
618{
619 const struct type_pf_telem *tdata =
620 (const struct type_pf_telem *) data;
621
622 return tdata->timeout;
623}
624
625static inline bool
626type_pf_data_expired(const struct type_pf_elem *data)
627{
628 const struct type_pf_telem *tdata =
629 (const struct type_pf_telem *) data;
630
631 return ip_set_timeout_expired(tdata->timeout);
632}
633
634static inline void
635type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout)
636{
637 struct type_pf_telem *tdata = (struct type_pf_telem *) data;
638
639 tdata->timeout = ip_set_timeout_set(timeout);
640}
641
642static int
643type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
644 u32 timeout)
645{
646 struct type_pf_elem *data;
647
648 if (n->pos >= n->size) {
649 void *tmp;
650
651 if (n->size >= AHASH_MAX_SIZE)
652 /* Trigger rehashing */
653 return -EAGAIN;
654
655 tmp = kzalloc((n->size + AHASH_INIT_SIZE)
656 * sizeof(struct type_pf_telem),
657 GFP_ATOMIC);
658 if (!tmp)
659 return -ENOMEM;
660 if (n->size) {
661 memcpy(tmp, n->value,
662 sizeof(struct type_pf_telem) * n->size);
663 kfree(n->value);
664 }
665 n->value = tmp;
666 n->size += AHASH_INIT_SIZE;
667 }
668 data = ahash_tdata(n, n->pos++);
669 type_pf_data_copy(data, value);
670 type_pf_data_timeout_set(data, timeout);
671 return 0;
672}
673
674/* Delete expired elements from the hashtable */
675static void
676type_pf_expire(struct ip_set_hash *h)
677{
678 struct htable *t = h->table;
679 struct hbucket *n;
680 struct type_pf_elem *data;
681 u32 i;
682 int j;
683
684 for (i = 0; i < jhash_size(t->htable_bits); i++) {
685 n = hbucket(t, i);
686 for (j = 0; j < n->pos; j++) {
687 data = ahash_tdata(n, j);
688 if (type_pf_data_expired(data)) {
689 pr_debug("expired %u/%u\n", i, j);
690#ifdef IP_SET_HASH_WITH_NETS
691 del_cidr(h, data->cidr, HOST_MASK);
692#endif
693 if (j != n->pos - 1)
694 /* Not last one */
695 type_pf_data_copy(data,
696 ahash_tdata(n, n->pos - 1));
697 n->pos--;
698 h->elements--;
699 }
700 }
701 if (n->pos + AHASH_INIT_SIZE < n->size) {
702 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
703 * sizeof(struct type_pf_telem),
704 GFP_ATOMIC);
705 if (!tmp)
706 /* Still try to delete expired elements */
707 continue;
708 n->size -= AHASH_INIT_SIZE;
709 memcpy(tmp, n->value,
710 n->size * sizeof(struct type_pf_telem));
711 kfree(n->value);
712 n->value = tmp;
713 }
714 }
715}
716
717static int
718type_pf_tresize(struct ip_set *set, bool retried)
719{
720 struct ip_set_hash *h = set->data;
721 struct htable *t, *orig = h->table;
722 u8 htable_bits = orig->htable_bits;
723 const struct type_pf_elem *data;
724 struct hbucket *n, *m;
725 u32 i, j;
726 int ret;
727
728 /* Try to cleanup once */
729 if (!retried) {
730 i = h->elements;
731 write_lock_bh(&set->lock);
732 type_pf_expire(set->data);
733 write_unlock_bh(&set->lock);
734 if (h->elements < i)
735 return 0;
736 }
737
738retry:
739 ret = 0;
740 htable_bits++;
741 if (!htable_bits)
742 /* In case we have plenty of memory :-) */
743 return -IPSET_ERR_HASH_FULL;
744 t = ip_set_alloc(sizeof(*t)
745 + jhash_size(htable_bits) * sizeof(struct hbucket));
746 if (!t)
747 return -ENOMEM;
748 t->htable_bits = htable_bits;
749
750 read_lock_bh(&set->lock);
751 for (i = 0; i < jhash_size(orig->htable_bits); i++) {
752 n = hbucket(orig, i);
753 for (j = 0; j < n->pos; j++) {
754 data = ahash_tdata(n, j);
755 m = hbucket(t, HKEY(data, h->initval, htable_bits));
756 ret = type_pf_elem_tadd(m, data,
757 type_pf_data_timeout(data));
758 if (ret < 0) {
759 read_unlock_bh(&set->lock);
760 ahash_destroy(t);
761 if (ret == -EAGAIN)
762 goto retry;
763 return ret;
764 }
765 }
766 }
767
768 rcu_assign_pointer(h->table, t);
769 read_unlock_bh(&set->lock);
770
771 /* Give time to other readers of the set */
772 synchronize_rcu_bh();
773
774 ahash_destroy(orig);
775
776 return 0;
777}
778
779static int
780type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
781{
782 struct ip_set_hash *h = set->data;
783 struct htable *t = h->table;
784 const struct type_pf_elem *d = value;
785 struct hbucket *n;
786 struct type_pf_elem *data;
787 int ret = 0, i, j = AHASH_MAX_SIZE + 1;
788 u32 key;
789
790 if (h->elements >= h->maxelem)
791 /* FIXME: when set is full, we slow down here */
792 type_pf_expire(h);
793 if (h->elements >= h->maxelem)
794 return -IPSET_ERR_HASH_FULL;
795
796 rcu_read_lock_bh();
797 t = rcu_dereference_bh(h->table);
798 key = HKEY(d, h->initval, t->htable_bits);
799 n = hbucket(t, key);
800 for (i = 0; i < n->pos; i++) {
801 data = ahash_tdata(n, i);
802 if (type_pf_data_equal(data, d)) {
803 if (type_pf_data_expired(data))
804 j = i;
805 else {
806 ret = -IPSET_ERR_EXIST;
807 goto out;
808 }
809 } else if (j == AHASH_MAX_SIZE + 1 &&
810 type_pf_data_expired(data))
811 j = i;
812 }
813 if (j != AHASH_MAX_SIZE + 1) {
814 data = ahash_tdata(n, j);
815#ifdef IP_SET_HASH_WITH_NETS
816 del_cidr(h, data->cidr, HOST_MASK);
817 add_cidr(h, d->cidr, HOST_MASK);
818#endif
819 type_pf_data_copy(data, d);
820 type_pf_data_timeout_set(data, timeout);
821 goto out;
822 }
823 ret = type_pf_elem_tadd(n, d, timeout);
824 if (ret != 0)
825 goto out;
826
827#ifdef IP_SET_HASH_WITH_NETS
828 add_cidr(h, d->cidr, HOST_MASK);
829#endif
830 h->elements++;
831out:
832 rcu_read_unlock_bh();
833 return ret;
834}
835
836static int
837type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
838{
839 struct ip_set_hash *h = set->data;
840 struct htable *t = h->table;
841 const struct type_pf_elem *d = value;
842 struct hbucket *n;
843 int i, ret = 0;
844 struct type_pf_elem *data;
845 u32 key;
846
847 key = HKEY(value, h->initval, t->htable_bits);
848 n = hbucket(t, key);
849 for (i = 0; i < n->pos; i++) {
850 data = ahash_tdata(n, i);
851 if (!type_pf_data_equal(data, d))
852 continue;
853 if (type_pf_data_expired(data))
854 ret = -IPSET_ERR_EXIST;
855 if (i != n->pos - 1)
856 /* Not last one */
857 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
858
859 n->pos--;
860 h->elements--;
861#ifdef IP_SET_HASH_WITH_NETS
862 del_cidr(h, d->cidr, HOST_MASK);
863#endif
864 if (n->pos + AHASH_INIT_SIZE < n->size) {
865 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
866 * sizeof(struct type_pf_telem),
867 GFP_ATOMIC);
868 if (!tmp)
869 return 0;
870 n->size -= AHASH_INIT_SIZE;
871 memcpy(tmp, n->value,
872 n->size * sizeof(struct type_pf_telem));
873 kfree(n->value);
874 n->value = tmp;
875 }
876 return 0;
877 }
878
879 return -IPSET_ERR_EXIST;
880}
881
882#ifdef IP_SET_HASH_WITH_NETS
883static int
884type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
885{
886 struct ip_set_hash *h = set->data;
887 struct htable *t = h->table;
888 struct type_pf_elem *data;
889 struct hbucket *n;
890 int i, j = 0;
891 u32 key;
892 u8 host_mask = SET_HOST_MASK(set->family);
893
894 for (; j < host_mask && h->nets[j].cidr; j++) {
895 type_pf_data_netmask(d, h->nets[j].cidr);
896 key = HKEY(d, h->initval, t->htable_bits);
897 n = hbucket(t, key);
898 for (i = 0; i < n->pos; i++) {
899 data = ahash_tdata(n, i);
900 if (type_pf_data_equal(data, d))
901 return !type_pf_data_expired(data);
902 }
903 }
904 return 0;
905}
906#endif
907
908static int
909type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
910{
911 struct ip_set_hash *h = set->data;
912 struct htable *t = h->table;
913 struct type_pf_elem *data, *d = value;
914 struct hbucket *n;
915 int i;
916 u32 key;
917
918#ifdef IP_SET_HASH_WITH_NETS
919 if (d->cidr == SET_HOST_MASK(set->family))
920 return type_pf_ttest_cidrs(set, d, timeout);
921#endif
922 key = HKEY(d, h->initval, t->htable_bits);
923 n = hbucket(t, key);
924 for (i = 0; i < n->pos; i++) {
925 data = ahash_tdata(n, i);
926 if (type_pf_data_equal(data, d))
927 return !type_pf_data_expired(data);
928 }
929 return 0;
930}
931
932static int
933type_pf_tlist(const struct ip_set *set,
934 struct sk_buff *skb, struct netlink_callback *cb)
935{
936 const struct ip_set_hash *h = set->data;
937 const struct htable *t = h->table;
938 struct nlattr *atd, *nested;
939 const struct hbucket *n;
940 const struct type_pf_elem *data;
941 u32 first = cb->args[2];
942 /* We assume that one hash bucket fills into one page */
943 void *incomplete;
944 int i;
945
946 atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
947 if (!atd)
948 return -EMSGSIZE;
949 for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
950 incomplete = skb_tail_pointer(skb);
951 n = hbucket(t, cb->args[2]);
952 for (i = 0; i < n->pos; i++) {
953 data = ahash_tdata(n, i);
954 pr_debug("list %p %u\n", n, i);
955 if (type_pf_data_expired(data))
956 continue;
957 pr_debug("do list %p %u\n", n, i);
958 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
959 if (!nested) {
960 if (cb->args[2] == first) {
961 nla_nest_cancel(skb, atd);
962 return -EMSGSIZE;
963 } else
964 goto nla_put_failure;
965 }
966 if (type_pf_data_tlist(skb, data))
967 goto nla_put_failure;
968 ipset_nest_end(skb, nested);
969 }
970 }
971 ipset_nest_end(skb, atd);
972 /* Set listing finished */
973 cb->args[2] = 0;
974
975 return 0;
976
977nla_put_failure:
978 nlmsg_trim(skb, incomplete);
979 ipset_nest_end(skb, atd);
980 if (unlikely(first == cb->args[2])) {
981 pr_warning("Can't list set %s: one bucket does not fit into "
982 "a message. Please report it!\n", set->name);
983 cb->args[2] = 0;
984 return -EMSGSIZE;
985 }
986 return 0;
987}
988
989static const struct ip_set_type_variant type_pf_tvariant = {
990 .kadt = type_pf_kadt,
991 .uadt = type_pf_uadt,
992 .adt = {
993 [IPSET_ADD] = type_pf_tadd,
994 [IPSET_DEL] = type_pf_tdel,
995 [IPSET_TEST] = type_pf_ttest,
996 },
997 .destroy = type_pf_destroy,
998 .flush = type_pf_flush,
999 .head = type_pf_head,
1000 .list = type_pf_tlist,
1001 .resize = type_pf_tresize,
1002 .same_set = type_pf_same_set,
1003};
1004
1005static void
1006type_pf_gc(unsigned long ul_set)
1007{
1008 struct ip_set *set = (struct ip_set *) ul_set;
1009 struct ip_set_hash *h = set->data;
1010
1011 pr_debug("called\n");
1012 write_lock_bh(&set->lock);
1013 type_pf_expire(h);
1014 write_unlock_bh(&set->lock);
1015
1016 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1017 add_timer(&h->gc);
1018}
1019
1020static void
1021type_pf_gc_init(struct ip_set *set)
1022{
1023 struct ip_set_hash *h = set->data;
1024
1025 init_timer(&h->gc);
1026 h->gc.data = (unsigned long) set;
1027 h->gc.function = type_pf_gc;
1028 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
1029 add_timer(&h->gc);
1030 pr_debug("gc initialized, run in every %u\n",
1031 IPSET_GC_PERIOD(h->timeout));
1032}
1033
1034#undef type_pf_data_equal
1035#undef type_pf_data_isnull
1036#undef type_pf_data_copy
1037#undef type_pf_data_zero_out
1038#undef type_pf_data_list
1039#undef type_pf_data_tlist
1040
1041#undef type_pf_elem
1042#undef type_pf_telem
1043#undef type_pf_data_timeout
1044#undef type_pf_data_expired
1045#undef type_pf_data_netmask
1046#undef type_pf_data_timeout_set
1047
1048#undef type_pf_elem_add
1049#undef type_pf_add
1050#undef type_pf_del
1051#undef type_pf_test_cidrs
1052#undef type_pf_test
1053
1054#undef type_pf_elem_tadd
1055#undef type_pf_expire
1056#undef type_pf_tadd
1057#undef type_pf_tdel
1058#undef type_pf_ttest_cidrs
1059#undef type_pf_ttest
1060
1061#undef type_pf_resize
1062#undef type_pf_tresize
1063#undef type_pf_flush
1064#undef type_pf_destroy
1065#undef type_pf_head
1066#undef type_pf_list
1067#undef type_pf_tlist
1068#undef type_pf_same_set
1069#undef type_pf_kadt
1070#undef type_pf_uadt
1071#undef type_pf_gc
1072#undef type_pf_gc_init
1073#undef type_pf_variant
1074#undef type_pf_tvariant
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h
new file mode 100644
index 000000000000..61a9e8746c83
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -0,0 +1,31 @@
1#ifndef __IP_SET_BITMAP_H
2#define __IP_SET_BITMAP_H
3
4/* Bitmap type specific error codes */
5enum {
6 /* The element is out of the range of the set */
7 IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
8 /* The range exceeds the size limit of the set type */
9 IPSET_ERR_BITMAP_RANGE_SIZE,
10};
11
12#ifdef __KERNEL__
13#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
14
15/* Common functions */
16
17static inline u32
18range_to_mask(u32 from, u32 to, u8 *bits)
19{
20 u32 mask = 0xFFFFFFFE;
21
22 *bits = 32;
23 while (--(*bits) > 0 && mask && (to & mask) != from)
24 mask <<= 1;
25
26 return mask;
27}
28
29#endif /* __KERNEL__ */
30
31#endif /* __IP_SET_BITMAP_H */
diff --git a/include/linux/netfilter/ipset/ip_set_getport.h b/include/linux/netfilter/ipset/ip_set_getport.h
new file mode 100644
index 000000000000..5aebd170f899
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_getport.h
@@ -0,0 +1,31 @@
1#ifndef _IP_SET_GETPORT_H
2#define _IP_SET_GETPORT_H
3
4extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
5 __be16 *port, u8 *proto);
6
7#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
8extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
9 __be16 *port, u8 *proto);
10#else
11static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
12 __be16 *port, u8 *proto)
13{
14 return false;
15}
16#endif
17
18extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
19 __be16 *port);
20
21static inline bool ip_set_proto_with_ports(u8 proto)
22{
23 switch (proto) {
24 case IPPROTO_TCP:
25 case IPPROTO_UDP:
26 return true;
27 }
28 return false;
29}
30
31#endif /*_IP_SET_GETPORT_H*/
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h
new file mode 100644
index 000000000000..b86f15c04524
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_hash.h
@@ -0,0 +1,26 @@
1#ifndef __IP_SET_HASH_H
2#define __IP_SET_HASH_H
3
4/* Hash type specific error codes */
5enum {
6 /* Hash is full */
7 IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
8 /* Null-valued element */
9 IPSET_ERR_HASH_ELEM,
10 /* Invalid protocol */
11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO,
14};
15
16#ifdef __KERNEL__
17
18#define IPSET_DEFAULT_HASHSIZE 1024
19#define IPSET_MIMINAL_HASHSIZE 64
20#define IPSET_DEFAULT_MAXELEM 65536
21#define IPSET_DEFAULT_PROBES 4
22#define IPSET_DEFAULT_RESIZE 100
23
24#endif /* __KERNEL__ */
25
26#endif /* __IP_SET_HASH_H */
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
new file mode 100644
index 000000000000..40a63f302613
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -0,0 +1,27 @@
1#ifndef __IP_SET_LIST_H
2#define __IP_SET_LIST_H
3
4/* List type specific error codes */
5enum {
6 /* Set name to be added/deleted/tested does not exist. */
7 IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
8 /* list:set type is not permitted to add */
9 IPSET_ERR_LOOP,
10 /* Missing reference set */
11 IPSET_ERR_BEFORE,
12 /* Reference set does not exist */
13 IPSET_ERR_NAMEREF,
14 /* Set is full */
15 IPSET_ERR_LIST_FULL,
16 /* Reference set is not added to the set */
17 IPSET_ERR_REF_EXIST,
18};
19
20#ifdef __KERNEL__
21
22#define IP_SET_LIST_DEFAULT_SIZE 8
23#define IP_SET_LIST_MIN_SIZE 4
24
25#endif /* __KERNEL__ */
26
27#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
new file mode 100644
index 000000000000..9f30c5f2ec1c
--- /dev/null
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -0,0 +1,127 @@
1#ifndef _IP_SET_TIMEOUT_H
2#define _IP_SET_TIMEOUT_H
3
4/* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
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
11#ifdef __KERNEL__
12
13/* How often should the gc be run by default */
14#define IPSET_GC_TIME (3 * 60)
15
16/* Timeout period depending on the timeout value of the given set */
17#define IPSET_GC_PERIOD(timeout) \
18 ((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1)
19
20/* Set is defined without timeout support: timeout value may be 0 */
21#define IPSET_NO_TIMEOUT UINT_MAX
22
23#define with_timeout(timeout) ((timeout) != IPSET_NO_TIMEOUT)
24
25static inline unsigned int
26ip_set_timeout_uget(struct nlattr *tb)
27{
28 unsigned int timeout = ip_set_get_h32(tb);
29
30 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
31 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
32}
33
34#ifdef IP_SET_BITMAP_TIMEOUT
35
36/* Bitmap specific timeout constants and macros for the entries */
37
38/* Bitmap entry is unset */
39#define IPSET_ELEM_UNSET 0
40/* Bitmap entry is set with no timeout value */
41#define IPSET_ELEM_PERMANENT (UINT_MAX/2)
42
43static inline bool
44ip_set_timeout_test(unsigned long timeout)
45{
46 return timeout != IPSET_ELEM_UNSET &&
47 (timeout == IPSET_ELEM_PERMANENT ||
48 time_after(timeout, jiffies));
49}
50
51static inline bool
52ip_set_timeout_expired(unsigned long timeout)
53{
54 return timeout != IPSET_ELEM_UNSET &&
55 timeout != IPSET_ELEM_PERMANENT &&
56 time_before(timeout, jiffies);
57}
58
59static inline unsigned long
60ip_set_timeout_set(u32 timeout)
61{
62 unsigned long t;
63
64 if (!timeout)
65 return IPSET_ELEM_PERMANENT;
66
67 t = timeout * HZ + jiffies;
68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT)
69 /* Bingo! */
70 t++;
71
72 return t;
73}
74
75static inline u32
76ip_set_timeout_get(unsigned long timeout)
77{
78 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
79}
80
81#else
82
83/* Hash specific timeout constants and macros for the entries */
84
85/* Hash entry is set with no timeout value */
86#define IPSET_ELEM_PERMANENT 0
87
88static inline bool
89ip_set_timeout_test(unsigned long timeout)
90{
91 return timeout == IPSET_ELEM_PERMANENT ||
92 time_after(timeout, jiffies);
93}
94
95static inline bool
96ip_set_timeout_expired(unsigned long timeout)
97{
98 return timeout != IPSET_ELEM_PERMANENT &&
99 time_before(timeout, jiffies);
100}
101
102static inline unsigned long
103ip_set_timeout_set(u32 timeout)
104{
105 unsigned long t;
106
107 if (!timeout)
108 return IPSET_ELEM_PERMANENT;
109
110 t = timeout * HZ + jiffies;
111 if (t == IPSET_ELEM_PERMANENT)
112 /* Bingo! :-) */
113 t++;
114
115 return t;
116}
117
118static inline u32
119ip_set_timeout_get(unsigned long timeout)
120{
121 return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ;
122}
123#endif /* ! IP_SET_BITMAP_TIMEOUT */
124
125#endif /* __KERNEL__ */
126
127#endif /* _IP_SET_TIMEOUT_H */
diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h
new file mode 100644
index 000000000000..0e1fb50da562
--- /dev/null
+++ b/include/linux/netfilter/ipset/pfxlen.h
@@ -0,0 +1,35 @@
1#ifndef _PFXLEN_H
2#define _PFXLEN_H
3
4#include <asm/byteorder.h>
5#include <linux/netfilter.h>
6
7/* Prefixlen maps, by Jan Engelhardt */
8extern const union nf_inet_addr ip_set_netmask_map[];
9extern const union nf_inet_addr ip_set_hostmask_map[];
10
11static inline __be32
12ip_set_netmask(u8 pfxlen)
13{
14 return ip_set_netmask_map[pfxlen].ip;
15}
16
17static inline const __be32 *
18ip_set_netmask6(u8 pfxlen)
19{
20 return &ip_set_netmask_map[pfxlen].ip6[0];
21}
22
23static inline u32
24ip_set_hostmask(u8 pfxlen)
25{
26 return (__force u32) ip_set_hostmask_map[pfxlen].ip;
27}
28
29static inline const __be32 *
30ip_set_hostmask6(u8 pfxlen)
31{
32 return &ip_set_hostmask_map[pfxlen].ip6[0];
33}
34
35#endif /*_PFXLEN_H */
diff --git a/include/linux/netfilter/nf_conntrack_snmp.h b/include/linux/netfilter/nf_conntrack_snmp.h
new file mode 100644
index 000000000000..064bc63a5346
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_snmp.h
@@ -0,0 +1,9 @@
1#ifndef _NF_CONNTRACK_SNMP_H
2#define _NF_CONNTRACK_SNMP_H
3
4extern int (*nf_nat_snmp_hook)(struct sk_buff *skb,
5 unsigned int protoff,
6 struct nf_conn *ct,
7 enum ip_conntrack_info ctinfo);
8
9#endif /* _NF_CONNTRACK_SNMP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 361d6b5630ee..2b11fc1a86be 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -47,7 +47,8 @@ struct nfgenmsg {
47#define NFNL_SUBSYS_QUEUE 3 47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_COUNT 6 50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_COUNT 7
51 52
52#ifdef __KERNEL__ 53#ifdef __KERNEL__
53 54
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 19711e3ffd42..debf1aefd753 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -42,6 +42,7 @@ enum ctattr_type {
42 CTA_SECMARK, /* obsolete */ 42 CTA_SECMARK, /* obsolete */
43 CTA_ZONE, 43 CTA_ZONE,
44 CTA_SECCTX, 44 CTA_SECCTX,
45 CTA_TIMESTAMP,
45 __CTA_MAX 46 __CTA_MAX
46}; 47};
47#define CTA_MAX (__CTA_MAX - 1) 48#define CTA_MAX (__CTA_MAX - 1)
@@ -127,6 +128,14 @@ enum ctattr_counters {
127}; 128};
128#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1) 129#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
129 130
131enum ctattr_tstamp {
132 CTA_TIMESTAMP_UNSPEC,
133 CTA_TIMESTAMP_START,
134 CTA_TIMESTAMP_STOP,
135 __CTA_TIMESTAMP_MAX
136};
137#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
138
130enum ctattr_nat { 139enum ctattr_nat {
131 CTA_NAT_UNSPEC, 140 CTA_NAT_UNSPEC,
132 CTA_NAT_MINIP, 141 CTA_NAT_MINIP,
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index ea9b8d380527..90c2c9575bac 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -28,8 +28,8 @@ struct nfulnl_msg_packet_hw {
28}; 28};
29 29
30struct nfulnl_msg_packet_timestamp { 30struct nfulnl_msg_packet_timestamp {
31 aligned_be64 sec; 31 __aligned_be64 sec;
32 aligned_be64 usec; 32 __aligned_be64 usec;
33}; 33};
34 34
35enum nfulnl_attr_type { 35enum nfulnl_attr_type {
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 2455fe5f4e01..af94e0014ebd 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -25,8 +25,8 @@ struct nfqnl_msg_packet_hw {
25}; 25};
26 26
27struct nfqnl_msg_packet_timestamp { 27struct nfqnl_msg_packet_timestamp {
28 aligned_be64 sec; 28 __aligned_be64 sec;
29 aligned_be64 usec; 29 __aligned_be64 usec;
30}; 30};
31 31
32enum nfqnl_attr_type { 32enum nfqnl_attr_type {
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 6712e713b299..37219525ff6f 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -611,8 +611,9 @@ struct _compat_xt_align {
611extern void xt_compat_lock(u_int8_t af); 611extern void xt_compat_lock(u_int8_t af);
612extern void xt_compat_unlock(u_int8_t af); 612extern void xt_compat_unlock(u_int8_t af);
613 613
614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta); 614extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
615extern void xt_compat_flush_offsets(u_int8_t af); 615extern void xt_compat_flush_offsets(u_int8_t af);
616extern void xt_compat_init_offsets(u_int8_t af, unsigned int number);
616extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); 617extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
617 618
618extern int xt_compat_match_offset(const struct xt_match *match); 619extern int xt_compat_match_offset(const struct xt_match *match);
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/linux/netfilter/xt_AUDIT.h
new file mode 100644
index 000000000000..38751d2ea52b
--- /dev/null
+++ b/include/linux/netfilter/xt_AUDIT.h
@@ -0,0 +1,30 @@
1/*
2 * Header file for iptables xt_AUDIT target
3 *
4 * (C) 2010-2011 Thomas Graf <tgraf@redhat.com>
5 * (C) 2010-2011 Red Hat, Inc.
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _XT_AUDIT_TARGET_H
13#define _XT_AUDIT_TARGET_H
14
15#include <linux/types.h>
16
17enum {
18 XT_AUDIT_TYPE_ACCEPT = 0,
19 XT_AUDIT_TYPE_DROP,
20 XT_AUDIT_TYPE_REJECT,
21 __XT_AUDIT_TYPE_MAX,
22};
23
24#define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1)
25
26struct xt_audit_info {
27 __u8 type; /* XT_AUDIT_TYPE_* */
28};
29
30#endif /* _XT_AUDIT_TARGET_H */
diff --git a/include/linux/netfilter/xt_CT.h b/include/linux/netfilter/xt_CT.h
index 1b564106891d..b56e76811c04 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/linux/netfilter/xt_CT.h
@@ -1,14 +1,16 @@
1#ifndef _XT_CT_H 1#ifndef _XT_CT_H
2#define _XT_CT_H 2#define _XT_CT_H
3 3
4#include <linux/types.h>
5
4#define XT_CT_NOTRACK 0x1 6#define XT_CT_NOTRACK 0x1
5 7
6struct xt_ct_target_info { 8struct xt_ct_target_info {
7 u_int16_t flags; 9 __u16 flags;
8 u_int16_t zone; 10 __u16 zone;
9 u_int32_t ct_events; 11 __u32 ct_events;
10 u_int32_t exp_events; 12 __u32 exp_events;
11 char helper[16]; 13 char helper[16];
12 14
13 /* Used internally by the kernel */ 15 /* Used internally by the kernel */
14 struct nf_conn *ct __attribute__((aligned(8))); 16 struct nf_conn *ct __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 2584f4a777de..9eafdbbb401c 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -20,4 +20,10 @@ struct xt_NFQ_info_v1 {
20 __u16 queues_total; 20 __u16 queues_total;
21}; 21};
22 22
23struct xt_NFQ_info_v2 {
24 __u16 queuenum;
25 __u16 queues_total;
26 __u16 bypass;
27};
28
23#endif /* _XT_NFQ_TARGET_H */ 29#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h
index 2db543214ff5..7157318499c2 100644
--- a/include/linux/netfilter/xt_TCPOPTSTRIP.h
+++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -1,13 +1,15 @@
1#ifndef _XT_TCPOPTSTRIP_H 1#ifndef _XT_TCPOPTSTRIP_H
2#define _XT_TCPOPTSTRIP_H 2#define _XT_TCPOPTSTRIP_H
3 3
4#include <linux/types.h>
5
4#define tcpoptstrip_set_bit(bmap, idx) \ 6#define tcpoptstrip_set_bit(bmap, idx) \
5 (bmap[(idx) >> 5] |= 1U << (idx & 31)) 7 (bmap[(idx) >> 5] |= 1U << (idx & 31))
6#define tcpoptstrip_test_bit(bmap, idx) \ 8#define tcpoptstrip_test_bit(bmap, idx) \
7 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) 9 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
8 10
9struct xt_tcpoptstrip_target_info { 11struct xt_tcpoptstrip_target_info {
10 u_int32_t strip_bmap[8]; 12 __u32 strip_bmap[8];
11}; 13};
12 14
13#endif /* _XT_TCPOPTSTRIP_H */ 15#endif /* _XT_TCPOPTSTRIP_H */
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h
index 3f3d69361289..902043c2073f 100644
--- a/include/linux/netfilter/xt_TPROXY.h
+++ b/include/linux/netfilter/xt_TPROXY.h
@@ -1,19 +1,21 @@
1#ifndef _XT_TPROXY_H 1#ifndef _XT_TPROXY_H
2#define _XT_TPROXY_H 2#define _XT_TPROXY_H
3 3
4#include <linux/types.h>
5
4/* TPROXY target is capable of marking the packet to perform 6/* TPROXY target is capable of marking the packet to perform
5 * redirection. We can get rid of that whenever we get support for 7 * redirection. We can get rid of that whenever we get support for
6 * mutliple targets in the same rule. */ 8 * mutliple targets in the same rule. */
7struct xt_tproxy_target_info { 9struct xt_tproxy_target_info {
8 u_int32_t mark_mask; 10 __u32 mark_mask;
9 u_int32_t mark_value; 11 __u32 mark_value;
10 __be32 laddr; 12 __be32 laddr;
11 __be16 lport; 13 __be16 lport;
12}; 14};
13 15
14struct xt_tproxy_target_info_v1 { 16struct xt_tproxy_target_info_v1 {
15 u_int32_t mark_mask; 17 __u32 mark_mask;
16 u_int32_t mark_value; 18 __u32 mark_value;
17 union nf_inet_addr laddr; 19 union nf_inet_addr laddr;
18 __be16 lport; 20 __be16 lport;
19}; 21};
diff --git a/include/linux/netfilter/xt_addrtype.h b/include/linux/netfilter/xt_addrtype.h
new file mode 100644
index 000000000000..b156baa9d55e
--- /dev/null
+++ b/include/linux/netfilter/xt_addrtype.h
@@ -0,0 +1,44 @@
1#ifndef _XT_ADDRTYPE_H
2#define _XT_ADDRTYPE_H
3
4#include <linux/types.h>
5
6enum {
7 XT_ADDRTYPE_INVERT_SOURCE = 0x0001,
8 XT_ADDRTYPE_INVERT_DEST = 0x0002,
9 XT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004,
10 XT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008,
11};
12
13
14/* rtn_type enum values from rtnetlink.h, but shifted */
15enum {
16 XT_ADDRTYPE_UNSPEC = 1 << 0,
17 XT_ADDRTYPE_UNICAST = 1 << 1, /* 1 << RTN_UNICAST */
18 XT_ADDRTYPE_LOCAL = 1 << 2, /* 1 << RTN_LOCAL, etc */
19 XT_ADDRTYPE_BROADCAST = 1 << 3,
20 XT_ADDRTYPE_ANYCAST = 1 << 4,
21 XT_ADDRTYPE_MULTICAST = 1 << 5,
22 XT_ADDRTYPE_BLACKHOLE = 1 << 6,
23 XT_ADDRTYPE_UNREACHABLE = 1 << 7,
24 XT_ADDRTYPE_PROHIBIT = 1 << 8,
25 XT_ADDRTYPE_THROW = 1 << 9,
26 XT_ADDRTYPE_NAT = 1 << 10,
27 XT_ADDRTYPE_XRESOLVE = 1 << 11,
28};
29
30struct xt_addrtype_info_v1 {
31 __u16 source; /* source-type mask */
32 __u16 dest; /* dest-type mask */
33 __u32 flags;
34};
35
36/* revision 0 */
37struct xt_addrtype_info {
38 __u16 source; /* source-type mask */
39 __u16 dest; /* dest-type mask */
40 __u32 invert_source;
41 __u32 invert_dest;
42};
43
44#endif
diff --git a/include/linux/netfilter/xt_cluster.h b/include/linux/netfilter/xt_cluster.h
index 886682656f09..9b883c8fbf54 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/linux/netfilter/xt_cluster.h
@@ -1,15 +1,17 @@
1#ifndef _XT_CLUSTER_MATCH_H 1#ifndef _XT_CLUSTER_MATCH_H
2#define _XT_CLUSTER_MATCH_H 2#define _XT_CLUSTER_MATCH_H
3 3
4#include <linux/types.h>
5
4enum xt_cluster_flags { 6enum xt_cluster_flags {
5 XT_CLUSTER_F_INV = (1 << 0) 7 XT_CLUSTER_F_INV = (1 << 0)
6}; 8};
7 9
8struct xt_cluster_match_info { 10struct xt_cluster_match_info {
9 u_int32_t total_nodes; 11 __u32 total_nodes;
10 u_int32_t node_mask; 12 __u32 node_mask;
11 u_int32_t hash_seed; 13 __u32 hash_seed;
12 u_int32_t flags; 14 __u32 flags;
13}; 15};
14 16
15#define XT_CLUSTER_NODES_MAX 32 17#define XT_CLUSTER_NODES_MAX 32
diff --git a/include/linux/netfilter/xt_comment.h b/include/linux/netfilter/xt_comment.h
index eacfedc6b5d0..0ea5e79f5bd7 100644
--- a/include/linux/netfilter/xt_comment.h
+++ b/include/linux/netfilter/xt_comment.h
@@ -4,7 +4,7 @@
4#define XT_MAX_COMMENT_LEN 256 4#define XT_MAX_COMMENT_LEN 256
5 5
6struct xt_comment_info { 6struct xt_comment_info {
7 unsigned char comment[XT_MAX_COMMENT_LEN]; 7 char comment[XT_MAX_COMMENT_LEN];
8}; 8};
9 9
10#endif /* XT_COMMENT_H */ 10#endif /* XT_COMMENT_H */
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/linux/netfilter/xt_connbytes.h
index 92fcbb0d193e..f1d6c15bd9e3 100644
--- a/include/linux/netfilter/xt_connbytes.h
+++ b/include/linux/netfilter/xt_connbytes.h
@@ -17,8 +17,8 @@ enum xt_connbytes_direction {
17 17
18struct xt_connbytes_info { 18struct xt_connbytes_info {
19 struct { 19 struct {
20 aligned_u64 from; /* count to be matched */ 20 __aligned_u64 from; /* count to be matched */
21 aligned_u64 to; /* count to be matched */ 21 __aligned_u64 to; /* count to be matched */
22 } count; 22 } count;
23 __u8 what; /* ipt_connbytes_what */ 23 __u8 what; /* ipt_connbytes_what */
24 __u8 direction; /* ipt_connbytes_direction */ 24 __u8 direction; /* ipt_connbytes_direction */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 7e3284bcbd2b..0ca66e97acbc 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -1,8 +1,15 @@
1#ifndef _XT_CONNLIMIT_H 1#ifndef _XT_CONNLIMIT_H
2#define _XT_CONNLIMIT_H 2#define _XT_CONNLIMIT_H
3 3
4#include <linux/types.h>
5
4struct xt_connlimit_data; 6struct xt_connlimit_data;
5 7
8enum {
9 XT_CONNLIMIT_INVERT = 1 << 0,
10 XT_CONNLIMIT_DADDR = 1 << 1,
11};
12
6struct xt_connlimit_info { 13struct xt_connlimit_info {
7 union { 14 union {
8 union nf_inet_addr mask; 15 union nf_inet_addr mask;
@@ -13,7 +20,14 @@ struct xt_connlimit_info {
13 }; 20 };
14#endif 21#endif
15 }; 22 };
16 unsigned int limit, inverse; 23 unsigned int limit;
24 union {
25 /* revision 0 */
26 unsigned int inverse;
27
28 /* revision 1 */
29 __u32 flags;
30 };
17 31
18 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
19 struct xt_connlimit_data *data __attribute__((aligned(8))); 33 struct xt_connlimit_data *data __attribute__((aligned(8)));
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 54f47a2f6152..74b904d8f99c 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -58,4 +58,19 @@ struct xt_conntrack_mtinfo2 {
58 __u16 state_mask, status_mask; 58 __u16 state_mask, status_mask;
59}; 59};
60 60
61struct xt_conntrack_mtinfo3 {
62 union nf_inet_addr origsrc_addr, origsrc_mask;
63 union nf_inet_addr origdst_addr, origdst_mask;
64 union nf_inet_addr replsrc_addr, replsrc_mask;
65 union nf_inet_addr repldst_addr, repldst_mask;
66 __u32 expires_min, expires_max;
67 __u16 l4proto;
68 __u16 origsrc_port, origdst_port;
69 __u16 replsrc_port, repldst_port;
70 __u16 match_flags, invert_flags;
71 __u16 state_mask, status_mask;
72 __u16 origsrc_port_high, origdst_port_high;
73 __u16 replsrc_port_high, repldst_port_high;
74};
75
61#endif /*_XT_CONNTRACK_H*/ 76#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/linux/netfilter/xt_devgroup.h
new file mode 100644
index 000000000000..1babde0ec900
--- /dev/null
+++ b/include/linux/netfilter/xt_devgroup.h
@@ -0,0 +1,21 @@
1#ifndef _XT_DEVGROUP_H
2#define _XT_DEVGROUP_H
3
4#include <linux/types.h>
5
6enum xt_devgroup_flags {
7 XT_DEVGROUP_MATCH_SRC = 0x1,
8 XT_DEVGROUP_INVERT_SRC = 0x2,
9 XT_DEVGROUP_MATCH_DST = 0x4,
10 XT_DEVGROUP_INVERT_DST = 0x8,
11};
12
13struct xt_devgroup_info {
14 __u32 flags;
15 __u32 src_group;
16 __u32 src_mask;
17 __u32 dst_group;
18 __u32 dst_mask;
19};
20
21#endif /* _XT_DEVGROUP_H */
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index b0d28c659ab7..9314723f39ca 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -1,6 +1,8 @@
1#ifndef _XT_QUOTA_H 1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H 2#define _XT_QUOTA_H
3 3
4#include <linux/types.h>
5
4enum xt_quota_flags { 6enum xt_quota_flags {
5 XT_QUOTA_INVERT = 0x1, 7 XT_QUOTA_INVERT = 0x1,
6}; 8};
@@ -9,9 +11,9 @@ enum xt_quota_flags {
9struct xt_quota_priv; 11struct xt_quota_priv;
10 12
11struct xt_quota_info { 13struct xt_quota_info {
12 u_int32_t flags; 14 __u32 flags;
13 u_int32_t pad; 15 __u32 pad;
14 aligned_u64 quota; 16 __aligned_u64 quota;
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 struct xt_quota_priv *master; 19 struct xt_quota_priv *master;
diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
new file mode 100644
index 000000000000..081f1ded2842
--- /dev/null
+++ b/include/linux/netfilter/xt_set.h
@@ -0,0 +1,56 @@
1#ifndef _XT_SET_H
2#define _XT_SET_H
3
4#include <linux/types.h>
5#include <linux/netfilter/ipset/ip_set.h>
6
7/* Revision 0 interface: backward compatible with netfilter/iptables */
8
9/*
10 * Option flags for kernel operations (xt_set_info_v0)
11 */
12#define IPSET_SRC 0x01 /* Source match/add */
13#define IPSET_DST 0x02 /* Destination match/add */
14#define IPSET_MATCH_INV 0x04 /* Inverse matching */
15
16struct xt_set_info_v0 {
17 ip_set_id_t index;
18 union {
19 __u32 flags[IPSET_DIM_MAX + 1];
20 struct {
21 __u32 __flags[IPSET_DIM_MAX];
22 __u8 dim;
23 __u8 flags;
24 } compat;
25 } u;
26};
27
28/* match and target infos */
29struct xt_set_info_match_v0 {
30 struct xt_set_info_v0 match_set;
31};
32
33struct xt_set_info_target_v0 {
34 struct xt_set_info_v0 add_set;
35 struct xt_set_info_v0 del_set;
36};
37
38/* Revision 1: current interface to netfilter/iptables */
39
40struct xt_set_info {
41 ip_set_id_t index;
42 __u8 dim;
43 __u8 flags;
44};
45
46/* match and target infos */
47struct xt_set_info_match {
48 struct xt_set_info match_set;
49};
50
51struct xt_set_info_target {
52 struct xt_set_info add_set;
53 struct xt_set_info del_set;
54};
55
56#endif /*_XT_SET_H*/
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 6f475b8ff34b..26d7217bd4f1 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -1,6 +1,8 @@
1#ifndef _XT_SOCKET_H 1#ifndef _XT_SOCKET_H
2#define _XT_SOCKET_H 2#define _XT_SOCKET_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 XT_SOCKET_TRANSPARENT = 1 << 0, 7 XT_SOCKET_TRANSPARENT = 1 << 0,
6}; 8};
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
index 14b6df412c9f..7c37fac576c4 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/linux/netfilter/xt_time.h
@@ -1,14 +1,16 @@
1#ifndef _XT_TIME_H 1#ifndef _XT_TIME_H
2#define _XT_TIME_H 1 2#define _XT_TIME_H 1
3 3
4#include <linux/types.h>
5
4struct xt_time_info { 6struct xt_time_info {
5 u_int32_t date_start; 7 __u32 date_start;
6 u_int32_t date_stop; 8 __u32 date_stop;
7 u_int32_t daytime_start; 9 __u32 daytime_start;
8 u_int32_t daytime_stop; 10 __u32 daytime_stop;
9 u_int32_t monthdays_match; 11 __u32 monthdays_match;
10 u_int8_t weekdays_match; 12 __u8 weekdays_match;
11 u_int8_t flags; 13 __u8 flags;
12}; 14};
13 15
14enum { 16enum {
diff --git a/include/linux/netfilter/xt_u32.h b/include/linux/netfilter/xt_u32.h
index 9947f56cdbdd..04d1bfea03c2 100644
--- a/include/linux/netfilter/xt_u32.h
+++ b/include/linux/netfilter/xt_u32.h
@@ -1,6 +1,8 @@
1#ifndef _XT_U32_H 1#ifndef _XT_U32_H
2#define _XT_U32_H 1 2#define _XT_U32_H 1
3 3
4#include <linux/types.h>
5
4enum xt_u32_ops { 6enum xt_u32_ops {
5 XT_U32_AND, 7 XT_U32_AND,
6 XT_U32_LEFTSH, 8 XT_U32_LEFTSH,
@@ -9,13 +11,13 @@ enum xt_u32_ops {
9}; 11};
10 12
11struct xt_u32_location_element { 13struct xt_u32_location_element {
12 u_int32_t number; 14 __u32 number;
13 u_int8_t nextop; 15 __u8 nextop;
14}; 16};
15 17
16struct xt_u32_value_element { 18struct xt_u32_value_element {
17 u_int32_t min; 19 __u32 min;
18 u_int32_t max; 20 __u32 max;
19}; 21};
20 22
21/* 23/*
@@ -27,14 +29,14 @@ struct xt_u32_value_element {
27struct xt_u32_test { 29struct xt_u32_test {
28 struct xt_u32_location_element location[XT_U32_MAXSIZE+1]; 30 struct xt_u32_location_element location[XT_U32_MAXSIZE+1];
29 struct xt_u32_value_element value[XT_U32_MAXSIZE+1]; 31 struct xt_u32_value_element value[XT_U32_MAXSIZE+1];
30 u_int8_t nnums; 32 __u8 nnums;
31 u_int8_t nvalues; 33 __u8 nvalues;
32}; 34};
33 35
34struct xt_u32 { 36struct xt_u32 {
35 struct xt_u32_test tests[XT_U32_MAXSIZE+1]; 37 struct xt_u32_test tests[XT_U32_MAXSIZE+1];
36 u_int8_t ntests; 38 __u8 ntests;
37 u_int8_t invert; 39 __u8 invert;
38}; 40};
39 41
40#endif /* _XT_U32_H */ 42#endif /* _XT_U32_H */
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index c73ef0b18bdc..be5be1577a56 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_802_3_H 1#ifndef __LINUX_BRIDGE_EBT_802_3_H
2#define __LINUX_BRIDGE_EBT_802_3_H 2#define __LINUX_BRIDGE_EBT_802_3_H
3 3
4#include <linux/types.h>
5
4#define EBT_802_3_SAP 0x01 6#define EBT_802_3_SAP 0x01
5#define EBT_802_3_TYPE 0x02 7#define EBT_802_3_TYPE 0x02
6 8
@@ -24,24 +26,24 @@
24 26
25/* ui has one byte ctrl, ni has two */ 27/* ui has one byte ctrl, ni has two */
26struct hdr_ui { 28struct hdr_ui {
27 uint8_t dsap; 29 __u8 dsap;
28 uint8_t ssap; 30 __u8 ssap;
29 uint8_t ctrl; 31 __u8 ctrl;
30 uint8_t orig[3]; 32 __u8 orig[3];
31 __be16 type; 33 __be16 type;
32}; 34};
33 35
34struct hdr_ni { 36struct hdr_ni {
35 uint8_t dsap; 37 __u8 dsap;
36 uint8_t ssap; 38 __u8 ssap;
37 __be16 ctrl; 39 __be16 ctrl;
38 uint8_t orig[3]; 40 __u8 orig[3];
39 __be16 type; 41 __be16 type;
40}; 42};
41 43
42struct ebt_802_3_hdr { 44struct ebt_802_3_hdr {
43 uint8_t daddr[6]; 45 __u8 daddr[6];
44 uint8_t saddr[6]; 46 __u8 saddr[6];
45 __be16 len; 47 __be16 len;
46 union { 48 union {
47 struct hdr_ui ui; 49 struct hdr_ui ui;
@@ -59,10 +61,10 @@ static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
59#endif 61#endif
60 62
61struct ebt_802_3_info { 63struct ebt_802_3_info {
62 uint8_t sap; 64 __u8 sap;
63 __be16 type; 65 __be16 type;
64 uint8_t bitmask; 66 __u8 bitmask;
65 uint8_t invflags; 67 __u8 invflags;
66}; 68};
67 69
68#endif 70#endif
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/linux/netfilter_bridge/ebt_among.h
index 0009558609a7..bd4e3ad0b706 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/linux/netfilter_bridge/ebt_among.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_AMONG_H 1#ifndef __LINUX_BRIDGE_EBT_AMONG_H
2#define __LINUX_BRIDGE_EBT_AMONG_H 2#define __LINUX_BRIDGE_EBT_AMONG_H
3 3
4#include <linux/types.h>
5
4#define EBT_AMONG_DST 0x01 6#define EBT_AMONG_DST 0x01
5#define EBT_AMONG_SRC 0x02 7#define EBT_AMONG_SRC 0x02
6 8
@@ -30,7 +32,7 @@
30 */ 32 */
31 33
32struct ebt_mac_wormhash_tuple { 34struct ebt_mac_wormhash_tuple {
33 uint32_t cmp[2]; 35 __u32 cmp[2];
34 __be32 ip; 36 __be32 ip;
35}; 37};
36 38
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/linux/netfilter_bridge/ebt_arp.h
index cbf4843b6b0f..522f3e427f49 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/linux/netfilter_bridge/ebt_arp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_ARP_H 1#ifndef __LINUX_BRIDGE_EBT_ARP_H
2#define __LINUX_BRIDGE_EBT_ARP_H 2#define __LINUX_BRIDGE_EBT_ARP_H
3 3
4#include <linux/types.h>
5
4#define EBT_ARP_OPCODE 0x01 6#define EBT_ARP_OPCODE 0x01
5#define EBT_ARP_HTYPE 0x02 7#define EBT_ARP_HTYPE 0x02
6#define EBT_ARP_PTYPE 0x04 8#define EBT_ARP_PTYPE 0x04
@@ -27,8 +29,8 @@ struct ebt_arp_info
27 unsigned char smmsk[ETH_ALEN]; 29 unsigned char smmsk[ETH_ALEN];
28 unsigned char dmaddr[ETH_ALEN]; 30 unsigned char dmaddr[ETH_ALEN];
29 unsigned char dmmsk[ETH_ALEN]; 31 unsigned char dmmsk[ETH_ALEN];
30 uint8_t bitmask; 32 __u8 bitmask;
31 uint8_t invflags; 33 __u8 invflags;
32}; 34};
33 35
34#endif 36#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/linux/netfilter_bridge/ebt_ip.h
index 6a708fb92241..c4bbc41b0ea4 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/linux/netfilter_bridge/ebt_ip.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_BRIDGE_EBT_IP_H 15#ifndef __LINUX_BRIDGE_EBT_IP_H
16#define __LINUX_BRIDGE_EBT_IP_H 16#define __LINUX_BRIDGE_EBT_IP_H
17 17
18#include <linux/types.h>
19
18#define EBT_IP_SOURCE 0x01 20#define EBT_IP_SOURCE 0x01
19#define EBT_IP_DEST 0x02 21#define EBT_IP_DEST 0x02
20#define EBT_IP_TOS 0x04 22#define EBT_IP_TOS 0x04
@@ -31,12 +33,12 @@ struct ebt_ip_info {
31 __be32 daddr; 33 __be32 daddr;
32 __be32 smsk; 34 __be32 smsk;
33 __be32 dmsk; 35 __be32 dmsk;
34 uint8_t tos; 36 __u8 tos;
35 uint8_t protocol; 37 __u8 protocol;
36 uint8_t bitmask; 38 __u8 bitmask;
37 uint8_t invflags; 39 __u8 invflags;
38 uint16_t sport[2]; 40 __u16 sport[2];
39 uint16_t dport[2]; 41 __u16 dport[2];
40}; 42};
41 43
42#endif 44#endif
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/linux/netfilter_bridge/ebt_ip6.h
index e5de98701519..42b889682721 100644
--- a/include/linux/netfilter_bridge/ebt_ip6.h
+++ b/include/linux/netfilter_bridge/ebt_ip6.h
@@ -12,14 +12,19 @@
12#ifndef __LINUX_BRIDGE_EBT_IP6_H 12#ifndef __LINUX_BRIDGE_EBT_IP6_H
13#define __LINUX_BRIDGE_EBT_IP6_H 13#define __LINUX_BRIDGE_EBT_IP6_H
14 14
15#include <linux/types.h>
16
15#define EBT_IP6_SOURCE 0x01 17#define EBT_IP6_SOURCE 0x01
16#define EBT_IP6_DEST 0x02 18#define EBT_IP6_DEST 0x02
17#define EBT_IP6_TCLASS 0x04 19#define EBT_IP6_TCLASS 0x04
18#define EBT_IP6_PROTO 0x08 20#define EBT_IP6_PROTO 0x08
19#define EBT_IP6_SPORT 0x10 21#define EBT_IP6_SPORT 0x10
20#define EBT_IP6_DPORT 0x20 22#define EBT_IP6_DPORT 0x20
23#define EBT_IP6_ICMP6 0x40
24
21#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\ 25#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
22 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT) 26 EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
27 EBT_IP6_ICMP6)
23#define EBT_IP6_MATCH "ip6" 28#define EBT_IP6_MATCH "ip6"
24 29
25/* the same values are used for the invflags */ 30/* the same values are used for the invflags */
@@ -28,12 +33,18 @@ struct ebt_ip6_info {
28 struct in6_addr daddr; 33 struct in6_addr daddr;
29 struct in6_addr smsk; 34 struct in6_addr smsk;
30 struct in6_addr dmsk; 35 struct in6_addr dmsk;
31 uint8_t tclass; 36 __u8 tclass;
32 uint8_t protocol; 37 __u8 protocol;
33 uint8_t bitmask; 38 __u8 bitmask;
34 uint8_t invflags; 39 __u8 invflags;
35 uint16_t sport[2]; 40 union {
36 uint16_t dport[2]; 41 __u16 sport[2];
42 __u8 icmpv6_type[2];
43 };
44 union {
45 __u16 dport[2];
46 __u8 icmpv6_code[2];
47 };
37}; 48};
38 49
39#endif 50#endif
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/linux/netfilter_bridge/ebt_limit.h
index 4bf76b751676..66d80b30ba0e 100644
--- a/include/linux/netfilter_bridge/ebt_limit.h
+++ b/include/linux/netfilter_bridge/ebt_limit.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H 1#ifndef __LINUX_BRIDGE_EBT_LIMIT_H
2#define __LINUX_BRIDGE_EBT_LIMIT_H 2#define __LINUX_BRIDGE_EBT_LIMIT_H
3 3
4#include <linux/types.h>
5
4#define EBT_LIMIT_MATCH "limit" 6#define EBT_LIMIT_MATCH "limit"
5 7
6/* timings are in milliseconds. */ 8/* timings are in milliseconds. */
@@ -10,13 +12,13 @@
10 seconds, or one every 59 hours. */ 12 seconds, or one every 59 hours. */
11 13
12struct ebt_limit_info { 14struct ebt_limit_info {
13 u_int32_t avg; /* Average secs between packets * scale */ 15 __u32 avg; /* Average secs between packets * scale */
14 u_int32_t burst; /* Period multiplier for upper limit. */ 16 __u32 burst; /* Period multiplier for upper limit. */
15 17
16 /* Used internally by the kernel */ 18 /* Used internally by the kernel */
17 unsigned long prev; 19 unsigned long prev;
18 u_int32_t credit; 20 __u32 credit;
19 u_int32_t credit_cap, cost; 21 __u32 credit_cap, cost;
20}; 22};
21 23
22#endif 24#endif
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/linux/netfilter_bridge/ebt_log.h
index cc2cdfb764bc..7e7f1d1fe494 100644
--- a/include/linux/netfilter_bridge/ebt_log.h
+++ b/include/linux/netfilter_bridge/ebt_log.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_LOG_H 1#ifndef __LINUX_BRIDGE_EBT_LOG_H
2#define __LINUX_BRIDGE_EBT_LOG_H 2#define __LINUX_BRIDGE_EBT_LOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */ 6#define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
5#define EBT_LOG_ARP 0x02 7#define EBT_LOG_ARP 0x02
6#define EBT_LOG_NFLOG 0x04 8#define EBT_LOG_NFLOG 0x04
@@ -10,9 +12,9 @@
10#define EBT_LOG_WATCHER "log" 12#define EBT_LOG_WATCHER "log"
11 13
12struct ebt_log_info { 14struct ebt_log_info {
13 uint8_t loglevel; 15 __u8 loglevel;
14 uint8_t prefix[EBT_LOG_PREFIX_SIZE]; 16 __u8 prefix[EBT_LOG_PREFIX_SIZE];
15 uint32_t bitmask; 17 __u32 bitmask;
16}; 18};
17 19
18#endif 20#endif
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/linux/netfilter_bridge/ebt_mark_m.h
index 9ceb10ec0ed6..410f9e5a71d4 100644
--- a/include/linux/netfilter_bridge/ebt_mark_m.h
+++ b/include/linux/netfilter_bridge/ebt_mark_m.h
@@ -1,13 +1,15 @@
1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H 1#ifndef __LINUX_BRIDGE_EBT_MARK_M_H
2#define __LINUX_BRIDGE_EBT_MARK_M_H 2#define __LINUX_BRIDGE_EBT_MARK_M_H
3 3
4#include <linux/types.h>
5
4#define EBT_MARK_AND 0x01 6#define EBT_MARK_AND 0x01
5#define EBT_MARK_OR 0x02 7#define EBT_MARK_OR 0x02
6#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR) 8#define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
7struct ebt_mark_m_info { 9struct ebt_mark_m_info {
8 unsigned long mark, mask; 10 unsigned long mark, mask;
9 uint8_t invert; 11 __u8 invert;
10 uint8_t bitmask; 12 __u8 bitmask;
11}; 13};
12#define EBT_MARK_MATCH "mark_m" 14#define EBT_MARK_MATCH "mark_m"
13 15
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
index 052817849b83..df829fce9125 100644
--- a/include/linux/netfilter_bridge/ebt_nflog.h
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H 1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H 2#define __LINUX_BRIDGE_EBT_NFLOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_NFLOG_MASK 0x0 6#define EBT_NFLOG_MASK 0x0
5 7
6#define EBT_NFLOG_PREFIX_SIZE 64 8#define EBT_NFLOG_PREFIX_SIZE 64
@@ -10,11 +12,11 @@
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1 12#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11 13
12struct ebt_nflog_info { 14struct ebt_nflog_info {
13 u_int32_t len; 15 __u32 len;
14 u_int16_t group; 16 __u16 group;
15 u_int16_t threshold; 17 __u16 threshold;
16 u_int16_t flags; 18 __u16 flags;
17 u_int16_t pad; 19 __u16 pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE]; 20 char prefix[EBT_NFLOG_PREFIX_SIZE];
19}; 21};
20 22
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/linux/netfilter_bridge/ebt_pkttype.h
index 51a799840931..c241badcd036 100644
--- a/include/linux/netfilter_bridge/ebt_pkttype.h
+++ b/include/linux/netfilter_bridge/ebt_pkttype.h
@@ -1,9 +1,11 @@
1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H 1#ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
2#define __LINUX_BRIDGE_EBT_PKTTYPE_H 2#define __LINUX_BRIDGE_EBT_PKTTYPE_H
3 3
4#include <linux/types.h>
5
4struct ebt_pkttype_info { 6struct ebt_pkttype_info {
5 uint8_t pkt_type; 7 __u8 pkt_type;
6 uint8_t invert; 8 __u8 invert;
7}; 9};
8#define EBT_PKTTYPE_MATCH "pkttype" 10#define EBT_PKTTYPE_MATCH "pkttype"
9 11
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/linux/netfilter_bridge/ebt_stp.h
index e503a0aa2728..1025b9f5fb7d 100644
--- a/include/linux/netfilter_bridge/ebt_stp.h
+++ b/include/linux/netfilter_bridge/ebt_stp.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_STP_H 1#ifndef __LINUX_BRIDGE_EBT_STP_H
2#define __LINUX_BRIDGE_EBT_STP_H 2#define __LINUX_BRIDGE_EBT_STP_H
3 3
4#include <linux/types.h>
5
4#define EBT_STP_TYPE 0x0001 6#define EBT_STP_TYPE 0x0001
5 7
6#define EBT_STP_FLAGS 0x0002 8#define EBT_STP_FLAGS 0x0002
@@ -21,24 +23,24 @@
21#define EBT_STP_MATCH "stp" 23#define EBT_STP_MATCH "stp"
22 24
23struct ebt_stp_config_info { 25struct ebt_stp_config_info {
24 uint8_t flags; 26 __u8 flags;
25 uint16_t root_priol, root_priou; 27 __u16 root_priol, root_priou;
26 char root_addr[6], root_addrmsk[6]; 28 char root_addr[6], root_addrmsk[6];
27 uint32_t root_costl, root_costu; 29 __u32 root_costl, root_costu;
28 uint16_t sender_priol, sender_priou; 30 __u16 sender_priol, sender_priou;
29 char sender_addr[6], sender_addrmsk[6]; 31 char sender_addr[6], sender_addrmsk[6];
30 uint16_t portl, portu; 32 __u16 portl, portu;
31 uint16_t msg_agel, msg_ageu; 33 __u16 msg_agel, msg_ageu;
32 uint16_t max_agel, max_ageu; 34 __u16 max_agel, max_ageu;
33 uint16_t hello_timel, hello_timeu; 35 __u16 hello_timel, hello_timeu;
34 uint16_t forward_delayl, forward_delayu; 36 __u16 forward_delayl, forward_delayu;
35}; 37};
36 38
37struct ebt_stp_info { 39struct ebt_stp_info {
38 uint8_t type; 40 __u8 type;
39 struct ebt_stp_config_info config; 41 struct ebt_stp_config_info config;
40 uint16_t bitmask; 42 __u16 bitmask;
41 uint16_t invflags; 43 __u16 invflags;
42}; 44};
43 45
44#endif 46#endif
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/linux/netfilter_bridge/ebt_ulog.h
index b677e2671541..89a6becb5269 100644
--- a/include/linux/netfilter_bridge/ebt_ulog.h
+++ b/include/linux/netfilter_bridge/ebt_ulog.h
@@ -1,6 +1,8 @@
1#ifndef _EBT_ULOG_H 1#ifndef _EBT_ULOG_H
2#define _EBT_ULOG_H 2#define _EBT_ULOG_H
3 3
4#include <linux/types.h>
5
4#define EBT_ULOG_DEFAULT_NLGROUP 0 6#define EBT_ULOG_DEFAULT_NLGROUP 0
5#define EBT_ULOG_DEFAULT_QTHRESHOLD 1 7#define EBT_ULOG_DEFAULT_QTHRESHOLD 1
6#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */ 8#define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
@@ -10,7 +12,7 @@
10#define EBT_ULOG_VERSION 1 12#define EBT_ULOG_VERSION 1
11 13
12struct ebt_ulog_info { 14struct ebt_ulog_info {
13 uint32_t nlgroup; 15 __u32 nlgroup;
14 unsigned int cprange; 16 unsigned int cprange;
15 unsigned int qthreshold; 17 unsigned int qthreshold;
16 char prefix[EBT_ULOG_PREFIX_LEN]; 18 char prefix[EBT_ULOG_PREFIX_LEN];
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/linux/netfilter_bridge/ebt_vlan.h
index 1d98be4031e7..967d1d5cf98d 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/linux/netfilter_bridge/ebt_vlan.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_BRIDGE_EBT_VLAN_H 1#ifndef __LINUX_BRIDGE_EBT_VLAN_H
2#define __LINUX_BRIDGE_EBT_VLAN_H 2#define __LINUX_BRIDGE_EBT_VLAN_H
3 3
4#include <linux/types.h>
5
4#define EBT_VLAN_ID 0x01 6#define EBT_VLAN_ID 0x01
5#define EBT_VLAN_PRIO 0x02 7#define EBT_VLAN_PRIO 0x02
6#define EBT_VLAN_ENCAP 0x04 8#define EBT_VLAN_ENCAP 0x04
@@ -8,12 +10,12 @@
8#define EBT_VLAN_MATCH "vlan" 10#define EBT_VLAN_MATCH "vlan"
9 11
10struct ebt_vlan_info { 12struct ebt_vlan_info {
11 uint16_t id; /* VLAN ID {1-4095} */ 13 __u16 id; /* VLAN ID {1-4095} */
12 uint8_t prio; /* VLAN User Priority {0-7} */ 14 __u8 prio; /* VLAN User Priority {0-7} */
13 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */ 15 __be16 encap; /* VLAN Encapsulated frame code {0-65535} */
14 uint8_t bitmask; /* Args bitmask bit 1=1 - ID arg, 16 __u8 bitmask; /* Args bitmask bit 1=1 - ID arg,
15 bit 2=1 User-Priority arg, bit 3=1 encap*/ 17 bit 2=1 User-Priority arg, bit 3=1 encap*/
16 uint8_t invflags; /* Inverse bitmask bit 1=1 - inversed ID arg, 18 __u8 invflags; /* Inverse bitmask bit 1=1 - inversed ID arg,
17 bit 2=1 - inversed Pirority arg */ 19 bit 2=1 - inversed Pirority arg */
18}; 20};
19 21
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index e5a3687c8a72..c6a204c97047 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_CLUSTERIP_H_target 1#ifndef _IPT_CLUSTERIP_H_target
2#define _IPT_CLUSTERIP_H_target 2#define _IPT_CLUSTERIP_H_target
3 3
4#include <linux/types.h>
5
4enum clusterip_hashmode { 6enum clusterip_hashmode {
5 CLUSTERIP_HASHMODE_SIP = 0, 7 CLUSTERIP_HASHMODE_SIP = 0,
6 CLUSTERIP_HASHMODE_SIP_SPT, 8 CLUSTERIP_HASHMODE_SIP_SPT,
@@ -17,15 +19,15 @@ struct clusterip_config;
17 19
18struct ipt_clusterip_tgt_info { 20struct ipt_clusterip_tgt_info {
19 21
20 u_int32_t flags; 22 __u32 flags;
21 23
22 /* only relevant for new ones */ 24 /* only relevant for new ones */
23 u_int8_t clustermac[6]; 25 __u8 clustermac[6];
24 u_int16_t num_total_nodes; 26 __u16 num_total_nodes;
25 u_int16_t num_local_nodes; 27 __u16 num_local_nodes;
26 u_int16_t local_nodes[CLUSTERIP_MAX_NODES]; 28 __u16 local_nodes[CLUSTERIP_MAX_NODES];
27 u_int32_t hash_mode; 29 __u32 hash_mode;
28 u_int32_t hash_initval; 30 __u32 hash_initval;
29 31
30 /* Used internally by the kernel */ 32 /* Used internally by the kernel */
31 struct clusterip_config *config; 33 struct clusterip_config *config;
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/linux/netfilter_ipv4/ipt_ECN.h
index 7ca45918ab8e..bb88d5315a4d 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,6 +8,8 @@
8*/ 8*/
9#ifndef _IPT_ECN_TARGET_H 9#ifndef _IPT_ECN_TARGET_H
10#define _IPT_ECN_TARGET_H 10#define _IPT_ECN_TARGET_H
11
12#include <linux/types.h>
11#include <linux/netfilter/xt_DSCP.h> 13#include <linux/netfilter/xt_DSCP.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -19,11 +21,11 @@
19#define IPT_ECN_OP_MASK 0xce 21#define IPT_ECN_OP_MASK 0xce
20 22
21struct ipt_ECN_info { 23struct ipt_ECN_info {
22 u_int8_t operation; /* bitset of operations */ 24 __u8 operation; /* bitset of operations */
23 u_int8_t ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */ 25 __u8 ip_ect; /* ECT codepoint of IPv4 header, pre-shifted */
24 union { 26 union {
25 struct { 27 struct {
26 u_int8_t ece:1, cwr:1; /* TCP ECT bits */ 28 __u8 ece:1, cwr:1; /* TCP ECT bits */
27 } tcp; 29 } tcp;
28 } proto; 30 } proto;
29}; 31};
diff --git a/include/linux/netfilter_ipv4/ipt_SAME.h b/include/linux/netfilter_ipv4/ipt_SAME.h
index 2529660c5b38..5bca78267afd 100644
--- a/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -1,15 +1,17 @@
1#ifndef _IPT_SAME_H 1#ifndef _IPT_SAME_H
2#define _IPT_SAME_H 2#define _IPT_SAME_H
3 3
4#include <linux/types.h>
5
4#define IPT_SAME_MAX_RANGE 10 6#define IPT_SAME_MAX_RANGE 10
5 7
6#define IPT_SAME_NODST 0x01 8#define IPT_SAME_NODST 0x01
7 9
8struct ipt_same_info { 10struct ipt_same_info {
9 unsigned char info; 11 unsigned char info;
10 u_int32_t rangesize; 12 __u32 rangesize;
11 u_int32_t ipnum; 13 __u32 ipnum;
12 u_int32_t *iparray; 14 __u32 *iparray;
13 15
14 /* hangs off end. */ 16 /* hangs off end. */
15 struct nf_nat_range range[IPT_SAME_MAX_RANGE]; 17 struct nf_nat_range range[IPT_SAME_MAX_RANGE];
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/linux/netfilter_ipv4/ipt_TTL.h
index ee6611edc112..f6ac169d92f9 100644
--- a/include/linux/netfilter_ipv4/ipt_TTL.h
+++ b/include/linux/netfilter_ipv4/ipt_TTL.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_SET = 0, 10 IPT_TTL_SET = 0,
9 IPT_TTL_INC, 11 IPT_TTL_INC,
@@ -13,8 +15,8 @@ enum {
13#define IPT_TTL_MAXMODE IPT_TTL_DEC 15#define IPT_TTL_MAXMODE IPT_TTL_DEC
14 16
15struct ipt_TTL_info { 17struct ipt_TTL_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h
index 446de6aef983..0da42237c8da 100644
--- a/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_ADDRTYPE_H 1#ifndef _IPT_ADDRTYPE_H
2#define _IPT_ADDRTYPE_H 2#define _IPT_ADDRTYPE_H
3 3
4#include <linux/types.h>
5
4enum { 6enum {
5 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, 7 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001,
6 IPT_ADDRTYPE_INVERT_DEST = 0x0002, 8 IPT_ADDRTYPE_INVERT_DEST = 0x0002,
@@ -9,17 +11,17 @@ enum {
9}; 11};
10 12
11struct ipt_addrtype_info_v1 { 13struct ipt_addrtype_info_v1 {
12 u_int16_t source; /* source-type mask */ 14 __u16 source; /* source-type mask */
13 u_int16_t dest; /* dest-type mask */ 15 __u16 dest; /* dest-type mask */
14 u_int32_t flags; 16 __u32 flags;
15}; 17};
16 18
17/* revision 0 */ 19/* revision 0 */
18struct ipt_addrtype_info { 20struct ipt_addrtype_info {
19 u_int16_t source; /* source-type mask */ 21 __u16 source; /* source-type mask */
20 u_int16_t dest; /* dest-type mask */ 22 __u16 dest; /* dest-type mask */
21 u_int32_t invert_source; 23 __u32 invert_source;
22 u_int32_t invert_dest; 24 __u32 invert_dest;
23}; 25};
24 26
25#endif 27#endif
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/linux/netfilter_ipv4/ipt_ah.h
index 2e555b4d05e3..4e02bb0119e3 100644
--- a/include/linux/netfilter_ipv4/ipt_ah.h
+++ b/include/linux/netfilter_ipv4/ipt_ah.h
@@ -1,9 +1,11 @@
1#ifndef _IPT_AH_H 1#ifndef _IPT_AH_H
2#define _IPT_AH_H 2#define _IPT_AH_H
3 3
4#include <linux/types.h>
5
4struct ipt_ah { 6struct ipt_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int8_t invflags; /* Inverse flags */ 8 __u8 invflags; /* Inverse flags */
7}; 9};
8 10
9 11
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/linux/netfilter_ipv4/ipt_ecn.h
index 9945baa4ccd7..eabf95fb7d3e 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -8,6 +8,8 @@
8*/ 8*/
9#ifndef _IPT_ECN_H 9#ifndef _IPT_ECN_H
10#define _IPT_ECN_H 10#define _IPT_ECN_H
11
12#include <linux/types.h>
11#include <linux/netfilter/xt_dscp.h> 13#include <linux/netfilter/xt_dscp.h>
12 14
13#define IPT_ECN_IP_MASK (~XT_DSCP_MASK) 15#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
@@ -20,12 +22,12 @@
20 22
21/* match info */ 23/* match info */
22struct ipt_ecn_info { 24struct ipt_ecn_info {
23 u_int8_t operation; 25 __u8 operation;
24 u_int8_t invert; 26 __u8 invert;
25 u_int8_t ip_ect; 27 __u8 ip_ect;
26 union { 28 union {
27 struct { 29 struct {
28 u_int8_t ect; 30 __u8 ect;
29 } tcp; 31 } tcp;
30 } proto; 32 } proto;
31}; 33};
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/linux/netfilter_ipv4/ipt_ttl.h
index ee24fd86a3aa..37bee4442486 100644
--- a/include/linux/netfilter_ipv4/ipt_ttl.h
+++ b/include/linux/netfilter_ipv4/ipt_ttl.h
@@ -4,6 +4,8 @@
4#ifndef _IPT_TTL_H 4#ifndef _IPT_TTL_H
5#define _IPT_TTL_H 5#define _IPT_TTL_H
6 6
7#include <linux/types.h>
8
7enum { 9enum {
8 IPT_TTL_EQ = 0, /* equals */ 10 IPT_TTL_EQ = 0, /* equals */
9 IPT_TTL_NE, /* not equals */ 11 IPT_TTL_NE, /* not equals */
@@ -13,8 +15,8 @@ enum {
13 15
14 16
15struct ipt_ttl_info { 17struct ipt_ttl_info {
16 u_int8_t mode; 18 __u8 mode;
17 u_int8_t ttl; 19 __u8 ttl;
18}; 20};
19 21
20 22
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/linux/netfilter_ipv6/ip6t_HL.h
index afb7813d45ab..ebd8ead1bb63 100644
--- a/include/linux/netfilter_ipv6/ip6t_HL.h
+++ b/include/linux/netfilter_ipv6/ip6t_HL.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_SET = 0, 11 IP6T_HL_SET = 0,
10 IP6T_HL_INC, 12 IP6T_HL_INC,
@@ -14,8 +16,8 @@ enum {
14#define IP6T_HL_MAXMODE IP6T_HL_DEC 16#define IP6T_HL_MAXMODE IP6T_HL_DEC
15 17
16struct ip6t_HL_info { 18struct ip6t_HL_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/linux/netfilter_ipv6/ip6t_REJECT.h
index 6be6504162bb..205ed62e4605 100644
--- a/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ b/include/linux/netfilter_ipv6/ip6t_REJECT.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_REJECT_H 1#ifndef _IP6T_REJECT_H
2#define _IP6T_REJECT_H 2#define _IP6T_REJECT_H
3 3
4#include <linux/types.h>
5
4enum ip6t_reject_with { 6enum ip6t_reject_with {
5 IP6T_ICMP6_NO_ROUTE, 7 IP6T_ICMP6_NO_ROUTE,
6 IP6T_ICMP6_ADM_PROHIBITED, 8 IP6T_ICMP6_ADM_PROHIBITED,
@@ -12,7 +14,7 @@ enum ip6t_reject_with {
12}; 14};
13 15
14struct ip6t_reject_info { 16struct ip6t_reject_info {
15 u_int32_t with; /* reject type */ 17 __u32 with; /* reject type */
16}; 18};
17 19
18#endif /*_IP6T_REJECT_H*/ 20#endif /*_IP6T_REJECT_H*/
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/linux/netfilter_ipv6/ip6t_ah.h
index 17a745cfb2c7..5da2b65cb3ad 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_AH_H 1#ifndef _IP6T_AH_H
2#define _IP6T_AH_H 2#define _IP6T_AH_H
3 3
4#include <linux/types.h>
5
4struct ip6t_ah { 6struct ip6t_ah {
5 u_int32_t spis[2]; /* Security Parameter Index */ 7 __u32 spis[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t hdrres; /* Test of the Reserved Filed */ 9 __u8 hdrres; /* Test of the Reserved Filed */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_AH_SPI 0x01 13#define IP6T_AH_SPI 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/linux/netfilter_ipv6/ip6t_frag.h
index 3724d0850920..b47f61b9e082 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -1,11 +1,13 @@
1#ifndef _IP6T_FRAG_H 1#ifndef _IP6T_FRAG_H
2#define _IP6T_FRAG_H 2#define _IP6T_FRAG_H
3 3
4#include <linux/types.h>
5
4struct ip6t_frag { 6struct ip6t_frag {
5 u_int32_t ids[2]; /* Security Parameter Index */ 7 __u32 ids[2]; /* Security Parameter Index */
6 u_int32_t hdrlen; /* Header Length */ 8 __u32 hdrlen; /* Header Length */
7 u_int8_t flags; /* */ 9 __u8 flags; /* */
8 u_int8_t invflags; /* Inverse flags */ 10 __u8 invflags; /* Inverse flags */
9}; 11};
10 12
11#define IP6T_FRAG_IDS 0x01 13#define IP6T_FRAG_IDS 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/linux/netfilter_ipv6/ip6t_hl.h
index 5ef91b8319a8..6e76dbc6c19a 100644
--- a/include/linux/netfilter_ipv6/ip6t_hl.h
+++ b/include/linux/netfilter_ipv6/ip6t_hl.h
@@ -5,6 +5,8 @@
5#ifndef _IP6T_HL_H 5#ifndef _IP6T_HL_H
6#define _IP6T_HL_H 6#define _IP6T_HL_H
7 7
8#include <linux/types.h>
9
8enum { 10enum {
9 IP6T_HL_EQ = 0, /* equals */ 11 IP6T_HL_EQ = 0, /* equals */
10 IP6T_HL_NE, /* not equals */ 12 IP6T_HL_NE, /* not equals */
@@ -14,8 +16,8 @@ enum {
14 16
15 17
16struct ip6t_hl_info { 18struct ip6t_hl_info {
17 u_int8_t mode; 19 __u8 mode;
18 u_int8_t hop_limit; 20 __u8 hop_limit;
19}; 21};
20 22
21 23
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
index 01dfd445596a..efae3a20c214 100644
--- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ b/include/linux/netfilter_ipv6/ip6t_ipv6header.h
@@ -8,10 +8,12 @@ on whether they contain certain headers */
8#ifndef __IPV6HEADER_H 8#ifndef __IPV6HEADER_H
9#define __IPV6HEADER_H 9#define __IPV6HEADER_H
10 10
11#include <linux/types.h>
12
11struct ip6t_ipv6header_info { 13struct ip6t_ipv6header_info {
12 u_int8_t matchflags; 14 __u8 matchflags;
13 u_int8_t invflags; 15 __u8 invflags;
14 u_int8_t modeflag; 16 __u8 modeflag;
15}; 17};
16 18
17#define MASK_HOPOPTS 128 19#define MASK_HOPOPTS 128
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/linux/netfilter_ipv6/ip6t_mh.h
index 18549bca2d1f..a7729a5025cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_mh.h
+++ b/include/linux/netfilter_ipv6/ip6t_mh.h
@@ -1,10 +1,12 @@
1#ifndef _IP6T_MH_H 1#ifndef _IP6T_MH_H
2#define _IP6T_MH_H 2#define _IP6T_MH_H
3 3
4#include <linux/types.h>
5
4/* MH matching stuff */ 6/* MH matching stuff */
5struct ip6t_mh { 7struct ip6t_mh {
6 u_int8_t types[2]; /* MH type range */ 8 __u8 types[2]; /* MH type range */
7 u_int8_t invflags; /* Inverse flags */ 9 __u8 invflags; /* Inverse flags */
8}; 10};
9 11
10/* Values for "invflags" field in struct ip6t_mh. */ 12/* Values for "invflags" field in struct ip6t_mh. */
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/linux/netfilter_ipv6/ip6t_opts.h
index 62d89bcd9f9c..17d419a811fd 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -1,14 +1,16 @@
1#ifndef _IP6T_OPTS_H 1#ifndef _IP6T_OPTS_H
2#define _IP6T_OPTS_H 2#define _IP6T_OPTS_H
3 3
4#include <linux/types.h>
5
4#define IP6T_OPTS_OPTSNR 16 6#define IP6T_OPTS_OPTSNR 16
5 7
6struct ip6t_opts { 8struct ip6t_opts {
7 u_int32_t hdrlen; /* Header Length */ 9 __u32 hdrlen; /* Header Length */
8 u_int8_t flags; /* */ 10 __u8 flags; /* */
9 u_int8_t invflags; /* Inverse flags */ 11 __u8 invflags; /* Inverse flags */
10 u_int16_t opts[IP6T_OPTS_OPTSNR]; /* opts */ 12 __u16 opts[IP6T_OPTS_OPTSNR]; /* opts */
11 u_int8_t optsnr; /* Nr of OPts */ 13 __u8 optsnr; /* Nr of OPts */
12}; 14};
13 15
14#define IP6T_OPTS_LEN 0x01 16#define IP6T_OPTS_LEN 0x01
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/linux/netfilter_ipv6/ip6t_rt.h
index ab91bfd2cd00..7605a5ff81cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -1,18 +1,19 @@
1#ifndef _IP6T_RT_H 1#ifndef _IP6T_RT_H
2#define _IP6T_RT_H 2#define _IP6T_RT_H
3 3
4#include <linux/types.h>
4/*#include <linux/in6.h>*/ 5/*#include <linux/in6.h>*/
5 6
6#define IP6T_RT_HOPS 16 7#define IP6T_RT_HOPS 16
7 8
8struct ip6t_rt { 9struct ip6t_rt {
9 u_int32_t rt_type; /* Routing Type */ 10 __u32 rt_type; /* Routing Type */
10 u_int32_t segsleft[2]; /* Segments Left */ 11 __u32 segsleft[2]; /* Segments Left */
11 u_int32_t hdrlen; /* Header Length */ 12 __u32 hdrlen; /* Header Length */
12 u_int8_t flags; /* */ 13 __u8 flags; /* */
13 u_int8_t invflags; /* Inverse flags */ 14 __u8 invflags; /* Inverse flags */
14 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */ 15 struct in6_addr addrs[IP6T_RT_HOPS]; /* Hops */
15 u_int8_t addrnr; /* Nr of Addresses */ 16 __u8 addrnr; /* Nr of Addresses */
16}; 17};
17 18
18#define IP6T_RT_TYP 0x01 19#define IP6T_RT_TYP 0x01
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index e2b9e63afa68..4c4ac3f3ce5a 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -160,10 +160,6 @@ struct netlink_skb_parms {
160 struct ucred creds; /* Skb credentials */ 160 struct ucred creds; /* Skb credentials */
161 __u32 pid; 161 __u32 pid;
162 __u32 dst_group; 162 __u32 dst_group;
163 kernel_cap_t eff_cap;
164 __u32 loginuid; /* Login (audit) uid */
165 __u32 sessionid; /* Session id (audit) */
166 __u32 sid; /* SELinux security id */
167}; 163};
168 164
169#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 165#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 134716e5e350..b528f6d4b860 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -550,6 +550,7 @@ enum {
550 NFSPROC4_CLNT_SETACL, 550 NFSPROC4_CLNT_SETACL,
551 NFSPROC4_CLNT_FS_LOCATIONS, 551 NFSPROC4_CLNT_FS_LOCATIONS,
552 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 552 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
553 NFSPROC4_CLNT_SECINFO,
553 554
554 /* nfs41 */ 555 /* nfs41 */
555 NFSPROC4_CLNT_EXCHANGE_ID, 556 NFSPROC4_CLNT_EXCHANGE_ID,
@@ -560,6 +561,7 @@ enum {
560 NFSPROC4_CLNT_RECLAIM_COMPLETE, 561 NFSPROC4_CLNT_RECLAIM_COMPLETE,
561 NFSPROC4_CLNT_LAYOUTGET, 562 NFSPROC4_CLNT_LAYOUTGET,
562 NFSPROC4_CLNT_GETDEVICEINFO, 563 NFSPROC4_CLNT_GETDEVICEINFO,
564 NFSPROC4_CLNT_LAYOUTCOMMIT,
563}; 565};
564 566
565/* nfs41 types */ 567/* nfs41 types */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 6023efa9f5d9..1b93b9c60e55 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -33,6 +33,8 @@
33#define FLUSH_STABLE 4 /* commit to stable storage */ 33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */ 34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
36 38
37#ifdef __KERNEL__ 39#ifdef __KERNEL__
38 40
@@ -93,8 +95,13 @@ struct nfs_open_context {
93 int error; 95 int error;
94 96
95 struct list_head list; 97 struct list_head list;
98};
96 99
100struct nfs_open_dir_context {
101 struct rpc_cred *cred;
97 __u64 dir_cookie; 102 __u64 dir_cookie;
103 __u64 dup_cookie;
104 int duped;
98}; 105};
99 106
100/* 107/*
@@ -191,6 +198,7 @@ struct nfs_inode {
191 198
192 /* pNFS layout information */ 199 /* pNFS layout information */
193 struct pnfs_layout_hdr *layout; 200 struct pnfs_layout_hdr *layout;
201 atomic_t commits_outstanding;
194#endif /* CONFIG_NFS_V4*/ 202#endif /* CONFIG_NFS_V4*/
195#ifdef CONFIG_NFS_FSCACHE 203#ifdef CONFIG_NFS_FSCACHE
196 struct fscache_cookie *fscache; 204 struct fscache_cookie *fscache;
@@ -219,6 +227,8 @@ struct nfs_inode {
219#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 227#define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */
220#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 228#define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */
221#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ 229#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
230#define NFS_INO_PNFS_COMMIT (8) /* use pnfs code for commit */
231#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
222 232
223static inline struct nfs_inode *NFS_I(const struct inode *inode) 233static inline struct nfs_inode *NFS_I(const struct inode *inode)
224{ 234{
@@ -501,7 +511,7 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
501extern int nfs_writepages(struct address_space *, struct writeback_control *); 511extern int nfs_writepages(struct address_space *, struct writeback_control *);
502extern int nfs_flush_incompatible(struct file *file, struct page *page); 512extern int nfs_flush_incompatible(struct file *file, struct page *page);
503extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 513extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
504extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 514extern void nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
505 515
506/* 516/*
507 * Try to write back everything synchronously (but check the 517 * Try to write back everything synchronously (but check the
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b197563913bf..216cea5db0aa 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -30,6 +30,8 @@ struct nfs_client {
30#define NFS_CS_CALLBACK 1 /* - callback started */ 30#define NFS_CS_CALLBACK 1 /* - callback started */
31#define NFS_CS_IDMAP 2 /* - idmap started */ 31#define NFS_CS_IDMAP 2 /* - idmap started */
32#define NFS_CS_RENEWD 3 /* - renewd started */ 32#define NFS_CS_RENEWD 3 /* - renewd started */
33#define NFS_CS_STOP_RENEW 4 /* no more state to renew */
34#define NFS_CS_CHECK_LEASE_TIME 5 /* need to check lease time */
33 struct sockaddr_storage cl_addr; /* server identifier */ 35 struct sockaddr_storage cl_addr; /* server identifier */
34 size_t cl_addrlen; 36 size_t cl_addrlen;
35 char * cl_hostname; /* hostname of server */ 37 char * cl_hostname; /* hostname of server */
@@ -68,19 +70,14 @@ struct nfs_client {
68 unsigned char cl_id_uniquifier; 70 unsigned char cl_id_uniquifier;
69 u32 cl_cb_ident; /* v4.0 callback identifier */ 71 u32 cl_cb_ident; /* v4.0 callback identifier */
70 const struct nfs4_minor_version_ops *cl_mvops; 72 const struct nfs4_minor_version_ops *cl_mvops;
71#endif /* CONFIG_NFS_V4 */
72 73
73#ifdef CONFIG_NFS_V4_1
74 /* clientid returned from EXCHANGE_ID, used by session operations */
75 u64 cl_ex_clid;
76 /* The sequence id to use for the next CREATE_SESSION */ 74 /* The sequence id to use for the next CREATE_SESSION */
77 u32 cl_seqid; 75 u32 cl_seqid;
78 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 76 /* The flags used for obtaining the clientid during EXCHANGE_ID */
79 u32 cl_exchange_flags; 77 u32 cl_exchange_flags;
80 struct nfs4_session *cl_session; /* sharred session */ 78 struct nfs4_session *cl_session; /* sharred session */
81 struct list_head cl_layouts; 79 struct list_head cl_layouts;
82 struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */ 80#endif /* CONFIG_NFS_V4 */
83#endif /* CONFIG_NFS_V4_1 */
84 81
85#ifdef CONFIG_NFS_FSCACHE 82#ifdef CONFIG_NFS_FSCACHE
86 struct fscache_cookie *fscache; /* client index cache cookie */ 83 struct fscache_cookie *fscache; /* client index cache cookie */
@@ -180,12 +177,13 @@ struct nfs_server {
180#define NFS_CAP_CTIME (1U << 12) 177#define NFS_CAP_CTIME (1U << 12)
181#define NFS_CAP_MTIME (1U << 13) 178#define NFS_CAP_MTIME (1U << 13)
182#define NFS_CAP_POSIX_LOCK (1U << 14) 179#define NFS_CAP_POSIX_LOCK (1U << 14)
180#define NFS_CAP_UIDGID_NOMAP (1U << 15)
183 181
184 182
185/* maximum number of slots to use */ 183/* maximum number of slots to use */
186#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE 184#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE
187 185
188#if defined(CONFIG_NFS_V4_1) 186#if defined(CONFIG_NFS_V4)
189 187
190/* Sessions */ 188/* Sessions */
191#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) 189#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long)))
@@ -225,5 +223,5 @@ struct nfs4_session {
225 struct nfs_client *clp; 223 struct nfs_client *clp;
226}; 224};
227 225
228#endif /* CONFIG_NFS_V4_1 */ 226#endif /* CONFIG_NFS_V4 */
229#endif 227#endif
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index e8352dc5afb5..ae7d6a380dae 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -65,6 +65,7 @@ struct idmap_msg {
65 65
66/* Forward declaration to make this header independent of others */ 66/* Forward declaration to make this header independent of others */
67struct nfs_client; 67struct nfs_client;
68struct nfs_server;
68 69
69#ifdef CONFIG_NFS_USE_NEW_IDMAPPER 70#ifdef CONFIG_NFS_USE_NEW_IDMAPPER
70 71
@@ -96,10 +97,10 @@ void nfs_idmap_delete(struct nfs_client *);
96 97
97#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */ 98#endif /* CONFIG_NFS_USE_NEW_IDMAPPER */
98 99
99int nfs_map_name_to_uid(struct nfs_client *, const char *, size_t, __u32 *); 100int nfs_map_name_to_uid(const struct nfs_server *, const char *, size_t, __u32 *);
100int nfs_map_group_to_gid(struct nfs_client *, const char *, size_t, __u32 *); 101int nfs_map_group_to_gid(const struct nfs_server *, const char *, size_t, __u32 *);
101int nfs_map_uid_to_name(struct nfs_client *, __u32, char *, size_t); 102int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
102int nfs_map_gid_to_group(struct nfs_client *, __u32, char *, size_t); 103int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t);
103 104
104extern unsigned int nfs_idmap_cache_timeout; 105extern unsigned int nfs_idmap_cache_timeout;
105#endif /* __KERNEL__ */ 106#endif /* __KERNEL__ */
diff --git a/include/linux/nfs_iostat.h b/include/linux/nfs_iostat.h
index 68b10f5f8907..8866bb3502ee 100644
--- a/include/linux/nfs_iostat.h
+++ b/include/linux/nfs_iostat.h
@@ -113,6 +113,8 @@ enum nfs_stat_eventcounters {
113 NFSIOS_SHORTREAD, 113 NFSIOS_SHORTREAD,
114 NFSIOS_SHORTWRITE, 114 NFSIOS_SHORTWRITE,
115 NFSIOS_DELAY, 115 NFSIOS_DELAY,
116 NFSIOS_PNFS_READ,
117 NFSIOS_PNFS_WRITE,
116 __NFSIOS_COUNTSMAX, 118 __NFSIOS_COUNTSMAX,
117}; 119};
118 120
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index d55cee73f634..8023e4e25133 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -33,11 +33,15 @@ enum {
33 PG_CLEAN, 33 PG_CLEAN,
34 PG_NEED_COMMIT, 34 PG_NEED_COMMIT,
35 PG_NEED_RESCHED, 35 PG_NEED_RESCHED,
36 PG_PNFS_COMMIT,
36}; 37};
37 38
38struct nfs_inode; 39struct nfs_inode;
39struct nfs_page { 40struct nfs_page {
40 struct list_head wb_list; /* Defines state of page: */ 41 union {
42 struct list_head wb_list; /* Defines state of page: */
43 struct pnfs_layout_segment *wb_commit_lseg; /* Used when PG_PNFS_COMMIT set */
44 };
41 struct page *wb_page; /* page to read in/write out */ 45 struct page *wb_page; /* page to read in/write out */
42 struct nfs_open_context *wb_context; /* File state context info */ 46 struct nfs_open_context *wb_context; /* File state context info */
43 struct nfs_lock_context *wb_lock_context; /* lock context info */ 47 struct nfs_lock_context *wb_lock_context; /* lock context info */
@@ -57,11 +61,14 @@ struct nfs_pageio_descriptor {
57 size_t pg_count; 61 size_t pg_count;
58 size_t pg_bsize; 62 size_t pg_bsize;
59 unsigned int pg_base; 63 unsigned int pg_base;
64 char pg_moreio;
60 65
61 struct inode *pg_inode; 66 struct inode *pg_inode;
62 int (*pg_doio)(struct inode *, struct list_head *, unsigned int, size_t, int); 67 int (*pg_doio)(struct nfs_pageio_descriptor *);
63 int pg_ioflags; 68 int pg_ioflags;
64 int pg_error; 69 int pg_error;
70 struct pnfs_layout_segment *pg_lseg;
71 int (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
65}; 72};
66 73
67#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
@@ -79,7 +86,7 @@ extern int nfs_scan_list(struct nfs_inode *nfsi, struct list_head *dst,
79 pgoff_t idx_start, unsigned int npages, int tag); 86 pgoff_t idx_start, unsigned int npages, int tag);
80extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc, 87extern void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
81 struct inode *inode, 88 struct inode *inode,
82 int (*doio)(struct inode *, struct list_head *, unsigned int, size_t, int), 89 int (*doio)(struct nfs_pageio_descriptor *desc),
83 size_t bsize, 90 size_t bsize,
84 int how); 91 int how);
85extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *, 92extern int nfs_pageio_add_request(struct nfs_pageio_descriptor *,
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index b0068579bec2..78b101e487ea 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/nfsacl.h> 4#include <linux/nfsacl.h>
5#include <linux/nfs3.h> 5#include <linux/nfs3.h>
6#include <linux/sunrpc/gss_api.h>
6 7
7/* 8/*
8 * To change the maximum rsize and wsize supported by the NFS client, adjust 9 * To change the maximum rsize and wsize supported by the NFS client, adjust
@@ -14,6 +15,9 @@
14#define NFS_DEF_FILE_IO_SIZE (4096U) 15#define NFS_DEF_FILE_IO_SIZE (4096U)
15#define NFS_MIN_FILE_IO_SIZE (1024U) 16#define NFS_MIN_FILE_IO_SIZE (1024U)
16 17
18/* Forward declaration for NFS v3 */
19struct nfs4_secinfo_flavors;
20
17struct nfs_fsid { 21struct nfs_fsid {
18 uint64_t major; 22 uint64_t major;
19 uint64_t minor; 23 uint64_t minor;
@@ -78,6 +82,7 @@ struct nfs_fattr {
78#define NFS_ATTR_FATTR_CHANGE (1U << 17) 82#define NFS_ATTR_FATTR_CHANGE (1U << 17)
79#define NFS_ATTR_FATTR_PRECHANGE (1U << 18) 83#define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
80#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */ 84#define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
85#define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
81 86
82#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 87#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
83 | NFS_ATTR_FATTR_MODE \ 88 | NFS_ATTR_FATTR_MODE \
@@ -190,8 +195,9 @@ struct nfs4_get_lease_time_res {
190#define PNFS_LAYOUT_MAXSIZE 4096 195#define PNFS_LAYOUT_MAXSIZE 4096
191 196
192struct nfs4_layoutdriver_data { 197struct nfs4_layoutdriver_data {
198 struct page **pages;
199 __u32 pglen;
193 __u32 len; 200 __u32 len;
194 void *buf;
195}; 201};
196 202
197struct pnfs_layout_range { 203struct pnfs_layout_range {
@@ -209,6 +215,7 @@ struct nfs4_layoutget_args {
209 struct nfs_open_context *ctx; 215 struct nfs_open_context *ctx;
210 struct nfs4_sequence_args seq_args; 216 struct nfs4_sequence_args seq_args;
211 nfs4_stateid stateid; 217 nfs4_stateid stateid;
218 struct nfs4_layoutdriver_data layout;
212}; 219};
213 220
214struct nfs4_layoutget_res { 221struct nfs4_layoutget_res {
@@ -216,8 +223,8 @@ struct nfs4_layoutget_res {
216 struct pnfs_layout_range range; 223 struct pnfs_layout_range range;
217 __u32 type; 224 __u32 type;
218 nfs4_stateid stateid; 225 nfs4_stateid stateid;
219 struct nfs4_layoutdriver_data layout;
220 struct nfs4_sequence_res seq_res; 226 struct nfs4_sequence_res seq_res;
227 struct nfs4_layoutdriver_data *layoutp;
221}; 228};
222 229
223struct nfs4_layoutget { 230struct nfs4_layoutget {
@@ -236,6 +243,29 @@ struct nfs4_getdeviceinfo_res {
236 struct nfs4_sequence_res seq_res; 243 struct nfs4_sequence_res seq_res;
237}; 244};
238 245
246struct nfs4_layoutcommit_args {
247 nfs4_stateid stateid;
248 __u64 lastbytewritten;
249 struct inode *inode;
250 const u32 *bitmask;
251 struct nfs4_sequence_args seq_args;
252};
253
254struct nfs4_layoutcommit_res {
255 struct nfs_fattr *fattr;
256 const struct nfs_server *server;
257 struct nfs4_sequence_res seq_res;
258};
259
260struct nfs4_layoutcommit_data {
261 struct rpc_task task;
262 struct nfs_fattr fattr;
263 struct pnfs_layout_segment *lseg;
264 struct rpc_cred *cred;
265 struct nfs4_layoutcommit_args args;
266 struct nfs4_layoutcommit_res res;
267};
268
239/* 269/*
240 * Arguments to the open call. 270 * Arguments to the open call.
241 */ 271 */
@@ -936,6 +966,38 @@ struct nfs4_fs_locations_res {
936 struct nfs4_sequence_res seq_res; 966 struct nfs4_sequence_res seq_res;
937}; 967};
938 968
969struct nfs4_secinfo_oid {
970 unsigned int len;
971 char data[GSS_OID_MAX_LEN];
972};
973
974struct nfs4_secinfo_gss {
975 struct nfs4_secinfo_oid sec_oid4;
976 unsigned int qop4;
977 unsigned int service;
978};
979
980struct nfs4_secinfo_flavor {
981 unsigned int flavor;
982 struct nfs4_secinfo_gss gss;
983};
984
985struct nfs4_secinfo_flavors {
986 unsigned int num_flavors;
987 struct nfs4_secinfo_flavor flavors[0];
988};
989
990struct nfs4_secinfo_arg {
991 const struct nfs_fh *dir_fh;
992 const struct qstr *name;
993 struct nfs4_sequence_args seq_args;
994};
995
996struct nfs4_secinfo_res {
997 struct nfs4_secinfo_flavors *flavors;
998 struct nfs4_sequence_res seq_res;
999};
1000
939#endif /* CONFIG_NFS_V4 */ 1001#endif /* CONFIG_NFS_V4 */
940 1002
941struct nfstime4 { 1003struct nfstime4 {
@@ -1016,9 +1078,12 @@ struct nfs_read_data {
1016 unsigned int npages; /* Max length of pagevec */ 1078 unsigned int npages; /* Max length of pagevec */
1017 struct nfs_readargs args; 1079 struct nfs_readargs args;
1018 struct nfs_readres res; 1080 struct nfs_readres res;
1019#ifdef CONFIG_NFS_V4
1020 unsigned long timestamp; /* For lease renewal */ 1081 unsigned long timestamp; /* For lease renewal */
1021#endif 1082 struct pnfs_layout_segment *lseg;
1083 struct nfs_client *ds_clp; /* pNFS data server */
1084 const struct rpc_call_ops *mds_ops;
1085 int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
1086 __u64 mds_offset;
1022 struct page *page_array[NFS_PAGEVEC_SIZE]; 1087 struct page *page_array[NFS_PAGEVEC_SIZE];
1023}; 1088};
1024 1089
@@ -1035,13 +1100,21 @@ struct nfs_write_data {
1035 unsigned int npages; /* Max length of pagevec */ 1100 unsigned int npages; /* Max length of pagevec */
1036 struct nfs_writeargs args; /* argument struct */ 1101 struct nfs_writeargs args; /* argument struct */
1037 struct nfs_writeres res; /* result struct */ 1102 struct nfs_writeres res; /* result struct */
1103 struct pnfs_layout_segment *lseg;
1104 struct nfs_client *ds_clp; /* pNFS data server */
1105 int ds_commit_index;
1106 const struct rpc_call_ops *mds_ops;
1107 int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
1038#ifdef CONFIG_NFS_V4 1108#ifdef CONFIG_NFS_V4
1039 unsigned long timestamp; /* For lease renewal */ 1109 unsigned long timestamp; /* For lease renewal */
1040#endif 1110#endif
1111 __u64 mds_offset; /* Filelayout dense stripe */
1041 struct page *page_array[NFS_PAGEVEC_SIZE]; 1112 struct page *page_array[NFS_PAGEVEC_SIZE];
1042}; 1113};
1043 1114
1044struct nfs_access_entry; 1115struct nfs_access_entry;
1116struct nfs_client;
1117struct rpc_timeout;
1045 1118
1046/* 1119/*
1047 * RPC procedure vector for NFSv2/NFSv3 demuxing 1120 * RPC procedure vector for NFSv2/NFSv3 demuxing
@@ -1061,7 +1134,7 @@ struct nfs_rpc_ops {
1061 struct nfs_fattr *); 1134 struct nfs_fattr *);
1062 int (*setattr) (struct dentry *, struct nfs_fattr *, 1135 int (*setattr) (struct dentry *, struct nfs_fattr *,
1063 struct iattr *); 1136 struct iattr *);
1064 int (*lookup) (struct inode *, struct qstr *, 1137 int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
1065 struct nfs_fh *, struct nfs_fattr *); 1138 struct nfs_fh *, struct nfs_fattr *);
1066 int (*access) (struct inode *, struct nfs_access_entry *); 1139 int (*access) (struct inode *, struct nfs_access_entry *);
1067 int (*readlink)(struct inode *, struct page *, unsigned int, 1140 int (*readlink)(struct inode *, struct page *, unsigned int,
@@ -1106,6 +1179,9 @@ struct nfs_rpc_ops {
1106 struct nfs_open_context *ctx, 1179 struct nfs_open_context *ctx,
1107 int open_flags, 1180 int open_flags,
1108 struct iattr *iattr); 1181 struct iattr *iattr);
1182 int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
1183 const char *, rpc_authflavor_t, int);
1184 int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
1109}; 1185};
1110 1186
1111/* 1187/*
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 227e49dd5720..8768c469e93e 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -40,26 +40,7 @@
40 40
41#include <linux/types.h> 41#include <linux/types.h>
42#include <linux/ioctl.h> 42#include <linux/ioctl.h>
43 43#include <linux/magic.h>
44/*
45 * Inode flags stored in nilfs_inode and on-memory nilfs inode
46 *
47 * We define these flags based on ext2-fs because of the
48 * compatibility reason; to avoid problems in chattr(1)
49 */
50#define NILFS_SECRM_FL 0x00000001 /* Secure deletion */
51#define NILFS_UNRM_FL 0x00000002 /* Undelete */
52#define NILFS_SYNC_FL 0x00000008 /* Synchronous updates */
53#define NILFS_IMMUTABLE_FL 0x00000010 /* Immutable file */
54#define NILFS_APPEND_FL 0x00000020 /* writes to file may only append */
55#define NILFS_NODUMP_FL 0x00000040 /* do not dump file */
56#define NILFS_NOATIME_FL 0x00000080 /* do not update atime */
57/* Reserved for compression usage... */
58#define NILFS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
59#define NILFS_DIRSYNC_FL 0x00010000 /* dirsync behaviour */
60
61#define NILFS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
62#define NILFS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
63 44
64 45
65#define NILFS_INODE_BMAP_SIZE 7 46#define NILFS_INODE_BMAP_SIZE 7
@@ -236,8 +217,10 @@ struct nilfs_super_block {
236 * If there is a bit set in the incompatible feature set that the kernel 217 * 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. 218 * doesn't know about, it should refuse to mount the filesystem.
238 */ 219 */
220#define NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT 0x00000001ULL
221
239#define NILFS_FEATURE_COMPAT_SUPP 0ULL 222#define NILFS_FEATURE_COMPAT_SUPP 0ULL
240#define NILFS_FEATURE_COMPAT_RO_SUPP 0ULL 223#define NILFS_FEATURE_COMPAT_RO_SUPP NILFS_FEATURE_COMPAT_RO_BLOCK_COUNT
241#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL 224#define NILFS_FEATURE_INCOMPAT_SUPP 0ULL
242 225
243/* 226/*
@@ -260,7 +243,6 @@ struct nilfs_super_block {
260#define NILFS_USER_INO 11 /* Fisrt user's file inode number */ 243#define NILFS_USER_INO 11 /* Fisrt user's file inode number */
261 244
262#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */ 245#define NILFS_SB_OFFSET_BYTES 1024 /* byte offset of nilfs superblock */
263#define NILFS_SUPER_MAGIC 0x3434 /* NILFS filesystem magic number */
264 246
265#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in 247#define NILFS_SEG_MIN_BLOCKS 16 /* Minimum number of blocks in
266 a full segment */ 248 a full segment */
@@ -346,17 +328,21 @@ static inline unsigned nilfs_rec_len_from_disk(__le16 dlen)
346{ 328{
347 unsigned len = le16_to_cpu(dlen); 329 unsigned len = le16_to_cpu(dlen);
348 330
331#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
349 if (len == NILFS_MAX_REC_LEN) 332 if (len == NILFS_MAX_REC_LEN)
350 return 1 << 16; 333 return 1 << 16;
334#endif
351 return len; 335 return len;
352} 336}
353 337
354static inline __le16 nilfs_rec_len_to_disk(unsigned len) 338static inline __le16 nilfs_rec_len_to_disk(unsigned len)
355{ 339{
340#if !defined(__KERNEL__) || (PAGE_CACHE_SIZE >= 65536)
356 if (len == (1 << 16)) 341 if (len == (1 << 16))
357 return cpu_to_le16(NILFS_MAX_REC_LEN); 342 return cpu_to_le16(NILFS_MAX_REC_LEN);
358 else if (len > (1 << 16)) 343 else if (len > (1 << 16))
359 BUG(); 344 BUG();
345#endif
360 return cpu_to_le16(len); 346 return cpu_to_le16(len);
361} 347}
362 348
@@ -525,7 +511,7 @@ struct nilfs_checkpoint {
525 __le64 cp_create; 511 __le64 cp_create;
526 __le64 cp_nblk_inc; 512 __le64 cp_nblk_inc;
527 __le64 cp_inodes_count; 513 __le64 cp_inodes_count;
528 __le64 cp_blocks_count; /* Reserved (might be deleted) */ 514 __le64 cp_blocks_count;
529 515
530 /* Do not change the byte offset of ifile inode. 516 /* Do not change the byte offset of ifile inode.
531 To keep the compatibility of the disk format, 517 To keep the compatibility of the disk format,
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 821ffb954f14..30022189104d 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1243,6 +1243,8 @@ enum nl80211_rate_info {
1243 * @NL80211_STA_INFO_LLID: the station's mesh LLID 1243 * @NL80211_STA_INFO_LLID: the station's mesh LLID
1244 * @NL80211_STA_INFO_PLID: the station's mesh PLID 1244 * @NL80211_STA_INFO_PLID: the station's mesh PLID
1245 * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station 1245 * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station
1246 * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested
1247 * attribute, like NL80211_STA_INFO_TX_BITRATE.
1246 * @__NL80211_STA_INFO_AFTER_LAST: internal 1248 * @__NL80211_STA_INFO_AFTER_LAST: internal
1247 * @NL80211_STA_INFO_MAX: highest possible station info attribute 1249 * @NL80211_STA_INFO_MAX: highest possible station info attribute
1248 */ 1250 */
@@ -1261,6 +1263,7 @@ enum nl80211_sta_info {
1261 NL80211_STA_INFO_TX_RETRIES, 1263 NL80211_STA_INFO_TX_RETRIES,
1262 NL80211_STA_INFO_TX_FAILED, 1264 NL80211_STA_INFO_TX_FAILED,
1263 NL80211_STA_INFO_SIGNAL_AVG, 1265 NL80211_STA_INFO_SIGNAL_AVG,
1266 NL80211_STA_INFO_RX_BITRATE,
1264 1267
1265 /* keep last */ 1268 /* keep last */
1266 __NL80211_STA_INFO_AFTER_LAST, 1269 __NL80211_STA_INFO_AFTER_LAST,
diff --git a/include/linux/node.h b/include/linux/node.h
index 1466945cc9ef..92370e22343c 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -39,7 +39,8 @@ extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
39extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); 39extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
40extern int register_mem_sect_under_node(struct memory_block *mem_blk, 40extern int register_mem_sect_under_node(struct memory_block *mem_blk,
41 int nid); 41 int nid);
42extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); 42extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
43 unsigned long phys_index);
43 44
44#ifdef CONFIG_HUGETLBFS 45#ifdef CONFIG_HUGETLBFS
45extern void register_hugetlbfs_with_node(node_registration_func_t doregister, 46extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
@@ -67,7 +68,8 @@ static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
67{ 68{
68 return 0; 69 return 0;
69} 70}
70static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) 71static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
72 unsigned long phys_index)
71{ 73{
72 return 0; 74 return 0;
73} 75}
diff --git a/include/linux/of.h b/include/linux/of.h
index cad7cf0ab278..bfc0ed1b0ced 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -23,8 +23,6 @@
23 23
24#include <asm/byteorder.h> 24#include <asm/byteorder.h>
25 25
26#ifdef CONFIG_OF
27
28typedef u32 phandle; 26typedef u32 phandle;
29typedef u32 ihandle; 27typedef u32 ihandle;
30 28
@@ -65,11 +63,18 @@ struct device_node {
65#endif 63#endif
66}; 64};
67 65
66#ifdef CONFIG_OF
67
68/* Pointer for first entry in chain of all nodes. */ 68/* Pointer for first entry in chain of all nodes. */
69extern struct device_node *allnodes; 69extern 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_have_populated_dt(void)
74{
75 return allnodes != NULL;
76}
77
73static inline bool of_node_is_root(const struct device_node *node) 78static inline bool of_node_is_root(const struct device_node *node)
74{ 79{
75 return node && (node->parent == NULL); 80 return node && (node->parent == NULL);
@@ -103,7 +108,7 @@ extern void of_node_put(struct device_node *node);
103#endif 108#endif
104 109
105/* 110/*
106 * OF address retreival & translation 111 * OF address retrieval & translation
107 */ 112 */
108 113
109/* Helper to read a big number; size is in cells (not bytes) */ 114/* Helper to read a big number; size is in cells (not bytes) */
@@ -222,5 +227,12 @@ extern void of_attach_node(struct device_node *);
222extern void of_detach_node(struct device_node *); 227extern void of_detach_node(struct device_node *);
223#endif 228#endif
224 229
230#else
231
232static inline bool of_have_populated_dt(void)
233{
234 return false;
235}
236
225#endif /* CONFIG_OF */ 237#endif /* CONFIG_OF */
226#endif /* _LINUX_OF_H */ 238#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 975d347079d9..8bfe6c1d4365 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev);
18 * @drv: the device_driver structure to test 18 * @drv: the device_driver structure to test
19 * @dev: the device structure to match against 19 * @dev: the device structure to match against
20 */ 20 */
21static inline int of_driver_match_device(const struct device *dev, 21static inline int of_driver_match_device(struct device *dev,
22 const struct device_driver *drv) 22 const struct device_driver *drv)
23{ 23{
24 return of_match_device(drv->of_match_table, dev) != NULL; 24 dev->of_match = of_match_device(drv->of_match_table, dev);
25 return dev->of_match != NULL;
25} 26}
26 27
27extern struct platform_device *of_dev_get(struct platform_device *dev); 28extern struct platform_device *of_dev_get(struct platform_device *dev);
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
new file mode 100644
index 000000000000..85a27b650d76
--- /dev/null
+++ b/include/linux/of_pci.h
@@ -0,0 +1,9 @@
1#ifndef __OF_PCI_H
2#define __OF_PCI_H
3
4#include <linux/pci.h>
5
6struct pci_dev;
7struct of_irq;
8int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
9#endif
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a68716ad38ce..fb51ae38cea7 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -23,13 +23,7 @@
23 * of_platform_driver - Legacy of-aware driver for platform devices. 23 * of_platform_driver - Legacy of-aware driver for platform devices.
24 * 24 *
25 * An of_platform_driver driver is attached to a basic platform_device on 25 * An of_platform_driver driver is attached to a basic platform_device on
26 * ether the "platform bus" (platform_bus_type), or the ibm ebus 26 * the ibm ebus (ibmebus_bus_type).
27 * (ibmebus_bus_type).
28 *
29 * of_platform_driver is being phased out when used with the platform_bus_type,
30 * and regular platform_drivers should be used instead. When the transition
31 * is complete, only ibmebus will be using this structure, and the
32 * platform_driver member of this structure will be removed.
33 */ 27 */
34struct of_platform_driver 28struct of_platform_driver
35{ 29{
@@ -42,35 +36,22 @@ struct of_platform_driver
42 int (*shutdown)(struct platform_device* dev); 36 int (*shutdown)(struct platform_device* dev);
43 37
44 struct device_driver driver; 38 struct device_driver driver;
45 struct platform_driver platform_driver;
46}; 39};
47#define to_of_platform_driver(drv) \ 40#define to_of_platform_driver(drv) \
48 container_of(drv,struct of_platform_driver, driver) 41 container_of(drv,struct of_platform_driver, driver)
49 42
50extern int of_register_driver(struct of_platform_driver *drv,
51 struct bus_type *bus);
52extern void of_unregister_driver(struct of_platform_driver *drv);
53
54/* Platform drivers register/unregister */ 43/* Platform drivers register/unregister */
55extern int of_register_platform_driver(struct of_platform_driver *drv);
56extern void of_unregister_platform_driver(struct of_platform_driver *drv);
57
58extern struct platform_device *of_device_alloc(struct device_node *np, 44extern struct platform_device *of_device_alloc(struct device_node *np,
59 const char *bus_id, 45 const char *bus_id,
60 struct device *parent); 46 struct device *parent);
61extern struct platform_device *of_find_device_by_node(struct device_node *np); 47extern struct platform_device *of_find_device_by_node(struct device_node *np);
62 48
63extern int of_bus_type_init(struct bus_type *bus, const char *name);
64
65#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */ 49#if !defined(CONFIG_SPARC) /* SPARC has its own device registration method */
66/* Platform devices and busses creation */ 50/* Platform devices and busses creation */
67extern struct platform_device *of_platform_device_create(struct device_node *np, 51extern struct platform_device *of_platform_device_create(struct device_node *np,
68 const char *bus_id, 52 const char *bus_id,
69 struct device *parent); 53 struct device *parent);
70 54
71/* pseudo "matches" value to not do deep probe */
72#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
73
74extern int of_platform_bus_probe(struct device_node *root, 55extern int of_platform_bus_probe(struct device_node *root,
75 const struct of_device_id *matches, 56 const struct of_device_id *matches,
76 struct device *parent); 57 struct device *parent);
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h
new file mode 100644
index 000000000000..150822b4dbff
--- /dev/null
+++ b/include/linux/omap3isp.h
@@ -0,0 +1,646 @@
1/*
2 * omap3isp.h
3 *
4 * TI OMAP3 ISP - User-space API
5 *
6 * Copyright (C) 2010 Nokia Corporation
7 * Copyright (C) 2009 Texas Instruments, Inc.
8 *
9 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 * Sakari Ailus <sakari.ailus@iki.fi>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 * 02110-1301 USA
25 */
26
27#ifndef OMAP3_ISP_USER_H
28#define OMAP3_ISP_USER_H
29
30#include <linux/types.h>
31
32/*
33 * Private IOCTLs
34 *
35 * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
36 * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
37 * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
38 * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
39 * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
40 * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
41 * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
42 */
43
44#define VIDIOC_OMAP3ISP_CCDC_CFG \
45 _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
46#define VIDIOC_OMAP3ISP_PRV_CFG \
47 _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
48#define VIDIOC_OMAP3ISP_AEWB_CFG \
49 _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
50#define VIDIOC_OMAP3ISP_HIST_CFG \
51 _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
52#define VIDIOC_OMAP3ISP_AF_CFG \
53 _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
54#define VIDIOC_OMAP3ISP_STAT_REQ \
55 _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
56#define VIDIOC_OMAP3ISP_STAT_EN \
57 _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
58
59/*
60 * Events
61 *
62 * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
63 * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
64 * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
65 * V4L2_EVENT_OMAP3ISP_HS_VS: Horizontal/vertical synchronization detected
66 */
67
68#define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100)
69#define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
70#define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
71#define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
72#define V4L2_EVENT_OMAP3ISP_HS_VS (V4L2_EVENT_OMAP3ISP_CLASS | 0x4)
73
74struct omap3isp_stat_event_status {
75 __u32 frame_number;
76 __u16 config_counter;
77 __u8 buf_err;
78};
79
80/* AE/AWB related structures and flags*/
81
82/* H3A Range Constants */
83#define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023
84#define OMAP3ISP_AEWB_MIN_WIN_H 2
85#define OMAP3ISP_AEWB_MAX_WIN_H 256
86#define OMAP3ISP_AEWB_MIN_WIN_W 6
87#define OMAP3ISP_AEWB_MAX_WIN_W 256
88#define OMAP3ISP_AEWB_MIN_WINVC 1
89#define OMAP3ISP_AEWB_MIN_WINHC 1
90#define OMAP3ISP_AEWB_MAX_WINVC 128
91#define OMAP3ISP_AEWB_MAX_WINHC 36
92#define OMAP3ISP_AEWB_MAX_WINSTART 4095
93#define OMAP3ISP_AEWB_MIN_SUB_INC 2
94#define OMAP3ISP_AEWB_MAX_SUB_INC 32
95#define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600
96
97#define OMAP3ISP_AF_IIRSH_MIN 0
98#define OMAP3ISP_AF_IIRSH_MAX 4095
99#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1
100#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36
101#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1
102#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128
103#define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2
104#define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32
105#define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2
106#define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256
107#define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16
108#define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256
109#define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1
110#define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095
111#define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0
112#define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095
113#define OMAP3ISP_AF_THRESHOLD_MAX 255
114#define OMAP3ISP_AF_COEF_MAX 4095
115#define OMAP3ISP_AF_PAXEL_SIZE 48
116#define OMAP3ISP_AF_MAX_BUF_SIZE 221184
117
118/**
119 * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
120 * saturation_limit: Saturation limit.
121 * @win_height: Window Height. Range 2 - 256, even values only.
122 * @win_width: Window Width. Range 6 - 256, even values only.
123 * @ver_win_count: Vertical Window Count. Range 1 - 128.
124 * @hor_win_count: Horizontal Window Count. Range 1 - 36.
125 * @ver_win_start: Vertical Window Start. Range 0 - 4095.
126 * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
127 * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
128 * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
129 * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
130 * values only.
131 * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
132 * values only.
133 * @alaw_enable: AEW ALAW EN flag.
134 */
135struct omap3isp_h3a_aewb_config {
136 /*
137 * Common fields.
138 * They should be the first ones and must be in the same order as in
139 * ispstat_generic_config struct.
140 */
141 __u32 buf_size;
142 __u16 config_counter;
143
144 /* Private fields */
145 __u16 saturation_limit;
146 __u16 win_height;
147 __u16 win_width;
148 __u16 ver_win_count;
149 __u16 hor_win_count;
150 __u16 ver_win_start;
151 __u16 hor_win_start;
152 __u16 blk_ver_win_start;
153 __u16 blk_win_height;
154 __u16 subsample_ver_inc;
155 __u16 subsample_hor_inc;
156 __u8 alaw_enable;
157};
158
159/**
160 * struct omap3isp_stat_data - Statistic data sent to or received from user
161 * @ts: Timestamp of returned framestats.
162 * @buf: Pointer to pass to user.
163 * @frame_number: Frame number of requested stats.
164 * @cur_frame: Current frame number being processed.
165 * @config_counter: Number of the configuration associated with the data.
166 */
167struct omap3isp_stat_data {
168 struct timeval ts;
169 void __user *buf;
170 __u32 buf_size;
171 __u16 frame_number;
172 __u16 cur_frame;
173 __u16 config_counter;
174};
175
176
177/* Histogram related structs */
178
179/* Flags for number of bins */
180#define OMAP3ISP_HIST_BINS_32 0
181#define OMAP3ISP_HIST_BINS_64 1
182#define OMAP3ISP_HIST_BINS_128 2
183#define OMAP3ISP_HIST_BINS_256 3
184
185/* Number of bins * 4 colors * 4-bytes word */
186#define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4)
187
188#define OMAP3ISP_HIST_MEM_SIZE 1024
189#define OMAP3ISP_HIST_MIN_REGIONS 1
190#define OMAP3ISP_HIST_MAX_REGIONS 4
191#define OMAP3ISP_HIST_MAX_WB_GAIN 255
192#define OMAP3ISP_HIST_MIN_WB_GAIN 0
193#define OMAP3ISP_HIST_MAX_BIT_WIDTH 14
194#define OMAP3ISP_HIST_MIN_BIT_WIDTH 8
195#define OMAP3ISP_HIST_MAX_WG 4
196#define OMAP3ISP_HIST_MAX_BUF_SIZE 4096
197
198/* Source */
199#define OMAP3ISP_HIST_SOURCE_CCDC 0
200#define OMAP3ISP_HIST_SOURCE_MEM 1
201
202/* CFA pattern */
203#define OMAP3ISP_HIST_CFA_BAYER 0
204#define OMAP3ISP_HIST_CFA_FOVEONX3 1
205
206struct omap3isp_hist_region {
207 __u16 h_start;
208 __u16 h_end;
209 __u16 v_start;
210 __u16 v_end;
211};
212
213struct omap3isp_hist_config {
214 /*
215 * Common fields.
216 * They should be the first ones and must be in the same order as in
217 * ispstat_generic_config struct.
218 */
219 __u32 buf_size;
220 __u16 config_counter;
221
222 __u8 num_acc_frames; /* Num of image frames to be processed and
223 accumulated for each histogram frame */
224 __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */
225 __u8 cfa; /* BAYER or FOVEON X3 */
226 __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */
227 __u8 num_regions; /* number of regions to be configured */
228 struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
229};
230
231/* Auto Focus related structs */
232
233#define OMAP3ISP_AF_NUM_COEF 11
234
235enum omap3isp_h3a_af_fvmode {
236 OMAP3ISP_AF_MODE_SUMMED = 0,
237 OMAP3ISP_AF_MODE_PEAK = 1
238};
239
240/* Red, Green, and blue pixel location in the AF windows */
241enum omap3isp_h3a_af_rgbpos {
242 OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */
243 OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */
244 OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */
245 OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */
246 OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */
247 OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */
248};
249
250/* Contains the information regarding the Horizontal Median Filter */
251struct omap3isp_h3a_af_hmf {
252 __u8 enable; /* Status of Horizontal Median Filter */
253 __u8 threshold; /* Threshhold Value for Horizontal Median Filter */
254};
255
256/* Contains the information regarding the IIR Filters */
257struct omap3isp_h3a_af_iir {
258 __u16 h_start; /* IIR horizontal start */
259 __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */
260 __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */
261};
262
263/* Contains the information regarding the Paxels Structure in AF Engine */
264struct omap3isp_h3a_af_paxel {
265 __u16 h_start; /* Horizontal Start Position */
266 __u16 v_start; /* Vertical Start Position */
267 __u8 width; /* Width of the Paxel */
268 __u8 height; /* Height of the Paxel */
269 __u8 h_cnt; /* Horizontal Count */
270 __u8 v_cnt; /* vertical Count */
271 __u8 line_inc; /* Line Increment */
272};
273
274/* Contains the parameters required for hardware set up of AF Engine */
275struct omap3isp_h3a_af_config {
276 /*
277 * Common fields.
278 * They should be the first ones and must be in the same order as in
279 * ispstat_generic_config struct.
280 */
281 __u32 buf_size;
282 __u16 config_counter;
283
284 struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */
285 struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */
286 struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */
287 enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */
288 enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */
289 __u8 alaw_enable; /* AF ALAW status */
290};
291
292/* ISP CCDC structs */
293
294/* Abstraction layer CCDC configurations */
295#define OMAP3ISP_CCDC_ALAW (1 << 0)
296#define OMAP3ISP_CCDC_LPF (1 << 1)
297#define OMAP3ISP_CCDC_BLCLAMP (1 << 2)
298#define OMAP3ISP_CCDC_BCOMP (1 << 3)
299#define OMAP3ISP_CCDC_FPC (1 << 4)
300#define OMAP3ISP_CCDC_CULL (1 << 5)
301#define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7)
302#define OMAP3ISP_CCDC_TBL_LSC (1 << 8)
303
304#define OMAP3ISP_RGB_MAX 3
305
306/* Enumeration constants for Alaw input width */
307enum omap3isp_alaw_ipwidth {
308 OMAP3ISP_ALAW_BIT12_3 = 0x3,
309 OMAP3ISP_ALAW_BIT11_2 = 0x4,
310 OMAP3ISP_ALAW_BIT10_1 = 0x5,
311 OMAP3ISP_ALAW_BIT9_0 = 0x6
312};
313
314/**
315 * struct omap3isp_ccdc_lsc_config - LSC configuration
316 * @offset: Table Offset of the gain table.
317 * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
318 * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
319 * @gain_format: Gain table format.
320 * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
321 * @fmtlnh: Number of pixels in horizontal direction to use for the data
322 * reformatter.
323 * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
324 * @fmtlnv: Number of lines in vertical direction for the data reformatter.
325 * @initial_x: X position, in pixels, of the first active pixel in reference
326 * to the first active paxel. Must be an even number.
327 * @initial_y: Y position, in pixels, of the first active pixel in reference
328 * to the first active paxel. Must be an even number.
329 * @size: Size of LSC gain table. Filled when loaded from userspace.
330 */
331struct omap3isp_ccdc_lsc_config {
332 __u16 offset;
333 __u8 gain_mode_n;
334 __u8 gain_mode_m;
335 __u8 gain_format;
336 __u16 fmtsph;
337 __u16 fmtlnh;
338 __u16 fmtslv;
339 __u16 fmtlnv;
340 __u8 initial_x;
341 __u8 initial_y;
342 __u32 size;
343};
344
345/**
346 * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
347 * @obgain: Optical black average gain.
348 * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
349 * @oblines: Optical Black Sample lines.
350 * @oblen: Optical Black Sample Length.
351 * @dcsubval: Digital Black Clamp subtract value.
352 */
353struct omap3isp_ccdc_bclamp {
354 __u8 obgain;
355 __u8 obstpixel;
356 __u8 oblines;
357 __u8 oblen;
358 __u16 dcsubval;
359};
360
361/**
362 * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
363 * @fpnum: Number of faulty pixels to be corrected in the frame.
364 * @fpcaddr: Memory address of the FPC Table
365 */
366struct omap3isp_ccdc_fpc {
367 __u16 fpnum;
368 __u32 fpcaddr;
369};
370
371/**
372 * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
373 * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
374 * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
375 * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
376 * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
377 */
378struct omap3isp_ccdc_blcomp {
379 __u8 b_mg;
380 __u8 gb_g;
381 __u8 gr_cy;
382 __u8 r_ye;
383};
384
385/**
386 * omap3isp_ccdc_culling - Culling parameters
387 * @v_pattern: Vertical culling pattern.
388 * @h_odd: Horizontal Culling pattern for odd lines.
389 * @h_even: Horizontal Culling pattern for even lines.
390 */
391struct omap3isp_ccdc_culling {
392 __u8 v_pattern;
393 __u16 h_odd;
394 __u16 h_even;
395};
396
397/**
398 * omap3isp_ccdc_update_config - CCDC configuration
399 * @update: Specifies which CCDC registers should be updated.
400 * @flag: Specifies which CCDC functions should be enabled.
401 * @alawip: Enable/Disable A-Law compression.
402 * @bclamp: Black clamp control register.
403 * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
404 * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
405 * @cull: Cull control register.
406 * @lsc: Pointer to LSC gain table.
407 */
408struct omap3isp_ccdc_update_config {
409 __u16 update;
410 __u16 flag;
411 enum omap3isp_alaw_ipwidth alawip;
412 struct omap3isp_ccdc_bclamp __user *bclamp;
413 struct omap3isp_ccdc_blcomp __user *blcomp;
414 struct omap3isp_ccdc_fpc __user *fpc;
415 struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
416 struct omap3isp_ccdc_culling __user *cull;
417 __u8 __user *lsc;
418};
419
420/* Preview configurations */
421#define OMAP3ISP_PREV_LUMAENH (1 << 0)
422#define OMAP3ISP_PREV_INVALAW (1 << 1)
423#define OMAP3ISP_PREV_HRZ_MED (1 << 2)
424#define OMAP3ISP_PREV_CFA (1 << 3)
425#define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4)
426#define OMAP3ISP_PREV_WB (1 << 5)
427#define OMAP3ISP_PREV_BLKADJ (1 << 6)
428#define OMAP3ISP_PREV_RGB2RGB (1 << 7)
429#define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
430#define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
431#define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
432#define OMAP3ISP_PREV_GAMMABYPASS (1 << 11)
433#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
434#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
435#define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
436#define OMAP3ISP_PREV_NF (1 << 15)
437#define OMAP3ISP_PREV_GAMMA (1 << 16)
438
439#define OMAP3ISP_PREV_NF_TBL_SIZE 64
440#define OMAP3ISP_PREV_CFA_TBL_SIZE 576
441#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
442#define OMAP3ISP_PREV_YENH_TBL_SIZE 128
443
444#define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4
445
446/**
447 * struct omap3isp_prev_hmed - Horizontal Median Filter
448 * @odddist: Distance between consecutive pixels of same color in the odd line.
449 * @evendist: Distance between consecutive pixels of same color in the even
450 * line.
451 * @thres: Horizontal median filter threshold.
452 */
453struct omap3isp_prev_hmed {
454 __u8 odddist;
455 __u8 evendist;
456 __u8 thres;
457};
458
459/*
460 * Enumeration for CFA Formats supported by preview
461 */
462enum omap3isp_cfa_fmt {
463 OMAP3ISP_CFAFMT_BAYER,
464 OMAP3ISP_CFAFMT_SONYVGA,
465 OMAP3ISP_CFAFMT_RGBFOVEON,
466 OMAP3ISP_CFAFMT_DNSPL,
467 OMAP3ISP_CFAFMT_HONEYCOMB,
468 OMAP3ISP_CFAFMT_RRGGBBFOVEON
469};
470
471/**
472 * struct omap3isp_prev_cfa - CFA Interpolation
473 * @format: CFA Format Enum value supported by preview.
474 * @gradthrs_vert: CFA Gradient Threshold - Vertical.
475 * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
476 * @table: Pointer to the CFA table.
477 */
478struct omap3isp_prev_cfa {
479 enum omap3isp_cfa_fmt format;
480 __u8 gradthrs_vert;
481 __u8 gradthrs_horz;
482 __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE];
483};
484
485/**
486 * struct omap3isp_prev_csup - Chrominance Suppression
487 * @gain: Gain.
488 * @thres: Threshold.
489 * @hypf_en: Flag to enable/disable the High Pass Filter.
490 */
491struct omap3isp_prev_csup {
492 __u8 gain;
493 __u8 thres;
494 __u8 hypf_en;
495};
496
497/**
498 * struct omap3isp_prev_wbal - White Balance
499 * @dgain: Digital gain (U10Q8).
500 * @coef3: White balance gain - COEF 3 (U8Q5).
501 * @coef2: White balance gain - COEF 2 (U8Q5).
502 * @coef1: White balance gain - COEF 1 (U8Q5).
503 * @coef0: White balance gain - COEF 0 (U8Q5).
504 */
505struct omap3isp_prev_wbal {
506 __u16 dgain;
507 __u8 coef3;
508 __u8 coef2;
509 __u8 coef1;
510 __u8 coef0;
511};
512
513/**
514 * struct omap3isp_prev_blkadj - Black Level Adjustment
515 * @red: Black level offset adjustment for Red in 2's complement format
516 * @green: Black level offset adjustment for Green in 2's complement format
517 * @blue: Black level offset adjustment for Blue in 2's complement format
518 */
519struct omap3isp_prev_blkadj {
520 /*Black level offset adjustment for Red in 2's complement format */
521 __u8 red;
522 /*Black level offset adjustment for Green in 2's complement format */
523 __u8 green;
524 /* Black level offset adjustment for Blue in 2's complement format */
525 __u8 blue;
526};
527
528/**
529 * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
530 * @matrix: Blending values(S12Q8 format)
531 * [RR] [GR] [BR]
532 * [RG] [GG] [BG]
533 * [RB] [GB] [BB]
534 * @offset: Blending offset value for R,G,B in 2's complement integer format.
535 */
536struct omap3isp_prev_rgbtorgb {
537 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
538 __u16 offset[OMAP3ISP_RGB_MAX];
539};
540
541/**
542 * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
543 * @matrix: Color space conversion coefficients(S10Q8)
544 * [CSCRY] [CSCGY] [CSCBY]
545 * [CSCRCB] [CSCGCB] [CSCBCB]
546 * [CSCRCR] [CSCGCR] [CSCBCR]
547 * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
548 */
549struct omap3isp_prev_csc {
550 __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
551 __s16 offset[OMAP3ISP_RGB_MAX];
552};
553
554/**
555 * struct omap3isp_prev_yclimit - Y, C Value Limit
556 * @minC: Minimum C value
557 * @maxC: Maximum C value
558 * @minY: Minimum Y value
559 * @maxY: Maximum Y value
560 */
561struct omap3isp_prev_yclimit {
562 __u8 minC;
563 __u8 maxC;
564 __u8 minY;
565 __u8 maxY;
566};
567
568/**
569 * struct omap3isp_prev_dcor - Defect correction
570 * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
571 * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
572 */
573struct omap3isp_prev_dcor {
574 __u8 couplet_mode_en;
575 __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
576};
577
578/**
579 * struct omap3isp_prev_nf - Noise Filter
580 * @spread: Spread value to be used in Noise Filter
581 * @table: Pointer to the Noise Filter table
582 */
583struct omap3isp_prev_nf {
584 __u8 spread;
585 __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
586};
587
588/**
589 * struct omap3isp_prev_gtables - Gamma correction tables
590 * @red: Array for red gamma table.
591 * @green: Array for green gamma table.
592 * @blue: Array for blue gamma table.
593 */
594struct omap3isp_prev_gtables {
595 __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
596 __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
597 __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
598};
599
600/**
601 * struct omap3isp_prev_luma - Luma enhancement
602 * @table: Array for luma enhancement table.
603 */
604struct omap3isp_prev_luma {
605 __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
606};
607
608/**
609 * struct omap3isp_prev_update_config - Preview engine configuration (user)
610 * @update: Specifies which ISP Preview registers should be updated.
611 * @flag: Specifies which ISP Preview functions should be enabled.
612 * @shading_shift: 3bit value of shift used in shading compensation.
613 * @luma: Pointer to luma enhancement structure.
614 * @hmed: Pointer to structure containing the odd and even distance.
615 * between the pixels in the image along with the filter threshold.
616 * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
617 * format in the image, vertical and horizontal gradient threshold.
618 * @csup: Pointer to Structure for Chrominance Suppression coefficients.
619 * @wbal: Pointer to structure for White Balance.
620 * @blkadj: Pointer to structure for Black Adjustment.
621 * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
622 * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
623 * @yclimit: Pointer to structure for Y, C Value Limit.
624 * @dcor: Pointer to structure for defect correction.
625 * @nf: Pointer to structure for Noise Filter
626 * @gamma: Pointer to gamma structure.
627 */
628struct omap3isp_prev_update_config {
629 __u32 update;
630 __u32 flag;
631 __u32 shading_shift;
632 struct omap3isp_prev_luma __user *luma;
633 struct omap3isp_prev_hmed __user *hmed;
634 struct omap3isp_prev_cfa __user *cfa;
635 struct omap3isp_prev_csup __user *csup;
636 struct omap3isp_prev_wbal __user *wbal;
637 struct omap3isp_prev_blkadj __user *blkadj;
638 struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
639 struct omap3isp_prev_csc __user *csc;
640 struct omap3isp_prev_yclimit __user *yclimit;
641 struct omap3isp_prev_dcor __user *dcor;
642 struct omap3isp_prev_nf __user *nf;
643 struct omap3isp_prev_gtables __user *gamma;
644};
645
646#endif /* OMAP3_ISP_USER_H */
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 1ca64113efe8..7f5cfd3b37dd 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -106,6 +106,13 @@ void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
106void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs, 106void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
107 unsigned long event, int is_kernel); 107 unsigned long event, int is_kernel);
108 108
109/**
110 * Add an hardware sample.
111 */
112void oprofile_add_ext_hw_sample(unsigned long pc, struct pt_regs * const regs,
113 unsigned long event, int is_kernel,
114 struct task_struct *task);
115
109/* Use this instead when the PC value is not from the regs. Doesn't 116/* Use this instead when the PC value is not from the regs. Doesn't
110 * backtrace. */ 117 * backtrace. */
111void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event); 118void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0db8037e2725..811183de1ef5 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -196,7 +196,7 @@ static inline int __TestClearPage##uname(struct page *page) { return 0; }
196 196
197struct page; /* forward declaration */ 197struct page; /* forward declaration */
198 198
199TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) 199TESTPAGEFLAG(Locked, locked)
200PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error) 200PAGEFLAG(Error, error) TESTCLEARFLAG(Error, error)
201PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 201PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 202PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 6d6cb7a57bb3..f5de21de31dd 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -1,8 +1,26 @@
1#ifndef __LINUX_PAGE_CGROUP_H 1#ifndef __LINUX_PAGE_CGROUP_H
2#define __LINUX_PAGE_CGROUP_H 2#define __LINUX_PAGE_CGROUP_H
3 3
4enum {
5 /* flags for mem_cgroup */
6 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
7 PCG_CACHE, /* charged as cache */
8 PCG_USED, /* this object is in use. */
9 PCG_MIGRATION, /* under page migration */
10 /* flags for mem_cgroup and file and I/O status */
11 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
12 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
13 /* No lock in page_cgroup */
14 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
15 __NR_PCG_FLAGS,
16};
17
18#ifndef __GENERATING_BOUNDS_H
19#include <generated/bounds.h>
20
4#ifdef CONFIG_CGROUP_MEM_RES_CTLR 21#ifdef CONFIG_CGROUP_MEM_RES_CTLR
5#include <linux/bit_spinlock.h> 22#include <linux/bit_spinlock.h>
23
6/* 24/*
7 * Page Cgroup can be considered as an extended mem_map. 25 * Page Cgroup can be considered as an extended mem_map.
8 * A page_cgroup page is associated with every page descriptor. The 26 * A page_cgroup page is associated with every page descriptor. The
@@ -13,7 +31,6 @@
13struct page_cgroup { 31struct page_cgroup {
14 unsigned long flags; 32 unsigned long flags;
15 struct mem_cgroup *mem_cgroup; 33 struct mem_cgroup *mem_cgroup;
16 struct page *page;
17 struct list_head lru; /* per cgroup LRU list */ 34 struct list_head lru; /* per cgroup LRU list */
18}; 35};
19 36
@@ -32,19 +49,7 @@ static inline void __init page_cgroup_init(void)
32#endif 49#endif
33 50
34struct page_cgroup *lookup_page_cgroup(struct page *page); 51struct page_cgroup *lookup_page_cgroup(struct page *page);
35 52struct page *lookup_cgroup_page(struct page_cgroup *pc);
36enum {
37 /* flags for mem_cgroup */
38 PCG_LOCK, /* Lock for pc->mem_cgroup and following bits. */
39 PCG_CACHE, /* charged as cache */
40 PCG_USED, /* this object is in use. */
41 PCG_MIGRATION, /* under page migration */
42 /* flags for mem_cgroup and file and I/O status */
43 PCG_MOVE_LOCK, /* For race between move_account v.s. following bits */
44 PCG_FILE_MAPPED, /* page is accounted as "mapped" */
45 /* No lock in page_cgroup */
46 PCG_ACCT_LRU, /* page has been accounted for (under lru_lock) */
47};
48 53
49#define TESTPCGFLAG(uname, lname) \ 54#define TESTPCGFLAG(uname, lname) \
50static inline int PageCgroup##uname(struct page_cgroup *pc) \ 55static inline int PageCgroup##uname(struct page_cgroup *pc) \
@@ -85,16 +90,6 @@ SETPCGFLAG(Migration, MIGRATION)
85CLEARPCGFLAG(Migration, MIGRATION) 90CLEARPCGFLAG(Migration, MIGRATION)
86TESTPCGFLAG(Migration, MIGRATION) 91TESTPCGFLAG(Migration, MIGRATION)
87 92
88static inline int page_cgroup_nid(struct page_cgroup *pc)
89{
90 return page_to_nid(pc->page);
91}
92
93static inline enum zone_type page_cgroup_zid(struct page_cgroup *pc)
94{
95 return page_zonenum(pc->page);
96}
97
98static inline void lock_page_cgroup(struct page_cgroup *pc) 93static inline void lock_page_cgroup(struct page_cgroup *pc)
99{ 94{
100 /* 95 /*
@@ -109,11 +104,6 @@ static inline void unlock_page_cgroup(struct page_cgroup *pc)
109 bit_spin_unlock(PCG_LOCK, &pc->flags); 104 bit_spin_unlock(PCG_LOCK, &pc->flags);
110} 105}
111 106
112static inline int page_is_cgroup_locked(struct page_cgroup *pc)
113{
114 return bit_spin_is_locked(PCG_LOCK, &pc->flags);
115}
116
117static inline void move_lock_page_cgroup(struct page_cgroup *pc, 107static inline void move_lock_page_cgroup(struct page_cgroup *pc,
118 unsigned long *flags) 108 unsigned long *flags)
119{ 109{
@@ -132,6 +122,39 @@ static inline void move_unlock_page_cgroup(struct page_cgroup *pc,
132 local_irq_restore(*flags); 122 local_irq_restore(*flags);
133} 123}
134 124
125#ifdef CONFIG_SPARSEMEM
126#define PCG_ARRAYID_WIDTH SECTIONS_SHIFT
127#else
128#define PCG_ARRAYID_WIDTH NODES_SHIFT
129#endif
130
131#if (PCG_ARRAYID_WIDTH > BITS_PER_LONG - NR_PCG_FLAGS)
132#error Not enough space left in pc->flags to store page_cgroup array IDs
133#endif
134
135/* pc->flags: ARRAY-ID | FLAGS */
136
137#define PCG_ARRAYID_MASK ((1UL << PCG_ARRAYID_WIDTH) - 1)
138
139#define PCG_ARRAYID_OFFSET (BITS_PER_LONG - PCG_ARRAYID_WIDTH)
140/*
141 * Zero the shift count for non-existant fields, to prevent compiler
142 * warnings and ensure references are optimized away.
143 */
144#define PCG_ARRAYID_SHIFT (PCG_ARRAYID_OFFSET * (PCG_ARRAYID_WIDTH != 0))
145
146static inline void set_page_cgroup_array_id(struct page_cgroup *pc,
147 unsigned long id)
148{
149 pc->flags &= ~(PCG_ARRAYID_MASK << PCG_ARRAYID_SHIFT);
150 pc->flags |= (id & PCG_ARRAYID_MASK) << PCG_ARRAYID_SHIFT;
151}
152
153static inline unsigned long page_cgroup_array_id(struct page_cgroup *pc)
154{
155 return (pc->flags >> PCG_ARRAYID_SHIFT) & PCG_ARRAYID_MASK;
156}
157
135#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 158#else /* CONFIG_CGROUP_MEM_RES_CTLR */
136struct page_cgroup; 159struct page_cgroup;
137 160
@@ -152,7 +175,7 @@ static inline void __init page_cgroup_init_flatmem(void)
152{ 175{
153} 176}
154 177
155#endif 178#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
156 179
157#include <linux/swap.h> 180#include <linux/swap.h>
158 181
@@ -188,5 +211,8 @@ static inline void swap_cgroup_swapoff(int type)
188 return; 211 return;
189} 212}
190 213
191#endif 214#endif /* CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
192#endif 215
216#endif /* !__GENERATING_BOUNDS_H */
217
218#endif /* __LINUX_PAGE_CGROUP_H */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index e112b8db2f3c..c11950652646 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -443,8 +443,9 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
443 pgoff_t index, gfp_t gfp_mask); 443 pgoff_t index, gfp_t gfp_mask);
444int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 444int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
445 pgoff_t index, gfp_t gfp_mask); 445 pgoff_t index, gfp_t gfp_mask);
446extern void remove_from_page_cache(struct page *page); 446extern void delete_from_page_cache(struct page *page);
447extern void __remove_from_page_cache(struct page *page); 447extern void __delete_from_page_cache(struct page *page);
448int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
448 449
449/* 450/*
450 * Like add_to_page_cache_locked, but used to add newly allocated pages: 451 * Like add_to_page_cache_locked, but used to add newly allocated pages:
diff --git a/include/linux/pata_arasan_cf_data.h b/include/linux/pata_arasan_cf_data.h
new file mode 100644
index 000000000000..a6ee9aa898bb
--- /dev/null
+++ b/include/linux/pata_arasan_cf_data.h
@@ -0,0 +1,49 @@
1/*
2 * include/linux/pata_arasan_cf_data.h
3 *
4 * Arasan Compact Flash host controller platform data header file
5 *
6 * Copyright (C) 2011 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 _PATA_ARASAN_CF_DATA_H
15#define _PATA_ARASAN_CF_DATA_H
16
17#include <linux/platform_device.h>
18
19struct arasan_cf_pdata {
20 u8 cf_if_clk;
21 #define CF_IF_CLK_100M (0x0)
22 #define CF_IF_CLK_75M (0x1)
23 #define CF_IF_CLK_66M (0x2)
24 #define CF_IF_CLK_50M (0x3)
25 #define CF_IF_CLK_40M (0x4)
26 #define CF_IF_CLK_33M (0x5)
27 #define CF_IF_CLK_25M (0x6)
28 #define CF_IF_CLK_125M (0x7)
29 #define CF_IF_CLK_150M (0x8)
30 #define CF_IF_CLK_166M (0x9)
31 #define CF_IF_CLK_200M (0xA)
32 /*
33 * Platform specific incapabilities of CF controller is handled via
34 * quirks
35 */
36 u32 quirk;
37 #define CF_BROKEN_PIO (1)
38 #define CF_BROKEN_MWDMA (1 << 1)
39 #define CF_BROKEN_UDMA (1 << 2)
40 /* This is platform specific data for the DMA controller */
41 void *dma_priv;
42};
43
44static inline void
45set_arasan_cf_pdata(struct platform_device *pdev, struct arasan_cf_pdata *data)
46{
47 pdev->dev.platform_data = data;
48}
49#endif /* _PATA_ARASAN_CF_DATA_H */
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index ce6810512c66..67cb3ae38016 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -26,6 +26,7 @@
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev); 26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30extern void pcie_clear_aspm(void); 31extern void pcie_clear_aspm(void);
31extern void pcie_no_aspm(void); 32extern void pcie_no_aspm(void);
@@ -39,6 +40,9 @@ static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev)
39static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) 40static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
40{ 41{
41} 42}
43static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
44{
45}
42static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 46static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
43{ 47{
44} 48}
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 559d02897075..96f70d7e058d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1002,12 +1002,11 @@ extern bool pcie_ports_auto;
1002#endif 1002#endif
1003 1003
1004#ifndef CONFIG_PCIEASPM 1004#ifndef CONFIG_PCIEASPM
1005static inline int pcie_aspm_enabled(void) 1005static inline int pcie_aspm_enabled(void) { return 0; }
1006{ 1006static inline bool pcie_aspm_support_enabled(void) { return false; }
1007 return 0;
1008}
1009#else 1007#else
1010extern int pcie_aspm_enabled(void); 1008extern int pcie_aspm_enabled(void);
1009extern bool pcie_aspm_support_enabled(void);
1011#endif 1010#endif
1012 1011
1013#ifdef CONFIG_PCIEAER 1012#ifdef CONFIG_PCIEAER
@@ -1191,6 +1190,11 @@ static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
1191 return 0; 1190 return 0;
1192} 1191}
1193 1192
1193static inline int pci_wake_from_d3(struct pci_dev *dev, bool enable)
1194{
1195 return 0;
1196}
1197
1194static inline pci_power_t pci_choose_state(struct pci_dev *dev, 1198static inline pci_power_t pci_choose_state(struct pci_dev *dev,
1195 pm_message_t state) 1199 pm_message_t state)
1196{ 1200{
@@ -1479,6 +1483,7 @@ void pci_request_acs(void);
1479#define PCI_VPD_RO_KEYWORD_PARTNO "PN" 1483#define PCI_VPD_RO_KEYWORD_PARTNO "PN"
1480#define PCI_VPD_RO_KEYWORD_MFR_ID "MN" 1484#define PCI_VPD_RO_KEYWORD_MFR_ID "MN"
1481#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0" 1485#define PCI_VPD_RO_KEYWORD_VENDOR0 "V0"
1486#define PCI_VPD_RO_KEYWORD_CHKSUM "RV"
1482 1487
1483/** 1488/**
1484 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length 1489 * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 3adb06ebf841..11fd38151cc9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -517,7 +517,8 @@
517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 517#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 518#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 519#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
520#define PCI_DEVICE_ID_AMD_15H_NB_MISC 0x1603 520#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603
521#define PCI_DEVICE_ID_AMD_15H_NB_LINK 0x1604
521#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 522#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
522#define PCI_DEVICE_ID_AMD_LANCE 0x2000 523#define PCI_DEVICE_ID_AMD_LANCE 0x2000
523#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 524#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -2078,6 +2079,8 @@
2078#define PCI_DEVICE_ID_TIGON3_5723 0x165b 2079#define PCI_DEVICE_ID_TIGON3_5723 0x165b
2079#define PCI_DEVICE_ID_TIGON3_5705M 0x165d 2080#define PCI_DEVICE_ID_TIGON3_5705M 0x165d
2080#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e 2081#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e
2082#define PCI_DEVICE_ID_NX2_57712 0x1662
2083#define PCI_DEVICE_ID_NX2_57712E 0x1663
2081#define PCI_DEVICE_ID_TIGON3_5714 0x1668 2084#define PCI_DEVICE_ID_TIGON3_5714 0x1668
2082#define PCI_DEVICE_ID_TIGON3_5714S 0x1669 2085#define PCI_DEVICE_ID_TIGON3_5714S 0x1669
2083#define PCI_DEVICE_ID_TIGON3_5780 0x166a 2086#define PCI_DEVICE_ID_TIGON3_5780 0x166a
@@ -2480,6 +2483,9 @@
2480#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22 2483#define PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS 0x1d22
2481#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 2484#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40
2482#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 2485#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41
2486#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MIN 0x2310
2487#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MAX 0x231f
2488#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330
2483#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 2489#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410
2484#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 2490#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411
2485#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 2491#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413
@@ -2731,6 +2737,7 @@
2731#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 2737#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601
2732#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 2738#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119
2733#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a 2739#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a
2740#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186
2734#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 2741#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4
2735#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 2742#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5
2736#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca 2743#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 27c3c6fcfad3..3a5c4449fd36 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -255,6 +255,30 @@ extern void __bad_size_call_parameter(void);
255 pscr2_ret__; \ 255 pscr2_ret__; \
256}) 256})
257 257
258/*
259 * Special handling for cmpxchg_double. cmpxchg_double is passed two
260 * percpu variables. The first has to be aligned to a double word
261 * boundary and the second has to follow directly thereafter.
262 */
263#define __pcpu_double_call_return_bool(stem, pcp1, pcp2, ...) \
264({ \
265 bool pdcrb_ret__; \
266 __verify_pcpu_ptr(&pcp1); \
267 BUILD_BUG_ON(sizeof(pcp1) != sizeof(pcp2)); \
268 VM_BUG_ON((unsigned long)(&pcp1) % (2 * sizeof(pcp1))); \
269 VM_BUG_ON((unsigned long)(&pcp2) != \
270 (unsigned long)(&pcp1) + sizeof(pcp1)); \
271 switch(sizeof(pcp1)) { \
272 case 1: pdcrb_ret__ = stem##1(pcp1, pcp2, __VA_ARGS__); break; \
273 case 2: pdcrb_ret__ = stem##2(pcp1, pcp2, __VA_ARGS__); break; \
274 case 4: pdcrb_ret__ = stem##4(pcp1, pcp2, __VA_ARGS__); break; \
275 case 8: pdcrb_ret__ = stem##8(pcp1, pcp2, __VA_ARGS__); break; \
276 default: \
277 __bad_size_call_parameter(); break; \
278 } \
279 pdcrb_ret__; \
280})
281
258#define __pcpu_size_call(stem, variable, ...) \ 282#define __pcpu_size_call(stem, variable, ...) \
259do { \ 283do { \
260 __verify_pcpu_ptr(&(variable)); \ 284 __verify_pcpu_ptr(&(variable)); \
@@ -501,6 +525,45 @@ do { \
501#endif 525#endif
502 526
503/* 527/*
528 * cmpxchg_double replaces two adjacent scalars at once. The first
529 * two parameters are per cpu variables which have to be of the same
530 * size. A truth value is returned to indicate success or failure
531 * (since a double register result is difficult to handle). There is
532 * very limited hardware support for these operations, so only certain
533 * sizes may work.
534 */
535#define _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
536({ \
537 int ret__; \
538 preempt_disable(); \
539 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
540 oval1, oval2, nval1, nval2); \
541 preempt_enable(); \
542 ret__; \
543})
544
545#ifndef this_cpu_cmpxchg_double
546# ifndef this_cpu_cmpxchg_double_1
547# define this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
548 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
549# endif
550# ifndef this_cpu_cmpxchg_double_2
551# define this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
552 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
553# endif
554# ifndef this_cpu_cmpxchg_double_4
555# define this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
556 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
557# endif
558# ifndef this_cpu_cmpxchg_double_8
559# define this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
560 _this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
561# endif
562# define this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
563 __pcpu_double_call_return_bool(this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
564#endif
565
566/*
504 * Generic percpu operations that do not require preemption handling. 567 * Generic percpu operations that do not require preemption handling.
505 * Either we do not care about races or the caller has the 568 * Either we do not care about races or the caller has the
506 * responsibility of handling preemptions issues. Arch code can still 569 * responsibility of handling preemptions issues. Arch code can still
@@ -703,6 +766,39 @@ do { \
703 __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval) 766 __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval)
704#endif 767#endif
705 768
769#define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
770({ \
771 int __ret = 0; \
772 if (__this_cpu_read(pcp1) == (oval1) && \
773 __this_cpu_read(pcp2) == (oval2)) { \
774 __this_cpu_write(pcp1, (nval1)); \
775 __this_cpu_write(pcp2, (nval2)); \
776 __ret = 1; \
777 } \
778 (__ret); \
779})
780
781#ifndef __this_cpu_cmpxchg_double
782# ifndef __this_cpu_cmpxchg_double_1
783# define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
784 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
785# endif
786# ifndef __this_cpu_cmpxchg_double_2
787# define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
788 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
789# endif
790# ifndef __this_cpu_cmpxchg_double_4
791# define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
792 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
793# endif
794# ifndef __this_cpu_cmpxchg_double_8
795# define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
796 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
797# endif
798# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
799 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
800#endif
801
706/* 802/*
707 * IRQ safe versions of the per cpu RMW operations. Note that these operations 803 * IRQ safe versions of the per cpu RMW operations. Note that these operations
708 * are *not* safe against modification of the same variable from another 804 * are *not* safe against modification of the same variable from another
@@ -823,4 +919,36 @@ do { \
823 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval) 919 __pcpu_size_call_return2(irqsafe_cpu_cmpxchg_, (pcp), oval, nval)
824#endif 920#endif
825 921
922#define irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
923({ \
924 int ret__; \
925 unsigned long flags; \
926 local_irq_save(flags); \
927 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \
928 oval1, oval2, nval1, nval2); \
929 local_irq_restore(flags); \
930 ret__; \
931})
932
933#ifndef irqsafe_cpu_cmpxchg_double
934# ifndef irqsafe_cpu_cmpxchg_double_1
935# define irqsafe_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
936 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
937# endif
938# ifndef irqsafe_cpu_cmpxchg_double_2
939# define irqsafe_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
940 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
941# endif
942# ifndef irqsafe_cpu_cmpxchg_double_4
943# define irqsafe_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
944 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
945# endif
946# ifndef irqsafe_cpu_cmpxchg_double_8
947# define irqsafe_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
948 irqsafe_generic_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
949# endif
950# define irqsafe_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
951 __pcpu_double_call_return_int(irqsafe_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
952#endif
953
826#endif /* __LINUX_PERCPU_H */ 954#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index dda5b0a3ff60..311b4dc785a1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -225,8 +225,14 @@ struct perf_event_attr {
225 }; 225 };
226 226
227 __u32 bp_type; 227 __u32 bp_type;
228 __u64 bp_addr; 228 union {
229 __u64 bp_len; 229 __u64 bp_addr;
230 __u64 config1; /* extension of config */
231 };
232 union {
233 __u64 bp_len;
234 __u64 config2; /* extension of config1 */
235 };
230}; 236};
231 237
232/* 238/*
@@ -464,6 +470,7 @@ enum perf_callchain_context {
464 470
465#define PERF_FLAG_FD_NO_GROUP (1U << 0) 471#define PERF_FLAG_FD_NO_GROUP (1U << 0)
466#define PERF_FLAG_FD_OUTPUT (1U << 1) 472#define PERF_FLAG_FD_OUTPUT (1U << 1)
473#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
467 474
468#ifdef __KERNEL__ 475#ifdef __KERNEL__
469/* 476/*
@@ -471,6 +478,7 @@ enum perf_callchain_context {
471 */ 478 */
472 479
473#ifdef CONFIG_PERF_EVENTS 480#ifdef CONFIG_PERF_EVENTS
481# include <linux/cgroup.h>
474# include <asm/perf_event.h> 482# include <asm/perf_event.h>
475# include <asm/local64.h> 483# include <asm/local64.h>
476#endif 484#endif
@@ -539,6 +547,9 @@ struct hw_perf_event {
539 unsigned long event_base; 547 unsigned long event_base;
540 int idx; 548 int idx;
541 int last_cpu; 549 int last_cpu;
550 unsigned int extra_reg;
551 u64 extra_config;
552 int extra_alloc;
542 }; 553 };
543 struct { /* software */ 554 struct { /* software */
544 struct hrtimer hrtimer; 555 struct hrtimer hrtimer;
@@ -716,6 +727,22 @@ struct swevent_hlist {
716#define PERF_ATTACH_GROUP 0x02 727#define PERF_ATTACH_GROUP 0x02
717#define PERF_ATTACH_TASK 0x04 728#define PERF_ATTACH_TASK 0x04
718 729
730#ifdef CONFIG_CGROUP_PERF
731/*
732 * perf_cgroup_info keeps track of time_enabled for a cgroup.
733 * This is a per-cpu dynamically allocated data structure.
734 */
735struct perf_cgroup_info {
736 u64 time;
737 u64 timestamp;
738};
739
740struct perf_cgroup {
741 struct cgroup_subsys_state css;
742 struct perf_cgroup_info *info; /* timing info, one per cpu */
743};
744#endif
745
719/** 746/**
720 * struct perf_event - performance event kernel representation: 747 * struct perf_event - performance event kernel representation:
721 */ 748 */
@@ -832,6 +859,11 @@ struct perf_event {
832 struct event_filter *filter; 859 struct event_filter *filter;
833#endif 860#endif
834 861
862#ifdef CONFIG_CGROUP_PERF
863 struct perf_cgroup *cgrp; /* cgroup event is attach to */
864 int cgrp_defer_enabled;
865#endif
866
835#endif /* CONFIG_PERF_EVENTS */ 867#endif /* CONFIG_PERF_EVENTS */
836}; 868};
837 869
@@ -846,8 +878,8 @@ enum perf_event_context_type {
846 * Used as a container for task events and CPU events as well: 878 * Used as a container for task events and CPU events as well:
847 */ 879 */
848struct perf_event_context { 880struct perf_event_context {
849 enum perf_event_context_type type;
850 struct pmu *pmu; 881 struct pmu *pmu;
882 enum perf_event_context_type type;
851 /* 883 /*
852 * Protect the states of the events in the list, 884 * Protect the states of the events in the list,
853 * nr_active, and the list: 885 * nr_active, and the list:
@@ -886,6 +918,7 @@ struct perf_event_context {
886 u64 generation; 918 u64 generation;
887 int pin_count; 919 int pin_count;
888 struct rcu_head rcu_head; 920 struct rcu_head rcu_head;
921 int nr_cgroups; /* cgroup events present */
889}; 922};
890 923
891/* 924/*
@@ -905,6 +938,7 @@ struct perf_cpu_context {
905 struct list_head rotation_list; 938 struct list_head rotation_list;
906 int jiffies_interval; 939 int jiffies_interval;
907 struct pmu *active_pmu; 940 struct pmu *active_pmu;
941 struct perf_cgroup *cgrp;
908}; 942};
909 943
910struct perf_output_handle { 944struct perf_output_handle {
@@ -1040,11 +1074,11 @@ have_event:
1040 __perf_sw_event(event_id, nr, nmi, regs, addr); 1074 __perf_sw_event(event_id, nr, nmi, regs, addr);
1041} 1075}
1042 1076
1043extern atomic_t perf_task_events; 1077extern atomic_t perf_sched_events;
1044 1078
1045static inline void perf_event_task_sched_in(struct task_struct *task) 1079static inline void perf_event_task_sched_in(struct task_struct *task)
1046{ 1080{
1047 COND_STMT(&perf_task_events, __perf_event_task_sched_in(task)); 1081 COND_STMT(&perf_sched_events, __perf_event_task_sched_in(task));
1048} 1082}
1049 1083
1050static inline 1084static inline
@@ -1052,7 +1086,7 @@ void perf_event_task_sched_out(struct task_struct *task, struct task_struct *nex
1052{ 1086{
1053 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); 1087 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
1054 1088
1055 COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next)); 1089 COND_STMT(&perf_sched_events, __perf_event_task_sched_out(task, next));
1056} 1090}
1057 1091
1058extern void perf_event_mmap(struct vm_area_struct *vma); 1092extern void perf_event_mmap(struct vm_area_struct *vma);
@@ -1083,6 +1117,10 @@ extern int sysctl_perf_event_paranoid;
1083extern int sysctl_perf_event_mlock; 1117extern int sysctl_perf_event_mlock;
1084extern int sysctl_perf_event_sample_rate; 1118extern int sysctl_perf_event_sample_rate;
1085 1119
1120extern int perf_proc_update_handler(struct ctl_table *table, int write,
1121 void __user *buffer, size_t *lenp,
1122 loff_t *ppos);
1123
1086static inline bool perf_paranoid_tracepoint_raw(void) 1124static inline bool perf_paranoid_tracepoint_raw(void)
1087{ 1125{
1088 return sysctl_perf_event_paranoid > -1; 1126 return sysctl_perf_event_paranoid > -1;
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 26c8df786918..6fb13841db45 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -36,9 +36,7 @@
36/* Socket options for SOL_PNPIPE level */ 36/* Socket options for SOL_PNPIPE level */
37#define PNPIPE_ENCAP 1 37#define PNPIPE_ENCAP 1
38#define PNPIPE_IFINDEX 2 38#define PNPIPE_IFINDEX 2
39#define PNPIPE_PIPE_HANDLE 3 39#define PNPIPE_HANDLE 3
40#define PNPIPE_ENABLE 4
41/* unused slot */
42 40
43#define PNADDR_ANY 0 41#define PNADDR_ANY 0
44#define PNADDR_BROADCAST 0xFC 42#define PNADDR_BROADCAST 0xFC
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 49f1c2f66e95..efceda0a51b1 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -141,6 +141,17 @@ static inline struct pid_namespace *ns_of_pid(struct pid *pid)
141} 141}
142 142
143/* 143/*
144 * is_child_reaper returns true if the pid is the init process
145 * of the current namespace. As this one could be checked before
146 * pid_ns->child_reaper is assigned in copy_process, we check
147 * with the pid number.
148 */
149static inline bool is_child_reaper(struct pid *pid)
150{
151 return pid->numbers[pid->level].nr == 1;
152}
153
154/*
144 * the helpers to get the pid's id seen from different namespaces 155 * the helpers to get the pid's id seen from different namespaces
145 * 156 *
146 * pid_nr() : global id, i.e. the id seen from the init namespace; 157 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 2cfa4bc8dea6..b1032a3fafdc 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -247,6 +247,35 @@ struct tc_gred_sopt {
247 __u16 pad1; 247 __u16 pad1;
248}; 248};
249 249
250/* CHOKe section */
251
252enum {
253 TCA_CHOKE_UNSPEC,
254 TCA_CHOKE_PARMS,
255 TCA_CHOKE_STAB,
256 __TCA_CHOKE_MAX,
257};
258
259#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1)
260
261struct tc_choke_qopt {
262 __u32 limit; /* Hard queue length (packets) */
263 __u32 qth_min; /* Min average threshold (packets) */
264 __u32 qth_max; /* Max average threshold (packets) */
265 unsigned char Wlog; /* log(W) */
266 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
267 unsigned char Scell_log; /* cell size for idle damping */
268 unsigned char flags; /* see RED flags */
269};
270
271struct tc_choke_xstats {
272 __u32 early; /* Early drops */
273 __u32 pdrop; /* Drops due to queue limits */
274 __u32 other; /* Drops due to drop() calls */
275 __u32 marked; /* Marked packets */
276 __u32 matched; /* Drops due to flow match */
277};
278
250/* HTB section */ 279/* HTB section */
251#define TC_HTB_NUMPRIO 8 280#define TC_HTB_NUMPRIO 8
252#define TC_HTB_MAXDEPTH 8 281#define TC_HTB_MAXDEPTH 8
@@ -435,6 +464,7 @@ enum {
435 TCA_NETEM_DELAY_DIST, 464 TCA_NETEM_DELAY_DIST,
436 TCA_NETEM_REORDER, 465 TCA_NETEM_REORDER,
437 TCA_NETEM_CORRUPT, 466 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS,
438 __TCA_NETEM_MAX, 468 __TCA_NETEM_MAX,
439}; 469};
440 470
@@ -465,7 +495,33 @@ struct tc_netem_corrupt {
465 __u32 correlation; 495 __u32 correlation;
466}; 496};
467 497
498enum {
499 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */
501 NETEM_LOSS_GE, /* Gilbert Elliot models */
502 __NETEM_LOSS_MAX
503};
504#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
505
506/* State transition probablities for 4 state model */
507struct tc_netem_gimodel {
508 __u32 p13;
509 __u32 p31;
510 __u32 p32;
511 __u32 p14;
512 __u32 p23;
513};
514
515/* Gilbert-Elliot models */
516struct tc_netem_gemodel {
517 __u32 p;
518 __u32 r;
519 __u32 h;
520 __u32 k1;
521};
522
468#define NETEM_DIST_SCALE 8192 523#define NETEM_DIST_SCALE 8192
524#define NETEM_DIST_MAX 16384
469 525
470/* DRR */ 526/* DRR */
471 527
@@ -481,4 +537,55 @@ struct tc_drr_stats {
481 __u32 deficit; 537 __u32 deficit;
482}; 538};
483 539
540/* MQPRIO */
541#define TC_QOPT_BITMASK 15
542#define TC_QOPT_MAX_QUEUE 16
543
544struct tc_mqprio_qopt {
545 __u8 num_tc;
546 __u8 prio_tc_map[TC_QOPT_BITMASK + 1];
547 __u8 hw;
548 __u16 count[TC_QOPT_MAX_QUEUE];
549 __u16 offset[TC_QOPT_MAX_QUEUE];
550};
551
552/* SFB */
553
554enum {
555 TCA_SFB_UNSPEC,
556 TCA_SFB_PARMS,
557 __TCA_SFB_MAX,
558};
559
560#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
561
562/*
563 * Note: increment, decrement are Q0.16 fixed-point values.
564 */
565struct tc_sfb_qopt {
566 __u32 rehash_interval; /* delay between hash move, in ms */
567 __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */
568 __u32 max; /* max len of qlen_min */
569 __u32 bin_size; /* maximum queue length per bin */
570 __u32 increment; /* probability increment, (d1 in Blue) */
571 __u32 decrement; /* probability decrement, (d2 in Blue) */
572 __u32 limit; /* max SFB queue length */
573 __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */
574 __u32 penalty_burst;
575};
576
577struct tc_sfb_xstats {
578 __u32 earlydrop;
579 __u32 penaltydrop;
580 __u32 bucketdrop;
581 __u32 queuedrop;
582 __u32 childdrop; /* drops in child qdisc */
583 __u32 marked;
584 __u32 maxqlen;
585 __u32 maxprob;
586 __u32 avgprob;
587};
588
589#define SFB_MAX_PROB 0xFFFF
590
484#endif 591#endif
diff --git a/include/linux/platform_data/msm_serial_hs.h b/include/linux/platform_data/msm_serial_hs.h
new file mode 100644
index 000000000000..98a2046f8b31
--- /dev/null
+++ b/include/linux/platform_data/msm_serial_hs.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2008 Google, Inc.
3 * Author: Nick Pelly <npelly@google.com>
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
15#ifndef __ASM_ARCH_MSM_SERIAL_HS_H
16#define __ASM_ARCH_MSM_SERIAL_HS_H
17
18#include <linux/serial_core.h>
19
20/* API to request the uart clock off or on for low power management
21 * Clients should call request_clock_off() when no uart data is expected,
22 * and must call request_clock_on() before any further uart data can be
23 * received. */
24extern void msm_hs_request_clock_off(struct uart_port *uport);
25extern void msm_hs_request_clock_on(struct uart_port *uport);
26
27/**
28 * struct msm_serial_hs_platform_data
29 * @rx_wakeup_irq: Rx activity irq
30 * @rx_to_inject: extra character to be inserted to Rx tty on wakeup
31 * @inject_rx: 1 = insert rx_to_inject. 0 = do not insert extra character
32 * @exit_lpm_cb: function called before every Tx transaction
33 *
34 * This is an optional structure required for UART Rx GPIO IRQ based
35 * wakeup from low power state. UART wakeup can be triggered by RX activity
36 * (using a wakeup GPIO on the UART RX pin). This should only be used if
37 * there is not a wakeup GPIO on the UART CTS, and the first RX byte is
38 * known (eg., with the Bluetooth Texas Instruments HCILL protocol),
39 * since the first RX byte will always be lost. RTS will be asserted even
40 * while the UART is clocked off in this mode of operation.
41 */
42struct msm_serial_hs_platform_data {
43 int rx_wakeup_irq;
44 unsigned char inject_rx_on_wakeup;
45 char rx_to_inject;
46 void (*exit_lpm_cb)(struct uart_port *);
47};
48
49#endif
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
new file mode 100644
index 000000000000..6bca5b569acb
--- /dev/null
+++ b/include/linux/platform_data/tegra_usb.h
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
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 */
14
15#ifndef _TEGRA_USB_H_
16#define _TEGRA_USB_H_
17
18enum tegra_usb_operating_modes {
19 TEGRA_USB_DEVICE,
20 TEGRA_USB_HOST,
21 TEGRA_USB_OTG,
22};
23
24struct tegra_ehci_platform_data {
25 enum tegra_usb_operating_modes operating_mode;
26 /* power down the phy on bus suspend */
27 int power_down_on_bus_suspend;
28 void *phy_config;
29};
30
31#endif /* _TEGRA_USB_H_ */
diff --git a/include/linux/platform_data/uio_pruss.h b/include/linux/platform_data/uio_pruss.h
new file mode 100644
index 000000000000..f39140aabc6f
--- /dev/null
+++ b/include/linux/platform_data/uio_pruss.h
@@ -0,0 +1,25 @@
1/*
2 * include/linux/platform_data/uio_pruss.h
3 *
4 * Platform data for uio_pruss driver
5 *
6 * Copyright (C) 2010-11 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether express or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef _UIO_PRUSS_H_
19#define _UIO_PRUSS_H_
20
21/* To configure the PRUSS INTC base offset for UIO driver */
22struct uio_pruss_pdata {
23 u32 pintc_base;
24};
25#endif /* _UIO_PRUSS_H_ */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 2e700ec0601f..d96db9825708 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -130,8 +130,15 @@ extern void platform_driver_unregister(struct platform_driver *);
130extern int platform_driver_probe(struct platform_driver *driver, 130extern int platform_driver_probe(struct platform_driver *driver,
131 int (*probe)(struct platform_device *)); 131 int (*probe)(struct platform_device *));
132 132
133#define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 133static inline void *platform_get_drvdata(const struct platform_device *pdev)
134#define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 134{
135 return dev_get_drvdata(&pdev->dev);
136}
137
138static inline void platform_set_drvdata(struct platform_device *pdev, void *data)
139{
140 dev_set_drvdata(&pdev->dev, data);
141}
135 142
136extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 143extern struct platform_device *platform_create_bundle(struct platform_driver *driver,
137 int (*probe)(struct platform_device *), 144 int (*probe)(struct platform_device *),
diff --git a/include/linux/plist.h b/include/linux/plist.h
index 7254eda078e5..c9b9f322c8d8 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -31,15 +31,17 @@
31 * 31 *
32 * Simple ASCII art explanation: 32 * Simple ASCII art explanation:
33 * 33 *
34 * |HEAD | 34 * pl:prio_list (only for plist_node)
35 * | | 35 * nl:node_list
36 * |prio_list.prev|<------------------------------------| 36 * HEAD| NODE(S)
37 * |prio_list.next|<->|pl|<->|pl|<--------------->|pl|<-| 37 * |
38 * |10 | |10| |21| |21| |21| |40| (prio) 38 * ||------------------------------------|
39 * | | | | | | | | | | | | 39 * ||->|pl|<->|pl|<--------------->|pl|<-|
40 * | | | | | | | | | | | | 40 * | |10| |21| |21| |21| |40| (prio)
41 * |node_list.next|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-| 41 * | | | | | | | | | | |
42 * |node_list.prev|<------------------------------------| 42 * | | | | | | | | | | |
43 * |->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<->|nl|<-|
44 * |-------------------------------------------|
43 * 45 *
44 * The nodes on the prio_list list are sorted by priority to simplify 46 * The nodes on the prio_list list are sorted by priority to simplify
45 * the insertion of new nodes. There are no nodes with duplicate 47 * the insertion of new nodes. There are no nodes with duplicate
@@ -78,7 +80,6 @@
78#include <linux/spinlock_types.h> 80#include <linux/spinlock_types.h>
79 81
80struct plist_head { 82struct plist_head {
81 struct list_head prio_list;
82 struct list_head node_list; 83 struct list_head node_list;
83#ifdef CONFIG_DEBUG_PI_LIST 84#ifdef CONFIG_DEBUG_PI_LIST
84 raw_spinlock_t *rawlock; 85 raw_spinlock_t *rawlock;
@@ -88,7 +89,8 @@ struct plist_head {
88 89
89struct plist_node { 90struct plist_node {
90 int prio; 91 int prio;
91 struct plist_head plist; 92 struct list_head prio_list;
93 struct list_head node_list;
92}; 94};
93 95
94#ifdef CONFIG_DEBUG_PI_LIST 96#ifdef CONFIG_DEBUG_PI_LIST
@@ -100,7 +102,6 @@ struct plist_node {
100#endif 102#endif
101 103
102#define _PLIST_HEAD_INIT(head) \ 104#define _PLIST_HEAD_INIT(head) \
103 .prio_list = LIST_HEAD_INIT((head).prio_list), \
104 .node_list = LIST_HEAD_INIT((head).node_list) 105 .node_list = LIST_HEAD_INIT((head).node_list)
105 106
106/** 107/**
@@ -133,7 +134,8 @@ struct plist_node {
133#define PLIST_NODE_INIT(node, __prio) \ 134#define PLIST_NODE_INIT(node, __prio) \
134{ \ 135{ \
135 .prio = (__prio), \ 136 .prio = (__prio), \
136 .plist = { _PLIST_HEAD_INIT((node).plist) }, \ 137 .prio_list = LIST_HEAD_INIT((node).prio_list), \
138 .node_list = LIST_HEAD_INIT((node).node_list), \
137} 139}
138 140
139/** 141/**
@@ -144,7 +146,6 @@ struct plist_node {
144static inline void 146static inline void
145plist_head_init(struct plist_head *head, spinlock_t *lock) 147plist_head_init(struct plist_head *head, spinlock_t *lock)
146{ 148{
147 INIT_LIST_HEAD(&head->prio_list);
148 INIT_LIST_HEAD(&head->node_list); 149 INIT_LIST_HEAD(&head->node_list);
149#ifdef CONFIG_DEBUG_PI_LIST 150#ifdef CONFIG_DEBUG_PI_LIST
150 head->spinlock = lock; 151 head->spinlock = lock;
@@ -160,7 +161,6 @@ plist_head_init(struct plist_head *head, spinlock_t *lock)
160static inline void 161static inline void
161plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock) 162plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
162{ 163{
163 INIT_LIST_HEAD(&head->prio_list);
164 INIT_LIST_HEAD(&head->node_list); 164 INIT_LIST_HEAD(&head->node_list);
165#ifdef CONFIG_DEBUG_PI_LIST 165#ifdef CONFIG_DEBUG_PI_LIST
166 head->rawlock = lock; 166 head->rawlock = lock;
@@ -176,7 +176,8 @@ plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
176static inline void plist_node_init(struct plist_node *node, int prio) 176static inline void plist_node_init(struct plist_node *node, int prio)
177{ 177{
178 node->prio = prio; 178 node->prio = prio;
179 plist_head_init(&node->plist, NULL); 179 INIT_LIST_HEAD(&node->prio_list);
180 INIT_LIST_HEAD(&node->node_list);
180} 181}
181 182
182extern void plist_add(struct plist_node *node, struct plist_head *head); 183extern void plist_add(struct plist_node *node, struct plist_head *head);
@@ -188,7 +189,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
188 * @head: the head for your list 189 * @head: the head for your list
189 */ 190 */
190#define plist_for_each(pos, head) \ 191#define plist_for_each(pos, head) \
191 list_for_each_entry(pos, &(head)->node_list, plist.node_list) 192 list_for_each_entry(pos, &(head)->node_list, node_list)
192 193
193/** 194/**
194 * plist_for_each_safe - iterate safely over a plist of given type 195 * plist_for_each_safe - iterate safely over a plist of given type
@@ -199,7 +200,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
199 * Iterate over a plist of given type, safe against removal of list entry. 200 * Iterate over a plist of given type, safe against removal of list entry.
200 */ 201 */
201#define plist_for_each_safe(pos, n, head) \ 202#define plist_for_each_safe(pos, n, head) \
202 list_for_each_entry_safe(pos, n, &(head)->node_list, plist.node_list) 203 list_for_each_entry_safe(pos, n, &(head)->node_list, node_list)
203 204
204/** 205/**
205 * plist_for_each_entry - iterate over list of given type 206 * plist_for_each_entry - iterate over list of given type
@@ -208,7 +209,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
208 * @mem: the name of the list_struct within the struct 209 * @mem: the name of the list_struct within the struct
209 */ 210 */
210#define plist_for_each_entry(pos, head, mem) \ 211#define plist_for_each_entry(pos, head, mem) \
211 list_for_each_entry(pos, &(head)->node_list, mem.plist.node_list) 212 list_for_each_entry(pos, &(head)->node_list, mem.node_list)
212 213
213/** 214/**
214 * plist_for_each_entry_safe - iterate safely over list of given type 215 * plist_for_each_entry_safe - iterate safely over list of given type
@@ -220,7 +221,7 @@ extern void plist_del(struct plist_node *node, struct plist_head *head);
220 * Iterate over list of given type, safe against removal of list entry. 221 * Iterate over list of given type, safe against removal of list entry.
221 */ 222 */
222#define plist_for_each_entry_safe(pos, n, head, m) \ 223#define plist_for_each_entry_safe(pos, n, head, m) \
223 list_for_each_entry_safe(pos, n, &(head)->node_list, m.plist.node_list) 224 list_for_each_entry_safe(pos, n, &(head)->node_list, m.node_list)
224 225
225/** 226/**
226 * plist_head_empty - return !0 if a plist_head is empty 227 * plist_head_empty - return !0 if a plist_head is empty
@@ -237,7 +238,7 @@ static inline int plist_head_empty(const struct plist_head *head)
237 */ 238 */
238static inline int plist_node_empty(const struct plist_node *node) 239static inline int plist_node_empty(const struct plist_node *node)
239{ 240{
240 return plist_head_empty(&node->plist); 241 return list_empty(&node->node_list);
241} 242}
242 243
243/* All functions below assume the plist_head is not empty. */ 244/* All functions below assume the plist_head is not empty. */
@@ -285,7 +286,7 @@ static inline int plist_node_empty(const struct plist_node *node)
285static inline struct plist_node *plist_first(const struct plist_head *head) 286static inline struct plist_node *plist_first(const struct plist_head *head)
286{ 287{
287 return list_entry(head->node_list.next, 288 return list_entry(head->node_list.next,
288 struct plist_node, plist.node_list); 289 struct plist_node, node_list);
289} 290}
290 291
291/** 292/**
@@ -297,7 +298,7 @@ static inline struct plist_node *plist_first(const struct plist_head *head)
297static inline struct plist_node *plist_last(const struct plist_head *head) 298static inline struct plist_node *plist_last(const struct plist_head *head)
298{ 299{
299 return list_entry(head->node_list.prev, 300 return list_entry(head->node_list.prev,
300 struct plist_node, plist.node_list); 301 struct plist_node, node_list);
301} 302}
302 303
303#endif 304#endif
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 21415cc91cbb..512e09177e57 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -267,7 +267,7 @@ const struct dev_pm_ops name = { \
267 * callbacks provided by device drivers supporting both the system sleep PM and 267 * callbacks provided by device drivers supporting both the system sleep PM and
268 * runtime PM, make the pm member point to generic_subsys_pm_ops. 268 * runtime PM, make the pm member point to generic_subsys_pm_ops.
269 */ 269 */
270#ifdef CONFIG_PM_OPS 270#ifdef CONFIG_PM
271extern struct dev_pm_ops generic_subsys_pm_ops; 271extern struct dev_pm_ops generic_subsys_pm_ops;
272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops) 272#define GENERIC_SUBSYS_PM_OPS (&generic_subsys_pm_ops)
273#else 273#else
@@ -465,6 +465,14 @@ struct dev_pm_info {
465 465
466extern void update_pm_runtime_accounting(struct device *dev); 466extern void update_pm_runtime_accounting(struct device *dev);
467 467
468/*
469 * Power domains provide callbacks that are executed during system suspend,
470 * hibernation, system resume and during runtime PM transitions along with
471 * subsystem-level and driver-level callbacks.
472 */
473struct dev_power_domain {
474 struct dev_pm_ops ops;
475};
468 476
469/* 477/*
470 * The PM_EVENT_ messages are also used by drivers implementing the legacy 478 * The PM_EVENT_ messages are also used by drivers implementing the legacy
@@ -521,13 +529,19 @@ extern void update_pm_runtime_accounting(struct device *dev);
521 */ 529 */
522 530
523#ifdef CONFIG_PM_SLEEP 531#ifdef CONFIG_PM_SLEEP
524extern void device_pm_lock(void); 532#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
533extern int sysdev_suspend(pm_message_t state);
525extern int sysdev_resume(void); 534extern int sysdev_resume(void);
535#else
536static inline int sysdev_suspend(pm_message_t state) { return 0; }
537static inline int sysdev_resume(void) { return 0; }
538#endif
539
540extern void device_pm_lock(void);
526extern void dpm_resume_noirq(pm_message_t state); 541extern void dpm_resume_noirq(pm_message_t state);
527extern void dpm_resume_end(pm_message_t state); 542extern void dpm_resume_end(pm_message_t state);
528 543
529extern void device_pm_unlock(void); 544extern void device_pm_unlock(void);
530extern int sysdev_suspend(pm_message_t state);
531extern int dpm_suspend_noirq(pm_message_t state); 545extern int dpm_suspend_noirq(pm_message_t state);
532extern int dpm_suspend_start(pm_message_t state); 546extern int dpm_suspend_start(pm_message_t state);
533 547
@@ -565,15 +579,6 @@ enum dpm_order {
565 DPM_ORDER_DEV_LAST, 579 DPM_ORDER_DEV_LAST,
566}; 580};
567 581
568/*
569 * Global Power Management flags
570 * Used to keep APM and ACPI from both being active
571 */
572extern unsigned int pm_flags;
573
574#define PM_APM 1
575#define PM_ACPI 2
576
577extern int pm_generic_suspend(struct device *dev); 582extern int pm_generic_suspend(struct device *dev);
578extern int pm_generic_resume(struct device *dev); 583extern int pm_generic_resume(struct device *dev);
579extern int pm_generic_freeze(struct device *dev); 584extern int pm_generic_freeze(struct device *dev);
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d34f067e2a7f..8de9aa6e7def 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -87,6 +87,11 @@ static inline bool pm_runtime_enabled(struct device *dev)
87 return !dev->power.disable_depth; 87 return !dev->power.disable_depth;
88} 88}
89 89
90static inline bool pm_runtime_callbacks_present(struct device *dev)
91{
92 return !dev->power.no_callbacks;
93}
94
90static inline void pm_runtime_mark_last_busy(struct device *dev) 95static inline void pm_runtime_mark_last_busy(struct device *dev)
91{ 96{
92 ACCESS_ONCE(dev->power.last_busy) = jiffies; 97 ACCESS_ONCE(dev->power.last_busy) = jiffies;
@@ -133,6 +138,7 @@ static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
133static inline void pm_runtime_no_callbacks(struct device *dev) {} 138static inline void pm_runtime_no_callbacks(struct device *dev) {}
134static inline void pm_runtime_irq_safe(struct device *dev) {} 139static inline void pm_runtime_irq_safe(struct device *dev) {}
135 140
141static inline bool pm_runtime_callbacks_present(struct device *dev) { return false; }
136static inline void pm_runtime_mark_last_busy(struct device *dev) {} 142static inline void pm_runtime_mark_last_busy(struct device *dev) {}
137static inline void __pm_runtime_use_autosuspend(struct device *dev, 143static inline void __pm_runtime_use_autosuspend(struct device *dev,
138 bool use) {} 144 bool use) {}
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h
index 03a67db03d01..a32da962d693 100644
--- a/include/linux/pm_wakeup.h
+++ b/include/linux/pm_wakeup.h
@@ -62,18 +62,11 @@ struct wakeup_source {
62 * Changes to device_may_wakeup take effect on the next pm state change. 62 * Changes to device_may_wakeup take effect on the next pm state change.
63 */ 63 */
64 64
65static inline void device_set_wakeup_capable(struct device *dev, bool capable)
66{
67 dev->power.can_wakeup = capable;
68}
69
70static inline bool device_can_wakeup(struct device *dev) 65static inline bool device_can_wakeup(struct device *dev)
71{ 66{
72 return dev->power.can_wakeup; 67 return dev->power.can_wakeup;
73} 68}
74 69
75
76
77static inline bool device_may_wakeup(struct device *dev) 70static inline bool device_may_wakeup(struct device *dev)
78{ 71{
79 return dev->power.can_wakeup && !!dev->power.wakeup; 72 return dev->power.can_wakeup && !!dev->power.wakeup;
@@ -88,6 +81,7 @@ extern struct wakeup_source *wakeup_source_register(const char *name);
88extern void wakeup_source_unregister(struct wakeup_source *ws); 81extern void wakeup_source_unregister(struct wakeup_source *ws);
89extern int device_wakeup_enable(struct device *dev); 82extern int device_wakeup_enable(struct device *dev);
90extern int device_wakeup_disable(struct device *dev); 83extern int device_wakeup_disable(struct device *dev);
84extern void device_set_wakeup_capable(struct device *dev, bool capable);
91extern int device_init_wakeup(struct device *dev, bool val); 85extern int device_init_wakeup(struct device *dev, bool val);
92extern int device_set_wakeup_enable(struct device *dev, bool enable); 86extern int device_set_wakeup_enable(struct device *dev, bool enable);
93extern void __pm_stay_awake(struct wakeup_source *ws); 87extern void __pm_stay_awake(struct wakeup_source *ws);
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
new file mode 100644
index 000000000000..369e19d3750b
--- /dev/null
+++ b/include/linux/posix-clock.h
@@ -0,0 +1,150 @@
1/*
2 * posix-clock.h - support for dynamic clock devices
3 *
4 * Copyright (C) 2010 OMICRON electronics GmbH
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20#ifndef _LINUX_POSIX_CLOCK_H_
21#define _LINUX_POSIX_CLOCK_H_
22
23#include <linux/cdev.h>
24#include <linux/fs.h>
25#include <linux/poll.h>
26#include <linux/posix-timers.h>
27
28struct posix_clock;
29
30/**
31 * struct posix_clock_operations - functional interface to the clock
32 *
33 * Every posix clock is represented by a character device. Drivers may
34 * optionally offer extended capabilities by implementing the
35 * character device methods. The character device file operations are
36 * first handled by the clock device layer, then passed on to the
37 * driver by calling these functions.
38 *
39 * @owner: The clock driver should set to THIS_MODULE
40 * @clock_adjtime: Adjust the clock
41 * @clock_gettime: Read the current time
42 * @clock_getres: Get the clock resolution
43 * @clock_settime: Set the current time value
44 * @timer_create: Create a new timer
45 * @timer_delete: Remove a previously created timer
46 * @timer_gettime: Get remaining time and interval of a timer
47 * @timer_setttime: Set a timer's initial expiration and interval
48 * @fasync: Optional character device fasync method
49 * @mmap: Optional character device mmap method
50 * @open: Optional character device open method
51 * @release: Optional character device release method
52 * @ioctl: Optional character device ioctl method
53 * @read: Optional character device read method
54 * @poll: Optional character device poll method
55 */
56struct posix_clock_operations {
57 struct module *owner;
58
59 int (*clock_adjtime)(struct posix_clock *pc, struct timex *tx);
60
61 int (*clock_gettime)(struct posix_clock *pc, struct timespec *ts);
62
63 int (*clock_getres) (struct posix_clock *pc, struct timespec *ts);
64
65 int (*clock_settime)(struct posix_clock *pc,
66 const struct timespec *ts);
67
68 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
69
70 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
71
72 void (*timer_gettime)(struct posix_clock *pc,
73 struct k_itimer *kit, struct itimerspec *tsp);
74
75 int (*timer_settime)(struct posix_clock *pc,
76 struct k_itimer *kit, int flags,
77 struct itimerspec *tsp, struct itimerspec *old);
78 /*
79 * Optional character device methods:
80 */
81 int (*fasync) (struct posix_clock *pc,
82 int fd, struct file *file, int on);
83
84 long (*ioctl) (struct posix_clock *pc,
85 unsigned int cmd, unsigned long arg);
86
87 int (*mmap) (struct posix_clock *pc,
88 struct vm_area_struct *vma);
89
90 int (*open) (struct posix_clock *pc, fmode_t f_mode);
91
92 uint (*poll) (struct posix_clock *pc,
93 struct file *file, poll_table *wait);
94
95 int (*release) (struct posix_clock *pc);
96
97 ssize_t (*read) (struct posix_clock *pc,
98 uint flags, char __user *buf, size_t cnt);
99};
100
101/**
102 * struct posix_clock - represents a dynamic posix clock
103 *
104 * @ops: Functional interface to the clock
105 * @cdev: Character device instance for this clock
106 * @kref: Reference count.
107 * @mutex: Protects the 'zombie' field from concurrent access.
108 * @zombie: If 'zombie' is true, then the hardware has disappeared.
109 * @release: A function to free the structure when the reference count reaches
110 * zero. May be NULL if structure is statically allocated.
111 *
112 * Drivers should embed their struct posix_clock within a private
113 * structure, obtaining a reference to it during callbacks using
114 * container_of().
115 */
116struct posix_clock {
117 struct posix_clock_operations ops;
118 struct cdev cdev;
119 struct kref kref;
120 struct mutex mutex;
121 bool zombie;
122 void (*release)(struct posix_clock *clk);
123};
124
125/**
126 * posix_clock_register() - register a new clock
127 * @clk: Pointer to the clock. Caller must provide 'ops' and 'release'
128 * @devid: Allocated device id
129 *
130 * A clock driver calls this function to register itself with the
131 * clock device subsystem. If 'clk' points to dynamically allocated
132 * memory, then the caller must provide a 'release' function to free
133 * that memory.
134 *
135 * Returns zero on success, non-zero otherwise.
136 */
137int posix_clock_register(struct posix_clock *clk, dev_t devid);
138
139/**
140 * posix_clock_unregister() - unregister a clock
141 * @clk: Clock instance previously registered via posix_clock_register()
142 *
143 * A clock driver calls this function to remove itself from the clock
144 * device subsystem. The posix_clock itself will remain (in an
145 * inactive state) until its reference count drops to zero, at which
146 * point it will be deallocated with its 'release' method.
147 */
148void posix_clock_unregister(struct posix_clock *clk);
149
150#endif
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 3e23844a6990..d51243ae0726 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -4,6 +4,7 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/timex.h>
7 8
8union cpu_time_count { 9union cpu_time_count {
9 cputime_t cpu; 10 cputime_t cpu;
@@ -17,10 +18,21 @@ struct cpu_timer_list {
17 int firing; 18 int firing;
18}; 19};
19 20
21/*
22 * Bit fields within a clockid:
23 *
24 * The most significant 29 bits hold either a pid or a file descriptor.
25 *
26 * Bit 2 indicates whether a cpu clock refers to a thread or a process.
27 *
28 * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
29 *
30 * A clockid is invalid if bits 2, 1, and 0 are all set.
31 */
20#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3)) 32#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
21#define CPUCLOCK_PERTHREAD(clock) \ 33#define CPUCLOCK_PERTHREAD(clock) \
22 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0) 34 (((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
23#define CPUCLOCK_PID_MASK 7 35
24#define CPUCLOCK_PERTHREAD_MASK 4 36#define CPUCLOCK_PERTHREAD_MASK 4
25#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK) 37#define CPUCLOCK_WHICH(clock) ((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
26#define CPUCLOCK_CLOCK_MASK 3 38#define CPUCLOCK_CLOCK_MASK 3
@@ -28,12 +40,17 @@ struct cpu_timer_list {
28#define CPUCLOCK_VIRT 1 40#define CPUCLOCK_VIRT 1
29#define CPUCLOCK_SCHED 2 41#define CPUCLOCK_SCHED 2
30#define CPUCLOCK_MAX 3 42#define CPUCLOCK_MAX 3
43#define CLOCKFD CPUCLOCK_MAX
44#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)
31 45
32#define MAKE_PROCESS_CPUCLOCK(pid, clock) \ 46#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
33 ((~(clockid_t) (pid) << 3) | (clockid_t) (clock)) 47 ((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
34#define MAKE_THREAD_CPUCLOCK(tid, clock) \ 48#define MAKE_THREAD_CPUCLOCK(tid, clock) \
35 MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK) 49 MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)
36 50
51#define FD_TO_CLOCKID(fd) ((~(clockid_t) (fd) << 3) | CLOCKFD)
52#define CLOCKID_TO_FD(clk) ((unsigned int) ~((clk) >> 3))
53
37/* POSIX.1b interval timer structure. */ 54/* POSIX.1b interval timer structure. */
38struct k_itimer { 55struct k_itimer {
39 struct list_head list; /* free/ allocate list */ 56 struct list_head list; /* free/ allocate list */
@@ -67,10 +84,11 @@ struct k_itimer {
67}; 84};
68 85
69struct k_clock { 86struct k_clock {
70 int res; /* in nanoseconds */
71 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); 87 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
72 int (*clock_set) (const clockid_t which_clock, struct timespec * tp); 88 int (*clock_set) (const clockid_t which_clock,
89 const struct timespec *tp);
73 int (*clock_get) (const clockid_t which_clock, struct timespec * tp); 90 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
91 int (*clock_adj) (const clockid_t which_clock, struct timex *tx);
74 int (*timer_create) (struct k_itimer *timer); 92 int (*timer_create) (struct k_itimer *timer);
75 int (*nsleep) (const clockid_t which_clock, int flags, 93 int (*nsleep) (const clockid_t which_clock, int flags,
76 struct timespec *, struct timespec __user *); 94 struct timespec *, struct timespec __user *);
@@ -84,28 +102,14 @@ struct k_clock {
84 struct itimerspec * cur_setting); 102 struct itimerspec * cur_setting);
85}; 103};
86 104
87void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock); 105extern struct k_clock clock_posix_cpu;
106extern struct k_clock clock_posix_dynamic;
88 107
89/* error handlers for timer_create, nanosleep and settime */ 108void posix_timers_register_clock(const clockid_t clock_id, struct k_clock *new_clock);
90int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
91 struct timespec __user *);
92int do_posix_clock_nosettime(const clockid_t, struct timespec *tp);
93 109
94/* function to call to trigger timer event */ 110/* function to call to trigger timer event */
95int posix_timer_event(struct k_itimer *timr, int si_private); 111int posix_timer_event(struct k_itimer *timr, int si_private);
96 112
97int posix_cpu_clock_getres(const clockid_t which_clock, struct timespec *ts);
98int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *ts);
99int posix_cpu_clock_set(const clockid_t which_clock, const struct timespec *ts);
100int posix_cpu_timer_create(struct k_itimer *timer);
101int posix_cpu_nsleep(const clockid_t which_clock, int flags,
102 struct timespec *rqtp, struct timespec __user *rmtp);
103long posix_cpu_nsleep_restart(struct restart_block *restart_block);
104int posix_cpu_timer_set(struct k_itimer *timer, int flags,
105 struct itimerspec *new, struct itimerspec *old);
106int posix_cpu_timer_del(struct k_itimer *timer);
107void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
108
109void posix_cpu_timer_schedule(struct k_itimer *timer); 113void posix_cpu_timer_schedule(struct k_itimer *timer);
110 114
111void run_posix_cpu_timers(struct task_struct *task); 115void run_posix_cpu_timers(struct task_struct *task);
diff --git a/include/linux/power/bq20z75.h b/include/linux/power/bq20z75.h
new file mode 100644
index 000000000000..b0843b68af92
--- /dev/null
+++ b/include/linux/power/bq20z75.h
@@ -0,0 +1,39 @@
1/*
2 * Gas Gauge driver for TI's BQ20Z75
3 *
4 * Copyright (c) 2010, NVIDIA Corporation.
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, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#ifndef __LINUX_POWER_BQ20Z75_H_
22#define __LINUX_POWER_BQ20Z75_H_
23
24#include <linux/power_supply.h>
25#include <linux/types.h>
26
27/**
28 * struct bq20z75_platform_data - platform data for bq20z75 devices
29 * @battery_detect: GPIO which is used to detect battery presence
30 * @battery_detect_present: gpio state when battery is present (0 / 1)
31 * @i2c_retry_count: # of times to retry on i2c IO failure
32 */
33struct bq20z75_platform_data {
34 int battery_detect;
35 int battery_detect_present;
36 int i2c_retry_count;
37};
38
39#endif
diff --git a/include/linux/power/bq27x00_battery.h b/include/linux/power/bq27x00_battery.h
new file mode 100644
index 000000000000..a857f719bf40
--- /dev/null
+++ b/include/linux/power/bq27x00_battery.h
@@ -0,0 +1,19 @@
1#ifndef __LINUX_BQ27X00_BATTERY_H__
2#define __LINUX_BQ27X00_BATTERY_H__
3
4/**
5 * struct bq27000_plaform_data - Platform data for bq27000 devices
6 * @name: Name of the battery. If NULL the driver will fallback to "bq27000".
7 * @read: HDQ read callback.
8 * This function should provide access to the HDQ bus the battery is
9 * connected to.
10 * The first parameter is a pointer to the battery device, the second the
11 * register to be read. The return value should either be the content of
12 * the passed register or an error value.
13 */
14struct bq27000_platform_data {
15 const char *name;
16 int (*read)(struct device *dev, unsigned int);
17};
18
19#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 7d7325685c42..204c18dfdc9e 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -173,6 +173,8 @@ struct power_supply {
173 char *full_trig_name; 173 char *full_trig_name;
174 struct led_trigger *online_trig; 174 struct led_trigger *online_trig;
175 char *online_trig_name; 175 char *online_trig_name;
176 struct led_trigger *charging_blink_full_solid_trig;
177 char *charging_blink_full_solid_trig_name;
176#endif 178#endif
177}; 179};
178 180
@@ -213,4 +215,49 @@ extern void power_supply_unregister(struct power_supply *psy);
213/* For APM emulation, think legacy userspace. */ 215/* For APM emulation, think legacy userspace. */
214extern struct class *power_supply_class; 216extern struct class *power_supply_class;
215 217
218static inline bool power_supply_is_amp_property(enum power_supply_property psp)
219{
220 switch (psp) {
221 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
222 case POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN:
223 case POWER_SUPPLY_PROP_CHARGE_FULL:
224 case POWER_SUPPLY_PROP_CHARGE_EMPTY:
225 case POWER_SUPPLY_PROP_CHARGE_NOW:
226 case POWER_SUPPLY_PROP_CHARGE_AVG:
227 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
228 case POWER_SUPPLY_PROP_CURRENT_MAX:
229 case POWER_SUPPLY_PROP_CURRENT_NOW:
230 case POWER_SUPPLY_PROP_CURRENT_AVG:
231 return 1;
232 default:
233 break;
234 }
235
236 return 0;
237}
238
239static inline bool power_supply_is_watt_property(enum power_supply_property psp)
240{
241 switch (psp) {
242 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
243 case POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN:
244 case POWER_SUPPLY_PROP_ENERGY_FULL:
245 case POWER_SUPPLY_PROP_ENERGY_EMPTY:
246 case POWER_SUPPLY_PROP_ENERGY_NOW:
247 case POWER_SUPPLY_PROP_ENERGY_AVG:
248 case POWER_SUPPLY_PROP_VOLTAGE_MAX:
249 case POWER_SUPPLY_PROP_VOLTAGE_MIN:
250 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
251 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
252 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
253 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
254 case POWER_SUPPLY_PROP_POWER_NOW:
255 return 1;
256 default:
257 break;
258 }
259
260 return 0;
261}
262
216#endif /* __LINUX_POWER_SUPPLY_H__ */ 263#endif /* __LINUX_POWER_SUPPLY_H__ */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 379eaed72d4b..838c1149251a 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,
50 50
51struct proc_dir_entry { 51struct proc_dir_entry {
52 unsigned int low_ino; 52 unsigned int low_ino;
53 unsigned short namelen; 53 unsigned int namelen;
54 const char *name; 54 const char *name;
55 mode_t mode; 55 mode_t mode;
56 nlink_t nlink; 56 nlink_t nlink;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
new file mode 100644
index 000000000000..41977737bb7d
--- /dev/null
+++ b/include/linux/pstore.h
@@ -0,0 +1,60 @@
1/*
2 * Persistent Storage - pstore.h
3 *
4 * Copyright (C) 2010 Intel Corporation <tony.luck@intel.com>
5 *
6 * This code is the generic layer to export data records from platform
7 * level persistent storage via a file system.
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 version 2 as
11 * published by the Free Software Foundation.
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#ifndef _LINUX_PSTORE_H
23#define _LINUX_PSTORE_H
24
25/* types */
26enum pstore_type_id {
27 PSTORE_TYPE_DMESG = 0,
28 PSTORE_TYPE_MCE = 1,
29 PSTORE_TYPE_UNKNOWN = 255
30};
31
32struct pstore_info {
33 struct module *owner;
34 char *name;
35 struct mutex buf_mutex; /* serialize access to 'buf' */
36 char *buf;
37 size_t bufsize;
38 size_t (*read)(u64 *id, enum pstore_type_id *type,
39 struct timespec *time);
40 u64 (*write)(enum pstore_type_id type, size_t size);
41 int (*erase)(u64 id);
42};
43
44#ifdef CONFIG_PSTORE
45extern int pstore_register(struct pstore_info *);
46extern int pstore_write(enum pstore_type_id type, char *buf, size_t size);
47#else
48static inline int
49pstore_register(struct pstore_info *psi)
50{
51 return -ENODEV;
52}
53static inline int
54pstore_write(enum pstore_type_id type, char *buf, size_t size)
55{
56 return -ENODEV;
57}
58#endif
59
60#endif /*_LINUX_PSTORE_H*/
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 092a04f874a8..a1147e5dd245 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -102,11 +102,8 @@
102 102
103extern long arch_ptrace(struct task_struct *child, long request, 103extern long arch_ptrace(struct task_struct *child, long request,
104 unsigned long addr, unsigned long data); 104 unsigned long addr, unsigned long data);
105extern int ptrace_traceme(void);
106extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 105extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
107extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 106extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
108extern int ptrace_attach(struct task_struct *tsk);
109extern int ptrace_detach(struct task_struct *, unsigned int);
110extern void ptrace_disable(struct task_struct *); 107extern void ptrace_disable(struct task_struct *);
111extern int ptrace_check_attach(struct task_struct *task, int kill); 108extern int ptrace_check_attach(struct task_struct *task, int kill);
112extern int ptrace_request(struct task_struct *child, long request, 109extern int ptrace_request(struct task_struct *child, long request,
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h
index e031e1a486d9..5e3e25a3c9c3 100644
--- a/include/linux/pwm_backlight.h
+++ b/include/linux/pwm_backlight.h
@@ -4,6 +4,8 @@
4#ifndef __LINUX_PWM_BACKLIGHT_H 4#ifndef __LINUX_PWM_BACKLIGHT_H
5#define __LINUX_PWM_BACKLIGHT_H 5#define __LINUX_PWM_BACKLIGHT_H
6 6
7#include <linux/backlight.h>
8
7struct platform_pwm_backlight_data { 9struct platform_pwm_backlight_data {
8 int pwm_id; 10 int pwm_id;
9 unsigned int max_brightness; 11 unsigned int max_brightness;
@@ -13,6 +15,7 @@ struct platform_pwm_backlight_data {
13 int (*init)(struct device *dev); 15 int (*init)(struct device *dev);
14 int (*notify)(struct device *dev, int brightness); 16 int (*notify)(struct device *dev, int brightness);
15 void (*exit)(struct device *dev); 17 void (*exit)(struct device *dev);
18 int (*check_fb)(struct device *dev, struct fb_info *info);
16}; 19};
17 20
18#endif 21#endif
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index eb354f6f26b3..26f9e3612e0f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -277,7 +277,7 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr)
277 /* 277 /*
278 * Mark inode fully dirty. Since we are allocating blocks, inode 278 * Mark inode fully dirty. Since we are allocating blocks, inode
279 * would become fully dirty soon anyway and it reportedly 279 * would become fully dirty soon anyway and it reportedly
280 * reduces inode_lock contention. 280 * reduces lock contention.
281 */ 281 */
282 mark_inode_dirty(inode); 282 mark_inode_dirty(inode);
283 } 283 }
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index c21072adbfad..0a3842aacba9 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1124,15 +1124,18 @@ struct reiserfs_de_head {
1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1))) 1124# define aligned_address(addr) ((void *)((long)(addr) & ~((1UL << ADDR_UNALIGNED_BITS) - 1)))
1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3) 1125# define unaligned_offset(addr) (((int)((long)(addr) & ((1 << ADDR_UNALIGNED_BITS) - 1))) << 3)
1126 1126
1127# define set_bit_unaligned(nr, addr) ext2_set_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1127# define set_bit_unaligned(nr, addr) \
1128# define clear_bit_unaligned(nr, addr) ext2_clear_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1128 __test_and_set_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1129# define test_bit_unaligned(nr, addr) ext2_test_bit((nr) + unaligned_offset(addr), aligned_address(addr)) 1129# define clear_bit_unaligned(nr, addr) \
1130 __test_and_clear_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1131# define test_bit_unaligned(nr, addr) \
1132 test_bit_le((nr) + unaligned_offset(addr), aligned_address(addr))
1130 1133
1131#else 1134#else
1132 1135
1133# define set_bit_unaligned(nr, addr) ext2_set_bit(nr, addr) 1136# define set_bit_unaligned(nr, addr) __test_and_set_bit_le(nr, addr)
1134# define clear_bit_unaligned(nr, addr) ext2_clear_bit(nr, addr) 1137# define clear_bit_unaligned(nr, addr) __test_and_clear_bit_le(nr, addr)
1135# define test_bit_unaligned(nr, addr) ext2_test_bit(nr, addr) 1138# define test_bit_unaligned(nr, addr) test_bit_le(nr, addr)
1136 1139
1137#endif 1140#endif
1138 1141
@@ -2329,14 +2332,10 @@ __u32 keyed_hash(const signed char *msg, int len);
2329__u32 yura_hash(const signed char *msg, int len); 2332__u32 yura_hash(const signed char *msg, int len);
2330__u32 r5_hash(const signed char *msg, int len); 2333__u32 r5_hash(const signed char *msg, int len);
2331 2334
2332/* the ext2 bit routines adjust for big or little endian as 2335#define reiserfs_test_and_set_le_bit __test_and_set_bit_le
2333** appropriate for the arch, so in our laziness we use them rather 2336#define reiserfs_test_and_clear_le_bit __test_and_clear_bit_le
2334** than using the bit routines they call more directly. These 2337#define reiserfs_test_le_bit test_bit_le
2335** routines must be used when changing on disk bitmaps. */ 2338#define reiserfs_find_next_zero_le_bit find_next_zero_bit_le
2336#define reiserfs_test_and_set_le_bit ext2_set_bit
2337#define reiserfs_test_and_clear_le_bit ext2_clear_bit
2338#define reiserfs_test_le_bit ext2_test_bit
2339#define reiserfs_find_next_zero_le_bit ext2_find_next_zero_bit
2340 2339
2341/* sometimes reiserfs_truncate may require to allocate few new blocks 2340/* sometimes reiserfs_truncate may require to allocate few new blocks
2342 to perform indirect2direct conversion. People probably used to 2341 to perform indirect2direct conversion. People probably used to
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 3b94c91f20a6..6deef5dc95fb 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -63,6 +63,7 @@ extern const struct xattr_handler reiserfs_xattr_trusted_handler;
63extern const 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 const struct qstr *qstr,
66 struct reiserfs_security_handle *sec); 67 struct reiserfs_security_handle *sec);
67int reiserfs_security_write(struct reiserfs_transaction_handle *th, 68int reiserfs_security_write(struct reiserfs_transaction_handle *th,
68 struct inode *inode, 69 struct inode *inode,
@@ -130,6 +131,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
130#ifndef CONFIG_REISERFS_FS_SECURITY 131#ifndef CONFIG_REISERFS_FS_SECURITY
131static inline int reiserfs_security_init(struct inode *dir, 132static inline int reiserfs_security_init(struct inode *dir,
132 struct inode *inode, 133 struct inode *inode,
134 const struct qstr *qstr,
133 struct reiserfs_security_handle *sec) 135 struct reiserfs_security_handle *sec)
134{ 136{
135 return 0; 137 return 0;
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index a5930cb66145..c9d625ca659e 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -129,20 +129,22 @@ int __must_check res_counter_charge(struct res_counter *counter,
129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val); 129void res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
130void res_counter_uncharge(struct res_counter *counter, unsigned long val); 130void res_counter_uncharge(struct res_counter *counter, unsigned long val);
131 131
132static inline bool res_counter_limit_check_locked(struct res_counter *cnt) 132/**
133{ 133 * res_counter_margin - calculate chargeable space of a counter
134 if (cnt->usage < cnt->limit) 134 * @cnt: the counter
135 return true; 135 *
136 136 * Returns the difference between the hard limit and the current usage
137 return false; 137 * of resource counter @cnt.
138} 138 */
139 139static inline unsigned long long res_counter_margin(struct res_counter *cnt)
140static inline bool res_counter_soft_limit_check_locked(struct res_counter *cnt)
141{ 140{
142 if (cnt->usage < cnt->soft_limit) 141 unsigned long long margin;
143 return true; 142 unsigned long flags;
144 143
145 return false; 144 spin_lock_irqsave(&cnt->lock, flags);
145 margin = cnt->limit - cnt->usage;
146 spin_unlock_irqrestore(&cnt->lock, flags);
147 return margin;
146} 148}
147 149
148/** 150/**
@@ -167,52 +169,6 @@ res_counter_soft_limit_excess(struct res_counter *cnt)
167 return excess; 169 return excess;
168} 170}
169 171
170/*
171 * Helper function to detect if the cgroup is within it's limit or
172 * not. It's currently called from cgroup_rss_prepare()
173 */
174static inline bool res_counter_check_under_limit(struct res_counter *cnt)
175{
176 bool ret;
177 unsigned long flags;
178
179 spin_lock_irqsave(&cnt->lock, flags);
180 ret = res_counter_limit_check_locked(cnt);
181 spin_unlock_irqrestore(&cnt->lock, flags);
182 return ret;
183}
184
185/**
186 * res_counter_check_margin - check if the counter allows charging
187 * @cnt: the resource counter to check
188 * @bytes: the number of bytes to check the remaining space against
189 *
190 * Returns a boolean value on whether the counter can be charged
191 * @bytes or whether this would exceed the limit.
192 */
193static inline bool res_counter_check_margin(struct res_counter *cnt,
194 unsigned long bytes)
195{
196 bool ret;
197 unsigned long flags;
198
199 spin_lock_irqsave(&cnt->lock, flags);
200 ret = cnt->limit - cnt->usage >= bytes;
201 spin_unlock_irqrestore(&cnt->lock, flags);
202 return ret;
203}
204
205static inline bool res_counter_check_under_soft_limit(struct res_counter *cnt)
206{
207 bool ret;
208 unsigned long flags;
209
210 spin_lock_irqsave(&cnt->lock, flags);
211 ret = res_counter_soft_limit_check_locked(cnt);
212 spin_unlock_irqrestore(&cnt->lock, flags);
213 return ret;
214}
215
216static inline void res_counter_reset_max(struct res_counter *cnt) 172static inline void res_counter_reset_max(struct res_counter *cnt)
217{ 173{
218 unsigned long flags; 174 unsigned long flags;
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 8d3a2486544d..ab38ac80b0f9 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -100,6 +100,8 @@ void ring_buffer_free(struct ring_buffer *buffer);
100 100
101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 101int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);
102 102
103void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val);
104
103struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer, 105struct ring_buffer_event *ring_buffer_lock_reserve(struct ring_buffer *buffer,
104 unsigned long length); 106 unsigned long length);
105int ring_buffer_unlock_commit(struct ring_buffer *buffer, 107int ring_buffer_unlock_commit(struct ring_buffer *buffer,
diff --git a/include/linux/rio.h b/include/linux/rio.h
index ff681ebba585..4e37a7cfa726 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -24,6 +24,7 @@
24#define RIO_NO_HOPCOUNT -1 24#define RIO_NO_HOPCOUNT -1
25#define RIO_INVALID_DESTID 0xffff 25#define RIO_INVALID_DESTID 0xffff
26 26
27#define RIO_MAX_MPORTS 8
27#define RIO_MAX_MPORT_RESOURCES 16 28#define RIO_MAX_MPORT_RESOURCES 16
28#define RIO_MAX_DEV_RESOURCES 16 29#define RIO_MAX_DEV_RESOURCES 16
29 30
@@ -241,7 +242,7 @@ struct rio_mport {
241 struct rio_msg inb_msg[RIO_MAX_MBOX]; 242 struct rio_msg inb_msg[RIO_MAX_MBOX];
242 struct rio_msg outb_msg[RIO_MAX_MBOX]; 243 struct rio_msg outb_msg[RIO_MAX_MBOX];
243 int host_deviceid; /* Host device ID */ 244 int host_deviceid; /* Host device ID */
244 struct rio_ops *ops; /* maintenance transaction functions */ 245 struct rio_ops *ops; /* low-level architecture-dependent routines */
245 unsigned char id; /* port ID, unique among all ports */ 246 unsigned char id; /* port ID, unique among all ports */
246 unsigned char index; /* port index, unique among all port 247 unsigned char index; /* port index, unique among all port
247 interfaces of the same type */ 248 interfaces of the same type */
@@ -285,6 +286,13 @@ struct rio_net {
285 * @cwrite: Callback to perform network write of config space. 286 * @cwrite: Callback to perform network write of config space.
286 * @dsend: Callback to send a doorbell message. 287 * @dsend: Callback to send a doorbell message.
287 * @pwenable: Callback to enable/disable port-write message handling. 288 * @pwenable: Callback to enable/disable port-write message handling.
289 * @open_outb_mbox: Callback to initialize outbound mailbox.
290 * @close_outb_mbox: Callback to shut down outbound mailbox.
291 * @open_inb_mbox: Callback to initialize inbound mailbox.
292 * @close_inb_mbox: Callback to shut down inbound mailbox.
293 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
294 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
295 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
288 */ 296 */
289struct rio_ops { 297struct rio_ops {
290 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 298 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -297,6 +305,16 @@ struct rio_ops {
297 u8 hopcount, u32 offset, int len, u32 data); 305 u8 hopcount, u32 offset, int len, u32 data);
298 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data); 306 int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);
299 int (*pwenable) (struct rio_mport *mport, int enable); 307 int (*pwenable) (struct rio_mport *mport, int enable);
308 int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id,
309 int mbox, int entries);
310 void (*close_outb_mbox)(struct rio_mport *mport, int mbox);
311 int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id,
312 int mbox, int entries);
313 void (*close_inb_mbox)(struct rio_mport *mport, int mbox);
314 int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev,
315 int mbox, void *buffer, size_t len);
316 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
317 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
300}; 318};
301 319
302#define RIO_RESOURCE_MEM 0x00000100 320#define RIO_RESOURCE_MEM 0x00000100
@@ -378,12 +396,7 @@ union rio_pw_msg {
378}; 396};
379 397
380/* Architecture and hardware-specific functions */ 398/* Architecture and hardware-specific functions */
381extern int rio_init_mports(void);
382extern void rio_register_mport(struct rio_mport *); 399extern void rio_register_mport(struct rio_mport *);
383extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int,
384 void *, size_t);
385extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *);
386extern void *rio_hw_get_inb_message(struct rio_mport *, int);
387extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); 400extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
388extern void rio_close_inb_mbox(struct rio_mport *, int); 401extern void rio_close_inb_mbox(struct rio_mport *, int);
389extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int); 402extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index e09e565c4bce..229b3ca23134 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -317,7 +317,8 @@ static inline int rio_add_outb_message(struct rio_mport *mport,
317 struct rio_dev *rdev, int mbox, 317 struct rio_dev *rdev, int mbox,
318 void *buffer, size_t len) 318 void *buffer, size_t len)
319{ 319{
320 return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len); 320 return mport->ops->add_outb_message(mport, rdev, mbox,
321 buffer, len);
321} 322}
322 323
323extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int, 324extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int,
@@ -336,7 +337,7 @@ extern int rio_release_inb_mbox(struct rio_mport *, int);
336static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox, 337static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
337 void *buffer) 338 void *buffer)
338{ 339{
339 return rio_hw_add_inb_buffer(mport, mbox, buffer); 340 return mport->ops->add_inb_buffer(mport, mbox, buffer);
340} 341}
341 342
342/** 343/**
@@ -348,7 +349,7 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
348 */ 349 */
349static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox) 350static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox)
350{ 351{
351 return rio_hw_get_inb_message(mport, mbox); 352 return mport->ops->get_inb_message(mport, mbox);
352} 353}
353 354
354/* Doorbell management */ 355/* Doorbell management */
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index e9fd04ca1e51..830e65dc01ee 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -27,18 +27,15 @@
27struct anon_vma { 27struct anon_vma {
28 struct anon_vma *root; /* Root of this anon_vma tree */ 28 struct anon_vma *root; /* Root of this anon_vma tree */
29 spinlock_t lock; /* Serialize access to vma list */ 29 spinlock_t lock; /* Serialize access to vma list */
30#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
31
32 /* 30 /*
33 * The external_refcount is taken by either KSM or page migration 31 * The refcount is taken on an anon_vma when there is no
34 * to take a reference to an anon_vma when there is no
35 * guarantee that the vma of page tables will exist for 32 * guarantee that the vma of page tables will exist for
36 * the duration of the operation. A caller that takes 33 * the duration of the operation. A caller that takes
37 * the reference is responsible for clearing up the 34 * the reference is responsible for clearing up the
38 * anon_vma if they are the last user on release 35 * anon_vma if they are the last user on release
39 */ 36 */
40 atomic_t external_refcount; 37 atomic_t refcount;
41#endif 38
42 /* 39 /*
43 * NOTE: the LSB of the head.next is set by 40 * NOTE: the LSB of the head.next is set by
44 * mm_take_all_locks() _after_ taking the above lock. So the 41 * mm_take_all_locks() _after_ taking the above lock. So the
@@ -71,42 +68,19 @@ struct anon_vma_chain {
71}; 68};
72 69
73#ifdef CONFIG_MMU 70#ifdef CONFIG_MMU
74#if defined(CONFIG_KSM) || defined(CONFIG_MIGRATION)
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)
81{
82 return atomic_read(&anon_vma->external_refcount);
83}
84
85static inline void get_anon_vma(struct anon_vma *anon_vma) 71static inline void get_anon_vma(struct anon_vma *anon_vma)
86{ 72{
87 atomic_inc(&anon_vma->external_refcount); 73 atomic_inc(&anon_vma->refcount);
88} 74}
89 75
90void drop_anon_vma(struct anon_vma *); 76void __put_anon_vma(struct anon_vma *anon_vma);
91#else
92static inline void anonvma_external_refcount_init(struct anon_vma *anon_vma)
93{
94}
95 77
96static inline int anonvma_external_refcount(struct anon_vma *anon_vma) 78static inline void put_anon_vma(struct anon_vma *anon_vma)
97{
98 return 0;
99}
100
101static inline void get_anon_vma(struct anon_vma *anon_vma)
102{ 79{
80 if (atomic_dec_and_test(&anon_vma->refcount))
81 __put_anon_vma(anon_vma);
103} 82}
104 83
105static inline void drop_anon_vma(struct anon_vma *anon_vma)
106{
107}
108#endif /* CONFIG_KSM */
109
110static inline struct anon_vma *page_anon_vma(struct page *page) 84static inline struct anon_vma *page_anon_vma(struct page *page)
111{ 85{
112 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != 86 if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
@@ -148,7 +122,6 @@ void unlink_anon_vmas(struct vm_area_struct *);
148int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
149int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 123int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
150void __anon_vma_link(struct vm_area_struct *); 124void __anon_vma_link(struct vm_area_struct *);
151void anon_vma_free(struct anon_vma *);
152 125
153static inline void anon_vma_merge(struct vm_area_struct *vma, 126static inline void anon_vma_merge(struct vm_area_struct *vma,
154 struct vm_area_struct *next) 127 struct vm_area_struct *next)
@@ -157,6 +130,8 @@ static inline void anon_vma_merge(struct vm_area_struct *vma,
157 unlink_anon_vmas(next); 130 unlink_anon_vmas(next);
158} 131}
159 132
133struct anon_vma *page_get_anon_vma(struct page *page);
134
160/* 135/*
161 * rmap interfaces called when adding or removing pte of page 136 * rmap interfaces called when adding or removing pte of page
162 */ 137 */
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 89c3e5182991..2ca7e8a78060 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -133,7 +133,6 @@ extern struct class *rtc_class;
133 * The (current) exceptions are mostly filesystem hooks: 133 * The (current) exceptions are mostly filesystem hooks:
134 * - the proc() hook for procfs 134 * - the proc() hook for procfs
135 * - non-ioctl() chardev hooks: open(), release(), read_callback() 135 * - non-ioctl() chardev hooks: open(), release(), read_callback()
136 * - periodic irq calls: irq_set_state(), irq_set_freq()
137 * 136 *
138 * REVISIT those periodic irq calls *do* have ops_lock when they're 137 * REVISIT those periodic irq calls *do* have ops_lock when they're
139 * issued through ioctl() ... 138 * issued through ioctl() ...
@@ -148,11 +147,8 @@ struct rtc_class_ops {
148 int (*set_alarm)(struct device *, struct rtc_wkalrm *); 147 int (*set_alarm)(struct device *, struct rtc_wkalrm *);
149 int (*proc)(struct device *, struct seq_file *); 148 int (*proc)(struct device *, struct seq_file *);
150 int (*set_mmss)(struct device *, unsigned long secs); 149 int (*set_mmss)(struct device *, unsigned long secs);
151 int (*irq_set_state)(struct device *, int enabled);
152 int (*irq_set_freq)(struct device *, int freq);
153 int (*read_callback)(struct device *, int data); 150 int (*read_callback)(struct device *, int data);
154 int (*alarm_irq_enable)(struct device *, unsigned int enabled); 151 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
155 int (*update_irq_enable)(struct device *, unsigned int enabled);
156}; 152};
157 153
158#define RTC_DEVICE_NAME_SIZE 20 154#define RTC_DEVICE_NAME_SIZE 20
@@ -227,6 +223,7 @@ extern void rtc_device_unregister(struct rtc_device *rtc);
227extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm); 223extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);
228extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); 224extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm);
229extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs); 225extern int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs);
226int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm);
230extern int rtc_read_alarm(struct rtc_device *rtc, 227extern int rtc_read_alarm(struct rtc_device *rtc,
231 struct rtc_wkalrm *alrm); 228 struct rtc_wkalrm *alrm);
232extern int rtc_set_alarm(struct rtc_device *rtc, 229extern int rtc_set_alarm(struct rtc_device *rtc,
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h
index bd31808c7d8e..cc0072e93e36 100644
--- a/include/linux/rwlock_types.h
+++ b/include/linux/rwlock_types.h
@@ -43,14 +43,6 @@ typedef struct {
43 RW_DEP_MAP_INIT(lockname) } 43 RW_DEP_MAP_INIT(lockname) }
44#endif 44#endif
45 45
46/*
47 * RW_LOCK_UNLOCKED defeat lockdep state tracking and is hence
48 * deprecated.
49 *
50 * Please use DEFINE_RWLOCK() or __RW_LOCK_UNLOCKED() as appropriate.
51 */
52#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
53
54#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) 46#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
55 47
56#endif /* __LINUX_RWLOCK_TYPES_H */ 48#endif /* __LINUX_RWLOCK_TYPES_H */
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index bdfcc2527970..34701241b673 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -12,15 +12,7 @@
12#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead" 12#error "please don't include linux/rwsem-spinlock.h directly, use linux/rwsem.h instead"
13#endif 13#endif
14 14
15#include <linux/spinlock.h>
16#include <linux/list.h>
17
18#ifdef __KERNEL__ 15#ifdef __KERNEL__
19
20#include <linux/types.h>
21
22struct rwsem_waiter;
23
24/* 16/*
25 * the rw-semaphore definition 17 * the rw-semaphore definition
26 * - if activity is 0 then there are no active readers or writers 18 * - if activity is 0 then there are no active readers or writers
@@ -37,28 +29,7 @@ struct rw_semaphore {
37#endif 29#endif
38}; 30};
39 31
40#ifdef CONFIG_DEBUG_LOCK_ALLOC 32#define RWSEM_UNLOCKED_VALUE 0x00000000
41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42#else
43# define __RWSEM_DEP_MAP_INIT(lockname)
44#endif
45
46#define __RWSEM_INITIALIZER(name) \
47{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \
48 __RWSEM_DEP_MAP_INIT(name) }
49
50#define DECLARE_RWSEM(name) \
51 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
52
53extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
54 struct lock_class_key *key);
55
56#define init_rwsem(sem) \
57do { \
58 static struct lock_class_key __key; \
59 \
60 __init_rwsem((sem), #sem, &__key); \
61} while (0)
62 33
63extern void __down_read(struct rw_semaphore *sem); 34extern void __down_read(struct rw_semaphore *sem);
64extern int __down_read_trylock(struct rw_semaphore *sem); 35extern int __down_read_trylock(struct rw_semaphore *sem);
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index efd348fe8ca7..a8afe9cd000c 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -11,6 +11,9 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/list.h>
15#include <linux/spinlock.h>
16
14#include <asm/system.h> 17#include <asm/system.h>
15#include <asm/atomic.h> 18#include <asm/atomic.h>
16 19
@@ -19,9 +22,57 @@ struct rw_semaphore;
19#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK 22#ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
20#include <linux/rwsem-spinlock.h> /* use a generic implementation */ 23#include <linux/rwsem-spinlock.h> /* use a generic implementation */
21#else 24#else
22#include <asm/rwsem.h> /* use an arch-specific implementation */ 25/* All arch specific implementations share the same struct */
26struct rw_semaphore {
27 long count;
28 spinlock_t wait_lock;
29 struct list_head wait_list;
30#ifdef CONFIG_DEBUG_LOCK_ALLOC
31 struct lockdep_map dep_map;
32#endif
33};
34
35extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
36extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
37extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
38extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
39
40/* Include the arch specific part */
41#include <asm/rwsem.h>
42
43/* In all implementations count != 0 means locked */
44static inline int rwsem_is_locked(struct rw_semaphore *sem)
45{
46 return sem->count != 0;
47}
48
49#endif
50
51/* Common initializer macros and functions */
52
53#ifdef CONFIG_DEBUG_LOCK_ALLOC
54# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
55#else
56# define __RWSEM_DEP_MAP_INIT(lockname)
23#endif 57#endif
24 58
59#define __RWSEM_INITIALIZER(name) \
60 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED(name.wait_lock), \
61 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
62
63#define DECLARE_RWSEM(name) \
64 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
65
66extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
67 struct lock_class_key *key);
68
69#define init_rwsem(sem) \
70do { \
71 static struct lock_class_key __key; \
72 \
73 __init_rwsem((sem), #sem, &__key); \
74} while (0)
75
25/* 76/*
26 * lock for reading 77 * lock for reading
27 */ 78 */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 96ac22643742..83bd2e2982fc 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -517,7 +517,7 @@ struct thread_group_cputimer {
517struct autogroup; 517struct autogroup;
518 518
519/* 519/*
520 * NOTE! "signal_struct" does not have it's own 520 * NOTE! "signal_struct" does not have its own
521 * locking, because a shared signal_struct always 521 * locking, because a shared signal_struct always
522 * implies a shared sighand_struct, so locking 522 * implies a shared sighand_struct, so locking
523 * sighand_struct is always a proper superset of 523 * sighand_struct is always a proper superset of
@@ -1059,6 +1059,7 @@ struct sched_class {
1059 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); 1059 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags);
1060 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); 1060 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags);
1061 void (*yield_task) (struct rq *rq); 1061 void (*yield_task) (struct rq *rq);
1062 bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
1062 1063
1063 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); 1064 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags);
1064 1065
@@ -1085,12 +1086,10 @@ struct sched_class {
1085 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); 1086 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
1086 void (*task_fork) (struct task_struct *p); 1087 void (*task_fork) (struct task_struct *p);
1087 1088
1088 void (*switched_from) (struct rq *this_rq, struct task_struct *task, 1089 void (*switched_from) (struct rq *this_rq, struct task_struct *task);
1089 int running); 1090 void (*switched_to) (struct rq *this_rq, struct task_struct *task);
1090 void (*switched_to) (struct rq *this_rq, struct task_struct *task,
1091 int running);
1092 void (*prio_changed) (struct rq *this_rq, struct task_struct *task, 1091 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
1093 int oldprio, int running); 1092 int oldprio);
1094 1093
1095 unsigned int (*get_rr_interval) (struct rq *rq, 1094 unsigned int (*get_rr_interval) (struct rq *rq,
1096 struct task_struct *task); 1095 struct task_struct *task);
@@ -1478,6 +1477,7 @@ struct task_struct {
1478#ifdef CONFIG_NUMA 1477#ifdef CONFIG_NUMA
1479 struct mempolicy *mempolicy; /* Protected by alloc_lock */ 1478 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1480 short il_next; 1479 short il_next;
1480 short pref_node_fork;
1481#endif 1481#endif
1482 atomic_t fs_excl; /* holding fs exclusive resources */ 1482 atomic_t fs_excl; /* holding fs exclusive resources */
1483 struct rcu_head rcu; 1483 struct rcu_head rcu;
@@ -1530,8 +1530,8 @@ struct task_struct {
1530 struct memcg_batch_info { 1530 struct memcg_batch_info {
1531 int do_batch; /* incremented when batch uncharge started */ 1531 int do_batch; /* incremented when batch uncharge started */
1532 struct mem_cgroup *memcg; /* target memcg of uncharge */ 1532 struct mem_cgroup *memcg; /* target memcg of uncharge */
1533 unsigned long bytes; /* uncharged usage */ 1533 unsigned long nr_pages; /* uncharged usage */
1534 unsigned long memsw_bytes; /* uncharged mem+swap usage */ 1534 unsigned long memsw_nr_pages; /* uncharged mem+swap usage */
1535 } memcg_batch; 1535 } memcg_batch;
1536#endif 1536#endif
1537}; 1537};
@@ -1721,7 +1721,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1721/* 1721/*
1722 * Per process flags 1722 * Per process flags
1723 */ 1723 */
1724#define PF_KSOFTIRQD 0x00000001 /* I am ksoftirqd */
1725#define PF_STARTING 0x00000002 /* being created */ 1724#define PF_STARTING 0x00000002 /* being created */
1726#define PF_EXITING 0x00000004 /* getting shut down */ 1725#define PF_EXITING 0x00000004 /* getting shut down */
1727#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1726#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
@@ -1951,8 +1950,6 @@ int sched_rt_handler(struct ctl_table *table, int write,
1951 void __user *buffer, size_t *lenp, 1950 void __user *buffer, size_t *lenp,
1952 loff_t *ppos); 1951 loff_t *ppos);
1953 1952
1954extern unsigned int sysctl_sched_compat_yield;
1955
1956#ifdef CONFIG_SCHED_AUTOGROUP 1953#ifdef CONFIG_SCHED_AUTOGROUP
1957extern unsigned int sysctl_sched_autogroup_enabled; 1954extern unsigned int sysctl_sched_autogroup_enabled;
1958 1955
@@ -1983,6 +1980,7 @@ static inline int rt_mutex_getprio(struct task_struct *p)
1983# define rt_mutex_adjust_pi(p) do { } while (0) 1980# define rt_mutex_adjust_pi(p) do { } while (0)
1984#endif 1981#endif
1985 1982
1983extern bool yield_to(struct task_struct *p, bool preempt);
1986extern void set_user_nice(struct task_struct *p, long nice); 1984extern void set_user_nice(struct task_struct *p, long nice);
1987extern int task_prio(const struct task_struct *p); 1985extern int task_prio(const struct task_struct *p);
1988extern int task_nice(const struct task_struct *p); 1986extern int task_nice(const struct task_struct *p);
@@ -2055,7 +2053,7 @@ extern void release_uids(struct user_namespace *ns);
2055 2053
2056#include <asm/current.h> 2054#include <asm/current.h>
2057 2055
2058extern void do_timer(unsigned long ticks); 2056extern void xtime_update(unsigned long ticks);
2059 2057
2060extern int wake_up_state(struct task_struct *tsk, unsigned int state); 2058extern int wake_up_state(struct task_struct *tsk, unsigned int state);
2061extern int wake_up_process(struct task_struct *tsk); 2059extern int wake_up_process(struct task_struct *tsk);
@@ -2584,13 +2582,6 @@ static inline void inc_syscw(struct task_struct *tsk)
2584#define TASK_SIZE_OF(tsk) TASK_SIZE 2582#define TASK_SIZE_OF(tsk) TASK_SIZE
2585#endif 2583#endif
2586 2584
2587/*
2588 * Call the function if the target task is executing on a CPU right now:
2589 */
2590extern void task_oncpu_function_call(struct task_struct *p,
2591 void (*func) (void *info), void *info);
2592
2593
2594#ifdef CONFIG_MM_OWNER 2585#ifdef CONFIG_MM_OWNER
2595extern void mm_update_next_owner(struct mm_struct *mm); 2586extern void mm_update_next_owner(struct mm_struct *mm);
2596extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); 2587extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
diff --git a/include/linux/security.h b/include/linux/security.h
index b2b7f9749f5e..ca02f1716736 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -25,6 +25,7 @@
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/fsnotify.h> 26#include <linux/fsnotify.h>
27#include <linux/binfmts.h> 27#include <linux/binfmts.h>
28#include <linux/dcache.h>
28#include <linux/signal.h> 29#include <linux/signal.h>
29#include <linux/resource.h> 30#include <linux/resource.h>
30#include <linux/sem.h> 31#include <linux/sem.h>
@@ -46,14 +47,15 @@
46 47
47struct ctl_table; 48struct ctl_table;
48struct audit_krule; 49struct audit_krule;
50struct user_namespace;
49 51
50/* 52/*
51 * These functions are in security/capability.c and are used 53 * These functions are in security/capability.c and are used
52 * as the default capabilities functions 54 * as the default capabilities functions
53 */ 55 */
54extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 56extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
55 int cap, int audit); 57 struct user_namespace *ns, int cap, int audit);
56extern int cap_settime(struct timespec *ts, struct timezone *tz); 58extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
57extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 59extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
58extern int cap_ptrace_traceme(struct task_struct *parent); 60extern int cap_ptrace_traceme(struct task_struct *parent);
59extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 61extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -267,6 +269,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
267 * @orig the original mount data copied from userspace. 269 * @orig the original mount data copied from userspace.
268 * @copy copied data which will be passed to the security module. 270 * @copy copied data which will be passed to the security module.
269 * Returns 0 if the copy was successful. 271 * Returns 0 if the copy was successful.
272 * @sb_remount:
273 * Extracts security system specifc mount options and verifys no changes
274 * are being made to those options.
275 * @sb superblock being remounted
276 * @data contains the filesystem-specific data.
277 * Return 0 if permission is granted.
270 * @sb_umount: 278 * @sb_umount:
271 * Check permission before the @mnt file system is unmounted. 279 * Check permission before the @mnt file system is unmounted.
272 * @mnt contains the mounted file system. 280 * @mnt contains the mounted file system.
@@ -315,6 +323,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
315 * then it should return -EOPNOTSUPP to skip this processing. 323 * then it should return -EOPNOTSUPP to skip this processing.
316 * @inode contains the inode structure of the newly created inode. 324 * @inode contains the inode structure of the newly created inode.
317 * @dir contains the inode structure of the parent directory. 325 * @dir contains the inode structure of the parent directory.
326 * @qstr contains the last path component of the new object
318 * @name will be set to the allocated name suffix (e.g. selinux). 327 * @name will be set to the allocated name suffix (e.g. selinux).
319 * @value will be set to the allocated attribute value. 328 * @value will be set to the allocated attribute value.
320 * @len will be set to the length of the value. 329 * @len will be set to the length of the value.
@@ -1254,15 +1263,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1254 * credentials. 1263 * credentials.
1255 * @tsk contains the task_struct for the process. 1264 * @tsk contains the task_struct for the process.
1256 * @cred contains the credentials to use. 1265 * @cred contains the credentials to use.
1266 * @ns contains the user namespace we want the capability in
1257 * @cap contains the capability <include/linux/capability.h>. 1267 * @cap contains the capability <include/linux/capability.h>.
1258 * @audit: Whether to write an audit message or not 1268 * @audit: Whether to write an audit message or not
1259 * Return 0 if the capability is granted for @tsk. 1269 * Return 0 if the capability is granted for @tsk.
1260 * @sysctl:
1261 * Check permission before accessing the @table sysctl variable in the
1262 * manner specified by @op.
1263 * @table contains the ctl_table structure for the sysctl variable.
1264 * @op contains the operation (001 = search, 002 = write, 004 = read).
1265 * Return 0 if permission is granted.
1266 * @syslog: 1270 * @syslog:
1267 * Check permission before accessing the kernel message ring or changing 1271 * Check permission before accessing the kernel message ring or changing
1268 * logging to the console. 1272 * logging to the console.
@@ -1382,12 +1386,11 @@ struct security_operations {
1382 const kernel_cap_t *inheritable, 1386 const kernel_cap_t *inheritable,
1383 const kernel_cap_t *permitted); 1387 const kernel_cap_t *permitted);
1384 int (*capable) (struct task_struct *tsk, const struct cred *cred, 1388 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1385 int cap, int audit); 1389 struct user_namespace *ns, int cap, int audit);
1386 int (*sysctl) (struct ctl_table *table, int op);
1387 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1390 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1388 int (*quota_on) (struct dentry *dentry); 1391 int (*quota_on) (struct dentry *dentry);
1389 int (*syslog) (int type); 1392 int (*syslog) (int type);
1390 int (*settime) (struct timespec *ts, struct timezone *tz); 1393 int (*settime) (const struct timespec *ts, const struct timezone *tz);
1391 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1394 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1392 1395
1393 int (*bprm_set_creds) (struct linux_binprm *bprm); 1396 int (*bprm_set_creds) (struct linux_binprm *bprm);
@@ -1399,6 +1402,7 @@ struct security_operations {
1399 int (*sb_alloc_security) (struct super_block *sb); 1402 int (*sb_alloc_security) (struct super_block *sb);
1400 void (*sb_free_security) (struct super_block *sb); 1403 void (*sb_free_security) (struct super_block *sb);
1401 int (*sb_copy_data) (char *orig, char *copy); 1404 int (*sb_copy_data) (char *orig, char *copy);
1405 int (*sb_remount) (struct super_block *sb, void *data);
1402 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); 1406 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1403 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1407 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1404 int (*sb_statfs) (struct dentry *dentry); 1408 int (*sb_statfs) (struct dentry *dentry);
@@ -1435,7 +1439,8 @@ struct security_operations {
1435 int (*inode_alloc_security) (struct inode *inode); 1439 int (*inode_alloc_security) (struct inode *inode);
1436 void (*inode_free_security) (struct inode *inode); 1440 void (*inode_free_security) (struct inode *inode);
1437 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1441 int (*inode_init_security) (struct inode *inode, struct inode *dir,
1438 char **name, void **value, size_t *len); 1442 const struct qstr *qstr, char **name,
1443 void **value, size_t *len);
1439 int (*inode_create) (struct inode *dir, 1444 int (*inode_create) (struct inode *dir,
1440 struct dentry *dentry, int mode); 1445 struct dentry *dentry, int mode);
1441 int (*inode_link) (struct dentry *old_dentry, 1446 int (*inode_link) (struct dentry *old_dentry,
@@ -1623,7 +1628,7 @@ struct security_operations {
1623 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 1628 int (*xfrm_policy_lookup) (struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1624 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x, 1629 int (*xfrm_state_pol_flow_match) (struct xfrm_state *x,
1625 struct xfrm_policy *xp, 1630 struct xfrm_policy *xp,
1626 struct flowi *fl); 1631 const struct flowi *fl);
1627 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall); 1632 int (*xfrm_decode_session) (struct sk_buff *skb, u32 *secid, int ckall);
1628#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 1633#endif /* CONFIG_SECURITY_NETWORK_XFRM */
1629 1634
@@ -1662,14 +1667,16 @@ int security_capset(struct cred *new, const struct cred *old,
1662 const kernel_cap_t *effective, 1667 const kernel_cap_t *effective,
1663 const kernel_cap_t *inheritable, 1668 const kernel_cap_t *inheritable,
1664 const kernel_cap_t *permitted); 1669 const kernel_cap_t *permitted);
1665int security_capable(const struct cred *cred, int cap); 1670int security_capable(struct user_namespace *ns, const struct cred *cred,
1666int security_real_capable(struct task_struct *tsk, int cap); 1671 int cap);
1667int security_real_capable_noaudit(struct task_struct *tsk, int cap); 1672int security_real_capable(struct task_struct *tsk, struct user_namespace *ns,
1668int security_sysctl(struct ctl_table *table, int op); 1673 int cap);
1674int security_real_capable_noaudit(struct task_struct *tsk,
1675 struct user_namespace *ns, int cap);
1669int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1676int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1670int security_quota_on(struct dentry *dentry); 1677int security_quota_on(struct dentry *dentry);
1671int security_syslog(int type); 1678int security_syslog(int type);
1672int security_settime(struct timespec *ts, struct timezone *tz); 1679int security_settime(const struct timespec *ts, const struct timezone *tz);
1673int security_vm_enough_memory(long pages); 1680int security_vm_enough_memory(long pages);
1674int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1681int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1675int security_vm_enough_memory_kern(long pages); 1682int security_vm_enough_memory_kern(long pages);
@@ -1681,6 +1688,7 @@ int security_bprm_secureexec(struct linux_binprm *bprm);
1681int security_sb_alloc(struct super_block *sb); 1688int security_sb_alloc(struct super_block *sb);
1682void security_sb_free(struct super_block *sb); 1689void security_sb_free(struct super_block *sb);
1683int security_sb_copy_data(char *orig, char *copy); 1690int security_sb_copy_data(char *orig, char *copy);
1691int security_sb_remount(struct super_block *sb, void *data);
1684int security_sb_kern_mount(struct super_block *sb, int flags, void *data); 1692int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1685int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1693int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1686int security_sb_statfs(struct dentry *dentry); 1694int security_sb_statfs(struct dentry *dentry);
@@ -1696,7 +1704,8 @@ int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1696int security_inode_alloc(struct inode *inode); 1704int security_inode_alloc(struct inode *inode);
1697void security_inode_free(struct inode *inode); 1705void security_inode_free(struct inode *inode);
1698int security_inode_init_security(struct inode *inode, struct inode *dir, 1706int security_inode_init_security(struct inode *inode, struct inode *dir,
1699 char **name, void **value, size_t *len); 1707 const struct qstr *qstr, char **name,
1708 void **value, size_t *len);
1700int security_inode_create(struct inode *dir, struct dentry *dentry, int mode); 1709int security_inode_create(struct inode *dir, struct dentry *dentry, int mode);
1701int security_inode_link(struct dentry *old_dentry, struct inode *dir, 1710int security_inode_link(struct dentry *old_dentry, struct inode *dir,
1702 struct dentry *new_dentry); 1711 struct dentry *new_dentry);
@@ -1856,38 +1865,34 @@ static inline int security_capset(struct cred *new,
1856 return cap_capset(new, old, effective, inheritable, permitted); 1865 return cap_capset(new, old, effective, inheritable, permitted);
1857} 1866}
1858 1867
1859static inline int security_capable(const struct cred *cred, int cap) 1868static inline int security_capable(struct user_namespace *ns,
1869 const struct cred *cred, int cap)
1860{ 1870{
1861 return cap_capable(current, cred, cap, SECURITY_CAP_AUDIT); 1871 return cap_capable(current, cred, ns, cap, SECURITY_CAP_AUDIT);
1862} 1872}
1863 1873
1864static inline int security_real_capable(struct task_struct *tsk, int cap) 1874static inline int security_real_capable(struct task_struct *tsk, struct user_namespace *ns, int cap)
1865{ 1875{
1866 int ret; 1876 int ret;
1867 1877
1868 rcu_read_lock(); 1878 rcu_read_lock();
1869 ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT); 1879 ret = cap_capable(tsk, __task_cred(tsk), ns, cap, SECURITY_CAP_AUDIT);
1870 rcu_read_unlock(); 1880 rcu_read_unlock();
1871 return ret; 1881 return ret;
1872} 1882}
1873 1883
1874static inline 1884static inline
1875int security_real_capable_noaudit(struct task_struct *tsk, int cap) 1885int security_real_capable_noaudit(struct task_struct *tsk, struct user_namespace *ns, int cap)
1876{ 1886{
1877 int ret; 1887 int ret;
1878 1888
1879 rcu_read_lock(); 1889 rcu_read_lock();
1880 ret = cap_capable(tsk, __task_cred(tsk), cap, 1890 ret = cap_capable(tsk, __task_cred(tsk), ns, cap,
1881 SECURITY_CAP_NOAUDIT); 1891 SECURITY_CAP_NOAUDIT);
1882 rcu_read_unlock(); 1892 rcu_read_unlock();
1883 return ret; 1893 return ret;
1884} 1894}
1885 1895
1886static inline int security_sysctl(struct ctl_table *table, int op)
1887{
1888 return 0;
1889}
1890
1891static inline int security_quotactl(int cmds, int type, int id, 1896static inline int security_quotactl(int cmds, int type, int id,
1892 struct super_block *sb) 1897 struct super_block *sb)
1893{ 1898{
@@ -1904,7 +1909,8 @@ static inline int security_syslog(int type)
1904 return 0; 1909 return 0;
1905} 1910}
1906 1911
1907static inline int security_settime(struct timespec *ts, struct timezone *tz) 1912static inline int security_settime(const struct timespec *ts,
1913 const struct timezone *tz)
1908{ 1914{
1909 return cap_settime(ts, tz); 1915 return cap_settime(ts, tz);
1910} 1916}
@@ -1964,6 +1970,11 @@ static inline int security_sb_copy_data(char *orig, char *copy)
1964 return 0; 1970 return 0;
1965} 1971}
1966 1972
1973static inline int security_sb_remount(struct super_block *sb, void *data)
1974{
1975 return 0;
1976}
1977
1967static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data) 1978static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1968{ 1979{
1969 return 0; 1980 return 0;
@@ -2023,6 +2034,7 @@ static inline void security_inode_free(struct inode *inode)
2023 2034
2024static inline int security_inode_init_security(struct inode *inode, 2035static inline int security_inode_init_security(struct inode *inode,
2025 struct inode *dir, 2036 struct inode *dir,
2037 const struct qstr *qstr,
2026 char **name, 2038 char **name,
2027 void **value, 2039 void **value,
2028 size_t *len) 2040 size_t *len)
@@ -2761,7 +2773,8 @@ int security_xfrm_state_delete(struct xfrm_state *x);
2761void security_xfrm_state_free(struct xfrm_state *x); 2773void security_xfrm_state_free(struct xfrm_state *x);
2762int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); 2774int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2763int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2775int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2764 struct xfrm_policy *xp, struct flowi *fl); 2776 struct xfrm_policy *xp,
2777 const struct flowi *fl);
2765int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2778int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
2766void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); 2779void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2767 2780
@@ -2813,7 +2826,7 @@ static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_s
2813} 2826}
2814 2827
2815static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2828static inline int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2816 struct xfrm_policy *xp, struct flowi *fl) 2829 struct xfrm_policy *xp, const struct flowi *fl)
2817{ 2830{
2818 return 1; 2831 return 1;
2819} 2832}
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 1630d9cae22a..a2afc9fbe186 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -34,28 +34,32 @@ enum {
34 SCIx_NR_IRQS, 34 SCIx_NR_IRQS,
35}; 35};
36 36
37#define SCIx_IRQ_MUXED(irq) \
38{ \
39 [SCIx_ERI_IRQ] = (irq), \
40 [SCIx_RXI_IRQ] = (irq), \
41 [SCIx_TXI_IRQ] = (irq), \
42 [SCIx_BRI_IRQ] = (irq), \
43}
44
37struct device; 45struct device;
38 46
39/* 47/*
40 * Platform device specific platform_data struct 48 * Platform device specific platform_data struct
41 */ 49 */
42struct plat_sci_port { 50struct plat_sci_port {
43 void __iomem *membase; /* io cookie */
44 unsigned long mapbase; /* resource base */ 51 unsigned long mapbase; /* resource base */
45 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 52 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
46 unsigned int type; /* SCI / SCIF / IRDA */ 53 unsigned int type; /* SCI / SCIF / IRDA */
47 upf_t flags; /* UPF_* flags */ 54 upf_t flags; /* UPF_* flags */
48 char *clk; /* clock string */
49 55
50 unsigned int scbrr_algo_id; /* SCBRR calculation algo */ 56 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
51 unsigned int scscr; /* SCSCR initialization */ 57 unsigned int scscr; /* SCSCR initialization */
52 58
53 struct device *dma_dev; 59 struct device *dma_dev;
54 60
55#ifdef CONFIG_SERIAL_SH_SCI_DMA 61 unsigned int dma_slave_tx;
56 unsigned int dma_slave_tx; 62 unsigned int dma_slave_rx;
57 unsigned int dma_slave_rx;
58#endif
59}; 63};
60 64
61#endif /* __LINUX_SERIAL_SCI_H */ 65#endif /* __LINUX_SERIAL_SCI_H */
diff --git a/include/linux/sigma.h b/include/linux/sigma.h
new file mode 100644
index 000000000000..e2accb3164d8
--- /dev/null
+++ b/include/linux/sigma.h
@@ -0,0 +1,60 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/firmware.h>
13#include <linux/types.h>
14
15struct i2c_client;
16
17#define SIGMA_MAGIC "ADISIGM"
18
19struct sigma_firmware {
20 const struct firmware *fw;
21 size_t pos;
22};
23
24struct sigma_firmware_header {
25 unsigned char magic[7];
26 u8 version;
27 u32 crc;
28};
29
30enum {
31 SIGMA_ACTION_WRITEXBYTES = 0,
32 SIGMA_ACTION_WRITESINGLE,
33 SIGMA_ACTION_WRITESAFELOAD,
34 SIGMA_ACTION_DELAY,
35 SIGMA_ACTION_PLLWAIT,
36 SIGMA_ACTION_NOOP,
37 SIGMA_ACTION_END,
38};
39
40struct sigma_action {
41 u8 instr;
42 u8 len_hi;
43 u16 len;
44 u16 addr;
45 unsigned char payload[];
46};
47
48static inline u32 sigma_action_len(struct sigma_action *sa)
49{
50 return (sa->len_hi << 16) | sa->len;
51}
52
53static inline size_t sigma_action_size(struct sigma_action *sa, u32 payload_len)
54{
55 return sizeof(*sa) + payload_len + (payload_len % 2);
56}
57
58extern int process_sigma_firmware(struct i2c_client *client, const char *name);
59
60#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf221d65d9ad..24cfa626931e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -388,10 +388,7 @@ struct sk_buff {
388 kmemcheck_bitfield_begin(flags2); 388 kmemcheck_bitfield_begin(flags2);
389 __u16 queue_mapping:16; 389 __u16 queue_mapping:16;
390#ifdef CONFIG_IPV6_NDISC_NODETYPE 390#ifdef CONFIG_IPV6_NDISC_NODETYPE
391 __u8 ndisc_nodetype:2, 391 __u8 ndisc_nodetype:2;
392 deliver_no_wcard:1;
393#else
394 __u8 deliver_no_wcard:1;
395#endif 392#endif
396 __u8 ooo_okay:1; 393 __u8 ooo_okay:1;
397 kmemcheck_bitfield_end(flags2); 394 kmemcheck_bitfield_end(flags2);
@@ -1801,6 +1798,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1801 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1798 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
1802 skb = skb->prev) 1799 skb = skb->prev)
1803 1800
1801#define skb_queue_reverse_walk_safe(queue, skb, tmp) \
1802 for (skb = (queue)->prev, tmp = skb->prev; \
1803 skb != (struct sk_buff *)(queue); \
1804 skb = tmp, tmp = skb->prev)
1805
1806#define skb_queue_reverse_walk_from_safe(queue, skb, tmp) \
1807 for (tmp = skb->prev; \
1808 skb != (struct sk_buff *)(queue); \
1809 skb = tmp, tmp = skb->prev)
1804 1810
1805static inline bool skb_has_frag_list(const struct sk_buff *skb) 1811static inline bool skb_has_frag_list(const struct sk_buff *skb)
1806{ 1812{
@@ -1868,7 +1874,7 @@ extern void skb_split(struct sk_buff *skb,
1868extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb, 1874extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1869 int shiftlen); 1875 int shiftlen);
1870 1876
1871extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1877extern struct sk_buff *skb_segment(struct sk_buff *skb, u32 features);
1872 1878
1873static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1879static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1874 int len, void *buffer) 1880 int len, void *buffer)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index fa9086647eb7..ad4dd1c8d30a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -105,7 +105,6 @@ void kmem_cache_destroy(struct kmem_cache *);
105int kmem_cache_shrink(struct kmem_cache *); 105int kmem_cache_shrink(struct kmem_cache *);
106void kmem_cache_free(struct kmem_cache *, void *); 106void kmem_cache_free(struct kmem_cache *, void *);
107unsigned int kmem_cache_size(struct kmem_cache *); 107unsigned int kmem_cache_size(struct kmem_cache *);
108const char *kmem_cache_name(struct kmem_cache *);
109 108
110/* 109/*
111 * Please use this macro to create slab caches. Simply specify the 110 * Please use this macro to create slab caches. Simply specify the
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 8b6e8ae5d5ca..45ca123e8002 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -32,10 +32,14 @@ enum stat_item {
32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */ 32 DEACTIVATE_TO_TAIL, /* Cpu slab was moved to the tail of partials */
33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */ 33 DEACTIVATE_REMOTE_FREES,/* Slab contained remotely freed objects */
34 ORDER_FALLBACK, /* Number of times fallback was necessary */ 34 ORDER_FALLBACK, /* Number of times fallback was necessary */
35 CMPXCHG_DOUBLE_CPU_FAIL,/* Failure of this_cpu_cmpxchg_double */
35 NR_SLUB_STAT_ITEMS }; 36 NR_SLUB_STAT_ITEMS };
36 37
37struct kmem_cache_cpu { 38struct kmem_cache_cpu {
38 void **freelist; /* Pointer to first free per cpu object */ 39 void **freelist; /* Pointer to next available object */
40#ifdef CONFIG_CMPXCHG_LOCAL
41 unsigned long tid; /* Globally unique transaction id */
42#endif
39 struct page *page; /* The slab from which we are allocating */ 43 struct page *page; /* The slab from which we are allocating */
40 int node; /* The node of the page (or -1 for debug) */ 44 int node; /* The node of the page (or -1 for debug) */
41#ifdef CONFIG_SLUB_STATS 45#ifdef CONFIG_SLUB_STATS
@@ -70,6 +74,7 @@ struct kmem_cache {
70 struct kmem_cache_cpu __percpu *cpu_slab; 74 struct kmem_cache_cpu __percpu *cpu_slab;
71 /* Used for retriving partial slabs etc */ 75 /* Used for retriving partial slabs etc */
72 unsigned long flags; 76 unsigned long flags;
77 unsigned long min_partial;
73 int size; /* The size of an object including meta data */ 78 int size; /* The size of an object including meta data */
74 int objsize; /* The size of an object without meta data */ 79 int objsize; /* The size of an object without meta data */
75 int offset; /* Free pointer offset. */ 80 int offset; /* Free pointer offset. */
@@ -83,7 +88,7 @@ struct kmem_cache {
83 void (*ctor)(void *); 88 void (*ctor)(void *);
84 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
85 int align; /* Alignment */ 90 int align; /* Alignment */
86 unsigned long min_partial; 91 int reserved; /* Reserved bytes at the end of slabs */
87 const char *name; /* Name (only for display!) */ 92 const char *name; /* Name (only for display!) */
88 struct list_head list; /* List of slab caches */ 93 struct list_head list; /* List of slab caches */
89#ifdef CONFIG_SYSFS 94#ifdef CONFIG_SYSFS
diff --git a/include/linux/sm501.h b/include/linux/sm501.h
index 214f93209b8c..02fde50a79a5 100644
--- a/include/linux/sm501.h
+++ b/include/linux/sm501.h
@@ -172,3 +172,11 @@ struct sm501_platdata {
172 struct sm501_platdata_gpio_i2c *gpio_i2c; 172 struct sm501_platdata_gpio_i2c *gpio_i2c;
173 unsigned int gpio_i2c_nr; 173 unsigned int gpio_i2c_nr;
174}; 174};
175
176#if defined(CONFIG_PPC32)
177#define smc501_readl(addr) ioread32be((addr))
178#define smc501_writel(val, addr) iowrite32be((val), (addr))
179#else
180#define smc501_readl(addr) readl(addr)
181#define smc501_writel(val, addr) writel(val, addr)
182#endif
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6dc95cac6b3d..74243c86ba39 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -10,6 +10,7 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/init.h>
13 14
14extern void cpu_idle(void); 15extern void cpu_idle(void);
15 16
@@ -114,6 +115,8 @@ int on_each_cpu(smp_call_func_t func, void *info, int wait);
114void smp_prepare_boot_cpu(void); 115void smp_prepare_boot_cpu(void);
115 116
116extern unsigned int setup_max_cpus; 117extern unsigned int setup_max_cpus;
118extern void __init setup_nr_cpu_ids(void);
119extern void __init smp_init(void);
117 120
118#else /* !SMP */ 121#else /* !SMP */
119 122
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
deleted file mode 100644
index 3a1988202731..000000000000
--- a/include/linux/smp_lock.h
+++ /dev/null
@@ -1,65 +0,0 @@
1#ifndef __LINUX_SMPLOCK_H
2#define __LINUX_SMPLOCK_H
3
4#ifdef CONFIG_LOCK_KERNEL
5#include <linux/sched.h>
6
7extern int __lockfunc __reacquire_kernel_lock(void);
8extern void __lockfunc __release_kernel_lock(void);
9
10/*
11 * Release/re-acquire global kernel lock for the scheduler
12 */
13#define release_kernel_lock(tsk) do { \
14 if (unlikely((tsk)->lock_depth >= 0)) \
15 __release_kernel_lock(); \
16} while (0)
17
18static inline int reacquire_kernel_lock(struct task_struct *task)
19{
20 if (unlikely(task->lock_depth >= 0))
21 return __reacquire_kernel_lock();
22 return 0;
23}
24
25extern void __lockfunc
26_lock_kernel(const char *func, const char *file, int line)
27__acquires(kernel_lock);
28
29extern void __lockfunc
30_unlock_kernel(const char *func, const char *file, int line)
31__releases(kernel_lock);
32
33#define lock_kernel() do { \
34 _lock_kernel(__func__, __FILE__, __LINE__); \
35} while (0)
36
37#define unlock_kernel() do { \
38 _unlock_kernel(__func__, __FILE__, __LINE__); \
39} while (0)
40
41/*
42 * Various legacy drivers don't really need the BKL in a specific
43 * function, but they *do* need to know that the BKL became available.
44 * This function just avoids wrapping a bunch of lock/unlock pairs
45 * around code which doesn't really need it.
46 */
47static inline void cycle_kernel_lock(void)
48{
49 lock_kernel();
50 unlock_kernel();
51}
52
53#else
54
55#ifdef CONFIG_BKL /* provoke build bug if not set */
56#define lock_kernel()
57#define unlock_kernel()
58#define cycle_kernel_lock() do { } while(0)
59#endif /* CONFIG_BKL */
60
61#define release_kernel_lock(task) do { } while(0)
62#define reacquire_kernel_lock(task) 0
63
64#endif /* CONFIG_LOCK_KERNEL */
65#endif /* __LINUX_SMPLOCK_H */
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 241f179347d9..7997a506ad41 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -22,7 +22,7 @@
22 22
23/* Linux-specific socket ioctls */ 23/* Linux-specific socket ioctls */
24#define SIOCINQ FIONREAD 24#define SIOCINQ FIONREAD
25#define SIOCOUTQ TIOCOUTQ 25#define SIOCOUTQ TIOCOUTQ /* output queue size (not sent + not acked) */
26 26
27/* Routing table calls. */ 27/* Routing table calls. */
28#define SIOCADDRT 0x890B /* add routing table entry */ 28#define SIOCADDRT 0x890B /* add routing table entry */
@@ -83,6 +83,8 @@
83 83
84#define SIOCWANDEV 0x894A /* get/set netdev parameters */ 84#define SIOCWANDEV 0x894A /* get/set netdev parameters */
85 85
86#define SIOCOUTQNSD 0x894B /* output queue size (not sent only) */
87
86/* ARP cache control calls. */ 88/* ARP cache control calls. */
87 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */ 89 /* 0x8950 - 0x8952 * obsolete calls, don't re-use */
88#define SIOCDARP 0x8953 /* delete ARP table entry */ 90#define SIOCDARP 0x8953 /* delete ARP table entry */
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h
deleted file mode 100644
index 6cd10f6ad472..000000000000
--- a/include/linux/spi/dw_spi.h
+++ /dev/null
@@ -1,233 +0,0 @@
1#ifndef DW_SPI_HEADER_H
2#define DW_SPI_HEADER_H
3
4#include <linux/io.h>
5
6/* Bit fields in CTRLR0 */
7#define SPI_DFS_OFFSET 0
8
9#define SPI_FRF_OFFSET 4
10#define SPI_FRF_SPI 0x0
11#define SPI_FRF_SSP 0x1
12#define SPI_FRF_MICROWIRE 0x2
13#define SPI_FRF_RESV 0x3
14
15#define SPI_MODE_OFFSET 6
16#define SPI_SCPH_OFFSET 6
17#define SPI_SCOL_OFFSET 7
18
19#define SPI_TMOD_OFFSET 8
20#define SPI_TMOD_MASK (0x3 << SPI_TMOD_OFFSET)
21#define SPI_TMOD_TR 0x0 /* xmit & recv */
22#define SPI_TMOD_TO 0x1 /* xmit only */
23#define SPI_TMOD_RO 0x2 /* recv only */
24#define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */
25
26#define SPI_SLVOE_OFFSET 10
27#define SPI_SRL_OFFSET 11
28#define SPI_CFS_OFFSET 12
29
30/* Bit fields in SR, 7 bits */
31#define SR_MASK 0x7f /* cover 7 bits */
32#define SR_BUSY (1 << 0)
33#define SR_TF_NOT_FULL (1 << 1)
34#define SR_TF_EMPT (1 << 2)
35#define SR_RF_NOT_EMPT (1 << 3)
36#define SR_RF_FULL (1 << 4)
37#define SR_TX_ERR (1 << 5)
38#define SR_DCOL (1 << 6)
39
40/* Bit fields in ISR, IMR, RISR, 7 bits */
41#define SPI_INT_TXEI (1 << 0)
42#define SPI_INT_TXOI (1 << 1)
43#define SPI_INT_RXUI (1 << 2)
44#define SPI_INT_RXOI (1 << 3)
45#define SPI_INT_RXFI (1 << 4)
46#define SPI_INT_MSTI (1 << 5)
47
48/* TX RX interrupt level threshhold, max can be 256 */
49#define SPI_INT_THRESHOLD 32
50
51enum dw_ssi_type {
52 SSI_MOTO_SPI = 0,
53 SSI_TI_SSP,
54 SSI_NS_MICROWIRE,
55};
56
57struct dw_spi_reg {
58 u32 ctrl0;
59 u32 ctrl1;
60 u32 ssienr;
61 u32 mwcr;
62 u32 ser;
63 u32 baudr;
64 u32 txfltr;
65 u32 rxfltr;
66 u32 txflr;
67 u32 rxflr;
68 u32 sr;
69 u32 imr;
70 u32 isr;
71 u32 risr;
72 u32 txoicr;
73 u32 rxoicr;
74 u32 rxuicr;
75 u32 msticr;
76 u32 icr;
77 u32 dmacr;
78 u32 dmatdlr;
79 u32 dmardlr;
80 u32 idr;
81 u32 version;
82 u32 dr; /* Currently oper as 32 bits,
83 though only low 16 bits matters */
84} __packed;
85
86struct dw_spi;
87struct dw_spi_dma_ops {
88 int (*dma_init)(struct dw_spi *dws);
89 void (*dma_exit)(struct dw_spi *dws);
90 int (*dma_transfer)(struct dw_spi *dws, int cs_change);
91};
92
93struct dw_spi {
94 struct spi_master *master;
95 struct spi_device *cur_dev;
96 struct device *parent_dev;
97 enum dw_ssi_type type;
98
99 void __iomem *regs;
100 unsigned long paddr;
101 u32 iolen;
102 int irq;
103 u32 fifo_len; /* depth of the FIFO buffer */
104 u32 max_freq; /* max bus freq supported */
105
106 u16 bus_num;
107 u16 num_cs; /* supported slave numbers */
108
109 /* Driver message queue */
110 struct workqueue_struct *workqueue;
111 struct work_struct pump_messages;
112 spinlock_t lock;
113 struct list_head queue;
114 int busy;
115 int run;
116
117 /* Message Transfer pump */
118 struct tasklet_struct pump_transfers;
119
120 /* Current message transfer state info */
121 struct spi_message *cur_msg;
122 struct spi_transfer *cur_transfer;
123 struct chip_data *cur_chip;
124 struct chip_data *prev_chip;
125 size_t len;
126 void *tx;
127 void *tx_end;
128 void *rx;
129 void *rx_end;
130 int dma_mapped;
131 dma_addr_t rx_dma;
132 dma_addr_t tx_dma;
133 size_t rx_map_len;
134 size_t tx_map_len;
135 u8 n_bytes; /* current is a 1/2 bytes op */
136 u8 max_bits_per_word; /* maxim is 16b */
137 u32 dma_width;
138 int cs_change;
139 int (*write)(struct dw_spi *dws);
140 int (*read)(struct dw_spi *dws);
141 irqreturn_t (*transfer_handler)(struct dw_spi *dws);
142 void (*cs_control)(u32 command);
143
144 /* Dma info */
145 int dma_inited;
146 struct dma_chan *txchan;
147 struct scatterlist tx_sgl;
148 struct dma_chan *rxchan;
149 struct scatterlist rx_sgl;
150 int dma_chan_done;
151 struct device *dma_dev;
152 dma_addr_t dma_addr; /* phy address of the Data register */
153 struct dw_spi_dma_ops *dma_ops;
154 void *dma_priv; /* platform relate info */
155 struct pci_dev *dmac;
156
157 /* Bus interface info */
158 void *priv;
159#ifdef CONFIG_DEBUG_FS
160 struct dentry *debugfs;
161#endif
162};
163
164#define dw_readl(dw, name) \
165 __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name))
166#define dw_writel(dw, name, val) \
167 __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name))
168#define dw_readw(dw, name) \
169 __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name))
170#define dw_writew(dw, name, val) \
171 __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name))
172
173static inline void spi_enable_chip(struct dw_spi *dws, int enable)
174{
175 dw_writel(dws, ssienr, (enable ? 1 : 0));
176}
177
178static inline void spi_set_clk(struct dw_spi *dws, u16 div)
179{
180 dw_writel(dws, baudr, div);
181}
182
183static inline void spi_chip_sel(struct dw_spi *dws, u16 cs)
184{
185 if (cs > dws->num_cs)
186 return;
187
188 if (dws->cs_control)
189 dws->cs_control(1);
190
191 dw_writel(dws, ser, 1 << cs);
192}
193
194/* Disable IRQ bits */
195static inline void spi_mask_intr(struct dw_spi *dws, u32 mask)
196{
197 u32 new_mask;
198
199 new_mask = dw_readl(dws, imr) & ~mask;
200 dw_writel(dws, imr, new_mask);
201}
202
203/* Enable IRQ bits */
204static inline void spi_umask_intr(struct dw_spi *dws, u32 mask)
205{
206 u32 new_mask;
207
208 new_mask = dw_readl(dws, imr) | mask;
209 dw_writel(dws, imr, new_mask);
210}
211
212/*
213 * Each SPI slave device to work with dw_api controller should
214 * has such a structure claiming its working mode (PIO/DMA etc),
215 * which can be save in the "controller_data" member of the
216 * struct spi_device
217 */
218struct dw_spi_chip {
219 u8 poll_mode; /* 0 for contoller polling mode */
220 u8 type; /* SPI/SSP/Micrwire */
221 u8 enable_dma;
222 void (*cs_control)(u32 command);
223};
224
225extern int dw_spi_add_host(struct dw_spi *dws);
226extern void dw_spi_remove_host(struct dw_spi *dws);
227extern int dw_spi_suspend_host(struct dw_spi *dws);
228extern int dw_spi_resume_host(struct dw_spi *dws);
229extern void dw_spi_xfer_done(struct dw_spi *dws);
230
231/* platform related setup */
232extern int dw_spi_mid_init(struct dw_spi *dws); /* Intel MID platforms */
233#endif /* DW_SPI_HEADER_H */
diff --git a/include/linux/spi/ifx_modem.h b/include/linux/spi/ifx_modem.h
index a68f3b19d112..394fec9e7722 100644
--- a/include/linux/spi/ifx_modem.h
+++ b/include/linux/spi/ifx_modem.h
@@ -2,13 +2,18 @@
2#define LINUX_IFX_MODEM_H 2#define LINUX_IFX_MODEM_H
3 3
4struct ifx_modem_platform_data { 4struct ifx_modem_platform_data {
5 unsigned short rst_out; /* modem reset out */ 5 unsigned short rst_out; /* modem reset out */
6 unsigned short pwr_on; /* power on */ 6 unsigned short pwr_on; /* power on */
7 unsigned short rst_pmu; /* reset modem */ 7 unsigned short rst_pmu; /* reset modem */
8 unsigned short tx_pwr; /* modem power threshold */ 8 unsigned short tx_pwr; /* modem power threshold */
9 unsigned short srdy; /* SRDY */ 9 unsigned short srdy; /* SRDY */
10 unsigned short mrdy; /* MRDY */ 10 unsigned short mrdy; /* MRDY */
11 unsigned short is_6160; /* Modem type */ 11 unsigned char modem_type; /* Modem type */
12 unsigned long max_hz; /* max SPI frequency */
13 unsigned short use_dma:1; /* spi protocol driver supplies
14 dma-able addrs */
12}; 15};
16#define IFX_MODEM_6160 1
17#define IFX_MODEM_6260 2
13 18
14#endif 19#endif
diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
index 22ef107d7704..c42cff8ca191 100644
--- a/include/linux/spi/mcp23s08.h
+++ b/include/linux/spi/mcp23s08.h
@@ -2,21 +2,24 @@
2/* FIXME driver should be able to handle IRQs... */ 2/* FIXME driver should be able to handle IRQs... */
3 3
4struct mcp23s08_chip_info { 4struct mcp23s08_chip_info {
5 bool is_present; /* true iff populated */ 5 bool is_present; /* true if populated */
6 u8 pullups; /* BIT(x) means enable pullup x */ 6 unsigned pullups; /* BIT(x) means enable pullup x */
7}; 7};
8 8
9struct mcp23s08_platform_data { 9struct mcp23s08_platform_data {
10 /* Four slaves (numbered 0..3) can share one SPI chipselect, and 10 /* For mcp23s08, up to 4 slaves (numbered 0..3) can share one SPI
11 * will provide 8..32 GPIOs using 1..4 gpio_chip instances. 11 * chipselect, each providing 1 gpio_chip instance with 8 gpios.
12 * For mpc23s17, up to 8 slaves (numbered 0..7) can share one SPI
13 * chipselect, each providing 1 gpio_chip (port A + port B) with
14 * 16 gpios.
12 */ 15 */
13 struct mcp23s08_chip_info chip[4]; 16 struct mcp23s08_chip_info chip[8];
14 17
15 /* "base" is the number of the first GPIO. Dynamic assignment is 18 /* "base" is the number of the first GPIO. Dynamic assignment is
16 * not currently supported, and even if there are gaps in chip 19 * not currently supported, and even if there are gaps in chip
17 * addressing the GPIO numbers are sequential .. so for example 20 * addressing the GPIO numbers are sequential .. so for example
18 * if only slaves 0 and 3 are present, their GPIOs range from 21 * if only slaves 0 and 3 are present, their GPIOs range from
19 * base to base+15. 22 * base to base+15 (or base+31 for s17 variant).
20 */ 23 */
21 unsigned base; 24 unsigned base;
22 25
diff --git a/include/linux/spi/spi_oc_tiny.h b/include/linux/spi/spi_oc_tiny.h
new file mode 100644
index 000000000000..1ac529cf4f06
--- /dev/null
+++ b/include/linux/spi/spi_oc_tiny.h
@@ -0,0 +1,20 @@
1#ifndef _LINUX_SPI_SPI_OC_TINY_H
2#define _LINUX_SPI_SPI_OC_TINY_H
3
4/**
5 * struct tiny_spi_platform_data - platform data of the OpenCores tiny SPI
6 * @freq: input clock freq to the core.
7 * @baudwidth: baud rate divider width of the core.
8 * @gpio_cs_count: number of gpio pins used for chipselect.
9 * @gpio_cs: array of gpio pins used for chipselect.
10 *
11 * freq and baudwidth are used only if the divider is programmable.
12 */
13struct tiny_spi_platform_data {
14 unsigned int freq;
15 unsigned int baudwidth;
16 unsigned int gpio_cs_count;
17 int *gpio_cs;
18};
19
20#endif /* _LINUX_SPI_SPI_OC_TINY_H */
diff --git a/include/linux/spi/tsc2005.h b/include/linux/spi/tsc2005.h
new file mode 100644
index 000000000000..d9b0c84220c7
--- /dev/null
+++ b/include/linux/spi/tsc2005.h
@@ -0,0 +1,41 @@
1/*
2 * This file is part of TSC2005 touchscreen driver
3 *
4 * Copyright (C) 2009-2010 Nokia Corporation
5 *
6 * Contact: Aaro Koskinen <aaro.koskinen@nokia.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
24#ifndef _LINUX_SPI_TSC2005_H
25#define _LINUX_SPI_TSC2005_H
26
27#include <linux/types.h>
28
29struct tsc2005_platform_data {
30 int ts_pressure_max;
31 int ts_pressure_fudge;
32 int ts_x_max;
33 int ts_x_fudge;
34 int ts_y_max;
35 int ts_y_fudge;
36 int ts_x_plate_ohm;
37 unsigned int esd_timeout_ms;
38 void (*set_reset)(bool enable);
39};
40
41#endif
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 851b7783720d..73548eb13a5d 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -81,14 +81,6 @@ typedef struct spinlock {
81#define __SPIN_LOCK_UNLOCKED(lockname) \ 81#define __SPIN_LOCK_UNLOCKED(lockname) \
82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) 82 (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
83 83
84/*
85 * SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence
86 * deprecated.
87 * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as
88 * appropriate.
89 */
90#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
91
92#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) 84#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
93 85
94#include <linux/rwlock_types.h> 86#include <linux/rwlock_types.h>
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 489f7b6d61c5..402955ae48ce 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -85,6 +85,8 @@
85#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ 85#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */
86#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ 86#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */
87#define SSB_IMSTATE_TO 0x00040000 /* Timeout */ 87#define SSB_IMSTATE_TO 0x00040000 /* Timeout */
88#define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */
89#define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */
88#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ 90#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */
89#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ 91#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */
90#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ 92#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */
@@ -97,7 +99,6 @@
97#define SSB_TMSLOW_RESET 0x00000001 /* Reset */ 99#define SSB_TMSLOW_RESET 0x00000001 /* Reset */
98#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */ 100#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */
99#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ 101#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */
100#define SSB_TMSLOW_PHYCLK 0x00000010 /* MAC PHY Clock Control Enable */
101#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ 102#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */
102#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ 103#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
103#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ 104#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */
@@ -268,6 +269,8 @@
268/* SPROM Revision 4 */ 269/* SPROM Revision 4 */
269#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ 270#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
270#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ 271#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
272#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
273#define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */
271#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ 274#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
272#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ 275#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
273#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ 276#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
@@ -358,6 +361,8 @@
358#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ 361#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
359#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ 362#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
360#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ 363#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
364#define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */
365#define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */
361#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ 366#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
362#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ 367#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
363#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ 368#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ef9476a36ff7..db7bcaf7c5bd 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -129,6 +129,7 @@ struct rpc_create_args {
129struct rpc_clnt *rpc_create(struct rpc_create_args *args); 129struct rpc_clnt *rpc_create(struct rpc_create_args *args);
130struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 130struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
131 struct rpc_program *, u32); 131 struct rpc_program *, u32);
132void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
132struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 133struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
133void rpc_shutdown_client(struct rpc_clnt *); 134void rpc_shutdown_client(struct rpc_clnt *);
134void rpc_release_client(struct rpc_clnt *); 135void rpc_release_client(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h
index 5d8048beb051..332da61cf8b7 100644
--- a/include/linux/sunrpc/gss_api.h
+++ b/include/linux/sunrpc/gss_api.h
@@ -126,6 +126,9 @@ struct gss_api_mech *gss_mech_get_by_name(const char *);
126/* Similar, but get by pseudoflavor. */ 126/* Similar, but get by pseudoflavor. */
127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); 127struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
128 128
129/* Fill in an array with a list of supported pseudoflavors */
130int gss_mech_list_pseudoflavors(u32 *);
131
129/* Just increments the mechanism's reference count and returns its input: */ 132/* Just increments the mechanism's reference count and returns its input: */
130struct gss_api_mech * gss_mech_get(struct gss_api_mech *); 133struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
131 134
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 88513fd8e208..d81db8012c63 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -212,6 +212,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
212struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, 212struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
213 const struct rpc_call_ops *ops); 213 const struct rpc_call_ops *ops);
214void rpc_put_task(struct rpc_task *); 214void rpc_put_task(struct rpc_task *);
215void rpc_put_task_async(struct rpc_task *);
215void rpc_exit_task(struct rpc_task *); 216void rpc_exit_task(struct rpc_task *);
216void rpc_exit(struct rpc_task *, int); 217void rpc_exit(struct rpc_task *, int);
217void rpc_release_calldata(const struct rpc_call_ops *, void *); 218void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index bef0f535f746..a0f998c07c65 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -12,7 +12,6 @@
12#include <linux/uio.h> 12#include <linux/uio.h>
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>
16#include <linux/ktime.h> 15#include <linux/ktime.h>
17#include <linux/sunrpc/sched.h> 16#include <linux/sunrpc/sched.h>
18#include <linux/sunrpc/xdr.h> 17#include <linux/sunrpc/xdr.h>
@@ -146,7 +145,7 @@ enum xprt_transports {
146}; 145};
147 146
148struct rpc_xprt { 147struct rpc_xprt {
149 struct kref kref; /* Reference count */ 148 atomic_t count; /* Reference count */
150 struct rpc_xprt_ops * ops; /* transport methods */ 149 struct rpc_xprt_ops * ops; /* transport methods */
151 150
152 const struct rpc_timeout *timeout; /* timeout parms */ 151 const struct rpc_timeout *timeout; /* timeout parms */
diff --git a/include/linux/svga.h b/include/linux/svga.h
index c59a51a2b0e7..bfa68e837d6a 100644
--- a/include/linux/svga.h
+++ b/include/linux/svga.h
@@ -67,25 +67,25 @@ struct svga_pll {
67 67
68/* Write a value to the attribute register */ 68/* Write a value to the attribute register */
69 69
70static inline void svga_wattr(u8 index, u8 data) 70static inline void svga_wattr(void __iomem *regbase, u8 index, u8 data)
71{ 71{
72 inb(0x3DA); 72 vga_r(regbase, VGA_IS1_RC);
73 outb(index, 0x3C0); 73 vga_w(regbase, VGA_ATT_IW, index);
74 outb(data, 0x3C0); 74 vga_w(regbase, VGA_ATT_W, data);
75} 75}
76 76
77/* Write a value to a sequence register with a mask */ 77/* Write a value to a sequence register with a mask */
78 78
79static inline void svga_wseq_mask(u8 index, u8 data, u8 mask) 79static inline void svga_wseq_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
80{ 80{
81 vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask)); 81 vga_wseq(regbase, index, (data & mask) | (vga_rseq(regbase, index) & ~mask));
82} 82}
83 83
84/* Write a value to a CRT register with a mask */ 84/* Write a value to a CRT register with a mask */
85 85
86static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask) 86static inline void svga_wcrt_mask(void __iomem *regbase, u8 index, u8 data, u8 mask)
87{ 87{
88 vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask)); 88 vga_wcrt(regbase, index, (data & mask) | (vga_rcrt(regbase, index) & ~mask));
89} 89}
90 90
91static inline int svga_primary_device(struct pci_dev *dev) 91static inline int svga_primary_device(struct pci_dev *dev)
@@ -96,27 +96,27 @@ static inline int svga_primary_device(struct pci_dev *dev)
96} 96}
97 97
98 98
99void svga_wcrt_multi(const struct vga_regset *regset, u32 value); 99void svga_wcrt_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
100void svga_wseq_multi(const struct vga_regset *regset, u32 value); 100void svga_wseq_multi(void __iomem *regbase, const struct vga_regset *regset, u32 value);
101 101
102void svga_set_default_gfx_regs(void); 102void svga_set_default_gfx_regs(void __iomem *regbase);
103void svga_set_default_atc_regs(void); 103void svga_set_default_atc_regs(void __iomem *regbase);
104void svga_set_default_seq_regs(void); 104void svga_set_default_seq_regs(void __iomem *regbase);
105void svga_set_default_crt_regs(void); 105void svga_set_default_crt_regs(void __iomem *regbase);
106void svga_set_textmode_vga_regs(void); 106void svga_set_textmode_vga_regs(void __iomem *regbase);
107 107
108void svga_settile(struct fb_info *info, struct fb_tilemap *map); 108void svga_settile(struct fb_info *info, struct fb_tilemap *map);
109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area); 109void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect); 110void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit); 111void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
112void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor); 112void svga_tilecursor(void __iomem *regbase, struct fb_info *info, struct fb_tilecursor *cursor);
113int svga_get_tilemax(struct fb_info *info); 113int svga_get_tilemax(struct fb_info *info);
114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps, 114void svga_get_caps(struct fb_info *info, struct fb_blit_caps *caps,
115 struct fb_var_screeninfo *var); 115 struct fb_var_screeninfo *var);
116 116
117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node); 117int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node); 118int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
119void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node); 119void svga_set_timings(void __iomem *regbase, const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
120 120
121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix); 121int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
122 122
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 9ee321833b21..a5c6da5d8df8 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -155,6 +155,15 @@ enum {
155#define SWAP_CLUSTER_MAX 32 155#define SWAP_CLUSTER_MAX 32
156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
157 157
158/*
159 * Ratio between the present memory in the zone and the "gap" that
160 * we're allowing kswapd to shrink in addition to the per-zone high
161 * wmark, even for zones that already have the high wmark satisfied,
162 * in order to provide better per-zone lru behavior. We are ok to
163 * spend not more than 1% of the memory for this zone balancing "gap".
164 */
165#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
166
158#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 167#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
159#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 168#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
160#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ 169#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */
@@ -215,6 +224,7 @@ extern void mark_page_accessed(struct page *);
215extern void lru_add_drain(void); 224extern void lru_add_drain(void);
216extern int lru_add_drain_all(void); 225extern int lru_add_drain_all(void);
217extern void rotate_reclaimable_page(struct page *page); 226extern void rotate_reclaimable_page(struct page *page);
227extern void deactivate_page(struct page *page);
218extern void swap_setup(void); 228extern void swap_setup(void);
219 229
220extern void add_page_to_unevictable_list(struct page *page); 230extern void add_page_to_unevictable_list(struct page *page);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 98664db1be47..83ecc1749ef6 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -62,6 +62,7 @@ struct robust_list_head;
62struct getcpu_cache; 62struct getcpu_cache;
63struct old_linux_dirent; 63struct old_linux_dirent;
64struct perf_event_attr; 64struct perf_event_attr;
65struct file_handle;
65 66
66#include <linux/types.h> 67#include <linux/types.h>
67#include <linux/aio_abi.h> 68#include <linux/aio_abi.h>
@@ -132,11 +133,11 @@ extern struct trace_event_functions exit_syscall_print_funcs;
132 .class = &event_class_syscall_enter, \ 133 .class = &event_class_syscall_enter, \
133 .event.funcs = &enter_syscall_print_funcs, \ 134 .event.funcs = &enter_syscall_print_funcs, \
134 .data = (void *)&__syscall_meta_##sname,\ 135 .data = (void *)&__syscall_meta_##sname,\
136 .flags = TRACE_EVENT_FL_CAP_ANY, \
135 }; \ 137 }; \
136 static struct ftrace_event_call __used \ 138 static struct ftrace_event_call __used \
137 __attribute__((section("_ftrace_events"))) \ 139 __attribute__((section("_ftrace_events"))) \
138 *__event_enter_##sname = &event_enter_##sname; \ 140 *__event_enter_##sname = &event_enter_##sname;
139 __TRACE_EVENT_FLAGS(enter_##sname, TRACE_EVENT_FL_CAP_ANY)
140 141
141#define SYSCALL_TRACE_EXIT_EVENT(sname) \ 142#define SYSCALL_TRACE_EXIT_EVENT(sname) \
142 static struct syscall_metadata __syscall_meta_##sname; \ 143 static struct syscall_metadata __syscall_meta_##sname; \
@@ -146,11 +147,11 @@ extern struct trace_event_functions exit_syscall_print_funcs;
146 .class = &event_class_syscall_exit, \ 147 .class = &event_class_syscall_exit, \
147 .event.funcs = &exit_syscall_print_funcs, \ 148 .event.funcs = &exit_syscall_print_funcs, \
148 .data = (void *)&__syscall_meta_##sname,\ 149 .data = (void *)&__syscall_meta_##sname,\
150 .flags = TRACE_EVENT_FL_CAP_ANY, \
149 }; \ 151 }; \
150 static struct ftrace_event_call __used \ 152 static struct ftrace_event_call __used \
151 __attribute__((section("_ftrace_events"))) \ 153 __attribute__((section("_ftrace_events"))) \
152 *__event_exit_##sname = &event_exit_##sname; \ 154 *__event_exit_##sname = &event_exit_##sname;
153 __TRACE_EVENT_FLAGS(exit_##sname, TRACE_EVENT_FL_CAP_ANY)
154 155
155#define SYSCALL_METADATA(sname, nb) \ 156#define SYSCALL_METADATA(sname, nb) \
156 SYSCALL_TRACE_ENTER_EVENT(sname); \ 157 SYSCALL_TRACE_ENTER_EVENT(sname); \
@@ -158,6 +159,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
158 static struct syscall_metadata __used \ 159 static struct syscall_metadata __used \
159 __syscall_meta_##sname = { \ 160 __syscall_meta_##sname = { \
160 .name = "sys"#sname, \ 161 .name = "sys"#sname, \
162 .syscall_nr = -1, /* Filled in at boot */ \
161 .nb_args = nb, \ 163 .nb_args = nb, \
162 .types = types_##sname, \ 164 .types = types_##sname, \
163 .args = args_##sname, \ 165 .args = args_##sname, \
@@ -175,6 +177,7 @@ extern struct trace_event_functions exit_syscall_print_funcs;
175 static struct syscall_metadata __used \ 177 static struct syscall_metadata __used \
176 __syscall_meta__##sname = { \ 178 __syscall_meta__##sname = { \
177 .name = "sys_"#sname, \ 179 .name = "sys_"#sname, \
180 .syscall_nr = -1, /* Filled in at boot */ \
178 .nb_args = 0, \ 181 .nb_args = 0, \
179 .enter_event = &event_enter__##sname, \ 182 .enter_event = &event_enter__##sname, \
180 .exit_event = &event_exit__##sname, \ 183 .exit_event = &event_exit__##sname, \
@@ -313,6 +316,8 @@ asmlinkage long sys_clock_settime(clockid_t which_clock,
313 const struct timespec __user *tp); 316 const struct timespec __user *tp);
314asmlinkage long sys_clock_gettime(clockid_t which_clock, 317asmlinkage long sys_clock_gettime(clockid_t which_clock,
315 struct timespec __user *tp); 318 struct timespec __user *tp);
319asmlinkage long sys_clock_adjtime(clockid_t which_clock,
320 struct timex __user *tx);
316asmlinkage long sys_clock_getres(clockid_t which_clock, 321asmlinkage long sys_clock_getres(clockid_t which_clock,
317 struct timespec __user *tp); 322 struct timespec __user *tp);
318asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags, 323asmlinkage long sys_clock_nanosleep(clockid_t which_clock, int flags,
@@ -820,6 +825,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags
820asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags, 825asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
821 u64 mask, int fd, 826 u64 mask, int fd,
822 const char __user *pathname); 827 const char __user *pathname);
828asmlinkage long sys_syncfs(int fd);
823 829
824int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 830int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
825 831
@@ -832,5 +838,10 @@ asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
832 unsigned long prot, unsigned long flags, 838 unsigned long prot, unsigned long flags,
833 unsigned long fd, unsigned long pgoff); 839 unsigned long fd, unsigned long pgoff);
834asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); 840asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg);
835 841asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name,
842 struct file_handle __user *handle,
843 int __user *mnt_id, int flag);
844asmlinkage long sys_open_by_handle_at(int mountdirfd,
845 struct file_handle __user *handle,
846 int flags);
836#endif 847#endif
diff --git a/include/linux/syscore_ops.h b/include/linux/syscore_ops.h
new file mode 100644
index 000000000000..27b3b0bc41a9
--- /dev/null
+++ b/include/linux/syscore_ops.h
@@ -0,0 +1,29 @@
1/*
2 * syscore_ops.h - System core operations.
3 *
4 * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
5 *
6 * This file is released under the GPLv2.
7 */
8
9#ifndef _LINUX_SYSCORE_OPS_H
10#define _LINUX_SYSCORE_OPS_H
11
12#include <linux/list.h>
13
14struct syscore_ops {
15 struct list_head node;
16 int (*suspend)(void);
17 void (*resume)(void);
18 void (*shutdown)(void);
19};
20
21extern void register_syscore_ops(struct syscore_ops *ops);
22extern void unregister_syscore_ops(struct syscore_ops *ops);
23#ifdef CONFIG_PM_SLEEP
24extern int syscore_suspend(void);
25extern void syscore_resume(void);
26#endif
27extern void syscore_shutdown(void);
28
29#endif
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 7bb5cb64f3b8..11684d9e6bd2 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -930,6 +930,7 @@ enum
930 930
931#ifdef __KERNEL__ 931#ifdef __KERNEL__
932#include <linux/list.h> 932#include <linux/list.h>
933#include <linux/rcupdate.h>
933 934
934/* For the /proc/sys support */ 935/* For the /proc/sys support */
935struct ctl_table; 936struct ctl_table;
@@ -1037,10 +1038,15 @@ struct ctl_table_root {
1037 struct ctl_table trees. */ 1038 struct ctl_table trees. */
1038struct ctl_table_header 1039struct ctl_table_header
1039{ 1040{
1040 struct ctl_table *ctl_table; 1041 union {
1041 struct list_head ctl_entry; 1042 struct {
1042 int used; 1043 struct ctl_table *ctl_table;
1043 int count; 1044 struct list_head ctl_entry;
1045 int used;
1046 int count;
1047 };
1048 struct rcu_head rcu;
1049 };
1044 struct completion *unregistering; 1050 struct completion *unregistering;
1045 struct ctl_table *ctl_table_arg; 1051 struct ctl_table *ctl_table_arg;
1046 struct ctl_table_root *root; 1052 struct ctl_table_root *root;
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 1154c29f4101..8a75da551e4e 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -33,12 +33,13 @@ struct sysdev_class {
33 const char *name; 33 const char *name;
34 struct list_head drivers; 34 struct list_head drivers;
35 struct sysdev_class_attribute **attrs; 35 struct sysdev_class_attribute **attrs;
36 36 struct kset kset;
37#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
37 /* Default operations for these types of devices */ 38 /* Default operations for these types of devices */
38 int (*shutdown)(struct sys_device *); 39 int (*shutdown)(struct sys_device *);
39 int (*suspend)(struct sys_device *, pm_message_t state); 40 int (*suspend)(struct sys_device *, pm_message_t state);
40 int (*resume)(struct sys_device *); 41 int (*resume)(struct sys_device *);
41 struct kset kset; 42#endif
42}; 43};
43 44
44struct sysdev_class_attribute { 45struct sysdev_class_attribute {
@@ -76,9 +77,11 @@ struct sysdev_driver {
76 struct list_head entry; 77 struct list_head entry;
77 int (*add)(struct sys_device *); 78 int (*add)(struct sys_device *);
78 int (*remove)(struct sys_device *); 79 int (*remove)(struct sys_device *);
80#ifndef CONFIG_ARCH_NO_SYSDEV_OPS
79 int (*shutdown)(struct sys_device *); 81 int (*shutdown)(struct sys_device *);
80 int (*suspend)(struct sys_device *, pm_message_t state); 82 int (*suspend)(struct sys_device *, pm_message_t state);
81 int (*resume)(struct sys_device *); 83 int (*resume)(struct sys_device *);
84#endif
82}; 85};
83 86
84 87
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index c90696544176..20fc303947d3 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -18,9 +18,6 @@ struct compat_timespec;
18struct restart_block { 18struct restart_block {
19 long (*fn)(struct restart_block *); 19 long (*fn)(struct restart_block *);
20 union { 20 union {
21 struct {
22 unsigned long arg0, arg1, arg2, arg3;
23 };
24 /* For futex_wait and futex_wait_requeue_pi */ 21 /* For futex_wait and futex_wait_requeue_pi */
25 struct { 22 struct {
26 u32 __user *uaddr; 23 u32 __user *uaddr;
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 4c7be2263011..7071ec5d0118 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -26,15 +26,6 @@
26#define TI_WILINK_ST_H 26#define TI_WILINK_ST_H
27 27
28/** 28/**
29 * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW
30 * gpio states for their chip/core enable gpios
31 */
32enum kim_gpio_state {
33 KIM_GPIO_INACTIVE,
34 KIM_GPIO_ACTIVE,
35};
36
37/**
38 * enum proto-type - The protocol on WiLink chips which share a 29 * enum proto-type - The protocol on WiLink chips which share a
39 * common physical interface like UART. 30 * common physical interface like UART.
40 */ 31 */
@@ -42,7 +33,7 @@ enum proto_type {
42 ST_BT, 33 ST_BT,
43 ST_FM, 34 ST_FM,
44 ST_GPS, 35 ST_GPS,
45 ST_MAX, 36 ST_MAX_CHANNELS = 16,
46}; 37};
47 38
48/** 39/**
@@ -62,6 +53,17 @@ enum proto_type {
62 * @priv_data: privdate data holder for the protocol drivers, sent 53 * @priv_data: privdate data holder for the protocol drivers, sent
63 * from the protocol drivers during registration, and sent back on 54 * from the protocol drivers during registration, and sent back on
64 * reg_complete_cb and recv. 55 * reg_complete_cb and recv.
56 * @chnl_id: channel id the protocol driver is interested in, the channel
57 * id is nothing but the 1st byte of the packet in UART frame.
58 * @max_frame_size: size of the largest frame the protocol can receive.
59 * @hdr_len: length of the header structure of the protocol.
60 * @offset_len_in_hdr: this provides the offset of the length field in the
61 * header structure of the protocol header, to assist ST to know
62 * how much to receive, if the data is split across UART frames.
63 * @len_size: whether the length field inside the header is 2 bytes
64 * or 1 byte.
65 * @reserve: the number of bytes ST needs to reserve in the skb being
66 * prepared for the protocol driver.
65 */ 67 */
66struct st_proto_s { 68struct st_proto_s {
67 enum proto_type type; 69 enum proto_type type;
@@ -70,10 +72,17 @@ struct st_proto_s {
70 void (*reg_complete_cb) (void *, char data); 72 void (*reg_complete_cb) (void *, char data);
71 long (*write) (struct sk_buff *skb); 73 long (*write) (struct sk_buff *skb);
72 void *priv_data; 74 void *priv_data;
75
76 unsigned char chnl_id;
77 unsigned short max_frame_size;
78 unsigned char hdr_len;
79 unsigned char offset_len_in_hdr;
80 unsigned char len_size;
81 unsigned char reserve;
73}; 82};
74 83
75extern long st_register(struct st_proto_s *); 84extern long st_register(struct st_proto_s *);
76extern long st_unregister(enum proto_type); 85extern long st_unregister(struct st_proto_s *);
77 86
78 87
79/* 88/*
@@ -114,6 +123,7 @@ extern long st_unregister(enum proto_type);
114 * @rx_skb: the skb where all data for a protocol gets accumulated, 123 * @rx_skb: the skb where all data for a protocol gets accumulated,
115 * since tty might not call receive when a complete event packet 124 * since tty might not call receive when a complete event packet
116 * is received, the states, count and the skb needs to be maintained. 125 * is received, the states, count and the skb needs to be maintained.
126 * @rx_chnl: the channel ID for which the data is getting accumalated for.
117 * @txq: the list of skbs which needs to be sent onto the TTY. 127 * @txq: the list of skbs which needs to be sent onto the TTY.
118 * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued 128 * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued
119 * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs 129 * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs
@@ -135,10 +145,11 @@ struct st_data_s {
135#define ST_TX_SENDING 1 145#define ST_TX_SENDING 1
136#define ST_TX_WAKEUP 2 146#define ST_TX_WAKEUP 2
137 unsigned long tx_state; 147 unsigned long tx_state;
138 struct st_proto_s *list[ST_MAX]; 148 struct st_proto_s *list[ST_MAX_CHANNELS];
139 unsigned long rx_state; 149 unsigned long rx_state;
140 unsigned long rx_count; 150 unsigned long rx_count;
141 struct sk_buff *rx_skb; 151 struct sk_buff *rx_skb;
152 unsigned char rx_chnl;
142 struct sk_buff_head txq, tx_waitq; 153 struct sk_buff_head txq, tx_waitq;
143 spinlock_t lock; 154 spinlock_t lock;
144 unsigned char protos_registered; 155 unsigned char protos_registered;
@@ -146,6 +157,11 @@ struct st_data_s {
146 void *kim_data; 157 void *kim_data;
147}; 158};
148 159
160/*
161 * wrapper around tty->ops->write_room to check
162 * availability during firmware download
163 */
164int st_get_uart_wr_room(struct st_data_s *st_gdata);
149/** 165/**
150 * st_int_write - 166 * st_int_write -
151 * point this to tty->driver->write or tty->ops->write 167 * point this to tty->driver->write or tty->ops->write
@@ -186,8 +202,9 @@ void gps_chrdrv_stub_init(void);
186/* time in msec to wait for 202/* time in msec to wait for
187 * line discipline to be installed 203 * line discipline to be installed
188 */ 204 */
189#define LDISC_TIME 500 205#define LDISC_TIME 1000
190#define CMD_RESP_TIME 500 206#define CMD_RESP_TIME 800
207#define CMD_WR_TIME 5000
191#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ 208#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \
192 | ((unsigned short)((unsigned char)(b))) << 8)) 209 | ((unsigned short)((unsigned char)(b))) << 8))
193 210
@@ -210,6 +227,7 @@ struct chip_version {
210 unsigned short maj_ver; 227 unsigned short maj_ver;
211}; 228};
212 229
230#define UART_DEV_NAME_LEN 32
213/** 231/**
214 * struct kim_data_s - the KIM internal data, embedded as the 232 * struct kim_data_s - the KIM internal data, embedded as the
215 * platform's drv data. One for each ST device in the system. 233 * platform's drv data. One for each ST device in the system.
@@ -225,14 +243,11 @@ struct chip_version {
225 * the ldisc was properly installed. 243 * the ldisc was properly installed.
226 * @resp_buffer: data buffer for the .bts fw file name. 244 * @resp_buffer: data buffer for the .bts fw file name.
227 * @fw_entry: firmware class struct to request/release the fw. 245 * @fw_entry: firmware class struct to request/release the fw.
228 * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores.
229 * @rx_state: the rx state for kim's receive func during fw download. 246 * @rx_state: the rx state for kim's receive func during fw download.
230 * @rx_count: the rx count for the kim's receive func during fw download. 247 * @rx_count: the rx count for the kim's receive func during fw download.
231 * @rx_skb: all of fw data might not come at once, and hence data storage for 248 * @rx_skb: all of fw data might not come at once, and hence data storage for
232 * whole of the fw response, only HCI_EVENTs and hence diff from ST's 249 * whole of the fw response, only HCI_EVENTs and hence diff from ST's
233 * response. 250 * response.
234 * @rfkill: rfkill data for each of the cores to be registered with rfkill.
235 * @rf_protos: proto types of the data registered with rfkill sub-system.
236 * @core_data: ST core's data, which mainly is the tty's disc_data 251 * @core_data: ST core's data, which mainly is the tty's disc_data
237 * @version: chip version available via a sysfs entry. 252 * @version: chip version available via a sysfs entry.
238 * 253 *
@@ -243,14 +258,16 @@ struct kim_data_s {
243 struct completion kim_rcvd, ldisc_installed; 258 struct completion kim_rcvd, ldisc_installed;
244 char resp_buffer[30]; 259 char resp_buffer[30];
245 const struct firmware *fw_entry; 260 const struct firmware *fw_entry;
246 long gpios[ST_MAX]; 261 long nshutdown;
247 unsigned long rx_state; 262 unsigned long rx_state;
248 unsigned long rx_count; 263 unsigned long rx_count;
249 struct sk_buff *rx_skb; 264 struct sk_buff *rx_skb;
250 struct rfkill *rfkill[ST_MAX];
251 enum proto_type rf_protos[ST_MAX];
252 struct st_data_s *core_data; 265 struct st_data_s *core_data;
253 struct chip_version version; 266 struct chip_version version;
267 unsigned char ldisc_install;
268 unsigned char dev_name[UART_DEV_NAME_LEN];
269 unsigned char flow_cntrl;
270 unsigned long baud_rate;
254}; 271};
255 272
256/** 273/**
@@ -262,7 +279,6 @@ long st_kim_start(void *);
262long st_kim_stop(void *); 279long st_kim_stop(void *);
263 280
264void st_kim_recv(void *, const unsigned char *, long count); 281void st_kim_recv(void *, const unsigned char *, long count);
265void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state);
266void st_kim_complete(void *); 282void st_kim_complete(void *);
267void kim_st_list_protocols(struct st_data_s *, void *); 283void kim_st_list_protocols(struct st_data_s *, void *);
268 284
@@ -338,12 +354,8 @@ struct hci_command {
338 354
339/* ST LL receiver states */ 355/* ST LL receiver states */
340#define ST_W4_PACKET_TYPE 0 356#define ST_W4_PACKET_TYPE 0
341#define ST_BT_W4_EVENT_HDR 1 357#define ST_W4_HEADER 1
342#define ST_BT_W4_ACL_HDR 2 358#define ST_W4_DATA 2
343#define ST_BT_W4_SCO_HDR 3
344#define ST_BT_W4_DATA 4
345#define ST_FM_W4_EVENT_HDR 5
346#define ST_GPS_W4_EVENT_HDR 6
347 359
348/* ST LL state machines */ 360/* ST LL state machines */
349#define ST_LL_ASLEEP 0 361#define ST_LL_ASLEEP 0
@@ -397,4 +409,14 @@ struct gps_event_hdr {
397 u16 plen; 409 u16 plen;
398} __attribute__ ((packed)); 410} __attribute__ ((packed));
399 411
412/* platform data */
413struct ti_st_plat_data {
414 long nshutdown_gpio;
415 unsigned char dev_name[UART_DEV_NAME_LEN]; /* uart name */
416 unsigned char flow_cntrl; /* flow control flag */
417 unsigned long baud_rate;
418 int (*suspend)(struct platform_device *, pm_message_t);
419 int (*resume)(struct platform_device *);
420};
421
400#endif /* TI_WILINK_ST_H */ 422#endif /* TI_WILINK_ST_H */
diff --git a/include/linux/time.h b/include/linux/time.h
index 1e6d3b59238d..454a26205787 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,8 +113,6 @@ static inline struct timespec timespec_sub(struct timespec lhs,
113#define timespec_valid(ts) \ 113#define timespec_valid(ts) \
114 (((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))
115 115
116extern seqlock_t xtime_lock;
117
118extern void read_persistent_clock(struct timespec *ts); 116extern void read_persistent_clock(struct timespec *ts);
119extern void read_boot_clock(struct timespec *ts); 117extern void read_boot_clock(struct timespec *ts);
120extern int update_persistent_clock(struct timespec now); 118extern int update_persistent_clock(struct timespec now);
@@ -125,8 +123,9 @@ extern int timekeeping_suspended;
125unsigned long get_seconds(void); 123unsigned long get_seconds(void);
126struct timespec current_kernel_time(void); 124struct timespec current_kernel_time(void);
127struct timespec __current_kernel_time(void); /* does not take xtime_lock */ 125struct timespec __current_kernel_time(void); /* does not take xtime_lock */
128struct timespec __get_wall_to_monotonic(void); /* does not take xtime_lock */
129struct timespec get_monotonic_coarse(void); 126struct timespec get_monotonic_coarse(void);
127void get_xtime_and_monotonic_and_sleep_offset(struct timespec *xtim,
128 struct timespec *wtom, struct timespec *sleep);
130 129
131#define CURRENT_TIME (current_kernel_time()) 130#define CURRENT_TIME (current_kernel_time())
132#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 131#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
@@ -147,8 +146,9 @@ static inline u32 arch_gettimeoffset(void) { return 0; }
147#endif 146#endif
148 147
149extern void do_gettimeofday(struct timeval *tv); 148extern void do_gettimeofday(struct timeval *tv);
150extern int do_settimeofday(struct timespec *tv); 149extern int do_settimeofday(const struct timespec *tv);
151extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 150extern int do_sys_settimeofday(const struct timespec *tv,
151 const struct timezone *tz);
152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 152#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); 153extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
154struct itimerval; 154struct itimerval;
@@ -162,12 +162,13 @@ extern void getnstime_raw_and_real(struct timespec *ts_raw,
162 struct timespec *ts_real); 162 struct timespec *ts_real);
163extern void getboottime(struct timespec *ts); 163extern void getboottime(struct timespec *ts);
164extern void monotonic_to_bootbased(struct timespec *ts); 164extern void monotonic_to_bootbased(struct timespec *ts);
165extern void get_monotonic_boottime(struct timespec *ts);
165 166
166extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 167extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
167extern int timekeeping_valid_for_hres(void); 168extern int timekeeping_valid_for_hres(void);
168extern u64 timekeeping_max_deferment(void); 169extern u64 timekeeping_max_deferment(void);
169extern void update_wall_time(void);
170extern void timekeeping_leap_insert(int leapsecond); 170extern void timekeeping_leap_insert(int leapsecond);
171extern int timekeeping_inject_offset(struct timespec *ts);
171 172
172struct tms; 173struct tms;
173extern void do_sys_times(struct tms *); 174extern void do_sys_times(struct tms *);
@@ -292,6 +293,7 @@ struct itimerval {
292#define CLOCK_MONOTONIC_RAW 4 293#define CLOCK_MONOTONIC_RAW 4
293#define CLOCK_REALTIME_COARSE 5 294#define CLOCK_REALTIME_COARSE 5
294#define CLOCK_MONOTONIC_COARSE 6 295#define CLOCK_MONOTONIC_COARSE 6
296#define CLOCK_BOOTTIME 7
295 297
296/* 298/*
297 * The IDs of various hardware clocks: 299 * The IDs of various hardware clocks:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index d23999f9499d..aa60fe7b6ed6 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -73,7 +73,7 @@ struct timex {
73 long tolerance; /* clock frequency tolerance (ppm) 73 long tolerance; /* clock frequency tolerance (ppm)
74 * (read only) 74 * (read only)
75 */ 75 */
76 struct timeval time; /* (read only) */ 76 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
77 long tick; /* (modified) usecs between clock ticks */ 77 long tick; /* (modified) usecs between clock ticks */
78 78
79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */ 79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
@@ -102,6 +102,7 @@ struct timex {
102#define ADJ_STATUS 0x0010 /* clock status */ 102#define ADJ_STATUS 0x0010 /* clock status */
103#define ADJ_TIMECONST 0x0020 /* pll time constant */ 103#define ADJ_TIMECONST 0x0020 /* pll time constant */
104#define ADJ_TAI 0x0080 /* set TAI offset */ 104#define ADJ_TAI 0x0080 /* set TAI offset */
105#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
105#define ADJ_MICRO 0x1000 /* select microsecond resolution */ 106#define ADJ_MICRO 0x1000 /* select microsecond resolution */
106#define ADJ_NANO 0x2000 /* select nanosecond resolution */ 107#define ADJ_NANO 0x2000 /* select nanosecond resolution */
107#define ADJ_TICK 0x4000 /* tick value */ 108#define ADJ_TICK 0x4000 /* tick value */
diff --git a/include/linux/tipc.h b/include/linux/tipc.h
index 1eefa3f6d1f4..a5b994a204d2 100644
--- a/include/linux/tipc.h
+++ b/include/linux/tipc.h
@@ -2,7 +2,7 @@
2 * include/linux/tipc.h: Include file for TIPC socket interface 2 * include/linux/tipc.h: Include file for TIPC socket interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005, Wind River Systems 5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -130,12 +130,6 @@ static inline unsigned int tipc_node(__u32 addr)
130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */ 130#define TIPC_SUB_PORTS 0x01 /* filter for port availability */
131#define TIPC_SUB_SERVICE 0x02 /* filter for service availability */ 131#define TIPC_SUB_SERVICE 0x02 /* filter for service 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
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index 7d42460a5e3c..0db239590b4d 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -2,7 +2,7 @@
2 * include/linux/tipc_config.h: Include file for TIPC configuration interface 2 * include/linux/tipc_config.h: Include file for TIPC configuration interface
3 * 3 *
4 * Copyright (c) 2003-2006, Ericsson AB 4 * Copyright (c) 2003-2006, Ericsson AB
5 * Copyright (c) 2005-2007, Wind River Systems 5 * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
@@ -76,13 +76,6 @@
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#define TIPC_CMD_SHOW_STATS 0x000F /* tx unsigned, rx ultra_string */
78 78
79#if 0
80#define TIPC_CMD_SHOW_PORT_STATS 0x0008 /* tx port_ref, rx ultra_string */
81#define TIPC_CMD_RESET_PORT_STATS 0x0009 /* tx port_ref, rx none */
82#define TIPC_CMD_GET_ROUTES 0x000A /* tx ?, rx ? */
83#define TIPC_CMD_GET_LINK_PEER 0x000D /* tx link_name, rx ? */
84#endif
85
86/* 79/*
87 * Protected commands: 80 * Protected commands:
88 * May only be issued by "network administration capable" process. 81 * May only be issued by "network administration capable" process.
@@ -96,7 +89,7 @@
96#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 89#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */
97#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ 90#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
98#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ 91#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
99#define TIPC_CMD_GET_MAX_NODES 0x4009 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
100#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */ 93#define TIPC_CMD_GET_MAX_SLAVES 0x400A /* obsoleted */
101#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */ 94#define TIPC_CMD_GET_NETID 0x400B /* tx none, rx unsigned */
102 95
@@ -109,13 +102,6 @@
109#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */ 102#define TIPC_CMD_DUMP_LOG 0x410B /* tx none, rx ultra_string */
110#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */ 103#define TIPC_CMD_RESET_LINK_STATS 0x410C /* tx link_name, rx none */
111 104
112#if 0
113#define TIPC_CMD_CREATE_LINK 0x4103 /* tx link_create, rx none */
114#define TIPC_CMD_REMOVE_LINK 0x4104 /* tx link_name, rx none */
115#define TIPC_CMD_BLOCK_LINK 0x4105 /* tx link_name, rx none */
116#define TIPC_CMD_UNBLOCK_LINK 0x4106 /* tx link_name, rx none */
117#endif
118
119/* 105/*
120 * Private commands: 106 * Private commands:
121 * May only be issued by "network administration capable" process. 107 * May only be issued by "network administration capable" process.
@@ -123,16 +109,13 @@
123 */ 109 */
124 110
125#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 111#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
126#if 0
127#define TIPC_CMD_SET_ZONE_MASTER 0x8002 /* tx none, rx none */
128#endif
129#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 112#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
130#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 113#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
131#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 114#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */
132#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 115#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */
133#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ 116#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
134#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ 117#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
135#define TIPC_CMD_SET_MAX_NODES 0x8009 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
136#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */ 119#define TIPC_CMD_SET_MAX_SLAVES 0x800A /* obsoleted */
137#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */ 120#define TIPC_CMD_SET_NETID 0x800B /* tx unsigned, rx none */
138 121
@@ -193,6 +176,10 @@
193#define TIPC_DEF_LINK_TOL 1500 176#define TIPC_DEF_LINK_TOL 1500
194#define TIPC_MAX_LINK_TOL 30000 177#define TIPC_MAX_LINK_TOL 30000
195 178
179#if (TIPC_MIN_LINK_TOL < 16)
180#error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)"
181#endif
182
196/* 183/*
197 * Link window limits (min, default, max), in packets 184 * Link window limits (min, default, max), in packets
198 */ 185 */
@@ -215,7 +202,7 @@ struct tipc_link_info {
215 202
216struct tipc_bearer_config { 203struct tipc_bearer_config {
217 __be32 priority; /* Range [1,31]. Override per link */ 204 __be32 priority; /* Range [1,31]. Override per link */
218 __be32 detect_scope; 205 __be32 disc_domain; /* <Z.C.N> describing desired nodes */
219 char name[TIPC_MAX_BEARER_NAME]; 206 char name[TIPC_MAX_BEARER_NAME];
220}; 207};
221 208
@@ -247,15 +234,6 @@ struct tipc_name_table_query {
247#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */ 234#define TIPC_CFG_NOT_SUPPORTED "\x84" /* request is not supported by TIPC */
248#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */ 235#define TIPC_CFG_INVALID_VALUE "\x85" /* request has invalid argument value */
249 236
250#if 0
251/* prototypes TLV structures for proposed commands */
252struct tipc_link_create {
253 __u32 domain;
254 struct tipc_media_addr peer_addr;
255 char bearer_name[TIPC_MAX_BEARER_NAME];
256};
257#endif
258
259/* 237/*
260 * A TLV consists of a descriptor, followed by the TLV value. 238 * A TLV consists of a descriptor, followed by the TLV value.
261 * TLV descriptor fields are stored in network byte order; 239 * TLV descriptor fields are stored in network byte order;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 54e4eaaa0561..9f469c700550 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -82,7 +82,7 @@ struct tty_buffer {
82 82
83 83
84struct tty_bufhead { 84struct tty_bufhead {
85 struct delayed_work work; 85 struct work_struct work;
86 spinlock_t lock; 86 spinlock_t lock;
87 struct tty_buffer *head; /* Queue head */ 87 struct tty_buffer *head; /* Queue head */
88 struct tty_buffer *tail; /* Active buffer */ 88 struct tty_buffer *tail; /* Active buffer */
@@ -448,6 +448,7 @@ extern void tty_encode_baud_rate(struct tty_struct *tty,
448 speed_t ibaud, speed_t obaud); 448 speed_t ibaud, speed_t obaud);
449extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 449extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
450extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b); 450extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
451extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
451 452
452extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 453extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
453extern void tty_ldisc_deref(struct tty_ldisc *); 454extern void tty_ldisc_deref(struct tty_ldisc *);
@@ -584,10 +585,10 @@ extern int pcxe_open(struct tty_struct *tty, struct file *filp);
584 585
585/* vt.c */ 586/* vt.c */
586 587
587extern int vt_ioctl(struct tty_struct *tty, struct file *file, 588extern int vt_ioctl(struct tty_struct *tty,
588 unsigned int cmd, unsigned long arg); 589 unsigned int cmd, unsigned long arg);
589 590
590extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, 591extern long vt_compat_ioctl(struct tty_struct *tty,
591 unsigned int cmd, unsigned long arg); 592 unsigned int cmd, unsigned long arg);
592 593
593/* tty_mutex.c */ 594/* tty_mutex.c */
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index c3d43eb4150c..9deeac855240 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -98,8 +98,7 @@
98 * 98 *
99 * Note: Do not call this function directly, call tty_write_room 99 * Note: Do not call this function directly, call tty_write_room
100 * 100 *
101 * int (*ioctl)(struct tty_struct *tty, struct file * file, 101 * int (*ioctl)(struct tty_struct *tty, unsigned int cmd, unsigned long arg);
102 * unsigned int cmd, unsigned long arg);
103 * 102 *
104 * This routine allows the tty driver to implement 103 * This routine allows the tty driver to implement
105 * device-specific ioctls. If the ioctl number passed in cmd 104 * device-specific ioctls. If the ioctl number passed in cmd
@@ -107,7 +106,7 @@
107 * 106 *
108 * Optional 107 * Optional
109 * 108 *
110 * long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 109 * long (*compat_ioctl)(struct tty_struct *tty,,
111 * unsigned int cmd, unsigned long arg); 110 * unsigned int cmd, unsigned long arg);
112 * 111 *
113 * implement ioctl processing for 32 bit process on 64 bit system 112 * implement ioctl processing for 32 bit process on 64 bit system
@@ -256,9 +255,9 @@ struct tty_operations {
256 void (*flush_chars)(struct tty_struct *tty); 255 void (*flush_chars)(struct tty_struct *tty);
257 int (*write_room)(struct tty_struct *tty); 256 int (*write_room)(struct tty_struct *tty);
258 int (*chars_in_buffer)(struct tty_struct *tty); 257 int (*chars_in_buffer)(struct tty_struct *tty);
259 int (*ioctl)(struct tty_struct *tty, struct file * file, 258 int (*ioctl)(struct tty_struct *tty,
260 unsigned int cmd, unsigned long arg); 259 unsigned int cmd, unsigned long arg);
261 long (*compat_ioctl)(struct tty_struct *tty, struct file * file, 260 long (*compat_ioctl)(struct tty_struct *tty,
262 unsigned int cmd, unsigned long arg); 261 unsigned int cmd, unsigned long arg);
263 void (*set_termios)(struct tty_struct *tty, struct ktermios * old); 262 void (*set_termios)(struct tty_struct *tty, struct ktermios * old);
264 void (*throttle)(struct tty_struct * tty); 263 void (*throttle)(struct tty_struct * tty);
@@ -271,8 +270,8 @@ struct tty_operations {
271 void (*set_ldisc)(struct tty_struct *tty); 270 void (*set_ldisc)(struct tty_struct *tty);
272 void (*wait_until_sent)(struct tty_struct *tty, int timeout); 271 void (*wait_until_sent)(struct tty_struct *tty, int timeout);
273 void (*send_xchar)(struct tty_struct *tty, char ch); 272 void (*send_xchar)(struct tty_struct *tty, char ch);
274 int (*tiocmget)(struct tty_struct *tty, struct file *file); 273 int (*tiocmget)(struct tty_struct *tty);
275 int (*tiocmset)(struct tty_struct *tty, struct file *file, 274 int (*tiocmset)(struct tty_struct *tty,
276 unsigned int set, unsigned int clear); 275 unsigned int set, unsigned int clear);
277 int (*resize)(struct tty_struct *tty, struct winsize *ws); 276 int (*resize)(struct tty_struct *tty, struct winsize *ws);
278 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); 277 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
diff --git a/include/linux/types.h b/include/linux/types.h
index c2a9eb44f2fa..176da8c1fbb1 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -150,6 +150,12 @@ typedef unsigned long blkcnt_t;
150#define pgoff_t unsigned long 150#define pgoff_t unsigned long
151#endif 151#endif
152 152
153#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
154typedef u64 dma_addr_t;
155#else
156typedef u32 dma_addr_t;
157#endif /* dma_addr_t */
158
153#endif /* __KERNEL__ */ 159#endif /* __KERNEL__ */
154 160
155/* 161/*
diff --git a/include/linux/usb.h b/include/linux/usb.h
index bd69b65f3356..e63efeb378e3 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -976,6 +976,7 @@ extern int usb_disabled(void);
976#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ 976#define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */
977#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ 977#define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */
978#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ 978#define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */
979#define URB_ALIGNED_TEMP_BUFFER 0x00800000 /* Temp buffer was alloc'd */
979 980
980struct usb_iso_packet_descriptor { 981struct usb_iso_packet_descriptor {
981 unsigned int offset; 982 unsigned int offset;
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 51410e0200cf..ed91fb62674b 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -2,6 +2,7 @@ header-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 += ch11.h
5header-y += functionfs.h
5header-y += gadgetfs.h 6header-y += gadgetfs.h
6header-y += midi.h 7header-y += midi.h
7header-y += g_printer.h 8header-y += g_printer.h
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 10ec0699bea4..4ebaf0824179 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,6 +26,7 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
29 30
30/* 31/*
31 * Hub class additional requests defined by USB 3.0 spec 32 * Hub class additional requests defined by USB 3.0 spec
@@ -61,6 +62,12 @@
61#define USB_PORT_FEAT_TEST 21 62#define USB_PORT_FEAT_TEST 21
62#define USB_PORT_FEAT_INDICATOR 22 63#define USB_PORT_FEAT_INDICATOR 22
63#define USB_PORT_FEAT_C_PORT_L1 23 64#define USB_PORT_FEAT_C_PORT_L1 23
65#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
66#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
67#define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27
68#define USB_PORT_FEAT_BH_PORT_RESET 28
69#define USB_PORT_FEAT_C_BH_PORT_RESET 29
70#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
64 71
65/* 72/*
66 * Port feature selectors added by USB 3.0 spec. 73 * Port feature selectors added by USB 3.0 spec.
@@ -102,7 +109,6 @@ struct usb_port_status {
102#define USB_PORT_STAT_TEST 0x0800 109#define USB_PORT_STAT_TEST 0x0800
103#define USB_PORT_STAT_INDICATOR 0x1000 110#define USB_PORT_STAT_INDICATOR 0x1000
104/* bits 13 to 15 are reserved */ 111/* bits 13 to 15 are reserved */
105#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */
106 112
107/* 113/*
108 * Additions to wPortStatus bit field from USB 3.0 114 * Additions to wPortStatus bit field from USB 3.0
@@ -110,8 +116,14 @@ struct usb_port_status {
110 */ 116 */
111#define USB_PORT_STAT_LINK_STATE 0x01e0 117#define USB_PORT_STAT_LINK_STATE 0x01e0
112#define USB_SS_PORT_STAT_POWER 0x0200 118#define USB_SS_PORT_STAT_POWER 0x0200
119#define USB_SS_PORT_STAT_SPEED 0x1c00
113#define USB_PORT_STAT_SPEED_5GBPS 0x0000 120#define USB_PORT_STAT_SPEED_5GBPS 0x0000
114/* Valid only if port is enabled */ 121/* Valid only if port is enabled */
122/* Bits that are the same from USB 2.0 */
123#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
124 USB_PORT_STAT_ENABLE | \
125 USB_PORT_STAT_OVERCURRENT | \
126 USB_PORT_STAT_RESET)
115 127
116/* 128/*
117 * Definitions for PORT_LINK_STATE values 129 * Definitions for PORT_LINK_STATE values
@@ -132,8 +144,8 @@ struct usb_port_status {
132 144
133/* 145/*
134 * wPortChange bit field 146 * wPortChange bit field
135 * See USB 2.0 spec Table 11-22 147 * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
136 * Bits 0 to 4 shown, bits 5 to 15 are reserved 148 * Bits 0 to 5 shown, bits 6 to 15 are reserved
137 */ 149 */
138#define USB_PORT_STAT_C_CONNECTION 0x0001 150#define USB_PORT_STAT_C_CONNECTION 0x0001
139#define USB_PORT_STAT_C_ENABLE 0x0002 151#define USB_PORT_STAT_C_ENABLE 0x0002
@@ -141,6 +153,13 @@ struct usb_port_status {
141#define USB_PORT_STAT_C_OVERCURRENT 0x0008 153#define USB_PORT_STAT_C_OVERCURRENT 0x0008
142#define USB_PORT_STAT_C_RESET 0x0010 154#define USB_PORT_STAT_C_RESET 0x0010
143#define USB_PORT_STAT_C_L1 0x0020 155#define USB_PORT_STAT_C_L1 0x0020
156/*
157 * USB 3.0 wPortChange bit fields
158 * See USB 3.0 spec Table 10-11
159 */
160#define USB_PORT_STAT_C_BH_RESET 0x0020
161#define USB_PORT_STAT_C_LINK_STATE 0x0040
162#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
144 163
145/* 164/*
146 * wHubCharacteristics (masks) 165 * wHubCharacteristics (masks)
@@ -175,7 +194,9 @@ struct usb_hub_status {
175 */ 194 */
176 195
177#define USB_DT_HUB (USB_TYPE_CLASS | 0x09) 196#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
197#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
178#define USB_DT_HUB_NONVAR_SIZE 7 198#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12
179 200
180struct usb_hub_descriptor { 201struct usb_hub_descriptor {
181 __u8 bDescLength; 202 __u8 bDescLength;
@@ -184,11 +205,22 @@ struct usb_hub_descriptor {
184 __le16 wHubCharacteristics; 205 __le16 wHubCharacteristics;
185 __u8 bPwrOn2PwrGood; 206 __u8 bPwrOn2PwrGood;
186 __u8 bHubContrCurrent; 207 __u8 bHubContrCurrent;
187 /* add 1 bit for hub status change; round to bytes */
188 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
189 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
190} __attribute__ ((packed));
191 208
209 /* 2.0 and 3.0 hubs differ here */
210 union {
211 struct {
212 /* add 1 bit for hub status change; round to bytes */
213 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
214 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
215 } __attribute__ ((packed)) hs;
216
217 struct {
218 __u8 bHubHdrDecLat;
219 __u16 wHubDelay;
220 __u16 DeviceRemovable;
221 } __attribute__ ((packed)) ss;
222 } u;
223} __attribute__ ((packed));
192 224
193/* port indicator status selectors, tables 11-7 and 11-25 */ 225/* port indicator status selectors, tables 11-7 and 11-25 */
194#define HUB_LED_AUTO 0 226#define HUB_LED_AUTO 0
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index ab461948b579..b72f305ce6bd 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -584,7 +584,9 @@ struct usb_ss_ep_comp_descriptor {
584 584
585#define USB_DT_SS_EP_COMP_SIZE 6 585#define USB_DT_SS_EP_COMP_SIZE 6
586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
587#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f)) 587#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
588/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
589#define USB_SS_MULT(p) (1 + ((p) & 0x3))
588 590
589/*-------------------------------------------------------------------------*/ 591/*-------------------------------------------------------------------------*/
590 592
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 2e262cb15425..656380245198 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -127,7 +127,9 @@ struct ehci_regs {
127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
128#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 128#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
129/* 19:16 for port testing */ 129/* 19:16 for port testing */
130#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */ 130#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
131#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
132#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
131#define PORT_LED_OFF (0<<14) 133#define PORT_LED_OFF (0<<14)
132#define PORT_LED_AMBER (1<<14) 134#define PORT_LED_AMBER (1<<14)
133#define PORT_LED_GREEN (2<<14) 135#define PORT_LED_GREEN (2<<14)
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index a854fe89484e..0097136ba45d 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -76,6 +76,10 @@ struct usb_hcd {
76 struct kref kref; /* reference counter */ 76 struct kref kref; /* reference counter */
77 77
78 const char *product_desc; /* product/vendor string */ 78 const char *product_desc; /* product/vendor string */
79 int speed; /* Speed for this roothub.
80 * May be different from
81 * hcd->driver->flags & HCD_MASK
82 */
79 char irq_descr[24]; /* driver + bus # */ 83 char irq_descr[24]; /* driver + bus # */
80 84
81 struct timer_list rh_timer; /* drives root-hub polling */ 85 struct timer_list rh_timer; /* drives root-hub polling */
@@ -99,6 +103,8 @@ struct usb_hcd {
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
106#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
107#define HCD_FLAG_DEAD 6 /* controller has died? */
102 108
103 /* The flags can be tested using these macros; they are likely to 109 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit(). 110 * be slightly faster than test_bit().
@@ -108,6 +114,8 @@ struct usb_hcd {
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 114#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)) 115#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)) 116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
117#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
118#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
111 119
112 /* Flags that get set only during HCD registration or removal. */ 120 /* Flags that get set only during HCD registration or removal. */
113 unsigned rh_registered:1;/* is root hub registered? */ 121 unsigned rh_registered:1;/* is root hub registered? */
@@ -138,7 +146,9 @@ struct usb_hcd {
138 * bandwidth_mutex should be dropped after a successful control message 146 * bandwidth_mutex should be dropped after a successful control message
139 * to the device, or resetting the bandwidth after a failed attempt. 147 * to the device, or resetting the bandwidth after a failed attempt.
140 */ 148 */
141 struct mutex bandwidth_mutex; 149 struct mutex *bandwidth_mutex;
150 struct usb_hcd *shared_hcd;
151 struct usb_hcd *primary_hcd;
142 152
143 153
144#define HCD_BUFFER_POOLS 4 154#define HCD_BUFFER_POOLS 4
@@ -201,6 +211,7 @@ struct hc_driver {
201 int flags; 211 int flags;
202#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ 212#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
203#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ 213#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
214#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
204#define HCD_USB11 0x0010 /* USB 1.1 */ 215#define HCD_USB11 0x0010 /* USB 1.1 */
205#define HCD_USB2 0x0020 /* USB 2.0 */ 216#define HCD_USB2 0x0020 /* USB 2.0 */
206#define HCD_USB3 0x0040 /* USB 3.0 */ 217#define HCD_USB3 0x0040 /* USB 3.0 */
@@ -234,6 +245,19 @@ struct hc_driver {
234 int (*urb_dequeue)(struct usb_hcd *hcd, 245 int (*urb_dequeue)(struct usb_hcd *hcd,
235 struct urb *urb, int status); 246 struct urb *urb, int status);
236 247
248 /*
249 * (optional) these hooks allow an HCD to override the default DMA
250 * mapping and unmapping routines. In general, they shouldn't be
251 * necessary unless the host controller has special DMA requirements,
252 * such as alignment contraints. If these are not specified, the
253 * general usb_hcd_(un)?map_urb_for_dma functions will be used instead
254 * (and it may be a good idea to call these functions in your HCD
255 * implementation)
256 */
257 int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
258 gfp_t mem_flags);
259 void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
260
237 /* hw synch, freeing endpoint resources that urb_dequeue can't */ 261 /* hw synch, freeing endpoint resources that urb_dequeue can't */
238 void (*endpoint_disable)(struct usb_hcd *hcd, 262 void (*endpoint_disable)(struct usb_hcd *hcd,
239 struct usb_host_endpoint *ep); 263 struct usb_host_endpoint *ep);
@@ -330,8 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
330extern int usb_hcd_unlink_urb(struct urb *urb, int status); 354extern int usb_hcd_unlink_urb(struct urb *urb, int status);
331extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, 355extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
332 int status); 356 int status);
333extern void unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); 357extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
334extern void unmap_urb_for_dma(struct usb_hcd *, struct urb *); 358 gfp_t mem_flags);
359extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
360extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
335extern void usb_hcd_flush_endpoint(struct usb_device *udev, 361extern void usb_hcd_flush_endpoint(struct usb_device *udev,
336 struct usb_host_endpoint *ep); 362 struct usb_host_endpoint *ep);
337extern void usb_hcd_disable_endpoint(struct usb_device *udev, 363extern void usb_hcd_disable_endpoint(struct usb_device *udev,
@@ -347,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev);
347 373
348extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 374extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
349 struct device *dev, const char *bus_name); 375 struct device *dev, const char *bus_name);
376extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
377 struct device *dev, const char *bus_name,
378 struct usb_hcd *shared_hcd);
350extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); 379extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
351extern void usb_put_hcd(struct usb_hcd *hcd); 380extern void usb_put_hcd(struct usb_hcd *hcd);
381extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
352extern int usb_add_hcd(struct usb_hcd *hcd, 382extern int usb_add_hcd(struct usb_hcd *hcd,
353 unsigned int irqnum, unsigned long irqflags); 383 unsigned int irqnum, unsigned long irqflags);
354extern void usb_remove_hcd(struct usb_hcd *hcd); 384extern void usb_remove_hcd(struct usb_hcd *hcd);
@@ -622,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
622 652
623/*-------------------------------------------------------------------------*/ 653/*-------------------------------------------------------------------------*/
624 654
625/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
626/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
627#define bitmap DeviceRemovable
628
629
630/*-------------------------------------------------------------------------*/
631
632/* random stuff */ 655/* random stuff */
633 656
634#define RUN_CONTEXT (in_irq() ? "in_irq" \ 657#define RUN_CONTEXT (in_irq() ? "in_irq" \
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 3675e03b1539..3657403eac18 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -55,7 +55,7 @@ enum otg_control_type {
55 55
56/** 56/**
57 * struct msm_otg_platform_data - platform device data 57 * struct msm_otg_platform_data - platform device data
58 * for msm72k_otg driver. 58 * for msm_otg driver.
59 * @phy_init_seq: PHY configuration sequence. val, reg pairs 59 * @phy_init_seq: PHY configuration sequence. val, reg pairs
60 * terminated by -1. 60 * terminated by -1.
61 * @vbus_power: VBUS power on/off routine. 61 * @vbus_power: VBUS power on/off routine.
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index a1a1e7a73ec9..6e40718f5abe 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -66,6 +66,7 @@ struct otg_transceiver {
66 66
67 u8 default_a; 67 u8 default_a;
68 enum usb_otg_state state; 68 enum usb_otg_state state;
69 enum usb_xceiv_events last_event;
69 70
70 struct usb_bus *host; 71 struct usb_bus *host;
71 struct usb_gadget *gadget; 72 struct usb_gadget *gadget;
@@ -74,7 +75,7 @@ struct otg_transceiver {
74 void __iomem *io_priv; 75 void __iomem *io_priv;
75 76
76 /* for notification of usb_xceiv_events */ 77 /* for notification of usb_xceiv_events */
77 struct blocking_notifier_head notifier; 78 struct atomic_notifier_head notifier;
78 79
79 /* to pass extra port status to the root hub */ 80 /* to pass extra port status to the root hub */
80 u16 port_status; 81 u16 port_status;
@@ -234,13 +235,13 @@ otg_start_srp(struct otg_transceiver *otg)
234static inline int 235static inline int
235otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 236otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
236{ 237{
237 return blocking_notifier_chain_register(&otg->notifier, nb); 238 return atomic_notifier_chain_register(&otg->notifier, nb);
238} 239}
239 240
240static inline void 241static inline void
241otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 242otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
242{ 243{
243 blocking_notifier_chain_unregister(&otg->notifier, nb); 244 atomic_notifier_chain_unregister(&otg->notifier, nb);
244} 245}
245 246
246/* for OTG controller drivers (and maybe other stuff) */ 247/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index c9049139a7a5..b29f70b2ecae 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -191,7 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
191 * @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
192 * of the devices this structure can support. 192 * of the devices this structure can support.
193 * @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) 194 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
195 * (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 196 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
196 * @calc_num_ports: pointer to a function to determine how many ports this 197 * @calc_num_ports: pointer to a function to determine how many ports this
197 * device has dynamically. It will be called after the probe() 198 * device has dynamically. It will be called after the probe()
@@ -260,7 +261,7 @@ struct usb_serial_driver {
260 const unsigned char *buf, int count); 261 const unsigned char *buf, int count);
261 /* Called only by the tty layer */ 262 /* Called only by the tty layer */
262 int (*write_room)(struct tty_struct *tty); 263 int (*write_room)(struct tty_struct *tty);
263 int (*ioctl)(struct tty_struct *tty, struct file *file, 264 int (*ioctl)(struct tty_struct *tty,
264 unsigned int cmd, unsigned long arg); 265 unsigned int cmd, unsigned long arg);
265 void (*set_termios)(struct tty_struct *tty, 266 void (*set_termios)(struct tty_struct *tty,
266 struct usb_serial_port *port, struct ktermios *old); 267 struct usb_serial_port *port, struct ktermios *old);
@@ -268,8 +269,8 @@ struct usb_serial_driver {
268 int (*chars_in_buffer)(struct tty_struct *tty); 269 int (*chars_in_buffer)(struct tty_struct *tty);
269 void (*throttle)(struct tty_struct *tty); 270 void (*throttle)(struct tty_struct *tty);
270 void (*unthrottle)(struct tty_struct *tty); 271 void (*unthrottle)(struct tty_struct *tty);
271 int (*tiocmget)(struct tty_struct *tty, struct file *file); 272 int (*tiocmget)(struct tty_struct *tty);
272 int (*tiocmset)(struct tty_struct *tty, struct file *file, 273 int (*tiocmset)(struct tty_struct *tty,
273 unsigned int set, unsigned int clear); 274 unsigned int set, unsigned int clear);
274 int (*get_icount)(struct tty_struct *tty, 275 int (*get_icount)(struct tty_struct *tty,
275 struct serial_icounter_struct *icount); 276 struct serial_icounter_struct *icount);
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 82b1507f4735..9595796d62ed 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -184,4 +184,9 @@
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops;
190#endif
191
187#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 69f39974c041..4e5b0213fdc1 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -37,9 +37,13 @@ struct new_utsname {
37#include <linux/nsproxy.h> 37#include <linux/nsproxy.h>
38#include <linux/err.h> 38#include <linux/err.h>
39 39
40struct user_namespace;
41extern struct user_namespace init_user_ns;
42
40struct uts_namespace { 43struct uts_namespace {
41 struct kref kref; 44 struct kref kref;
42 struct new_utsname name; 45 struct new_utsname name;
46 struct user_namespace *user_ns;
43}; 47};
44extern struct uts_namespace init_uts_ns; 48extern struct uts_namespace init_uts_ns;
45 49
@@ -50,7 +54,7 @@ static inline void get_uts_ns(struct uts_namespace *ns)
50} 54}
51 55
52extern struct uts_namespace *copy_utsname(unsigned long flags, 56extern struct uts_namespace *copy_utsname(unsigned long flags,
53 struct uts_namespace *ns); 57 struct task_struct *tsk);
54extern void free_uts_ns(struct kref *kref); 58extern void free_uts_ns(struct kref *kref);
55 59
56static inline void put_uts_ns(struct uts_namespace *ns) 60static inline void put_uts_ns(struct uts_namespace *ns)
@@ -67,12 +71,12 @@ static inline void put_uts_ns(struct uts_namespace *ns)
67} 71}
68 72
69static inline struct uts_namespace *copy_utsname(unsigned long flags, 73static inline struct uts_namespace *copy_utsname(unsigned long flags,
70 struct uts_namespace *ns) 74 struct task_struct *tsk)
71{ 75{
72 if (flags & CLONE_NEWUTS) 76 if (flags & CLONE_NEWUTS)
73 return ERR_PTR(-EINVAL); 77 return ERR_PTR(-EINVAL);
74 78
75 return ns; 79 return tsk->nsproxy->uts_ns;
76} 80}
77#endif 81#endif
78 82
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
new file mode 100644
index 000000000000..7054a7a8065e
--- /dev/null
+++ b/include/linux/v4l2-mediabus.h
@@ -0,0 +1,108 @@
1/*
2 * Media Bus API header
3 *
4 * Copyright (C) 2009, 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
11#ifndef __LINUX_V4L2_MEDIABUS_H
12#define __LINUX_V4L2_MEDIABUS_H
13
14#include <linux/types.h>
15#include <linux/videodev2.h>
16
17/*
18 * These pixel codes uniquely identify data formats on the media bus. Mostly
19 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
20 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
21 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
22 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
23 * transferred over the bus: "LE" means that the least significant bits are
24 * transferred first, "BE" means that the most significant bits are transferred
25 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
26 * incomplete high byte, are filled with padding bits.
27 *
28 * The pixel codes are grouped by type, bus_width, bits per component, samples
29 * per pixel and order of subsamples. Numerical values are sorted using generic
30 * numerical sort order (8 thus comes before 10).
31 *
32 * As their value can't change when a new pixel code is inserted in the
33 * enumeration, the pixel codes are explicitly given a numerical value. The next
34 * free values for each category are listed below, update them when inserting
35 * new pixel codes.
36 */
37enum v4l2_mbus_pixelcode {
38 V4L2_MBUS_FMT_FIXED = 0x0001,
39
40 /* RGB - next is 0x1009 */
41 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
42 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
43 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
44 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
45 V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49
50 /* YUV (including grey) - next is 0x2013 */
51 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
52 V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
53 V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
54 V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
55 V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
56 V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
57 V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
58 V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
59 V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
60 V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
61 V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
62 V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
63 V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
64 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
65 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
66 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
67 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
68 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
69
70 /* Bayer - next is 0x3013 */
71 V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
72 V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
73 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
74 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
75 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
76 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
77 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
78 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
79 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
80 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
81 V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
82 V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
83 V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
84 V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
85 V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
86 V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
87 V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
88 V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
89};
90
91/**
92 * struct v4l2_mbus_framefmt - frame format on the media bus
93 * @width: frame width
94 * @height: frame height
95 * @code: data format code (from enum v4l2_mbus_pixelcode)
96 * @field: used interlacing type (from enum v4l2_field)
97 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
98 */
99struct v4l2_mbus_framefmt {
100 __u32 width;
101 __u32 height;
102 __u32 code;
103 __u32 field;
104 __u32 colorspace;
105 __u32 reserved[7];
106};
107
108#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
new file mode 100644
index 000000000000..ed29cbbebfef
--- /dev/null
+++ b/include/linux/v4l2-subdev.h
@@ -0,0 +1,141 @@
1/*
2 * V4L2 subdev userspace API
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
11 * published by the Free Software Foundation.
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_V4L2_SUBDEV_H
24#define __LINUX_V4L2_SUBDEV_H
25
26#include <linux/ioctl.h>
27#include <linux/types.h>
28#include <linux/v4l2-mediabus.h>
29
30/**
31 * enum v4l2_subdev_format_whence - Media bus format type
32 * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
33 * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
34 */
35enum v4l2_subdev_format_whence {
36 V4L2_SUBDEV_FORMAT_TRY = 0,
37 V4L2_SUBDEV_FORMAT_ACTIVE = 1,
38};
39
40/**
41 * struct v4l2_subdev_format - Pad-level media bus format
42 * @which: format type (from enum v4l2_subdev_format_whence)
43 * @pad: pad number, as reported by the media API
44 * @format: media bus format (format code and frame size)
45 */
46struct v4l2_subdev_format {
47 __u32 which;
48 __u32 pad;
49 struct v4l2_mbus_framefmt format;
50 __u32 reserved[8];
51};
52
53/**
54 * struct v4l2_subdev_crop - Pad-level crop settings
55 * @which: format type (from enum v4l2_subdev_format_whence)
56 * @pad: pad number, as reported by the media API
57 * @rect: pad crop rectangle boundaries
58 */
59struct v4l2_subdev_crop {
60 __u32 which;
61 __u32 pad;
62 struct v4l2_rect rect;
63 __u32 reserved[8];
64};
65
66/**
67 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
68 * @pad: pad number, as reported by the media API
69 * @index: format index during enumeration
70 * @code: format code (from enum v4l2_mbus_pixelcode)
71 */
72struct v4l2_subdev_mbus_code_enum {
73 __u32 pad;
74 __u32 index;
75 __u32 code;
76 __u32 reserved[9];
77};
78
79/**
80 * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
81 * @pad: pad number, as reported by the media API
82 * @index: format index during enumeration
83 * @code: format code (from enum v4l2_mbus_pixelcode)
84 */
85struct v4l2_subdev_frame_size_enum {
86 __u32 index;
87 __u32 pad;
88 __u32 code;
89 __u32 min_width;
90 __u32 max_width;
91 __u32 min_height;
92 __u32 max_height;
93 __u32 reserved[9];
94};
95
96/**
97 * struct v4l2_subdev_frame_interval - Pad-level frame rate
98 * @pad: pad number, as reported by the media API
99 * @interval: frame interval in seconds
100 */
101struct v4l2_subdev_frame_interval {
102 __u32 pad;
103 struct v4l2_fract interval;
104 __u32 reserved[9];
105};
106
107/**
108 * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
109 * @pad: pad number, as reported by the media API
110 * @index: frame interval index during enumeration
111 * @code: format code (from enum v4l2_mbus_pixelcode)
112 * @width: frame width in pixels
113 * @height: frame height in pixels
114 * @interval: frame interval in seconds
115 */
116struct v4l2_subdev_frame_interval_enum {
117 __u32 index;
118 __u32 pad;
119 __u32 code;
120 __u32 width;
121 __u32 height;
122 struct v4l2_fract interval;
123 __u32 reserved[9];
124};
125
126#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
127#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
128#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
129 _IOWR('V', 21, struct v4l2_subdev_frame_interval)
130#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
131 _IOWR('V', 22, struct v4l2_subdev_frame_interval)
132#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
133 _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum)
134#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
135 _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
136#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
137 _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
138#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop)
139#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop)
140
141#endif
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 5f6f47044abf..aa6c393b7ae9 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -70,6 +70,7 @@
70 * Moved from videodev.h 70 * Moved from videodev.h
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73#define VIDEO_MAX_PLANES 8
73 74
74#ifndef __KERNEL__ 75#ifndef __KERNEL__
75 76
@@ -157,9 +158,23 @@ enum v4l2_buf_type {
157 /* Experimental */ 158 /* Experimental */
158 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, 159 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
159#endif 160#endif
161 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
162 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
160 V4L2_BUF_TYPE_PRIVATE = 0x80, 163 V4L2_BUF_TYPE_PRIVATE = 0x80,
161}; 164};
162 165
166#define V4L2_TYPE_IS_MULTIPLANAR(type) \
167 ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
168 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
169
170#define V4L2_TYPE_IS_OUTPUT(type) \
171 ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
172 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
173 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
174 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
175 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
176 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
177
163enum v4l2_tuner_type { 178enum v4l2_tuner_type {
164 V4L2_TUNER_RADIO = 1, 179 V4L2_TUNER_RADIO = 1,
165 V4L2_TUNER_ANALOG_TV = 2, 180 V4L2_TUNER_ANALOG_TV = 2,
@@ -245,6 +260,11 @@ struct v4l2_capability {
245#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ 260#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
246#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ 261#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
247 262
263/* Is a video capture device that supports multiplanar formats */
264#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
265/* Is a video output device that supports multiplanar formats */
266#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
267
248#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ 268#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
249#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ 269#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
250#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 270#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
@@ -319,6 +339,13 @@ struct v4l2_pix_format {
319#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ 339#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
320#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 340#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
321 341
342/* two non contiguous planes - one Y, one Cr + Cb interleaved */
343#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
344#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
345
346/* three non contiguous planes - Y, Cb, Cr */
347#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
348
322/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 349/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
323#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 350#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
324#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ 351#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
@@ -328,6 +355,10 @@ struct v4l2_pix_format {
328#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ 355#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
329#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ 356#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
330#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ 357#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
358#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
359#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
360#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
361#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
331 /* 10bit raw bayer DPCM compressed to 8 bits */ 362 /* 10bit raw bayer DPCM compressed to 8 bits */
332#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') 363#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
333 /* 364 /*
@@ -365,6 +396,7 @@ struct v4l2_pix_format {
365#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ 396#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
366#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ 397#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
367#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ 398#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
399#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
368 400
369/* 401/*
370 * F O R M A T E N U M E R A T I O N 402 * F O R M A T E N U M E R A T I O N
@@ -517,6 +549,62 @@ struct v4l2_requestbuffers {
517 __u32 reserved[2]; 549 __u32 reserved[2];
518}; 550};
519 551
552/**
553 * struct v4l2_plane - plane info for multi-planar buffers
554 * @bytesused: number of bytes occupied by data in the plane (payload)
555 * @length: size of this plane (NOT the payload) in bytes
556 * @mem_offset: when memory in the associated struct v4l2_buffer is
557 * V4L2_MEMORY_MMAP, equals the offset from the start of
558 * the device memory for this plane (or is a "cookie" that
559 * should be passed to mmap() called on the video node)
560 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
561 * pointing to this plane
562 * @data_offset: offset in the plane to the start of data; usually 0,
563 * unless there is a header in front of the data
564 *
565 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
566 * with two planes can have one plane for Y, and another for interleaved CbCr
567 * components. Each plane can reside in a separate memory buffer, or even in
568 * a completely separate memory node (e.g. in embedded devices).
569 */
570struct v4l2_plane {
571 __u32 bytesused;
572 __u32 length;
573 union {
574 __u32 mem_offset;
575 unsigned long userptr;
576 } m;
577 __u32 data_offset;
578 __u32 reserved[11];
579};
580
581/**
582 * struct v4l2_buffer - video buffer info
583 * @index: id number of the buffer
584 * @type: buffer type (type == *_MPLANE for multiplanar buffers)
585 * @bytesused: number of bytes occupied by data in the buffer (payload);
586 * unused (set to 0) for multiplanar buffers
587 * @flags: buffer informational flags
588 * @field: field order of the image in the buffer
589 * @timestamp: frame timestamp
590 * @timecode: frame timecode
591 * @sequence: sequence count of this frame
592 * @memory: the method, in which the actual video data is passed
593 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
594 * offset from the start of the device memory for this plane,
595 * (or a "cookie" that should be passed to mmap() as offset)
596 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
597 * a userspace pointer pointing to this buffer
598 * @planes: for multiplanar buffers; userspace pointer to the array of plane
599 * info structs for this buffer
600 * @length: size in bytes of the buffer (NOT its payload) for single-plane
601 * buffers (when type != *_MPLANE); number of elements in the
602 * planes array for multi-plane buffers
603 * @input: input number from which the video data has has been captured
604 *
605 * Contains data exchanged by application and driver using one of the Streaming
606 * I/O methods.
607 */
520struct v4l2_buffer { 608struct v4l2_buffer {
521 __u32 index; 609 __u32 index;
522 enum v4l2_buf_type type; 610 enum v4l2_buf_type type;
@@ -532,6 +620,7 @@ struct v4l2_buffer {
532 union { 620 union {
533 __u32 offset; 621 __u32 offset;
534 unsigned long userptr; 622 unsigned long userptr;
623 struct v4l2_plane *planes;
535 } m; 624 } m;
536 __u32 length; 625 __u32 length;
537 __u32 input; 626 __u32 input;
@@ -1622,12 +1711,56 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
1622 * A G G R E G A T E S T R U C T U R E S 1711 * A G G R E G A T E S T R U C T U R E S
1623 */ 1712 */
1624 1713
1625/* Stream data format 1714/**
1715 * struct v4l2_plane_pix_format - additional, per-plane format definition
1716 * @sizeimage: maximum size in bytes required for data, for which
1717 * this plane will be used
1718 * @bytesperline: distance in bytes between the leftmost pixels in two
1719 * adjacent lines
1720 */
1721struct v4l2_plane_pix_format {
1722 __u32 sizeimage;
1723 __u16 bytesperline;
1724 __u16 reserved[7];
1725} __attribute__ ((packed));
1726
1727/**
1728 * struct v4l2_pix_format_mplane - multiplanar format definition
1729 * @width: image width in pixels
1730 * @height: image height in pixels
1731 * @pixelformat: little endian four character code (fourcc)
1732 * @field: field order (for interlaced video)
1733 * @colorspace: supplemental to pixelformat
1734 * @plane_fmt: per-plane information
1735 * @num_planes: number of planes for this format
1736 */
1737struct v4l2_pix_format_mplane {
1738 __u32 width;
1739 __u32 height;
1740 __u32 pixelformat;
1741 enum v4l2_field field;
1742 enum v4l2_colorspace colorspace;
1743
1744 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1745 __u8 num_planes;
1746 __u8 reserved[11];
1747} __attribute__ ((packed));
1748
1749/**
1750 * struct v4l2_format - stream data format
1751 * @type: type of the data stream
1752 * @pix: definition of an image format
1753 * @pix_mp: definition of a multiplanar image format
1754 * @win: definition of an overlaid image
1755 * @vbi: raw VBI capture or output parameters
1756 * @sliced: sliced VBI capture or output parameters
1757 * @raw_data: placeholder for future extensions and custom formats
1626 */ 1758 */
1627struct v4l2_format { 1759struct v4l2_format {
1628 enum v4l2_buf_type type; 1760 enum v4l2_buf_type type;
1629 union { 1761 union {
1630 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ 1762 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1763 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
1631 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ 1764 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1632 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ 1765 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1633 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ 1766 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
@@ -1635,7 +1768,6 @@ struct v4l2_format {
1635 } fmt; 1768 } fmt;
1636}; 1769};
1637 1770
1638
1639/* Stream type-dependent parameters 1771/* Stream type-dependent parameters
1640 */ 1772 */
1641struct v4l2_streamparm { 1773struct v4l2_streamparm {
@@ -1808,16 +1940,6 @@ struct v4l2_dbg_chip_ident {
1808/* Reminder: when adding new ioctls please add support for them to 1940/* Reminder: when adding new ioctls please add support for them to
1809 drivers/media/video/v4l2-compat-ioctl32.c as well! */ 1941 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1810 1942
1811#ifdef __OLD_VIDIOC_
1812/* for compatibility, will go away some day */
1813#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1814#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1815#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1816#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1817#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1818#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1819#endif
1820
1821#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1943#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1822 1944
1823#endif /* __LINUX_VIDEODEV2_H */ 1945#endif /* __LINUX_VIDEODEV2_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 833e676d6d92..461c0119664f 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -220,12 +220,12 @@ static inline unsigned long node_page_state(int node,
220 zone_page_state(&zones[ZONE_MOVABLE], item); 220 zone_page_state(&zones[ZONE_MOVABLE], item);
221} 221}
222 222
223extern void zone_statistics(struct zone *, struct zone *); 223extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
224 224
225#else 225#else
226 226
227#define node_page_state(node, item) global_page_state(item) 227#define node_page_state(node, item) global_page_state(item)
228#define zone_statistics(_zl,_z) do { } while (0) 228#define zone_statistics(_zl, _z, gfp) do { } while (0)
229 229
230#endif /* CONFIG_NUMA */ 230#endif /* CONFIG_NUMA */
231 231
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 6625cc1ab758..4d05e14ea60c 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -142,14 +142,6 @@ static inline bool vt_force_oops_output(struct vc_data *vc)
142 return false; 142 return false;
143} 143}
144 144
145/*
146 * vc_screen.c shares this temporary buffer with the console write code so that
147 * we can easily avoid touching user space while holding the console spinlock.
148 */
149
150#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
151extern char con_buf[CON_BUF_SIZE];
152extern struct mutex con_buf_mtx;
153extern char vt_dont_switch; 145extern char vt_dont_switch;
154extern int default_utf8; 146extern int default_utf8;
155extern int global_cursor_default; 147extern int global_cursor_default;
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f7998a3bf020..f584aba78ca9 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -286,11 +286,15 @@ enum {
286 * any specific CPU, not concurrency managed, and all queued works are 286 * any specific CPU, not concurrency managed, and all queued works are
287 * executed immediately as long as max_active limit is not reached and 287 * executed immediately as long as max_active limit is not reached and
288 * resources are available. 288 * resources are available.
289 *
290 * system_freezable_wq is equivalent to system_wq except that it's
291 * freezable.
289 */ 292 */
290extern struct workqueue_struct *system_wq; 293extern struct workqueue_struct *system_wq;
291extern struct workqueue_struct *system_long_wq; 294extern struct workqueue_struct *system_long_wq;
292extern struct workqueue_struct *system_nrt_wq; 295extern struct workqueue_struct *system_nrt_wq;
293extern struct workqueue_struct *system_unbound_wq; 296extern struct workqueue_struct *system_unbound_wq;
297extern struct workqueue_struct *system_freezable_wq;
294 298
295extern struct workqueue_struct * 299extern struct workqueue_struct *
296__alloc_workqueue_key(const char *name, unsigned int flags, int max_active, 300__alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 0ead399e08b5..17e7ccc322a5 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -9,7 +9,7 @@
9 9
10struct backing_dev_info; 10struct backing_dev_info;
11 11
12extern spinlock_t inode_lock; 12extern spinlock_t inode_wb_list_lock;
13 13
14/* 14/*
15 * fs/fs-writeback.c 15 * fs/fs-writeback.c
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index e6131ef98d8f..6050783005bd 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -42,11 +42,13 @@
42#define XATTR_SMACK_IPOUT "SMACK64IPOUT" 42#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
43#define XATTR_SMACK_EXEC "SMACK64EXEC" 43#define XATTR_SMACK_EXEC "SMACK64EXEC"
44#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE" 44#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE"
45#define XATTR_SMACK_MMAP "SMACK64MMAP"
45#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX 46#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
46#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN 47#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
47#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT 48#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
48#define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC 49#define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC
49#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE 50#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE
51#define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP
50 52
51#define XATTR_CAPS_SUFFIX "capability" 53#define XATTR_CAPS_SUFFIX "capability"
52#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 54#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 930fdd2de79c..22e61fdf75a2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,16 @@ struct xfrm_replay_state {
84 __u32 bitmap; 84 __u32 bitmap;
85}; 85};
86 86
87struct xfrm_replay_state_esn {
88 unsigned int bmp_len;
89 __u32 oseq;
90 __u32 seq;
91 __u32 oseq_hi;
92 __u32 seq_hi;
93 __u32 replay_window;
94 __u32 bmp[0];
95};
96
87struct xfrm_algo { 97struct xfrm_algo {
88 char alg_name[64]; 98 char alg_name[64];
89 unsigned int alg_key_len; /* in bits */ 99 unsigned int alg_key_len; /* in bits */
@@ -284,6 +294,7 @@ enum xfrm_attr_type_t {
284 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */ 294 XFRMA_ALG_AUTH_TRUNC, /* struct xfrm_algo_auth */
285 XFRMA_MARK, /* struct xfrm_mark */ 295 XFRMA_MARK, /* struct xfrm_mark */
286 XFRMA_TFCPAD, /* __u32 */ 296 XFRMA_TFCPAD, /* __u32 */
297 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
287 __XFRMA_MAX 298 __XFRMA_MAX
288 299
289#define XFRMA_MAX (__XFRMA_MAX - 1) 300#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -350,6 +361,8 @@ struct xfrm_usersa_info {
350#define XFRM_STATE_WILDRECV 8 361#define XFRM_STATE_WILDRECV 8
351#define XFRM_STATE_ICMP 16 362#define XFRM_STATE_ICMP 16
352#define XFRM_STATE_AF_UNSPEC 32 363#define XFRM_STATE_AF_UNSPEC 32
364#define XFRM_STATE_ALIGN4 64
365#define XFRM_STATE_ESN 128
353}; 366};
354 367
355struct xfrm_usersa_id { 368struct xfrm_usersa_id {
diff --git a/include/linux/zlib.h b/include/linux/zlib.h
index 40c49cb3eb51..9c5a6b4de0a3 100644
--- a/include/linux/zlib.h
+++ b/include/linux/zlib.h
@@ -179,11 +179,16 @@ typedef z_stream *z_streamp;
179 179
180 /* basic functions */ 180 /* basic functions */
181 181
182extern int zlib_deflate_workspacesize (void); 182extern int zlib_deflate_workspacesize (int windowBits, int memLevel);
183/* 183/*
184 Returns the number of bytes that needs to be allocated for a per- 184 Returns the number of bytes that needs to be allocated for a per-
185 stream workspace. A pointer to this number of bytes should be 185 stream workspace with the specified parameters. A pointer to this
186 returned in stream->workspace before calling zlib_deflateInit(). 186 number of bytes should be returned in stream->workspace before
187 you call zlib_deflateInit() or zlib_deflateInit2(). If you call
188 zlib_deflateInit(), specify windowBits = MAX_WBITS and memLevel =
189 MAX_MEM_LEVEL here. If you call zlib_deflateInit2(), the windowBits
190 and memLevel parameters passed to zlib_deflateInit2() must not
191 exceed those passed here.
187*/ 192*/
188 193
189/* 194/*
diff --git a/include/media/media-device.h b/include/media/media-device.h
new file mode 100644
index 000000000000..6a27d916c250
--- /dev/null
+++ b/include/media/media-device.h
@@ -0,0 +1,95 @@
1/*
2 * Media device
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
11 * published by the Free Software Foundation.
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 _MEDIA_DEVICE_H
24#define _MEDIA_DEVICE_H
25
26#include <linux/device.h>
27#include <linux/list.h>
28#include <linux/mutex.h>
29#include <linux/spinlock.h>
30
31#include <media/media-devnode.h>
32#include <media/media-entity.h>
33
34/**
35 * struct media_device - Media device
36 * @dev: Parent device
37 * @devnode: Media device node
38 * @model: Device model name
39 * @serial: Device serial number (optional)
40 * @bus_info: Unique and stable device location identifier
41 * @hw_revision: Hardware device revision
42 * @driver_version: Device driver version
43 * @entity_id: ID of the next entity to be registered
44 * @entities: List of registered entities
45 * @lock: Entities list lock
46 * @graph_mutex: Entities graph operation lock
47 *
48 * This structure represents an abstract high-level media device. It allows easy
49 * access to entities and provides basic media device-level support. The
50 * structure can be allocated directly or embedded in a larger structure.
51 *
52 * The parent @dev is a physical device. It must be set before registering the
53 * media device.
54 *
55 * @model is a descriptive model name exported through sysfs. It doesn't have to
56 * be unique.
57 */
58struct media_device {
59 /* dev->driver_data points to this struct. */
60 struct device *dev;
61 struct media_devnode devnode;
62
63 char model[32];
64 char serial[40];
65 char bus_info[32];
66 u32 hw_revision;
67 u32 driver_version;
68
69 u32 entity_id;
70 struct list_head entities;
71
72 /* Protects the entities list */
73 spinlock_t lock;
74 /* Serializes graph operations. */
75 struct mutex graph_mutex;
76
77 int (*link_notify)(struct media_pad *source,
78 struct media_pad *sink, u32 flags);
79};
80
81/* media_devnode to media_device */
82#define to_media_device(node) container_of(node, struct media_device, devnode)
83
84int __must_check media_device_register(struct media_device *mdev);
85void media_device_unregister(struct media_device *mdev);
86
87int __must_check media_device_register_entity(struct media_device *mdev,
88 struct media_entity *entity);
89void media_device_unregister_entity(struct media_entity *entity);
90
91/* Iterate over all entities. */
92#define media_device_for_each_entity(entity, mdev) \
93 list_for_each_entry(entity, &(mdev)->entities, list)
94
95#endif
diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
new file mode 100644
index 000000000000..f6caafc874cb
--- /dev/null
+++ b/include/media/media-devnode.h
@@ -0,0 +1,97 @@
1/*
2 * Media device node
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
11 * published by the Free Software Foundation.
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 *
24 * Common functions for media-related drivers to register and unregister media
25 * device nodes.
26 */
27
28#ifndef _MEDIA_DEVNODE_H
29#define _MEDIA_DEVNODE_H
30
31#include <linux/poll.h>
32#include <linux/fs.h>
33#include <linux/device.h>
34#include <linux/cdev.h>
35
36/*
37 * Flag to mark the media_devnode struct as registered. Drivers must not touch
38 * this flag directly, it will be set and cleared by media_devnode_register and
39 * media_devnode_unregister.
40 */
41#define MEDIA_FLAG_REGISTERED 0
42
43struct media_file_operations {
44 struct module *owner;
45 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
46 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
47 unsigned int (*poll) (struct file *, struct poll_table_struct *);
48 long (*ioctl) (struct file *, unsigned int, unsigned long);
49 int (*open) (struct file *);
50 int (*release) (struct file *);
51};
52
53/**
54 * struct media_devnode - Media device node
55 * @parent: parent device
56 * @minor: device node minor number
57 * @flags: flags, combination of the MEDIA_FLAG_* constants
58 *
59 * This structure represents a media-related device node.
60 *
61 * The @parent is a physical device. It must be set by core or device drivers
62 * before registering the node.
63 */
64struct media_devnode {
65 /* device ops */
66 const struct media_file_operations *fops;
67
68 /* sysfs */
69 struct device dev; /* media device */
70 struct cdev cdev; /* character device */
71 struct device *parent; /* device parent */
72
73 /* device info */
74 int minor;
75 unsigned long flags; /* Use bitops to access flags */
76
77 /* callbacks */
78 void (*release)(struct media_devnode *mdev);
79};
80
81/* dev to media_devnode */
82#define to_media_devnode(cd) container_of(cd, struct media_devnode, dev)
83
84int __must_check media_devnode_register(struct media_devnode *mdev);
85void media_devnode_unregister(struct media_devnode *mdev);
86
87static inline struct media_devnode *media_devnode_data(struct file *filp)
88{
89 return filp->private_data;
90}
91
92static inline int media_devnode_is_registered(struct media_devnode *mdev)
93{
94 return test_bit(MEDIA_FLAG_REGISTERED, &mdev->flags);
95}
96
97#endif /* _MEDIA_DEVNODE_H */
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
new file mode 100644
index 000000000000..cd8bca63a502
--- /dev/null
+++ b/include/media/media-entity.h
@@ -0,0 +1,151 @@
1/*
2 * Media entity
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
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 version 2 as
11 * published by the Free Software Foundation.
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 _MEDIA_ENTITY_H
24#define _MEDIA_ENTITY_H
25
26#include <linux/list.h>
27#include <linux/media.h>
28
29struct media_pipeline {
30};
31
32struct media_link {
33 struct media_pad *source; /* Source pad */
34 struct media_pad *sink; /* Sink pad */
35 struct media_link *reverse; /* Link in the reverse direction */
36 unsigned long flags; /* Link flags (MEDIA_LNK_FL_*) */
37};
38
39struct media_pad {
40 struct media_entity *entity; /* Entity this pad belongs to */
41 u16 index; /* Pad index in the entity pads array */
42 unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */
43};
44
45struct media_entity_operations {
46 int (*link_setup)(struct media_entity *entity,
47 const struct media_pad *local,
48 const struct media_pad *remote, u32 flags);
49};
50
51struct media_entity {
52 struct list_head list;
53 struct media_device *parent; /* Media device this entity belongs to*/
54 u32 id; /* Entity ID, unique in the parent media
55 * device context */
56 const char *name; /* Entity name */
57 u32 type; /* Entity type (MEDIA_ENT_T_*) */
58 u32 revision; /* Entity revision, driver specific */
59 unsigned long flags; /* Entity flags (MEDIA_ENT_FL_*) */
60 u32 group_id; /* Entity group ID */
61
62 u16 num_pads; /* Number of sink and source pads */
63 u16 num_links; /* Number of existing links, both
64 * enabled and disabled */
65 u16 num_backlinks; /* Number of backlinks */
66 u16 max_links; /* Maximum number of links */
67
68 struct media_pad *pads; /* Pads array (num_pads elements) */
69 struct media_link *links; /* Links array (max_links elements)*/
70
71 const struct media_entity_operations *ops; /* Entity operations */
72
73 /* Reference counts must never be negative, but are signed integers on
74 * purpose: a simple WARN_ON(<0) check can be used to detect reference
75 * count bugs that would make them negative.
76 */
77 int stream_count; /* Stream count for the entity. */
78 int use_count; /* Use count for the entity. */
79
80 struct media_pipeline *pipe; /* Pipeline this entity belongs to. */
81
82 union {
83 /* Node specifications */
84 struct {
85 u32 major;
86 u32 minor;
87 } v4l;
88 struct {
89 u32 major;
90 u32 minor;
91 } fb;
92 struct {
93 u32 card;
94 u32 device;
95 u32 subdevice;
96 } alsa;
97 int dvb;
98
99 /* Sub-device specifications */
100 /* Nothing needed yet */
101 };
102};
103
104static inline u32 media_entity_type(struct media_entity *entity)
105{
106 return entity->type & MEDIA_ENT_TYPE_MASK;
107}
108
109static inline u32 media_entity_subtype(struct media_entity *entity)
110{
111 return entity->type & MEDIA_ENT_SUBTYPE_MASK;
112}
113
114#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
115
116struct media_entity_graph {
117 struct {
118 struct media_entity *entity;
119 int link;
120 } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH];
121 int top;
122};
123
124int media_entity_init(struct media_entity *entity, u16 num_pads,
125 struct media_pad *pads, u16 extra_links);
126void media_entity_cleanup(struct media_entity *entity);
127
128int media_entity_create_link(struct media_entity *source, u16 source_pad,
129 struct media_entity *sink, u16 sink_pad, u32 flags);
130int __media_entity_setup_link(struct media_link *link, u32 flags);
131int media_entity_setup_link(struct media_link *link, u32 flags);
132struct media_link *media_entity_find_link(struct media_pad *source,
133 struct media_pad *sink);
134struct media_pad *media_entity_remote_source(struct media_pad *pad);
135
136struct media_entity *media_entity_get(struct media_entity *entity);
137void media_entity_put(struct media_entity *entity);
138
139void media_entity_graph_walk_start(struct media_entity_graph *graph,
140 struct media_entity *entity);
141struct media_entity *
142media_entity_graph_walk_next(struct media_entity_graph *graph);
143void media_entity_pipeline_start(struct media_entity *entity,
144 struct media_pipeline *pipe);
145void media_entity_pipeline_stop(struct media_entity *entity);
146
147#define media_entity_call(entity, operation, args...) \
148 (((entity)->ops && (entity)->ops->operation) ? \
149 (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)
150
151#endif
diff --git a/include/media/noon010pc30.h b/include/media/noon010pc30.h
new file mode 100644
index 000000000000..58eafee36b30
--- /dev/null
+++ b/include/media/noon010pc30.h
@@ -0,0 +1,28 @@
1/*
2 * Driver header for NOON010PC30L camera sensor chip.
3 *
4 * Copyright (c) 2010 Samsung Electronics, Co. Ltd
5 * Contact: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef NOON010PC30_H
14#define NOON010PC30_H
15
16/**
17 * @clk_rate: the clock frequency in Hz
18 * @gpio_nreset: GPIO driving nRESET pin
19 * @gpio_nstby: GPIO driving nSTBY pin
20 */
21
22struct noon010pc30_platform_data {
23 unsigned long clk_rate;
24 int gpio_nreset;
25 int gpio_nstby;
26};
27
28#endif /* NOON010PC30_H */
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index ee9e2f747c76..9184751f19c0 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -94,7 +94,7 @@ void rc_map_init(void);
94#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z" 94#define RC_MAP_GADMEI_RM008Z "rc-gadmei-rm008z"
95#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce" 95#define RC_MAP_GENIUS_TVGO_A11MCE "rc-genius-tvgo-a11mce"
96#define RC_MAP_GOTVIEW7135 "rc-gotview7135" 96#define RC_MAP_GOTVIEW7135 "rc-gotview7135"
97#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge-new" 97#define RC_MAP_HAUPPAUGE_NEW "rc-hauppauge"
98#define RC_MAP_IMON_MCE "rc-imon-mce" 98#define RC_MAP_IMON_MCE "rc-imon-mce"
99#define RC_MAP_IMON_PAD "rc-imon-pad" 99#define RC_MAP_IMON_PAD "rc-imon-pad"
100#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e" 100#define RC_MAP_IODATA_BCTV7E "rc-iodata-bctv7e"
@@ -125,14 +125,16 @@ void rc_map_init(void);
125#define RC_MAP_PROTEUS_2309 "rc-proteus-2309" 125#define RC_MAP_PROTEUS_2309 "rc-proteus-2309"
126#define RC_MAP_PURPLETV "rc-purpletv" 126#define RC_MAP_PURPLETV "rc-purpletv"
127#define RC_MAP_PV951 "rc-pv951" 127#define RC_MAP_PV951 "rc-pv951"
128#define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" 128#define RC_MAP_HAUPPAUGE "rc-hauppauge"
129#define RC_MAP_RC5_TV "rc-rc5-tv" 129#define RC_MAP_RC5_TV "rc-rc5-tv"
130#define RC_MAP_RC6_MCE "rc-rc6-mce" 130#define RC_MAP_RC6_MCE "rc-rc6-mce"
131#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" 131#define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys"
132#define RC_MAP_STREAMZAP "rc-streamzap" 132#define RC_MAP_STREAMZAP "rc-streamzap"
133#define RC_MAP_TBS_NEC "rc-tbs-nec" 133#define RC_MAP_TBS_NEC "rc-tbs-nec"
134#define RC_MAP_TECHNISAT_USB2 "rc-technisat-usb2"
134#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs" 135#define RC_MAP_TERRATEC_CINERGY_XS "rc-terratec-cinergy-xs"
135#define RC_MAP_TERRATEC_SLIM "rc-terratec-slim" 136#define RC_MAP_TERRATEC_SLIM "rc-terratec-slim"
137#define RC_MAP_TERRATEC_SLIM_2 "rc-terratec-slim-2"
136#define RC_MAP_TEVII_NEC "rc-tevii-nec" 138#define RC_MAP_TEVII_NEC "rc-tevii-nec"
137#define RC_MAP_TOTAL_MEDIA_IN_HAND "rc-total-media-in-hand" 139#define RC_MAP_TOTAL_MEDIA_IN_HAND "rc-total-media-in-hand"
138#define RC_MAP_TREKSTOR "rc-trekstor" 140#define RC_MAP_TREKSTOR "rc-trekstor"
diff --git a/include/media/s3c_fimc.h b/include/media/s5p_fimc.h
index ca1b6738e4a4..9fdff8a4ed26 100644
--- a/include/media/s3c_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -9,8 +9,8 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#ifndef S3C_FIMC_H_ 12#ifndef S5P_FIMC_H_
13#define S3C_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15enum cam_bus_type { 15enum cam_bus_type {
16 FIMC_ITU_601 = 1, 16 FIMC_ITU_601 = 1,
@@ -27,34 +27,35 @@ enum cam_bus_type {
27struct i2c_board_info; 27struct i2c_board_info;
28 28
29/** 29/**
30 * struct s3c_fimc_isp_info - image sensor information required for host 30 * struct s5p_fimc_isp_info - image sensor information required for host
31 * interace configuration. 31 * interace configuration.
32 * 32 *
33 * @board_info: pointer to I2C subdevice's board info 33 * @board_info: pointer to I2C subdevice's board info
34 * @clk_frequency: frequency of the clock the host interface provides to sensor
34 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. 35 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
36 * @csi_data_align: MIPI-CSI interface data alignment in bits
35 * @i2c_bus_num: i2c control bus id the sensor is attached to 37 * @i2c_bus_num: i2c control bus id the sensor is attached to
36 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) 38 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
37 * @bus_width: camera data bus width in bits
38 * @flags: flags defining bus signals polarity inversion (High by default) 39 * @flags: flags defining bus signals polarity inversion (High by default)
39 */ 40 */
40struct s3c_fimc_isp_info { 41struct s5p_fimc_isp_info {
41 struct i2c_board_info *board_info; 42 struct i2c_board_info *board_info;
43 unsigned long clk_frequency;
42 enum cam_bus_type bus_type; 44 enum cam_bus_type bus_type;
45 u16 csi_data_align;
43 u16 i2c_bus_num; 46 u16 i2c_bus_num;
44 u16 mux_id; 47 u16 mux_id;
45 u16 bus_width;
46 u16 flags; 48 u16 flags;
47}; 49};
48 50
49
50#define FIMC_MAX_CAMIF_CLIENTS 2
51
52/** 51/**
53 * struct s3c_platform_fimc - camera host interface platform data 52 * struct s5p_platform_fimc - camera host interface platform data
54 * 53 *
55 * @isp_info: properties of camera sensor required for host interface setup 54 * @isp_info: properties of camera sensor required for host interface setup
55 * @num_clients: the number of attached image sensors
56 */ 56 */
57struct s3c_platform_fimc { 57struct s5p_platform_fimc {
58 struct s3c_fimc_isp_info *isp_info[FIMC_MAX_CAMIF_CLIENTS]; 58 struct s5p_fimc_isp_info *isp_info;
59 int num_clients;
59}; 60};
60#endif /* S3C_FIMC_H_ */ 61#endif /* S5P_FIMC_H_ */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 9386db829fb7..f80b5372baf3 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -17,6 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <media/videobuf-core.h> 19#include <media/videobuf-core.h>
20#include <media/videobuf2-core.h>
20#include <media/v4l2-device.h> 21#include <media/v4l2-device.h>
21 22
22extern struct bus_type soc_camera_bus_type; 23extern struct bus_type soc_camera_bus_type;
@@ -29,6 +30,8 @@ struct soc_camera_device {
29 struct device *pdev; /* Platform device */ 30 struct device *pdev; /* Platform device */
30 s32 user_width; 31 s32 user_width;
31 s32 user_height; 32 s32 user_height;
33 u32 bytesperline; /* for padding, zero if unused */
34 u32 sizeimage;
32 enum v4l2_colorspace colorspace; 35 enum v4l2_colorspace colorspace;
33 unsigned char iface; /* Host number */ 36 unsigned char iface; /* Host number */
34 unsigned char devnum; /* Device number per host */ 37 unsigned char devnum; /* Device number per host */
@@ -44,7 +47,10 @@ struct soc_camera_device {
44 int use_count; 47 int use_count;
45 struct mutex video_lock; /* Protects device data */ 48 struct mutex video_lock; /* Protects device data */
46 struct file *streamer; /* stream owner */ 49 struct file *streamer; /* stream owner */
47 struct videobuf_queue vb_vidq; 50 union {
51 struct videobuf_queue vb_vidq;
52 struct vb2_queue vb2_vidq;
53 };
48}; 54};
49 55
50struct soc_camera_host { 56struct soc_camera_host {
@@ -78,6 +84,8 @@ struct soc_camera_host_ops {
78 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 84 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
79 void (*init_videobuf)(struct videobuf_queue *, 85 void (*init_videobuf)(struct videobuf_queue *,
80 struct soc_camera_device *); 86 struct soc_camera_device *);
87 int (*init_videobuf2)(struct vb2_queue *,
88 struct soc_camera_device *);
81 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *); 89 int (*reqbufs)(struct soc_camera_device *, struct v4l2_requestbuffers *);
82 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 90 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
83 int (*set_bus_param)(struct soc_camera_device *, __u32); 91 int (*set_bus_param)(struct soc_camera_device *, __u32);
@@ -85,6 +93,7 @@ struct soc_camera_host_ops {
85 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *); 93 int (*set_ctrl)(struct soc_camera_device *, struct v4l2_control *);
86 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 94 int (*get_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
87 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *); 95 int (*set_parm)(struct soc_camera_device *, struct v4l2_streamparm *);
96 int (*enum_fsizes)(struct soc_camera_device *, struct v4l2_frmsizeenum *);
88 unsigned int (*poll)(struct file *, poll_table *); 97 unsigned int (*poll)(struct file *, poll_table *);
89 const struct v4l2_queryctrl *controls; 98 const struct v4l2_queryctrl *controls;
90 int num_controls; 99 int num_controls;
@@ -299,4 +308,17 @@ static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *cli
299 return icd->vdev; 308 return icd->vdev;
300} 309}
301 310
311static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq)
312{
313 return container_of(vq, struct soc_camera_device, vb2_vidq);
314}
315
316static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq)
317{
318 return container_of(vq, struct soc_camera_device, vb_vidq);
319}
320
321void soc_camera_lock(struct vb2_queue *vq);
322void soc_camera_unlock(struct vb2_queue *vq);
323
302#endif 324#endif
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 037cd7be001e..b338108ec305 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -12,8 +12,7 @@
12#define SOC_MEDIABUS_H 12#define SOC_MEDIABUS_H
13 13
14#include <linux/videodev2.h> 14#include <linux/videodev2.h>
15 15#include <linux/v4l2-mediabus.h>
16#include <media/v4l2-mediabus.h>
17 16
18/** 17/**
19 * enum soc_mbus_packing - data packing types on the media-bus 18 * enum soc_mbus_packing - data packing types on the media-bus
@@ -61,5 +60,6 @@ struct soc_mbus_pixelfmt {
61const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc( 60const struct soc_mbus_pixelfmt *soc_mbus_get_fmtdesc(
62 enum v4l2_mbus_pixelcode code); 61 enum v4l2_mbus_pixelcode code);
63s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf); 62s32 soc_mbus_bytes_per_line(u32 width, const struct soc_mbus_pixelfmt *mf);
63int soc_mbus_samples_per_pixel(const struct soc_mbus_pixelfmt *mf);
64 64
65#endif 65#endif
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 51811eac46f1..963e33471835 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -21,6 +21,7 @@
21 21
22#ifndef _TUNER_H 22#ifndef _TUNER_H
23#define _TUNER_H 23#define _TUNER_H
24#ifdef __KERNEL__
24 25
25#include <linux/videodev2.h> 26#include <linux/videodev2.h>
26 27
@@ -131,6 +132,7 @@
131#define TUNER_NXP_TDA18271 83 132#define TUNER_NXP_TDA18271 83
132#define TUNER_SONY_BTF_PXN01Z 84 133#define TUNER_SONY_BTF_PXN01Z 84
133#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */ 134#define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */
135#define TUNER_TENA_TNF_5337 86
134 136
135/* tv card specific */ 137/* tv card specific */
136#define TDA9887_PRESENT (1<<0) 138#define TDA9887_PRESENT (1<<0)
@@ -156,14 +158,10 @@
156#define TDA9887_GAIN_NORMAL (1<<20) 158#define TDA9887_GAIN_NORMAL (1<<20)
157#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */ 159#define TDA9887_RIF_41_3 (1<<21) /* radio IF1 41.3 vs 33.3 */
158 160
159#ifdef __KERNEL__
160
161enum tuner_mode { 161enum tuner_mode {
162 T_UNINITIALIZED = 0,
163 T_RADIO = 1 << V4L2_TUNER_RADIO, 162 T_RADIO = 1 << V4L2_TUNER_RADIO,
164 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV, 163 T_ANALOG_TV = 1 << V4L2_TUNER_ANALOG_TV,
165 T_DIGITAL_TV = 1 << V4L2_TUNER_DIGITAL_TV, 164 /* Don't need to map V4L2_TUNER_DIGITAL_TV, as tuner-core won't use it */
166 T_STANDBY = 1 << 31
167}; 165};
168 166
169/* Older boards only had a single tuner device. Nowadays multiple tuner 167/* Older boards only had a single tuner device. Nowadays multiple tuner
@@ -193,11 +191,3 @@ struct tuner_setup {
193#endif /* __KERNEL__ */ 191#endif /* __KERNEL__ */
194 192
195#endif /* _TUNER_H */ 193#endif /* _TUNER_H */
196
197/*
198 * Overrides for Emacs so that we follow Linus's tabbing style.
199 * ---------------------------------------------------------------------------
200 * Local variables:
201 * c-basic-offset: 8
202 * End:
203 */
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 44fe44ec9ea7..b3edb67a8311 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -75,6 +75,7 @@ enum {
75 V4L2_IDENT_OV9640 = 257, 75 V4L2_IDENT_OV9640 = 257,
76 V4L2_IDENT_OV6650 = 258, 76 V4L2_IDENT_OV6650 = 258,
77 V4L2_IDENT_OV2640 = 259, 77 V4L2_IDENT_OV2640 = 259,
78 V4L2_IDENT_OV9740 = 260,
78 79
79 /* module saa7146: reserved range 300-309 */ 80 /* module saa7146: reserved range 300-309 */
80 V4L2_IDENT_SAA7146 = 300, 81 V4L2_IDENT_SAA7146 = 300,
@@ -209,6 +210,9 @@ enum {
209 /* module sn9c20x: just ident 10000 */ 210 /* module sn9c20x: just ident 10000 */
210 V4L2_IDENT_SN9C20X = 10000, 211 V4L2_IDENT_SN9C20X = 10000,
211 212
213 /* Siliconfile sensors: reserved range 10100 - 10199 */
214 V4L2_IDENT_NOON010PC30 = 10100,
215
212 /* module cx231xx and cx25840 */ 216 /* module cx231xx and cx25840 */
213 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */ 217 V4L2_IDENT_CX2310X_AV = 23099, /* Integrated A/V decoder; not in '100 */
214 V4L2_IDENT_CX23100 = 23100, 218 V4L2_IDENT_CX23100 = 23100,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a659319e8582..a298ec49ddc4 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -80,21 +80,6 @@
80 80
81/* ------------------------------------------------------------------------- */ 81/* ------------------------------------------------------------------------- */
82 82
83/* Priority helper functions */
84
85struct v4l2_prio_state {
86 atomic_t prios[4];
87};
88void v4l2_prio_init(struct v4l2_prio_state *global);
89int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
90 enum v4l2_priority new);
91void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
92void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
93enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
94int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
95
96/* ------------------------------------------------------------------------- */
97
98/* Control helper functions */ 83/* Control helper functions */
99 84
100int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, 85int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 15802a067a12..8266d5ade2ff 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -16,12 +16,15 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18 18
19#include <media/media-entity.h>
20
19#define VIDEO_MAJOR 81 21#define VIDEO_MAJOR 81
20 22
21#define VFL_TYPE_GRABBER 0 23#define VFL_TYPE_GRABBER 0
22#define VFL_TYPE_VBI 1 24#define VFL_TYPE_VBI 1
23#define VFL_TYPE_RADIO 2 25#define VFL_TYPE_RADIO 2
24#define VFL_TYPE_MAX 3 26#define VFL_TYPE_SUBDEV 3
27#define VFL_TYPE_MAX 4
25 28
26struct v4l2_ioctl_callbacks; 29struct v4l2_ioctl_callbacks;
27struct video_device; 30struct video_device;
@@ -32,7 +35,25 @@ struct v4l2_ctrl_handler;
32 Drivers can clear this flag if they want to block all future 35 Drivers can clear this flag if they want to block all future
33 device access. It is cleared by video_unregister_device. */ 36 device access. It is cleared by video_unregister_device. */
34#define V4L2_FL_REGISTERED (0) 37#define V4L2_FL_REGISTERED (0)
38/* file->private_data points to struct v4l2_fh */
35#define V4L2_FL_USES_V4L2_FH (1) 39#define V4L2_FL_USES_V4L2_FH (1)
40/* Use the prio field of v4l2_fh for core priority checking */
41#define V4L2_FL_USE_FH_PRIO (2)
42
43/* Priority helper functions */
44
45struct v4l2_prio_state {
46 atomic_t prios[4];
47};
48
49void v4l2_prio_init(struct v4l2_prio_state *global);
50int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
51 enum v4l2_priority new);
52void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local);
53void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local);
54enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global);
55int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
56
36 57
37struct v4l2_file_operations { 58struct v4l2_file_operations {
38 struct module *owner; 59 struct module *owner;
@@ -54,6 +75,9 @@ struct v4l2_file_operations {
54 75
55struct video_device 76struct video_device
56{ 77{
78#if defined(CONFIG_MEDIA_CONTROLLER)
79 struct media_entity entity;
80#endif
57 /* device ops */ 81 /* device ops */
58 const struct v4l2_file_operations *fops; 82 const struct v4l2_file_operations *fops;
59 83
@@ -68,6 +92,9 @@ struct video_device
68 /* Control handler associated with this device node. May be NULL. */ 92 /* Control handler associated with this device node. May be NULL. */
69 struct v4l2_ctrl_handler *ctrl_handler; 93 struct v4l2_ctrl_handler *ctrl_handler;
70 94
95 /* Priority state. If NULL, then v4l2_dev->prio will be used. */
96 struct v4l2_prio_state *prio;
97
71 /* device info */ 98 /* device info */
72 char name[32]; 99 char name[32];
73 int vfl_type; 100 int vfl_type;
@@ -99,18 +126,31 @@ struct video_device
99 struct mutex *lock; 126 struct mutex *lock;
100}; 127};
101 128
129#define media_entity_to_video_device(entity) \
130 container_of(entity, struct video_device, entity)
102/* dev to video-device */ 131/* dev to video-device */
103#define to_video_device(cd) container_of(cd, struct video_device, dev) 132#define to_video_device(cd) container_of(cd, struct video_device, dev)
104 133
134int __must_check __video_register_device(struct video_device *vdev, int type,
135 int nr, int warn_if_nr_in_use, struct module *owner);
136
105/* Register video devices. Note that if video_register_device fails, 137/* Register video devices. Note that if video_register_device fails,
106 the release() callback of the video_device structure is *not* called, so 138 the release() callback of the video_device structure is *not* called, so
107 the caller is responsible for freeing any data. Usually that means that 139 the caller is responsible for freeing any data. Usually that means that
108 you call video_device_release() on failure. */ 140 you call video_device_release() on failure. */
109int __must_check video_register_device(struct video_device *vdev, int type, int nr); 141static inline int __must_check video_register_device(struct video_device *vdev,
142 int type, int nr)
143{
144 return __video_register_device(vdev, type, nr, 1, vdev->fops->owner);
145}
110 146
111/* Same as video_register_device, but no warning is issued if the desired 147/* Same as video_register_device, but no warning is issued if the desired
112 device node number was already in use. */ 148 device node number was already in use. */
113int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr); 149static inline int __must_check video_register_device_no_warn(
150 struct video_device *vdev, int type, int nr)
151{
152 return __video_register_device(vdev, type, nr, 0, vdev->fops->owner);
153}
114 154
115/* Unregister video devices. Will do nothing if vdev == NULL or 155/* Unregister video devices. Will do nothing if vdev == NULL or
116 video_is_registered() returns false. */ 156 video_is_registered() returns false. */
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index b16f307d471a..bd102cf509ac 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -21,7 +21,9 @@
21#ifndef _V4L2_DEVICE_H 21#ifndef _V4L2_DEVICE_H
22#define _V4L2_DEVICE_H 22#define _V4L2_DEVICE_H
23 23
24#include <media/media-device.h>
24#include <media/v4l2-subdev.h> 25#include <media/v4l2-subdev.h>
26#include <media/v4l2-dev.h>
25 27
26/* Each instance of a V4L2 device should create the v4l2_device struct, 28/* Each instance of a V4L2 device should create the v4l2_device struct,
27 either stand-alone or embedded in a larger struct. 29 either stand-alone or embedded in a larger struct.
@@ -39,6 +41,9 @@ struct v4l2_device {
39 Note: dev might be NULL if there is no parent device 41 Note: dev might be NULL if there is no parent device
40 as is the case with e.g. ISA devices. */ 42 as is the case with e.g. ISA devices. */
41 struct device *dev; 43 struct device *dev;
44#if defined(CONFIG_MEDIA_CONTROLLER)
45 struct media_device *mdev;
46#endif
42 /* used to keep track of the registered subdevs */ 47 /* used to keep track of the registered subdevs */
43 struct list_head subdevs; 48 struct list_head subdevs;
44 /* lock this struct; can be used by the driver as well if this 49 /* lock this struct; can be used by the driver as well if this
@@ -51,10 +56,23 @@ struct v4l2_device {
51 unsigned int notification, void *arg); 56 unsigned int notification, void *arg);
52 /* The control handler. May be NULL. */ 57 /* The control handler. May be NULL. */
53 struct v4l2_ctrl_handler *ctrl_handler; 58 struct v4l2_ctrl_handler *ctrl_handler;
59 /* Device's priority state */
60 struct v4l2_prio_state prio;
54 /* BKL replacement mutex. Temporary solution only. */ 61 /* BKL replacement mutex. Temporary solution only. */
55 struct mutex ioctl_lock; 62 struct mutex ioctl_lock;
63 /* Keep track of the references to this struct. */
64 struct kref ref;
65 /* Release function that is called when the ref count goes to 0. */
66 void (*release)(struct v4l2_device *v4l2_dev);
56}; 67};
57 68
69static inline void v4l2_device_get(struct v4l2_device *v4l2_dev)
70{
71 kref_get(&v4l2_dev->ref);
72}
73
74int v4l2_device_put(struct v4l2_device *v4l2_dev);
75
58/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. 76/* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev.
59 dev may be NULL in rare cases (ISA devices). In that case you 77 dev may be NULL in rare cases (ISA devices). In that case you
60 must fill in the v4l2_dev->name field before calling this function. */ 78 must fill in the v4l2_dev->name field before calling this function. */
@@ -96,6 +114,12 @@ int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
96 wasn't registered. In that case it will do nothing. */ 114 wasn't registered. In that case it will do nothing. */
97void v4l2_device_unregister_subdev(struct v4l2_subdev *sd); 115void v4l2_device_unregister_subdev(struct v4l2_subdev *sd);
98 116
117/* Register device nodes for all subdev of the v4l2 device that are marked with
118 * the V4L2_SUBDEV_FL_HAS_DEVNODE flag.
119 */
120int __must_check
121v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);
122
99/* Iterate over all subdevs. */ 123/* Iterate over all subdevs. */
100#define v4l2_device_for_each_subdev(sd, v4l2_dev) \ 124#define v4l2_device_for_each_subdev(sd, v4l2_dev) \
101 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list) 125 list_for_each_entry(sd, &(v4l2_dev)->subdevs, list)
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 1d72dde320bf..0206aa55be24 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -35,6 +35,7 @@ struct v4l2_fh {
35 struct list_head list; 35 struct list_head list;
36 struct video_device *vdev; 36 struct video_device *vdev;
37 struct v4l2_events *events; /* events, pending and subscribed */ 37 struct v4l2_events *events; /* events, pending and subscribed */
38 enum v4l2_priority prio;
38}; 39};
39 40
40/* 41/*
@@ -50,8 +51,16 @@ int v4l2_fh_init(struct v4l2_fh *fh, struct video_device *vdev);
50 */ 51 */
51void v4l2_fh_add(struct v4l2_fh *fh); 52void v4l2_fh_add(struct v4l2_fh *fh);
52/* 53/*
54 * Can be used as the open() op of v4l2_file_operations.
55 * It allocates a v4l2_fh and inits and adds it to the video_device associated
56 * with the file pointer.
57 */
58int v4l2_fh_open(struct file *filp);
59/*
53 * Remove file handle from the list of file handles. Must be called in 60 * Remove file handle from the list of file handles. Must be called in
54 * v4l2_file_operations->release() handler if the driver uses v4l2_fh. 61 * v4l2_file_operations->release() handler if the driver uses v4l2_fh.
62 * On error filp->private_data will be NULL, otherwise it will point to
63 * the v4l2_fh struct.
55 */ 64 */
56void v4l2_fh_del(struct v4l2_fh *fh); 65void v4l2_fh_del(struct v4l2_fh *fh);
57/* 66/*
@@ -61,5 +70,25 @@ void v4l2_fh_del(struct v4l2_fh *fh);
61 * driver uses v4l2_fh. 70 * driver uses v4l2_fh.
62 */ 71 */
63void v4l2_fh_exit(struct v4l2_fh *fh); 72void v4l2_fh_exit(struct v4l2_fh *fh);
73/*
74 * Can be used as the release() op of v4l2_file_operations.
75 * It deletes and exits the v4l2_fh associated with the file pointer and
76 * frees it. It will do nothing if filp->private_data (the pointer to the
77 * v4l2_fh struct) is NULL. This function always returns 0.
78 */
79int v4l2_fh_release(struct file *filp);
80/*
81 * Returns 1 if this filehandle is the only filehandle opened for the
82 * associated video_device. If fh is NULL, then it returns 0.
83 */
84int v4l2_fh_is_singular(struct v4l2_fh *fh);
85/*
86 * Helper function with struct file as argument. If filp->private_data is
87 * NULL, then it will return 0.
88 */
89static inline int v4l2_fh_is_singular_file(struct file *filp)
90{
91 return v4l2_fh_is_singular(filp->private_data);
92}
64 93
65#endif /* V4L2_EVENT_H */ 94#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 67df37542c68..dd9f1e7b8ff7 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -37,6 +37,10 @@ struct v4l2_ioctl_ops {
37 struct v4l2_fmtdesc *f); 37 struct v4l2_fmtdesc *f);
38 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh, 38 int (*vidioc_enum_fmt_vid_out) (struct file *file, void *fh,
39 struct v4l2_fmtdesc *f); 39 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_vid_cap_mplane)(struct file *file, void *fh,
41 struct v4l2_fmtdesc *f);
42 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
43 struct v4l2_fmtdesc *f);
40 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh, 44 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
41 struct v4l2_fmtdesc *f); 45 struct v4l2_fmtdesc *f);
42 46
@@ -57,6 +61,10 @@ struct v4l2_ioctl_ops {
57 struct v4l2_format *f); 61 struct v4l2_format *f);
58 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh, 62 int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
59 struct v4l2_format *f); 63 struct v4l2_format *f);
64 int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
65 struct v4l2_format *f);
66 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
67 struct v4l2_format *f);
60 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh, 68 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
61 struct v4l2_format *f); 69 struct v4l2_format *f);
62 70
@@ -77,6 +85,10 @@ struct v4l2_ioctl_ops {
77 struct v4l2_format *f); 85 struct v4l2_format *f);
78 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh, 86 int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
79 struct v4l2_format *f); 87 struct v4l2_format *f);
88 int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
89 struct v4l2_format *f);
90 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
91 struct v4l2_format *f);
80 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh, 92 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
81 struct v4l2_format *f); 93 struct v4l2_format *f);
82 94
@@ -97,6 +109,10 @@ struct v4l2_ioctl_ops {
97 struct v4l2_format *f); 109 struct v4l2_format *f);
98 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh, 110 int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
99 struct v4l2_format *f); 111 struct v4l2_format *f);
112 int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
113 struct v4l2_format *f);
114 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
115 struct v4l2_format *f);
100 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh, 116 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
101 struct v4l2_format *f); 117 struct v4l2_format *f);
102 118
@@ -254,7 +270,7 @@ struct v4l2_ioctl_ops {
254 270
255 /* For other private ioctls */ 271 /* For other private ioctls */
256 long (*vidioc_default) (struct file *file, void *fh, 272 long (*vidioc_default) (struct file *file, void *fh,
257 int cmd, void *arg); 273 bool valid_prio, int cmd, void *arg);
258}; 274};
259 275
260 276
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 8e6559838ae3..971c7fa29614 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -11,66 +11,7 @@
11#ifndef V4L2_MEDIABUS_H 11#ifndef V4L2_MEDIABUS_H
12#define V4L2_MEDIABUS_H 12#define V4L2_MEDIABUS_H
13 13
14/* 14#include <linux/v4l2-mediabus.h>
15 * These pixel codes uniquely identify data formats on the media bus. Mostly
16 * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
17 * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
18 * data format is fixed. Additionally, "2X8" means that one pixel is transferred
19 * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
20 * transferred over the bus: "LE" means that the least significant bits are
21 * transferred first, "BE" means that the most significant bits are transferred
22 * first, and "PADHI" and "PADLO" define which bits - low or high, in the
23 * incomplete high byte, are filled with padding bits.
24 */
25enum v4l2_mbus_pixelcode {
26 V4L2_MBUS_FMT_FIXED = 1,
27 V4L2_MBUS_FMT_YUYV8_2X8,
28 V4L2_MBUS_FMT_YVYU8_2X8,
29 V4L2_MBUS_FMT_UYVY8_2X8,
30 V4L2_MBUS_FMT_VYUY8_2X8,
31 V4L2_MBUS_FMT_YVYU10_2X10,
32 V4L2_MBUS_FMT_YUYV10_2X10,
33 V4L2_MBUS_FMT_YVYU10_1X20,
34 V4L2_MBUS_FMT_YUYV10_1X20,
35 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
36 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE,
37 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
38 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
39 V4L2_MBUS_FMT_RGB565_2X8_LE,
40 V4L2_MBUS_FMT_RGB565_2X8_BE,
41 V4L2_MBUS_FMT_BGR565_2X8_LE,
42 V4L2_MBUS_FMT_BGR565_2X8_BE,
43 V4L2_MBUS_FMT_SBGGR8_1X8,
44 V4L2_MBUS_FMT_SBGGR10_1X10,
45 V4L2_MBUS_FMT_GREY8_1X8,
46 V4L2_MBUS_FMT_Y10_1X10,
47 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
48 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
49 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
50 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
51 V4L2_MBUS_FMT_SGRBG8_1X8,
52 V4L2_MBUS_FMT_SBGGR12_1X12,
53 V4L2_MBUS_FMT_YUYV8_1_5X8,
54 V4L2_MBUS_FMT_YVYU8_1_5X8,
55 V4L2_MBUS_FMT_UYVY8_1_5X8,
56 V4L2_MBUS_FMT_VYUY8_1_5X8,
57};
58
59/**
60 * struct v4l2_mbus_framefmt - frame format on the media bus
61 * @width: frame width
62 * @height: frame height
63 * @code: data format code
64 * @field: used interlacing type
65 * @colorspace: colorspace of the data
66 */
67struct v4l2_mbus_framefmt {
68 __u32 width;
69 __u32 height;
70 enum v4l2_mbus_pixelcode code;
71 enum v4l2_field field;
72 enum v4l2_colorspace colorspace;
73};
74 15
75static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, 16static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt,
76 const struct v4l2_mbus_framefmt *mbus_fmt) 17 const struct v4l2_mbus_framefmt *mbus_fmt)
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 8d149f1c58d0..16ac4733e80d 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -5,7 +5,7 @@
5 * and destination. 5 * and destination.
6 * 6 *
7 * Copyright (c) 2009 Samsung Electronics Co., Ltd. 7 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
8 * Pawel Osciak, <p.osciak@samsung.com> 8 * Pawel Osciak, <pawel@osciak.com>
9 * Marek Szyprowski, <m.szyprowski@samsung.com> 9 * Marek Szyprowski, <m.szyprowski@samsung.com>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@
17#ifndef _MEDIA_V4L2_MEM2MEM_H 17#ifndef _MEDIA_V4L2_MEM2MEM_H
18#define _MEDIA_V4L2_MEM2MEM_H 18#define _MEDIA_V4L2_MEM2MEM_H
19 19
20#include <media/videobuf-core.h> 20#include <media/videobuf2-core.h>
21 21
22/** 22/**
23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks 23 * struct v4l2_m2m_ops - mem-to-mem device driver callbacks
@@ -45,17 +45,20 @@ struct v4l2_m2m_ops {
45 void (*device_run)(void *priv); 45 void (*device_run)(void *priv);
46 int (*job_ready)(void *priv); 46 int (*job_ready)(void *priv);
47 void (*job_abort)(void *priv); 47 void (*job_abort)(void *priv);
48 void (*lock)(void *priv);
49 void (*unlock)(void *priv);
48}; 50};
49 51
50struct v4l2_m2m_dev; 52struct v4l2_m2m_dev;
51 53
52struct v4l2_m2m_queue_ctx { 54struct v4l2_m2m_queue_ctx {
53/* private: internal use only */ 55/* private: internal use only */
54 struct videobuf_queue q; 56 struct vb2_queue q;
55 57
56 /* Queue for buffers ready to be processed as soon as this 58 /* Queue for buffers ready to be processed as soon as this
57 * instance receives access to the device */ 59 * instance receives access to the device */
58 struct list_head rdy_queue; 60 struct list_head rdy_queue;
61 spinlock_t rdy_spinlock;
59 u8 num_rdy; 62 u8 num_rdy;
60}; 63};
61 64
@@ -72,19 +75,31 @@ struct v4l2_m2m_ctx {
72 /* For device job queue */ 75 /* For device job queue */
73 struct list_head queue; 76 struct list_head queue;
74 unsigned long job_flags; 77 unsigned long job_flags;
78 wait_queue_head_t finished;
75 79
76 /* Instance private data */ 80 /* Instance private data */
77 void *priv; 81 void *priv;
78}; 82};
79 83
84struct v4l2_m2m_buffer {
85 struct vb2_buffer vb;
86 struct list_head list;
87};
88
80void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev); 89void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
81 90
82struct videobuf_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx, 91struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
83 enum v4l2_buf_type type); 92 enum v4l2_buf_type type);
84 93
85void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev, 94void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
86 struct v4l2_m2m_ctx *m2m_ctx); 95 struct v4l2_m2m_ctx *m2m_ctx);
87 96
97static inline void
98v4l2_m2m_buf_done(struct vb2_buffer *buf, enum vb2_buffer_state state)
99{
100 vb2_buffer_done(buf, state);
101}
102
88int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 103int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
89 struct v4l2_requestbuffers *reqbufs); 104 struct v4l2_requestbuffers *reqbufs);
90 105
@@ -110,13 +125,13 @@ int v4l2_m2m_mmap(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
110struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops); 125struct v4l2_m2m_dev *v4l2_m2m_init(struct v4l2_m2m_ops *m2m_ops);
111void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev); 126void v4l2_m2m_release(struct v4l2_m2m_dev *m2m_dev);
112 127
113struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(void *priv, struct v4l2_m2m_dev *m2m_dev, 128struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev,
114 void (*vq_init)(void *priv, struct videobuf_queue *, 129 void *drv_priv,
115 enum v4l2_buf_type)); 130 int (*queue_init)(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq));
131
116void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx); 132void v4l2_m2m_ctx_release(struct v4l2_m2m_ctx *m2m_ctx);
117 133
118void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct videobuf_queue *vq, 134void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);
119 struct videobuf_buffer *vb);
120 135
121/** 136/**
122 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for 137 * v4l2_m2m_num_src_bufs_ready() - return the number of source buffers ready for
@@ -138,7 +153,7 @@ unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
138 return m2m_ctx->out_q_ctx.num_rdy; 153 return m2m_ctx->out_q_ctx.num_rdy;
139} 154}
140 155
141void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); 156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx);
142 157
143/** 158/**
144 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready 159 * v4l2_m2m_next_src_buf() - return next source buffer from the list of ready
@@ -146,7 +161,7 @@ void *v4l2_m2m_next_buf(struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type);
146 */ 161 */
147static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx) 162static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
148{ 163{
149 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 164 return v4l2_m2m_next_buf(&m2m_ctx->out_q_ctx);
150} 165}
151 166
152/** 167/**
@@ -155,29 +170,28 @@ static inline void *v4l2_m2m_next_src_buf(struct v4l2_m2m_ctx *m2m_ctx)
155 */ 170 */
156static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx) 171static inline void *v4l2_m2m_next_dst_buf(struct v4l2_m2m_ctx *m2m_ctx)
157{ 172{
158 return v4l2_m2m_next_buf(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 173 return v4l2_m2m_next_buf(&m2m_ctx->cap_q_ctx);
159} 174}
160 175
161/** 176/**
162 * v4l2_m2m_get_src_vq() - return videobuf_queue for source buffers 177 * v4l2_m2m_get_src_vq() - return vb2_queue for source buffers
163 */ 178 */
164static inline 179static inline
165struct videobuf_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx) 180struct vb2_queue *v4l2_m2m_get_src_vq(struct v4l2_m2m_ctx *m2m_ctx)
166{ 181{
167 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 182 return &m2m_ctx->out_q_ctx.q;
168} 183}
169 184
170/** 185/**
171 * v4l2_m2m_get_dst_vq() - return videobuf_queue for destination buffers 186 * v4l2_m2m_get_dst_vq() - return vb2_queue for destination buffers
172 */ 187 */
173static inline 188static inline
174struct videobuf_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx) 189struct vb2_queue *v4l2_m2m_get_dst_vq(struct v4l2_m2m_ctx *m2m_ctx)
175{ 190{
176 return v4l2_m2m_get_vq(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 191 return &m2m_ctx->cap_q_ctx.q;
177} 192}
178 193
179void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx, 194void *v4l2_m2m_buf_remove(struct v4l2_m2m_queue_ctx *q_ctx);
180 enum v4l2_buf_type type);
181 195
182/** 196/**
183 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready 197 * v4l2_m2m_src_buf_remove() - take off a source buffer from the list of ready
@@ -185,7 +199,7 @@ void *v4l2_m2m_buf_remove(struct v4l2_m2m_ctx *m2m_ctx,
185 */ 199 */
186static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 200static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
187{ 201{
188 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 202 return v4l2_m2m_buf_remove(&m2m_ctx->out_q_ctx);
189} 203}
190 204
191/** 205/**
@@ -194,7 +208,7 @@ static inline void *v4l2_m2m_src_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
194 */ 208 */
195static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx) 209static inline void *v4l2_m2m_dst_buf_remove(struct v4l2_m2m_ctx *m2m_ctx)
196{ 210{
197 return v4l2_m2m_buf_remove(m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); 211 return v4l2_m2m_buf_remove(&m2m_ctx->cap_q_ctx);
198} 212}
199 213
200#endif /* _MEDIA_V4L2_MEM2MEM_H */ 214#endif /* _MEDIA_V4L2_MEM2MEM_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index daf1e57d9b26..1562c4ff3a65 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -21,7 +21,11 @@
21#ifndef _V4L2_SUBDEV_H 21#ifndef _V4L2_SUBDEV_H
22#define _V4L2_SUBDEV_H 22#define _V4L2_SUBDEV_H
23 23
24#include <linux/v4l2-subdev.h>
25#include <media/media-entity.h>
24#include <media/v4l2-common.h> 26#include <media/v4l2-common.h>
27#include <media/v4l2-dev.h>
28#include <media/v4l2-fh.h>
25#include <media/v4l2-mediabus.h> 29#include <media/v4l2-mediabus.h>
26 30
27/* generic v4l2_device notify callback notification values */ 31/* generic v4l2_device notify callback notification values */
@@ -36,7 +40,10 @@
36 40
37struct v4l2_device; 41struct v4l2_device;
38struct v4l2_ctrl_handler; 42struct v4l2_ctrl_handler;
43struct v4l2_event_subscription;
44struct v4l2_fh;
39struct v4l2_subdev; 45struct v4l2_subdev;
46struct v4l2_subdev_fh;
40struct tuner_setup; 47struct tuner_setup;
41 48
42/* decode_vbi_line */ 49/* decode_vbi_line */
@@ -160,6 +167,10 @@ struct v4l2_subdev_core_ops {
160 int (*s_power)(struct v4l2_subdev *sd, int on); 167 int (*s_power)(struct v4l2_subdev *sd, int on);
161 int (*interrupt_service_routine)(struct v4l2_subdev *sd, 168 int (*interrupt_service_routine)(struct v4l2_subdev *sd,
162 u32 status, bool *handled); 169 u32 status, bool *handled);
170 int (*subscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
171 struct v4l2_event_subscription *sub);
172 int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
173 struct v4l2_event_subscription *sub);
163}; 174};
164 175
165/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 176/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -257,6 +268,10 @@ struct v4l2_subdev_video_ops {
257 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 268 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
258 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 269 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
259 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 270 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
271 int (*g_frame_interval)(struct v4l2_subdev *sd,
272 struct v4l2_subdev_frame_interval *interval);
273 int (*s_frame_interval)(struct v4l2_subdev *sd,
274 struct v4l2_subdev_frame_interval *interval);
260 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); 275 int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);
261 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); 276 int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival);
262 int (*enum_dv_presets) (struct v4l2_subdev *sd, 277 int (*enum_dv_presets) (struct v4l2_subdev *sd,
@@ -271,6 +286,8 @@ struct v4l2_subdev_video_ops {
271 struct v4l2_dv_timings *timings); 286 struct v4l2_dv_timings *timings);
272 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, 287 int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
273 enum v4l2_mbus_pixelcode *code); 288 enum v4l2_mbus_pixelcode *code);
289 int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
290 struct v4l2_frmsizeenum *fsize);
274 int (*g_mbus_fmt)(struct v4l2_subdev *sd, 291 int (*g_mbus_fmt)(struct v4l2_subdev *sd,
275 struct v4l2_mbus_framefmt *fmt); 292 struct v4l2_mbus_framefmt *fmt);
276 int (*try_mbus_fmt)(struct v4l2_subdev *sd, 293 int (*try_mbus_fmt)(struct v4l2_subdev *sd,
@@ -324,9 +341,13 @@ struct v4l2_subdev_vbi_ops {
324 * This is needed for some sensors, which always corrupt 341 * This is needed for some sensors, which always corrupt
325 * several top lines of the output image, or which send their 342 * several top lines of the output image, or which send their
326 * metadata in them. 343 * metadata in them.
344 * @g_skip_frames: number of frames to skip at stream start. This is needed for
345 * buggy sensors that generate faulty frames when they are
346 * turned on.
327 */ 347 */
328struct v4l2_subdev_sensor_ops { 348struct v4l2_subdev_sensor_ops {
329 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines); 349 int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
350 int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
330}; 351};
331 352
332/* 353/*
@@ -401,6 +422,25 @@ struct v4l2_subdev_ir_ops {
401 struct v4l2_subdev_ir_parameters *params); 422 struct v4l2_subdev_ir_parameters *params);
402}; 423};
403 424
425struct v4l2_subdev_pad_ops {
426 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
427 struct v4l2_subdev_mbus_code_enum *code);
428 int (*enum_frame_size)(struct v4l2_subdev *sd,
429 struct v4l2_subdev_fh *fh,
430 struct v4l2_subdev_frame_size_enum *fse);
431 int (*enum_frame_interval)(struct v4l2_subdev *sd,
432 struct v4l2_subdev_fh *fh,
433 struct v4l2_subdev_frame_interval_enum *fie);
434 int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
435 struct v4l2_subdev_format *format);
436 int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
437 struct v4l2_subdev_format *format);
438 int (*set_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
439 struct v4l2_subdev_crop *crop);
440 int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
441 struct v4l2_subdev_crop *crop);
442};
443
404struct v4l2_subdev_ops { 444struct v4l2_subdev_ops {
405 const struct v4l2_subdev_core_ops *core; 445 const struct v4l2_subdev_core_ops *core;
406 const struct v4l2_subdev_tuner_ops *tuner; 446 const struct v4l2_subdev_tuner_ops *tuner;
@@ -409,6 +449,7 @@ struct v4l2_subdev_ops {
409 const struct v4l2_subdev_vbi_ops *vbi; 449 const struct v4l2_subdev_vbi_ops *vbi;
410 const struct v4l2_subdev_ir_ops *ir; 450 const struct v4l2_subdev_ir_ops *ir;
411 const struct v4l2_subdev_sensor_ops *sensor; 451 const struct v4l2_subdev_sensor_ops *sensor;
452 const struct v4l2_subdev_pad_ops *pad;
412}; 453};
413 454
414/* 455/*
@@ -420,23 +461,36 @@ struct v4l2_subdev_ops {
420 * 461 *
421 * unregistered: called when this subdev is unregistered. When called the 462 * unregistered: called when this subdev is unregistered. When called the
422 * v4l2_dev field is still set to the correct v4l2_device. 463 * v4l2_dev field is still set to the correct v4l2_device.
464 *
465 * open: called when the subdev device node is opened by an application.
466 *
467 * close: called when the subdev device node is closed.
423 */ 468 */
424struct v4l2_subdev_internal_ops { 469struct v4l2_subdev_internal_ops {
425 int (*registered)(struct v4l2_subdev *sd); 470 int (*registered)(struct v4l2_subdev *sd);
426 void (*unregistered)(struct v4l2_subdev *sd); 471 void (*unregistered)(struct v4l2_subdev *sd);
472 int (*open)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
473 int (*close)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh);
427}; 474};
428 475
429#define V4L2_SUBDEV_NAME_SIZE 32 476#define V4L2_SUBDEV_NAME_SIZE 32
430 477
431/* Set this flag if this subdev is a i2c device. */ 478/* Set this flag if this subdev is a i2c device. */
432#define V4L2_SUBDEV_FL_IS_I2C (1U << 0) 479#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
433/* Set this flag if this subdev is a spi device. */ 480/* Set this flag if this subdev is a spi device. */
434#define V4L2_SUBDEV_FL_IS_SPI (1U << 1) 481#define V4L2_SUBDEV_FL_IS_SPI (1U << 1)
482/* Set this flag if this subdev needs a device node. */
483#define V4L2_SUBDEV_FL_HAS_DEVNODE (1U << 2)
484/* Set this flag if this subdev generates events. */
485#define V4L2_SUBDEV_FL_HAS_EVENTS (1U << 3)
435 486
436/* Each instance of a subdev driver should create this struct, either 487/* Each instance of a subdev driver should create this struct, either
437 stand-alone or embedded in a larger struct. 488 stand-alone or embedded in a larger struct.
438 */ 489 */
439struct v4l2_subdev { 490struct v4l2_subdev {
491#if defined(CONFIG_MEDIA_CONTROLLER)
492 struct media_entity entity;
493#endif
440 struct list_head list; 494 struct list_head list;
441 struct module *owner; 495 struct module *owner;
442 u32 flags; 496 u32 flags;
@@ -453,8 +507,47 @@ struct v4l2_subdev {
453 /* pointer to private data */ 507 /* pointer to private data */
454 void *dev_priv; 508 void *dev_priv;
455 void *host_priv; 509 void *host_priv;
510 /* subdev device node */
511 struct video_device devnode;
512 /* number of events to be allocated on open */
513 unsigned int nevents;
514};
515
516#define media_entity_to_v4l2_subdev(ent) \
517 container_of(ent, struct v4l2_subdev, entity)
518#define vdev_to_v4l2_subdev(vdev) \
519 container_of(vdev, struct v4l2_subdev, devnode)
520
521/*
522 * Used for storing subdev information per file handle
523 */
524struct v4l2_subdev_fh {
525 struct v4l2_fh vfh;
526#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
527 struct v4l2_mbus_framefmt *try_fmt;
528 struct v4l2_rect *try_crop;
529#endif
456}; 530};
457 531
532#define to_v4l2_subdev_fh(fh) \
533 container_of(fh, struct v4l2_subdev_fh, vfh)
534
535#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
536static inline struct v4l2_mbus_framefmt *
537v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad)
538{
539 return &fh->try_fmt[pad];
540}
541
542static inline struct v4l2_rect *
543v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad)
544{
545 return &fh->try_crop[pad];
546}
547#endif
548
549extern const struct v4l2_file_operations v4l2_subdev_fops;
550
458static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p) 551static inline void v4l2_set_subdevdata(struct v4l2_subdev *sd, void *p)
459{ 552{
460 sd->dev_priv = p; 553 sd->dev_priv = p;
@@ -475,20 +568,8 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd)
475 return sd->host_priv; 568 return sd->host_priv;
476} 569}
477 570
478static inline void v4l2_subdev_init(struct v4l2_subdev *sd, 571void v4l2_subdev_init(struct v4l2_subdev *sd,
479 const struct v4l2_subdev_ops *ops) 572 const struct v4l2_subdev_ops *ops);
480{
481 INIT_LIST_HEAD(&sd->list);
482 /* ops->core MUST be set */
483 BUG_ON(!ops || !ops->core);
484 sd->ops = ops;
485 sd->v4l2_dev = NULL;
486 sd->flags = 0;
487 sd->name[0] = '\0';
488 sd->grp_id = 0;
489 sd->dev_priv = NULL;
490 sd->host_priv = NULL;
491}
492 573
493/* Call an ops of a v4l2_subdev, doing the right checks against 574/* Call an ops of a v4l2_subdev, doing the right checks against
494 NULL pointers. 575 NULL pointers.
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
new file mode 100644
index 000000000000..f87472acbc51
--- /dev/null
+++ b/include/media/videobuf2-core.h
@@ -0,0 +1,380 @@
1/*
2 * videobuf2-core.h - V4L2 driver helper framework
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12#ifndef _MEDIA_VIDEOBUF2_CORE_H
13#define _MEDIA_VIDEOBUF2_CORE_H
14
15#include <linux/mm_types.h>
16#include <linux/mutex.h>
17#include <linux/poll.h>
18#include <linux/videodev2.h>
19
20struct vb2_alloc_ctx;
21struct vb2_fileio_data;
22
23/**
24 * struct vb2_mem_ops - memory handling/memory allocator operations
25 * @alloc: allocate video memory and, optionally, allocator private data,
26 * return NULL on failure or a pointer to allocator private,
27 * per-buffer data on success; the returned private structure
28 * will then be passed as buf_priv argument to other ops in this
29 * structure
30 * @put: inform the allocator that the buffer will no longer be used;
31 * usually will result in the allocator freeing the buffer (if
32 * no other users of this buffer are present); the buf_priv
33 * argument is the allocator private per-buffer structure
34 * previously returned from the alloc callback
35 * @get_userptr: acquire userspace memory for a hardware operation; used for
36 * USERPTR memory types; vaddr is the address passed to the
37 * videobuf layer when queuing a video buffer of USERPTR type;
38 * should return an allocator private per-buffer structure
39 * associated with the buffer on success, NULL on failure;
40 * the returned private structure will then be passed as buf_priv
41 * argument to other ops in this structure
42 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
43 * be used
44 * @vaddr: return a kernel virtual address to a given memory buffer
45 * associated with the passed private structure or NULL if no
46 * such mapping exists
47 * @cookie: return allocator specific cookie for a given memory buffer
48 * associated with the passed private structure or NULL if not
49 * available
50 * @num_users: return the current number of users of a memory buffer;
51 * return 1 if the videobuf layer (or actually the driver using
52 * it) is the only user
53 * @mmap: setup a userspace mapping for a given memory buffer under
54 * the provided virtual memory region
55 *
56 * Required ops for USERPTR types: get_userptr, put_userptr.
57 * Required ops for MMAP types: alloc, put, num_users, mmap.
58 * Required ops for read/write access types: alloc, put, num_users, vaddr
59 */
60struct vb2_mem_ops {
61 void *(*alloc)(void *alloc_ctx, unsigned long size);
62 void (*put)(void *buf_priv);
63
64 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
65 unsigned long size, int write);
66 void (*put_userptr)(void *buf_priv);
67
68 void *(*vaddr)(void *buf_priv);
69 void *(*cookie)(void *buf_priv);
70
71 unsigned int (*num_users)(void *buf_priv);
72
73 int (*mmap)(void *buf_priv, struct vm_area_struct *vma);
74};
75
76struct vb2_plane {
77 void *mem_priv;
78 int mapped:1;
79};
80
81/**
82 * enum vb2_io_modes - queue access methods
83 * @VB2_MMAP: driver supports MMAP with streaming API
84 * @VB2_USERPTR: driver supports USERPTR with streaming API
85 * @VB2_READ: driver supports read() style access
86 * @VB2_WRITE: driver supports write() style access
87 */
88enum vb2_io_modes {
89 VB2_MMAP = (1 << 0),
90 VB2_USERPTR = (1 << 1),
91 VB2_READ = (1 << 2),
92 VB2_WRITE = (1 << 3),
93};
94
95/**
96 * enum vb2_fileio_flags - flags for selecting a mode of the file io emulator,
97 * by default the 'streaming' style is used by the file io emulator
98 * @VB2_FILEIO_READ_ONCE: report EOF after reading the first buffer
99 * @VB2_FILEIO_WRITE_IMMEDIATELY: queue buffer after each write() call
100 */
101enum vb2_fileio_flags {
102 VB2_FILEIO_READ_ONCE = (1 << 0),
103 VB2_FILEIO_WRITE_IMMEDIATELY = (1 << 1),
104};
105
106/**
107 * enum vb2_buffer_state - current video buffer state
108 * @VB2_BUF_STATE_DEQUEUED: buffer under userspace control
109 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver
110 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used
111 * in a hardware operation
112 * @VB2_BUF_STATE_DONE: buffer returned from driver to videobuf, but
113 * not yet dequeued to userspace
114 * @VB2_BUF_STATE_ERROR: same as above, but the operation on the buffer
115 * has ended with an error, which will be reported
116 * to the userspace when it is dequeued
117 */
118enum vb2_buffer_state {
119 VB2_BUF_STATE_DEQUEUED,
120 VB2_BUF_STATE_QUEUED,
121 VB2_BUF_STATE_ACTIVE,
122 VB2_BUF_STATE_DONE,
123 VB2_BUF_STATE_ERROR,
124};
125
126struct vb2_queue;
127
128/**
129 * struct vb2_buffer - represents a video buffer
130 * @v4l2_buf: struct v4l2_buffer associated with this buffer; can
131 * be read by the driver and relevant entries can be
132 * changed by the driver in case of CAPTURE types
133 * (such as timestamp)
134 * @v4l2_planes: struct v4l2_planes associated with this buffer; can
135 * be read by the driver and relevant entries can be
136 * changed by the driver in case of CAPTURE types
137 * (such as bytesused); NOTE that even for single-planar
138 * types, the v4l2_planes[0] struct should be used
139 * instead of v4l2_buf for filling bytesused - drivers
140 * should use the vb2_set_plane_payload() function for that
141 * @vb2_queue: the queue to which this driver belongs
142 * @num_planes: number of planes in the buffer
143 * on an internal driver queue
144 * @state: current buffer state; do not change
145 * @queued_entry: entry on the queued buffers list, which holds all
146 * buffers queued from userspace
147 * @done_entry: entry on the list that stores all buffers ready to
148 * be dequeued to userspace
149 * @planes: private per-plane information; do not change
150 * @num_planes_mapped: number of mapped planes; do not change
151 */
152struct vb2_buffer {
153 struct v4l2_buffer v4l2_buf;
154 struct v4l2_plane v4l2_planes[VIDEO_MAX_PLANES];
155
156 struct vb2_queue *vb2_queue;
157
158 unsigned int num_planes;
159
160/* Private: internal use only */
161 enum vb2_buffer_state state;
162
163 struct list_head queued_entry;
164 struct list_head done_entry;
165
166 struct vb2_plane planes[VIDEO_MAX_PLANES];
167 unsigned int num_planes_mapped;
168};
169
170/**
171 * struct vb2_ops - driver-specific callbacks
172 *
173 * @queue_setup: called from a VIDIOC_REQBUFS handler, before
174 * memory allocation; driver should return the required
175 * number of buffers in num_buffers, the required number
176 * of planes per buffer in num_planes; the size of each
177 * plane should be set in the sizes[] array and optional
178 * per-plane allocator specific context in alloc_ctxs[]
179 * array
180 * @wait_prepare: release any locks taken while calling vb2 functions;
181 * it is called before an ioctl needs to wait for a new
182 * buffer to arrive; required to avoid a deadlock in
183 * blocking access type
184 * @wait_finish: reacquire all locks released in the previous callback;
185 * required to continue operation after sleeping while
186 * waiting for a new buffer to arrive
187 * @buf_init: called once after allocating a buffer (in MMAP case)
188 * or after acquiring a new USERPTR buffer; drivers may
189 * perform additional buffer-related initialization;
190 * initialization failure (return != 0) will prevent
191 * queue setup from completing successfully; optional
192 * @buf_prepare: called every time the buffer is queued from userspace;
193 * drivers may perform any initialization required before
194 * each hardware operation in this callback;
195 * if an error is returned, the buffer will not be queued
196 * in driver; optional
197 * @buf_finish: called before every dequeue of the buffer back to
198 * userspace; drivers may perform any operations required
199 * before userspace accesses the buffer; optional
200 * @buf_cleanup: called once before the buffer is freed; drivers may
201 * perform any additional cleanup; optional
202 * @start_streaming: called once before entering 'streaming' state; enables
203 * driver to receive buffers over buf_queue() callback
204 * @stop_streaming: called when 'streaming' state must be disabled; driver
205 * should stop any DMA transactions or wait until they
206 * finish and give back all buffers it got from buf_queue()
207 * callback; may use vb2_wait_for_all_buffers() function
208 * @buf_queue: passes buffer vb to the driver; driver may start
209 * hardware operation on this buffer; driver should give
210 * the buffer back by calling vb2_buffer_done() function
211 */
212struct vb2_ops {
213 int (*queue_setup)(struct vb2_queue *q, unsigned int *num_buffers,
214 unsigned int *num_planes, unsigned long sizes[],
215 void *alloc_ctxs[]);
216
217 void (*wait_prepare)(struct vb2_queue *q);
218 void (*wait_finish)(struct vb2_queue *q);
219
220 int (*buf_init)(struct vb2_buffer *vb);
221 int (*buf_prepare)(struct vb2_buffer *vb);
222 int (*buf_finish)(struct vb2_buffer *vb);
223 void (*buf_cleanup)(struct vb2_buffer *vb);
224
225 int (*start_streaming)(struct vb2_queue *q);
226 int (*stop_streaming)(struct vb2_queue *q);
227
228 void (*buf_queue)(struct vb2_buffer *vb);
229};
230
231/**
232 * struct vb2_queue - a videobuf queue
233 *
234 * @type: queue type (see V4L2_BUF_TYPE_* in linux/videodev2.h
235 * @io_modes: supported io methods (see vb2_io_modes enum)
236 * @io_flags: additional io flags (see vb2_fileio_flags enum)
237 * @ops: driver-specific callbacks
238 * @mem_ops: memory allocator specific callbacks
239 * @drv_priv: driver private data
240 * @buf_struct_size: size of the driver-specific buffer structure;
241 * "0" indicates the driver doesn't want to use a custom buffer
242 * structure type, so sizeof(struct vb2_buffer) will is used
243 *
244 * @memory: current memory type used
245 * @bufs: videobuf buffer structures
246 * @num_buffers: number of allocated/used buffers
247 * @queued_list: list of buffers currently queued from userspace
248 * @queued_count: number of buffers owned by the driver
249 * @done_list: list of buffers ready to be dequeued to userspace
250 * @done_lock: lock to protect done_list list
251 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
252 * @alloc_ctx: memory type/allocator-specific contexts for each plane
253 * @streaming: current streaming state
254 * @fileio: file io emulator internal data, used only if emulator is active
255 */
256struct vb2_queue {
257 enum v4l2_buf_type type;
258 unsigned int io_modes;
259 unsigned int io_flags;
260
261 const struct vb2_ops *ops;
262 const struct vb2_mem_ops *mem_ops;
263 void *drv_priv;
264 unsigned int buf_struct_size;
265
266/* private: internal use only */
267 enum v4l2_memory memory;
268 struct vb2_buffer *bufs[VIDEO_MAX_FRAME];
269 unsigned int num_buffers;
270
271 struct list_head queued_list;
272
273 atomic_t queued_count;
274 struct list_head done_list;
275 spinlock_t done_lock;
276 wait_queue_head_t done_wq;
277
278 void *alloc_ctx[VIDEO_MAX_PLANES];
279
280 unsigned int streaming:1;
281
282 struct vb2_fileio_data *fileio;
283};
284
285void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no);
286void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no);
287
288void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
289int vb2_wait_for_all_buffers(struct vb2_queue *q);
290
291int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
292int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
293
294int vb2_queue_init(struct vb2_queue *q);
295
296void vb2_queue_release(struct vb2_queue *q);
297
298int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
299int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
300
301int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
302int vb2_streamoff(struct vb2_queue *q, enum v4l2_buf_type type);
303
304int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma);
305unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait);
306size_t vb2_read(struct vb2_queue *q, char __user *data, size_t count,
307 loff_t *ppos, int nonblock);
308size_t vb2_write(struct vb2_queue *q, char __user *data, size_t count,
309 loff_t *ppos, int nonblock);
310
311/**
312 * vb2_is_streaming() - return streaming status of the queue
313 * @q: videobuf queue
314 */
315static inline bool vb2_is_streaming(struct vb2_queue *q)
316{
317 return q->streaming;
318}
319
320/**
321 * vb2_is_busy() - return busy status of the queue
322 * @q: videobuf queue
323 *
324 * This function checks if queue has any buffers allocated.
325 */
326static inline bool vb2_is_busy(struct vb2_queue *q)
327{
328 return (q->num_buffers > 0);
329}
330
331/**
332 * vb2_get_drv_priv() - return driver private data associated with the queue
333 * @q: videobuf queue
334 */
335static inline void *vb2_get_drv_priv(struct vb2_queue *q)
336{
337 return q->drv_priv;
338}
339
340/**
341 * vb2_set_plane_payload() - set bytesused for the plane plane_no
342 * @vb: buffer for which plane payload should be set
343 * @plane_no: plane number for which payload should be set
344 * @size: payload in bytes
345 */
346static inline void vb2_set_plane_payload(struct vb2_buffer *vb,
347 unsigned int plane_no, unsigned long size)
348{
349 if (plane_no < vb->num_planes)
350 vb->v4l2_planes[plane_no].bytesused = size;
351}
352
353/**
354 * vb2_get_plane_payload() - get bytesused for the plane plane_no
355 * @vb: buffer for which plane payload should be set
356 * @plane_no: plane number for which payload should be set
357 * @size: payload in bytes
358 */
359static inline unsigned long vb2_get_plane_payload(struct vb2_buffer *vb,
360 unsigned int plane_no)
361{
362 if (plane_no < vb->num_planes)
363 return vb->v4l2_planes[plane_no].bytesused;
364 return 0;
365}
366
367/**
368 * vb2_plane_size() - return plane size in bytes
369 * @vb: buffer for which plane size should be returned
370 * @plane_no: plane number for which size should be returned
371 */
372static inline unsigned long
373vb2_plane_size(struct vb2_buffer *vb, unsigned int plane_no)
374{
375 if (plane_no < vb->num_planes)
376 return vb->v4l2_planes[plane_no].length;
377 return 0;
378}
379
380#endif /* _MEDIA_VIDEOBUF2_CORE_H */
diff --git a/include/media/videobuf2-dma-contig.h b/include/media/videobuf2-dma-contig.h
new file mode 100644
index 000000000000..7e6c68b23773
--- /dev/null
+++ b/include/media/videobuf2-dma-contig.h
@@ -0,0 +1,32 @@
1/*
2 * videobuf2-dma-coherent.h - DMA coherent memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_DMA_COHERENT_H
14#define _MEDIA_VIDEOBUF2_DMA_COHERENT_H
15
16#include <media/videobuf2-core.h>
17#include <linux/dma-mapping.h>
18
19static inline dma_addr_t
20vb2_dma_contig_plane_paddr(struct vb2_buffer *vb, unsigned int plane_no)
21{
22 dma_addr_t *paddr = vb2_plane_cookie(vb, plane_no);
23
24 return *paddr;
25}
26
27void *vb2_dma_contig_init_ctx(struct device *dev);
28void vb2_dma_contig_cleanup_ctx(void *alloc_ctx);
29
30extern const struct vb2_mem_ops vb2_dma_contig_memops;
31
32#endif
diff --git a/include/media/videobuf2-dma-sg.h b/include/media/videobuf2-dma-sg.h
new file mode 100644
index 000000000000..0038526b8ef7
--- /dev/null
+++ b/include/media/videobuf2-dma-sg.h
@@ -0,0 +1,32 @@
1/*
2 * videobuf2-dma-sg.h - DMA scatter/gather memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Andrzej Pietrasiewicz <andrzej.p@samsung.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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_DMA_SG_H
14#define _MEDIA_VIDEOBUF2_DMA_SG_H
15
16#include <media/videobuf2-core.h>
17
18struct vb2_dma_sg_desc {
19 unsigned long size;
20 unsigned int num_pages;
21 struct scatterlist *sglist;
22};
23
24static inline struct vb2_dma_sg_desc *vb2_dma_sg_plane_desc(
25 struct vb2_buffer *vb, unsigned int plane_no)
26{
27 return (struct vb2_dma_sg_desc *)vb2_plane_cookie(vb, plane_no);
28}
29
30extern const struct vb2_mem_ops vb2_dma_sg_memops;
31
32#endif
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
new file mode 100644
index 000000000000..84e1f6c031c5
--- /dev/null
+++ b/include/media/videobuf2-memops.h
@@ -0,0 +1,45 @@
1/*
2 * videobuf2-memops.h - generic memory handling routines for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.com>
7 * Marek Szyprowski <m.szyprowski@samsung.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.
12 */
13
14#ifndef _MEDIA_VIDEOBUF2_MEMOPS_H
15#define _MEDIA_VIDEOBUF2_MEMOPS_H
16
17#include <media/videobuf2-core.h>
18
19/**
20 * vb2_vmarea_handler - common vma refcount tracking handler
21 * @refcount: pointer to refcount entry in the buffer
22 * @put: callback to function that decreases buffer refcount
23 * @arg: argument for @put callback
24 */
25struct vb2_vmarea_handler {
26 atomic_t *refcount;
27 void (*put)(void *arg);
28 void *arg;
29};
30
31extern const struct vm_operations_struct vb2_common_vm_ops;
32
33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
34 struct vm_area_struct **res_vma, dma_addr_t *res_pa);
35
36int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
37 unsigned long size,
38 const struct vm_operations_struct *vm_ops,
39 void *priv);
40
41struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
42void vb2_put_vma(struct vm_area_struct *vma);
43
44
45#endif
diff --git a/include/media/videobuf2-vmalloc.h b/include/media/videobuf2-vmalloc.h
new file mode 100644
index 000000000000..93a76b43038d
--- /dev/null
+++ b/include/media/videobuf2-vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * videobuf2-vmalloc.h - vmalloc memory allocator for videobuf2
3 *
4 * Copyright (C) 2010 Samsung Electronics
5 *
6 * Author: Pawel Osciak <pawel@osciak.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.
11 */
12
13#ifndef _MEDIA_VIDEOBUF2_VMALLOC_H
14#define _MEDIA_VIDEOBUF2_VMALLOC_H
15
16#include <media/videobuf2-core.h>
17
18extern const struct vb2_mem_ops vb2_vmalloc_memops;
19
20#endif
diff --git a/include/media/wm8775.h b/include/media/wm8775.h
index 60739c5a23ae..d0e801a9935c 100644
--- a/include/media/wm8775.h
+++ b/include/media/wm8775.h
@@ -32,4 +32,13 @@
32#define WM8775_AIN3 4 32#define WM8775_AIN3 4
33#define WM8775_AIN4 8 33#define WM8775_AIN4 8
34 34
35
36struct wm8775_platform_data {
37 /*
38 * FIXME: Instead, we should parametrize the params
39 * that need different settings between ivtv, pvrusb2, and Nova-S
40 */
41 bool is_nova_s;
42};
43
35#endif 44#endif
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 071fd7a8d781..6b75a6971346 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -139,6 +139,8 @@ do { \
139 */ 139 */
140 140
141enum p9_msg_t { 141enum p9_msg_t {
142 P9_TSYNCFS = 0,
143 P9_RSYNCFS,
142 P9_TLERROR = 6, 144 P9_TLERROR = 6,
143 P9_RLERROR, 145 P9_RLERROR,
144 P9_TSTATFS = 8, 146 P9_TSTATFS = 8,
@@ -688,7 +690,11 @@ struct p9_rwstat {
688 * @id: protocol operating identifier of type &p9_msg_t 690 * @id: protocol operating identifier of type &p9_msg_t
689 * @tag: transaction id of the request 691 * @tag: transaction id of the request
690 * @offset: used by marshalling routines to track currentposition in buffer 692 * @offset: used by marshalling routines to track currentposition in buffer
691 * @capacity: used by marshalling routines to track total capacity 693 * @capacity: used by marshalling routines to track total malloc'd capacity
694 * @pubuf: Payload user buffer given by the caller
695 * @pubuf: Payload kernel buffer given by the caller
696 * @pbuf_size: pubuf/pkbuf(only one will be !NULL) size to be read/write.
697 * @private: For transport layer's use.
692 * @sdata: payload 698 * @sdata: payload
693 * 699 *
694 * &p9_fcall represents the structure for all 9P RPC 700 * &p9_fcall represents the structure for all 9P RPC
@@ -705,6 +711,10 @@ struct p9_fcall {
705 711
706 size_t offset; 712 size_t offset;
707 size_t capacity; 713 size_t capacity;
714 char __user *pubuf;
715 char *pkbuf;
716 size_t pbuf_size;
717 void *private;
708 718
709 uint8_t *sdata; 719 uint8_t *sdata;
710}; 720};
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index 83ba6a4d58a3..0a30977e3c1f 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -230,6 +230,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
230 gid_t gid, struct p9_qid *qid); 230 gid_t gid, struct p9_qid *qid);
231int p9_client_clunk(struct p9_fid *fid); 231int p9_client_clunk(struct p9_fid *fid);
232int p9_client_fsync(struct p9_fid *fid, int datasync); 232int p9_client_fsync(struct p9_fid *fid, int datasync);
233int p9_client_sync_fs(struct p9_fid *fid);
233int p9_client_remove(struct p9_fid *fid); 234int p9_client_remove(struct p9_fid *fid);
234int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, 235int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
235 u64 offset, u32 count); 236 u64 offset, u32 count);
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 6d5886efb102..82868f18c573 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,11 +26,19 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#define P9_TRANS_PREF_PAYLOAD_MASK 0x1
30
31/* Default. Add Payload to PDU before sending it down to transport layer */
32#define P9_TRANS_PREF_PAYLOAD_DEF 0x0
33/* Send pay load seperately to transport layer along with PDU.*/
34#define P9_TRANS_PREF_PAYLOAD_SEP 0x1
35
29/** 36/**
30 * struct p9_trans_module - transport module interface 37 * struct p9_trans_module - transport module interface
31 * @list: used to maintain a list of currently available transports 38 * @list: used to maintain a list of currently available transports
32 * @name: the human-readable name of the transport 39 * @name: the human-readable name of the transport
33 * @maxsize: transport provided maximum packet size 40 * @maxsize: transport provided maximum packet size
41 * @pref: Preferences of this transport
34 * @def: set if this transport should be considered the default 42 * @def: set if this transport should be considered the default
35 * @create: member function to create a new connection on this transport 43 * @create: member function to create a new connection on this transport
36 * @request: member function to issue a request to the transport 44 * @request: member function to issue a request to the transport
@@ -47,6 +55,7 @@ struct p9_trans_module {
47 struct list_head list; 55 struct list_head list;
48 char *name; /* name of transport */ 56 char *name; /* name of transport */
49 int maxsize; /* max message size of transport */ 57 int maxsize; /* max message size of transport */
58 int pref; /* Preferences of this transport */
50 int def; /* this transport should be default */ 59 int def; /* this transport should be default */
51 struct module *owner; 60 struct module *owner;
52 int (*create)(struct p9_client *, const char *, char *); 61 int (*create)(struct p9_client *, const char *, char *);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 0c5e72503b77..43750439c521 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -64,6 +64,11 @@ struct bt_security {
64 64
65#define BT_DEFER_SETUP 7 65#define BT_DEFER_SETUP 7
66 66
67#define BT_FLUSHABLE 8
68
69#define BT_FLUSHABLE_OFF 0
70#define BT_FLUSHABLE_ON 1
71
67#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg) 72#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
68#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg) 73#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
69#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg) 74#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
@@ -200,4 +205,32 @@ extern void bt_sysfs_cleanup(void);
200 205
201extern struct dentry *bt_debugfs; 206extern struct dentry *bt_debugfs;
202 207
208#ifdef CONFIG_BT_L2CAP
209int l2cap_init(void);
210void l2cap_exit(void);
211#else
212static inline int l2cap_init(void)
213{
214 return 0;
215}
216
217static inline void l2cap_exit(void)
218{
219}
220#endif
221
222#ifdef CONFIG_BT_SCO
223int sco_init(void);
224void sco_exit(void);
225#else
226static inline int sco_init(void)
227{
228 return 0;
229}
230
231static inline void sco_exit(void)
232{
233}
234#endif
235
203#endif /* __BLUETOOTH_H */ 236#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 29a7a8ca0438..ec6acf2f1c0b 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -76,6 +76,14 @@ enum {
76 HCI_INQUIRY, 76 HCI_INQUIRY,
77 77
78 HCI_RAW, 78 HCI_RAW,
79
80 HCI_SETUP,
81 HCI_AUTO_OFF,
82 HCI_MGMT,
83 HCI_PAIRABLE,
84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS,
79}; 87};
80 88
81/* HCI ioctl defines */ 89/* HCI ioctl defines */
@@ -111,6 +119,7 @@ enum {
111#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */ 119#define HCI_PAIRING_TIMEOUT (60000) /* 60 seconds */
112#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */ 120#define HCI_IDLE_TIMEOUT (6000) /* 6 seconds */
113#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */ 121#define HCI_INIT_TIMEOUT (10000) /* 10 seconds */
122#define HCI_CMD_TIMEOUT (1000) /* 1 seconds */
114 123
115/* HCI data types */ 124/* HCI data types */
116#define HCI_COMMAND_PKT 0x01 125#define HCI_COMMAND_PKT 0x01
@@ -150,6 +159,7 @@ enum {
150#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) 159#define EDR_ESCO_MASK (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5)
151 160
152/* ACL flags */ 161/* ACL flags */
162#define ACL_START_NO_FLUSH 0x00
153#define ACL_CONT 0x01 163#define ACL_CONT 0x01
154#define ACL_START 0x02 164#define ACL_START 0x02
155#define ACL_ACTIVE_BCAST 0x04 165#define ACL_ACTIVE_BCAST 0x04
@@ -159,6 +169,8 @@ enum {
159#define SCO_LINK 0x00 169#define SCO_LINK 0x00
160#define ACL_LINK 0x01 170#define ACL_LINK 0x01
161#define ESCO_LINK 0x02 171#define ESCO_LINK 0x02
172/* Low Energy links do not have defined link type. Use invented one */
173#define LE_LINK 0x80
162 174
163/* LMP features */ 175/* LMP features */
164#define LMP_3SLOT 0x01 176#define LMP_3SLOT 0x01
@@ -183,17 +195,25 @@ enum {
183#define LMP_PSCHEME 0x02 195#define LMP_PSCHEME 0x02
184#define LMP_PCONTROL 0x04 196#define LMP_PCONTROL 0x04
185 197
198#define LMP_RSSI_INQ 0x40
186#define LMP_ESCO 0x80 199#define LMP_ESCO 0x80
187 200
188#define LMP_EV4 0x01 201#define LMP_EV4 0x01
189#define LMP_EV5 0x02 202#define LMP_EV5 0x02
203#define LMP_LE 0x40
190 204
191#define LMP_SNIFF_SUBR 0x02 205#define LMP_SNIFF_SUBR 0x02
206#define LMP_PAUSE_ENC 0x04
192#define LMP_EDR_ESCO_2M 0x20 207#define LMP_EDR_ESCO_2M 0x20
193#define LMP_EDR_ESCO_3M 0x40 208#define LMP_EDR_ESCO_3M 0x40
194#define LMP_EDR_3S_ESCO 0x80 209#define LMP_EDR_3S_ESCO 0x80
195 210
211#define LMP_EXT_INQ 0x01
196#define LMP_SIMPLE_PAIR 0x08 212#define LMP_SIMPLE_PAIR 0x08
213#define LMP_NO_FLUSH 0x40
214
215#define LMP_LSTO 0x01
216#define LMP_INQ_TX_PWR 0x02
197 217
198/* Connection modes */ 218/* Connection modes */
199#define HCI_CM_ACTIVE 0x0000 219#define HCI_CM_ACTIVE 0x0000
@@ -225,6 +245,8 @@ enum {
225#define HCI_AT_GENERAL_BONDING_MITM 0x05 245#define HCI_AT_GENERAL_BONDING_MITM 0x05
226 246
227/* ----- HCI Commands ---- */ 247/* ----- HCI Commands ---- */
248#define HCI_OP_NOP 0x0000
249
228#define HCI_OP_INQUIRY 0x0401 250#define HCI_OP_INQUIRY 0x0401
229struct hci_cp_inquiry { 251struct hci_cp_inquiry {
230 __u8 lap[3]; 252 __u8 lap[3];
@@ -292,11 +314,19 @@ struct hci_cp_pin_code_reply {
292 __u8 pin_len; 314 __u8 pin_len;
293 __u8 pin_code[16]; 315 __u8 pin_code[16];
294} __packed; 316} __packed;
317struct hci_rp_pin_code_reply {
318 __u8 status;
319 bdaddr_t bdaddr;
320} __packed;
295 321
296#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e 322#define HCI_OP_PIN_CODE_NEG_REPLY 0x040e
297struct hci_cp_pin_code_neg_reply { 323struct hci_cp_pin_code_neg_reply {
298 bdaddr_t bdaddr; 324 bdaddr_t bdaddr;
299} __packed; 325} __packed;
326struct hci_rp_pin_code_neg_reply {
327 __u8 status;
328 bdaddr_t bdaddr;
329} __packed;
300 330
301#define HCI_OP_CHANGE_CONN_PTYPE 0x040f 331#define HCI_OP_CHANGE_CONN_PTYPE 0x040f
302struct hci_cp_change_conn_ptype { 332struct hci_cp_change_conn_ptype {
@@ -377,6 +407,31 @@ struct hci_cp_reject_sync_conn_req {
377 __u8 reason; 407 __u8 reason;
378} __packed; 408} __packed;
379 409
410#define HCI_OP_IO_CAPABILITY_REPLY 0x042b
411struct hci_cp_io_capability_reply {
412 bdaddr_t bdaddr;
413 __u8 capability;
414 __u8 oob_data;
415 __u8 authentication;
416} __packed;
417
418#define HCI_OP_USER_CONFIRM_REPLY 0x042c
419struct hci_cp_user_confirm_reply {
420 bdaddr_t bdaddr;
421} __packed;
422struct hci_rp_user_confirm_reply {
423 __u8 status;
424 bdaddr_t bdaddr;
425} __packed;
426
427#define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d
428
429#define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434
430struct hci_cp_io_capability_neg_reply {
431 bdaddr_t bdaddr;
432 __u8 reason;
433} __packed;
434
380#define HCI_OP_SNIFF_MODE 0x0803 435#define HCI_OP_SNIFF_MODE 0x0803
381struct hci_cp_sniff_mode { 436struct hci_cp_sniff_mode {
382 __le16 handle; 437 __le16 handle;
@@ -474,6 +529,12 @@ struct hci_cp_set_event_flt {
474#define HCI_CONN_SETUP_AUTO_OFF 0x01 529#define HCI_CONN_SETUP_AUTO_OFF 0x01
475#define HCI_CONN_SETUP_AUTO_ON 0x02 530#define HCI_CONN_SETUP_AUTO_ON 0x02
476 531
532#define HCI_OP_DELETE_STORED_LINK_KEY 0x0c12
533struct hci_cp_delete_stored_link_key {
534 bdaddr_t bdaddr;
535 __u8 delete_all;
536} __packed;
537
477#define HCI_OP_WRITE_LOCAL_NAME 0x0c13 538#define HCI_OP_WRITE_LOCAL_NAME 0x0c13
478struct hci_cp_write_local_name { 539struct hci_cp_write_local_name {
479 __u8 name[248]; 540 __u8 name[248];
@@ -537,6 +598,8 @@ struct hci_cp_host_buffer_size {
537 __le16 sco_max_pkt; 598 __le16 sco_max_pkt;
538} __packed; 599} __packed;
539 600
601#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
602
540#define HCI_OP_READ_SSP_MODE 0x0c55 603#define HCI_OP_READ_SSP_MODE 0x0c55
541struct hci_rp_read_ssp_mode { 604struct hci_rp_read_ssp_mode {
542 __u8 status; 605 __u8 status;
@@ -548,6 +611,8 @@ struct hci_cp_write_ssp_mode {
548 __u8 mode; 611 __u8 mode;
549} __packed; 612} __packed;
550 613
614#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
615
551#define HCI_OP_READ_LOCAL_VERSION 0x1001 616#define HCI_OP_READ_LOCAL_VERSION 0x1001
552struct hci_rp_read_local_version { 617struct hci_rp_read_local_version {
553 __u8 status; 618 __u8 status;
@@ -593,6 +658,47 @@ struct hci_rp_read_bd_addr {
593 bdaddr_t bdaddr; 658 bdaddr_t bdaddr;
594} __packed; 659} __packed;
595 660
661#define HCI_OP_LE_SET_EVENT_MASK 0x2001
662struct hci_cp_le_set_event_mask {
663 __u8 mask[8];
664} __packed;
665
666#define HCI_OP_LE_READ_BUFFER_SIZE 0x2002
667struct hci_rp_le_read_buffer_size {
668 __u8 status;
669 __le16 le_mtu;
670 __u8 le_max_pkt;
671} __packed;
672
673#define HCI_OP_LE_CREATE_CONN 0x200d
674struct hci_cp_le_create_conn {
675 __le16 scan_interval;
676 __le16 scan_window;
677 __u8 filter_policy;
678 __u8 peer_addr_type;
679 bdaddr_t peer_addr;
680 __u8 own_address_type;
681 __le16 conn_interval_min;
682 __le16 conn_interval_max;
683 __le16 conn_latency;
684 __le16 supervision_timeout;
685 __le16 min_ce_len;
686 __le16 max_ce_len;
687} __packed;
688
689#define HCI_OP_LE_CREATE_CONN_CANCEL 0x200e
690
691#define HCI_OP_LE_CONN_UPDATE 0x2013
692struct hci_cp_le_conn_update {
693 __le16 handle;
694 __le16 conn_interval_min;
695 __le16 conn_interval_max;
696 __le16 conn_latency;
697 __le16 supervision_timeout;
698 __le16 min_ce_len;
699 __le16 max_ce_len;
700} __packed;
701
596/* ---- HCI Events ---- */ 702/* ---- HCI Events ---- */
597#define HCI_EV_INQUIRY_COMPLETE 0x01 703#define HCI_EV_INQUIRY_COMPLETE 0x01
598 704
@@ -833,6 +939,20 @@ struct hci_ev_io_capa_request {
833 bdaddr_t bdaddr; 939 bdaddr_t bdaddr;
834} __packed; 940} __packed;
835 941
942#define HCI_EV_IO_CAPA_REPLY 0x32
943struct hci_ev_io_capa_reply {
944 bdaddr_t bdaddr;
945 __u8 capability;
946 __u8 oob_data;
947 __u8 authentication;
948} __packed;
949
950#define HCI_EV_USER_CONFIRM_REQUEST 0x33
951struct hci_ev_user_confirm_req {
952 bdaddr_t bdaddr;
953 __le32 passkey;
954} __packed;
955
836#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 956#define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36
837struct hci_ev_simple_pair_complete { 957struct hci_ev_simple_pair_complete {
838 __u8 status; 958 __u8 status;
@@ -845,6 +965,25 @@ struct hci_ev_remote_host_features {
845 __u8 features[8]; 965 __u8 features[8];
846} __packed; 966} __packed;
847 967
968#define HCI_EV_LE_META 0x3e
969struct hci_ev_le_meta {
970 __u8 subevent;
971} __packed;
972
973/* Low energy meta events */
974#define HCI_EV_LE_CONN_COMPLETE 0x01
975struct hci_ev_le_conn_complete {
976 __u8 status;
977 __le16 handle;
978 __u8 role;
979 __u8 bdaddr_type;
980 bdaddr_t bdaddr;
981 __le16 interval;
982 __le16 latency;
983 __le16 supervision_timeout;
984 __u8 clk_accurancy;
985} __packed;
986
848/* Internal events generated by Bluetooth stack */ 987/* Internal events generated by Bluetooth stack */
849#define HCI_EV_STACK_INTERNAL 0xfd 988#define HCI_EV_STACK_INTERNAL 0xfd
850struct hci_ev_stack_internal { 989struct hci_ev_stack_internal {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index d2cf88407690..441dadbf6a89 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -60,12 +60,28 @@ struct hci_conn_hash {
60 spinlock_t lock; 60 spinlock_t lock;
61 unsigned int acl_num; 61 unsigned int acl_num;
62 unsigned int sco_num; 62 unsigned int sco_num;
63 unsigned int le_num;
63}; 64};
64 65
65struct bdaddr_list { 66struct bdaddr_list {
66 struct list_head list; 67 struct list_head list;
67 bdaddr_t bdaddr; 68 bdaddr_t bdaddr;
68}; 69};
70
71struct bt_uuid {
72 struct list_head list;
73 u8 uuid[16];
74 u8 svc_hint;
75};
76
77struct link_key {
78 struct list_head list;
79 bdaddr_t bdaddr;
80 u8 type;
81 u8 val[16];
82 u8 pin_len;
83};
84
69#define NUM_REASSEMBLY 4 85#define NUM_REASSEMBLY 4
70struct hci_dev { 86struct hci_dev {
71 struct list_head list; 87 struct list_head list;
@@ -80,13 +96,18 @@ struct hci_dev {
80 bdaddr_t bdaddr; 96 bdaddr_t bdaddr;
81 __u8 dev_name[248]; 97 __u8 dev_name[248];
82 __u8 dev_class[3]; 98 __u8 dev_class[3];
99 __u8 major_class;
100 __u8 minor_class;
83 __u8 features[8]; 101 __u8 features[8];
84 __u8 commands[64]; 102 __u8 commands[64];
85 __u8 ssp_mode; 103 __u8 ssp_mode;
86 __u8 hci_ver; 104 __u8 hci_ver;
87 __u16 hci_rev; 105 __u16 hci_rev;
106 __u8 lmp_ver;
88 __u16 manufacturer; 107 __u16 manufacturer;
108 __le16 lmp_subver;
89 __u16 voice_setting; 109 __u16 voice_setting;
110 __u8 io_capability;
90 111
91 __u16 pkt_type; 112 __u16 pkt_type;
92 __u16 esco_type; 113 __u16 esco_type;
@@ -102,18 +123,26 @@ struct hci_dev {
102 atomic_t cmd_cnt; 123 atomic_t cmd_cnt;
103 unsigned int acl_cnt; 124 unsigned int acl_cnt;
104 unsigned int sco_cnt; 125 unsigned int sco_cnt;
126 unsigned int le_cnt;
105 127
106 unsigned int acl_mtu; 128 unsigned int acl_mtu;
107 unsigned int sco_mtu; 129 unsigned int sco_mtu;
130 unsigned int le_mtu;
108 unsigned int acl_pkts; 131 unsigned int acl_pkts;
109 unsigned int sco_pkts; 132 unsigned int sco_pkts;
133 unsigned int le_pkts;
110 134
111 unsigned long cmd_last_tx;
112 unsigned long acl_last_tx; 135 unsigned long acl_last_tx;
113 unsigned long sco_last_tx; 136 unsigned long sco_last_tx;
137 unsigned long le_last_tx;
114 138
115 struct workqueue_struct *workqueue; 139 struct workqueue_struct *workqueue;
116 140
141 struct work_struct power_on;
142 struct work_struct power_off;
143 struct timer_list off_timer;
144
145 struct timer_list cmd_timer;
117 struct tasklet_struct cmd_task; 146 struct tasklet_struct cmd_task;
118 struct tasklet_struct rx_task; 147 struct tasklet_struct rx_task;
119 struct tasklet_struct tx_task; 148 struct tasklet_struct tx_task;
@@ -129,12 +158,17 @@ struct hci_dev {
129 wait_queue_head_t req_wait_q; 158 wait_queue_head_t req_wait_q;
130 __u32 req_status; 159 __u32 req_status;
131 __u32 req_result; 160 __u32 req_result;
132 __u16 req_last_cmd; 161
162 __u16 init_last_cmd;
133 163
134 struct inquiry_cache inq_cache; 164 struct inquiry_cache inq_cache;
135 struct hci_conn_hash conn_hash; 165 struct hci_conn_hash conn_hash;
136 struct list_head blacklist; 166 struct list_head blacklist;
137 167
168 struct list_head uuids;
169
170 struct list_head link_keys;
171
138 struct hci_dev_stats stat; 172 struct hci_dev_stats stat;
139 173
140 struct sk_buff_head driver_init; 174 struct sk_buff_head driver_init;
@@ -165,31 +199,37 @@ struct hci_dev {
165struct hci_conn { 199struct hci_conn {
166 struct list_head list; 200 struct list_head list;
167 201
168 atomic_t refcnt; 202 atomic_t refcnt;
169 spinlock_t lock; 203 spinlock_t lock;
170 204
171 bdaddr_t dst; 205 bdaddr_t dst;
172 __u16 handle; 206 __u16 handle;
173 __u16 state; 207 __u16 state;
174 __u8 mode; 208 __u8 mode;
175 __u8 type; 209 __u8 type;
176 __u8 out; 210 __u8 out;
177 __u8 attempt; 211 __u8 attempt;
178 __u8 dev_class[3]; 212 __u8 dev_class[3];
179 __u8 features[8]; 213 __u8 features[8];
180 __u8 ssp_mode; 214 __u8 ssp_mode;
181 __u16 interval; 215 __u16 interval;
182 __u16 pkt_type; 216 __u16 pkt_type;
183 __u16 link_policy; 217 __u16 link_policy;
184 __u32 link_mode; 218 __u32 link_mode;
185 __u8 auth_type; 219 __u8 auth_type;
186 __u8 sec_level; 220 __u8 sec_level;
187 __u8 pending_sec_level; 221 __u8 pending_sec_level;
188 __u8 power_save; 222 __u8 pin_length;
189 __u16 disc_timeout; 223 __u8 io_capability;
190 unsigned long pend; 224 __u8 power_save;
191 225 __u16 disc_timeout;
192 unsigned int sent; 226 unsigned long pend;
227
228 __u8 remote_cap;
229 __u8 remote_oob;
230 __u8 remote_auth;
231
232 unsigned int sent;
193 233
194 struct sk_buff_head data_q; 234 struct sk_buff_head data_q;
195 235
@@ -208,6 +248,10 @@ struct hci_conn {
208 void *priv; 248 void *priv;
209 249
210 struct hci_conn *link; 250 struct hci_conn *link;
251
252 void (*connect_cfm_cb) (struct hci_conn *conn, u8 status);
253 void (*security_cfm_cb) (struct hci_conn *conn, u8 status);
254 void (*disconn_cfm_cb) (struct hci_conn *conn, u8 reason);
211}; 255};
212 256
213extern struct hci_proto *hci_proto[]; 257extern struct hci_proto *hci_proto[];
@@ -274,24 +318,40 @@ static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
274{ 318{
275 struct hci_conn_hash *h = &hdev->conn_hash; 319 struct hci_conn_hash *h = &hdev->conn_hash;
276 list_add(&c->list, &h->list); 320 list_add(&c->list, &h->list);
277 if (c->type == ACL_LINK) 321 switch (c->type) {
322 case ACL_LINK:
278 h->acl_num++; 323 h->acl_num++;
279 else 324 break;
325 case LE_LINK:
326 h->le_num++;
327 break;
328 case SCO_LINK:
329 case ESCO_LINK:
280 h->sco_num++; 330 h->sco_num++;
331 break;
332 }
281} 333}
282 334
283static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c) 335static inline void hci_conn_hash_del(struct hci_dev *hdev, struct hci_conn *c)
284{ 336{
285 struct hci_conn_hash *h = &hdev->conn_hash; 337 struct hci_conn_hash *h = &hdev->conn_hash;
286 list_del(&c->list); 338 list_del(&c->list);
287 if (c->type == ACL_LINK) 339 switch (c->type) {
340 case ACL_LINK:
288 h->acl_num--; 341 h->acl_num--;
289 else 342 break;
343 case LE_LINK:
344 h->le_num--;
345 break;
346 case SCO_LINK:
347 case ESCO_LINK:
290 h->sco_num--; 348 h->sco_num--;
349 break;
350 }
291} 351}
292 352
293static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 353static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
294 __u16 handle) 354 __u16 handle)
295{ 355{
296 struct hci_conn_hash *h = &hdev->conn_hash; 356 struct hci_conn_hash *h = &hdev->conn_hash;
297 struct list_head *p; 357 struct list_head *p;
@@ -306,7 +366,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
306} 366}
307 367
308static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev, 368static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
309 __u8 type, bdaddr_t *ba) 369 __u8 type, bdaddr_t *ba)
310{ 370{
311 struct hci_conn_hash *h = &hdev->conn_hash; 371 struct hci_conn_hash *h = &hdev->conn_hash;
312 struct list_head *p; 372 struct list_head *p;
@@ -321,7 +381,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
321} 381}
322 382
323static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev, 383static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
324 __u8 type, __u16 state) 384 __u8 type, __u16 state)
325{ 385{
326 struct hci_conn_hash *h = &hdev->conn_hash; 386 struct hci_conn_hash *h = &hdev->conn_hash;
327 struct list_head *p; 387 struct list_head *p;
@@ -437,6 +497,16 @@ int hci_inquiry(void __user *arg);
437struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); 497struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
438int hci_blacklist_clear(struct hci_dev *hdev); 498int hci_blacklist_clear(struct hci_dev *hdev);
439 499
500int hci_uuids_clear(struct hci_dev *hdev);
501
502int hci_link_keys_clear(struct hci_dev *hdev);
503struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
504int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr,
505 u8 *key, u8 type, u8 pin_len);
506int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
507
508void hci_del_off_timer(struct hci_dev *hdev);
509
440void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 510void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
441 511
442int hci_recv_frame(struct sk_buff *skb); 512int hci_recv_frame(struct sk_buff *skb);
@@ -458,6 +528,8 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
458#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) 528#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR)
459#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO) 529#define lmp_esco_capable(dev) ((dev)->features[3] & LMP_ESCO)
460#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR) 530#define lmp_ssp_capable(dev) ((dev)->features[6] & LMP_SIMPLE_PAIR)
531#define lmp_no_flush_capable(dev) ((dev)->features[6] & LMP_NO_FLUSH)
532#define lmp_le_capable(dev) ((dev)->features[4] & LMP_LE)
461 533
462/* ----- HCI protocols ----- */ 534/* ----- HCI protocols ----- */
463struct hci_proto { 535struct hci_proto {
@@ -503,6 +575,9 @@ static inline void hci_proto_connect_cfm(struct hci_conn *conn, __u8 status)
503 hp = hci_proto[HCI_PROTO_SCO]; 575 hp = hci_proto[HCI_PROTO_SCO];
504 if (hp && hp->connect_cfm) 576 if (hp && hp->connect_cfm)
505 hp->connect_cfm(conn, status); 577 hp->connect_cfm(conn, status);
578
579 if (conn->connect_cfm_cb)
580 conn->connect_cfm_cb(conn, status);
506} 581}
507 582
508static inline int hci_proto_disconn_ind(struct hci_conn *conn) 583static inline int hci_proto_disconn_ind(struct hci_conn *conn)
@@ -532,6 +607,9 @@ static inline void hci_proto_disconn_cfm(struct hci_conn *conn, __u8 reason)
532 hp = hci_proto[HCI_PROTO_SCO]; 607 hp = hci_proto[HCI_PROTO_SCO];
533 if (hp && hp->disconn_cfm) 608 if (hp && hp->disconn_cfm)
534 hp->disconn_cfm(conn, reason); 609 hp->disconn_cfm(conn, reason);
610
611 if (conn->disconn_cfm_cb)
612 conn->disconn_cfm_cb(conn, reason);
535} 613}
536 614
537static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status) 615static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
@@ -551,6 +629,9 @@ static inline void hci_proto_auth_cfm(struct hci_conn *conn, __u8 status)
551 hp = hci_proto[HCI_PROTO_SCO]; 629 hp = hci_proto[HCI_PROTO_SCO];
552 if (hp && hp->security_cfm) 630 if (hp && hp->security_cfm)
553 hp->security_cfm(conn, status, encrypt); 631 hp->security_cfm(conn, status, encrypt);
632
633 if (conn->security_cfm_cb)
634 conn->security_cfm_cb(conn, status);
554} 635}
555 636
556static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt) 637static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u8 encrypt)
@@ -564,6 +645,9 @@ static inline void hci_proto_encrypt_cfm(struct hci_conn *conn, __u8 status, __u
564 hp = hci_proto[HCI_PROTO_SCO]; 645 hp = hci_proto[HCI_PROTO_SCO];
565 if (hp && hp->security_cfm) 646 if (hp && hp->security_cfm)
566 hp->security_cfm(conn, status, encrypt); 647 hp->security_cfm(conn, status, encrypt);
648
649 if (conn->security_cfm_cb)
650 conn->security_cfm_cb(conn, status);
567} 651}
568 652
569int hci_register_proto(struct hci_proto *hproto); 653int hci_register_proto(struct hci_proto *hproto);
@@ -660,12 +744,29 @@ void *hci_sent_cmd_data(struct hci_dev *hdev, __u16 opcode);
660void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data); 744void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data);
661 745
662/* ----- HCI Sockets ----- */ 746/* ----- HCI Sockets ----- */
663void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb); 747void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb,
748 struct sock *skip_sk);
664 749
665/* Management interface */ 750/* Management interface */
666int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 751int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
667int mgmt_index_added(u16 index); 752int mgmt_index_added(u16 index);
668int mgmt_index_removed(u16 index); 753int mgmt_index_removed(u16 index);
754int mgmt_powered(u16 index, u8 powered);
755int mgmt_discoverable(u16 index, u8 discoverable);
756int mgmt_connectable(u16 index, u8 connectable);
757int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type);
758int mgmt_connected(u16 index, bdaddr_t *bdaddr);
759int mgmt_disconnected(u16 index, bdaddr_t *bdaddr);
760int mgmt_disconnect_failed(u16 index);
761int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status);
762int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr);
763int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
764int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
765int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value);
766int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status);
767int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr,
768 u8 status);
769int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status);
669 770
670/* HCI info for socket */ 771/* HCI info for socket */
671#define hci_pi(sk) ((struct hci_pinfo *) sk) 772#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -697,4 +798,6 @@ struct hci_sec_filter {
697 798
698void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); 799void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result);
699 800
801void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
802 u16 latency, u16 to_multiplier);
700#endif /* __HCI_CORE_H */ 803#endif /* __HCI_CORE_H */
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7ad25ca60ec0..4f4bff1eaed6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -38,6 +38,7 @@
38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */ 38#define L2CAP_DEFAULT_MAX_PDU_SIZE 1009 /* Sized for 3-DH5 packet */
39#define L2CAP_DEFAULT_ACK_TO 200 39#define L2CAP_DEFAULT_ACK_TO 200
40#define L2CAP_LOCAL_BUSY_TRIES 12 40#define L2CAP_LOCAL_BUSY_TRIES 12
41#define L2CAP_LE_DEFAULT_MTU 23
41 42
42#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 43#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
43#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 44#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -88,6 +89,8 @@ struct l2cap_conninfo {
88#define L2CAP_ECHO_RSP 0x09 89#define L2CAP_ECHO_RSP 0x09
89#define L2CAP_INFO_REQ 0x0a 90#define L2CAP_INFO_REQ 0x0a
90#define L2CAP_INFO_RSP 0x0b 91#define L2CAP_INFO_RSP 0x0b
92#define L2CAP_CONN_PARAM_UPDATE_REQ 0x12
93#define L2CAP_CONN_PARAM_UPDATE_RSP 0x13
91 94
92/* L2CAP feature mask */ 95/* L2CAP feature mask */
93#define L2CAP_FEAT_FLOWCTL 0x00000001 96#define L2CAP_FEAT_FLOWCTL 0x00000001
@@ -160,6 +163,9 @@ struct l2cap_conn_rsp {
160/* channel indentifier */ 163/* channel indentifier */
161#define L2CAP_CID_SIGNALING 0x0001 164#define L2CAP_CID_SIGNALING 0x0001
162#define L2CAP_CID_CONN_LESS 0x0002 165#define L2CAP_CID_CONN_LESS 0x0002
166#define L2CAP_CID_LE_DATA 0x0004
167#define L2CAP_CID_LE_SIGNALING 0x0005
168#define L2CAP_CID_SMP 0x0006
163#define L2CAP_CID_DYN_START 0x0040 169#define L2CAP_CID_DYN_START 0x0040
164#define L2CAP_CID_DYN_END 0xffff 170#define L2CAP_CID_DYN_END 0xffff
165 171
@@ -255,6 +261,21 @@ struct l2cap_info_rsp {
255#define L2CAP_IR_SUCCESS 0x0000 261#define L2CAP_IR_SUCCESS 0x0000
256#define L2CAP_IR_NOTSUPP 0x0001 262#define L2CAP_IR_NOTSUPP 0x0001
257 263
264struct l2cap_conn_param_update_req {
265 __le16 min;
266 __le16 max;
267 __le16 latency;
268 __le16 to_multiplier;
269} __packed;
270
271struct l2cap_conn_param_update_rsp {
272 __le16 result;
273} __packed;
274
275/* Connection Parameters result */
276#define L2CAP_CONN_PARAM_ACCEPTED 0x0000
277#define L2CAP_CONN_PARAM_REJECTED 0x0001
278
258/* ----- L2CAP connections ----- */ 279/* ----- L2CAP connections ----- */
259struct l2cap_chan_list { 280struct l2cap_chan_list {
260 struct sock *head; 281 struct sock *head;
@@ -327,6 +348,7 @@ struct l2cap_pinfo {
327 __u8 sec_level; 348 __u8 sec_level;
328 __u8 role_switch; 349 __u8 role_switch;
329 __u8 force_reliable; 350 __u8 force_reliable;
351 __u8 flushable;
330 352
331 __u8 conf_req[64]; 353 __u8 conf_req[64];
332 __u8 conf_len; 354 __u8 conf_len;
@@ -423,6 +445,35 @@ static inline int l2cap_tx_window_full(struct sock *sk)
423#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE) 445#define __is_sframe(ctrl) ((ctrl) & L2CAP_CTRL_FRAME_TYPE)
424#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) 446#define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START)
425 447
426void l2cap_load(void); 448extern int disable_ertm;
449extern const struct proto_ops l2cap_sock_ops;
450extern struct bt_sock_list l2cap_sk_list;
451
452int l2cap_init_sockets(void);
453void l2cap_cleanup_sockets(void);
454
455u8 l2cap_get_ident(struct l2cap_conn *conn);
456void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data);
457int l2cap_build_conf_req(struct sock *sk, void *data);
458int __l2cap_wait_ack(struct sock *sk);
459
460struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len);
461struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len);
462struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen);
463int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len);
464void l2cap_do_send(struct sock *sk, struct sk_buff *skb);
465void l2cap_streaming_send(struct sock *sk);
466int l2cap_ertm_send(struct sock *sk);
467
468void l2cap_sock_set_timer(struct sock *sk, long timeout);
469void l2cap_sock_clear_timer(struct sock *sk);
470void __l2cap_sock_close(struct sock *sk, int reason);
471void l2cap_sock_kill(struct sock *sk);
472void l2cap_sock_init(struct sock *sk, struct sock *parent);
473struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock,
474 int proto, gfp_t prio);
475void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err);
476void l2cap_chan_del(struct sock *sk, int err);
477int l2cap_do_connect(struct sock *sk);
427 478
428#endif /* __L2CAP_H */ 479#endif /* __L2CAP_H */
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index ca29c1367ffd..5fabfa886b3e 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -21,11 +21,13 @@
21 SOFTWARE IS DISCLAIMED. 21 SOFTWARE IS DISCLAIMED.
22*/ 22*/
23 23
24#define MGMT_INDEX_NONE 0xFFFF
25
24struct mgmt_hdr { 26struct mgmt_hdr {
25 __le16 opcode; 27 __le16 opcode;
28 __le16 index;
26 __le16 len; 29 __le16 len;
27} __packed; 30} __packed;
28#define MGMT_HDR_SIZE 4
29 31
30#define MGMT_OP_READ_VERSION 0x0001 32#define MGMT_OP_READ_VERSION 0x0001
31struct mgmt_rp_read_version { 33struct mgmt_rp_read_version {
@@ -40,13 +42,10 @@ struct mgmt_rp_read_index_list {
40} __packed; 42} __packed;
41 43
42#define MGMT_OP_READ_INFO 0x0004 44#define MGMT_OP_READ_INFO 0x0004
43struct mgmt_cp_read_info {
44 __le16 index;
45} __packed;
46struct mgmt_rp_read_info { 45struct mgmt_rp_read_info {
47 __le16 index;
48 __u8 type; 46 __u8 type;
49 __u8 powered; 47 __u8 powered;
48 __u8 connectable;
50 __u8 discoverable; 49 __u8 discoverable;
51 __u8 pairable; 50 __u8 pairable;
52 __u8 sec_mode; 51 __u8 sec_mode;
@@ -58,6 +57,116 @@ struct mgmt_rp_read_info {
58 __u16 hci_rev; 57 __u16 hci_rev;
59} __packed; 58} __packed;
60 59
60struct mgmt_mode {
61 __u8 val;
62} __packed;
63
64#define MGMT_OP_SET_POWERED 0x0005
65
66#define MGMT_OP_SET_DISCOVERABLE 0x0006
67
68#define MGMT_OP_SET_CONNECTABLE 0x0007
69
70#define MGMT_OP_SET_PAIRABLE 0x0008
71
72#define MGMT_OP_ADD_UUID 0x0009
73struct mgmt_cp_add_uuid {
74 __u8 uuid[16];
75 __u8 svc_hint;
76} __packed;
77
78#define MGMT_OP_REMOVE_UUID 0x000A
79struct mgmt_cp_remove_uuid {
80 __u8 uuid[16];
81} __packed;
82
83#define MGMT_OP_SET_DEV_CLASS 0x000B
84struct mgmt_cp_set_dev_class {
85 __u8 major;
86 __u8 minor;
87} __packed;
88
89#define MGMT_OP_SET_SERVICE_CACHE 0x000C
90struct mgmt_cp_set_service_cache {
91 __u8 enable;
92} __packed;
93
94struct mgmt_key_info {
95 bdaddr_t bdaddr;
96 u8 type;
97 u8 val[16];
98 u8 pin_len;
99} __packed;
100
101#define MGMT_OP_LOAD_KEYS 0x000D
102struct mgmt_cp_load_keys {
103 __u8 debug_keys;
104 __le16 key_count;
105 struct mgmt_key_info keys[0];
106} __packed;
107
108#define MGMT_OP_REMOVE_KEY 0x000E
109struct mgmt_cp_remove_key {
110 bdaddr_t bdaddr;
111 __u8 disconnect;
112} __packed;
113
114#define MGMT_OP_DISCONNECT 0x000F
115struct mgmt_cp_disconnect {
116 bdaddr_t bdaddr;
117} __packed;
118struct mgmt_rp_disconnect {
119 bdaddr_t bdaddr;
120} __packed;
121
122#define MGMT_OP_GET_CONNECTIONS 0x0010
123struct mgmt_rp_get_connections {
124 __le16 conn_count;
125 bdaddr_t conn[0];
126} __packed;
127
128#define MGMT_OP_PIN_CODE_REPLY 0x0011
129struct mgmt_cp_pin_code_reply {
130 bdaddr_t bdaddr;
131 __u8 pin_len;
132 __u8 pin_code[16];
133} __packed;
134struct mgmt_rp_pin_code_reply {
135 bdaddr_t bdaddr;
136 uint8_t status;
137} __packed;
138
139#define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012
140struct mgmt_cp_pin_code_neg_reply {
141 bdaddr_t bdaddr;
142} __packed;
143
144#define MGMT_OP_SET_IO_CAPABILITY 0x0013
145struct mgmt_cp_set_io_capability {
146 __u8 io_capability;
147} __packed;
148
149#define MGMT_OP_PAIR_DEVICE 0x0014
150struct mgmt_cp_pair_device {
151 bdaddr_t bdaddr;
152 __u8 io_cap;
153} __packed;
154struct mgmt_rp_pair_device {
155 bdaddr_t bdaddr;
156 __u8 status;
157} __packed;
158
159#define MGMT_OP_USER_CONFIRM_REPLY 0x0015
160struct mgmt_cp_user_confirm_reply {
161 bdaddr_t bdaddr;
162} __packed;
163struct mgmt_rp_user_confirm_reply {
164 bdaddr_t bdaddr;
165 __u8 status;
166} __packed;
167
168#define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016
169
61#define MGMT_EV_CMD_COMPLETE 0x0001 170#define MGMT_EV_CMD_COMPLETE 0x0001
62struct mgmt_ev_cmd_complete { 171struct mgmt_ev_cmd_complete {
63 __le16 opcode; 172 __le16 opcode;
@@ -72,16 +181,56 @@ struct mgmt_ev_cmd_status {
72 181
73#define MGMT_EV_CONTROLLER_ERROR 0x0003 182#define MGMT_EV_CONTROLLER_ERROR 0x0003
74struct mgmt_ev_controller_error { 183struct mgmt_ev_controller_error {
75 __le16 index;
76 __u8 error_code; 184 __u8 error_code;
77} __packed; 185} __packed;
78 186
79#define MGMT_EV_INDEX_ADDED 0x0004 187#define MGMT_EV_INDEX_ADDED 0x0004
80struct mgmt_ev_index_added {
81 __le16 index;
82} __packed;
83 188
84#define MGMT_EV_INDEX_REMOVED 0x0005 189#define MGMT_EV_INDEX_REMOVED 0x0005
85struct mgmt_ev_index_removed { 190
86 __le16 index; 191#define MGMT_EV_POWERED 0x0006
192
193#define MGMT_EV_DISCOVERABLE 0x0007
194
195#define MGMT_EV_CONNECTABLE 0x0008
196
197#define MGMT_EV_PAIRABLE 0x0009
198
199#define MGMT_EV_NEW_KEY 0x000A
200struct mgmt_ev_new_key {
201 struct mgmt_key_info key;
202 __u8 old_key_type;
203} __packed;
204
205#define MGMT_EV_CONNECTED 0x000B
206struct mgmt_ev_connected {
207 bdaddr_t bdaddr;
208} __packed;
209
210#define MGMT_EV_DISCONNECTED 0x000C
211struct mgmt_ev_disconnected {
212 bdaddr_t bdaddr;
213} __packed;
214
215#define MGMT_EV_CONNECT_FAILED 0x000D
216struct mgmt_ev_connect_failed {
217 bdaddr_t bdaddr;
218 __u8 status;
219} __packed;
220
221#define MGMT_EV_PIN_CODE_REQUEST 0x000E
222struct mgmt_ev_pin_code_request {
223 bdaddr_t bdaddr;
224} __packed;
225
226#define MGMT_EV_USER_CONFIRM_REQUEST 0x000F
227struct mgmt_ev_user_confirm_request {
228 bdaddr_t bdaddr;
229 __le32 value;
230} __packed;
231
232#define MGMT_EV_AUTH_FAILED 0x0010
233struct mgmt_ev_auth_failed {
234 bdaddr_t bdaddr;
235 __u8 status;
87} __packed; 236} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
new file mode 100644
index 000000000000..8f2edbf979dc
--- /dev/null
+++ b/include/net/bluetooth/smp.h
@@ -0,0 +1,76 @@
1#ifndef __SMP_H
2#define __SMP_H
3
4struct smp_command_hdr {
5 __u8 code;
6} __packed;
7
8#define SMP_CMD_PAIRING_REQ 0x01
9#define SMP_CMD_PAIRING_RSP 0x02
10struct smp_cmd_pairing {
11 __u8 io_capability;
12 __u8 oob_flag;
13 __u8 auth_req;
14 __u8 max_key_size;
15 __u8 init_key_dist;
16 __u8 resp_key_dist;
17} __packed;
18
19#define SMP_CMD_PAIRING_CONFIRM 0x03
20struct smp_cmd_pairing_confirm {
21 __u8 confirm_val[16];
22} __packed;
23
24#define SMP_CMD_PAIRING_RANDOM 0x04
25struct smp_cmd_pairing_random {
26 __u8 rand_val[16];
27} __packed;
28
29#define SMP_CMD_PAIRING_FAIL 0x05
30struct smp_cmd_pairing_fail {
31 __u8 reason;
32} __packed;
33
34#define SMP_CMD_ENCRYPT_INFO 0x06
35struct smp_cmd_encrypt_info {
36 __u8 ltk[16];
37} __packed;
38
39#define SMP_CMD_MASTER_IDENT 0x07
40struct smp_cmd_master_ident {
41 __u16 ediv;
42 __u8 rand[8];
43} __packed;
44
45#define SMP_CMD_IDENT_INFO 0x08
46struct smp_cmd_ident_info {
47 __u8 irk[16];
48} __packed;
49
50#define SMP_CMD_IDENT_ADDR_INFO 0x09
51struct smp_cmd_ident_addr_info {
52 __u8 addr_type;
53 bdaddr_t bdaddr;
54} __packed;
55
56#define SMP_CMD_SIGN_INFO 0x0a
57struct smp_cmd_sign_info {
58 __u8 csrk[16];
59} __packed;
60
61#define SMP_CMD_SECURITY_REQ 0x0b
62struct smp_cmd_security_req {
63 __u8 auth_req;
64} __packed;
65
66#define SMP_PASSKEY_ENTRY_FAILED 0x01
67#define SMP_OOB_NOT_AVAIL 0x02
68#define SMP_AUTH_REQUIREMENTS 0x03
69#define SMP_CONFIRM_FAILED 0x04
70#define SMP_PAIRING_NOTSUPP 0x05
71#define SMP_ENC_KEY_SIZE 0x06
72#define SMP_CMD_NOTSUPP 0x07
73#define SMP_UNSPECIFIED 0x08
74#define SMP_REPEATED_ATTEMPTS 0x09
75
76#endif /* __SMP_H */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1322695beb52..b2b9d28cb4ab 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -413,7 +413,7 @@ struct station_parameters {
413 * @STATION_INFO_PLID: @plid filled 413 * @STATION_INFO_PLID: @plid filled
414 * @STATION_INFO_PLINK_STATE: @plink_state filled 414 * @STATION_INFO_PLINK_STATE: @plink_state filled
415 * @STATION_INFO_SIGNAL: @signal filled 415 * @STATION_INFO_SIGNAL: @signal filled
416 * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled 416 * @STATION_INFO_TX_BITRATE: @txrate fields are filled
417 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) 417 * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
418 * @STATION_INFO_RX_PACKETS: @rx_packets filled 418 * @STATION_INFO_RX_PACKETS: @rx_packets filled
419 * @STATION_INFO_TX_PACKETS: @tx_packets filled 419 * @STATION_INFO_TX_PACKETS: @tx_packets filled
@@ -421,6 +421,7 @@ struct station_parameters {
421 * @STATION_INFO_TX_FAILED: @tx_failed filled 421 * @STATION_INFO_TX_FAILED: @tx_failed filled
422 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled 422 * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled
423 * @STATION_INFO_SIGNAL_AVG: @signal_avg filled 423 * @STATION_INFO_SIGNAL_AVG: @signal_avg filled
424 * @STATION_INFO_RX_BITRATE: @rxrate fields are filled
424 */ 425 */
425enum station_info_flags { 426enum station_info_flags {
426 STATION_INFO_INACTIVE_TIME = 1<<0, 427 STATION_INFO_INACTIVE_TIME = 1<<0,
@@ -437,6 +438,7 @@ enum station_info_flags {
437 STATION_INFO_TX_FAILED = 1<<11, 438 STATION_INFO_TX_FAILED = 1<<11,
438 STATION_INFO_RX_DROP_MISC = 1<<12, 439 STATION_INFO_RX_DROP_MISC = 1<<12,
439 STATION_INFO_SIGNAL_AVG = 1<<13, 440 STATION_INFO_SIGNAL_AVG = 1<<13,
441 STATION_INFO_RX_BITRATE = 1<<14,
440}; 442};
441 443
442/** 444/**
@@ -484,7 +486,8 @@ struct rate_info {
484 * @plink_state: mesh peer link state 486 * @plink_state: mesh peer link state
485 * @signal: signal strength of last received packet in dBm 487 * @signal: signal strength of last received packet in dBm
486 * @signal_avg: signal strength average in dBm 488 * @signal_avg: signal strength average in dBm
487 * @txrate: current unicast bitrate to this station 489 * @txrate: current unicast bitrate from this station
490 * @rxrate: current unicast bitrate to this station
488 * @rx_packets: packets received from this station 491 * @rx_packets: packets received from this station
489 * @tx_packets: packets transmitted to this station 492 * @tx_packets: packets transmitted to this station
490 * @tx_retries: cumulative retry counts 493 * @tx_retries: cumulative retry counts
@@ -506,6 +509,7 @@ struct station_info {
506 s8 signal; 509 s8 signal;
507 s8 signal_avg; 510 s8 signal_avg;
508 struct rate_info txrate; 511 struct rate_info txrate;
512 struct rate_info rxrate;
509 u32 rx_packets; 513 u32 rx_packets;
510 u32 tx_packets; 514 u32 tx_packets;
511 u32 tx_retries; 515 u32 tx_retries;
@@ -1194,6 +1198,10 @@ struct cfg80211_pmksa {
1194 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). 1198 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
1195 * 1199 *
1196 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). 1200 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
1201 *
1202 * @set_ringparam: Set tx and rx ring sizes.
1203 *
1204 * @get_ringparam: Get tx and rx ring current and maximum sizes.
1197 */ 1205 */
1198struct cfg80211_ops { 1206struct cfg80211_ops {
1199 int (*suspend)(struct wiphy *wiphy); 1207 int (*suspend)(struct wiphy *wiphy);
@@ -1361,6 +1369,10 @@ struct cfg80211_ops {
1361 1369
1362 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 1370 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
1363 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); 1371 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
1372
1373 int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx);
1374 void (*get_ringparam)(struct wiphy *wiphy,
1375 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1364}; 1376};
1365 1377
1366/* 1378/*
@@ -1790,8 +1802,9 @@ static inline void *wdev_priv(struct wireless_dev *wdev)
1790/** 1802/**
1791 * ieee80211_channel_to_frequency - convert channel number to frequency 1803 * ieee80211_channel_to_frequency - convert channel number to frequency
1792 * @chan: channel number 1804 * @chan: channel number
1805 * @band: band, necessary due to channel number overlap
1793 */ 1806 */
1794extern int ieee80211_channel_to_frequency(int chan); 1807extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
1795 1808
1796/** 1809/**
1797 * ieee80211_frequency_to_channel - convert frequency to channel number 1810 * ieee80211_frequency_to_channel - convert frequency to channel number
diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h
index a8e7852b10ab..e5983c9053dc 100644
--- a/include/net/dcbnl.h
+++ b/include/net/dcbnl.h
@@ -43,6 +43,8 @@ struct dcbnl_rtnl_ops {
43 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *); 43 int (*ieee_setpfc) (struct net_device *, struct ieee_pfc *);
44 int (*ieee_getapp) (struct net_device *, struct dcb_app *); 44 int (*ieee_getapp) (struct net_device *, struct dcb_app *);
45 int (*ieee_setapp) (struct net_device *, struct dcb_app *); 45 int (*ieee_setapp) (struct net_device *, struct dcb_app *);
46 int (*ieee_peer_getets) (struct net_device *, struct ieee_ets *);
47 int (*ieee_peer_getpfc) (struct net_device *, struct ieee_pfc *);
46 48
47 /* CEE std */ 49 /* CEE std */
48 u8 (*getstate)(struct net_device *); 50 u8 (*getstate)(struct net_device *);
@@ -77,7 +79,14 @@ struct dcbnl_rtnl_ops {
77 u8 (*getdcbx)(struct net_device *); 79 u8 (*getdcbx)(struct net_device *);
78 u8 (*setdcbx)(struct net_device *, u8); 80 u8 (*setdcbx)(struct net_device *, u8);
79 81
82 /* peer apps */
83 int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *,
84 u16 *);
85 int (*peer_getapptable)(struct net_device *, struct dcb_app *);
80 86
87 /* CEE peer */
88 int (*cee_peer_getpg) (struct net_device *, struct cee_pg *);
89 int (*cee_peer_getpfc) (struct net_device *, struct cee_pfc *);
81}; 90};
82 91
83#endif /* __NET_DCBNL_H__ */ 92#endif /* __NET_DCBNL_H__ */
diff --git a/include/net/dn.h b/include/net/dn.h
index a514a3cf4573..298521e0d8a2 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -192,10 +192,10 @@ static inline void dn_dn2eth(unsigned char *ethaddr, __le16 addr)
192 ethaddr[5] = (__u8)(a >> 8); 192 ethaddr[5] = (__u8)(a >> 8);
193} 193}
194 194
195static inline void dn_sk_ports_copy(struct flowi *fl, struct dn_scp *scp) 195static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
196{ 196{
197 fl->uli_u.dnports.sport = scp->addrloc; 197 fld->fld_sport = scp->addrloc;
198 fl->uli_u.dnports.dport = scp->addrrem; 198 fld->fld_dport = scp->addrrem;
199} 199}
200 200
201extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu); 201extern unsigned dn_mss_from_pmtu(struct net_device *dev, int mtu);
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index bbcde3238e58..782ef7cb4930 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -98,7 +98,7 @@ struct dn_fib_table {
98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r, 98 int (*delete)(struct dn_fib_table *t, struct rtmsg *r,
99 struct dn_kern_rta *rta, struct nlmsghdr *n, 99 struct dn_kern_rta *rta, struct nlmsghdr *n,
100 struct netlink_skb_parms *req); 100 struct netlink_skb_parms *req);
101 int (*lookup)(struct dn_fib_table *t, const struct flowi *fl, 101 int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,
102 struct dn_fib_res *res); 102 struct dn_fib_res *res);
103 int (*flush)(struct dn_fib_table *t); 103 int (*flush)(struct dn_fib_table *t);
104 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb); 104 int (*dump)(struct dn_fib_table *t, struct sk_buff *skb, struct netlink_callback *cb);
@@ -119,12 +119,12 @@ extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
119 struct dn_kern_rta *rta, 119 struct dn_kern_rta *rta,
120 const struct nlmsghdr *nlh, int *errp); 120 const struct nlmsghdr *nlh, int *errp);
121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 121extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
122 const struct flowi *fl, 122 const struct flowidn *fld,
123 struct dn_fib_res *res); 123 struct dn_fib_res *res);
124extern void dn_fib_release_info(struct dn_fib_info *fi); 124extern void dn_fib_release_info(struct dn_fib_info *fi);
125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type); 125extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);
126extern void dn_fib_flush(void); 126extern void dn_fib_flush(void);
127extern void dn_fib_select_multipath(const struct flowi *fl, 127extern void dn_fib_select_multipath(const struct flowidn *fld,
128 struct dn_fib_res *res); 128 struct dn_fib_res *res);
129 129
130/* 130/*
@@ -141,7 +141,7 @@ extern void dn_fib_table_cleanup(void);
141extern void dn_fib_rules_init(void); 141extern void dn_fib_rules_init(void);
142extern void dn_fib_rules_cleanup(void); 142extern void dn_fib_rules_cleanup(void);
143extern unsigned dnet_addr_type(__le16 addr); 143extern unsigned dnet_addr_type(__le16 addr);
144extern int dn_fib_lookup(struct flowi *fl, struct dn_fib_res *res); 144extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
145 145
146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 146extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
147 147
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 9b185df265fb..81712cfa1ddf 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -16,7 +16,7 @@
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowi *, struct sock *sk, int flags); 19extern int dn_route_output_sock(struct dst_entry **pprt, struct flowidn *, struct sock *sk, int flags);
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
21extern void dn_rt_cache_flush(int delay); 21extern void dn_rt_cache_flush(int delay);
22 22
@@ -67,7 +67,7 @@ extern void dn_rt_cache_flush(int delay);
67struct dn_route { 67struct dn_route {
68 struct dst_entry dst; 68 struct dst_entry dst;
69 69
70 struct flowi fl; 70 struct flowidn fld;
71 71
72 __le16 rt_saddr; 72 __le16 rt_saddr;
73 __le16 rt_daddr; 73 __le16 rt_daddr;
@@ -82,12 +82,12 @@ struct dn_route {
82 82
83static inline bool dn_is_input_route(struct dn_route *rt) 83static inline bool dn_is_input_route(struct dn_route *rt)
84{ 84{
85 return rt->fl.iif != 0; 85 return rt->fld.flowidn_iif != 0;
86} 86}
87 87
88static inline bool dn_is_output_route(struct dn_route *rt) 88static inline bool dn_is_output_route(struct dn_route *rt)
89{ 89{
90 return rt->fl.iif == 0; 90 return rt->fld.flowidn_iif == 0;
91} 91}
92 92
93extern void dn_route_init(void); 93extern void dn_route_init(void);
diff --git a/include/net/dst.h b/include/net/dst.h
index 93b0310317be..2a46cbaef92d 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -40,24 +40,10 @@ struct dst_entry {
40 struct rcu_head rcu_head; 40 struct rcu_head rcu_head;
41 struct dst_entry *child; 41 struct dst_entry *child;
42 struct net_device *dev; 42 struct net_device *dev;
43 short error; 43 struct dst_ops *ops;
44 short obsolete; 44 unsigned long _metrics;
45 int flags;
46#define DST_HOST 0x0001
47#define DST_NOXFRM 0x0002
48#define DST_NOPOLICY 0x0004
49#define DST_NOHASH 0x0008
50#define DST_NOCACHE 0x0010
51 unsigned long expires; 45 unsigned long expires;
52
53 unsigned short header_len; /* more space at head required */
54 unsigned short trailer_len; /* space to reserve at tail */
55
56 unsigned int rate_tokens;
57 unsigned long rate_last; /* rate limiting for ICMP */
58
59 struct dst_entry *path; 46 struct dst_entry *path;
60
61 struct neighbour *neighbour; 47 struct neighbour *neighbour;
62 struct hh_cache *hh; 48 struct hh_cache *hh;
63#ifdef CONFIG_XFRM 49#ifdef CONFIG_XFRM
@@ -68,17 +54,16 @@ struct dst_entry {
68 int (*input)(struct sk_buff*); 54 int (*input)(struct sk_buff*);
69 int (*output)(struct sk_buff*); 55 int (*output)(struct sk_buff*);
70 56
71 struct dst_ops *ops; 57 short error;
72 58 short obsolete;
73 u32 _metrics[RTAX_MAX]; 59 unsigned short header_len; /* more space at head required */
74 60 unsigned short trailer_len; /* space to reserve at tail */
75#ifdef CONFIG_NET_CLS_ROUTE 61#ifdef CONFIG_IP_ROUTE_CLASSID
76 __u32 tclassid; 62 __u32 tclassid;
77#else 63#else
78 __u32 __pad2; 64 __u32 __pad2;
79#endif 65#endif
80 66
81
82 /* 67 /*
83 * Align __refcnt to a 64 bytes alignment 68 * Align __refcnt to a 64 bytes alignment
84 * (L1_CACHE_SIZE would be too much) 69 * (L1_CACHE_SIZE would be too much)
@@ -93,6 +78,12 @@ struct dst_entry {
93 atomic_t __refcnt; /* client references */ 78 atomic_t __refcnt; /* client references */
94 int __use; 79 int __use;
95 unsigned long lastuse; 80 unsigned long lastuse;
81 int flags;
82#define DST_HOST 0x0001
83#define DST_NOXFRM 0x0002
84#define DST_NOPOLICY 0x0004
85#define DST_NOHASH 0x0008
86#define DST_NOCACHE 0x0010
96 union { 87 union {
97 struct dst_entry *next; 88 struct dst_entry *next;
98 struct rtable __rcu *rt_next; 89 struct rtable __rcu *rt_next;
@@ -103,10 +94,70 @@ struct dst_entry {
103 94
104#ifdef __KERNEL__ 95#ifdef __KERNEL__
105 96
97extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
98extern const u32 dst_default_metrics[RTAX_MAX];
99
100#define DST_METRICS_READ_ONLY 0x1UL
101#define __DST_METRICS_PTR(Y) \
102 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY))
103#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
104
105static inline bool dst_metrics_read_only(const struct dst_entry *dst)
106{
107 return dst->_metrics & DST_METRICS_READ_ONLY;
108}
109
110extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
111
112static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
113{
114 unsigned long val = dst->_metrics;
115 if (!(val & DST_METRICS_READ_ONLY))
116 __dst_destroy_metrics_generic(dst, val);
117}
118
119static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
120{
121 unsigned long p = dst->_metrics;
122
123 if (p & DST_METRICS_READ_ONLY)
124 return dst->ops->cow_metrics(dst, p);
125 return __DST_METRICS_PTR(p);
126}
127
128/* This may only be invoked before the entry has reached global
129 * visibility.
130 */
131static inline void dst_init_metrics(struct dst_entry *dst,
132 const u32 *src_metrics,
133 bool read_only)
134{
135 dst->_metrics = ((unsigned long) src_metrics) |
136 (read_only ? DST_METRICS_READ_ONLY : 0);
137}
138
139static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src)
140{
141 u32 *dst_metrics = dst_metrics_write_ptr(dest);
142
143 if (dst_metrics) {
144 u32 *src_metrics = DST_METRICS_PTR(src);
145
146 memcpy(dst_metrics, src_metrics, RTAX_MAX * sizeof(u32));
147 }
148}
149
150static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
151{
152 return DST_METRICS_PTR(dst);
153}
154
106static inline u32 155static inline u32
107dst_metric_raw(const struct dst_entry *dst, const int metric) 156dst_metric_raw(const struct dst_entry *dst, const int metric)
108{ 157{
109 return dst->_metrics[metric-1]; 158 u32 *p = DST_METRICS_PTR(dst);
159
160 return p[metric-1];
110} 161}
111 162
112static inline u32 163static inline u32
@@ -131,22 +182,10 @@ dst_metric_advmss(const struct dst_entry *dst)
131 182
132static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val) 183static inline void dst_metric_set(struct dst_entry *dst, int metric, u32 val)
133{ 184{
134 dst->_metrics[metric-1] = val; 185 u32 *p = dst_metrics_write_ptr(dst);
135}
136 186
137static inline void dst_import_metrics(struct dst_entry *dst, const u32 *src_metrics) 187 if (p)
138{ 188 p[metric-1] = val;
139 memcpy(dst->_metrics, src_metrics, RTAX_MAX * sizeof(u32));
140}
141
142static inline void dst_copy_metrics(struct dst_entry *dest, const struct dst_entry *src)
143{
144 dst_import_metrics(dest, src->_metrics);
145}
146
147static inline u32 *dst_metrics_ptr(struct dst_entry *dst)
148{
149 return dst->_metrics;
150} 189}
151 190
152static inline u32 191static inline u32
@@ -181,8 +220,6 @@ static inline u32
181dst_allfrag(const struct dst_entry *dst) 220dst_allfrag(const struct dst_entry *dst)
182{ 221{
183 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG); 222 int ret = dst_feature(dst, RTAX_FEATURE_ALLFRAG);
184 /* Yes, _exactly_. This is paranoia. */
185 barrier();
186 return ret; 223 return ret;
187} 224}
188 225
@@ -315,7 +352,7 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
315} 352}
316 353
317extern int dst_discard(struct sk_buff *skb); 354extern int dst_discard(struct sk_buff *skb);
318extern void * dst_alloc(struct dst_ops * ops); 355extern void *dst_alloc(struct dst_ops * ops, int initial_ref);
319extern void __dst_free(struct dst_entry * dst); 356extern void __dst_free(struct dst_entry * dst);
320extern struct dst_entry *dst_destroy(struct dst_entry * dst); 357extern struct dst_entry *dst_destroy(struct dst_entry * dst);
321 358
@@ -384,27 +421,22 @@ extern void dst_init(void);
384 421
385/* Flags for xfrm_lookup flags argument. */ 422/* Flags for xfrm_lookup flags argument. */
386enum { 423enum {
387 XFRM_LOOKUP_WAIT = 1 << 0, 424 XFRM_LOOKUP_ICMP = 1 << 0,
388 XFRM_LOOKUP_ICMP = 1 << 1,
389}; 425};
390 426
391struct flowi; 427struct flowi;
392#ifndef CONFIG_XFRM 428#ifndef CONFIG_XFRM
393static inline int xfrm_lookup(struct net *net, struct dst_entry **dst_p, 429static inline struct dst_entry *xfrm_lookup(struct net *net,
394 struct flowi *fl, struct sock *sk, int flags) 430 struct dst_entry *dst_orig,
431 const struct flowi *fl, struct sock *sk,
432 int flags)
395{ 433{
396 return 0; 434 return dst_orig;
397} 435}
398static inline int __xfrm_lookup(struct net *net, struct dst_entry **dst_p,
399 struct flowi *fl, struct sock *sk, int flags)
400{
401 return 0;
402}
403#else 436#else
404extern int xfrm_lookup(struct net *net, struct dst_entry **dst_p, 437extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
405 struct flowi *fl, struct sock *sk, int flags); 438 const struct flowi *fl, struct sock *sk,
406extern int __xfrm_lookup(struct net *net, struct dst_entry **dst_p, 439 int flags);
407 struct flowi *fl, struct sock *sk, int flags);
408#endif 440#endif
409#endif 441#endif
410 442
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
index 21a320b8708e..dc0746328947 100644
--- a/include/net/dst_ops.h
+++ b/include/net/dst_ops.h
@@ -18,6 +18,7 @@ struct dst_ops {
18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); 18 struct dst_entry * (*check)(struct dst_entry *, __u32 cookie);
19 unsigned int (*default_advmss)(const struct dst_entry *); 19 unsigned int (*default_advmss)(const struct dst_entry *);
20 unsigned int (*default_mtu)(const struct dst_entry *); 20 unsigned int (*default_mtu)(const struct dst_entry *);
21 u32 * (*cow_metrics)(struct dst_entry *, unsigned long);
21 void (*destroy)(struct dst_entry *); 22 void (*destroy)(struct dst_entry *);
22 void (*ifdown)(struct dst_entry *, 23 void (*ifdown)(struct dst_entry *,
23 struct net_device *dev, int how); 24 struct net_device *dev, int how);
diff --git a/include/net/flow.h b/include/net/flow.h
index 240b7f356c71..7fe5a0f9483a 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -10,78 +10,136 @@
10#include <linux/in6.h> 10#include <linux/in6.h>
11#include <asm/atomic.h> 11#include <asm/atomic.h>
12 12
13struct flowi { 13struct flowi_common {
14 int oif; 14 int flowic_oif;
15 int iif; 15 int flowic_iif;
16 __u32 mark; 16 __u32 flowic_mark;
17 __u8 flowic_tos;
18 __u8 flowic_scope;
19 __u8 flowic_proto;
20 __u8 flowic_flags;
21#define FLOWI_FLAG_ANYSRC 0x01
22#define FLOWI_FLAG_PRECOW_METRICS 0x02
23#define FLOWI_FLAG_CAN_SLEEP 0x04
24 __u32 flowic_secid;
25};
17 26
27union flowi_uli {
28 struct {
29 __be16 sport;
30 __be16 dport;
31 } ports;
32
33 struct {
34 __u8 type;
35 __u8 code;
36 } icmpt;
37
38 struct {
39 __le16 sport;
40 __le16 dport;
41 } dnports;
42
43 __be32 spi;
44 __be32 gre_key;
45
46 struct {
47 __u8 type;
48 } mht;
49};
50
51struct flowi4 {
52 struct flowi_common __fl_common;
53#define flowi4_oif __fl_common.flowic_oif
54#define flowi4_iif __fl_common.flowic_iif
55#define flowi4_mark __fl_common.flowic_mark
56#define flowi4_tos __fl_common.flowic_tos
57#define flowi4_scope __fl_common.flowic_scope
58#define flowi4_proto __fl_common.flowic_proto
59#define flowi4_flags __fl_common.flowic_flags
60#define flowi4_secid __fl_common.flowic_secid
61 __be32 daddr;
62 __be32 saddr;
63 union flowi_uli uli;
64#define fl4_sport uli.ports.sport
65#define fl4_dport uli.ports.dport
66#define fl4_icmp_type uli.icmpt.type
67#define fl4_icmp_code uli.icmpt.code
68#define fl4_ipsec_spi uli.spi
69#define fl4_mh_type uli.mht.type
70#define fl4_gre_key uli.gre_key
71};
72
73struct flowi6 {
74 struct flowi_common __fl_common;
75#define flowi6_oif __fl_common.flowic_oif
76#define flowi6_iif __fl_common.flowic_iif
77#define flowi6_mark __fl_common.flowic_mark
78#define flowi6_tos __fl_common.flowic_tos
79#define flowi6_scope __fl_common.flowic_scope
80#define flowi6_proto __fl_common.flowic_proto
81#define flowi6_flags __fl_common.flowic_flags
82#define flowi6_secid __fl_common.flowic_secid
83 struct in6_addr daddr;
84 struct in6_addr saddr;
85 __be32 flowlabel;
86 union flowi_uli uli;
87#define fl6_sport uli.ports.sport
88#define fl6_dport uli.ports.dport
89#define fl6_icmp_type uli.icmpt.type
90#define fl6_icmp_code uli.icmpt.code
91#define fl6_ipsec_spi uli.spi
92#define fl6_mh_type uli.mht.type
93#define fl6_gre_key uli.gre_key
94};
95
96struct flowidn {
97 struct flowi_common __fl_common;
98#define flowidn_oif __fl_common.flowic_oif
99#define flowidn_iif __fl_common.flowic_iif
100#define flowidn_mark __fl_common.flowic_mark
101#define flowidn_scope __fl_common.flowic_scope
102#define flowidn_proto __fl_common.flowic_proto
103#define flowidn_flags __fl_common.flowic_flags
104 __le16 daddr;
105 __le16 saddr;
106 union flowi_uli uli;
107#define fld_sport uli.ports.sport
108#define fld_dport uli.ports.dport
109};
110
111struct flowi {
18 union { 112 union {
19 struct { 113 struct flowi_common __fl_common;
20 __be32 daddr; 114 struct flowi4 ip4;
21 __be32 saddr; 115 struct flowi6 ip6;
22 __u8 tos; 116 struct flowidn dn;
23 __u8 scope; 117 } u;
24 } ip4_u; 118#define flowi_oif u.__fl_common.flowic_oif
25 119#define flowi_iif u.__fl_common.flowic_iif
26 struct { 120#define flowi_mark u.__fl_common.flowic_mark
27 struct in6_addr daddr; 121#define flowi_tos u.__fl_common.flowic_tos
28 struct in6_addr saddr; 122#define flowi_scope u.__fl_common.flowic_scope
29 __be32 flowlabel; 123#define flowi_proto u.__fl_common.flowic_proto
30 } ip6_u; 124#define flowi_flags u.__fl_common.flowic_flags
31 125#define flowi_secid u.__fl_common.flowic_secid
32 struct {
33 __le16 daddr;
34 __le16 saddr;
35 __u8 scope;
36 } dn_u;
37 } nl_u;
38#define fld_dst nl_u.dn_u.daddr
39#define fld_src nl_u.dn_u.saddr
40#define fld_scope nl_u.dn_u.scope
41#define fl6_dst nl_u.ip6_u.daddr
42#define fl6_src nl_u.ip6_u.saddr
43#define fl6_flowlabel nl_u.ip6_u.flowlabel
44#define fl4_dst nl_u.ip4_u.daddr
45#define fl4_src nl_u.ip4_u.saddr
46#define fl4_tos nl_u.ip4_u.tos
47#define fl4_scope nl_u.ip4_u.scope
48
49 __u8 proto;
50 __u8 flags;
51#define FLOWI_FLAG_ANYSRC 0x01
52 union {
53 struct {
54 __be16 sport;
55 __be16 dport;
56 } ports;
57
58 struct {
59 __u8 type;
60 __u8 code;
61 } icmpt;
62
63 struct {
64 __le16 sport;
65 __le16 dport;
66 } dnports;
67
68 __be32 spi;
69 __be32 gre_key;
70
71 struct {
72 __u8 type;
73 } mht;
74 } uli_u;
75#define fl_ip_sport uli_u.ports.sport
76#define fl_ip_dport uli_u.ports.dport
77#define fl_icmp_type uli_u.icmpt.type
78#define fl_icmp_code uli_u.icmpt.code
79#define fl_ipsec_spi uli_u.spi
80#define fl_mh_type uli_u.mht.type
81#define fl_gre_key uli_u.gre_key
82 __u32 secid; /* used by xfrm; see secid.txt */
83} __attribute__((__aligned__(BITS_PER_LONG/8))); 126} __attribute__((__aligned__(BITS_PER_LONG/8)));
84 127
128static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)
129{
130 return container_of(fl4, struct flowi, u.ip4);
131}
132
133static inline struct flowi *flowi6_to_flowi(struct flowi6 *fl6)
134{
135 return container_of(fl6, struct flowi, u.ip6);
136}
137
138static inline struct flowi *flowidn_to_flowi(struct flowidn *fldn)
139{
140 return container_of(fldn, struct flowi, u.dn);
141}
142
85#define FLOW_DIR_IN 0 143#define FLOW_DIR_IN 0
86#define FLOW_DIR_OUT 1 144#define FLOW_DIR_OUT 1
87#define FLOW_DIR_FWD 2 145#define FLOW_DIR_FWD 2
@@ -101,20 +159,14 @@ struct flow_cache_ops {
101}; 159};
102 160
103typedef struct flow_cache_object *(*flow_resolve_t)( 161typedef struct flow_cache_object *(*flow_resolve_t)(
104 struct net *net, struct flowi *key, u16 family, 162 struct net *net, const struct flowi *key, u16 family,
105 u8 dir, struct flow_cache_object *oldobj, void *ctx); 163 u8 dir, struct flow_cache_object *oldobj, void *ctx);
106 164
107extern struct flow_cache_object *flow_cache_lookup( 165extern struct flow_cache_object *flow_cache_lookup(
108 struct net *net, struct flowi *key, u16 family, 166 struct net *net, const struct flowi *key, u16 family,
109 u8 dir, flow_resolve_t resolver, void *ctx); 167 u8 dir, flow_resolve_t resolver, void *ctx);
110 168
111extern void flow_cache_flush(void); 169extern void flow_cache_flush(void);
112extern atomic_t flow_cache_genid; 170extern atomic_t flow_cache_genid;
113 171
114static inline int flow_cache_uli_match(struct flowi *fl1, struct flowi *fl2)
115{
116 return (fl1->proto == fl2->proto &&
117 !memcmp(&fl1->uli_u, &fl2->uli_u, sizeof(fl1->uli_u)));
118}
119
120#endif 172#endif
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6e991e0d0d6f..f0698b955b73 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -45,7 +45,4 @@ extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
45extern int icmp_init(void); 45extern int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 46extern void icmp_out_count(struct net *net, unsigned char type);
47 47
48/* Move into dst.h ? */
49extern int xrlim_allow(struct dst_entry *dst, int timeout);
50
51#endif /* _ICMP_H */ 48#endif /* _ICMP_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index af49f8ab7f81..b0be5fb9de19 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -178,6 +178,11 @@ struct ieee80211_radiotap_header {
178 * 178 *
179 * Number of unicast retries a transmitted frame used. 179 * Number of unicast retries a transmitted frame used.
180 * 180 *
181 * IEEE80211_RADIOTAP_MCS u8, u8, u8 unitless
182 *
183 * Contains a bitmap of known fields/flags, the flags, and
184 * the MCS index.
185 *
181 */ 186 */
182enum ieee80211_radiotap_type { 187enum ieee80211_radiotap_type {
183 IEEE80211_RADIOTAP_TSFT = 0, 188 IEEE80211_RADIOTAP_TSFT = 0,
@@ -199,6 +204,8 @@ enum ieee80211_radiotap_type {
199 IEEE80211_RADIOTAP_RTS_RETRIES = 16, 204 IEEE80211_RADIOTAP_RTS_RETRIES = 16,
200 IEEE80211_RADIOTAP_DATA_RETRIES = 17, 205 IEEE80211_RADIOTAP_DATA_RETRIES = 17,
201 206
207 IEEE80211_RADIOTAP_MCS = 19,
208
202 /* valid in every it_present bitmap, even vendor namespaces */ 209 /* valid in every it_present bitmap, even vendor namespaces */
203 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, 210 IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
204 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, 211 IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
@@ -245,6 +252,24 @@ enum ieee80211_radiotap_type {
245#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ 252#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */
246#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ 253#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */
247 254
255
256/* For IEEE80211_RADIOTAP_MCS */
257#define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01
258#define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02
259#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04
260#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08
261#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10
262
263#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03
264#define IEEE80211_RADIOTAP_MCS_BW_20 0
265#define IEEE80211_RADIOTAP_MCS_BW_40 1
266#define IEEE80211_RADIOTAP_MCS_BW_20L 2
267#define IEEE80211_RADIOTAP_MCS_BW_20U 3
268#define IEEE80211_RADIOTAP_MCS_SGI 0x04
269#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08
270#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10
271
272
248/* Ugly macro to convert literal channel numbers into their mhz equivalents 273/* Ugly macro to convert literal channel numbers into their mhz equivalents
249 * There are certianly some conditions that will break this (like feeding it '30') 274 * There are certianly some conditions that will break this (like feeding it '30')
250 * but they shouldn't arise since nothing talks on channel 30. */ 275 * but they shouldn't arise since nothing talks on channel 30. */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 8181498fa96c..7a37369f8ea3 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -86,6 +86,19 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
86 return (struct inet_request_sock *)sk; 86 return (struct inet_request_sock *)sk;
87} 87}
88 88
89struct inet_cork {
90 unsigned int flags;
91 unsigned int fragsize;
92 struct ip_options *opt;
93 struct dst_entry *dst;
94 int length; /* Total length of all frames */
95 __be32 addr;
96 struct flowi fl;
97 struct page *page;
98 u32 off;
99 u8 tx_flags;
100};
101
89struct ip_mc_socklist; 102struct ip_mc_socklist;
90struct ipv6_pinfo; 103struct ipv6_pinfo;
91struct rtable; 104struct rtable;
@@ -143,15 +156,7 @@ struct inet_sock {
143 int mc_index; 156 int mc_index;
144 __be32 mc_addr; 157 __be32 mc_addr;
145 struct ip_mc_socklist __rcu *mc_list; 158 struct ip_mc_socklist __rcu *mc_list;
146 struct { 159 struct inet_cork cork;
147 unsigned int flags;
148 unsigned int fragsize;
149 struct ip_options *opt;
150 struct dst_entry *dst;
151 int length; /* Total length of all frames */
152 __be32 addr;
153 struct flowi fl;
154 } cork;
155}; 160};
156 161
157#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ 162#define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */
@@ -219,7 +224,13 @@ static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops
219 224
220static inline __u8 inet_sk_flowi_flags(const struct sock *sk) 225static inline __u8 inet_sk_flowi_flags(const struct sock *sk)
221{ 226{
222 return inet_sk(sk)->transparent ? FLOWI_FLAG_ANYSRC : 0; 227 __u8 flags = 0;
228
229 if (inet_sk(sk)->transparent)
230 flags |= FLOWI_FLAG_ANYSRC;
231 if (sk->sk_protocol == IPPROTO_TCP)
232 flags |= FLOWI_FLAG_PRECOW_METRICS;
233 return flags;
223} 234}
224 235
225#endif /* _INET_SOCK_H */ 236#endif /* _INET_SOCK_H */
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 599d96e74114..e6dd8da6b2ad 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -11,15 +11,20 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/jiffies.h> 12#include <linux/jiffies.h>
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14#include <linux/rtnetlink.h>
14#include <net/ipv6.h> 15#include <net/ipv6.h>
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16 17
17struct inetpeer_addr { 18struct inetpeer_addr_base {
18 union { 19 union {
19 __be32 a4; 20 __be32 a4;
20 __be32 a6[4]; 21 __be32 a6[4];
21 }; 22 };
22 __u16 family; 23};
24
25struct inetpeer_addr {
26 struct inetpeer_addr_base addr;
27 __u16 family;
23}; 28};
24 29
25struct inet_peer { 30struct inet_peer {
@@ -33,15 +38,22 @@ struct inet_peer {
33 atomic_t refcnt; 38 atomic_t refcnt;
34 /* 39 /*
35 * Once inet_peer is queued for deletion (refcnt == -1), following fields 40 * Once inet_peer is queued for deletion (refcnt == -1), following fields
36 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 41 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp, metrics
37 * We can share memory with rcu_head to keep inet_peer small 42 * We can share memory with rcu_head to help keep inet_peer small.
38 */ 43 */
39 union { 44 union {
40 struct { 45 struct {
41 atomic_t rid; /* Frag reception counter */ 46 atomic_t rid; /* Frag reception counter */
42 atomic_t ip_id_count; /* IP ID for the next packet */ 47 atomic_t ip_id_count; /* IP ID for the next packet */
43 __u32 tcp_ts; 48 __u32 tcp_ts;
44 __u32 tcp_ts_stamp; 49 __u32 tcp_ts_stamp;
50 u32 metrics[RTAX_MAX];
51 u32 rate_tokens; /* rate limiting for ICMP */
52 unsigned long rate_last;
53 unsigned long pmtu_expires;
54 u32 pmtu_orig;
55 u32 pmtu_learned;
56 struct inetpeer_addr_base redirect_learned;
45 }; 57 };
46 struct rcu_head rcu; 58 struct rcu_head rcu;
47 }; 59 };
@@ -49,6 +61,13 @@ struct inet_peer {
49 61
50void inet_initpeers(void) __init; 62void inet_initpeers(void) __init;
51 63
64#define INETPEER_METRICS_NEW (~(u32) 0)
65
66static inline bool inet_metrics_new(const struct inet_peer *p)
67{
68 return p->metrics[RTAX_LOCK-1] == INETPEER_METRICS_NEW;
69}
70
52/* can be called with or without local BH being disabled */ 71/* can be called with or without local BH being disabled */
53struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create); 72struct inet_peer *inet_getpeer(struct inetpeer_addr *daddr, int create);
54 73
@@ -56,7 +75,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create)
56{ 75{
57 struct inetpeer_addr daddr; 76 struct inetpeer_addr daddr;
58 77
59 daddr.a4 = v4daddr; 78 daddr.addr.a4 = v4daddr;
60 daddr.family = AF_INET; 79 daddr.family = AF_INET;
61 return inet_getpeer(&daddr, create); 80 return inet_getpeer(&daddr, create);
62} 81}
@@ -65,13 +84,14 @@ static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int cr
65{ 84{
66 struct inetpeer_addr daddr; 85 struct inetpeer_addr daddr;
67 86
68 ipv6_addr_copy((struct in6_addr *)daddr.a6, v6daddr); 87 ipv6_addr_copy((struct in6_addr *)daddr.addr.a6, v6daddr);
69 daddr.family = AF_INET6; 88 daddr.family = AF_INET6;
70 return inet_getpeer(&daddr, create); 89 return inet_getpeer(&daddr, create);
71} 90}
72 91
73/* can be called from BH context or outside */ 92/* can be called from BH context or outside */
74extern void inet_putpeer(struct inet_peer *p); 93extern void inet_putpeer(struct inet_peer *p);
94extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
75 95
76/* 96/*
77 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 97 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 67fac78a186b..a4f631108c54 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -116,8 +116,24 @@ extern int ip_append_data(struct sock *sk,
116extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 116extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
117extern ssize_t ip_append_page(struct sock *sk, struct page *page, 117extern ssize_t ip_append_page(struct sock *sk, struct page *page,
118 int offset, size_t size, int flags); 118 int offset, size_t size, int flags);
119extern struct sk_buff *__ip_make_skb(struct sock *sk,
120 struct sk_buff_head *queue,
121 struct inet_cork *cork);
122extern int ip_send_skb(struct sk_buff *skb);
119extern int ip_push_pending_frames(struct sock *sk); 123extern int ip_push_pending_frames(struct sock *sk);
120extern void ip_flush_pending_frames(struct sock *sk); 124extern void ip_flush_pending_frames(struct sock *sk);
125extern struct sk_buff *ip_make_skb(struct sock *sk,
126 int getfrag(void *from, char *to, int offset, int len,
127 int odd, struct sk_buff *skb),
128 void *from, int length, int transhdrlen,
129 struct ipcm_cookie *ipc,
130 struct rtable **rtp,
131 unsigned int flags);
132
133static inline struct sk_buff *ip_finish_skb(struct sock *sk)
134{
135 return __ip_make_skb(sk, &sk->sk_write_queue, &inet_sk(sk)->cork);
136}
121 137
122/* datagram.c */ 138/* datagram.c */
123extern int ip4_datagram_connect(struct sock *sk, 139extern int ip4_datagram_connect(struct sock *sk,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 708ff7cb8806..bc3cde0a810c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -108,6 +108,7 @@ struct rt6_info {
108 u32 rt6i_flags; 108 u32 rt6i_flags;
109 struct rt6key rt6i_src; 109 struct rt6key rt6i_src;
110 u32 rt6i_metric; 110 u32 rt6i_metric;
111 u32 rt6i_peer_genid;
111 112
112 struct inet6_dev *rt6i_idev; 113 struct inet6_dev *rt6i_idev;
113 struct inet_peer *rt6i_peer; 114 struct inet_peer *rt6i_peer;
@@ -182,7 +183,7 @@ struct fib6_table {
182 183
183typedef struct rt6_info *(*pol_lookup_t)(struct net *, 184typedef struct rt6_info *(*pol_lookup_t)(struct net *,
184 struct fib6_table *, 185 struct fib6_table *,
185 struct flowi *, int); 186 struct flowi6 *, int);
186 187
187/* 188/*
188 * exported functions 189 * exported functions
@@ -191,7 +192,7 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
191extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 192extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
192extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 193extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
193extern struct dst_entry *fib6_rule_lookup(struct net *net, 194extern struct dst_entry *fib6_rule_lookup(struct net *net,
194 struct flowi *fl, int flags, 195 struct flowi6 *fl6, int flags,
195 pol_lookup_t lookup); 196 pol_lookup_t lookup);
196 197
197extern struct fib6_node *fib6_lookup(struct fib6_node *root, 198extern struct fib6_node *fib6_lookup(struct fib6_node *root,
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 8552f0a2e854..c850e5fb967c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -70,8 +70,8 @@ static inline struct inet_peer *rt6_get_peer(struct rt6_info *rt)
70extern void ip6_route_input(struct sk_buff *skb); 70extern void ip6_route_input(struct sk_buff *skb);
71 71
72extern struct dst_entry * ip6_route_output(struct net *net, 72extern struct dst_entry * ip6_route_output(struct net *net,
73 struct sock *sk, 73 const struct sock *sk,
74 struct flowi *fl); 74 struct flowi6 *fl6);
75 75
76extern int ip6_route_init(void); 76extern int ip6_route_init(void);
77extern void ip6_route_cleanup(void); 77extern void ip6_route_cleanup(void);
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 07bdb5e9e8ac..e5d66ec88cf6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -55,11 +55,13 @@ struct fib_nh {
55 int nh_weight; 55 int nh_weight;
56 int nh_power; 56 int nh_power;
57#endif 57#endif
58#ifdef CONFIG_NET_CLS_ROUTE 58#ifdef CONFIG_IP_ROUTE_CLASSID
59 __u32 nh_tclassid; 59 __u32 nh_tclassid;
60#endif 60#endif
61 int nh_oif; 61 int nh_oif;
62 __be32 nh_gw; 62 __be32 nh_gw;
63 __be32 nh_saddr;
64 int nh_saddr_genid;
63}; 65};
64 66
65/* 67/*
@@ -72,12 +74,13 @@ struct fib_info {
72 struct net *fib_net; 74 struct net *fib_net;
73 int fib_treeref; 75 int fib_treeref;
74 atomic_t fib_clntref; 76 atomic_t fib_clntref;
75 int fib_dead;
76 unsigned fib_flags; 77 unsigned fib_flags;
77 int fib_protocol; 78 unsigned char fib_dead;
79 unsigned char fib_protocol;
80 unsigned char fib_scope;
78 __be32 fib_prefsrc; 81 __be32 fib_prefsrc;
79 u32 fib_priority; 82 u32 fib_priority;
80 u32 fib_metrics[RTAX_MAX]; 83 u32 *fib_metrics;
81#define fib_mtu fib_metrics[RTAX_MTU-1] 84#define fib_mtu fib_metrics[RTAX_MTU-1]
82#define fib_window fib_metrics[RTAX_WINDOW-1] 85#define fib_window fib_metrics[RTAX_WINDOW-1]
83#define fib_rtt fib_metrics[RTAX_RTT-1] 86#define fib_rtt fib_metrics[RTAX_RTT-1]
@@ -96,12 +99,15 @@ struct fib_info {
96struct fib_rule; 99struct fib_rule;
97#endif 100#endif
98 101
102struct fib_table;
99struct fib_result { 103struct fib_result {
100 unsigned char prefixlen; 104 unsigned char prefixlen;
101 unsigned char nh_sel; 105 unsigned char nh_sel;
102 unsigned char type; 106 unsigned char type;
103 unsigned char scope; 107 unsigned char scope;
104 struct fib_info *fi; 108 struct fib_info *fi;
109 struct fib_table *table;
110 struct list_head *fa_head;
105#ifdef CONFIG_IP_MULTIPLE_TABLES 111#ifdef CONFIG_IP_MULTIPLE_TABLES
106 struct fib_rule *r; 112 struct fib_rule *r;
107#endif 113#endif
@@ -136,11 +142,20 @@ struct fib_result_nl {
136 142
137#endif /* CONFIG_IP_ROUTE_MULTIPATH */ 143#endif /* CONFIG_IP_ROUTE_MULTIPATH */
138 144
139#define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) 145extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
146
147#define FIB_RES_SADDR(net, res) \
148 ((FIB_RES_NH(res).nh_saddr_genid == \
149 atomic_read(&(net)->ipv4.dev_addr_genid)) ? \
150 FIB_RES_NH(res).nh_saddr : \
151 fib_info_update_nh_saddr((net), &FIB_RES_NH(res)))
140#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw) 152#define FIB_RES_GW(res) (FIB_RES_NH(res).nh_gw)
141#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev) 153#define FIB_RES_DEV(res) (FIB_RES_NH(res).nh_dev)
142#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif) 154#define FIB_RES_OIF(res) (FIB_RES_NH(res).nh_oif)
143 155
156#define FIB_RES_PREFSRC(net, res) ((res).fi->fib_prefsrc ? : \
157 FIB_RES_SADDR(net, res))
158
144struct fib_table { 159struct fib_table {
145 struct hlist_node tb_hlist; 160 struct hlist_node tb_hlist;
146 u32 tb_id; 161 u32 tb_id;
@@ -148,16 +163,13 @@ struct fib_table {
148 unsigned char tb_data[0]; 163 unsigned char tb_data[0];
149}; 164};
150 165
151extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, 166extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
152 struct fib_result *res, int fib_flags); 167 struct fib_result *res, int fib_flags);
153extern int fib_table_insert(struct fib_table *, struct fib_config *); 168extern int fib_table_insert(struct fib_table *, struct fib_config *);
154extern int fib_table_delete(struct fib_table *, struct fib_config *); 169extern int fib_table_delete(struct fib_table *, struct fib_config *);
155extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 170extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
156 struct netlink_callback *cb); 171 struct netlink_callback *cb);
157extern int fib_table_flush(struct fib_table *table); 172extern int fib_table_flush(struct fib_table *table);
158extern void fib_table_select_default(struct fib_table *table,
159 const struct flowi *flp,
160 struct fib_result *res);
161extern void fib_free_table(struct fib_table *tb); 173extern void fib_free_table(struct fib_table *tb);
162 174
163 175
@@ -182,7 +194,7 @@ static inline struct fib_table *fib_new_table(struct net *net, u32 id)
182 return fib_get_table(net, id); 194 return fib_get_table(net, id);
183} 195}
184 196
185static inline int fib_lookup(struct net *net, const struct flowi *flp, 197static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
186 struct fib_result *res) 198 struct fib_result *res)
187{ 199{
188 struct fib_table *table; 200 struct fib_table *table;
@@ -201,11 +213,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp,
201extern int __net_init fib4_rules_init(struct net *net); 213extern int __net_init fib4_rules_init(struct net *net);
202extern void __net_exit fib4_rules_exit(struct net *net); 214extern void __net_exit fib4_rules_exit(struct net *net);
203 215
204#ifdef CONFIG_NET_CLS_ROUTE 216#ifdef CONFIG_IP_ROUTE_CLASSID
205extern u32 fib_rules_tclass(struct fib_result *res); 217extern u32 fib_rules_tclass(const struct fib_result *res);
206#endif 218#endif
207 219
208extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); 220extern int fib_lookup(struct net *n, struct flowi4 *flp, struct fib_result *res);
209 221
210extern struct fib_table *fib_new_table(struct net *net, u32 id); 222extern struct fib_table *fib_new_table(struct net *net, u32 id);
211extern struct fib_table *fib_get_table(struct net *net, u32 id); 223extern struct fib_table *fib_get_table(struct net *net, u32 id);
@@ -218,24 +230,23 @@ extern void ip_fib_init(void);
218extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, 230extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
219 struct net_device *dev, __be32 *spec_dst, 231 struct net_device *dev, __be32 *spec_dst,
220 u32 *itag, u32 mark); 232 u32 *itag, u32 mark);
221extern void fib_select_default(struct net *net, const struct flowi *flp, 233extern void fib_select_default(struct fib_result *res);
222 struct fib_result *res);
223 234
224/* Exported by fib_semantics.c */ 235/* Exported by fib_semantics.c */
225extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 236extern int ip_fib_check_default(__be32 gw, struct net_device *dev);
226extern int fib_sync_down_dev(struct net_device *dev, int force); 237extern int fib_sync_down_dev(struct net_device *dev, int force);
227extern int fib_sync_down_addr(struct net *net, __be32 local); 238extern int fib_sync_down_addr(struct net *net, __be32 local);
239extern void fib_update_nh_saddrs(struct net_device *dev);
228extern int fib_sync_up(struct net_device *dev); 240extern int fib_sync_up(struct net_device *dev);
229extern __be32 __fib_res_prefsrc(struct fib_result *res); 241extern void fib_select_multipath(struct fib_result *res);
230extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res);
231 242
232/* Exported by fib_{hash|trie}.c */ 243/* Exported by fib_trie.c */
233extern void fib_hash_init(void); 244extern void fib_trie_init(void);
234extern struct fib_table *fib_hash_table(u32 id); 245extern struct fib_table *fib_trie_table(u32 id);
235 246
236static inline void fib_combine_itag(u32 *itag, struct fib_result *res) 247static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
237{ 248{
238#ifdef CONFIG_NET_CLS_ROUTE 249#ifdef CONFIG_IP_ROUTE_CLASSID
239#ifdef CONFIG_IP_MULTIPLE_TABLES 250#ifdef CONFIG_IP_MULTIPLE_TABLES
240 u32 rtag; 251 u32 rtag;
241#endif 252#endif
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index b7bbd6c28cfa..30b49ed72f0d 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -28,6 +28,80 @@
28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 28#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
29#include <net/netfilter/nf_conntrack.h> 29#include <net/netfilter/nf_conntrack.h>
30#endif 30#endif
31#include <net/net_namespace.h> /* Netw namespace */
32
33/*
34 * Generic access of ipvs struct
35 */
36static inline struct netns_ipvs *net_ipvs(struct net* net)
37{
38 return net->ipvs;
39}
40/*
41 * Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink)
43 */
44static inline struct net *skb_net(const struct sk_buff *skb)
45{
46#ifdef CONFIG_NET_NS
47#ifdef CONFIG_IP_VS_DEBUG
48 /*
49 * This is used for debug only.
50 * Start with the most likely hit
51 * End with BUG
52 */
53 if (likely(skb->dev && skb->dev->nd_net))
54 return dev_net(skb->dev);
55 if (skb_dst(skb)->dev)
56 return dev_net(skb_dst(skb)->dev);
57 WARN(skb->sk, "Maybe skb_sknet should be used in %s() at line:%d\n",
58 __func__, __LINE__);
59 if (likely(skb->sk && skb->sk->sk_net))
60 return sock_net(skb->sk);
61 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
62 __func__, __LINE__);
63 BUG();
64#else
65 return dev_net(skb->dev ? : skb_dst(skb)->dev);
66#endif
67#else
68 return &init_net;
69#endif
70}
71
72static inline struct net *skb_sknet(const struct sk_buff *skb)
73{
74#ifdef CONFIG_NET_NS
75#ifdef CONFIG_IP_VS_DEBUG
76 /* Start with the most likely hit */
77 if (likely(skb->sk && skb->sk->sk_net))
78 return sock_net(skb->sk);
79 WARN(skb->dev, "Maybe skb_net should be used instead in %s() line:%d\n",
80 __func__, __LINE__);
81 if (likely(skb->dev && skb->dev->nd_net))
82 return dev_net(skb->dev);
83 pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
84 __func__, __LINE__);
85 BUG();
86#else
87 return sock_net(skb->sk);
88#endif
89#else
90 return &init_net;
91#endif
92}
93/*
94 * This one needed for single_open_net since net is stored directly in
95 * private not as a struct i.e. seq_file_net cant be used.
96 */
97static inline struct net *seq_file_single_net(struct seq_file *seq)
98{
99#ifdef CONFIG_NET_NS
100 return (struct net *)seq->private;
101#else
102 return &init_net;
103#endif
104}
31 105
32/* Connections' size value needed by ip_vs_ctl.c */ 106/* Connections' size value needed by ip_vs_ctl.c */
33extern int ip_vs_conn_tab_size; 107extern int ip_vs_conn_tab_size;
@@ -258,6 +332,23 @@ struct ip_vs_seq {
258 before last resized pkt */ 332 before last resized pkt */
259}; 333};
260 334
335/*
336 * counters per cpu
337 */
338struct ip_vs_counters {
339 __u32 conns; /* connections scheduled */
340 __u32 inpkts; /* incoming packets */
341 __u32 outpkts; /* outgoing packets */
342 __u64 inbytes; /* incoming bytes */
343 __u64 outbytes; /* outgoing bytes */
344};
345/*
346 * Stats per cpu
347 */
348struct ip_vs_cpu_stats {
349 struct ip_vs_counters ustats;
350 struct u64_stats_sync syncp;
351};
261 352
262/* 353/*
263 * IPVS statistics objects 354 * IPVS statistics objects
@@ -279,10 +370,11 @@ struct ip_vs_estimator {
279}; 370};
280 371
281struct ip_vs_stats { 372struct ip_vs_stats {
282 struct ip_vs_stats_user ustats; /* statistics */ 373 struct ip_vs_stats_user ustats; /* statistics */
283 struct ip_vs_estimator est; /* estimator */ 374 struct ip_vs_estimator est; /* estimator */
284 375 struct ip_vs_cpu_stats *cpustats; /* per cpu counters */
285 spinlock_t lock; /* spin lock */ 376 spinlock_t lock; /* spin lock */
377 struct ip_vs_stats_user ustats0; /* reset values */
286}; 378};
287 379
288struct dst_entry; 380struct dst_entry;
@@ -290,6 +382,7 @@ struct iphdr;
290struct ip_vs_conn; 382struct ip_vs_conn;
291struct ip_vs_app; 383struct ip_vs_app;
292struct sk_buff; 384struct sk_buff;
385struct ip_vs_proto_data;
293 386
294struct ip_vs_protocol { 387struct ip_vs_protocol {
295 struct ip_vs_protocol *next; 388 struct ip_vs_protocol *next;
@@ -297,21 +390,22 @@ struct ip_vs_protocol {
297 u16 protocol; 390 u16 protocol;
298 u16 num_states; 391 u16 num_states;
299 int dont_defrag; 392 int dont_defrag;
300 atomic_t appcnt; /* counter of proto app incs */
301 int *timeout_table; /* protocol timeout table */
302 393
303 void (*init)(struct ip_vs_protocol *pp); 394 void (*init)(struct ip_vs_protocol *pp);
304 395
305 void (*exit)(struct ip_vs_protocol *pp); 396 void (*exit)(struct ip_vs_protocol *pp);
306 397
398 void (*init_netns)(struct net *net, struct ip_vs_proto_data *pd);
399
400 void (*exit_netns)(struct net *net, struct ip_vs_proto_data *pd);
401
307 int (*conn_schedule)(int af, struct sk_buff *skb, 402 int (*conn_schedule)(int af, struct sk_buff *skb,
308 struct ip_vs_protocol *pp, 403 struct ip_vs_proto_data *pd,
309 int *verdict, struct ip_vs_conn **cpp); 404 int *verdict, struct ip_vs_conn **cpp);
310 405
311 struct ip_vs_conn * 406 struct ip_vs_conn *
312 (*conn_in_get)(int af, 407 (*conn_in_get)(int af,
313 const struct sk_buff *skb, 408 const struct sk_buff *skb,
314 struct ip_vs_protocol *pp,
315 const struct ip_vs_iphdr *iph, 409 const struct ip_vs_iphdr *iph,
316 unsigned int proto_off, 410 unsigned int proto_off,
317 int inverse); 411 int inverse);
@@ -319,7 +413,6 @@ struct ip_vs_protocol {
319 struct ip_vs_conn * 413 struct ip_vs_conn *
320 (*conn_out_get)(int af, 414 (*conn_out_get)(int af,
321 const struct sk_buff *skb, 415 const struct sk_buff *skb,
322 struct ip_vs_protocol *pp,
323 const struct ip_vs_iphdr *iph, 416 const struct ip_vs_iphdr *iph,
324 unsigned int proto_off, 417 unsigned int proto_off,
325 int inverse); 418 int inverse);
@@ -337,11 +430,11 @@ struct ip_vs_protocol {
337 430
338 int (*state_transition)(struct ip_vs_conn *cp, int direction, 431 int (*state_transition)(struct ip_vs_conn *cp, int direction,
339 const struct sk_buff *skb, 432 const struct sk_buff *skb,
340 struct ip_vs_protocol *pp); 433 struct ip_vs_proto_data *pd);
341 434
342 int (*register_app)(struct ip_vs_app *inc); 435 int (*register_app)(struct net *net, struct ip_vs_app *inc);
343 436
344 void (*unregister_app)(struct ip_vs_app *inc); 437 void (*unregister_app)(struct net *net, struct ip_vs_app *inc);
345 438
346 int (*app_conn_bind)(struct ip_vs_conn *cp); 439 int (*app_conn_bind)(struct ip_vs_conn *cp);
347 440
@@ -350,14 +443,26 @@ struct ip_vs_protocol {
350 int offset, 443 int offset,
351 const char *msg); 444 const char *msg);
352 445
353 void (*timeout_change)(struct ip_vs_protocol *pp, int flags); 446 void (*timeout_change)(struct ip_vs_proto_data *pd, int flags);
447};
354 448
355 int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to); 449/*
450 * protocol data per netns
451 */
452struct ip_vs_proto_data {
453 struct ip_vs_proto_data *next;
454 struct ip_vs_protocol *pp;
455 int *timeout_table; /* protocol timeout table */
456 atomic_t appcnt; /* counter of proto app incs. */
457 struct tcp_states_t *tcp_state_table;
356}; 458};
357 459
358extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); 460extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
461extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
462 unsigned short proto);
359 463
360struct ip_vs_conn_param { 464struct ip_vs_conn_param {
465 struct net *net;
361 const union nf_inet_addr *caddr; 466 const union nf_inet_addr *caddr;
362 const union nf_inet_addr *vaddr; 467 const union nf_inet_addr *vaddr;
363 __be16 cport; 468 __be16 cport;
@@ -374,17 +479,20 @@ struct ip_vs_conn_param {
374 * IP_VS structure allocated for each dynamically scheduled connection 479 * IP_VS structure allocated for each dynamically scheduled connection
375 */ 480 */
376struct ip_vs_conn { 481struct ip_vs_conn {
377 struct list_head c_list; /* hashed list heads */ 482 struct hlist_node c_list; /* hashed list heads */
378 483#ifdef CONFIG_NET_NS
484 struct net *net; /* Name space */
485#endif
379 /* Protocol, addresses and port numbers */ 486 /* Protocol, addresses and port numbers */
380 u16 af; /* address family */ 487 u16 af; /* address family */
381 union nf_inet_addr caddr; /* client address */ 488 __be16 cport;
382 union nf_inet_addr vaddr; /* virtual address */ 489 __be16 vport;
383 union nf_inet_addr daddr; /* destination address */ 490 __be16 dport;
384 volatile __u32 flags; /* status flags */ 491 __u32 fwmark; /* Fire wall mark from skb */
385 __be16 cport; 492 union nf_inet_addr caddr; /* client address */
386 __be16 vport; 493 union nf_inet_addr vaddr; /* virtual address */
387 __be16 dport; 494 union nf_inet_addr daddr; /* destination address */
495 volatile __u32 flags; /* status flags */
388 __u16 protocol; /* Which protocol (TCP/UDP) */ 496 __u16 protocol; /* Which protocol (TCP/UDP) */
389 497
390 /* counter and timer */ 498 /* counter and timer */
@@ -422,10 +530,38 @@ struct ip_vs_conn {
422 struct ip_vs_seq in_seq; /* incoming seq. struct */ 530 struct ip_vs_seq in_seq; /* incoming seq. struct */
423 struct ip_vs_seq out_seq; /* outgoing seq. struct */ 531 struct ip_vs_seq out_seq; /* outgoing seq. struct */
424 532
533 const struct ip_vs_pe *pe;
425 char *pe_data; 534 char *pe_data;
426 __u8 pe_data_len; 535 __u8 pe_data_len;
427}; 536};
428 537
538/*
539 * To save some memory in conn table when name space is disabled.
540 */
541static inline struct net *ip_vs_conn_net(const struct ip_vs_conn *cp)
542{
543#ifdef CONFIG_NET_NS
544 return cp->net;
545#else
546 return &init_net;
547#endif
548}
549static inline void ip_vs_conn_net_set(struct ip_vs_conn *cp, struct net *net)
550{
551#ifdef CONFIG_NET_NS
552 cp->net = net;
553#endif
554}
555
556static inline int ip_vs_conn_net_eq(const struct ip_vs_conn *cp,
557 struct net *net)
558{
559#ifdef CONFIG_NET_NS
560 return cp->net == net;
561#else
562 return 1;
563#endif
564}
429 565
430/* 566/*
431 * Extended internal versions of struct ip_vs_service_user and 567 * Extended internal versions of struct ip_vs_service_user and
@@ -485,6 +621,7 @@ struct ip_vs_service {
485 unsigned flags; /* service status flags */ 621 unsigned flags; /* service status flags */
486 unsigned timeout; /* persistent timeout in ticks */ 622 unsigned timeout; /* persistent timeout in ticks */
487 __be32 netmask; /* grouping granularity */ 623 __be32 netmask; /* grouping granularity */
624 struct net *net;
488 625
489 struct list_head destinations; /* real server d-linked list */ 626 struct list_head destinations; /* real server d-linked list */
490 __u32 num_dests; /* number of servers */ 627 __u32 num_dests; /* number of servers */
@@ -510,8 +647,8 @@ struct ip_vs_dest {
510 struct list_head d_list; /* for table with all the dests */ 647 struct list_head d_list; /* for table with all the dests */
511 648
512 u16 af; /* address family */ 649 u16 af; /* address family */
513 union nf_inet_addr addr; /* IP address of the server */
514 __be16 port; /* port number of the server */ 650 __be16 port; /* port number of the server */
651 union nf_inet_addr addr; /* IP address of the server */
515 volatile unsigned flags; /* dest status flags */ 652 volatile unsigned flags; /* dest status flags */
516 atomic_t conn_flags; /* flags to copy to conn */ 653 atomic_t conn_flags; /* flags to copy to conn */
517 atomic_t weight; /* server weight */ 654 atomic_t weight; /* server weight */
@@ -538,8 +675,8 @@ struct ip_vs_dest {
538 /* for virtual service */ 675 /* for virtual service */
539 struct ip_vs_service *svc; /* service it belongs to */ 676 struct ip_vs_service *svc; /* service it belongs to */
540 __u16 protocol; /* which protocol (TCP/UDP) */ 677 __u16 protocol; /* which protocol (TCP/UDP) */
541 union nf_inet_addr vaddr; /* virtual IP address */
542 __be16 vport; /* virtual port number */ 678 __be16 vport; /* virtual port number */
679 union nf_inet_addr vaddr; /* virtual IP address */
543 __u32 vfwmark; /* firewall mark of service */ 680 __u32 vfwmark; /* firewall mark of service */
544}; 681};
545 682
@@ -651,6 +788,169 @@ struct ip_vs_app {
651 void (*timeout_change)(struct ip_vs_app *app, int flags); 788 void (*timeout_change)(struct ip_vs_app *app, int flags);
652}; 789};
653 790
791/* IPVS in network namespace */
792struct netns_ipvs {
793 int gen; /* Generation */
794 /*
795 * Hash table: for real service lookups
796 */
797 #define IP_VS_RTAB_BITS 4
798 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
799 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
800
801 struct list_head rs_table[IP_VS_RTAB_SIZE];
802 /* ip_vs_app */
803 struct list_head app_list;
804
805 /* ip_vs_proto */
806 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
807 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
808 /* ip_vs_proto_tcp */
809#ifdef CONFIG_IP_VS_PROTO_TCP
810 #define TCP_APP_TAB_BITS 4
811 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
812 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
813 struct list_head tcp_apps[TCP_APP_TAB_SIZE];
814 spinlock_t tcp_app_lock;
815#endif
816 /* ip_vs_proto_udp */
817#ifdef CONFIG_IP_VS_PROTO_UDP
818 #define UDP_APP_TAB_BITS 4
819 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
820 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
821 struct list_head udp_apps[UDP_APP_TAB_SIZE];
822 spinlock_t udp_app_lock;
823#endif
824 /* ip_vs_proto_sctp */
825#ifdef CONFIG_IP_VS_PROTO_SCTP
826 #define SCTP_APP_TAB_BITS 4
827 #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
828 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
829 /* Hash table for SCTP application incarnations */
830 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
831 spinlock_t sctp_app_lock;
832#endif
833 /* ip_vs_conn */
834 atomic_t conn_count; /* connection counter */
835
836 /* ip_vs_ctl */
837 struct ip_vs_stats tot_stats; /* Statistics & est. */
838
839 int num_services; /* no of virtual services */
840
841 rwlock_t rs_lock; /* real services table */
842 /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
843 struct lock_class_key ctl_key; /* ctl_mutex debuging */
844 /* Trash for destinations */
845 struct list_head dest_trash;
846 /* Service counters */
847 atomic_t ftpsvc_counter;
848 atomic_t nullsvc_counter;
849
850#ifdef CONFIG_SYSCTL
851 /* 1/rate drop and drop-entry variables */
852 struct delayed_work defense_work; /* Work handler */
853 int drop_rate;
854 int drop_counter;
855 atomic_t dropentry;
856 /* locks in ctl.c */
857 spinlock_t dropentry_lock; /* drop entry handling */
858 spinlock_t droppacket_lock; /* drop packet handling */
859 spinlock_t securetcp_lock; /* state and timeout tables */
860
861 /* sys-ctl struct */
862 struct ctl_table_header *sysctl_hdr;
863 struct ctl_table *sysctl_tbl;
864#endif
865
866 /* sysctl variables */
867 int sysctl_amemthresh;
868 int sysctl_am_droprate;
869 int sysctl_drop_entry;
870 int sysctl_drop_packet;
871 int sysctl_secure_tcp;
872#ifdef CONFIG_IP_VS_NFCT
873 int sysctl_conntrack;
874#endif
875 int sysctl_snat_reroute;
876 int sysctl_sync_ver;
877 int sysctl_cache_bypass;
878 int sysctl_expire_nodest_conn;
879 int sysctl_expire_quiescent_template;
880 int sysctl_sync_threshold[2];
881 int sysctl_nat_icmp_send;
882
883 /* ip_vs_lblc */
884 int sysctl_lblc_expiration;
885 struct ctl_table_header *lblc_ctl_header;
886 struct ctl_table *lblc_ctl_table;
887 /* ip_vs_lblcr */
888 int sysctl_lblcr_expiration;
889 struct ctl_table_header *lblcr_ctl_header;
890 struct ctl_table *lblcr_ctl_table;
891 /* ip_vs_est */
892 struct list_head est_list; /* estimator list */
893 spinlock_t est_lock;
894 struct timer_list est_timer; /* Estimation timer */
895 /* ip_vs_sync */
896 struct list_head sync_queue;
897 spinlock_t sync_lock;
898 struct ip_vs_sync_buff *sync_buff;
899 spinlock_t sync_buff_lock;
900 struct sockaddr_in sync_mcast_addr;
901 struct task_struct *master_thread;
902 struct task_struct *backup_thread;
903 int send_mesg_maxlen;
904 int recv_mesg_maxlen;
905 volatile int sync_state;
906 volatile int master_syncid;
907 volatile int backup_syncid;
908 /* multicast interface name */
909 char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
910 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
911 /* net name space ptr */
912 struct net *net; /* Needed by timer routines */
913};
914
915#define DEFAULT_SYNC_THRESHOLD 3
916#define DEFAULT_SYNC_PERIOD 50
917#define DEFAULT_SYNC_VER 1
918
919#ifdef CONFIG_SYSCTL
920
921static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
922{
923 return ipvs->sysctl_sync_threshold[0];
924}
925
926static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
927{
928 return ipvs->sysctl_sync_threshold[1];
929}
930
931static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
932{
933 return ipvs->sysctl_sync_ver;
934}
935
936#else
937
938static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
939{
940 return DEFAULT_SYNC_THRESHOLD;
941}
942
943static inline int sysctl_sync_period(struct netns_ipvs *ipvs)
944{
945 return DEFAULT_SYNC_PERIOD;
946}
947
948static inline int sysctl_sync_ver(struct netns_ipvs *ipvs)
949{
950 return DEFAULT_SYNC_VER;
951}
952
953#endif
654 954
655/* 955/*
656 * IPVS core functions 956 * IPVS core functions
@@ -674,13 +974,14 @@ enum {
674 IP_VS_DIR_LAST, 974 IP_VS_DIR_LAST,
675}; 975};
676 976
677static inline void ip_vs_conn_fill_param(int af, int protocol, 977static inline void ip_vs_conn_fill_param(struct net *net, int af, int protocol,
678 const union nf_inet_addr *caddr, 978 const union nf_inet_addr *caddr,
679 __be16 cport, 979 __be16 cport,
680 const union nf_inet_addr *vaddr, 980 const union nf_inet_addr *vaddr,
681 __be16 vport, 981 __be16 vport,
682 struct ip_vs_conn_param *p) 982 struct ip_vs_conn_param *p)
683{ 983{
984 p->net = net;
684 p->af = af; 985 p->af = af;
685 p->protocol = protocol; 986 p->protocol = protocol;
686 p->caddr = caddr; 987 p->caddr = caddr;
@@ -695,7 +996,6 @@ struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p);
695struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); 996struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p);
696 997
697struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, 998struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
698 struct ip_vs_protocol *pp,
699 const struct ip_vs_iphdr *iph, 999 const struct ip_vs_iphdr *iph,
700 unsigned int proto_off, 1000 unsigned int proto_off,
701 int inverse); 1001 int inverse);
@@ -703,7 +1003,6 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb,
703struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); 1003struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p);
704 1004
705struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, 1005struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,
706 struct ip_vs_protocol *pp,
707 const struct ip_vs_iphdr *iph, 1006 const struct ip_vs_iphdr *iph,
708 unsigned int proto_off, 1007 unsigned int proto_off,
709 int inverse); 1008 int inverse);
@@ -719,14 +1018,14 @@ extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
719struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1018struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
720 const union nf_inet_addr *daddr, 1019 const union nf_inet_addr *daddr,
721 __be16 dport, unsigned flags, 1020 __be16 dport, unsigned flags,
722 struct ip_vs_dest *dest); 1021 struct ip_vs_dest *dest, __u32 fwmark);
723extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1022extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
724 1023
725extern const char * ip_vs_state_name(__u16 proto, int state); 1024extern const char * ip_vs_state_name(__u16 proto, int state);
726 1025
727extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); 1026extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
728extern int ip_vs_check_template(struct ip_vs_conn *ct); 1027extern int ip_vs_check_template(struct ip_vs_conn *ct);
729extern void ip_vs_random_dropentry(void); 1028extern void ip_vs_random_dropentry(struct net *net);
730extern int ip_vs_conn_init(void); 1029extern int ip_vs_conn_init(void);
731extern void ip_vs_conn_cleanup(void); 1030extern void ip_vs_conn_cleanup(void);
732 1031
@@ -796,12 +1095,12 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
796 * (from ip_vs_app.c) 1095 * (from ip_vs_app.c)
797 */ 1096 */
798#define IP_VS_APP_MAX_PORTS 8 1097#define IP_VS_APP_MAX_PORTS 8
799extern int register_ip_vs_app(struct ip_vs_app *app); 1098extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app);
800extern void unregister_ip_vs_app(struct ip_vs_app *app); 1099extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
801extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1100extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
802extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1101extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
803extern int 1102extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app,
804register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port); 1103 __u16 proto, __u16 port);
805extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 1104extern int ip_vs_app_inc_get(struct ip_vs_app *inc);
806extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 1105extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
807 1106
@@ -814,15 +1113,27 @@ void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe);
814void ip_vs_unbind_pe(struct ip_vs_service *svc); 1113void ip_vs_unbind_pe(struct ip_vs_service *svc);
815int register_ip_vs_pe(struct ip_vs_pe *pe); 1114int register_ip_vs_pe(struct ip_vs_pe *pe);
816int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1115int unregister_ip_vs_pe(struct ip_vs_pe *pe);
817extern struct ip_vs_pe *ip_vs_pe_get(const char *name); 1116struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
818extern void ip_vs_pe_put(struct ip_vs_pe *pe); 1117struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1118
1119static inline void ip_vs_pe_get(const struct ip_vs_pe *pe)
1120{
1121 if (pe && pe->module)
1122 __module_get(pe->module);
1123}
1124
1125static inline void ip_vs_pe_put(const struct ip_vs_pe *pe)
1126{
1127 if (pe && pe->module)
1128 module_put(pe->module);
1129}
819 1130
820/* 1131/*
821 * IPVS protocol functions (from ip_vs_proto.c) 1132 * IPVS protocol functions (from ip_vs_proto.c)
822 */ 1133 */
823extern int ip_vs_protocol_init(void); 1134extern int ip_vs_protocol_init(void);
824extern void ip_vs_protocol_cleanup(void); 1135extern void ip_vs_protocol_cleanup(void);
825extern void ip_vs_protocol_timeout_change(int flags); 1136extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
826extern int *ip_vs_create_timeout_table(int *table, int size); 1137extern int *ip_vs_create_timeout_table(int *table, int size);
827extern int 1138extern int
828ip_vs_set_state_timeout(int *table, int num, const char *const *names, 1139ip_vs_set_state_timeout(int *table, int num, const char *const *names,
@@ -852,26 +1163,23 @@ extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
852extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1163extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
853extern struct ip_vs_conn * 1164extern struct ip_vs_conn *
854ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1165ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
855 struct ip_vs_protocol *pp, int *ignored); 1166 struct ip_vs_proto_data *pd, int *ignored);
856extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1167extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
857 struct ip_vs_protocol *pp); 1168 struct ip_vs_proto_data *pd);
1169
1170extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
858 1171
859 1172
860/* 1173/*
861 * IPVS control data and functions (from ip_vs_ctl.c) 1174 * IPVS control data and functions (from ip_vs_ctl.c)
862 */ 1175 */
863extern int sysctl_ip_vs_cache_bypass;
864extern int sysctl_ip_vs_expire_nodest_conn;
865extern int sysctl_ip_vs_expire_quiescent_template;
866extern int sysctl_ip_vs_sync_threshold[2];
867extern int sysctl_ip_vs_nat_icmp_send;
868extern int sysctl_ip_vs_conntrack;
869extern int sysctl_ip_vs_snat_reroute;
870extern struct ip_vs_stats ip_vs_stats; 1176extern struct ip_vs_stats ip_vs_stats;
871extern const struct ctl_path net_vs_ctl_path[]; 1177extern const struct ctl_path net_vs_ctl_path[];
1178extern int sysctl_ip_vs_sync_ver;
872 1179
1180extern void ip_vs_sync_switch_mode(struct net *net, int mode);
873extern struct ip_vs_service * 1181extern struct ip_vs_service *
874ip_vs_service_get(int af, __u32 fwmark, __u16 protocol, 1182ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol,
875 const union nf_inet_addr *vaddr, __be16 vport); 1183 const union nf_inet_addr *vaddr, __be16 vport);
876 1184
877static inline void ip_vs_service_put(struct ip_vs_service *svc) 1185static inline void ip_vs_service_put(struct ip_vs_service *svc)
@@ -880,7 +1188,7 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
880} 1188}
881 1189
882extern struct ip_vs_dest * 1190extern struct ip_vs_dest *
883ip_vs_lookup_real_service(int af, __u16 protocol, 1191ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol,
884 const union nf_inet_addr *daddr, __be16 dport); 1192 const union nf_inet_addr *daddr, __be16 dport);
885 1193
886extern int ip_vs_use_count_inc(void); 1194extern int ip_vs_use_count_inc(void);
@@ -888,8 +1196,9 @@ extern void ip_vs_use_count_dec(void);
888extern int ip_vs_control_init(void); 1196extern int ip_vs_control_init(void);
889extern void ip_vs_control_cleanup(void); 1197extern void ip_vs_control_cleanup(void);
890extern struct ip_vs_dest * 1198extern struct ip_vs_dest *
891ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport, 1199ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
892 const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol); 1200 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1201 __u16 protocol, __u32 fwmark);
893extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1202extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
894 1203
895 1204
@@ -897,14 +1206,12 @@ extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
897 * IPVS sync daemon data and function prototypes 1206 * IPVS sync daemon data and function prototypes
898 * (from ip_vs_sync.c) 1207 * (from ip_vs_sync.c)
899 */ 1208 */
900extern volatile int ip_vs_sync_state; 1209extern int start_sync_thread(struct net *net, int state, char *mcast_ifn,
901extern volatile int ip_vs_master_syncid; 1210 __u8 syncid);
902extern volatile int ip_vs_backup_syncid; 1211extern int stop_sync_thread(struct net *net, int state);
903extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1212extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp);
904extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; 1213extern int ip_vs_sync_init(void);
905extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid); 1214extern void ip_vs_sync_cleanup(void);
906extern int stop_sync_thread(int state);
907extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
908 1215
909 1216
910/* 1217/*
@@ -912,9 +1219,11 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
912 */ 1219 */
913extern int ip_vs_estimator_init(void); 1220extern int ip_vs_estimator_init(void);
914extern void ip_vs_estimator_cleanup(void); 1221extern void ip_vs_estimator_cleanup(void);
915extern void ip_vs_new_estimator(struct ip_vs_stats *stats); 1222extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
916extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); 1223extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
917extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1224extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1225extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1226 struct ip_vs_stats *stats);
918 1227
919/* 1228/*
920 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1229 * Various IPVS packet transmitters (from ip_vs_xmit.c)
@@ -947,21 +1256,25 @@ extern int ip_vs_icmp_xmit_v6
947 int offset); 1256 int offset);
948#endif 1257#endif
949 1258
1259#ifdef CONFIG_SYSCTL
950/* 1260/*
951 * This is a simple mechanism to ignore packets when 1261 * This is a simple mechanism to ignore packets when
952 * we are loaded. Just set ip_vs_drop_rate to 'n' and 1262 * we are loaded. Just set ip_vs_drop_rate to 'n' and
953 * we start to drop 1/rate of the packets 1263 * we start to drop 1/rate of the packets
954 */ 1264 */
955extern int ip_vs_drop_rate;
956extern int ip_vs_drop_counter;
957 1265
958static __inline__ int ip_vs_todrop(void) 1266static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
959{ 1267{
960 if (!ip_vs_drop_rate) return 0; 1268 if (!ipvs->drop_rate)
961 if (--ip_vs_drop_counter > 0) return 0; 1269 return 0;
962 ip_vs_drop_counter = ip_vs_drop_rate; 1270 if (--ipvs->drop_counter > 0)
1271 return 0;
1272 ipvs->drop_counter = ipvs->drop_rate;
963 return 1; 1273 return 1;
964} 1274}
1275#else
1276static inline int ip_vs_todrop(struct netns_ipvs *ipvs) { return 0; }
1277#endif
965 1278
966/* 1279/*
967 * ip_vs_fwd_tag returns the forwarding tag of the connection 1280 * ip_vs_fwd_tag returns the forwarding tag of the connection
@@ -1031,7 +1344,7 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1031{ 1344{
1032#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 1345#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
1033 enum ip_conntrack_info ctinfo; 1346 enum ip_conntrack_info ctinfo;
1034 struct nf_conn *ct = ct = nf_ct_get(skb, &ctinfo); 1347 struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
1035 1348
1036 if (!ct || !nf_ct_is_untracked(ct)) { 1349 if (!ct || !nf_ct_is_untracked(ct)) {
1037 nf_reset(skb); 1350 nf_reset(skb);
@@ -1047,9 +1360,13 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1047 * Netfilter connection tracking 1360 * Netfilter connection tracking
1048 * (from ip_vs_nfct.c) 1361 * (from ip_vs_nfct.c)
1049 */ 1362 */
1050static inline int ip_vs_conntrack_enabled(void) 1363static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1051{ 1364{
1052 return sysctl_ip_vs_conntrack; 1365#ifdef CONFIG_SYSCTL
1366 return ipvs->sysctl_conntrack;
1367#else
1368 return 0;
1369#endif
1053} 1370}
1054 1371
1055extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1372extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1062,7 +1379,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1062 1379
1063#else 1380#else
1064 1381
1065static inline int ip_vs_conntrack_enabled(void) 1382static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1066{ 1383{
1067 return 0; 1384 return 0;
1068} 1385}
@@ -1084,6 +1401,20 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
1084/* CONFIG_IP_VS_NFCT */ 1401/* CONFIG_IP_VS_NFCT */
1085#endif 1402#endif
1086 1403
1404static inline unsigned int
1405ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
1406{
1407 /*
1408 * We think the overhead of processing active connections is 256
1409 * times higher than that of inactive connections in average. (This
1410 * 256 times might not be accurate, we will change it later) We
1411 * use the following formula to estimate the overhead now:
1412 * dest->activeconns*256 + dest->inactconns
1413 */
1414 return (atomic_read(&dest->activeconns) << 8) +
1415 atomic_read(&dest->inactconns);
1416}
1417
1087#endif /* __KERNEL__ */ 1418#endif /* __KERNEL__ */
1088 1419
1089#endif /* _NET_IP_VS_H */ 1420#endif /* _NET_IP_VS_H */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 96e50e0ce3ca..34200f9e6805 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -492,7 +492,7 @@ extern int ip6_rcv_finish(struct sk_buff *skb);
492 */ 492 */
493extern int ip6_xmit(struct sock *sk, 493extern int ip6_xmit(struct sock *sk,
494 struct sk_buff *skb, 494 struct sk_buff *skb,
495 struct flowi *fl, 495 struct flowi6 *fl6,
496 struct ipv6_txoptions *opt); 496 struct ipv6_txoptions *opt);
497 497
498extern int ip6_nd_hdr(struct sock *sk, 498extern int ip6_nd_hdr(struct sock *sk,
@@ -512,7 +512,7 @@ extern int ip6_append_data(struct sock *sk,
512 int hlimit, 512 int hlimit,
513 int tclass, 513 int tclass,
514 struct ipv6_txoptions *opt, 514 struct ipv6_txoptions *opt,
515 struct flowi *fl, 515 struct flowi6 *fl6,
516 struct rt6_info *rt, 516 struct rt6_info *rt,
517 unsigned int flags, 517 unsigned int flags,
518 int dontfrag); 518 int dontfrag);
@@ -523,13 +523,17 @@ extern void ip6_flush_pending_frames(struct sock *sk);
523 523
524extern int ip6_dst_lookup(struct sock *sk, 524extern int ip6_dst_lookup(struct sock *sk,
525 struct dst_entry **dst, 525 struct dst_entry **dst,
526 struct flowi *fl); 526 struct flowi6 *fl6);
527extern int ip6_dst_blackhole(struct sock *sk, 527extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
528 struct dst_entry **dst, 528 struct flowi6 *fl6,
529 struct flowi *fl); 529 const struct in6_addr *final_dst,
530extern int ip6_sk_dst_lookup(struct sock *sk, 530 bool can_sleep);
531 struct dst_entry **dst, 531extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
532 struct flowi *fl); 532 struct flowi6 *fl6,
533 const struct in6_addr *final_dst,
534 bool can_sleep);
535extern struct dst_entry * ip6_blackhole_route(struct net *net,
536 struct dst_entry *orig_dst);
533 537
534/* 538/*
535 * skb processing functions 539 * skb processing functions
@@ -562,7 +566,7 @@ extern int ipv6_ext_hdr(u8 nexthdr);
562 566
563extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 567extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
564 568
565extern struct in6_addr *fl6_update_dst(struct flowi *fl, 569extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
566 const struct ipv6_txoptions *opt, 570 const struct ipv6_txoptions *opt,
567 struct in6_addr *orig); 571 struct in6_addr *orig);
568 572
@@ -596,8 +600,8 @@ extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
596extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 600extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
597extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 601extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
598 u32 info, u8 *payload); 602 u32 info, u8 *payload);
599extern void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info); 603extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
600extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi *fl, u32 mtu); 604extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
601 605
602extern int inet6_release(struct socket *sock); 606extern int inet6_release(struct socket *sock);
603extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr, 607extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index eea2e6152389..59ba38bc400f 100644
--- a/include/net/irda/ircomm_tty.h
+++ b/include/net/irda/ircomm_tty.h
@@ -120,10 +120,10 @@ struct ircomm_tty_cb {
120void ircomm_tty_start(struct tty_struct *tty); 120void ircomm_tty_start(struct tty_struct *tty);
121void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); 121void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
122 122
123extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file); 123extern int ircomm_tty_tiocmget(struct tty_struct *tty);
124extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, 124extern int ircomm_tty_tiocmset(struct tty_struct *tty,
125 unsigned int set, unsigned int clear); 125 unsigned int set, unsigned int clear);
126extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, 126extern int ircomm_tty_ioctl(struct tty_struct *tty,
127 unsigned int cmd, unsigned long arg); 127 unsigned int cmd, unsigned long arg);
128extern void ircomm_tty_set_termios(struct tty_struct *tty, 128extern void ircomm_tty_set_termios(struct tty_struct *tty,
129 struct ktermios *old_termios); 129 struct ktermios *old_termios);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 62c0ce2d1dc8..cefe1b37c493 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -341,6 +341,9 @@ struct ieee80211_bss_conf {
341 * the off-channel channel when a remain-on-channel offload is done 341 * the off-channel channel when a remain-on-channel offload is done
342 * in hardware -- normal packets still flow and are expected to be 342 * in hardware -- normal packets still flow and are expected to be
343 * handled properly by the device. 343 * handled properly by the device.
344 * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
345 * testing. It will be sent out with incorrect Michael MIC key to allow
346 * TKIP countermeasures to be tested.
344 * 347 *
345 * Note: If you have to add new flags to the enumeration, then don't 348 * Note: If you have to add new flags to the enumeration, then don't
346 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. 349 * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
@@ -370,6 +373,7 @@ enum mac80211_tx_control_flags {
370 IEEE80211_TX_CTL_LDPC = BIT(22), 373 IEEE80211_TX_CTL_LDPC = BIT(22),
371 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), 374 IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24),
372 IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25), 375 IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25),
376 IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26),
373}; 377};
374 378
375#define IEEE80211_TX_CTL_STBC_SHIFT 23 379#define IEEE80211_TX_CTL_STBC_SHIFT 23
@@ -595,9 +599,10 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
595 * the frame. 599 * the frame.
596 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 600 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
597 * the frame. 601 * the frame.
598 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) 602 * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime
599 * is valid. This is useful in monitor mode and necessary for beacon frames 603 * field) is valid and contains the time the first symbol of the MPDU
600 * to enable IBSS merging. 604 * was received. This is useful in monitor mode and for proper IBSS
605 * merging.
601 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame 606 * @RX_FLAG_SHORTPRE: Short preamble was used for this frame
602 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 607 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
603 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 608 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
@@ -610,7 +615,7 @@ enum mac80211_rx_flags {
610 RX_FLAG_IV_STRIPPED = 1<<4, 615 RX_FLAG_IV_STRIPPED = 1<<4,
611 RX_FLAG_FAILED_FCS_CRC = 1<<5, 616 RX_FLAG_FAILED_FCS_CRC = 1<<5,
612 RX_FLAG_FAILED_PLCP_CRC = 1<<6, 617 RX_FLAG_FAILED_PLCP_CRC = 1<<6,
613 RX_FLAG_TSFT = 1<<7, 618 RX_FLAG_MACTIME_MPDU = 1<<7,
614 RX_FLAG_SHORTPRE = 1<<8, 619 RX_FLAG_SHORTPRE = 1<<8,
615 RX_FLAG_HT = 1<<9, 620 RX_FLAG_HT = 1<<9,
616 RX_FLAG_40MHZ = 1<<10, 621 RX_FLAG_40MHZ = 1<<10,
@@ -1069,6 +1074,13 @@ enum ieee80211_tkip_key_type {
1069 * to decrypt group addressed frames, then IBSS RSN support is still 1074 * to decrypt group addressed frames, then IBSS RSN support is still
1070 * possible but software crypto will be used. Advertise the wiphy flag 1075 * possible but software crypto will be used. Advertise the wiphy flag
1071 * only in that case. 1076 * only in that case.
1077 *
1078 * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device
1079 * autonomously manages the PS status of connected stations. When
1080 * this flag is set mac80211 will not trigger PS mode for connected
1081 * stations based on the PM bit of incoming frames.
1082 * Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
1083 * the PS mode of connected stations.
1072 */ 1084 */
1073enum ieee80211_hw_flags { 1085enum ieee80211_hw_flags {
1074 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1086 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1093,6 +1105,7 @@ enum ieee80211_hw_flags {
1093 IEEE80211_HW_CONNECTION_MONITOR = 1<<19, 1105 IEEE80211_HW_CONNECTION_MONITOR = 1<<19,
1094 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, 1106 IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20,
1095 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, 1107 IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21,
1108 IEEE80211_HW_AP_LINK_PS = 1<<22,
1096}; 1109};
1097 1110
1098/** 1111/**
@@ -1147,6 +1160,17 @@ enum ieee80211_hw_flags {
1147 * @napi_weight: weight used for NAPI polling. You must specify an 1160 * @napi_weight: weight used for NAPI polling. You must specify an
1148 * appropriate value here if a napi_poll operation is provided 1161 * appropriate value here if a napi_poll operation is provided
1149 * by your driver. 1162 * by your driver.
1163 *
1164 * @max_rx_aggregation_subframes: maximum buffer size (number of
1165 * sub-frames) to be used for A-MPDU block ack receiver
1166 * aggregation.
1167 * This is only relevant if the device has restrictions on the
1168 * number of subframes, if it relies on mac80211 to do reordering
1169 * it shouldn't be set.
1170 *
1171 * @max_tx_aggregation_subframes: maximum number of subframes in an
1172 * aggregate an HT driver will transmit, used by the peer as a
1173 * hint to size its reorder buffer.
1150 */ 1174 */
1151struct ieee80211_hw { 1175struct ieee80211_hw {
1152 struct ieee80211_conf conf; 1176 struct ieee80211_conf conf;
@@ -1165,6 +1189,8 @@ struct ieee80211_hw {
1165 u8 max_rates; 1189 u8 max_rates;
1166 u8 max_report_rates; 1190 u8 max_report_rates;
1167 u8 max_rate_tries; 1191 u8 max_rate_tries;
1192 u8 max_rx_aggregation_subframes;
1193 u8 max_tx_aggregation_subframes;
1168}; 1194};
1169 1195
1170/** 1196/**
@@ -1688,7 +1714,9 @@ enum ieee80211_ampdu_mlme_action {
1688 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. 1714 * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep.
1689 * 1715 *
1690 * @sta_notify: Notifies low level driver about power state transition of an 1716 * @sta_notify: Notifies low level driver about power state transition of an
1691 * associated station, AP, IBSS/WDS/mesh peer etc. Must be atomic. 1717 * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating
1718 * in AP mode, this callback will not be called when the flag
1719 * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
1692 * 1720 *
1693 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), 1721 * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
1694 * bursting) for a hardware TX queue. 1722 * bursting) for a hardware TX queue.
@@ -1723,6 +1751,10 @@ enum ieee80211_ampdu_mlme_action {
1723 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1751 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1724 * is the first frame we expect to perform the action on. Notice 1752 * is the first frame we expect to perform the action on. Notice
1725 * that TX/RX_STOP can pass NULL for this parameter. 1753 * that TX/RX_STOP can pass NULL for this parameter.
1754 * The @buf_size parameter is only valid when the action is set to
1755 * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder
1756 * buffer size (number of subframes) for this session -- aggregates
1757 * containing more subframes than this may not be transmitted to the peer.
1726 * Returns a negative error code on failure. 1758 * Returns a negative error code on failure.
1727 * The callback can sleep. 1759 * The callback can sleep.
1728 * 1760 *
@@ -1767,9 +1799,18 @@ enum ieee80211_ampdu_mlme_action {
1767 * ieee80211_remain_on_channel_expired(). This callback may sleep. 1799 * ieee80211_remain_on_channel_expired(). This callback may sleep.
1768 * @cancel_remain_on_channel: Requests that an ongoing off-channel period is 1800 * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
1769 * aborted before it expires. This callback may sleep. 1801 * aborted before it expires. This callback may sleep.
1802 * @offchannel_tx: Transmit frame on another channel, wait for a response
1803 * and return. Reliable TX status must be reported for the frame. If the
1804 * return value is 1, then the @remain_on_channel will be used with a
1805 * regular transmission (if supported.)
1806 * @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX
1807 *
1808 * @set_ringparam: Set tx and rx ring sizes.
1809 *
1810 * @get_ringparam: Get tx and rx ring current and maximum sizes.
1770 */ 1811 */
1771struct ieee80211_ops { 1812struct ieee80211_ops {
1772 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1813 void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
1773 int (*start)(struct ieee80211_hw *hw); 1814 int (*start)(struct ieee80211_hw *hw);
1774 void (*stop)(struct ieee80211_hw *hw); 1815 void (*stop)(struct ieee80211_hw *hw);
1775 int (*add_interface)(struct ieee80211_hw *hw, 1816 int (*add_interface)(struct ieee80211_hw *hw,
@@ -1825,7 +1866,8 @@ struct ieee80211_ops {
1825 int (*ampdu_action)(struct ieee80211_hw *hw, 1866 int (*ampdu_action)(struct ieee80211_hw *hw,
1826 struct ieee80211_vif *vif, 1867 struct ieee80211_vif *vif,
1827 enum ieee80211_ampdu_mlme_action action, 1868 enum ieee80211_ampdu_mlme_action action,
1828 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1869 struct ieee80211_sta *sta, u16 tid, u16 *ssn,
1870 u8 buf_size);
1829 int (*get_survey)(struct ieee80211_hw *hw, int idx, 1871 int (*get_survey)(struct ieee80211_hw *hw, int idx,
1830 struct survey_info *survey); 1872 struct survey_info *survey);
1831 void (*rfkill_poll)(struct ieee80211_hw *hw); 1873 void (*rfkill_poll)(struct ieee80211_hw *hw);
@@ -1845,6 +1887,14 @@ struct ieee80211_ops {
1845 enum nl80211_channel_type channel_type, 1887 enum nl80211_channel_type channel_type,
1846 int duration); 1888 int duration);
1847 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 1889 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
1890 int (*offchannel_tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
1891 struct ieee80211_channel *chan,
1892 enum nl80211_channel_type channel_type,
1893 unsigned int wait);
1894 int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw);
1895 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
1896 void (*get_ringparam)(struct ieee80211_hw *hw,
1897 u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
1848}; 1898};
1849 1899
1850/** 1900/**
@@ -2113,6 +2163,48 @@ static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
2113 local_bh_enable(); 2163 local_bh_enable();
2114} 2164}
2115 2165
2166/**
2167 * ieee80211_sta_ps_transition - PS transition for connected sta
2168 *
2169 * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
2170 * flag set, use this function to inform mac80211 about a connected station
2171 * entering/leaving PS mode.
2172 *
2173 * This function may not be called in IRQ context or with softirqs enabled.
2174 *
2175 * Calls to this function for a single hardware must be synchronized against
2176 * each other.
2177 *
2178 * The function returns -EINVAL when the requested PS mode is already set.
2179 *
2180 * @sta: currently connected sta
2181 * @start: start or stop PS
2182 */
2183int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
2184
2185/**
2186 * ieee80211_sta_ps_transition_ni - PS transition for connected sta
2187 * (in process context)
2188 *
2189 * Like ieee80211_sta_ps_transition() but can be called in process context
2190 * (internally disables bottom halves). Concurrent call restriction still
2191 * applies.
2192 *
2193 * @sta: currently connected sta
2194 * @start: start or stop PS
2195 */
2196static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
2197 bool start)
2198{
2199 int ret;
2200
2201 local_bh_disable();
2202 ret = ieee80211_sta_ps_transition(sta, start);
2203 local_bh_enable();
2204
2205 return ret;
2206}
2207
2116/* 2208/*
2117 * The TX headroom reserved by mac80211 for its own tx_status functions. 2209 * The TX headroom reserved by mac80211 for its own tx_status functions.
2118 * This is enough for the radiotap header. 2210 * This is enough for the radiotap header.
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 1bf812b21fb7..3ae491932bc8 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -27,6 +27,7 @@ struct sock;
27struct ctl_table_header; 27struct ctl_table_header;
28struct net_generic; 28struct net_generic;
29struct sock; 29struct sock;
30struct netns_ipvs;
30 31
31 32
32#define NETDEV_HASHBITS 8 33#define NETDEV_HASHBITS 8
@@ -94,6 +95,7 @@ struct net {
94#ifdef CONFIG_XFRM 95#ifdef CONFIG_XFRM
95 struct netns_xfrm xfrm; 96 struct netns_xfrm xfrm;
96#endif 97#endif
98 struct netns_ipvs *ipvs;
97}; 99};
98 100
99 101
diff --git a/include/net/netevent.h b/include/net/netevent.h
index e82b7bab3ff3..22b239c17eaa 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -21,7 +21,6 @@ struct netevent_redirect {
21 21
22enum netevent_notif_type { 22enum netevent_notif_type {
23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */ 23 NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
24 NETEVENT_PMTU_UPDATE, /* arg is struct dst_entry ptr */
25 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ 24 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
26}; 25};
27 26
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index d85cff10e169..d0d13378991e 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -50,11 +50,24 @@ union nf_conntrack_expect_proto {
50/* per conntrack: application helper private data */ 50/* per conntrack: application helper private data */
51union nf_conntrack_help { 51union nf_conntrack_help {
52 /* insert conntrack helper private data (master) here */ 52 /* insert conntrack helper private data (master) here */
53#if defined(CONFIG_NF_CONNTRACK_FTP) || defined(CONFIG_NF_CONNTRACK_FTP_MODULE)
53 struct nf_ct_ftp_master ct_ftp_info; 54 struct nf_ct_ftp_master ct_ftp_info;
55#endif
56#if defined(CONFIG_NF_CONNTRACK_PPTP) || \
57 defined(CONFIG_NF_CONNTRACK_PPTP_MODULE)
54 struct nf_ct_pptp_master ct_pptp_info; 58 struct nf_ct_pptp_master ct_pptp_info;
59#endif
60#if defined(CONFIG_NF_CONNTRACK_H323) || \
61 defined(CONFIG_NF_CONNTRACK_H323_MODULE)
55 struct nf_ct_h323_master ct_h323_info; 62 struct nf_ct_h323_master ct_h323_info;
63#endif
64#if defined(CONFIG_NF_CONNTRACK_SANE) || \
65 defined(CONFIG_NF_CONNTRACK_SANE_MODULE)
56 struct nf_ct_sane_master ct_sane_info; 66 struct nf_ct_sane_master ct_sane_info;
67#endif
68#if defined(CONFIG_NF_CONNTRACK_SIP) || defined(CONFIG_NF_CONNTRACK_SIP_MODULE)
57 struct nf_ct_sip_master ct_sip_info; 69 struct nf_ct_sip_master ct_sip_info;
70#endif
58}; 71};
59 72
60#include <linux/types.h> 73#include <linux/types.h>
@@ -116,14 +129,14 @@ struct nf_conn {
116 u_int32_t secmark; 129 u_int32_t secmark;
117#endif 130#endif
118 131
119 /* Storage reserved for other modules: */
120 union nf_conntrack_proto proto;
121
122 /* Extensions */ 132 /* Extensions */
123 struct nf_ct_ext *ext; 133 struct nf_ct_ext *ext;
124#ifdef CONFIG_NET_NS 134#ifdef CONFIG_NET_NS
125 struct net *ct_net; 135 struct net *ct_net;
126#endif 136#endif
137
138 /* Storage reserved for other modules, must be the last member */
139 union nf_conntrack_proto proto;
127}; 140};
128 141
129static inline struct nf_conn * 142static inline struct nf_conn *
@@ -189,9 +202,9 @@ extern void nf_ct_l3proto_module_put(unsigned short l3proto);
189 * Allocate a hashtable of hlist_head (if nulls == 0), 202 * Allocate a hashtable of hlist_head (if nulls == 0),
190 * or hlist_nulls_head (if nulls == 1) 203 * or hlist_nulls_head (if nulls == 1)
191 */ 204 */
192extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls); 205extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
193 206
194extern void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size); 207extern void nf_ct_free_hashtable(void *hash, unsigned int size);
195 208
196extern struct nf_conntrack_tuple_hash * 209extern struct nf_conntrack_tuple_hash *
197__nf_conntrack_find(struct net *net, u16 zone, 210__nf_conntrack_find(struct net *net, u16 zone,
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 349cefedc9f3..4283508b3e18 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -23,12 +23,17 @@ struct nf_conntrack_ecache {
23static inline struct nf_conntrack_ecache * 23static inline struct nf_conntrack_ecache *
24nf_ct_ecache_find(const struct nf_conn *ct) 24nf_ct_ecache_find(const struct nf_conn *ct)
25{ 25{
26#ifdef CONFIG_NF_CONNTRACK_EVENTS
26 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); 27 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
28#else
29 return NULL;
30#endif
27} 31}
28 32
29static inline struct nf_conntrack_ecache * 33static inline struct nf_conntrack_ecache *
30nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) 34nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
31{ 35{
36#ifdef CONFIG_NF_CONNTRACK_EVENTS
32 struct net *net = nf_ct_net(ct); 37 struct net *net = nf_ct_net(ct);
33 struct nf_conntrack_ecache *e; 38 struct nf_conntrack_ecache *e;
34 39
@@ -45,6 +50,9 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
45 e->expmask = expmask; 50 e->expmask = expmask;
46 } 51 }
47 return e; 52 return e;
53#else
54 return NULL;
55#endif
48}; 56};
49 57
50#ifdef CONFIG_NF_CONNTRACK_EVENTS 58#ifdef CONFIG_NF_CONNTRACK_EVENTS
@@ -59,7 +67,7 @@ struct nf_ct_event_notifier {
59 int (*fcn)(unsigned int events, struct nf_ct_event *item); 67 int (*fcn)(unsigned int events, struct nf_ct_event *item);
60}; 68};
61 69
62extern struct nf_ct_event_notifier *nf_conntrack_event_cb; 70extern struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
63extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb); 71extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb);
64extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb); 72extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb);
65 73
@@ -156,7 +164,7 @@ struct nf_exp_event_notifier {
156 int (*fcn)(unsigned int events, struct nf_exp_event *item); 164 int (*fcn)(unsigned int events, struct nf_exp_event *item);
157}; 165};
158 166
159extern struct nf_exp_event_notifier *nf_expect_event_cb; 167extern struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
160extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb); 168extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb);
161extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb); 169extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb);
162 170
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 0772d296dfdb..2dcf31703acb 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -7,10 +7,19 @@
7 7
8enum nf_ct_ext_id { 8enum nf_ct_ext_id {
9 NF_CT_EXT_HELPER, 9 NF_CT_EXT_HELPER,
10#if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE)
10 NF_CT_EXT_NAT, 11 NF_CT_EXT_NAT,
12#endif
11 NF_CT_EXT_ACCT, 13 NF_CT_EXT_ACCT,
14#ifdef CONFIG_NF_CONNTRACK_EVENTS
12 NF_CT_EXT_ECACHE, 15 NF_CT_EXT_ECACHE,
16#endif
17#ifdef CONFIG_NF_CONNTRACK_ZONES
13 NF_CT_EXT_ZONE, 18 NF_CT_EXT_ZONE,
19#endif
20#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
21 NF_CT_EXT_TSTAMP,
22#endif
14 NF_CT_EXT_NUM, 23 NF_CT_EXT_NUM,
15}; 24};
16 25
@@ -19,6 +28,7 @@ enum nf_ct_ext_id {
19#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 28#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
20#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 29#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
21#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 30#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
31#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
22 32
23/* Extensions: optional stuff which isn't permanently in struct. */ 33/* Extensions: optional stuff which isn't permanently in struct. */
24struct nf_ct_ext { 34struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 32c305dbdab6..f1c1311adc2c 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -63,4 +63,10 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
63extern int nf_conntrack_helper_init(void); 63extern int nf_conntrack_helper_init(void);
64extern void nf_conntrack_helper_fini(void); 64extern void nf_conntrack_helper_fini(void);
65 65
66extern int nf_conntrack_broadcast_help(struct sk_buff *skb,
67 unsigned int protoff,
68 struct nf_conn *ct,
69 enum ip_conntrack_info ctinfo,
70 unsigned int timeout);
71
66#endif /*_NF_CONNTRACK_HELPER_H*/ 72#endif /*_NF_CONNTRACK_HELPER_H*/
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index a7547611e8f1..e8010f445ae1 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -73,7 +73,7 @@ struct nf_conntrack_l3proto {
73 struct module *me; 73 struct module *me;
74}; 74};
75 75
76extern struct nf_conntrack_l3proto *nf_ct_l3protos[AF_MAX]; 76extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
77 77
78/* Protocol registration. */ 78/* Protocol registration. */
79extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto); 79extern int nf_conntrack_l3proto_register(struct nf_conntrack_l3proto *proto);
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
new file mode 100644
index 000000000000..fc9c82b1f06b
--- /dev/null
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -0,0 +1,65 @@
1#ifndef _NF_CONNTRACK_TSTAMP_H
2#define _NF_CONNTRACK_TSTAMP_H
3
4#include <net/net_namespace.h>
5#include <linux/netfilter/nf_conntrack_common.h>
6#include <linux/netfilter/nf_conntrack_tuple_common.h>
7#include <net/netfilter/nf_conntrack.h>
8#include <net/netfilter/nf_conntrack_extend.h>
9
10struct nf_conn_tstamp {
11 u_int64_t start;
12 u_int64_t stop;
13};
14
15static inline
16struct nf_conn_tstamp *nf_conn_tstamp_find(const struct nf_conn *ct)
17{
18#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
19 return nf_ct_ext_find(ct, NF_CT_EXT_TSTAMP);
20#else
21 return NULL;
22#endif
23}
24
25static inline
26struct nf_conn_tstamp *nf_ct_tstamp_ext_add(struct nf_conn *ct, gfp_t gfp)
27{
28#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
29 struct net *net = nf_ct_net(ct);
30
31 if (!net->ct.sysctl_tstamp)
32 return NULL;
33
34 return nf_ct_ext_add(ct, NF_CT_EXT_TSTAMP, gfp);
35#else
36 return NULL;
37#endif
38};
39
40static inline bool nf_ct_tstamp_enabled(struct net *net)
41{
42 return net->ct.sysctl_tstamp != 0;
43}
44
45static inline void nf_ct_set_tstamp(struct net *net, bool enable)
46{
47 net->ct.sysctl_tstamp = enable;
48}
49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_init(struct net *net);
52extern void nf_conntrack_tstamp_fini(struct net *net);
53#else
54static inline int nf_conntrack_tstamp_init(struct net *net)
55{
56 return 0;
57}
58
59static inline void nf_conntrack_tstamp_fini(struct net *net)
60{
61 return;
62}
63#endif /* CONFIG_NF_CONNTRACK_TIMESTAMP */
64
65#endif /* _NF_CONNTRACK_TSTAMP_H */
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index f5f09f032a90..aff80b190c12 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -56,7 +56,9 @@ struct nf_nat_multi_range_compat {
56/* per conntrack: nat application helper private data */ 56/* per conntrack: nat application helper private data */
57union nf_conntrack_nat_help { 57union nf_conntrack_nat_help {
58 /* insert nat helper private data here */ 58 /* insert nat helper private data here */
59#if defined(CONFIG_NF_NAT_PPTP) || defined(CONFIG_NF_NAT_PPTP_MODULE)
59 struct nf_nat_pptp nat_pptp_info; 60 struct nf_nat_pptp nat_pptp_info;
61#endif
60}; 62};
61 63
62struct nf_conn; 64struct nf_conn;
@@ -84,7 +86,11 @@ extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
84 86
85static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) 87static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
86{ 88{
89#if defined(CONFIG_NF_NAT) || defined(CONFIG_NF_NAT_MODULE)
87 return nf_ct_ext_find(ct, NF_CT_EXT_NAT); 90 return nf_ct_ext_find(ct, NF_CT_EXT_NAT);
91#else
92 return NULL;
93#endif
88} 94}
89 95
90#else /* !__KERNEL__: iptables wants this to compile. */ 96#else /* !__KERNEL__: iptables wants this to compile. */
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 33602ab66190..3dc7b98effeb 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -21,9 +21,9 @@ static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 21 enum nf_nat_manip_type manip)
22{ 22{
23 if (manip == IP_NAT_MANIP_SRC) 23 if (manip == IP_NAT_MANIP_SRC)
24 return test_bit(IPS_SRC_NAT_DONE_BIT, &ct->status); 24 return ct->status & IPS_SRC_NAT_DONE;
25 else 25 else
26 return test_bit(IPS_DST_NAT_DONE_BIT, &ct->status); 26 return ct->status & IPS_DST_NAT_DONE;
27} 27}
28 28
29struct nlattr; 29struct nlattr;
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 373f1a900cf4..8a3906a08f5f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -856,18 +856,27 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
856#define NLA_PUT_BE16(skb, attrtype, value) \ 856#define NLA_PUT_BE16(skb, attrtype, value) \
857 NLA_PUT_TYPE(skb, __be16, attrtype, value) 857 NLA_PUT_TYPE(skb, __be16, attrtype, value)
858 858
859#define NLA_PUT_NET16(skb, attrtype, value) \
860 NLA_PUT_BE16(skb, attrtype | NLA_F_NET_BYTEORDER, value)
861
859#define NLA_PUT_U32(skb, attrtype, value) \ 862#define NLA_PUT_U32(skb, attrtype, value) \
860 NLA_PUT_TYPE(skb, u32, attrtype, value) 863 NLA_PUT_TYPE(skb, u32, attrtype, value)
861 864
862#define NLA_PUT_BE32(skb, attrtype, value) \ 865#define NLA_PUT_BE32(skb, attrtype, value) \
863 NLA_PUT_TYPE(skb, __be32, attrtype, value) 866 NLA_PUT_TYPE(skb, __be32, attrtype, value)
864 867
868#define NLA_PUT_NET32(skb, attrtype, value) \
869 NLA_PUT_BE32(skb, attrtype | NLA_F_NET_BYTEORDER, value)
870
865#define NLA_PUT_U64(skb, attrtype, value) \ 871#define NLA_PUT_U64(skb, attrtype, value) \
866 NLA_PUT_TYPE(skb, u64, attrtype, value) 872 NLA_PUT_TYPE(skb, u64, attrtype, value)
867 873
868#define NLA_PUT_BE64(skb, attrtype, value) \ 874#define NLA_PUT_BE64(skb, attrtype, value) \
869 NLA_PUT_TYPE(skb, __be64, attrtype, value) 875 NLA_PUT_TYPE(skb, __be64, attrtype, value)
870 876
877#define NLA_PUT_NET64(skb, attrtype, value) \
878 NLA_PUT_BE64(skb, attrtype | NLA_F_NET_BYTEORDER, value)
879
871#define NLA_PUT_STRING(skb, attrtype, value) \ 880#define NLA_PUT_STRING(skb, attrtype, value) \
872 NLA_PUT(skb, attrtype, strlen(value) + 1, value) 881 NLA_PUT(skb, attrtype, strlen(value) + 1, value)
873 882
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index d4958d4c6574..341eb089349e 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -21,15 +21,15 @@ struct netns_ct {
21 int sysctl_events; 21 int sysctl_events;
22 unsigned int sysctl_events_retry_timeout; 22 unsigned int sysctl_events_retry_timeout;
23 int sysctl_acct; 23 int sysctl_acct;
24 int sysctl_tstamp;
24 int sysctl_checksum; 25 int sysctl_checksum;
25 unsigned int sysctl_log_invalid; /* Log invalid packets */ 26 unsigned int sysctl_log_invalid; /* Log invalid packets */
26#ifdef CONFIG_SYSCTL 27#ifdef CONFIG_SYSCTL
27 struct ctl_table_header *sysctl_header; 28 struct ctl_table_header *sysctl_header;
28 struct ctl_table_header *acct_sysctl_header; 29 struct ctl_table_header *acct_sysctl_header;
30 struct ctl_table_header *tstamp_sysctl_header;
29 struct ctl_table_header *event_sysctl_header; 31 struct ctl_table_header *event_sysctl_header;
30#endif 32#endif
31 int hash_vmalloc;
32 int expect_vmalloc;
33 char *slabname; 33 char *slabname;
34}; 34};
35#endif 35#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index d68c3f121774..542195d9469e 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -43,7 +43,6 @@ struct netns_ipv4 {
43 struct xt_table *nat_table; 43 struct xt_table *nat_table;
44 struct hlist_head *nat_bysource; 44 struct hlist_head *nat_bysource;
45 unsigned int nat_htable_size; 45 unsigned int nat_htable_size;
46 int nat_vmalloced;
47#endif 46#endif
48 47
49 int sysctl_icmp_echo_ignore_all; 48 int sysctl_icmp_echo_ignore_all;
@@ -56,6 +55,7 @@ struct netns_ipv4 {
56 int current_rt_cache_rebuild_count; 55 int current_rt_cache_rebuild_count;
57 56
58 atomic_t rt_genid; 57 atomic_t rt_genid;
58 atomic_t dev_addr_genid;
59 59
60#ifdef CONFIG_IP_MROUTE 60#ifdef CONFIG_IP_MROUTE
61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES 61#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
index b60b28c99e87..b669fe6dbc3b 100644
--- a/include/net/phonet/pep.h
+++ b/include/net/phonet/pep.h
@@ -28,7 +28,6 @@ struct pep_sock {
28 28
29 /* XXX: union-ify listening vs connected stuff ? */ 29 /* XXX: union-ify listening vs connected stuff ? */
30 /* Listening socket stuff: */ 30 /* Listening socket stuff: */
31 struct hlist_head ackq;
32 struct hlist_head hlist; 31 struct hlist_head hlist;
33 32
34 /* Connected socket stuff: */ 33 /* Connected socket stuff: */
@@ -45,10 +44,6 @@ struct pep_sock {
45 u8 tx_fc; /* TX flow control */ 44 u8 tx_fc; /* TX flow control */
46 u8 init_enable; /* auto-enable at creation */ 45 u8 init_enable; /* auto-enable at creation */
47 u8 aligned; 46 u8 aligned;
48#ifdef CONFIG_PHONET_PIPECTRLR
49 u8 pipe_state;
50 struct sockaddr_pn remote_pep;
51#endif
52}; 47};
53 48
54static inline struct pep_sock *pep_sk(struct sock *sk) 49static inline struct pep_sock *pep_sk(struct sock *sk)
@@ -158,6 +153,7 @@ enum {
158 PN_LEGACY_FLOW_CONTROL, 153 PN_LEGACY_FLOW_CONTROL,
159 PN_ONE_CREDIT_FLOW_CONTROL, 154 PN_ONE_CREDIT_FLOW_CONTROL,
160 PN_MULTI_CREDIT_FLOW_CONTROL, 155 PN_MULTI_CREDIT_FLOW_CONTROL,
156 PN_MAX_FLOW_CONTROL,
161}; 157};
162 158
163#define pn_flow_safe(fc) ((fc) >> 1) 159#define pn_flow_safe(fc) ((fc) >> 1)
@@ -169,21 +165,4 @@ enum {
169 PEP_IND_READY, 165 PEP_IND_READY,
170}; 166};
171 167
172#ifdef CONFIG_PHONET_PIPECTRLR
173#define PNS_PEP_CONNECT_UTID 0x02
174#define PNS_PIPE_CREATED_IND_UTID 0x04
175#define PNS_PIPE_ENABLE_UTID 0x0A
176#define PNS_PIPE_ENABLED_IND_UTID 0x0C
177#define PNS_PIPE_DISABLE_UTID 0x0F
178#define PNS_PIPE_DISABLED_IND_UTID 0x11
179#define PNS_PEP_DISCONNECT_UTID 0x06
180
181/* Used for tracking state of a pipe */
182enum {
183 PIPE_IDLE,
184 PIPE_DISABLED,
185 PIPE_ENABLED,
186};
187#endif /* CONFIG_PHONET_PIPECTRLR */
188
189#endif 168#endif
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 5395e09187df..68e509750caa 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -36,6 +36,7 @@
36struct pn_sock { 36struct pn_sock {
37 struct sock sk; 37 struct sock sk;
38 u16 sobject; 38 u16 sobject;
39 u16 dobject;
39 u8 resource; 40 u8 resource;
40}; 41};
41 42
diff --git a/include/net/protocol.h b/include/net/protocol.h
index dc07495bce4c..6f7eb800974a 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -38,7 +38,7 @@ struct net_protocol {
38 void (*err_handler)(struct sk_buff *skb, u32 info); 38 void (*err_handler)(struct sk_buff *skb, u32 info);
39 int (*gso_send_check)(struct sk_buff *skb); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features); 41 u32 features);
42 struct sk_buff **(*gro_receive)(struct sk_buff **head, 42 struct sk_buff **(*gro_receive)(struct sk_buff **head,
43 struct sk_buff *skb); 43 struct sk_buff *skb);
44 int (*gro_complete)(struct sk_buff *skb); 44 int (*gro_complete)(struct sk_buff *skb);
@@ -57,7 +57,7 @@ struct inet6_protocol {
57 57
58 int (*gso_send_check)(struct sk_buff *skb); 58 int (*gso_send_check)(struct sk_buff *skb);
59 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 59 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
60 int features); 60 u32 features);
61 struct sk_buff **(*gro_receive)(struct sk_buff **head, 61 struct sk_buff **(*gro_receive)(struct sk_buff **head,
62 struct sk_buff *skb); 62 struct sk_buff *skb);
63 int (*gro_complete)(struct sk_buff *skb); 63 int (*gro_complete)(struct sk_buff *skb);
diff --git a/include/net/route.h b/include/net/route.h
index 93e10c453f6b..f88429cad52a 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -49,36 +49,43 @@
49 49
50struct fib_nh; 50struct fib_nh;
51struct inet_peer; 51struct inet_peer;
52struct fib_info;
52struct rtable { 53struct rtable {
53 struct dst_entry dst; 54 struct dst_entry dst;
54 55
55 /* Cache lookup keys */ 56 /* Lookup key. */
56 struct flowi fl; 57 __be32 rt_key_dst;
58 __be32 rt_key_src;
57 59
58 int rt_genid; 60 int rt_genid;
59 unsigned rt_flags; 61 unsigned rt_flags;
60 __u16 rt_type; 62 __u16 rt_type;
63 __u8 rt_tos;
61 64
62 __be32 rt_dst; /* Path destination */ 65 __be32 rt_dst; /* Path destination */
63 __be32 rt_src; /* Path source */ 66 __be32 rt_src; /* Path source */
64 int rt_iif; 67 int rt_iif;
68 int rt_oif;
69 __u32 rt_mark;
65 70
66 /* Info on neighbour */ 71 /* Info on neighbour */
67 __be32 rt_gateway; 72 __be32 rt_gateway;
68 73
69 /* Miscellaneous cached information */ 74 /* Miscellaneous cached information */
70 __be32 rt_spec_dst; /* RFC1122 specific destination */ 75 __be32 rt_spec_dst; /* RFC1122 specific destination */
76 u32 rt_peer_genid;
71 struct inet_peer *peer; /* long-living peer info */ 77 struct inet_peer *peer; /* long-living peer info */
78 struct fib_info *fi; /* for client ref to shared metrics */
72}; 79};
73 80
74static inline bool rt_is_input_route(struct rtable *rt) 81static inline bool rt_is_input_route(struct rtable *rt)
75{ 82{
76 return rt->fl.iif != 0; 83 return rt->rt_iif != 0;
77} 84}
78 85
79static inline bool rt_is_output_route(struct rtable *rt) 86static inline bool rt_is_output_route(struct rtable *rt)
80{ 87{
81 return rt->fl.iif == 0; 88 return rt->rt_iif == 0;
82} 89}
83 90
84struct ip_rt_acct { 91struct ip_rt_acct {
@@ -115,9 +122,63 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
115 __be32 src, struct net_device *dev); 122 __be32 src, struct net_device *dev);
116extern void rt_cache_flush(struct net *net, int how); 123extern void rt_cache_flush(struct net *net, int how);
117extern void rt_cache_flush_batch(struct net *net); 124extern void rt_cache_flush_batch(struct net *net);
118extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); 125extern struct rtable *__ip_route_output_key(struct net *, const struct flowi4 *flp);
119extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); 126extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
120extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); 127 struct sock *sk);
128extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig);
129
130static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp)
131{
132 return ip_route_output_flow(net, flp, NULL);
133}
134
135static inline struct rtable *ip_route_output(struct net *net, __be32 daddr,
136 __be32 saddr, u8 tos, int oif)
137{
138 struct flowi4 fl4 = {
139 .flowi4_oif = oif,
140 .daddr = daddr,
141 .saddr = saddr,
142 .flowi4_tos = tos,
143 };
144 return ip_route_output_key(net, &fl4);
145}
146
147static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk,
148 __be32 daddr, __be32 saddr,
149 __be16 dport, __be16 sport,
150 __u8 proto, __u8 tos, int oif)
151{
152 struct flowi4 fl4 = {
153 .flowi4_oif = oif,
154 .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0,
155 .flowi4_mark = sk ? sk->sk_mark : 0,
156 .daddr = daddr,
157 .saddr = saddr,
158 .flowi4_tos = tos,
159 .flowi4_proto = proto,
160 .fl4_dport = dport,
161 .fl4_sport = sport,
162 };
163 if (sk)
164 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
165 return ip_route_output_flow(net, &fl4, sk);
166}
167
168static inline struct rtable *ip_route_output_gre(struct net *net,
169 __be32 daddr, __be32 saddr,
170 __be32 gre_key, __u8 tos, int oif)
171{
172 struct flowi4 fl4 = {
173 .flowi4_oif = oif,
174 .daddr = daddr,
175 .saddr = saddr,
176 .flowi4_tos = tos,
177 .flowi4_proto = IPPROTO_GRE,
178 .fl4_gre_key = gre_key,
179 };
180 return ip_route_output_key(net, &fl4);
181}
121 182
122extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, 183extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src,
123 u8 tos, struct net_device *devin, bool noref); 184 u8 tos, struct net_device *devin, bool noref);
@@ -146,6 +207,7 @@ extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
146 207
147struct in_ifaddr; 208struct in_ifaddr;
148extern void fib_add_ifaddr(struct in_ifaddr *); 209extern void fib_add_ifaddr(struct in_ifaddr *);
210extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
149 211
150static inline void ip_rt_put(struct rtable * rt) 212static inline void ip_rt_put(struct rtable * rt)
151{ 213{
@@ -162,57 +224,68 @@ static inline char rt_tos2priority(u8 tos)
162 return ip_tos2prio[IPTOS_TOS(tos)>>1]; 224 return ip_tos2prio[IPTOS_TOS(tos)>>1];
163} 225}
164 226
165static inline int ip_route_connect(struct rtable **rp, __be32 dst, 227static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos,
166 __be32 src, u32 tos, int oif, u8 protocol, 228 int oif, u8 protocol,
167 __be16 sport, __be16 dport, struct sock *sk, 229 __be16 sport, __be16 dport,
168 int flags) 230 struct sock *sk, bool can_sleep)
169{ 231{
170 struct flowi fl = { .oif = oif, 232 struct flowi4 fl4 = {
171 .mark = sk->sk_mark, 233 .flowi4_oif = oif,
172 .fl4_dst = dst, 234 .flowi4_mark = sk->sk_mark,
173 .fl4_src = src, 235 .daddr = dst,
174 .fl4_tos = tos, 236 .saddr = src,
175 .proto = protocol, 237 .flowi4_tos = tos,
176 .fl_ip_sport = sport, 238 .flowi4_proto = protocol,
177 .fl_ip_dport = dport }; 239 .fl4_sport = sport,
178 int err; 240 .fl4_dport = dport,
241 };
179 struct net *net = sock_net(sk); 242 struct net *net = sock_net(sk);
243 struct rtable *rt;
180 244
181 if (inet_sk(sk)->transparent) 245 if (inet_sk(sk)->transparent)
182 fl.flags |= FLOWI_FLAG_ANYSRC; 246 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
247 if (protocol == IPPROTO_TCP)
248 fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS;
249 if (can_sleep)
250 fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP;
183 251
184 if (!dst || !src) { 252 if (!dst || !src) {
185 err = __ip_route_output_key(net, rp, &fl); 253 rt = __ip_route_output_key(net, &fl4);
186 if (err) 254 if (IS_ERR(rt))
187 return err; 255 return rt;
188 fl.fl4_dst = (*rp)->rt_dst; 256 fl4.daddr = rt->rt_dst;
189 fl.fl4_src = (*rp)->rt_src; 257 fl4.saddr = rt->rt_src;
190 ip_rt_put(*rp); 258 ip_rt_put(rt);
191 *rp = NULL;
192 } 259 }
193 security_sk_classify_flow(sk, &fl); 260 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
194 return ip_route_output_flow(net, rp, &fl, sk, flags); 261 return ip_route_output_flow(net, &fl4, sk);
195} 262}
196 263
197static inline int ip_route_newports(struct rtable **rp, u8 protocol, 264static inline struct rtable *ip_route_newports(struct rtable *rt,
198 __be16 sport, __be16 dport, struct sock *sk) 265 u8 protocol, __be16 orig_sport,
266 __be16 orig_dport, __be16 sport,
267 __be16 dport, struct sock *sk)
199{ 268{
200 if (sport != (*rp)->fl.fl_ip_sport || 269 if (sport != orig_sport || dport != orig_dport) {
201 dport != (*rp)->fl.fl_ip_dport) { 270 struct flowi4 fl4 = {
202 struct flowi fl; 271 .flowi4_oif = rt->rt_oif,
203 272 .flowi4_mark = rt->rt_mark,
204 memcpy(&fl, &(*rp)->fl, sizeof(fl)); 273 .daddr = rt->rt_dst,
205 fl.fl_ip_sport = sport; 274 .saddr = rt->rt_src,
206 fl.fl_ip_dport = dport; 275 .flowi4_tos = rt->rt_tos,
207 fl.proto = protocol; 276 .flowi4_proto = protocol,
277 .fl4_sport = sport,
278 .fl4_dport = dport
279 };
208 if (inet_sk(sk)->transparent) 280 if (inet_sk(sk)->transparent)
209 fl.flags |= FLOWI_FLAG_ANYSRC; 281 fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
210 ip_rt_put(*rp); 282 if (protocol == IPPROTO_TCP)
211 *rp = NULL; 283 fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS;
212 security_sk_classify_flow(sk, &fl); 284 ip_rt_put(rt);
213 return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0); 285 security_sk_classify_flow(sk, flowi4_to_flowi(&fl4));
286 return ip_route_output_flow(sock_net(sk), &fl4, sk);
214 } 287 }
215 return 0; 288 return rt;
216} 289}
217 290
218extern void rt_bind_peer(struct rtable *rt, int create); 291extern void rt_bind_peer(struct rtable *rt, int create);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 04f8556313d5..b931f021d7ab 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -25,16 +25,18 @@ struct qdisc_rate_table {
25enum qdisc_state_t { 25enum qdisc_state_t {
26 __QDISC_STATE_SCHED, 26 __QDISC_STATE_SCHED,
27 __QDISC_STATE_DEACTIVATED, 27 __QDISC_STATE_DEACTIVATED,
28 __QDISC_STATE_THROTTLED,
28}; 29};
29 30
30/* 31/*
31 * following bits are only changed while qdisc lock is held 32 * following bits are only changed while qdisc lock is held
32 */ 33 */
33enum qdisc___state_t { 34enum qdisc___state_t {
34 __QDISC___STATE_RUNNING, 35 __QDISC___STATE_RUNNING = 1,
35}; 36};
36 37
37struct qdisc_size_table { 38struct qdisc_size_table {
39 struct rcu_head rcu;
38 struct list_head list; 40 struct list_head list;
39 struct tc_sizespec szopts; 41 struct tc_sizespec szopts;
40 int refcnt; 42 int refcnt;
@@ -46,14 +48,13 @@ struct Qdisc {
46 struct sk_buff * (*dequeue)(struct Qdisc *dev); 48 struct sk_buff * (*dequeue)(struct Qdisc *dev);
47 unsigned flags; 49 unsigned flags;
48#define TCQ_F_BUILTIN 1 50#define TCQ_F_BUILTIN 1
49#define TCQ_F_THROTTLED 2 51#define TCQ_F_INGRESS 2
50#define TCQ_F_INGRESS 4 52#define TCQ_F_CAN_BYPASS 4
51#define TCQ_F_CAN_BYPASS 8 53#define TCQ_F_MQROOT 8
52#define TCQ_F_MQROOT 16
53#define TCQ_F_WARN_NONWC (1 << 16) 54#define TCQ_F_WARN_NONWC (1 << 16)
54 int padded; 55 int padded;
55 struct Qdisc_ops *ops; 56 struct Qdisc_ops *ops;
56 struct qdisc_size_table *stab; 57 struct qdisc_size_table __rcu *stab;
57 struct list_head list; 58 struct list_head list;
58 u32 handle; 59 u32 handle;
59 u32 parent; 60 u32 parent;
@@ -78,25 +79,44 @@ struct Qdisc {
78 unsigned long state; 79 unsigned long state;
79 struct sk_buff_head q; 80 struct sk_buff_head q;
80 struct gnet_stats_basic_packed bstats; 81 struct gnet_stats_basic_packed bstats;
81 unsigned long __state; 82 unsigned int __state;
82 struct gnet_stats_queue qstats; 83 struct gnet_stats_queue qstats;
83 struct rcu_head rcu_head; 84 struct rcu_head rcu_head;
84 spinlock_t busylock; 85 spinlock_t busylock;
86 u32 limit;
85}; 87};
86 88
87static inline bool qdisc_is_running(struct Qdisc *qdisc) 89static inline bool qdisc_is_running(const struct Qdisc *qdisc)
88{ 90{
89 return test_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 91 return (qdisc->__state & __QDISC___STATE_RUNNING) ? true : false;
90} 92}
91 93
92static inline bool qdisc_run_begin(struct Qdisc *qdisc) 94static inline bool qdisc_run_begin(struct Qdisc *qdisc)
93{ 95{
94 return !__test_and_set_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 96 if (qdisc_is_running(qdisc))
97 return false;
98 qdisc->__state |= __QDISC___STATE_RUNNING;
99 return true;
95} 100}
96 101
97static inline void qdisc_run_end(struct Qdisc *qdisc) 102static inline void qdisc_run_end(struct Qdisc *qdisc)
98{ 103{
99 __clear_bit(__QDISC___STATE_RUNNING, &qdisc->__state); 104 qdisc->__state &= ~__QDISC___STATE_RUNNING;
105}
106
107static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
108{
109 return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false;
110}
111
112static inline void qdisc_throttled(struct Qdisc *qdisc)
113{
114 set_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
115}
116
117static inline void qdisc_unthrottled(struct Qdisc *qdisc)
118{
119 clear_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
100} 120}
101 121
102struct Qdisc_class_ops { 122struct Qdisc_class_ops {
@@ -331,8 +351,8 @@ extern struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
331 struct Qdisc_ops *ops); 351 struct Qdisc_ops *ops);
332extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, 352extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue,
333 struct Qdisc_ops *ops, u32 parentid); 353 struct Qdisc_ops *ops, u32 parentid);
334extern void qdisc_calculate_pkt_len(struct sk_buff *skb, 354extern void __qdisc_calculate_pkt_len(struct sk_buff *skb,
335 struct qdisc_size_table *stab); 355 const struct qdisc_size_table *stab);
336extern void tcf_destroy(struct tcf_proto *tp); 356extern void tcf_destroy(struct tcf_proto *tp);
337extern void tcf_destroy_chain(struct tcf_proto **fl); 357extern void tcf_destroy_chain(struct tcf_proto **fl);
338 358
@@ -411,12 +431,20 @@ enum net_xmit_qdisc_t {
411#define net_xmit_drop_count(e) (1) 431#define net_xmit_drop_count(e) (1)
412#endif 432#endif
413 433
414static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch) 434static inline void qdisc_calculate_pkt_len(struct sk_buff *skb,
435 const struct Qdisc *sch)
415{ 436{
416#ifdef CONFIG_NET_SCHED 437#ifdef CONFIG_NET_SCHED
417 if (sch->stab) 438 struct qdisc_size_table *stab = rcu_dereference_bh(sch->stab);
418 qdisc_calculate_pkt_len(skb, sch->stab); 439
440 if (stab)
441 __qdisc_calculate_pkt_len(skb, stab);
419#endif 442#endif
443}
444
445static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
446{
447 qdisc_calculate_pkt_len(skb, sch);
420 return sch->enqueue(skb, sch); 448 return sch->enqueue(skb, sch);
421} 449}
422 450
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 762e2abce889..27461d6dd46f 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -150,7 +150,7 @@ struct linux_xfrm_mib {
150#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 150#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
151 do { \ 151 do { \
152 __typeof__(*mib[0]) *ptr = \ 152 __typeof__(*mib[0]) *ptr = \
153 __this_cpu_ptr((mib)[!in_softirq()]); \ 153 __this_cpu_ptr((mib)[0]); \
154 ptr->mibs[basefield##PKTS]++; \ 154 ptr->mibs[basefield##PKTS]++; \
155 ptr->mibs[basefield##OCTETS] += addend;\ 155 ptr->mibs[basefield##OCTETS] += addend;\
156 } while (0) 156 } while (0)
@@ -202,7 +202,7 @@ struct linux_xfrm_mib {
202#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \ 202#define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend) \
203 do { \ 203 do { \
204 __typeof__(*mib[0]) *ptr; \ 204 __typeof__(*mib[0]) *ptr; \
205 ptr = __this_cpu_ptr((mib)[!in_softirq()]); \ 205 ptr = __this_cpu_ptr((mib)[0]); \
206 u64_stats_update_begin(&ptr->syncp); \ 206 u64_stats_update_begin(&ptr->syncp); \
207 ptr->mibs[basefield##PKTS]++; \ 207 ptr->mibs[basefield##PKTS]++; \
208 ptr->mibs[basefield##OCTETS] += addend; \ 208 ptr->mibs[basefield##OCTETS] += addend; \
diff --git a/include/net/sock.h b/include/net/sock.h
index bc1cf7d88ccb..da0534d3401c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -281,7 +281,7 @@ struct sock {
281 int sk_rcvbuf; 281 int sk_rcvbuf;
282 282
283 struct sk_filter __rcu *sk_filter; 283 struct sk_filter __rcu *sk_filter;
284 struct socket_wq *sk_wq; 284 struct socket_wq __rcu *sk_wq;
285 285
286#ifdef CONFIG_NET_DMA 286#ifdef CONFIG_NET_DMA
287 struct sk_buff_head sk_async_wait_queue; 287 struct sk_buff_head sk_async_wait_queue;
@@ -1191,7 +1191,7 @@ extern void sk_filter_release_rcu(struct rcu_head *rcu);
1191static inline void sk_filter_release(struct sk_filter *fp) 1191static inline void sk_filter_release(struct sk_filter *fp)
1192{ 1192{
1193 if (atomic_dec_and_test(&fp->refcnt)) 1193 if (atomic_dec_and_test(&fp->refcnt))
1194 call_rcu_bh(&fp->rcu, sk_filter_release_rcu); 1194 call_rcu(&fp->rcu, sk_filter_release_rcu);
1195} 1195}
1196 1196
1197static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) 1197static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
@@ -1266,7 +1266,8 @@ static inline void sk_set_socket(struct sock *sk, struct socket *sock)
1266 1266
1267static inline wait_queue_head_t *sk_sleep(struct sock *sk) 1267static inline wait_queue_head_t *sk_sleep(struct sock *sk)
1268{ 1268{
1269 return &sk->sk_wq->wait; 1269 BUILD_BUG_ON(offsetof(struct socket_wq, wait) != 0);
1270 return &rcu_dereference_raw(sk->sk_wq)->wait;
1270} 1271}
1271/* Detach socket from process context. 1272/* Detach socket from process context.
1272 * Announce socket dead, detach it from wait queue and inode. 1273 * Announce socket dead, detach it from wait queue and inode.
@@ -1287,7 +1288,7 @@ static inline void sock_orphan(struct sock *sk)
1287static inline void sock_graft(struct sock *sk, struct socket *parent) 1288static inline void sock_graft(struct sock *sk, struct socket *parent)
1288{ 1289{
1289 write_lock_bh(&sk->sk_callback_lock); 1290 write_lock_bh(&sk->sk_callback_lock);
1290 rcu_assign_pointer(sk->sk_wq, parent->wq); 1291 sk->sk_wq = parent->wq;
1291 parent->sk = sk; 1292 parent->sk = sk;
1292 sk_set_socket(sk, parent); 1293 sk_set_socket(sk, parent);
1293 security_sock_graft(sk, parent); 1294 security_sock_graft(sk, parent);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 38509f047382..cda30ea354a2 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
196/* TCP thin-stream limits */ 196/* TCP thin-stream limits */
197#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */ 197#define TCP_THIN_LINEAR_RETRIES 6 /* After 6 linear retries, do exp. backoff */
198 198
199/* TCP initial congestion window as per draft-hkchu-tcpm-initcwnd-01 */
200#define TCP_INIT_CWND 10
201
199extern struct inet_timewait_death_row tcp_death_row; 202extern struct inet_timewait_death_row tcp_death_row;
200 203
201/* sysctl variables for tcp */ 204/* sysctl variables for tcp */
@@ -799,15 +802,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
799/* Use define here intentionally to get WARN_ON location shown at the caller */ 802/* Use define here intentionally to get WARN_ON location shown at the caller */
800#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 803#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
801 804
802/*
803 * Convert RFC 3390 larger initial window into an equivalent number of packets.
804 * This is based on the numbers specified in RFC 5681, 3.1.
805 */
806static inline u32 rfc3390_bytes_to_packets(const u32 smss)
807{
808 return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3);
809}
810
811extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 805extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
812extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 806extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
813 807
@@ -1074,8 +1068,6 @@ static inline int tcp_paws_reject(const struct tcp_options_received *rx_opt,
1074 return 1; 1068 return 1;
1075} 1069}
1076 1070
1077#define TCP_CHECK_TIMER(sk) do { } while (0)
1078
1079static inline void tcp_mib_init(struct net *net) 1071static inline void tcp_mib_init(struct net *net)
1080{ 1072{
1081 /* See RFC 2012 */ 1073 /* See RFC 2012 */
@@ -1404,7 +1396,7 @@ extern struct request_sock_ops tcp6_request_sock_ops;
1404extern void tcp_v4_destroy_sock(struct sock *sk); 1396extern void tcp_v4_destroy_sock(struct sock *sk);
1405 1397
1406extern int tcp_v4_gso_send_check(struct sk_buff *skb); 1398extern int tcp_v4_gso_send_check(struct sk_buff *skb);
1407extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, int features); 1399extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, u32 features);
1408extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1400extern struct sk_buff **tcp_gro_receive(struct sk_buff **head,
1409 struct sk_buff *skb); 1401 struct sk_buff *skb);
1410extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head, 1402extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 42a0eb68b7b6..eeb077dd735f 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -14,7 +14,7 @@ extern struct proto udpv6_prot;
14extern struct proto udplitev6_prot; 14extern struct proto udplitev6_prot;
15extern struct proto tcpv6_prot; 15extern struct proto tcpv6_prot;
16 16
17struct flowi; 17struct flowi6;
18 18
19/* extention headers */ 19/* extention headers */
20extern int ipv6_exthdrs_init(void); 20extern int ipv6_exthdrs_init(void);
@@ -42,7 +42,7 @@ extern int datagram_recv_ctl(struct sock *sk,
42 42
43extern int datagram_send_ctl(struct net *net, 43extern int datagram_send_ctl(struct net *net,
44 struct msghdr *msg, 44 struct msghdr *msg,
45 struct flowi *fl, 45 struct flowi6 *fl6,
46 struct ipv6_txoptions *opt, 46 struct ipv6_txoptions *opt,
47 int *hlimit, int *tclass, 47 int *hlimit, int *tclass,
48 int *dontfrag); 48 int *dontfrag);
diff --git a/include/net/udp.h b/include/net/udp.h
index bb967dd59bf7..67ea6fcb3ec0 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -144,6 +144,17 @@ static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
144 return csum; 144 return csum;
145} 145}
146 146
147static inline __wsum udp_csum(struct sk_buff *skb)
148{
149 __wsum csum = csum_partial(skb_transport_header(skb),
150 sizeof(struct udphdr), skb->csum);
151
152 for (skb = skb_shinfo(skb)->frag_list; skb; skb = skb->next) {
153 csum = csum_add(csum, skb->csum);
154 }
155 return csum;
156}
157
147/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ 158/* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
148static inline void udp_lib_hash(struct sock *sk) 159static inline void udp_lib_hash(struct sock *sk)
149{ 160{
@@ -245,5 +256,5 @@ extern void udp4_proc_exit(void);
245extern void udp_init(void); 256extern void udp_init(void);
246 257
247extern int udp4_ufo_send_check(struct sk_buff *skb); 258extern int udp4_ufo_send_check(struct sk_buff *skb);
248extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, int features); 259extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb, u32 features);
249#endif /* _UDP_H */ 260#endif /* _UDP_H */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index afdffe607b24..673a024c6b2a 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -115,6 +115,18 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb)
115 return csum; 115 return csum;
116} 116}
117 117
118static inline __wsum udplite_csum(struct sk_buff *skb)
119{
120 struct sock *sk = skb->sk;
121 int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb));
122 const int off = skb_transport_offset(skb);
123 const int len = skb->len - off;
124
125 skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */
126
127 return skb_checksum(skb, off, min(cscov, len), 0);
128}
129
118extern void udplite4_register(void); 130extern void udplite4_register(void);
119extern int udplite_get_port(struct sock *sk, unsigned short snum, 131extern int udplite_get_port(struct sock *sk, unsigned short snum,
120 int (*scmp)(const struct sock *, const struct sock *)); 132 int (*scmp)(const struct sock *, const struct sock *));
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b9f385da758e..cffa5dc66449 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -36,6 +36,7 @@
36#define XFRM_PROTO_ROUTING IPPROTO_ROUTING 36#define XFRM_PROTO_ROUTING IPPROTO_ROUTING
37#define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS 37#define XFRM_PROTO_DSTOPTS IPPROTO_DSTOPTS
38 38
39#define XFRM_ALIGN4(len) (((len) + 3) & ~3)
39#define XFRM_ALIGN8(len) (((len) + 7) & ~7) 40#define XFRM_ALIGN8(len) (((len) + 7) & ~7)
40#define MODULE_ALIAS_XFRM_MODE(family, encap) \ 41#define MODULE_ALIAS_XFRM_MODE(family, encap) \
41 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap)) 42 MODULE_ALIAS("xfrm-mode-" __stringify(family) "-" __stringify(encap))
@@ -185,9 +186,14 @@ struct xfrm_state {
185 186
186 /* State for replay detection */ 187 /* State for replay detection */
187 struct xfrm_replay_state replay; 188 struct xfrm_replay_state replay;
189 struct xfrm_replay_state_esn *replay_esn;
188 190
189 /* Replay detection state at the time we sent the last notification */ 191 /* Replay detection state at the time we sent the last notification */
190 struct xfrm_replay_state preplay; 192 struct xfrm_replay_state preplay;
193 struct xfrm_replay_state_esn *preplay_esn;
194
195 /* The functions for replay detection. */
196 struct xfrm_replay *repl;
191 197
192 /* internal flag that only holds state for delayed aevent at the 198 /* internal flag that only holds state for delayed aevent at the
193 * moment 199 * moment
@@ -258,6 +264,15 @@ struct km_event {
258 struct net *net; 264 struct net *net;
259}; 265};
260 266
267struct xfrm_replay {
268 void (*advance)(struct xfrm_state *x, __be32 net_seq);
269 int (*check)(struct xfrm_state *x,
270 struct sk_buff *skb,
271 __be32 net_seq);
272 void (*notify)(struct xfrm_state *x, int event);
273 int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
274};
275
261struct net_device; 276struct net_device;
262struct xfrm_type; 277struct xfrm_type;
263struct xfrm_dst; 278struct xfrm_dst;
@@ -266,25 +281,26 @@ struct xfrm_policy_afinfo {
266 struct dst_ops *dst_ops; 281 struct dst_ops *dst_ops;
267 void (*garbage_collect)(struct net *net); 282 void (*garbage_collect)(struct net *net);
268 struct dst_entry *(*dst_lookup)(struct net *net, int tos, 283 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
269 xfrm_address_t *saddr, 284 const xfrm_address_t *saddr,
270 xfrm_address_t *daddr); 285 const xfrm_address_t *daddr);
271 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); 286 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
272 void (*decode_session)(struct sk_buff *skb, 287 void (*decode_session)(struct sk_buff *skb,
273 struct flowi *fl, 288 struct flowi *fl,
274 int reverse); 289 int reverse);
275 int (*get_tos)(struct flowi *fl); 290 int (*get_tos)(const struct flowi *fl);
276 int (*init_path)(struct xfrm_dst *path, 291 int (*init_path)(struct xfrm_dst *path,
277 struct dst_entry *dst, 292 struct dst_entry *dst,
278 int nfheader_len); 293 int nfheader_len);
279 int (*fill_dst)(struct xfrm_dst *xdst, 294 int (*fill_dst)(struct xfrm_dst *xdst,
280 struct net_device *dev, 295 struct net_device *dev,
281 struct flowi *fl); 296 const struct flowi *fl);
297 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig);
282}; 298};
283 299
284extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 300extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
285extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 301extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
286extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); 302extern void km_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c);
287extern void km_state_notify(struct xfrm_state *x, struct km_event *c); 303extern void km_state_notify(struct xfrm_state *x, const struct km_event *c);
288 304
289struct xfrm_tmpl; 305struct xfrm_tmpl;
290extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 306extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
@@ -299,9 +315,12 @@ struct xfrm_state_afinfo {
299 const struct xfrm_type *type_map[IPPROTO_MAX]; 315 const struct xfrm_type *type_map[IPPROTO_MAX];
300 struct xfrm_mode *mode_map[XFRM_MODE_MAX]; 316 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
301 int (*init_flags)(struct xfrm_state *x); 317 int (*init_flags)(struct xfrm_state *x);
302 void (*init_tempsel)(struct xfrm_selector *sel, struct flowi *fl); 318 void (*init_tempsel)(struct xfrm_selector *sel,
303 void (*init_temprop)(struct xfrm_state *x, struct xfrm_tmpl *tmpl, 319 const struct flowi *fl);
304 xfrm_address_t *daddr, xfrm_address_t *saddr); 320 void (*init_temprop)(struct xfrm_state *x,
321 const struct xfrm_tmpl *tmpl,
322 const xfrm_address_t *daddr,
323 const xfrm_address_t *saddr);
305 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); 324 int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n);
306 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); 325 int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n);
307 int (*output)(struct sk_buff *skb); 326 int (*output)(struct sk_buff *skb);
@@ -332,7 +351,8 @@ struct xfrm_type {
332 void (*destructor)(struct xfrm_state *); 351 void (*destructor)(struct xfrm_state *);
333 int (*input)(struct xfrm_state *, struct sk_buff *skb); 352 int (*input)(struct xfrm_state *, struct sk_buff *skb);
334 int (*output)(struct xfrm_state *, struct sk_buff *pskb); 353 int (*output)(struct xfrm_state *, struct sk_buff *pskb);
335 int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); 354 int (*reject)(struct xfrm_state *, struct sk_buff *,
355 const struct flowi *);
336 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); 356 int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **);
337 /* Estimate maximal size of result of transformation of a dgram */ 357 /* Estimate maximal size of result of transformation of a dgram */
338 u32 (*get_mtu)(struct xfrm_state *, int size); 358 u32 (*get_mtu)(struct xfrm_state *, int size);
@@ -501,7 +521,7 @@ struct xfrm_policy {
501 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; 521 struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
502}; 522};
503 523
504static inline struct net *xp_net(struct xfrm_policy *xp) 524static inline struct net *xp_net(const struct xfrm_policy *xp)
505{ 525{
506 return read_pnet(&xp->xp_net); 526 return read_pnet(&xp->xp_net);
507} 527}
@@ -545,13 +565,17 @@ struct xfrm_migrate {
545struct xfrm_mgr { 565struct xfrm_mgr {
546 struct list_head list; 566 struct list_head list;
547 char *id; 567 char *id;
548 int (*notify)(struct xfrm_state *x, struct km_event *c); 568 int (*notify)(struct xfrm_state *x, const struct km_event *c);
549 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 569 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
550 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 570 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
551 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 571 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
552 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c); 572 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c);
553 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 573 int (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
554 int (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k); 574 int (*migrate)(const struct xfrm_selector *sel,
575 u8 dir, u8 type,
576 const struct xfrm_migrate *m,
577 int num_bundles,
578 const struct xfrm_kmaddress *k);
555}; 579};
556 580
557extern int xfrm_register_km(struct xfrm_mgr *km); 581extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -570,8 +594,14 @@ struct xfrm_skb_cb {
570 594
571 /* Sequence number for replay protection. */ 595 /* Sequence number for replay protection. */
572 union { 596 union {
573 u64 output; 597 struct {
574 __be32 input; 598 __u32 low;
599 __u32 hi;
600 } output;
601 struct {
602 __be32 low;
603 __be32 hi;
604 } input;
575 } seq; 605 } seq;
576}; 606};
577 607
@@ -675,6 +705,8 @@ extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
675 u32 auid, u32 ses, u32 secid); 705 u32 auid, u32 ses, u32 secid);
676extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 706extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
677 struct sk_buff *skb); 707 struct sk_buff *skb);
708extern void xfrm_audit_state_replay(struct xfrm_state *x,
709 struct sk_buff *skb, __be32 net_seq);
678extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); 710extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family);
679extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, 711extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family,
680 __be32 net_spi, __be32 net_seq); 712 __be32 net_spi, __be32 net_seq);
@@ -707,6 +739,11 @@ static inline void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
707{ 739{
708} 740}
709 741
742static inline void xfrm_audit_state_replay(struct xfrm_state *x,
743 struct sk_buff *skb, __be32 net_seq)
744{
745}
746
710static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb, 747static inline void xfrm_audit_state_notfound_simple(struct sk_buff *skb,
711 u16 family) 748 u16 family)
712{ 749{
@@ -762,10 +799,11 @@ static inline void xfrm_state_hold(struct xfrm_state *x)
762 atomic_inc(&x->refcnt); 799 atomic_inc(&x->refcnt);
763} 800}
764 801
765static __inline__ int addr_match(void *token1, void *token2, int prefixlen) 802static inline bool addr_match(const void *token1, const void *token2,
803 int prefixlen)
766{ 804{
767 __be32 *a1 = token1; 805 const __be32 *a1 = token1;
768 __be32 *a2 = token2; 806 const __be32 *a2 = token2;
769 int pdw; 807 int pdw;
770 int pbi; 808 int pbi;
771 809
@@ -774,7 +812,7 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
774 812
775 if (pdw) 813 if (pdw)
776 if (memcmp(a1, a2, pdw << 2)) 814 if (memcmp(a1, a2, pdw << 2))
777 return 0; 815 return false;
778 816
779 if (pbi) { 817 if (pbi) {
780 __be32 mask; 818 __be32 mask;
@@ -782,32 +820,32 @@ static __inline__ int addr_match(void *token1, void *token2, int prefixlen)
782 mask = htonl((0xffffffff) << (32 - pbi)); 820 mask = htonl((0xffffffff) << (32 - pbi));
783 821
784 if ((a1[pdw] ^ a2[pdw]) & mask) 822 if ((a1[pdw] ^ a2[pdw]) & mask)
785 return 0; 823 return false;
786 } 824 }
787 825
788 return 1; 826 return true;
789} 827}
790 828
791static __inline__ 829static __inline__
792__be16 xfrm_flowi_sport(struct flowi *fl) 830__be16 xfrm_flowi_sport(const struct flowi *fl, const union flowi_uli *uli)
793{ 831{
794 __be16 port; 832 __be16 port;
795 switch(fl->proto) { 833 switch(fl->flowi_proto) {
796 case IPPROTO_TCP: 834 case IPPROTO_TCP:
797 case IPPROTO_UDP: 835 case IPPROTO_UDP:
798 case IPPROTO_UDPLITE: 836 case IPPROTO_UDPLITE:
799 case IPPROTO_SCTP: 837 case IPPROTO_SCTP:
800 port = fl->fl_ip_sport; 838 port = uli->ports.sport;
801 break; 839 break;
802 case IPPROTO_ICMP: 840 case IPPROTO_ICMP:
803 case IPPROTO_ICMPV6: 841 case IPPROTO_ICMPV6:
804 port = htons(fl->fl_icmp_type); 842 port = htons(uli->icmpt.type);
805 break; 843 break;
806 case IPPROTO_MH: 844 case IPPROTO_MH:
807 port = htons(fl->fl_mh_type); 845 port = htons(uli->mht.type);
808 break; 846 break;
809 case IPPROTO_GRE: 847 case IPPROTO_GRE:
810 port = htons(ntohl(fl->fl_gre_key) >> 16); 848 port = htons(ntohl(uli->gre_key) >> 16);
811 break; 849 break;
812 default: 850 default:
813 port = 0; /*XXX*/ 851 port = 0; /*XXX*/
@@ -816,22 +854,22 @@ __be16 xfrm_flowi_sport(struct flowi *fl)
816} 854}
817 855
818static __inline__ 856static __inline__
819__be16 xfrm_flowi_dport(struct flowi *fl) 857__be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
820{ 858{
821 __be16 port; 859 __be16 port;
822 switch(fl->proto) { 860 switch(fl->flowi_proto) {
823 case IPPROTO_TCP: 861 case IPPROTO_TCP:
824 case IPPROTO_UDP: 862 case IPPROTO_UDP:
825 case IPPROTO_UDPLITE: 863 case IPPROTO_UDPLITE:
826 case IPPROTO_SCTP: 864 case IPPROTO_SCTP:
827 port = fl->fl_ip_dport; 865 port = uli->ports.dport;
828 break; 866 break;
829 case IPPROTO_ICMP: 867 case IPPROTO_ICMP:
830 case IPPROTO_ICMPV6: 868 case IPPROTO_ICMPV6:
831 port = htons(fl->fl_icmp_code); 869 port = htons(uli->icmpt.code);
832 break; 870 break;
833 case IPPROTO_GRE: 871 case IPPROTO_GRE:
834 port = htons(ntohl(fl->fl_gre_key) & 0xffff); 872 port = htons(ntohl(uli->gre_key) & 0xffff);
835 break; 873 break;
836 default: 874 default:
837 port = 0; /*XXX*/ 875 port = 0; /*XXX*/
@@ -839,7 +877,8 @@ __be16 xfrm_flowi_dport(struct flowi *fl)
839 return port; 877 return port;
840} 878}
841 879
842extern int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, 880extern int xfrm_selector_match(const struct xfrm_selector *sel,
881 const struct flowi *fl,
843 unsigned short family); 882 unsigned short family);
844 883
845#ifdef CONFIG_SECURITY_NETWORK_XFRM 884#ifdef CONFIG_SECURITY_NETWORK_XFRM
@@ -947,7 +986,7 @@ secpath_reset(struct sk_buff *skb)
947} 986}
948 987
949static inline int 988static inline int
950xfrm_addr_any(xfrm_address_t *addr, unsigned short family) 989xfrm_addr_any(const xfrm_address_t *addr, unsigned short family)
951{ 990{
952 switch (family) { 991 switch (family) {
953 case AF_INET: 992 case AF_INET:
@@ -959,21 +998,21 @@ xfrm_addr_any(xfrm_address_t *addr, unsigned short family)
959} 998}
960 999
961static inline int 1000static inline int
962__xfrm4_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 1001__xfrm4_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
963{ 1002{
964 return (tmpl->saddr.a4 && 1003 return (tmpl->saddr.a4 &&
965 tmpl->saddr.a4 != x->props.saddr.a4); 1004 tmpl->saddr.a4 != x->props.saddr.a4);
966} 1005}
967 1006
968static inline int 1007static inline int
969__xfrm6_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x) 1008__xfrm6_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x)
970{ 1009{
971 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) && 1010 return (!ipv6_addr_any((struct in6_addr*)&tmpl->saddr) &&
972 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr)); 1011 ipv6_addr_cmp((struct in6_addr *)&tmpl->saddr, (struct in6_addr*)&x->props.saddr));
973} 1012}
974 1013
975static inline int 1014static inline int
976xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short family) 1015xfrm_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, unsigned short family)
977{ 1016{
978 switch (family) { 1017 switch (family) {
979 case AF_INET: 1018 case AF_INET:
@@ -1126,49 +1165,49 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
1126#endif 1165#endif
1127 1166
1128static __inline__ 1167static __inline__
1129xfrm_address_t *xfrm_flowi_daddr(struct flowi *fl, unsigned short family) 1168xfrm_address_t *xfrm_flowi_daddr(const struct flowi *fl, unsigned short family)
1130{ 1169{
1131 switch (family){ 1170 switch (family){
1132 case AF_INET: 1171 case AF_INET:
1133 return (xfrm_address_t *)&fl->fl4_dst; 1172 return (xfrm_address_t *)&fl->u.ip4.daddr;
1134 case AF_INET6: 1173 case AF_INET6:
1135 return (xfrm_address_t *)&fl->fl6_dst; 1174 return (xfrm_address_t *)&fl->u.ip6.daddr;
1136 } 1175 }
1137 return NULL; 1176 return NULL;
1138} 1177}
1139 1178
1140static __inline__ 1179static __inline__
1141xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family) 1180xfrm_address_t *xfrm_flowi_saddr(const struct flowi *fl, unsigned short family)
1142{ 1181{
1143 switch (family){ 1182 switch (family){
1144 case AF_INET: 1183 case AF_INET:
1145 return (xfrm_address_t *)&fl->fl4_src; 1184 return (xfrm_address_t *)&fl->u.ip4.saddr;
1146 case AF_INET6: 1185 case AF_INET6:
1147 return (xfrm_address_t *)&fl->fl6_src; 1186 return (xfrm_address_t *)&fl->u.ip6.saddr;
1148 } 1187 }
1149 return NULL; 1188 return NULL;
1150} 1189}
1151 1190
1152static __inline__ 1191static __inline__
1153void xfrm_flowi_addr_get(struct flowi *fl, 1192void xfrm_flowi_addr_get(const struct flowi *fl,
1154 xfrm_address_t *saddr, xfrm_address_t *daddr, 1193 xfrm_address_t *saddr, xfrm_address_t *daddr,
1155 unsigned short family) 1194 unsigned short family)
1156{ 1195{
1157 switch(family) { 1196 switch(family) {
1158 case AF_INET: 1197 case AF_INET:
1159 memcpy(&saddr->a4, &fl->fl4_src, sizeof(saddr->a4)); 1198 memcpy(&saddr->a4, &fl->u.ip4.saddr, sizeof(saddr->a4));
1160 memcpy(&daddr->a4, &fl->fl4_dst, sizeof(daddr->a4)); 1199 memcpy(&daddr->a4, &fl->u.ip4.daddr, sizeof(daddr->a4));
1161 break; 1200 break;
1162 case AF_INET6: 1201 case AF_INET6:
1163 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->fl6_src); 1202 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->u.ip6.saddr);
1164 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->fl6_dst); 1203 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->u.ip6.daddr);
1165 break; 1204 break;
1166 } 1205 }
1167} 1206}
1168 1207
1169static __inline__ int 1208static __inline__ int
1170__xfrm4_state_addr_check(struct xfrm_state *x, 1209__xfrm4_state_addr_check(const struct xfrm_state *x,
1171 xfrm_address_t *daddr, xfrm_address_t *saddr) 1210 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1172{ 1211{
1173 if (daddr->a4 == x->id.daddr.a4 && 1212 if (daddr->a4 == x->id.daddr.a4 &&
1174 (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4)) 1213 (saddr->a4 == x->props.saddr.a4 || !saddr->a4 || !x->props.saddr.a4))
@@ -1177,8 +1216,8 @@ __xfrm4_state_addr_check(struct xfrm_state *x,
1177} 1216}
1178 1217
1179static __inline__ int 1218static __inline__ int
1180__xfrm6_state_addr_check(struct xfrm_state *x, 1219__xfrm6_state_addr_check(const struct xfrm_state *x,
1181 xfrm_address_t *daddr, xfrm_address_t *saddr) 1220 const xfrm_address_t *daddr, const xfrm_address_t *saddr)
1182{ 1221{
1183 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) && 1222 if (!ipv6_addr_cmp((struct in6_addr *)daddr, (struct in6_addr *)&x->id.daddr) &&
1184 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)|| 1223 (!ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)&x->props.saddr)||
@@ -1189,8 +1228,8 @@ __xfrm6_state_addr_check(struct xfrm_state *x,
1189} 1228}
1190 1229
1191static __inline__ int 1230static __inline__ int
1192xfrm_state_addr_check(struct xfrm_state *x, 1231xfrm_state_addr_check(const struct xfrm_state *x,
1193 xfrm_address_t *daddr, xfrm_address_t *saddr, 1232 const xfrm_address_t *daddr, const xfrm_address_t *saddr,
1194 unsigned short family) 1233 unsigned short family)
1195{ 1234{
1196 switch (family) { 1235 switch (family) {
@@ -1203,23 +1242,23 @@ xfrm_state_addr_check(struct xfrm_state *x,
1203} 1242}
1204 1243
1205static __inline__ int 1244static __inline__ int
1206xfrm_state_addr_flow_check(struct xfrm_state *x, struct flowi *fl, 1245xfrm_state_addr_flow_check(const struct xfrm_state *x, const struct flowi *fl,
1207 unsigned short family) 1246 unsigned short family)
1208{ 1247{
1209 switch (family) { 1248 switch (family) {
1210 case AF_INET: 1249 case AF_INET:
1211 return __xfrm4_state_addr_check(x, 1250 return __xfrm4_state_addr_check(x,
1212 (xfrm_address_t *)&fl->fl4_dst, 1251 (const xfrm_address_t *)&fl->u.ip4.daddr,
1213 (xfrm_address_t *)&fl->fl4_src); 1252 (const xfrm_address_t *)&fl->u.ip4.saddr);
1214 case AF_INET6: 1253 case AF_INET6:
1215 return __xfrm6_state_addr_check(x, 1254 return __xfrm6_state_addr_check(x,
1216 (xfrm_address_t *)&fl->fl6_dst, 1255 (const xfrm_address_t *)&fl->u.ip6.daddr,
1217 (xfrm_address_t *)&fl->fl6_src); 1256 (const xfrm_address_t *)&fl->u.ip6.saddr);
1218 } 1257 }
1219 return 0; 1258 return 0;
1220} 1259}
1221 1260
1222static inline int xfrm_state_kern(struct xfrm_state *x) 1261static inline int xfrm_state_kern(const struct xfrm_state *x)
1223{ 1262{
1224 return atomic_read(&x->tunnel_users); 1263 return atomic_read(&x->tunnel_users);
1225} 1264}
@@ -1323,8 +1362,10 @@ extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1323 int (*func)(struct xfrm_state *, int, void*), void *); 1362 int (*func)(struct xfrm_state *, int, void*), void *);
1324extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1363extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1325extern struct xfrm_state *xfrm_state_alloc(struct net *net); 1364extern struct xfrm_state *xfrm_state_alloc(struct net *net);
1326extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1365extern struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr,
1327 struct flowi *fl, struct xfrm_tmpl *tmpl, 1366 const xfrm_address_t *saddr,
1367 const struct flowi *fl,
1368 struct xfrm_tmpl *tmpl,
1328 struct xfrm_policy *pol, int *err, 1369 struct xfrm_policy *pol, int *err,
1329 unsigned short family); 1370 unsigned short family);
1330extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, 1371extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
@@ -1337,11 +1378,11 @@ extern void xfrm_state_insert(struct xfrm_state *x);
1337extern int xfrm_state_add(struct xfrm_state *x); 1378extern int xfrm_state_add(struct xfrm_state *x);
1338extern int xfrm_state_update(struct xfrm_state *x); 1379extern int xfrm_state_update(struct xfrm_state *x);
1339extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, 1380extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1340 xfrm_address_t *daddr, __be32 spi, 1381 const xfrm_address_t *daddr, __be32 spi,
1341 u8 proto, unsigned short family); 1382 u8 proto, unsigned short family);
1342extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, 1383extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1343 xfrm_address_t *daddr, 1384 const xfrm_address_t *daddr,
1344 xfrm_address_t *saddr, 1385 const xfrm_address_t *saddr,
1345 u8 proto, 1386 u8 proto,
1346 unsigned short family); 1387 unsigned short family);
1347#ifdef CONFIG_XFRM_SUB_POLICY 1388#ifdef CONFIG_XFRM_SUB_POLICY
@@ -1386,11 +1427,10 @@ extern int xfrm_state_delete(struct xfrm_state *x);
1386extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1427extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1387extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1428extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1388extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1429extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1389extern int xfrm_replay_check(struct xfrm_state *x, 1430extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
1390 struct sk_buff *skb, __be32 seq); 1431extern int xfrm_init_replay(struct xfrm_state *x);
1391extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
1392extern void xfrm_replay_notify(struct xfrm_state *x, int event);
1393extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1432extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1433extern int __xfrm_init_state(struct xfrm_state *x, bool init_replay);
1394extern int xfrm_init_state(struct xfrm_state *x); 1434extern int xfrm_init_state(struct xfrm_state *x);
1395extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); 1435extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
1396extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, 1436extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi,
@@ -1468,19 +1508,19 @@ u32 xfrm_get_acqseq(void);
1468extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1508extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1469struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, 1509struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark,
1470 u8 mode, u32 reqid, u8 proto, 1510 u8 mode, u32 reqid, u8 proto,
1471 xfrm_address_t *daddr, 1511 const xfrm_address_t *daddr,
1472 xfrm_address_t *saddr, int create, 1512 const xfrm_address_t *saddr, int create,
1473 unsigned short family); 1513 unsigned short family);
1474extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1514extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1475 1515
1476#ifdef CONFIG_XFRM_MIGRATE 1516#ifdef CONFIG_XFRM_MIGRATE
1477extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1517extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1478 struct xfrm_migrate *m, int num_bundles, 1518 const struct xfrm_migrate *m, int num_bundles,
1479 struct xfrm_kmaddress *k); 1519 const struct xfrm_kmaddress *k);
1480extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1520extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m);
1481extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1521extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x,
1482 struct xfrm_migrate *m); 1522 struct xfrm_migrate *m);
1483extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type, 1523extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1484 struct xfrm_migrate *m, int num_bundles, 1524 struct xfrm_migrate *m, int num_bundles,
1485 struct xfrm_kmaddress *k); 1525 struct xfrm_kmaddress *k);
1486#endif 1526#endif
@@ -1500,10 +1540,10 @@ extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx);
1500extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); 1540extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id);
1501extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); 1541extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id);
1502extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); 1542extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1503extern struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe); 1543extern struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe);
1504extern struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe); 1544extern struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe);
1505extern struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe); 1545extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1506extern struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len, 1546extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1507 int probe); 1547 int probe);
1508 1548
1509struct hash_desc; 1549struct hash_desc;
@@ -1511,7 +1551,8 @@ struct scatterlist;
1511typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *, 1551typedef int (icv_update_fn_t)(struct hash_desc *, struct scatterlist *,
1512 unsigned int); 1552 unsigned int);
1513 1553
1514static inline int xfrm_addr_cmp(xfrm_address_t *a, xfrm_address_t *b, 1554static inline int xfrm_addr_cmp(const xfrm_address_t *a,
1555 const xfrm_address_t *b,
1515 int family) 1556 int family)
1516{ 1557{
1517 switch (family) { 1558 switch (family) {
@@ -1544,16 +1585,21 @@ static inline int xfrm_aevent_is_on(struct net *net)
1544} 1585}
1545#endif 1586#endif
1546 1587
1547static inline int xfrm_alg_len(struct xfrm_algo *alg) 1588static inline int xfrm_alg_len(const struct xfrm_algo *alg)
1548{ 1589{
1549 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1590 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1550} 1591}
1551 1592
1552static inline int xfrm_alg_auth_len(struct xfrm_algo_auth *alg) 1593static inline int xfrm_alg_auth_len(const struct xfrm_algo_auth *alg)
1553{ 1594{
1554 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); 1595 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1555} 1596}
1556 1597
1598static inline int xfrm_replay_state_esn_len(struct xfrm_replay_state_esn *replay_esn)
1599{
1600 return sizeof(*replay_esn) + replay_esn->bmp_len * sizeof(__u32);
1601}
1602
1557#ifdef CONFIG_XFRM_MIGRATE 1603#ifdef CONFIG_XFRM_MIGRATE
1558static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1604static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1559{ 1605{
@@ -1597,7 +1643,7 @@ static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
1597 return m->v & m->m; 1643 return m->v & m->m;
1598} 1644}
1599 1645
1600static inline int xfrm_mark_put(struct sk_buff *skb, struct xfrm_mark *m) 1646static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1601{ 1647{
1602 if (m->m | m->v) 1648 if (m->m | m->v)
1603 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m); 1649 NLA_PUT(skb, XFRMA_MARK, sizeof(struct xfrm_mark), m);
diff --git a/include/scsi/fc/fc_ns.h b/include/scsi/fc/fc_ns.h
index 185015dd1166..f7751d53f1d3 100644
--- a/include/scsi/fc/fc_ns.h
+++ b/include/scsi/fc/fc_ns.h
@@ -41,6 +41,7 @@ enum fc_ns_req {
41 FC_NS_GI_A = 0x0101, /* get identifiers - scope */ 41 FC_NS_GI_A = 0x0101, /* get identifiers - scope */
42 FC_NS_GPN_ID = 0x0112, /* get port name by ID */ 42 FC_NS_GPN_ID = 0x0112, /* get port name by ID */
43 FC_NS_GNN_ID = 0x0113, /* get node name by ID */ 43 FC_NS_GNN_ID = 0x0113, /* get node name by ID */
44 FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */
44 FC_NS_GID_PN = 0x0121, /* get ID for port name */ 45 FC_NS_GID_PN = 0x0121, /* get ID for port name */
45 FC_NS_GID_NN = 0x0131, /* get IDs for node name */ 46 FC_NS_GID_NN = 0x0131, /* get IDs for node name */
46 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ 47 FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */
@@ -144,7 +145,7 @@ struct fc_ns_gid_pn {
144}; 145};
145 146
146/* 147/*
147 * GID_PN response 148 * GID_PN response or GSPN_ID request
148 */ 149 */
149struct fc_gid_pn_resp { 150struct fc_gid_pn_resp {
150 __u8 fp_resvd; 151 __u8 fp_resvd;
@@ -152,6 +153,14 @@ struct fc_gid_pn_resp {
152}; 153};
153 154
154/* 155/*
156 * GSPN_ID response
157 */
158struct fc_gspn_resp {
159 __u8 fp_name_len;
160 char fp_name[];
161};
162
163/*
155 * RFT_ID request - register FC-4 types for ID. 164 * RFT_ID request - register FC-4 types for ID.
156 */ 165 */
157struct fc_ns_rft_id { 166struct fc_ns_rft_id {
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 6d293c846a46..be418d8448a5 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -46,16 +46,11 @@ struct fc_ct_req {
46 } payload; 46 } payload;
47}; 47};
48 48
49/** 49static inline void __fc_fill_fc_hdr(struct fc_frame_header *fh,
50 * fill FC header fields in specified fc_frame 50 enum fc_rctl r_ctl,
51 */ 51 u32 did, u32 sid, enum fc_fh_type type,
52static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl, 52 u32 f_ctl, u32 parm_offset)
53 u32 did, u32 sid, enum fc_fh_type type,
54 u32 f_ctl, u32 parm_offset)
55{ 53{
56 struct fc_frame_header *fh;
57
58 fh = fc_frame_header_get(fp);
59 WARN_ON(r_ctl == 0); 54 WARN_ON(r_ctl == 0);
60 fh->fh_r_ctl = r_ctl; 55 fh->fh_r_ctl = r_ctl;
61 hton24(fh->fh_d_id, did); 56 hton24(fh->fh_d_id, did);
@@ -68,6 +63,19 @@ static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
68} 63}
69 64
70/** 65/**
66 * fill FC header fields in specified fc_frame
67 */
68static inline void fc_fill_fc_hdr(struct fc_frame *fp, enum fc_rctl r_ctl,
69 u32 did, u32 sid, enum fc_fh_type type,
70 u32 f_ctl, u32 parm_offset)
71{
72 struct fc_frame_header *fh;
73
74 fh = fc_frame_header_get(fp);
75 __fc_fill_fc_hdr(fh, r_ctl, did, sid, type, f_ctl, parm_offset);
76}
77
78/**
71 * fc_adisc_fill() - Fill in adisc request frame 79 * fc_adisc_fill() - Fill in adisc request frame
72 * @lport: local port. 80 * @lport: local port.
73 * @fp: fc frame where payload will be placed. 81 * @fp: fc frame where payload will be placed.
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f53c8e31d5fb..24193c1b0da0 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -35,6 +35,8 @@
35 35
36#include <scsi/fc_frame.h> 36#include <scsi/fc_frame.h>
37 37
38#define FC_FC4_PROV_SIZE (FC_TYPE_FCP + 1) /* size of tables */
39
38/* 40/*
39 * libfc error codes 41 * libfc error codes
40 */ 42 */
@@ -156,6 +158,7 @@ struct fc_rport_libfc_priv {
156 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) 158 #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0)
157 #define FC_RP_FLAGS_RETRY (1 << 1) 159 #define FC_RP_FLAGS_RETRY (1 << 1)
158 #define FC_RP_STARTED (1 << 2) 160 #define FC_RP_STARTED (1 << 2)
161 #define FC_RP_FLAGS_CONF_REQ (1 << 3)
159 unsigned int e_d_tov; 162 unsigned int e_d_tov;
160 unsigned int r_a_tov; 163 unsigned int r_a_tov;
161}; 164};
@@ -179,6 +182,7 @@ struct fc_rport_libfc_priv {
179 * @rp_mutex: The mutex that protects the remote port 182 * @rp_mutex: The mutex that protects the remote port
180 * @retry_work: Handle for retries 183 * @retry_work: Handle for retries
181 * @event_callback: Callback when READY, FAILED or LOGO states complete 184 * @event_callback: Callback when READY, FAILED or LOGO states complete
185 * @prli_count: Count of open PRLI sessions in providers
182 * @rcu: Structure used for freeing in an RCU-safe manner 186 * @rcu: Structure used for freeing in an RCU-safe manner
183 */ 187 */
184struct fc_rport_priv { 188struct fc_rport_priv {
@@ -202,7 +206,13 @@ struct fc_rport_priv {
202 struct list_head peers; 206 struct list_head peers;
203 struct work_struct event_work; 207 struct work_struct event_work;
204 u32 supported_classes; 208 u32 supported_classes;
209 u16 prli_count;
205 struct rcu_head rcu; 210 struct rcu_head rcu;
211 u16 sp_features;
212 u8 spp_type;
213 void (*lld_event_callback)(struct fc_lport *,
214 struct fc_rport_priv *,
215 enum fc_rport_event);
206}; 216};
207 217
208/** 218/**
@@ -551,6 +561,16 @@ struct libfc_function_template {
551 struct fc_seq *(*seq_start_next)(struct fc_seq *); 561 struct fc_seq *(*seq_start_next)(struct fc_seq *);
552 562
553 /* 563 /*
564 * Set a response handler for the exchange of the sequence.
565 *
566 * STATUS: OPTIONAL
567 */
568 void (*seq_set_resp)(struct fc_seq *sp,
569 void (*resp)(struct fc_seq *, struct fc_frame *,
570 void *),
571 void *arg);
572
573 /*
554 * Assign a sequence for an incoming request frame. 574 * Assign a sequence for an incoming request frame.
555 * 575 *
556 * STATUS: OPTIONAL 576 * STATUS: OPTIONAL
@@ -558,6 +578,13 @@ struct libfc_function_template {
558 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); 578 struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *);
559 579
560 /* 580 /*
581 * Release the reference on the sequence returned by seq_assign().
582 *
583 * STATUS: OPTIONAL
584 */
585 void (*seq_release)(struct fc_seq *);
586
587 /*
561 * Reset an exchange manager, completing all sequences and exchanges. 588 * Reset an exchange manager, completing all sequences and exchanges.
562 * If s_id is non-zero, reset only exchanges originating from that FID. 589 * If s_id is non-zero, reset only exchanges originating from that FID.
563 * If d_id is non-zero, reset only exchanges sending to that FID. 590 * If d_id is non-zero, reset only exchanges sending to that FID.
@@ -656,6 +683,15 @@ struct libfc_function_template {
656 void (*rport_destroy)(struct kref *); 683 void (*rport_destroy)(struct kref *);
657 684
658 /* 685 /*
686 * Callback routine after the remote port is logged in
687 *
688 * STATUS: OPTIONAL
689 */
690 void (*rport_event_callback)(struct fc_lport *,
691 struct fc_rport_priv *,
692 enum fc_rport_event);
693
694 /*
659 * Send a fcp cmd from fsp pkt. 695 * Send a fcp cmd from fsp pkt.
660 * Called with the SCSI host lock unlocked and irqs disabled. 696 * Called with the SCSI host lock unlocked and irqs disabled.
661 * 697 *
@@ -749,6 +785,15 @@ struct fc_disc {
749 enum fc_disc_event); 785 enum fc_disc_event);
750}; 786};
751 787
788/*
789 * Local port notifier and events.
790 */
791extern struct blocking_notifier_head fc_lport_notifier_head;
792enum fc_lport_event {
793 FC_LPORT_EV_ADD,
794 FC_LPORT_EV_DEL,
795};
796
752/** 797/**
753 * struct fc_lport - Local port 798 * struct fc_lport - Local port
754 * @host: The SCSI host associated with a local port 799 * @host: The SCSI host associated with a local port
@@ -789,8 +834,10 @@ struct fc_disc {
789 * @lso_max: The maximum large offload send size 834 * @lso_max: The maximum large offload send size
790 * @fcts: FC-4 type mask 835 * @fcts: FC-4 type mask
791 * @lp_mutex: Mutex to protect the local port 836 * @lp_mutex: Mutex to protect the local port
792 * @list: Handle for list of local ports 837 * @list: Linkage on list of vport peers
793 * @retry_work: Handle to local port for delayed retry context 838 * @retry_work: Handle to local port for delayed retry context
839 * @prov: Pointers available for use by passive FC-4 providers
840 * @lport_list: Linkage on module-wide list of local ports
794 */ 841 */
795struct fc_lport { 842struct fc_lport {
796 /* Associations */ 843 /* Associations */
@@ -846,8 +893,32 @@ struct fc_lport {
846 struct mutex lp_mutex; 893 struct mutex lp_mutex;
847 struct list_head list; 894 struct list_head list;
848 struct delayed_work retry_work; 895 struct delayed_work retry_work;
896 void *prov[FC_FC4_PROV_SIZE];
897 struct list_head lport_list;
849}; 898};
850 899
900/**
901 * struct fc4_prov - FC-4 provider registration
902 * @prli: Handler for incoming PRLI
903 * @prlo: Handler for session reset
904 * @recv: Handler for incoming request
905 * @module: Pointer to module. May be NULL.
906 */
907struct fc4_prov {
908 int (*prli)(struct fc_rport_priv *, u32 spp_len,
909 const struct fc_els_spp *spp_in,
910 struct fc_els_spp *spp_out);
911 void (*prlo)(struct fc_rport_priv *);
912 void (*recv)(struct fc_lport *, struct fc_frame *);
913 struct module *module;
914};
915
916/*
917 * Register FC-4 provider with libfc.
918 */
919int fc_fc4_register_provider(enum fc_fh_type type, struct fc4_prov *);
920void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *);
921
851/* 922/*
852 * FC_LPORT HELPER FUNCTIONS 923 * FC_LPORT HELPER FUNCTIONS
853 *****************************/ 924 *****************************/
@@ -978,6 +1049,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize);
978struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); 1049struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id);
979int fc_lport_bsg_request(struct fc_bsg_job *); 1050int fc_lport_bsg_request(struct fc_bsg_job *);
980void fc_lport_set_local_id(struct fc_lport *, u32 port_id); 1051void fc_lport_set_local_id(struct fc_lport *, u32 port_id);
1052void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *);
981 1053
982/* 1054/*
983 * REMOTE PORT LAYER 1055 * REMOTE PORT LAYER
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index feb6a94c90ea..8c1638b8c28e 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -33,6 +33,12 @@
33#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */ 33#define FCOE_MAX_CMD_LEN 16 /* Supported CDB length */
34 34
35/* 35/*
36 * Max MTU for FCoE: 14 (FCoE header) + 24 (FC header) + 2112 (max FC payload)
37 * + 4 (FC CRC) + 4 (FCoE trailer) = 2158 bytes
38 */
39#define FCOE_MTU 2158
40
41/*
36 * FIP tunable parameters. 42 * FIP tunable parameters.
37 */ 43 */
38#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */ 44#define FCOE_CTLR_START_DELAY 2000 /* mS after first adv. to choose FCF */
@@ -221,6 +227,8 @@ int fcoe_ctlr_recv_flogi(struct fcoe_ctlr *, struct fc_lport *,
221u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int); 227u64 fcoe_wwn_from_mac(unsigned char mac[], unsigned int, unsigned int);
222int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *, 228int fcoe_libfc_config(struct fc_lport *, struct fcoe_ctlr *,
223 const struct libfc_function_template *, int init_fcp); 229 const struct libfc_function_template *, int init_fcp);
230u32 fcoe_fc_crc(struct fc_frame *fp);
231int fcoe_start_io(struct sk_buff *skb);
224 232
225/** 233/**
226 * is_fip_mode() - returns true if FIP mode selected. 234 * is_fip_mode() - returns true if FIP mode selected.
@@ -231,5 +239,102 @@ static inline bool is_fip_mode(struct fcoe_ctlr *fip)
231 return fip->state == FIP_ST_ENABLED; 239 return fip->state == FIP_ST_ENABLED;
232} 240}
233 241
242/* helper for FCoE SW HBA drivers, can include subven and subdev if needed. The
243 * modpost would use pci_device_id table to auto-generate formatted module alias
244 * into the corresponding .mod.c file, but there may or may not be a pci device
245 * id table for FCoE drivers so we use the following helper for build the fcoe
246 * driver module alias.
247 */
248#define MODULE_ALIAS_FCOE_PCI(ven, dev) \
249 MODULE_ALIAS("fcoe-pci:" \
250 "v" __stringify(ven) \
251 "d" __stringify(dev) "sv*sd*bc*sc*i*")
252
253/* the name of the default FCoE transport driver fcoe.ko */
254#define FCOE_TRANSPORT_DEFAULT "fcoe"
255
256/* struct fcoe_transport - The FCoE transport interface
257 * @name: a vendor specific name for their FCoE transport driver
258 * @attached: whether this transport is already attached
259 * @list: list linkage to all attached transports
260 * @match: handler to allow the transport driver to match up a given netdev
261 * @create: handler to sysfs entry of create for FCoE instances
262 * @destroy: handler to sysfs entry of destroy for FCoE instances
263 * @enable: handler to sysfs entry of enable for FCoE instances
264 * @disable: handler to sysfs entry of disable for FCoE instances
265 */
266struct fcoe_transport {
267 char name[IFNAMSIZ];
268 bool attached;
269 struct list_head list;
270 bool (*match) (struct net_device *device);
271 int (*create) (struct net_device *device, enum fip_state fip_mode);
272 int (*destroy) (struct net_device *device);
273 int (*enable) (struct net_device *device);
274 int (*disable) (struct net_device *device);
275};
276
277/**
278 * struct fcoe_percpu_s - The context for FCoE receive thread(s)
279 * @thread: The thread context
280 * @fcoe_rx_list: The queue of pending packets to process
281 * @page: The memory page for calculating frame trailer CRCs
282 * @crc_eof_offset: The offset into the CRC page pointing to available
283 * memory for a new trailer
284 */
285struct fcoe_percpu_s {
286 struct task_struct *thread;
287 struct sk_buff_head fcoe_rx_list;
288 struct page *crc_eof_page;
289 int crc_eof_offset;
290};
291
292/**
293 * struct fcoe_port - The FCoE private structure
294 * @priv: The associated fcoe interface. The structure is
295 * defined by the low level driver
296 * @lport: The associated local port
297 * @fcoe_pending_queue: The pending Rx queue of skbs
298 * @fcoe_pending_queue_active: Indicates if the pending queue is active
299 * @max_queue_depth: Max queue depth of pending queue
300 * @min_queue_depth: Min queue depth of pending queue
301 * @timer: The queue timer
302 * @destroy_work: Handle for work context
303 * (to prevent RTNL deadlocks)
304 * @data_srt_addr: Source address for data
305 *
306 * An instance of this structure is to be allocated along with the
307 * Scsi_Host and libfc fc_lport structures.
308 */
309struct fcoe_port {
310 void *priv;
311 struct fc_lport *lport;
312 struct sk_buff_head fcoe_pending_queue;
313 u8 fcoe_pending_queue_active;
314 u32 max_queue_depth;
315 u32 min_queue_depth;
316 struct timer_list timer;
317 struct work_struct destroy_work;
318 u8 data_src_addr[ETH_ALEN];
319};
320void fcoe_clean_pending_queue(struct fc_lport *);
321void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb);
322void fcoe_queue_timer(ulong lport);
323int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen,
324 struct fcoe_percpu_s *fps);
325
326/**
327 * struct netdev_list
328 * A mapping from netdevice to fcoe_transport
329 */
330struct fcoe_netdev_mapping {
331 struct list_head list;
332 struct net_device *netdev;
333 struct fcoe_transport *ft;
334};
335
336/* fcoe transports registration and deregistration */
337int fcoe_transport_attach(struct fcoe_transport *ft);
338int fcoe_transport_detach(struct fcoe_transport *ft);
234 339
235#endif /* _LIBFCOE_H */ 340#endif /* _LIBFCOE_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 748382b32b52..0f4367751b71 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -212,9 +212,6 @@ struct iscsi_conn {
212 /* values userspace uses to id a conn */ 212 /* values userspace uses to id a conn */
213 int persistent_port; 213 int persistent_port;
214 char *persistent_address; 214 char *persistent_address;
215 /* remote portal currently connected to */
216 int portal_port;
217 char portal_address[ISCSI_ADDRESS_BUF_LEN];
218 215
219 /* MIB-statistics */ 216 /* MIB-statistics */
220 uint64_t txdata_octets; 217 uint64_t txdata_octets;
@@ -319,9 +316,6 @@ struct iscsi_host {
319 /* hw address or netdev iscsi connection is bound to */ 316 /* hw address or netdev iscsi connection is bound to */
320 char *hwaddress; 317 char *hwaddress;
321 char *netdev; 318 char *netdev;
322 /* local address */
323 int local_port;
324 char local_address[ISCSI_ADDRESS_BUF_LEN];
325 319
326 wait_queue_head_t session_removal_wq; 320 wait_queue_head_t session_removal_wq;
327 /* protects sessions and state */ 321 /* protects sessions and state */
@@ -394,6 +388,8 @@ extern void iscsi_session_failure(struct iscsi_session *session,
394 enum iscsi_err err); 388 enum iscsi_err err);
395extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn, 389extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
396 enum iscsi_param param, char *buf); 390 enum iscsi_param param, char *buf);
391extern int iscsi_conn_get_addr_param(struct sockaddr_storage *addr,
392 enum iscsi_param param, char *buf);
397extern void iscsi_suspend_tx(struct iscsi_conn *conn); 393extern void iscsi_suspend_tx(struct iscsi_conn *conn);
398extern void iscsi_suspend_queue(struct iscsi_conn *conn); 394extern void iscsi_suspend_queue(struct iscsi_conn *conn);
399extern void iscsi_conn_queue_work(struct iscsi_conn *conn); 395extern void iscsi_conn_queue_work(struct iscsi_conn *conn);
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 741ae7ed4394..e6b9fd2eea34 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -47,6 +47,7 @@ struct iscsi_segment {
47 struct scatterlist *sg; 47 struct scatterlist *sg;
48 void *sg_mapped; 48 void *sg_mapped;
49 unsigned int sg_offset; 49 unsigned int sg_offset;
50 bool atomic_mapped;
50 51
51 iscsi_segment_done_fn_t *done; 52 iscsi_segment_done_fn_t *done;
52}; 53};
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index c583193ae929..9c159f74c6d0 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -39,6 +39,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
39 struct scsi_target *starget); 39 struct scsi_target *starget);
40 40
41void sas_ata_task_abort(struct sas_task *task); 41void sas_ata_task_abort(struct sas_task *task);
42void sas_ata_strategy_handler(struct Scsi_Host *shost);
43int sas_ata_timed_out(struct scsi_cmnd *cmd, struct sas_task *task,
44 enum blk_eh_timer_return *rtn);
45int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
46 struct list_head *done_q);
42 47
43#else 48#else
44 49
@@ -55,6 +60,23 @@ static inline int sas_ata_init_host_and_port(struct domain_device *found_dev,
55static inline void sas_ata_task_abort(struct sas_task *task) 60static inline void sas_ata_task_abort(struct sas_task *task)
56{ 61{
57} 62}
63
64static inline void sas_ata_strategy_handler(struct Scsi_Host *shost)
65{
66}
67
68static inline int sas_ata_timed_out(struct scsi_cmnd *cmd,
69 struct sas_task *task,
70 enum blk_eh_timer_return *rtn)
71{
72 return 0;
73}
74static inline int sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
75 struct list_head *done_q)
76{
77 return 0;
78}
79
58#endif 80#endif
59 81
60#endif /* _SAS_ATA_H_ */ 82#endif /* _SAS_ATA_H_ */
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index b76d4006e36d..3668903e397b 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -435,6 +435,10 @@ static inline int scsi_is_wlun(unsigned int lun)
435 * recover the link. Transport class will 435 * recover the link. Transport class will
436 * retry or fail IO */ 436 * retry or fail IO */
437#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */ 437#define DID_TRANSPORT_FAILFAST 0x0f /* Transport class fastfailed the io */
438#define DID_TARGET_FAILURE 0x10 /* Permanent target failure, do not retry on
439 * other paths */
440#define DID_NEXUS_FAILURE 0x11 /* Permanent nexus failure, retry on other
441 * paths might yield different results */
438#define DRIVER_OK 0x00 /* Driver status */ 442#define DRIVER_OK 0x00 /* Driver status */
439 443
440/* 444/*
@@ -464,6 +468,7 @@ static inline int scsi_is_wlun(unsigned int lun)
464#define TIMEOUT_ERROR 0x2007 468#define TIMEOUT_ERROR 0x2007
465#define SCSI_RETURN_NOT_HANDLED 0x2008 469#define SCSI_RETURN_NOT_HANDLED 0x2008
466#define FAST_IO_FAIL 0x2009 470#define FAST_IO_FAIL 0x2009
471#define TARGET_ERROR 0x200A
467 472
468/* 473/*
469 * Midlevel queue return values. 474 * Midlevel queue return values.
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 85867dcde335..2d3ec5094685 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -184,6 +184,7 @@ typedef void (*activate_complete)(void *, int);
184struct scsi_device_handler { 184struct scsi_device_handler {
185 /* Used by the infrastructure */ 185 /* Used by the infrastructure */
186 struct list_head list; /* list of scsi_device_handlers */ 186 struct list_head list; /* list of scsi_device_handlers */
187 int idx;
187 188
188 /* Filled by the hardware handler */ 189 /* Filled by the hardware handler */
189 struct module *module; 190 struct module *module;
@@ -461,7 +462,7 @@ static inline int scsi_device_qas(struct scsi_device *sdev)
461} 462}
462static inline int scsi_device_enclosure(struct scsi_device *sdev) 463static inline int scsi_device_enclosure(struct scsi_device *sdev)
463{ 464{
464 return sdev->inquiry[6] & (1<<6); 465 return sdev->inquiry ? (sdev->inquiry[6] & (1<<6)) : 1;
465} 466}
466 467
467static inline int scsi_device_protection(struct scsi_device *sdev) 468static inline int scsi_device_protection(struct scsi_device *sdev)
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 7fff94b3b2a8..bf8f52965675 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -101,6 +101,8 @@ struct iscsi_transport {
101 void (*destroy_conn) (struct iscsi_cls_conn *conn); 101 void (*destroy_conn) (struct iscsi_cls_conn *conn);
102 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param, 102 int (*set_param) (struct iscsi_cls_conn *conn, enum iscsi_param param,
103 char *buf, int buflen); 103 char *buf, int buflen);
104 int (*get_ep_param) (struct iscsi_endpoint *ep, enum iscsi_param param,
105 char *buf);
104 int (*get_conn_param) (struct iscsi_cls_conn *conn, 106 int (*get_conn_param) (struct iscsi_cls_conn *conn,
105 enum iscsi_param param, char *buf); 107 enum iscsi_param param, char *buf);
106 int (*get_session_param) (struct iscsi_cls_session *session, 108 int (*get_session_param) (struct iscsi_cls_session *session,
@@ -160,8 +162,9 @@ struct iscsi_cls_conn {
160 void *dd_data; /* LLD private data */ 162 void *dd_data; /* LLD private data */
161 struct iscsi_transport *transport; 163 struct iscsi_transport *transport;
162 uint32_t cid; /* connection id */ 164 uint32_t cid; /* connection id */
165 struct mutex ep_mutex;
166 struct iscsi_endpoint *ep;
163 167
164 int active; /* must be accessed with the connlock */
165 struct device dev; /* sysfs transport/container device */ 168 struct device dev; /* sysfs transport/container device */
166}; 169};
167 170
@@ -222,6 +225,7 @@ struct iscsi_endpoint {
222 void *dd_data; /* LLD private data */ 225 void *dd_data; /* LLD private data */
223 struct device dev; 226 struct device dev;
224 uint64_t id; 227 uint64_t id;
228 struct iscsi_cls_conn *conn;
225}; 229};
226 230
227/* 231/*
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index b602f475cdbb..f1dcefe4532b 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -96,6 +96,10 @@
96#define AC97_FUNC_INFO 0x68 /* Function Information */ 96#define AC97_FUNC_INFO 0x68 /* Function Information */
97#define AC97_SENSE_INFO 0x6a /* Sense Details */ 97#define AC97_SENSE_INFO 0x6a /* Sense Details */
98 98
99/* volume controls */
100#define AC97_MUTE_MASK_MONO 0x8000
101#define AC97_MUTE_MASK_STEREO 0x8080
102
99/* slot allocation */ 103/* slot allocation */
100#define AC97_SLOT_TAG 0 104#define AC97_SLOT_TAG 0
101#define AC97_SLOT_CMD_ADDR 1 105#define AC97_SLOT_CMD_ADDR 1
@@ -138,6 +142,7 @@
138#define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */ 142#define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */
139#define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */ 143#define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */
140#define AC97_BC_ADC_MASK 0x0300 144#define AC97_BC_ADC_MASK 0x0300
145#define AC97_BC_3D_TECH_ID_MASK 0x7c00 /* Per-vendor ID of 3D enhancement */
141 146
142/* general purpose */ 147/* general purpose */
143#define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */ 148#define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */
diff --git a/include/sound/control.h b/include/sound/control.h
index 7715e6f00d38..e67db2869360 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -115,6 +115,8 @@ int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol);
115int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); 115int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol);
116int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id); 116int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id);
117int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id); 117int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id);
118int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id,
119 int active);
118struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid); 120struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid);
119struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id); 121struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id);
120 122
diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h
new file mode 100644
index 000000000000..50a059e7d116
--- /dev/null
+++ b/include/sound/cs4271.h
@@ -0,0 +1,24 @@
1/*
2 * Definitions for CS4271 ASoC codec driver
3 *
4 * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (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
17#ifndef __CS4271_H
18#define __CS4271_H
19
20struct cs4271_platform_data {
21 int gpio_nreset; /* GPIO driving Reset pin, if any */
22};
23
24#endif /* __CS4271_H */
diff --git a/include/sound/hdspm.h b/include/sound/hdspm.h
index 81990b2bcc98..1774ff5ff632 100644
--- a/include/sound/hdspm.h
+++ b/include/sound/hdspm.h
@@ -3,8 +3,8 @@
3/* 3/*
4 * Copyright (C) 2003 Winfried Ritsch (IEM) 4 * Copyright (C) 2003 Winfried Ritsch (IEM)
5 * based on hdsp.h from Thomas Charbonnel (thomas@undata.org) 5 * based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
6 * 6 *
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 as published by 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 10 * the Free Software Foundation; either version 2 of the License, or
@@ -23,50 +23,41 @@
23/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */ 23/* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
24#define HDSPM_MAX_CHANNELS 64 24#define HDSPM_MAX_CHANNELS 64
25 25
26/* -------------------- IOCTL Peak/RMS Meters -------------------- */ 26enum hdspm_io_type {
27 27 MADI,
28/* peam rms level structure like we get from hardware 28 MADIface,
29 29 AIO,
30 maybe in future we can memory map it so I just copy it 30 AES32,
31 to user on ioctl call now an dont change anything 31 RayDAT
32 rms are made out of low and high values 32};
33 where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24)
34 (i asume so from the code)
35*/
36
37struct hdspm_peak_rms {
38
39 unsigned int level_offset[1024];
40 33
41 unsigned int input_peak[64]; 34enum hdspm_speed {
42 unsigned int playback_peak[64]; 35 ss,
43 unsigned int output_peak[64]; 36 ds,
44 unsigned int xxx_peak[64]; /* not used */ 37 qs
38};
45 39
46 unsigned int reserved[256]; /* not used */ 40/* -------------------- IOCTL Peak/RMS Meters -------------------- */
47 41
48 unsigned int input_rms_l[64]; 42struct hdspm_peak_rms {
49 unsigned int playback_rms_l[64]; 43 uint32_t input_peaks[64];
50 unsigned int output_rms_l[64]; 44 uint32_t playback_peaks[64];
51 unsigned int xxx_rms_l[64]; /* not used */ 45 uint32_t output_peaks[64];
52 46
53 unsigned int input_rms_h[64]; 47 uint64_t input_rms[64];
54 unsigned int playback_rms_h[64]; 48 uint64_t playback_rms[64];
55 unsigned int output_rms_h[64]; 49 uint64_t output_rms[64];
56 unsigned int xxx_rms_h[64]; /* not used */
57};
58 50
59struct hdspm_peak_rms_ioctl { 51 uint8_t speed; /* enum {ss, ds, qs} */
60 struct hdspm_peak_rms *peak; 52 int status2;
61}; 53};
62 54
63/* use indirect access due to the limit of ioctl bit size */
64#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \ 55#define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
65 _IOR('H', 0x40, struct hdspm_peak_rms_ioctl) 56 _IOR('H', 0x42, struct hdspm_peak_rms)
66 57
67/* ------------ CONFIG block IOCTL ---------------------- */ 58/* ------------ CONFIG block IOCTL ---------------------- */
68 59
69struct hdspm_config_info { 60struct hdspm_config {
70 unsigned char pref_sync_ref; 61 unsigned char pref_sync_ref;
71 unsigned char wordclock_sync_check; 62 unsigned char wordclock_sync_check;
72 unsigned char madi_sync_check; 63 unsigned char madi_sync_check;
@@ -80,18 +71,121 @@ struct hdspm_config_info {
80 unsigned int analog_out; 71 unsigned int analog_out;
81}; 72};
82 73
83#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \ 74#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
84 _IOR('H', 0x41, struct hdspm_config_info) 75 _IOR('H', 0x41, struct hdspm_config)
76
77/**
78 * If there's a TCO (TimeCode Option) board installed,
79 * there are further options and status data available.
80 * The hdspm_ltc structure contains the current SMPTE
81 * timecode and some status information and can be
82 * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
83 * hdspm_status struct.
84 **/
85
86enum hdspm_ltc_format {
87 format_invalid,
88 fps_24,
89 fps_25,
90 fps_2997,
91 fps_30
92};
93
94enum hdspm_ltc_frame {
95 frame_invalid,
96 drop_frame,
97 full_frame
98};
99
100enum hdspm_ltc_input_format {
101 ntsc,
102 pal,
103 no_video
104};
105
106struct hdspm_ltc {
107 unsigned int ltc;
85 108
109 enum hdspm_ltc_format format;
110 enum hdspm_ltc_frame frame;
111 enum hdspm_ltc_input_format input_format;
112};
113
114#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_mixer_ioctl)
115
116/**
117 * The status data reflects the device's current state
118 * as determined by the card's configuration and
119 * connection status.
120 **/
121
122enum hdspm_sync {
123 hdspm_sync_no_lock = 0,
124 hdspm_sync_lock = 1,
125 hdspm_sync_sync = 2
126};
86 127
87/* get Soundcard Version */ 128enum hdspm_madi_input {
129 hdspm_input_optical = 0,
130 hdspm_input_coax = 1
131};
132
133enum hdspm_madi_channel_format {
134 hdspm_format_ch_64 = 0,
135 hdspm_format_ch_56 = 1
136};
137
138enum hdspm_madi_frame_format {
139 hdspm_frame_48 = 0,
140 hdspm_frame_96 = 1
141};
142
143enum hdspm_syncsource {
144 syncsource_wc = 0,
145 syncsource_madi = 1,
146 syncsource_tco = 2,
147 syncsource_sync = 3,
148 syncsource_none = 4
149};
150
151struct hdspm_status {
152 uint8_t card_type; /* enum hdspm_io_type */
153 enum hdspm_syncsource autosync_source;
154
155 uint64_t card_clock;
156 uint32_t master_period;
157
158 union {
159 struct {
160 uint8_t sync_wc; /* enum hdspm_sync */
161 uint8_t sync_madi; /* enum hdspm_sync */
162 uint8_t sync_tco; /* enum hdspm_sync */
163 uint8_t sync_in; /* enum hdspm_sync */
164 uint8_t madi_input; /* enum hdspm_madi_input */
165 uint8_t channel_format; /* enum hdspm_madi_channel_format */
166 uint8_t frame_format; /* enum hdspm_madi_frame_format */
167 } madi;
168 } card_specific;
169};
170
171#define SNDRV_HDSPM_IOCTL_GET_STATUS \
172 _IOR('H', 0x47, struct hdspm_status)
173
174/**
175 * Get information about the card and its add-ons.
176 **/
177
178#define HDSPM_ADDON_TCO 1
88 179
89struct hdspm_version { 180struct hdspm_version {
181 uint8_t card_type; /* enum hdspm_io_type */
182 char cardname[20];
183 unsigned int serial;
90 unsigned short firmware_rev; 184 unsigned short firmware_rev;
185 int addons;
91}; 186};
92 187
93#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version) 188#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
94
95 189
96/* ------------- get Matrix Mixer IOCTL --------------- */ 190/* ------------- get Matrix Mixer IOCTL --------------- */
97 191
@@ -103,7 +197,7 @@ struct hdspm_version {
103/* equivalent to hardware definition, maybe for future feature of mmap of 197/* equivalent to hardware definition, maybe for future feature of mmap of
104 * them 198 * them
105 */ 199 */
106/* each of 64 outputs has 64 infader and 64 outfader: 200/* each of 64 outputs has 64 infader and 64 outfader:
107 Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */ 201 Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
108 202
109#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS 203#define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
@@ -131,4 +225,5 @@ typedef struct hdspm_version hdspm_version_t;
131typedef struct hdspm_channelfader snd_hdspm_channelfader_t; 225typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
132typedef struct hdspm_mixer hdspm_mixer_t; 226typedef struct hdspm_mixer hdspm_mixer_t;
133 227
134#endif /* __SOUND_HDSPM_H */ 228
229#endif
diff --git a/include/sound/mixer_oss.h b/include/sound/mixer_oss.h
index 51fbcb4a277a..13cb0b430a1b 100644
--- a/include/sound/mixer_oss.h
+++ b/include/sound/mixer_oss.h
@@ -73,6 +73,9 @@ struct snd_mixer_oss_file {
73 struct snd_mixer_oss *mixer; 73 struct snd_mixer_oss *mixer;
74}; 74};
75 75
76int snd_mixer_oss_ioctl_card(struct snd_card *card,
77 unsigned int cmd, unsigned long arg);
78
76#endif /* CONFIG_SND_MIXER_OSS */ 79#endif /* CONFIG_SND_MIXER_OSS */
77 80
78#endif /* __SOUND_MIXER_OSS_H */ 81#endif /* __SOUND_MIXER_OSS_H */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index e731f8d71934..430a9cc045e2 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -136,48 +136,49 @@ struct snd_pcm_ops {
136 SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000) 136 SNDRV_PCM_RATE_88200|SNDRV_PCM_RATE_96000)
137#define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ 137#define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\
138 SNDRV_PCM_RATE_192000) 138 SNDRV_PCM_RATE_192000)
139#define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8) 139#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
140#define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8) 140#define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
141#define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE) 141#define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
142#define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE) 142#define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE)
143#define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE) 143#define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE)
144#define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE) 144#define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE)
145#define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE) 145#define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE)
146#define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE) 146#define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE)
147#define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE) 147#define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE)
148#define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE) 148#define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE)
149#define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE) 149#define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE)
150#define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE) 150#define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE)
151#define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE) 151#define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE)
152#define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE) 152#define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE)
153#define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE) 153#define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE)
154#define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE) 154#define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE)
155#define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE) 155#define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE)
156#define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE) 156#define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE)
157#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) 157#define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE)
158#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) 158#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE)
159#define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW) 159#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE)
160#define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW) 160#define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW)
161#define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM) 161#define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW)
162#define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG) 162#define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM)
163#define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM) 163#define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG)
164#define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL) 164#define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM)
165#define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE) 165#define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL)
166#define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE) 166#define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE)
167#define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE) 167#define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE)
168#define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE) 168#define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE)
169#define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE) 169#define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE)
170#define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE) 170#define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE)
171#define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE) 171#define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE)
172#define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE) 172#define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE)
173#define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE) 173#define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE)
174#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 174#define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE)
175#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 175#define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE)
176#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 176#define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE)
177#define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) 177#define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE)
178#define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) 178#define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24)
179#define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) 179#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
180#define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) 180#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
181#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
181 182
182#ifdef SNDRV_LITTLE_ENDIAN 183#ifdef SNDRV_LITTLE_ENDIAN
183#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 184#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -490,7 +491,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
490int snd_pcm_status(struct snd_pcm_substream *substream, 491int snd_pcm_status(struct snd_pcm_substream *substream,
491 struct snd_pcm_status *status); 492 struct snd_pcm_status *status);
492int snd_pcm_start(struct snd_pcm_substream *substream); 493int snd_pcm_start(struct snd_pcm_substream *substream);
493int snd_pcm_stop(struct snd_pcm_substream *substream, int status); 494int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status);
494int snd_pcm_drain_done(struct snd_pcm_substream *substream); 495int snd_pcm_drain_done(struct snd_pcm_substream *substream);
495#ifdef CONFIG_PM 496#ifdef CONFIG_PM
496int snd_pcm_suspend(struct snd_pcm_substream *substream); 497int snd_pcm_suspend(struct snd_pcm_substream *substream);
@@ -748,8 +749,8 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
748 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL]; 749 return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
749} 750}
750 751
751#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 752#define params_access(p) ((__force snd_pcm_access_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)))
752#define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) 753#define params_format(p) ((__force snd_pcm_format_t)snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)))
753#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) 754#define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT))
754#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min 755#define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min
755#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min 756#define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index d79894192ae3..9a155f9d0a12 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -15,67 +15,29 @@
15#define FSI_PORT_A 0 15#define FSI_PORT_A 0
16#define FSI_PORT_B 1 16#define FSI_PORT_B 1
17 17
18/* flags format
19
20 * 0xABCDEEFF
21 *
22 * A: channel size for TDM (input)
23 * B: channel size for TDM (ooutput)
24 * C: inversion
25 * D: mode
26 * E: input format
27 * F: output format
28 */
29
30#include <linux/clk.h> 18#include <linux/clk.h>
31#include <sound/soc.h> 19#include <sound/soc.h>
32 20
33/* TDM channel */ 21/*
34#define SH_FSI_SET_CH_I(x) ((x & 0xF) << 28) 22 * flags format
35#define SH_FSI_SET_CH_O(x) ((x & 0xF) << 24) 23 *
36 24 * 0x000000BA
37#define SH_FSI_CH_IMASK 0xF0000000 25 *
38#define SH_FSI_CH_OMASK 0x0F000000 26 * A: inversion
39#define SH_FSI_GET_CH_I(x) ((x & SH_FSI_CH_IMASK) >> 28) 27 * B: format mode
40#define SH_FSI_GET_CH_O(x) ((x & SH_FSI_CH_OMASK) >> 24) 28 */
41
42/* clock inversion */
43#define SH_FSI_INVERSION_MASK 0x00F00000
44#define SH_FSI_LRM_INV (1 << 20)
45#define SH_FSI_BRM_INV (1 << 21)
46#define SH_FSI_LRS_INV (1 << 22)
47#define SH_FSI_BRS_INV (1 << 23)
48
49/* mode */
50#define SH_FSI_MODE_MASK 0x000F0000
51#define SH_FSI_IN_SLAVE_MODE (1 << 16) /* default master mode */
52#define SH_FSI_OUT_SLAVE_MODE (1 << 17) /* default master mode */
53
54/* DI format */
55#define SH_FSI_FMT_MASK 0x000000FF
56#define SH_FSI_IFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 8)
57#define SH_FSI_OFMT(x) (((SH_FSI_FMT_ ## x) & SH_FSI_FMT_MASK) << 0)
58#define SH_FSI_GET_IFMT(x) ((x >> 8) & SH_FSI_FMT_MASK)
59#define SH_FSI_GET_OFMT(x) ((x >> 0) & SH_FSI_FMT_MASK)
60
61#define SH_FSI_FMT_MONO 0
62#define SH_FSI_FMT_MONO_DELAY 1
63#define SH_FSI_FMT_PCM 2
64#define SH_FSI_FMT_I2S 3
65#define SH_FSI_FMT_TDM 4
66#define SH_FSI_FMT_TDM_DELAY 5
67#define SH_FSI_FMT_SPDIF 6
68
69
70#define SH_FSI_IFMT_TDM_CH(x) \
71 (SH_FSI_IFMT(TDM) | SH_FSI_SET_CH_I(x))
72#define SH_FSI_IFMT_TDM_DELAY_CH(x) \
73 (SH_FSI_IFMT(TDM_DELAY) | SH_FSI_SET_CH_I(x))
74 29
75#define SH_FSI_OFMT_TDM_CH(x) \ 30/* A: clock inversion */
76 (SH_FSI_OFMT(TDM) | SH_FSI_SET_CH_O(x)) 31#define SH_FSI_INVERSION_MASK 0x0000000F
77#define SH_FSI_OFMT_TDM_DELAY_CH(x) \ 32#define SH_FSI_LRM_INV (1 << 0)
78 (SH_FSI_OFMT(TDM_DELAY) | SH_FSI_SET_CH_O(x)) 33#define SH_FSI_BRM_INV (1 << 1)
34#define SH_FSI_LRS_INV (1 << 2)
35#define SH_FSI_BRS_INV (1 << 3)
36
37/* B: format mode */
38#define SH_FSI_FMT_MASK 0x000000F0
39#define SH_FSI_FMT_DAI (0 << 4)
40#define SH_FSI_FMT_SPDIF (1 << 4)
79 41
80 42
81/* 43/*
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8031769ac485..979ed84e07d6 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -157,6 +157,18 @@
157 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 157 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
158 .event = wevent, .event_flags = wflags} 158 .event = wevent, .event_flags = wflags}
159 159
160/* additional sequencing control within an event type */
161#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
162 wevent, wflags) \
163{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
164 .invert = winvert, .event = wevent, .event_flags = wflags, \
165 .subseq = wsubseq}
166#define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \
167 wflags) \
168{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
169 .shift = wshift, .invert = winvert, .event = wevent, \
170 .event_flags = wflags, .subseq = wsubseq}
171
160/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 172/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
161#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 173#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
162 wevent, wflags) \ 174 wevent, wflags) \
@@ -450,6 +462,7 @@ struct snd_soc_dapm_widget {
450 unsigned char ext:1; /* has external widgets */ 462 unsigned char ext:1; /* has external widgets */
451 unsigned char force:1; /* force state */ 463 unsigned char force:1; /* force state */
452 unsigned char ignore_suspend:1; /* kept enabled over suspend */ 464 unsigned char ignore_suspend:1; /* kept enabled over suspend */
465 int subseq; /* sort within widget type */
453 466
454 int (*power_check)(struct snd_soc_dapm_widget *w); 467 int (*power_check)(struct snd_soc_dapm_widget *w);
455 468
@@ -487,6 +500,9 @@ struct snd_soc_dapm_context {
487 500
488 struct snd_soc_dapm_update *update; 501 struct snd_soc_dapm_update *update;
489 502
503 void (*seq_notifier)(struct snd_soc_dapm_context *,
504 enum snd_soc_dapm_type, int);
505
490 struct device *dev; /* from parent - for debug */ 506 struct device *dev; /* from parent - for debug */
491 struct snd_soc_codec *codec; /* parent codec */ 507 struct snd_soc_codec *codec; /* parent codec */
492 struct snd_soc_card *card; /* parent card */ 508 struct snd_soc_card *card; /* parent card */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 74921f20a1d8..bfa4836ea107 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -234,6 +234,7 @@ struct snd_soc_codec;
234struct snd_soc_codec_driver; 234struct snd_soc_codec_driver;
235struct soc_enum; 235struct soc_enum;
236struct snd_soc_jack; 236struct snd_soc_jack;
237struct snd_soc_jack_zone;
237struct snd_soc_jack_pin; 238struct snd_soc_jack_pin;
238struct snd_soc_cache_ops; 239struct snd_soc_cache_ops;
239#include <sound/soc-dapm.h> 240#include <sound/soc-dapm.h>
@@ -258,6 +259,16 @@ enum snd_soc_compress_type {
258 SND_SOC_RBTREE_COMPRESSION 259 SND_SOC_RBTREE_COMPRESSION
259}; 260};
260 261
262int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id,
263 unsigned int freq, int dir);
264int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
265 unsigned int freq_in, unsigned int freq_out);
266
267int snd_soc_register_card(struct snd_soc_card *card);
268int snd_soc_unregister_card(struct snd_soc_card *card);
269int snd_soc_suspend(struct device *dev);
270int snd_soc_resume(struct device *dev);
271int snd_soc_poweroff(struct device *dev);
261int snd_soc_register_platform(struct device *dev, 272int snd_soc_register_platform(struct device *dev,
262 struct snd_soc_platform_driver *platform_drv); 273 struct snd_soc_platform_driver *platform_drv);
263void snd_soc_unregister_platform(struct device *dev); 274void snd_soc_unregister_platform(struct device *dev);
@@ -265,7 +276,8 @@ int snd_soc_register_codec(struct device *dev,
265 const struct snd_soc_codec_driver *codec_drv, 276 const struct snd_soc_codec_driver *codec_drv,
266 struct snd_soc_dai_driver *dai_drv, int num_dai); 277 struct snd_soc_dai_driver *dai_drv, int num_dai);
267void snd_soc_unregister_codec(struct device *dev); 278void snd_soc_unregister_codec(struct device *dev);
268int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 279int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
280 unsigned int reg);
269int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 281int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
270 int addr_bits, int data_bits, 282 int addr_bits, int data_bits,
271 enum snd_soc_control_type control); 283 enum snd_soc_control_type control);
@@ -276,6 +288,10 @@ int snd_soc_cache_write(struct snd_soc_codec *codec,
276 unsigned int reg, unsigned int value); 288 unsigned int reg, unsigned int value);
277int snd_soc_cache_read(struct snd_soc_codec *codec, 289int snd_soc_cache_read(struct snd_soc_codec *codec,
278 unsigned int reg, unsigned int *value); 290 unsigned int reg, unsigned int *value);
291int snd_soc_default_volatile_register(struct snd_soc_codec *codec,
292 unsigned int reg);
293int snd_soc_default_readable_register(struct snd_soc_codec *codec,
294 unsigned int reg);
279 295
280/* Utility functions to get clock rates from various things */ 296/* Utility functions to get clock rates from various things */
281int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 297int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
@@ -297,6 +313,9 @@ void snd_soc_jack_notifier_register(struct snd_soc_jack *jack,
297 struct notifier_block *nb); 313 struct notifier_block *nb);
298void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, 314void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack,
299 struct notifier_block *nb); 315 struct notifier_block *nb);
316int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count,
317 struct snd_soc_jack_zone *zones);
318int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage);
300#ifdef CONFIG_GPIOLIB 319#ifdef CONFIG_GPIOLIB
301int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 320int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
302 struct snd_soc_jack_gpio *gpios); 321 struct snd_soc_jack_gpio *gpios);
@@ -321,7 +340,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
321 *Controls 340 *Controls
322 */ 341 */
323struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 342struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
324 void *data, char *long_name); 343 void *data, char *long_name,
344 const char *prefix);
325int snd_soc_add_controls(struct snd_soc_codec *codec, 345int snd_soc_add_controls(struct snd_soc_codec *codec,
326 const struct snd_kcontrol_new *controls, int num_controls); 346 const struct snd_kcontrol_new *controls, int num_controls);
327int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 347int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
@@ -367,6 +387,22 @@ int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
367 struct snd_ctl_elem_value *ucontrol); 387 struct snd_ctl_elem_value *ucontrol);
368 388
369/** 389/**
390 * struct snd_soc_reg_access - Describes whether a given register is
391 * readable, writable or volatile.
392 *
393 * @reg: the register number
394 * @read: whether this register is readable
395 * @write: whether this register is writable
396 * @vol: whether this register is volatile
397 */
398struct snd_soc_reg_access {
399 u16 reg;
400 u16 read;
401 u16 write;
402 u16 vol;
403};
404
405/**
370 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection 406 * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
371 * 407 *
372 * @pin: name of the pin to update 408 * @pin: name of the pin to update
@@ -381,6 +417,24 @@ struct snd_soc_jack_pin {
381}; 417};
382 418
383/** 419/**
420 * struct snd_soc_jack_zone - Describes voltage zones of jack detection
421 *
422 * @min_mv: start voltage in mv
423 * @max_mv: end voltage in mv
424 * @jack_type: type of jack that is expected for this voltage
425 * @debounce_time: debounce_time for jack, codec driver should wait for this
426 * duration before reading the adc for voltages
427 * @:list: list container
428 */
429struct snd_soc_jack_zone {
430 unsigned int min_mv;
431 unsigned int max_mv;
432 unsigned int jack_type;
433 unsigned int debounce_time;
434 struct list_head list;
435};
436
437/**
384 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection 438 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
385 * 439 *
386 * @gpio: gpio number 440 * @gpio: gpio number
@@ -388,6 +442,10 @@ struct snd_soc_jack_pin {
388 * @report: value to report when jack detected 442 * @report: value to report when jack detected
389 * @invert: report presence in low state 443 * @invert: report presence in low state
390 * @debouce_time: debouce time in ms 444 * @debouce_time: debouce time in ms
445 * @wake: enable as wake source
446 * @jack_status_check: callback function which overrides the detection
447 * to provide more complex checks (eg, reading an
448 * ADC).
391 */ 449 */
392#ifdef CONFIG_GPIOLIB 450#ifdef CONFIG_GPIOLIB
393struct snd_soc_jack_gpio { 451struct snd_soc_jack_gpio {
@@ -396,6 +454,8 @@ struct snd_soc_jack_gpio {
396 int report; 454 int report;
397 int invert; 455 int invert;
398 int debounce_time; 456 int debounce_time;
457 bool wake;
458
399 struct snd_soc_jack *jack; 459 struct snd_soc_jack *jack;
400 struct delayed_work work; 460 struct delayed_work work;
401 461
@@ -409,6 +469,7 @@ struct snd_soc_jack {
409 struct list_head pins; 469 struct list_head pins;
410 int status; 470 int status;
411 struct blocking_notifier_head notifier; 471 struct blocking_notifier_head notifier;
472 struct list_head jack_zones;
412}; 473};
413 474
414/* SoC PCM stream information */ 475/* SoC PCM stream information */
@@ -459,18 +520,22 @@ struct snd_soc_codec {
459 struct list_head card_list; 520 struct list_head card_list;
460 int num_dai; 521 int num_dai;
461 enum snd_soc_compress_type compress_type; 522 enum snd_soc_compress_type compress_type;
523 size_t reg_size; /* reg_cache_size * reg_word_size */
524 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
525 int (*readable_register)(struct snd_soc_codec *, unsigned int);
462 526
463 /* runtime */ 527 /* runtime */
464 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 528 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
465 unsigned int active; 529 unsigned int active;
466 unsigned int cache_only:1; /* Suppress writes to hardware */ 530 unsigned int cache_bypass:1; /* Suppress access to the cache */
467 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
468 unsigned int suspended:1; /* Codec is in suspend PM state */ 531 unsigned int suspended:1; /* Codec is in suspend PM state */
469 unsigned int probed:1; /* Codec has been probed */ 532 unsigned int probed:1; /* Codec has been probed */
470 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 533 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
471 unsigned int ac97_created:1; /* Codec has been created by SoC */ 534 unsigned int ac97_created:1; /* Codec has been created by SoC */
472 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 535 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
473 unsigned int cache_init:1; /* codec cache has been initialized */ 536 unsigned int cache_init:1; /* codec cache has been initialized */
537 u32 cache_only; /* Suppress writes to hardware */
538 u32 cache_sync; /* Cache needs to be synced to hardware */
474 539
475 /* codec IO */ 540 /* codec IO */
476 void *control_data; /* codec control (i2c/3wire) data */ 541 void *control_data; /* codec control (i2c/3wire) data */
@@ -503,22 +568,39 @@ struct snd_soc_codec_driver {
503 pm_message_t state); 568 pm_message_t state);
504 int (*resume)(struct snd_soc_codec *); 569 int (*resume)(struct snd_soc_codec *);
505 570
571 /* Default DAPM setup, added after probe() is run */
572 const struct snd_soc_dapm_widget *dapm_widgets;
573 int num_dapm_widgets;
574 const struct snd_soc_dapm_route *dapm_routes;
575 int num_dapm_routes;
576
577 /* codec wide operations */
578 int (*set_sysclk)(struct snd_soc_codec *codec,
579 int clk_id, unsigned int freq, int dir);
580 int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source,
581 unsigned int freq_in, unsigned int freq_out);
582
506 /* codec IO */ 583 /* codec IO */
507 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 584 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
508 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 585 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
509 int (*display_register)(struct snd_soc_codec *, char *, 586 int (*display_register)(struct snd_soc_codec *, char *,
510 size_t, unsigned int); 587 size_t, unsigned int);
511 int (*volatile_register)(unsigned int); 588 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
512 int (*readable_register)(unsigned int); 589 int (*readable_register)(struct snd_soc_codec *, unsigned int);
513 short reg_cache_size; 590 short reg_cache_size;
514 short reg_cache_step; 591 short reg_cache_step;
515 short reg_word_size; 592 short reg_word_size;
516 const void *reg_cache_default; 593 const void *reg_cache_default;
594 short reg_access_size;
595 const struct snd_soc_reg_access *reg_access_default;
517 enum snd_soc_compress_type compress_type; 596 enum snd_soc_compress_type compress_type;
518 597
519 /* codec bias level */ 598 /* codec bias level */
520 int (*set_bias_level)(struct snd_soc_codec *, 599 int (*set_bias_level)(struct snd_soc_codec *,
521 enum snd_soc_bias_level level); 600 enum snd_soc_bias_level level);
601
602 void (*seq_notifier)(struct snd_soc_dapm_context *,
603 enum snd_soc_dapm_type, int);
522}; 604};
523 605
524/* SoC platform interface */ 606/* SoC platform interface */
@@ -617,15 +699,16 @@ struct snd_soc_card {
617 699
618 bool instantiated; 700 bool instantiated;
619 701
620 int (*probe)(struct platform_device *pdev); 702 int (*probe)(struct snd_soc_card *card);
621 int (*remove)(struct platform_device *pdev); 703 int (*late_probe)(struct snd_soc_card *card);
704 int (*remove)(struct snd_soc_card *card);
622 705
623 /* the pre and post PM functions are used to do any PM work before and 706 /* the pre and post PM functions are used to do any PM work before and
624 * after the codec and DAI's do any PM work. */ 707 * after the codec and DAI's do any PM work. */
625 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); 708 int (*suspend_pre)(struct snd_soc_card *card);
626 int (*suspend_post)(struct platform_device *pdev, pm_message_t state); 709 int (*suspend_post)(struct snd_soc_card *card);
627 int (*resume_pre)(struct platform_device *pdev); 710 int (*resume_pre)(struct snd_soc_card *card);
628 int (*resume_post)(struct platform_device *pdev); 711 int (*resume_post)(struct snd_soc_card *card);
629 712
630 /* callbacks */ 713 /* callbacks */
631 int (*set_bias_level)(struct snd_soc_card *, 714 int (*set_bias_level)(struct snd_soc_card *,
@@ -654,6 +737,14 @@ struct snd_soc_card {
654 struct snd_soc_pcm_runtime *rtd_aux; 737 struct snd_soc_pcm_runtime *rtd_aux;
655 int num_aux_rtd; 738 int num_aux_rtd;
656 739
740 /*
741 * Card-specific routes and widgets.
742 */
743 struct snd_soc_dapm_widget *dapm_widgets;
744 int num_dapm_widgets;
745 struct snd_soc_dapm_route *dapm_routes;
746 int num_dapm_routes;
747
657 struct work_struct deferred_resume_work; 748 struct work_struct deferred_resume_work;
658 749
659 /* lists of probed devices belonging to this card */ 750 /* lists of probed devices belonging to this card */
@@ -665,11 +756,16 @@ struct snd_soc_card {
665 struct list_head paths; 756 struct list_head paths;
666 struct list_head dapm_list; 757 struct list_head dapm_list;
667 758
759 /* Generic DAPM context for the card */
760 struct snd_soc_dapm_context dapm;
761
668#ifdef CONFIG_DEBUG_FS 762#ifdef CONFIG_DEBUG_FS
669 struct dentry *debugfs_card_root; 763 struct dentry *debugfs_card_root;
670 struct dentry *debugfs_pop_time; 764 struct dentry *debugfs_pop_time;
671#endif 765#endif
672 u32 pop_time; 766 u32 pop_time;
767
768 void *drvdata;
673}; 769};
674 770
675/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 771/* SoC machine DAI configuration, glues a codec and cpu DAI together */
@@ -721,6 +817,17 @@ unsigned int snd_soc_write(struct snd_soc_codec *codec,
721 817
722/* device driver data */ 818/* device driver data */
723 819
820static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
821 void *data)
822{
823 card->drvdata = data;
824}
825
826static inline void *snd_soc_card_get_drvdata(struct snd_soc_card *card)
827{
828 return card->drvdata;
829}
830
724static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, 831static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
725 void *data) 832 void *data)
726{ 833{
@@ -754,6 +861,22 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
754 return dev_get_drvdata(&rtd->dev); 861 return dev_get_drvdata(&rtd->dev);
755} 862}
756 863
864static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
865{
866 INIT_LIST_HEAD(&card->dai_dev_list);
867 INIT_LIST_HEAD(&card->codec_dev_list);
868 INIT_LIST_HEAD(&card->platform_dev_list);
869 INIT_LIST_HEAD(&card->widgets);
870 INIT_LIST_HEAD(&card->paths);
871 INIT_LIST_HEAD(&card->dapm_list);
872}
873
757#include <sound/soc-dai.h> 874#include <sound/soc-dai.h>
758 875
876#ifdef CONFIG_DEBUG_FS
877extern struct dentry *snd_soc_debugfs_root;
878#endif
879
880extern const struct dev_pm_ops snd_soc_pm_ops;
881
759#endif 882#endif
diff --git a/include/sound/tlv320aic32x4.h b/include/sound/tlv320aic32x4.h
new file mode 100644
index 000000000000..c009f70b4029
--- /dev/null
+++ b/include/sound/tlv320aic32x4.h
@@ -0,0 +1,31 @@
1/*
2 * tlv320aic32x4.h -- TLV320AIC32X4 Soc Audio driver platform data
3 *
4 * Copyright 2011 Vista Silicon S.L.
5 *
6 * Author: Javier Martin <javier.martin@vista-silicon.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 _AIC32X4_PDATA_H
14#define _AIC32X4_PDATA_H
15
16#define AIC32X4_PWR_MICBIAS_2075_LDOIN 0x00000001
17#define AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE 0x00000002
18#define AIC32X4_PWR_AIC32X4_LDO_ENABLE 0x00000004
19#define AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 0x00000008
20#define AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED 0x00000010
21
22#define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001
23#define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002
24
25struct aic32x4_pdata {
26 u32 power_cfg;
27 u32 micpga_routing;
28 bool swapdacs;
29};
30
31#endif
diff --git a/include/sound/version.h b/include/sound/version.h
index bf69a5b7e65f..8fc5321e1ecc 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h */ 1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.23" 2#define CONFIG_SND_VERSION "1.0.24"
3#define CONFIG_SND_DATE "" 3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h
index 1eeebd534f7e..cf7ccb76a8de 100644
--- a/include/sound/wm8903.h
+++ b/include/sound/wm8903.h
@@ -33,6 +33,21 @@
33#define WM8903_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */ 33#define WM8903_MICBIAS_ENA_WIDTH 1 /* MICBIAS_ENA */
34 34
35/* 35/*
36 * WM8903_GPn_FN values
37 *
38 * See datasheets for list of valid values per pin
39 */
40#define WM8903_GPn_FN_GPIO_OUTPUT 0
41#define WM8903_GPn_FN_BCLK 1
42#define WM8903_GPn_FN_IRQ_OUTPT 2
43#define WM8903_GPn_FN_GPIO_INPUT 3
44#define WM8903_GPn_FN_MICBIAS_CURRENT_DETECT 4
45#define WM8903_GPn_FN_MICBIAS_SHORT_DETECT 5
46#define WM8903_GPn_FN_DMIC_LR_CLK_OUTPUT 6
47#define WM8903_GPn_FN_FLL_LOCK_OUTPUT 8
48#define WM8903_GPn_FN_FLL_CLOCK_OUTPUT 9
49
50/*
36 * R116 (0x74) - GPIO Control 1 51 * R116 (0x74) - GPIO Control 1
37 */ 52 */
38#define WM8903_GP1_FN_MASK 0x1F00 /* GP1_FN - [12:8] */ 53#define WM8903_GP1_FN_MASK 0x1F00 /* GP1_FN - [12:8] */
@@ -227,6 +242,8 @@
227#define WM8903_GP5_DB_SHIFT 0 /* GP5_DB */ 242#define WM8903_GP5_DB_SHIFT 0 /* GP5_DB */
228#define WM8903_GP5_DB_WIDTH 1 /* GP5_DB */ 243#define WM8903_GP5_DB_WIDTH 1 /* GP5_DB */
229 244
245#define WM8903_NUM_GPIO 5
246
230struct wm8903_platform_data { 247struct wm8903_platform_data {
231 bool irq_active_low; /* Set if IRQ active low, default high */ 248 bool irq_active_low; /* Set if IRQ active low, default high */
232 249
@@ -239,7 +256,8 @@ struct wm8903_platform_data {
239 256
240 int micdet_delay; /* Delay after microphone detection (ms) */ 257 int micdet_delay; /* Delay after microphone detection (ms) */
241 258
242 u32 gpio_cfg[5]; /* Default register values for GPIO pin mux */ 259 int gpio_base;
260 u32 gpio_cfg[WM8903_NUM_GPIO]; /* Default register values for GPIO pin mux */
243}; 261};
244 262
245#endif 263#endif
diff --git a/include/sound/wm9081.h b/include/sound/wm9081.h
index e173ddbf6bd4..f34b0b1716d8 100644
--- a/include/sound/wm9081.h
+++ b/include/sound/wm9081.h
@@ -17,9 +17,12 @@ struct wm9081_retune_mobile_setting {
17 u16 config[20]; 17 u16 config[20];
18}; 18};
19 19
20struct wm9081_retune_mobile_config { 20struct wm9081_pdata {
21 struct wm9081_retune_mobile_setting *configs; 21 bool irq_high; /* IRQ is active high */
22 int num_configs; 22 bool irq_cmos; /* IRQ is in CMOS mode */
23
24 struct wm9081_retune_mobile_setting *retune_configs;
25 int num_retune_configs;
23}; 26};
24 27
25#endif 28#endif
diff --git a/include/staging/altera.h b/include/staging/altera.h
new file mode 100644
index 000000000000..94c0c6181daf
--- /dev/null
+++ b/include/staging/altera.h
@@ -0,0 +1,49 @@
1/*
2 * altera.h
3 *
4 * altera FPGA driver
5 *
6 * Copyright (C) Altera Corporation 1998-2001
7 * Copyright (C) 2010 NetUP Inc.
8 * Copyright (C) 2010 Igor M. Liplianin <liplianin@netup.ru>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 *
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#ifndef _ALTERA_H_
27#define _ALTERA_H_
28
29struct altera_config {
30 void *dev;
31 u8 *action;
32 int (*jtag_io) (void *dev, int tms, int tdi, int tdo);
33};
34
35#if defined(CONFIG_ALTERA_STAPL) || \
36 (defined(CONFIG_ALTERA_STAPL_MODULE) && defined(MODULE))
37
38extern int altera_init(struct altera_config *config, const struct firmware *fw);
39#else
40
41static inline int altera_init(struct altera_config *config,
42 const struct firmware *fw)
43{
44 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
45 return 0;
46}
47#endif /* CONFIG_ALTERA_STAPL */
48
49#endif /* _ALTERA_H_ */
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 0828b6c8610a..c15ed5026fb5 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -9,7 +9,7 @@
9#include <net/sock.h> 9#include <net/sock.h>
10#include <net/tcp.h> 10#include <net/tcp.h>
11 11
12#define TARGET_CORE_MOD_VERSION "v4.0.0-rc6" 12#define TARGET_CORE_MOD_VERSION "v4.0.0-rc7-ml"
13#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) 13#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
14 14
15/* Used by transport_generic_allocate_iovecs() */ 15/* Used by transport_generic_allocate_iovecs() */
@@ -239,7 +239,7 @@ struct t10_alua_lu_gp {
239} ____cacheline_aligned; 239} ____cacheline_aligned;
240 240
241struct t10_alua_lu_gp_member { 241struct t10_alua_lu_gp_member {
242 int lu_gp_assoc:1; 242 bool lu_gp_assoc;
243 atomic_t lu_gp_mem_ref_cnt; 243 atomic_t lu_gp_mem_ref_cnt;
244 spinlock_t lu_gp_mem_lock; 244 spinlock_t lu_gp_mem_lock;
245 struct t10_alua_lu_gp *lu_gp; 245 struct t10_alua_lu_gp *lu_gp;
@@ -271,7 +271,7 @@ struct t10_alua_tg_pt_gp {
271} ____cacheline_aligned; 271} ____cacheline_aligned;
272 272
273struct t10_alua_tg_pt_gp_member { 273struct t10_alua_tg_pt_gp_member {
274 int tg_pt_gp_assoc:1; 274 bool tg_pt_gp_assoc;
275 atomic_t tg_pt_gp_mem_ref_cnt; 275 atomic_t tg_pt_gp_mem_ref_cnt;
276 spinlock_t tg_pt_gp_mem_lock; 276 spinlock_t tg_pt_gp_mem_lock;
277 struct t10_alua_tg_pt_gp *tg_pt_gp; 277 struct t10_alua_tg_pt_gp *tg_pt_gp;
@@ -336,7 +336,7 @@ struct t10_pr_registration {
336 int pr_res_type; 336 int pr_res_type;
337 int pr_res_scope; 337 int pr_res_scope;
338 /* Used for fabric initiator WWPNs using a ISID */ 338 /* Used for fabric initiator WWPNs using a ISID */
339 int isid_present_at_reg:1; 339 bool isid_present_at_reg;
340 u32 pr_res_mapped_lun; 340 u32 pr_res_mapped_lun;
341 u32 pr_aptpl_target_lun; 341 u32 pr_aptpl_target_lun;
342 u32 pr_res_generation; 342 u32 pr_res_generation;
@@ -418,7 +418,7 @@ struct se_transport_task {
418 unsigned long long t_task_lba; 418 unsigned long long t_task_lba;
419 int t_tasks_failed; 419 int t_tasks_failed;
420 int t_tasks_fua; 420 int t_tasks_fua;
421 int t_tasks_bidi:1; 421 bool t_tasks_bidi;
422 u32 t_task_cdbs; 422 u32 t_task_cdbs;
423 u32 t_tasks_check; 423 u32 t_tasks_check;
424 u32 t_tasks_no; 424 u32 t_tasks_no;
@@ -470,7 +470,7 @@ struct se_task {
470 u8 task_flags; 470 u8 task_flags;
471 int task_error_status; 471 int task_error_status;
472 int task_state_flags; 472 int task_state_flags;
473 int task_padded_sg:1; 473 bool task_padded_sg;
474 unsigned long long task_lba; 474 unsigned long long task_lba;
475 u32 task_no; 475 u32 task_no;
476 u32 task_sectors; 476 u32 task_sectors;
@@ -494,8 +494,8 @@ struct se_task {
494 struct list_head t_state_list; 494 struct list_head t_state_list;
495} ____cacheline_aligned; 495} ____cacheline_aligned;
496 496
497#define TASK_CMD(task) ((struct se_cmd *)task->task_se_cmd) 497#define TASK_CMD(task) ((task)->task_se_cmd)
498#define TASK_DEV(task) ((struct se_device *)task->se_dev) 498#define TASK_DEV(task) ((task)->se_dev)
499 499
500struct se_cmd { 500struct se_cmd {
501 /* SAM response code being sent to initiator */ 501 /* SAM response code being sent to initiator */
@@ -551,8 +551,8 @@ struct se_cmd {
551 void (*transport_complete_callback)(struct se_cmd *); 551 void (*transport_complete_callback)(struct se_cmd *);
552} ____cacheline_aligned; 552} ____cacheline_aligned;
553 553
554#define T_TASK(cmd) ((struct se_transport_task *)(cmd->t_task)) 554#define T_TASK(cmd) ((cmd)->t_task)
555#define CMD_TFO(cmd) ((struct target_core_fabric_ops *)cmd->se_tfo) 555#define CMD_TFO(cmd) ((cmd)->se_tfo)
556 556
557struct se_tmr_req { 557struct se_tmr_req {
558 /* Task Management function to be preformed */ 558 /* Task Management function to be preformed */
@@ -583,7 +583,7 @@ struct se_ua {
583struct se_node_acl { 583struct se_node_acl {
584 char initiatorname[TRANSPORT_IQN_LEN]; 584 char initiatorname[TRANSPORT_IQN_LEN];
585 /* Used to signal demo mode created ACL, disabled by default */ 585 /* Used to signal demo mode created ACL, disabled by default */
586 int dynamic_node_acl:1; 586 bool dynamic_node_acl;
587 u32 queue_depth; 587 u32 queue_depth;
588 u32 acl_index; 588 u32 acl_index;
589 u64 num_cmds; 589 u64 num_cmds;
@@ -601,7 +601,8 @@ struct se_node_acl {
601 struct config_group acl_attrib_group; 601 struct config_group acl_attrib_group;
602 struct config_group acl_auth_group; 602 struct config_group acl_auth_group;
603 struct config_group acl_param_group; 603 struct config_group acl_param_group;
604 struct config_group *acl_default_groups[4]; 604 struct config_group acl_fabric_stat_group;
605 struct config_group *acl_default_groups[5];
605 struct list_head acl_list; 606 struct list_head acl_list;
606 struct list_head acl_sess_list; 607 struct list_head acl_sess_list;
607} ____cacheline_aligned; 608} ____cacheline_aligned;
@@ -615,13 +616,19 @@ struct se_session {
615 struct list_head sess_acl_list; 616 struct list_head sess_acl_list;
616} ____cacheline_aligned; 617} ____cacheline_aligned;
617 618
618#define SE_SESS(cmd) ((struct se_session *)(cmd)->se_sess) 619#define SE_SESS(cmd) ((cmd)->se_sess)
619#define SE_NODE_ACL(sess) ((struct se_node_acl *)(sess)->se_node_acl) 620#define SE_NODE_ACL(sess) ((sess)->se_node_acl)
620 621
621struct se_device; 622struct se_device;
622struct se_transform_info; 623struct se_transform_info;
623struct scatterlist; 624struct scatterlist;
624 625
626struct se_ml_stat_grps {
627 struct config_group stat_group;
628 struct config_group scsi_auth_intr_group;
629 struct config_group scsi_att_intr_port_group;
630};
631
625struct se_lun_acl { 632struct se_lun_acl {
626 char initiatorname[TRANSPORT_IQN_LEN]; 633 char initiatorname[TRANSPORT_IQN_LEN];
627 u32 mapped_lun; 634 u32 mapped_lun;
@@ -629,10 +636,13 @@ struct se_lun_acl {
629 struct se_lun *se_lun; 636 struct se_lun *se_lun;
630 struct list_head lacl_list; 637 struct list_head lacl_list;
631 struct config_group se_lun_group; 638 struct config_group se_lun_group;
639 struct se_ml_stat_grps ml_stat_grps;
632} ____cacheline_aligned; 640} ____cacheline_aligned;
633 641
642#define ML_STAT_GRPS(lacl) (&(lacl)->ml_stat_grps)
643
634struct se_dev_entry { 644struct se_dev_entry {
635 int def_pr_registered:1; 645 bool def_pr_registered;
636 /* See transport_lunflags_table */ 646 /* See transport_lunflags_table */
637 u32 lun_flags; 647 u32 lun_flags;
638 u32 deve_cmds; 648 u32 deve_cmds;
@@ -693,6 +703,13 @@ struct se_dev_attrib {
693 struct config_group da_group; 703 struct config_group da_group;
694} ____cacheline_aligned; 704} ____cacheline_aligned;
695 705
706struct se_dev_stat_grps {
707 struct config_group stat_group;
708 struct config_group scsi_dev_group;
709 struct config_group scsi_tgt_dev_group;
710 struct config_group scsi_lu_group;
711};
712
696struct se_subsystem_dev { 713struct se_subsystem_dev {
697/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */ 714/* Used for struct se_subsystem_dev-->se_dev_alias, must be less than PAGE_SIZE */
698#define SE_DEV_ALIAS_LEN 512 715#define SE_DEV_ALIAS_LEN 512
@@ -716,11 +733,14 @@ struct se_subsystem_dev {
716 struct config_group se_dev_group; 733 struct config_group se_dev_group;
717 /* For T10 Reservations */ 734 /* For T10 Reservations */
718 struct config_group se_dev_pr_group; 735 struct config_group se_dev_pr_group;
736 /* For target_core_stat.c groups */
737 struct se_dev_stat_grps dev_stat_grps;
719} ____cacheline_aligned; 738} ____cacheline_aligned;
720 739
721#define T10_ALUA(su_dev) (&(su_dev)->t10_alua) 740#define T10_ALUA(su_dev) (&(su_dev)->t10_alua)
722#define T10_RES(su_dev) (&(su_dev)->t10_reservation) 741#define T10_RES(su_dev) (&(su_dev)->t10_reservation)
723#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops) 742#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops)
743#define DEV_STAT_GRP(dev) (&(dev)->dev_stat_grps)
724 744
725struct se_device { 745struct se_device {
726 /* Set to 1 if thread is NOT sleeping on thread_sem */ 746 /* Set to 1 if thread is NOT sleeping on thread_sem */
@@ -803,8 +823,8 @@ struct se_device {
803 struct list_head g_se_dev_list; 823 struct list_head g_se_dev_list;
804} ____cacheline_aligned; 824} ____cacheline_aligned;
805 825
806#define SE_DEV(cmd) ((struct se_device *)(cmd)->se_lun->lun_se_dev) 826#define SE_DEV(cmd) ((cmd)->se_lun->lun_se_dev)
807#define SU_DEV(dev) ((struct se_subsystem_dev *)(dev)->se_sub_dev) 827#define SU_DEV(dev) ((dev)->se_sub_dev)
808#define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib) 828#define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib)
809#define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn) 829#define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn)
810 830
@@ -832,7 +852,14 @@ struct se_hba {
832 struct se_subsystem_api *transport; 852 struct se_subsystem_api *transport;
833} ____cacheline_aligned; 853} ____cacheline_aligned;
834 854
835#define SE_HBA(d) ((struct se_hba *)(d)->se_hba) 855#define SE_HBA(dev) ((dev)->se_hba)
856
857struct se_port_stat_grps {
858 struct config_group stat_group;
859 struct config_group scsi_port_group;
860 struct config_group scsi_tgt_port_group;
861 struct config_group scsi_transport_group;
862};
836 863
837struct se_lun { 864struct se_lun {
838 /* See transport_lun_status_table */ 865 /* See transport_lun_status_table */
@@ -848,11 +875,13 @@ struct se_lun {
848 struct list_head lun_cmd_list; 875 struct list_head lun_cmd_list;
849 struct list_head lun_acl_list; 876 struct list_head lun_acl_list;
850 struct se_device *lun_se_dev; 877 struct se_device *lun_se_dev;
878 struct se_port *lun_sep;
851 struct config_group lun_group; 879 struct config_group lun_group;
852 struct se_port *lun_sep; 880 struct se_port_stat_grps port_stat_grps;
853} ____cacheline_aligned; 881} ____cacheline_aligned;
854 882
855#define SE_LUN(c) ((struct se_lun *)(c)->se_lun) 883#define SE_LUN(cmd) ((cmd)->se_lun)
884#define PORT_STAT_GRP(lun) (&(lun)->port_stat_grps)
856 885
857struct scsi_port_stats { 886struct scsi_port_stats {
858 u64 cmd_pdus; 887 u64 cmd_pdus;
@@ -919,11 +948,13 @@ struct se_portal_group {
919 struct config_group tpg_param_group; 948 struct config_group tpg_param_group;
920} ____cacheline_aligned; 949} ____cacheline_aligned;
921 950
922#define TPG_TFO(se_tpg) ((struct target_core_fabric_ops *)(se_tpg)->se_tpg_tfo) 951#define TPG_TFO(se_tpg) ((se_tpg)->se_tpg_tfo)
923 952
924struct se_wwn { 953struct se_wwn {
925 struct target_fabric_configfs *wwn_tf; 954 struct target_fabric_configfs *wwn_tf;
926 struct config_group wwn_group; 955 struct config_group wwn_group;
956 struct config_group *wwn_default_groups[2];
957 struct config_group fabric_stat_group;
927} ____cacheline_aligned; 958} ____cacheline_aligned;
928 959
929struct se_global { 960struct se_global {
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index 40e6e740527c..612509592ffd 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -14,10 +14,12 @@ extern void target_fabric_configfs_deregister(struct target_fabric_configfs *);
14struct target_fabric_configfs_template { 14struct target_fabric_configfs_template {
15 struct config_item_type tfc_discovery_cit; 15 struct config_item_type tfc_discovery_cit;
16 struct config_item_type tfc_wwn_cit; 16 struct config_item_type tfc_wwn_cit;
17 struct config_item_type tfc_wwn_fabric_stats_cit;
17 struct config_item_type tfc_tpg_cit; 18 struct config_item_type tfc_tpg_cit;
18 struct config_item_type tfc_tpg_base_cit; 19 struct config_item_type tfc_tpg_base_cit;
19 struct config_item_type tfc_tpg_lun_cit; 20 struct config_item_type tfc_tpg_lun_cit;
20 struct config_item_type tfc_tpg_port_cit; 21 struct config_item_type tfc_tpg_port_cit;
22 struct config_item_type tfc_tpg_port_stat_cit;
21 struct config_item_type tfc_tpg_np_cit; 23 struct config_item_type tfc_tpg_np_cit;
22 struct config_item_type tfc_tpg_np_base_cit; 24 struct config_item_type tfc_tpg_np_base_cit;
23 struct config_item_type tfc_tpg_attrib_cit; 25 struct config_item_type tfc_tpg_attrib_cit;
@@ -27,7 +29,9 @@ struct target_fabric_configfs_template {
27 struct config_item_type tfc_tpg_nacl_attrib_cit; 29 struct config_item_type tfc_tpg_nacl_attrib_cit;
28 struct config_item_type tfc_tpg_nacl_auth_cit; 30 struct config_item_type tfc_tpg_nacl_auth_cit;
29 struct config_item_type tfc_tpg_nacl_param_cit; 31 struct config_item_type tfc_tpg_nacl_param_cit;
32 struct config_item_type tfc_tpg_nacl_stat_cit;
30 struct config_item_type tfc_tpg_mappedlun_cit; 33 struct config_item_type tfc_tpg_mappedlun_cit;
34 struct config_item_type tfc_tpg_mappedlun_stat_cit;
31}; 35};
32 36
33struct target_fabric_configfs { 37struct target_fabric_configfs {
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
index f3ac12b019c2..5eb8b1ae59d1 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -8,7 +8,7 @@ struct target_core_fabric_ops {
8 * for scatterlist chaining using transport_do_task_sg_link(), 8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default 9 * disabled by default
10 */ 10 */
11 int task_sg_chaining:1; 11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void); 12 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 13 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *); 14 char *(*tpg_get_wwn)(struct se_portal_group *);
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
index 6c8248bc2c66..bd5596807478 100644
--- a/include/target/target_core_tmr.h
+++ b/include/target/target_core_tmr.h
@@ -1,37 +1,29 @@
1#ifndef TARGET_CORE_TMR_H 1#ifndef TARGET_CORE_TMR_H
2#define TARGET_CORE_TMR_H 2#define TARGET_CORE_TMR_H
3 3
4/* task management function values */ 4/* fabric independent task management function values */
5#ifdef ABORT_TASK 5enum tcm_tmreq_table {
6#undef ABORT_TASK 6 TMR_ABORT_TASK = 1,
7#endif /* ABORT_TASK */ 7 TMR_ABORT_TASK_SET = 2,
8#define ABORT_TASK 1 8 TMR_CLEAR_ACA = 3,
9#ifdef ABORT_TASK_SET 9 TMR_CLEAR_TASK_SET = 4,
10#undef ABORT_TASK_SET 10 TMR_LUN_RESET = 5,
11#endif /* ABORT_TASK_SET */ 11 TMR_TARGET_WARM_RESET = 6,
12#define ABORT_TASK_SET 2 12 TMR_TARGET_COLD_RESET = 7,
13#ifdef CLEAR_ACA 13 TMR_FABRIC_TMR = 255,
14#undef CLEAR_ACA 14};
15#endif /* CLEAR_ACA */
16#define CLEAR_ACA 3
17#ifdef CLEAR_TASK_SET
18#undef CLEAR_TASK_SET
19#endif /* CLEAR_TASK_SET */
20#define CLEAR_TASK_SET 4
21#define LUN_RESET 5
22#define TARGET_WARM_RESET 6
23#define TARGET_COLD_RESET 7
24#define TASK_REASSIGN 8
25 15
26/* task management response values */ 16/* fabric independent task management response values */
27#define TMR_FUNCTION_COMPLETE 0 17enum tcm_tmrsp_table {
28#define TMR_TASK_DOES_NOT_EXIST 1 18 TMR_FUNCTION_COMPLETE = 0,
29#define TMR_LUN_DOES_NOT_EXIST 2 19 TMR_TASK_DOES_NOT_EXIST = 1,
30#define TMR_TASK_STILL_ALLEGIANT 3 20 TMR_LUN_DOES_NOT_EXIST = 2,
31#define TMR_TASK_FAILOVER_NOT_SUPPORTED 4 21 TMR_TASK_STILL_ALLEGIANT = 3,
32#define TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED 5 22 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
33#define TMR_FUNCTION_AUTHORIZATION_FAILED 6 23 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
34#define TMR_FUNCTION_REJECTED 255 24 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
25 TMR_FUNCTION_REJECTED = 255,
26};
35 27
36extern struct kmem_cache *se_tmr_req_cache; 28extern struct kmem_cache *se_tmr_req_cache;
37 29
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index 246940511579..59aa464f6ee2 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -109,6 +109,8 @@
109struct se_mem; 109struct se_mem;
110struct se_subsystem_api; 110struct se_subsystem_api;
111 111
112extern struct kmem_cache *se_mem_cache;
113
112extern int init_se_global(void); 114extern int init_se_global(void);
113extern void release_se_global(void); 115extern void release_se_global(void);
114extern void init_scsi_index_table(void); 116extern void init_scsi_index_table(void);
@@ -135,6 +137,8 @@ extern void transport_complete_task(struct se_task *, int);
135extern void transport_add_task_to_execute_queue(struct se_task *, 137extern void transport_add_task_to_execute_queue(struct se_task *,
136 struct se_task *, 138 struct se_task *,
137 struct se_device *); 139 struct se_device *);
140extern void transport_remove_task_from_execute_queue(struct se_task *,
141 struct se_device *);
138unsigned char *transport_dump_cmd_direction(struct se_cmd *); 142unsigned char *transport_dump_cmd_direction(struct se_cmd *);
139extern void transport_dump_dev_state(struct se_device *, char *, int *); 143extern void transport_dump_dev_state(struct se_device *, char *, int *);
140extern void transport_dump_dev_info(struct se_device *, struct se_lun *, 144extern void transport_dump_dev_info(struct se_device *, struct se_lun *,
@@ -188,6 +192,8 @@ extern void transport_generic_process_write(struct se_cmd *);
188extern int transport_generic_do_tmr(struct se_cmd *); 192extern int transport_generic_do_tmr(struct se_cmd *);
189/* From target_core_alua.c */ 193/* From target_core_alua.c */
190extern int core_alua_check_nonop_delay(struct se_cmd *); 194extern int core_alua_check_nonop_delay(struct se_cmd *);
195/* From target_core_cdb.c */
196extern int transport_emulate_control_cdb(struct se_task *);
191 197
192/* 198/*
193 * Each se_transport_task_t can have N number of possible struct se_task's 199 * Each se_transport_task_t can have N number of possible struct se_task's
diff --git a/include/trace/events/asoc.h b/include/trace/events/asoc.h
index 186e84db4b54..ae973d2e27a1 100644
--- a/include/trace/events/asoc.h
+++ b/include/trace/events/asoc.h
@@ -229,6 +229,31 @@ TRACE_EVENT(snd_soc_jack_notify,
229 TP_printk("jack=%s %x", __get_str(name), (int)__entry->val) 229 TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
230); 230);
231 231
232TRACE_EVENT(snd_soc_cache_sync,
233
234 TP_PROTO(struct snd_soc_codec *codec, const char *type,
235 const char *status),
236
237 TP_ARGS(codec, type, status),
238
239 TP_STRUCT__entry(
240 __string( name, codec->name )
241 __string( status, status )
242 __string( type, type )
243 __field( int, id )
244 ),
245
246 TP_fast_assign(
247 __assign_str(name, codec->name);
248 __assign_str(status, status);
249 __assign_str(type, type);
250 __entry->id = codec->id;
251 ),
252
253 TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
254 (int)__entry->id, __get_str(type), __get_str(status))
255);
256
232#endif /* _TRACE_ASOC_H */ 257#endif /* _TRACE_ASOC_H */
233 258
234/* This part must be outside protection */ 259/* This part must be outside protection */
diff --git a/include/trace/events/bkl.h b/include/trace/events/bkl.h
deleted file mode 100644
index 1af72dc24278..000000000000
--- a/include/trace/events/bkl.h
+++ /dev/null
@@ -1,61 +0,0 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM bkl
3
4#if !defined(_TRACE_BKL_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_BKL_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(lock_kernel,
10
11 TP_PROTO(const char *func, const char *file, int line),
12
13 TP_ARGS(func, file, line),
14
15 TP_STRUCT__entry(
16 __field( int, depth )
17 __field_ext( const char *, func, FILTER_PTR_STRING )
18 __field_ext( const char *, file, FILTER_PTR_STRING )
19 __field( int, line )
20 ),
21
22 TP_fast_assign(
23 /* We want to record the lock_depth after lock is acquired */
24 __entry->depth = current->lock_depth + 1;
25 __entry->func = func;
26 __entry->file = file;
27 __entry->line = line;
28 ),
29
30 TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
31 __entry->file, __entry->line, __entry->func)
32);
33
34TRACE_EVENT(unlock_kernel,
35
36 TP_PROTO(const char *func, const char *file, int line),
37
38 TP_ARGS(func, file, line),
39
40 TP_STRUCT__entry(
41 __field(int, depth )
42 __field(const char *, func )
43 __field(const char *, file )
44 __field(int, line )
45 ),
46
47 TP_fast_assign(
48 __entry->depth = current->lock_depth;
49 __entry->func = func;
50 __entry->file = file;
51 __entry->line = line;
52 ),
53
54 TP_printk("depth=%d file:line=%s:%d func=%s()", __entry->depth,
55 __entry->file, __entry->line, __entry->func)
56);
57
58#endif /* _TRACE_BKL_H */
59
60/* This part must be outside protection */
61#include <trace/define_trace.h>
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index e5e345fb2a5c..e09592d2f916 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -21,8 +21,7 @@ TRACE_EVENT(ext4_free_inode,
21 TP_ARGS(inode), 21 TP_ARGS(inode),
22 22
23 TP_STRUCT__entry( 23 TP_STRUCT__entry(
24 __field( int, dev_major ) 24 __field( dev_t, dev )
25 __field( int, dev_minor )
26 __field( ino_t, ino ) 25 __field( ino_t, ino )
27 __field( umode_t, mode ) 26 __field( umode_t, mode )
28 __field( uid_t, uid ) 27 __field( uid_t, uid )
@@ -31,8 +30,7 @@ TRACE_EVENT(ext4_free_inode,
31 ), 30 ),
32 31
33 TP_fast_assign( 32 TP_fast_assign(
34 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 33 __entry->dev = inode->i_sb->s_dev;
35 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
36 __entry->ino = inode->i_ino; 34 __entry->ino = inode->i_ino;
37 __entry->mode = inode->i_mode; 35 __entry->mode = inode->i_mode;
38 __entry->uid = inode->i_uid; 36 __entry->uid = inode->i_uid;
@@ -41,9 +39,9 @@ TRACE_EVENT(ext4_free_inode,
41 ), 39 ),
42 40
43 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", 41 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
44 __entry->dev_major, __entry->dev_minor, 42 MAJOR(__entry->dev), MINOR(__entry->dev),
45 (unsigned long) __entry->ino, __entry->mode, 43 (unsigned long) __entry->ino,
46 __entry->uid, __entry->gid, 44 __entry->mode, __entry->uid, __entry->gid,
47 (unsigned long long) __entry->blocks) 45 (unsigned long long) __entry->blocks)
48); 46);
49 47
@@ -53,21 +51,19 @@ TRACE_EVENT(ext4_request_inode,
53 TP_ARGS(dir, mode), 51 TP_ARGS(dir, mode),
54 52
55 TP_STRUCT__entry( 53 TP_STRUCT__entry(
56 __field( int, dev_major ) 54 __field( dev_t, dev )
57 __field( int, dev_minor )
58 __field( ino_t, dir ) 55 __field( ino_t, dir )
59 __field( umode_t, mode ) 56 __field( umode_t, mode )
60 ), 57 ),
61 58
62 TP_fast_assign( 59 TP_fast_assign(
63 __entry->dev_major = MAJOR(dir->i_sb->s_dev); 60 __entry->dev = dir->i_sb->s_dev;
64 __entry->dev_minor = MINOR(dir->i_sb->s_dev);
65 __entry->dir = dir->i_ino; 61 __entry->dir = dir->i_ino;
66 __entry->mode = mode; 62 __entry->mode = mode;
67 ), 63 ),
68 64
69 TP_printk("dev %d,%d dir %lu mode 0%o", 65 TP_printk("dev %d,%d dir %lu mode 0%o",
70 __entry->dev_major, __entry->dev_minor, 66 MAJOR(__entry->dev), MINOR(__entry->dev),
71 (unsigned long) __entry->dir, __entry->mode) 67 (unsigned long) __entry->dir, __entry->mode)
72); 68);
73 69
@@ -77,23 +73,21 @@ TRACE_EVENT(ext4_allocate_inode,
77 TP_ARGS(inode, dir, mode), 73 TP_ARGS(inode, dir, mode),
78 74
79 TP_STRUCT__entry( 75 TP_STRUCT__entry(
80 __field( int, dev_major ) 76 __field( dev_t, dev )
81 __field( int, dev_minor )
82 __field( ino_t, ino ) 77 __field( ino_t, ino )
83 __field( ino_t, dir ) 78 __field( ino_t, dir )
84 __field( umode_t, mode ) 79 __field( umode_t, mode )
85 ), 80 ),
86 81
87 TP_fast_assign( 82 TP_fast_assign(
88 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 83 __entry->dev = inode->i_sb->s_dev;
89 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
90 __entry->ino = inode->i_ino; 84 __entry->ino = inode->i_ino;
91 __entry->dir = dir->i_ino; 85 __entry->dir = dir->i_ino;
92 __entry->mode = mode; 86 __entry->mode = mode;
93 ), 87 ),
94 88
95 TP_printk("dev %d,%d ino %lu dir %lu mode 0%o", 89 TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
96 __entry->dev_major, __entry->dev_minor, 90 MAJOR(__entry->dev), MINOR(__entry->dev),
97 (unsigned long) __entry->ino, 91 (unsigned long) __entry->ino,
98 (unsigned long) __entry->dir, __entry->mode) 92 (unsigned long) __entry->dir, __entry->mode)
99); 93);
@@ -104,21 +98,19 @@ TRACE_EVENT(ext4_evict_inode,
104 TP_ARGS(inode), 98 TP_ARGS(inode),
105 99
106 TP_STRUCT__entry( 100 TP_STRUCT__entry(
107 __field( int, dev_major ) 101 __field( dev_t, dev )
108 __field( int, dev_minor )
109 __field( ino_t, ino ) 102 __field( ino_t, ino )
110 __field( int, nlink ) 103 __field( int, nlink )
111 ), 104 ),
112 105
113 TP_fast_assign( 106 TP_fast_assign(
114 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 107 __entry->dev = inode->i_sb->s_dev;
115 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
116 __entry->ino = inode->i_ino; 108 __entry->ino = inode->i_ino;
117 __entry->nlink = inode->i_nlink; 109 __entry->nlink = inode->i_nlink;
118 ), 110 ),
119 111
120 TP_printk("dev %d,%d ino %lu nlink %d", 112 TP_printk("dev %d,%d ino %lu nlink %d",
121 __entry->dev_major, __entry->dev_minor, 113 MAJOR(__entry->dev), MINOR(__entry->dev),
122 (unsigned long) __entry->ino, __entry->nlink) 114 (unsigned long) __entry->ino, __entry->nlink)
123); 115);
124 116
@@ -128,21 +120,19 @@ TRACE_EVENT(ext4_drop_inode,
128 TP_ARGS(inode, drop), 120 TP_ARGS(inode, drop),
129 121
130 TP_STRUCT__entry( 122 TP_STRUCT__entry(
131 __field( int, dev_major ) 123 __field( dev_t, dev )
132 __field( int, dev_minor )
133 __field( ino_t, ino ) 124 __field( ino_t, ino )
134 __field( int, drop ) 125 __field( int, drop )
135 ), 126 ),
136 127
137 TP_fast_assign( 128 TP_fast_assign(
138 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 129 __entry->dev = inode->i_sb->s_dev;
139 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
140 __entry->ino = inode->i_ino; 130 __entry->ino = inode->i_ino;
141 __entry->drop = drop; 131 __entry->drop = drop;
142 ), 132 ),
143 133
144 TP_printk("dev %d,%d ino %lu drop %d", 134 TP_printk("dev %d,%d ino %lu drop %d",
145 __entry->dev_major, __entry->dev_minor, 135 MAJOR(__entry->dev), MINOR(__entry->dev),
146 (unsigned long) __entry->ino, __entry->drop) 136 (unsigned long) __entry->ino, __entry->drop)
147); 137);
148 138
@@ -152,21 +142,19 @@ TRACE_EVENT(ext4_mark_inode_dirty,
152 TP_ARGS(inode, IP), 142 TP_ARGS(inode, IP),
153 143
154 TP_STRUCT__entry( 144 TP_STRUCT__entry(
155 __field( int, dev_major ) 145 __field( dev_t, dev )
156 __field( int, dev_minor )
157 __field( ino_t, ino ) 146 __field( ino_t, ino )
158 __field(unsigned long, ip ) 147 __field(unsigned long, ip )
159 ), 148 ),
160 149
161 TP_fast_assign( 150 TP_fast_assign(
162 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 151 __entry->dev = inode->i_sb->s_dev;
163 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
164 __entry->ino = inode->i_ino; 152 __entry->ino = inode->i_ino;
165 __entry->ip = IP; 153 __entry->ip = IP;
166 ), 154 ),
167 155
168 TP_printk("dev %d,%d ino %lu caller %pF", 156 TP_printk("dev %d,%d ino %lu caller %pF",
169 __entry->dev_major, __entry->dev_minor, 157 MAJOR(__entry->dev), MINOR(__entry->dev),
170 (unsigned long) __entry->ino, (void *)__entry->ip) 158 (unsigned long) __entry->ino, (void *)__entry->ip)
171); 159);
172 160
@@ -176,21 +164,19 @@ TRACE_EVENT(ext4_begin_ordered_truncate,
176 TP_ARGS(inode, new_size), 164 TP_ARGS(inode, new_size),
177 165
178 TP_STRUCT__entry( 166 TP_STRUCT__entry(
179 __field( int, dev_major ) 167 __field( dev_t, dev )
180 __field( int, dev_minor )
181 __field( ino_t, ino ) 168 __field( ino_t, ino )
182 __field( loff_t, new_size ) 169 __field( loff_t, new_size )
183 ), 170 ),
184 171
185 TP_fast_assign( 172 TP_fast_assign(
186 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 173 __entry->dev = inode->i_sb->s_dev;
187 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
188 __entry->ino = inode->i_ino; 174 __entry->ino = inode->i_ino;
189 __entry->new_size = new_size; 175 __entry->new_size = new_size;
190 ), 176 ),
191 177
192 TP_printk("dev %d,%d ino %lu new_size %lld", 178 TP_printk("dev %d,%d ino %lu new_size %lld",
193 __entry->dev_major, __entry->dev_minor, 179 MAJOR(__entry->dev), MINOR(__entry->dev),
194 (unsigned long) __entry->ino, 180 (unsigned long) __entry->ino,
195 (long long) __entry->new_size) 181 (long long) __entry->new_size)
196); 182);
@@ -203,8 +189,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
203 TP_ARGS(inode, pos, len, flags), 189 TP_ARGS(inode, pos, len, flags),
204 190
205 TP_STRUCT__entry( 191 TP_STRUCT__entry(
206 __field( int, dev_major ) 192 __field( dev_t, dev )
207 __field( int, dev_minor )
208 __field( ino_t, ino ) 193 __field( ino_t, ino )
209 __field( loff_t, pos ) 194 __field( loff_t, pos )
210 __field( unsigned int, len ) 195 __field( unsigned int, len )
@@ -212,8 +197,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
212 ), 197 ),
213 198
214 TP_fast_assign( 199 TP_fast_assign(
215 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 200 __entry->dev = inode->i_sb->s_dev;
216 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
217 __entry->ino = inode->i_ino; 201 __entry->ino = inode->i_ino;
218 __entry->pos = pos; 202 __entry->pos = pos;
219 __entry->len = len; 203 __entry->len = len;
@@ -221,7 +205,7 @@ DECLARE_EVENT_CLASS(ext4__write_begin,
221 ), 205 ),
222 206
223 TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u", 207 TP_printk("dev %d,%d ino %lu pos %llu len %u flags %u",
224 __entry->dev_major, __entry->dev_minor, 208 MAJOR(__entry->dev), MINOR(__entry->dev),
225 (unsigned long) __entry->ino, 209 (unsigned long) __entry->ino,
226 __entry->pos, __entry->len, __entry->flags) 210 __entry->pos, __entry->len, __entry->flags)
227); 211);
@@ -249,8 +233,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
249 TP_ARGS(inode, pos, len, copied), 233 TP_ARGS(inode, pos, len, copied),
250 234
251 TP_STRUCT__entry( 235 TP_STRUCT__entry(
252 __field( int, dev_major ) 236 __field( dev_t, dev )
253 __field( int, dev_minor )
254 __field( ino_t, ino ) 237 __field( ino_t, ino )
255 __field( loff_t, pos ) 238 __field( loff_t, pos )
256 __field( unsigned int, len ) 239 __field( unsigned int, len )
@@ -258,8 +241,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,
258 ), 241 ),
259 242
260 TP_fast_assign( 243 TP_fast_assign(
261 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 244 __entry->dev = inode->i_sb->s_dev;
262 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
263 __entry->ino = inode->i_ino; 245 __entry->ino = inode->i_ino;
264 __entry->pos = pos; 246 __entry->pos = pos;
265 __entry->len = len; 247 __entry->len = len;
@@ -267,9 +249,9 @@ DECLARE_EVENT_CLASS(ext4__write_end,
267 ), 249 ),
268 250
269 TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u", 251 TP_printk("dev %d,%d ino %lu pos %llu len %u copied %u",
270 __entry->dev_major, __entry->dev_minor, 252 MAJOR(__entry->dev), MINOR(__entry->dev),
271 (unsigned long) __entry->ino, __entry->pos, 253 (unsigned long) __entry->ino,
272 __entry->len, __entry->copied) 254 __entry->pos, __entry->len, __entry->copied)
273); 255);
274 256
275DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end, 257DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
@@ -310,22 +292,20 @@ TRACE_EVENT(ext4_writepage,
310 TP_ARGS(inode, page), 292 TP_ARGS(inode, page),
311 293
312 TP_STRUCT__entry( 294 TP_STRUCT__entry(
313 __field( int, dev_major ) 295 __field( dev_t, dev )
314 __field( int, dev_minor )
315 __field( ino_t, ino ) 296 __field( ino_t, ino )
316 __field( pgoff_t, index ) 297 __field( pgoff_t, index )
317 298
318 ), 299 ),
319 300
320 TP_fast_assign( 301 TP_fast_assign(
321 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 302 __entry->dev = inode->i_sb->s_dev;
322 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
323 __entry->ino = inode->i_ino; 303 __entry->ino = inode->i_ino;
324 __entry->index = page->index; 304 __entry->index = page->index;
325 ), 305 ),
326 306
327 TP_printk("dev %d,%d ino %lu page_index %lu", 307 TP_printk("dev %d,%d ino %lu page_index %lu",
328 __entry->dev_major, __entry->dev_minor, 308 MAJOR(__entry->dev), MINOR(__entry->dev),
329 (unsigned long) __entry->ino, __entry->index) 309 (unsigned long) __entry->ino, __entry->index)
330); 310);
331 311
@@ -335,43 +315,39 @@ TRACE_EVENT(ext4_da_writepages,
335 TP_ARGS(inode, wbc), 315 TP_ARGS(inode, wbc),
336 316
337 TP_STRUCT__entry( 317 TP_STRUCT__entry(
338 __field( int, dev_major ) 318 __field( dev_t, dev )
339 __field( int, dev_minor )
340 __field( ino_t, ino ) 319 __field( ino_t, ino )
341 __field( long, nr_to_write ) 320 __field( long, nr_to_write )
342 __field( long, pages_skipped ) 321 __field( long, pages_skipped )
343 __field( loff_t, range_start ) 322 __field( loff_t, range_start )
344 __field( loff_t, range_end ) 323 __field( loff_t, range_end )
324 __field( int, sync_mode )
345 __field( char, for_kupdate ) 325 __field( char, for_kupdate )
346 __field( char, for_reclaim )
347 __field( char, range_cyclic ) 326 __field( char, range_cyclic )
348 __field( pgoff_t, writeback_index ) 327 __field( pgoff_t, writeback_index )
349 ), 328 ),
350 329
351 TP_fast_assign( 330 TP_fast_assign(
352 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 331 __entry->dev = inode->i_sb->s_dev;
353 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
354 __entry->ino = inode->i_ino; 332 __entry->ino = inode->i_ino;
355 __entry->nr_to_write = wbc->nr_to_write; 333 __entry->nr_to_write = wbc->nr_to_write;
356 __entry->pages_skipped = wbc->pages_skipped; 334 __entry->pages_skipped = wbc->pages_skipped;
357 __entry->range_start = wbc->range_start; 335 __entry->range_start = wbc->range_start;
358 __entry->range_end = wbc->range_end; 336 __entry->range_end = wbc->range_end;
337 __entry->sync_mode = wbc->sync_mode;
359 __entry->for_kupdate = wbc->for_kupdate; 338 __entry->for_kupdate = wbc->for_kupdate;
360 __entry->for_reclaim = wbc->for_reclaim;
361 __entry->range_cyclic = wbc->range_cyclic; 339 __entry->range_cyclic = wbc->range_cyclic;
362 __entry->writeback_index = inode->i_mapping->writeback_index; 340 __entry->writeback_index = inode->i_mapping->writeback_index;
363 ), 341 ),
364 342
365 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " 343 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
366 "range_start %llu range_end %llu " 344 "range_start %llu range_end %llu sync_mode %d"
367 "for_kupdate %d for_reclaim %d " 345 "for_kupdate %d range_cyclic %d writeback_index %lu",
368 "range_cyclic %d writeback_index %lu", 346 MAJOR(__entry->dev), MINOR(__entry->dev),
369 __entry->dev_major, __entry->dev_minor,
370 (unsigned long) __entry->ino, __entry->nr_to_write, 347 (unsigned long) __entry->ino, __entry->nr_to_write,
371 __entry->pages_skipped, __entry->range_start, 348 __entry->pages_skipped, __entry->range_start,
372 __entry->range_end, 349 __entry->range_end, __entry->sync_mode,
373 __entry->for_kupdate, __entry->for_reclaim, 350 __entry->for_kupdate, __entry->range_cyclic,
374 __entry->range_cyclic,
375 (unsigned long) __entry->writeback_index) 351 (unsigned long) __entry->writeback_index)
376); 352);
377 353
@@ -381,8 +357,7 @@ TRACE_EVENT(ext4_da_write_pages,
381 TP_ARGS(inode, mpd), 357 TP_ARGS(inode, mpd),
382 358
383 TP_STRUCT__entry( 359 TP_STRUCT__entry(
384 __field( int, dev_major ) 360 __field( dev_t, dev )
385 __field( int, dev_minor )
386 __field( ino_t, ino ) 361 __field( ino_t, ino )
387 __field( __u64, b_blocknr ) 362 __field( __u64, b_blocknr )
388 __field( __u32, b_size ) 363 __field( __u32, b_size )
@@ -390,11 +365,11 @@ TRACE_EVENT(ext4_da_write_pages,
390 __field( unsigned long, first_page ) 365 __field( unsigned long, first_page )
391 __field( int, io_done ) 366 __field( int, io_done )
392 __field( int, pages_written ) 367 __field( int, pages_written )
368 __field( int, sync_mode )
393 ), 369 ),
394 370
395 TP_fast_assign( 371 TP_fast_assign(
396 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 372 __entry->dev = inode->i_sb->s_dev;
397 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
398 __entry->ino = inode->i_ino; 373 __entry->ino = inode->i_ino;
399 __entry->b_blocknr = mpd->b_blocknr; 374 __entry->b_blocknr = mpd->b_blocknr;
400 __entry->b_size = mpd->b_size; 375 __entry->b_size = mpd->b_size;
@@ -402,14 +377,18 @@ TRACE_EVENT(ext4_da_write_pages,
402 __entry->first_page = mpd->first_page; 377 __entry->first_page = mpd->first_page;
403 __entry->io_done = mpd->io_done; 378 __entry->io_done = mpd->io_done;
404 __entry->pages_written = mpd->pages_written; 379 __entry->pages_written = mpd->pages_written;
380 __entry->sync_mode = mpd->wbc->sync_mode;
405 ), 381 ),
406 382
407 TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d", 383 TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x "
408 __entry->dev_major, __entry->dev_minor, 384 "first_page %lu io_done %d pages_written %d sync_mode %d",
385 MAJOR(__entry->dev), MINOR(__entry->dev),
409 (unsigned long) __entry->ino, 386 (unsigned long) __entry->ino,
410 __entry->b_blocknr, __entry->b_size, 387 __entry->b_blocknr, __entry->b_size,
411 __entry->b_state, __entry->first_page, 388 __entry->b_state, __entry->first_page,
412 __entry->io_done, __entry->pages_written) 389 __entry->io_done, __entry->pages_written,
390 __entry->sync_mode
391 )
413); 392);
414 393
415TRACE_EVENT(ext4_da_writepages_result, 394TRACE_EVENT(ext4_da_writepages_result,
@@ -419,35 +398,100 @@ TRACE_EVENT(ext4_da_writepages_result,
419 TP_ARGS(inode, wbc, ret, pages_written), 398 TP_ARGS(inode, wbc, ret, pages_written),
420 399
421 TP_STRUCT__entry( 400 TP_STRUCT__entry(
422 __field( int, dev_major ) 401 __field( dev_t, dev )
423 __field( int, dev_minor )
424 __field( ino_t, ino ) 402 __field( ino_t, ino )
425 __field( int, ret ) 403 __field( int, ret )
426 __field( int, pages_written ) 404 __field( int, pages_written )
427 __field( long, pages_skipped ) 405 __field( long, pages_skipped )
406 __field( int, sync_mode )
428 __field( char, more_io ) 407 __field( char, more_io )
429 __field( pgoff_t, writeback_index ) 408 __field( pgoff_t, writeback_index )
430 ), 409 ),
431 410
432 TP_fast_assign( 411 TP_fast_assign(
433 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 412 __entry->dev = inode->i_sb->s_dev;
434 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
435 __entry->ino = inode->i_ino; 413 __entry->ino = inode->i_ino;
436 __entry->ret = ret; 414 __entry->ret = ret;
437 __entry->pages_written = pages_written; 415 __entry->pages_written = pages_written;
438 __entry->pages_skipped = wbc->pages_skipped; 416 __entry->pages_skipped = wbc->pages_skipped;
417 __entry->sync_mode = wbc->sync_mode;
439 __entry->more_io = wbc->more_io; 418 __entry->more_io = wbc->more_io;
440 __entry->writeback_index = inode->i_mapping->writeback_index; 419 __entry->writeback_index = inode->i_mapping->writeback_index;
441 ), 420 ),
442 421
443 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld more_io %d writeback_index %lu", 422 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
444 __entry->dev_major, __entry->dev_minor, 423 " more_io %d sync_mode %d writeback_index %lu",
424 MAJOR(__entry->dev), MINOR(__entry->dev),
445 (unsigned long) __entry->ino, __entry->ret, 425 (unsigned long) __entry->ino, __entry->ret,
446 __entry->pages_written, __entry->pages_skipped, 426 __entry->pages_written, __entry->pages_skipped,
447 __entry->more_io, 427 __entry->more_io, __entry->sync_mode,
448 (unsigned long) __entry->writeback_index) 428 (unsigned long) __entry->writeback_index)
449); 429);
450 430
431DECLARE_EVENT_CLASS(ext4__page_op,
432 TP_PROTO(struct page *page),
433
434 TP_ARGS(page),
435
436 TP_STRUCT__entry(
437 __field( pgoff_t, index )
438 __field( ino_t, ino )
439 __field( dev_t, dev )
440
441 ),
442
443 TP_fast_assign(
444 __entry->index = page->index;
445 __entry->ino = page->mapping->host->i_ino;
446 __entry->dev = page->mapping->host->i_sb->s_dev;
447 ),
448
449 TP_printk("dev %d,%d ino %lu page_index %lu",
450 MAJOR(__entry->dev), MINOR(__entry->dev),
451 (unsigned long) __entry->ino,
452 __entry->index)
453);
454
455DEFINE_EVENT(ext4__page_op, ext4_readpage,
456
457 TP_PROTO(struct page *page),
458
459 TP_ARGS(page)
460);
461
462DEFINE_EVENT(ext4__page_op, ext4_releasepage,
463
464 TP_PROTO(struct page *page),
465
466 TP_ARGS(page)
467);
468
469TRACE_EVENT(ext4_invalidatepage,
470 TP_PROTO(struct page *page, unsigned long offset),
471
472 TP_ARGS(page, offset),
473
474 TP_STRUCT__entry(
475 __field( pgoff_t, index )
476 __field( unsigned long, offset )
477 __field( ino_t, ino )
478 __field( dev_t, dev )
479
480 ),
481
482 TP_fast_assign(
483 __entry->index = page->index;
484 __entry->offset = offset;
485 __entry->ino = page->mapping->host->i_ino;
486 __entry->dev = page->mapping->host->i_sb->s_dev;
487 ),
488
489 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
490 MAJOR(__entry->dev), MINOR(__entry->dev),
491 (unsigned long) __entry->ino,
492 __entry->index, __entry->offset)
493);
494
451TRACE_EVENT(ext4_discard_blocks, 495TRACE_EVENT(ext4_discard_blocks,
452 TP_PROTO(struct super_block *sb, unsigned long long blk, 496 TP_PROTO(struct super_block *sb, unsigned long long blk,
453 unsigned long long count), 497 unsigned long long count),
@@ -455,22 +499,20 @@ TRACE_EVENT(ext4_discard_blocks,
455 TP_ARGS(sb, blk, count), 499 TP_ARGS(sb, blk, count),
456 500
457 TP_STRUCT__entry( 501 TP_STRUCT__entry(
458 __field( int, dev_major ) 502 __field( dev_t, dev )
459 __field( int, dev_minor )
460 __field( __u64, blk ) 503 __field( __u64, blk )
461 __field( __u64, count ) 504 __field( __u64, count )
462 505
463 ), 506 ),
464 507
465 TP_fast_assign( 508 TP_fast_assign(
466 __entry->dev_major = MAJOR(sb->s_dev); 509 __entry->dev = sb->s_dev;
467 __entry->dev_minor = MINOR(sb->s_dev);
468 __entry->blk = blk; 510 __entry->blk = blk;
469 __entry->count = count; 511 __entry->count = count;
470 ), 512 ),
471 513
472 TP_printk("dev %d,%d blk %llu count %llu", 514 TP_printk("dev %d,%d blk %llu count %llu",
473 __entry->dev_major, __entry->dev_minor, 515 MAJOR(__entry->dev), MINOR(__entry->dev),
474 __entry->blk, __entry->count) 516 __entry->blk, __entry->count)
475); 517);
476 518
@@ -481,8 +523,7 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
481 TP_ARGS(ac, pa), 523 TP_ARGS(ac, pa),
482 524
483 TP_STRUCT__entry( 525 TP_STRUCT__entry(
484 __field( int, dev_major ) 526 __field( dev_t, dev )
485 __field( int, dev_minor )
486 __field( ino_t, ino ) 527 __field( ino_t, ino )
487 __field( __u64, pa_pstart ) 528 __field( __u64, pa_pstart )
488 __field( __u32, pa_len ) 529 __field( __u32, pa_len )
@@ -491,8 +532,7 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
491 ), 532 ),
492 533
493 TP_fast_assign( 534 TP_fast_assign(
494 __entry->dev_major = MAJOR(ac->ac_sb->s_dev); 535 __entry->dev = ac->ac_sb->s_dev;
495 __entry->dev_minor = MINOR(ac->ac_sb->s_dev);
496 __entry->ino = ac->ac_inode->i_ino; 536 __entry->ino = ac->ac_inode->i_ino;
497 __entry->pa_pstart = pa->pa_pstart; 537 __entry->pa_pstart = pa->pa_pstart;
498 __entry->pa_len = pa->pa_len; 538 __entry->pa_len = pa->pa_len;
@@ -500,9 +540,9 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
500 ), 540 ),
501 541
502 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu", 542 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
503 __entry->dev_major, __entry->dev_minor, 543 MAJOR(__entry->dev), MINOR(__entry->dev),
504 (unsigned long) __entry->ino, __entry->pa_pstart, 544 (unsigned long) __entry->ino,
505 __entry->pa_len, __entry->pa_lstart) 545 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
506); 546);
507 547
508DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa, 548DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
@@ -530,8 +570,7 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
530 TP_ARGS(sb, inode, pa, block, count), 570 TP_ARGS(sb, inode, pa, block, count),
531 571
532 TP_STRUCT__entry( 572 TP_STRUCT__entry(
533 __field( int, dev_major ) 573 __field( dev_t, dev )
534 __field( int, dev_minor )
535 __field( ino_t, ino ) 574 __field( ino_t, ino )
536 __field( __u64, block ) 575 __field( __u64, block )
537 __field( __u32, count ) 576 __field( __u32, count )
@@ -539,16 +578,16 @@ TRACE_EVENT(ext4_mb_release_inode_pa,
539 ), 578 ),
540 579
541 TP_fast_assign( 580 TP_fast_assign(
542 __entry->dev_major = MAJOR(sb->s_dev); 581 __entry->dev = sb->s_dev;
543 __entry->dev_minor = MINOR(sb->s_dev);
544 __entry->ino = inode->i_ino; 582 __entry->ino = inode->i_ino;
545 __entry->block = block; 583 __entry->block = block;
546 __entry->count = count; 584 __entry->count = count;
547 ), 585 ),
548 586
549 TP_printk("dev %d,%d ino %lu block %llu count %u", 587 TP_printk("dev %d,%d ino %lu block %llu count %u",
550 __entry->dev_major, __entry->dev_minor, 588 MAJOR(__entry->dev), MINOR(__entry->dev),
551 (unsigned long) __entry->ino, __entry->block, __entry->count) 589 (unsigned long) __entry->ino,
590 __entry->block, __entry->count)
552); 591);
553 592
554TRACE_EVENT(ext4_mb_release_group_pa, 593TRACE_EVENT(ext4_mb_release_group_pa,
@@ -558,22 +597,20 @@ TRACE_EVENT(ext4_mb_release_group_pa,
558 TP_ARGS(sb, pa), 597 TP_ARGS(sb, pa),
559 598
560 TP_STRUCT__entry( 599 TP_STRUCT__entry(
561 __field( int, dev_major ) 600 __field( dev_t, dev )
562 __field( int, dev_minor )
563 __field( __u64, pa_pstart ) 601 __field( __u64, pa_pstart )
564 __field( __u32, pa_len ) 602 __field( __u32, pa_len )
565 603
566 ), 604 ),
567 605
568 TP_fast_assign( 606 TP_fast_assign(
569 __entry->dev_major = MAJOR(sb->s_dev); 607 __entry->dev = sb->s_dev;
570 __entry->dev_minor = MINOR(sb->s_dev);
571 __entry->pa_pstart = pa->pa_pstart; 608 __entry->pa_pstart = pa->pa_pstart;
572 __entry->pa_len = pa->pa_len; 609 __entry->pa_len = pa->pa_len;
573 ), 610 ),
574 611
575 TP_printk("dev %d,%d pstart %llu len %u", 612 TP_printk("dev %d,%d pstart %llu len %u",
576 __entry->dev_major, __entry->dev_minor, 613 MAJOR(__entry->dev), MINOR(__entry->dev),
577 __entry->pa_pstart, __entry->pa_len) 614 __entry->pa_pstart, __entry->pa_len)
578); 615);
579 616
@@ -583,20 +620,18 @@ TRACE_EVENT(ext4_discard_preallocations,
583 TP_ARGS(inode), 620 TP_ARGS(inode),
584 621
585 TP_STRUCT__entry( 622 TP_STRUCT__entry(
586 __field( int, dev_major ) 623 __field( dev_t, dev )
587 __field( int, dev_minor )
588 __field( ino_t, ino ) 624 __field( ino_t, ino )
589 625
590 ), 626 ),
591 627
592 TP_fast_assign( 628 TP_fast_assign(
593 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 629 __entry->dev = inode->i_sb->s_dev;
594 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
595 __entry->ino = inode->i_ino; 630 __entry->ino = inode->i_ino;
596 ), 631 ),
597 632
598 TP_printk("dev %d,%d ino %lu", 633 TP_printk("dev %d,%d ino %lu",
599 __entry->dev_major, __entry->dev_minor, 634 MAJOR(__entry->dev), MINOR(__entry->dev),
600 (unsigned long) __entry->ino) 635 (unsigned long) __entry->ino)
601); 636);
602 637
@@ -606,20 +641,19 @@ TRACE_EVENT(ext4_mb_discard_preallocations,
606 TP_ARGS(sb, needed), 641 TP_ARGS(sb, needed),
607 642
608 TP_STRUCT__entry( 643 TP_STRUCT__entry(
609 __field( int, dev_major ) 644 __field( dev_t, dev )
610 __field( int, dev_minor )
611 __field( int, needed ) 645 __field( int, needed )
612 646
613 ), 647 ),
614 648
615 TP_fast_assign( 649 TP_fast_assign(
616 __entry->dev_major = MAJOR(sb->s_dev); 650 __entry->dev = sb->s_dev;
617 __entry->dev_minor = MINOR(sb->s_dev);
618 __entry->needed = needed; 651 __entry->needed = needed;
619 ), 652 ),
620 653
621 TP_printk("dev %d,%d needed %d", 654 TP_printk("dev %d,%d needed %d",
622 __entry->dev_major, __entry->dev_minor, __entry->needed) 655 MAJOR(__entry->dev), MINOR(__entry->dev),
656 __entry->needed)
623); 657);
624 658
625TRACE_EVENT(ext4_request_blocks, 659TRACE_EVENT(ext4_request_blocks,
@@ -628,8 +662,7 @@ TRACE_EVENT(ext4_request_blocks,
628 TP_ARGS(ar), 662 TP_ARGS(ar),
629 663
630 TP_STRUCT__entry( 664 TP_STRUCT__entry(
631 __field( int, dev_major ) 665 __field( dev_t, dev )
632 __field( int, dev_minor )
633 __field( ino_t, ino ) 666 __field( ino_t, ino )
634 __field( unsigned int, flags ) 667 __field( unsigned int, flags )
635 __field( unsigned int, len ) 668 __field( unsigned int, len )
@@ -642,8 +675,7 @@ TRACE_EVENT(ext4_request_blocks,
642 ), 675 ),
643 676
644 TP_fast_assign( 677 TP_fast_assign(
645 __entry->dev_major = MAJOR(ar->inode->i_sb->s_dev); 678 __entry->dev = ar->inode->i_sb->s_dev;
646 __entry->dev_minor = MINOR(ar->inode->i_sb->s_dev);
647 __entry->ino = ar->inode->i_ino; 679 __entry->ino = ar->inode->i_ino;
648 __entry->flags = ar->flags; 680 __entry->flags = ar->flags;
649 __entry->len = ar->len; 681 __entry->len = ar->len;
@@ -655,8 +687,9 @@ TRACE_EVENT(ext4_request_blocks,
655 __entry->pright = ar->pright; 687 __entry->pright = ar->pright;
656 ), 688 ),
657 689
658 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 690 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %llu goal %llu "
659 __entry->dev_major, __entry->dev_minor, 691 "lleft %llu lright %llu pleft %llu pright %llu ",
692 MAJOR(__entry->dev), MINOR(__entry->dev),
660 (unsigned long) __entry->ino, 693 (unsigned long) __entry->ino,
661 __entry->flags, __entry->len, 694 __entry->flags, __entry->len,
662 (unsigned long long) __entry->logical, 695 (unsigned long long) __entry->logical,
@@ -673,8 +706,7 @@ TRACE_EVENT(ext4_allocate_blocks,
673 TP_ARGS(ar, block), 706 TP_ARGS(ar, block),
674 707
675 TP_STRUCT__entry( 708 TP_STRUCT__entry(
676 __field( int, dev_major ) 709 __field( dev_t, dev )
677 __field( int, dev_minor )
678 __field( ino_t, ino ) 710 __field( ino_t, ino )
679 __field( __u64, block ) 711 __field( __u64, block )
680 __field( unsigned int, flags ) 712 __field( unsigned int, flags )
@@ -688,8 +720,7 @@ TRACE_EVENT(ext4_allocate_blocks,
688 ), 720 ),
689 721
690 TP_fast_assign( 722 TP_fast_assign(
691 __entry->dev_major = MAJOR(ar->inode->i_sb->s_dev); 723 __entry->dev = ar->inode->i_sb->s_dev;
692 __entry->dev_minor = MINOR(ar->inode->i_sb->s_dev);
693 __entry->ino = ar->inode->i_ino; 724 __entry->ino = ar->inode->i_ino;
694 __entry->block = block; 725 __entry->block = block;
695 __entry->flags = ar->flags; 726 __entry->flags = ar->flags;
@@ -702,10 +733,11 @@ TRACE_EVENT(ext4_allocate_blocks,
702 __entry->pright = ar->pright; 733 __entry->pright = ar->pright;
703 ), 734 ),
704 735
705 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ", 736 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %llu "
706 __entry->dev_major, __entry->dev_minor, 737 "goal %llu lleft %llu lright %llu pleft %llu pright %llu",
707 (unsigned long) __entry->ino, __entry->flags, 738 MAJOR(__entry->dev), MINOR(__entry->dev),
708 __entry->len, __entry->block, 739 (unsigned long) __entry->ino,
740 __entry->flags, __entry->len, __entry->block,
709 (unsigned long long) __entry->logical, 741 (unsigned long long) __entry->logical,
710 (unsigned long long) __entry->goal, 742 (unsigned long long) __entry->goal,
711 (unsigned long long) __entry->lleft, 743 (unsigned long long) __entry->lleft,
@@ -721,8 +753,7 @@ TRACE_EVENT(ext4_free_blocks,
721 TP_ARGS(inode, block, count, flags), 753 TP_ARGS(inode, block, count, flags),
722 754
723 TP_STRUCT__entry( 755 TP_STRUCT__entry(
724 __field( int, dev_major ) 756 __field( dev_t, dev )
725 __field( int, dev_minor )
726 __field( ino_t, ino ) 757 __field( ino_t, ino )
727 __field( umode_t, mode ) 758 __field( umode_t, mode )
728 __field( __u64, block ) 759 __field( __u64, block )
@@ -731,8 +762,7 @@ TRACE_EVENT(ext4_free_blocks,
731 ), 762 ),
732 763
733 TP_fast_assign( 764 TP_fast_assign(
734 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 765 __entry->dev = inode->i_sb->s_dev;
735 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
736 __entry->ino = inode->i_ino; 766 __entry->ino = inode->i_ino;
737 __entry->mode = inode->i_mode; 767 __entry->mode = inode->i_mode;
738 __entry->block = block; 768 __entry->block = block;
@@ -741,20 +771,19 @@ TRACE_EVENT(ext4_free_blocks,
741 ), 771 ),
742 772
743 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", 773 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
744 __entry->dev_major, __entry->dev_minor, 774 MAJOR(__entry->dev), MINOR(__entry->dev),
745 (unsigned long) __entry->ino, 775 (unsigned long) __entry->ino,
746 __entry->mode, __entry->block, __entry->count, 776 __entry->mode, __entry->block, __entry->count,
747 __entry->flags) 777 __entry->flags)
748); 778);
749 779
750TRACE_EVENT(ext4_sync_file, 780TRACE_EVENT(ext4_sync_file_enter,
751 TP_PROTO(struct file *file, int datasync), 781 TP_PROTO(struct file *file, int datasync),
752 782
753 TP_ARGS(file, datasync), 783 TP_ARGS(file, datasync),
754 784
755 TP_STRUCT__entry( 785 TP_STRUCT__entry(
756 __field( int, dev_major ) 786 __field( dev_t, dev )
757 __field( int, dev_minor )
758 __field( ino_t, ino ) 787 __field( ino_t, ino )
759 __field( ino_t, parent ) 788 __field( ino_t, parent )
760 __field( int, datasync ) 789 __field( int, datasync )
@@ -763,39 +792,60 @@ TRACE_EVENT(ext4_sync_file,
763 TP_fast_assign( 792 TP_fast_assign(
764 struct dentry *dentry = file->f_path.dentry; 793 struct dentry *dentry = file->f_path.dentry;
765 794
766 __entry->dev_major = MAJOR(dentry->d_inode->i_sb->s_dev); 795 __entry->dev = dentry->d_inode->i_sb->s_dev;
767 __entry->dev_minor = MINOR(dentry->d_inode->i_sb->s_dev);
768 __entry->ino = dentry->d_inode->i_ino; 796 __entry->ino = dentry->d_inode->i_ino;
769 __entry->datasync = datasync; 797 __entry->datasync = datasync;
770 __entry->parent = dentry->d_parent->d_inode->i_ino; 798 __entry->parent = dentry->d_parent->d_inode->i_ino;
771 ), 799 ),
772 800
773 TP_printk("dev %d,%d ino %ld parent %ld datasync %d ", 801 TP_printk("dev %d,%d ino %ld parent %ld datasync %d ",
774 __entry->dev_major, __entry->dev_minor, 802 MAJOR(__entry->dev), MINOR(__entry->dev),
775 (unsigned long) __entry->ino, 803 (unsigned long) __entry->ino,
776 (unsigned long) __entry->parent, __entry->datasync) 804 (unsigned long) __entry->parent, __entry->datasync)
777); 805);
778 806
807TRACE_EVENT(ext4_sync_file_exit,
808 TP_PROTO(struct inode *inode, int ret),
809
810 TP_ARGS(inode, ret),
811
812 TP_STRUCT__entry(
813 __field( int, ret )
814 __field( ino_t, ino )
815 __field( dev_t, dev )
816 ),
817
818 TP_fast_assign(
819 __entry->ret = ret;
820 __entry->ino = inode->i_ino;
821 __entry->dev = inode->i_sb->s_dev;
822 ),
823
824 TP_printk("dev %d,%d ino %ld ret %d",
825 MAJOR(__entry->dev), MINOR(__entry->dev),
826 (unsigned long) __entry->ino,
827 __entry->ret)
828);
829
779TRACE_EVENT(ext4_sync_fs, 830TRACE_EVENT(ext4_sync_fs,
780 TP_PROTO(struct super_block *sb, int wait), 831 TP_PROTO(struct super_block *sb, int wait),
781 832
782 TP_ARGS(sb, wait), 833 TP_ARGS(sb, wait),
783 834
784 TP_STRUCT__entry( 835 TP_STRUCT__entry(
785 __field( int, dev_major ) 836 __field( dev_t, dev )
786 __field( int, dev_minor )
787 __field( int, wait ) 837 __field( int, wait )
788 838
789 ), 839 ),
790 840
791 TP_fast_assign( 841 TP_fast_assign(
792 __entry->dev_major = MAJOR(sb->s_dev); 842 __entry->dev = sb->s_dev;
793 __entry->dev_minor = MINOR(sb->s_dev);
794 __entry->wait = wait; 843 __entry->wait = wait;
795 ), 844 ),
796 845
797 TP_printk("dev %d,%d wait %d", __entry->dev_major, 846 TP_printk("dev %d,%d wait %d",
798 __entry->dev_minor, __entry->wait) 847 MAJOR(__entry->dev), MINOR(__entry->dev),
848 __entry->wait)
799); 849);
800 850
801TRACE_EVENT(ext4_alloc_da_blocks, 851TRACE_EVENT(ext4_alloc_da_blocks,
@@ -804,23 +854,21 @@ TRACE_EVENT(ext4_alloc_da_blocks,
804 TP_ARGS(inode), 854 TP_ARGS(inode),
805 855
806 TP_STRUCT__entry( 856 TP_STRUCT__entry(
807 __field( int, dev_major ) 857 __field( dev_t, dev )
808 __field( int, dev_minor )
809 __field( ino_t, ino ) 858 __field( ino_t, ino )
810 __field( unsigned int, data_blocks ) 859 __field( unsigned int, data_blocks )
811 __field( unsigned int, meta_blocks ) 860 __field( unsigned int, meta_blocks )
812 ), 861 ),
813 862
814 TP_fast_assign( 863 TP_fast_assign(
815 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 864 __entry->dev = inode->i_sb->s_dev;
816 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
817 __entry->ino = inode->i_ino; 865 __entry->ino = inode->i_ino;
818 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 866 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
819 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 867 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
820 ), 868 ),
821 869
822 TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u", 870 TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
823 __entry->dev_major, __entry->dev_minor, 871 MAJOR(__entry->dev), MINOR(__entry->dev),
824 (unsigned long) __entry->ino, 872 (unsigned long) __entry->ino,
825 __entry->data_blocks, __entry->meta_blocks) 873 __entry->data_blocks, __entry->meta_blocks)
826); 874);
@@ -831,8 +879,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
831 TP_ARGS(ac), 879 TP_ARGS(ac),
832 880
833 TP_STRUCT__entry( 881 TP_STRUCT__entry(
834 __field( int, dev_major ) 882 __field( dev_t, dev )
835 __field( int, dev_minor )
836 __field( ino_t, ino ) 883 __field( ino_t, ino )
837 __field( __u16, found ) 884 __field( __u16, found )
838 __field( __u16, groups ) 885 __field( __u16, groups )
@@ -855,8 +902,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
855 ), 902 ),
856 903
857 TP_fast_assign( 904 TP_fast_assign(
858 __entry->dev_major = MAJOR(ac->ac_inode->i_sb->s_dev); 905 __entry->dev = ac->ac_inode->i_sb->s_dev;
859 __entry->dev_minor = MINOR(ac->ac_inode->i_sb->s_dev);
860 __entry->ino = ac->ac_inode->i_ino; 906 __entry->ino = ac->ac_inode->i_ino;
861 __entry->found = ac->ac_found; 907 __entry->found = ac->ac_found;
862 __entry->flags = ac->ac_flags; 908 __entry->flags = ac->ac_flags;
@@ -881,7 +927,7 @@ TRACE_EVENT(ext4_mballoc_alloc,
881 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " 927 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
882 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x " 928 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
883 "tail %u broken %u", 929 "tail %u broken %u",
884 __entry->dev_major, __entry->dev_minor, 930 MAJOR(__entry->dev), MINOR(__entry->dev),
885 (unsigned long) __entry->ino, 931 (unsigned long) __entry->ino,
886 __entry->orig_group, __entry->orig_start, 932 __entry->orig_group, __entry->orig_start,
887 __entry->orig_len, __entry->orig_logical, 933 __entry->orig_len, __entry->orig_logical,
@@ -900,8 +946,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
900 TP_ARGS(ac), 946 TP_ARGS(ac),
901 947
902 TP_STRUCT__entry( 948 TP_STRUCT__entry(
903 __field( int, dev_major ) 949 __field( dev_t, dev )
904 __field( int, dev_minor )
905 __field( ino_t, ino ) 950 __field( ino_t, ino )
906 __field( __u32, orig_logical ) 951 __field( __u32, orig_logical )
907 __field( int, orig_start ) 952 __field( int, orig_start )
@@ -914,8 +959,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
914 ), 959 ),
915 960
916 TP_fast_assign( 961 TP_fast_assign(
917 __entry->dev_major = MAJOR(ac->ac_inode->i_sb->s_dev); 962 __entry->dev = ac->ac_inode->i_sb->s_dev;
918 __entry->dev_minor = MINOR(ac->ac_inode->i_sb->s_dev);
919 __entry->ino = ac->ac_inode->i_ino; 963 __entry->ino = ac->ac_inode->i_ino;
920 __entry->orig_logical = ac->ac_o_ex.fe_logical; 964 __entry->orig_logical = ac->ac_o_ex.fe_logical;
921 __entry->orig_start = ac->ac_o_ex.fe_start; 965 __entry->orig_start = ac->ac_o_ex.fe_start;
@@ -928,7 +972,7 @@ TRACE_EVENT(ext4_mballoc_prealloc,
928 ), 972 ),
929 973
930 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u", 974 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
931 __entry->dev_major, __entry->dev_minor, 975 MAJOR(__entry->dev), MINOR(__entry->dev),
932 (unsigned long) __entry->ino, 976 (unsigned long) __entry->ino,
933 __entry->orig_group, __entry->orig_start, 977 __entry->orig_group, __entry->orig_start,
934 __entry->orig_len, __entry->orig_logical, 978 __entry->orig_len, __entry->orig_logical,
@@ -946,8 +990,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
946 TP_ARGS(sb, inode, group, start, len), 990 TP_ARGS(sb, inode, group, start, len),
947 991
948 TP_STRUCT__entry( 992 TP_STRUCT__entry(
949 __field( int, dev_major ) 993 __field( dev_t, dev )
950 __field( int, dev_minor )
951 __field( ino_t, ino ) 994 __field( ino_t, ino )
952 __field( int, result_start ) 995 __field( int, result_start )
953 __field( __u32, result_group ) 996 __field( __u32, result_group )
@@ -955,8 +998,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
955 ), 998 ),
956 999
957 TP_fast_assign( 1000 TP_fast_assign(
958 __entry->dev_major = MAJOR(sb->s_dev); 1001 __entry->dev = sb->s_dev;
959 __entry->dev_minor = MINOR(sb->s_dev);
960 __entry->ino = inode ? inode->i_ino : 0; 1002 __entry->ino = inode ? inode->i_ino : 0;
961 __entry->result_start = start; 1003 __entry->result_start = start;
962 __entry->result_group = group; 1004 __entry->result_group = group;
@@ -964,7 +1006,7 @@ DECLARE_EVENT_CLASS(ext4__mballoc,
964 ), 1006 ),
965 1007
966 TP_printk("dev %d,%d inode %lu extent %u/%d/%u ", 1008 TP_printk("dev %d,%d inode %lu extent %u/%d/%u ",
967 __entry->dev_major, __entry->dev_minor, 1009 MAJOR(__entry->dev), MINOR(__entry->dev),
968 (unsigned long) __entry->ino, 1010 (unsigned long) __entry->ino,
969 __entry->result_group, __entry->result_start, 1011 __entry->result_group, __entry->result_start,
970 __entry->result_len) 1012 __entry->result_len)
@@ -998,8 +1040,7 @@ TRACE_EVENT(ext4_forget,
998 TP_ARGS(inode, is_metadata, block), 1040 TP_ARGS(inode, is_metadata, block),
999 1041
1000 TP_STRUCT__entry( 1042 TP_STRUCT__entry(
1001 __field( int, dev_major ) 1043 __field( dev_t, dev )
1002 __field( int, dev_minor )
1003 __field( ino_t, ino ) 1044 __field( ino_t, ino )
1004 __field( umode_t, mode ) 1045 __field( umode_t, mode )
1005 __field( int, is_metadata ) 1046 __field( int, is_metadata )
@@ -1007,8 +1048,7 @@ TRACE_EVENT(ext4_forget,
1007 ), 1048 ),
1008 1049
1009 TP_fast_assign( 1050 TP_fast_assign(
1010 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1051 __entry->dev = inode->i_sb->s_dev;
1011 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1012 __entry->ino = inode->i_ino; 1052 __entry->ino = inode->i_ino;
1013 __entry->mode = inode->i_mode; 1053 __entry->mode = inode->i_mode;
1014 __entry->is_metadata = is_metadata; 1054 __entry->is_metadata = is_metadata;
@@ -1016,9 +1056,9 @@ TRACE_EVENT(ext4_forget,
1016 ), 1056 ),
1017 1057
1018 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu", 1058 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1019 __entry->dev_major, __entry->dev_minor, 1059 MAJOR(__entry->dev), MINOR(__entry->dev),
1020 (unsigned long) __entry->ino, __entry->mode, 1060 (unsigned long) __entry->ino,
1021 __entry->is_metadata, __entry->block) 1061 __entry->mode, __entry->is_metadata, __entry->block)
1022); 1062);
1023 1063
1024TRACE_EVENT(ext4_da_update_reserve_space, 1064TRACE_EVENT(ext4_da_update_reserve_space,
@@ -1027,8 +1067,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1027 TP_ARGS(inode, used_blocks), 1067 TP_ARGS(inode, used_blocks),
1028 1068
1029 TP_STRUCT__entry( 1069 TP_STRUCT__entry(
1030 __field( int, dev_major ) 1070 __field( dev_t, dev )
1031 __field( int, dev_minor )
1032 __field( ino_t, ino ) 1071 __field( ino_t, ino )
1033 __field( umode_t, mode ) 1072 __field( umode_t, mode )
1034 __field( __u64, i_blocks ) 1073 __field( __u64, i_blocks )
@@ -1039,8 +1078,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1039 ), 1078 ),
1040 1079
1041 TP_fast_assign( 1080 TP_fast_assign(
1042 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1081 __entry->dev = inode->i_sb->s_dev;
1043 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1044 __entry->ino = inode->i_ino; 1082 __entry->ino = inode->i_ino;
1045 __entry->mode = inode->i_mode; 1083 __entry->mode = inode->i_mode;
1046 __entry->i_blocks = inode->i_blocks; 1084 __entry->i_blocks = inode->i_blocks;
@@ -1050,10 +1088,12 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1050 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1088 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1051 ), 1089 ),
1052 1090
1053 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", 1091 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1054 __entry->dev_major, __entry->dev_minor, 1092 "reserved_data_blocks %d reserved_meta_blocks %d "
1055 (unsigned long) __entry->ino, __entry->mode, 1093 "allocated_meta_blocks %d",
1056 (unsigned long long) __entry->i_blocks, 1094 MAJOR(__entry->dev), MINOR(__entry->dev),
1095 (unsigned long) __entry->ino,
1096 __entry->mode, (unsigned long long) __entry->i_blocks,
1057 __entry->used_blocks, __entry->reserved_data_blocks, 1097 __entry->used_blocks, __entry->reserved_data_blocks,
1058 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks) 1098 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1059); 1099);
@@ -1064,8 +1104,7 @@ TRACE_EVENT(ext4_da_reserve_space,
1064 TP_ARGS(inode, md_needed), 1104 TP_ARGS(inode, md_needed),
1065 1105
1066 TP_STRUCT__entry( 1106 TP_STRUCT__entry(
1067 __field( int, dev_major ) 1107 __field( dev_t, dev )
1068 __field( int, dev_minor )
1069 __field( ino_t, ino ) 1108 __field( ino_t, ino )
1070 __field( umode_t, mode ) 1109 __field( umode_t, mode )
1071 __field( __u64, i_blocks ) 1110 __field( __u64, i_blocks )
@@ -1075,8 +1114,7 @@ TRACE_EVENT(ext4_da_reserve_space,
1075 ), 1114 ),
1076 1115
1077 TP_fast_assign( 1116 TP_fast_assign(
1078 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1117 __entry->dev = inode->i_sb->s_dev;
1079 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1080 __entry->ino = inode->i_ino; 1118 __entry->ino = inode->i_ino;
1081 __entry->mode = inode->i_mode; 1119 __entry->mode = inode->i_mode;
1082 __entry->i_blocks = inode->i_blocks; 1120 __entry->i_blocks = inode->i_blocks;
@@ -1085,8 +1123,9 @@ TRACE_EVENT(ext4_da_reserve_space,
1085 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1123 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1086 ), 1124 ),
1087 1125
1088 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d", 1126 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
1089 __entry->dev_major, __entry->dev_minor, 1127 "reserved_data_blocks %d reserved_meta_blocks %d",
1128 MAJOR(__entry->dev), MINOR(__entry->dev),
1090 (unsigned long) __entry->ino, 1129 (unsigned long) __entry->ino,
1091 __entry->mode, (unsigned long long) __entry->i_blocks, 1130 __entry->mode, (unsigned long long) __entry->i_blocks,
1092 __entry->md_needed, __entry->reserved_data_blocks, 1131 __entry->md_needed, __entry->reserved_data_blocks,
@@ -1099,8 +1138,7 @@ TRACE_EVENT(ext4_da_release_space,
1099 TP_ARGS(inode, freed_blocks), 1138 TP_ARGS(inode, freed_blocks),
1100 1139
1101 TP_STRUCT__entry( 1140 TP_STRUCT__entry(
1102 __field( int, dev_major ) 1141 __field( dev_t, dev )
1103 __field( int, dev_minor )
1104 __field( ino_t, ino ) 1142 __field( ino_t, ino )
1105 __field( umode_t, mode ) 1143 __field( umode_t, mode )
1106 __field( __u64, i_blocks ) 1144 __field( __u64, i_blocks )
@@ -1111,8 +1149,7 @@ TRACE_EVENT(ext4_da_release_space,
1111 ), 1149 ),
1112 1150
1113 TP_fast_assign( 1151 TP_fast_assign(
1114 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 1152 __entry->dev = inode->i_sb->s_dev;
1115 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
1116 __entry->ino = inode->i_ino; 1153 __entry->ino = inode->i_ino;
1117 __entry->mode = inode->i_mode; 1154 __entry->mode = inode->i_mode;
1118 __entry->i_blocks = inode->i_blocks; 1155 __entry->i_blocks = inode->i_blocks;
@@ -1122,8 +1159,10 @@ TRACE_EVENT(ext4_da_release_space,
1122 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1159 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1123 ), 1160 ),
1124 1161
1125 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d", 1162 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1126 __entry->dev_major, __entry->dev_minor, 1163 "reserved_data_blocks %d reserved_meta_blocks %d "
1164 "allocated_meta_blocks %d",
1165 MAJOR(__entry->dev), MINOR(__entry->dev),
1127 (unsigned long) __entry->ino, 1166 (unsigned long) __entry->ino,
1128 __entry->mode, (unsigned long long) __entry->i_blocks, 1167 __entry->mode, (unsigned long long) __entry->i_blocks,
1129 __entry->freed_blocks, __entry->reserved_data_blocks, 1168 __entry->freed_blocks, __entry->reserved_data_blocks,
@@ -1136,20 +1175,19 @@ DECLARE_EVENT_CLASS(ext4__bitmap_load,
1136 TP_ARGS(sb, group), 1175 TP_ARGS(sb, group),
1137 1176
1138 TP_STRUCT__entry( 1177 TP_STRUCT__entry(
1139 __field( int, dev_major ) 1178 __field( dev_t, dev )
1140 __field( int, dev_minor )
1141 __field( __u32, group ) 1179 __field( __u32, group )
1142 1180
1143 ), 1181 ),
1144 1182
1145 TP_fast_assign( 1183 TP_fast_assign(
1146 __entry->dev_major = MAJOR(sb->s_dev); 1184 __entry->dev = sb->s_dev;
1147 __entry->dev_minor = MINOR(sb->s_dev);
1148 __entry->group = group; 1185 __entry->group = group;
1149 ), 1186 ),
1150 1187
1151 TP_printk("dev %d,%d group %u", 1188 TP_printk("dev %d,%d group %u",
1152 __entry->dev_major, __entry->dev_minor, __entry->group) 1189 MAJOR(__entry->dev), MINOR(__entry->dev),
1190 __entry->group)
1153); 1191);
1154 1192
1155DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load, 1193DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
@@ -1166,6 +1204,349 @@ DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1166 TP_ARGS(sb, group) 1204 TP_ARGS(sb, group)
1167); 1205);
1168 1206
1207DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1208
1209 TP_PROTO(struct super_block *sb, unsigned long group),
1210
1211 TP_ARGS(sb, group)
1212);
1213
1214DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1215
1216 TP_PROTO(struct super_block *sb, unsigned long group),
1217
1218 TP_ARGS(sb, group)
1219);
1220
1221TRACE_EVENT(ext4_direct_IO_enter,
1222 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1223
1224 TP_ARGS(inode, offset, len, rw),
1225
1226 TP_STRUCT__entry(
1227 __field( ino_t, ino )
1228 __field( dev_t, dev )
1229 __field( loff_t, pos )
1230 __field( unsigned long, len )
1231 __field( int, rw )
1232 ),
1233
1234 TP_fast_assign(
1235 __entry->ino = inode->i_ino;
1236 __entry->dev = inode->i_sb->s_dev;
1237 __entry->pos = offset;
1238 __entry->len = len;
1239 __entry->rw = rw;
1240 ),
1241
1242 TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d",
1243 MAJOR(__entry->dev), MINOR(__entry->dev),
1244 (unsigned long) __entry->ino,
1245 (unsigned long long) __entry->pos, __entry->len, __entry->rw)
1246);
1247
1248TRACE_EVENT(ext4_direct_IO_exit,
1249 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw, int ret),
1250
1251 TP_ARGS(inode, offset, len, rw, ret),
1252
1253 TP_STRUCT__entry(
1254 __field( ino_t, ino )
1255 __field( dev_t, dev )
1256 __field( loff_t, pos )
1257 __field( unsigned long, len )
1258 __field( int, rw )
1259 __field( int, ret )
1260 ),
1261
1262 TP_fast_assign(
1263 __entry->ino = inode->i_ino;
1264 __entry->dev = inode->i_sb->s_dev;
1265 __entry->pos = offset;
1266 __entry->len = len;
1267 __entry->rw = rw;
1268 __entry->ret = ret;
1269 ),
1270
1271 TP_printk("dev %d,%d ino %lu pos %llu len %lu rw %d ret %d",
1272 MAJOR(__entry->dev), MINOR(__entry->dev),
1273 (unsigned long) __entry->ino,
1274 (unsigned long long) __entry->pos, __entry->len,
1275 __entry->rw, __entry->ret)
1276);
1277
1278TRACE_EVENT(ext4_fallocate_enter,
1279 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1280
1281 TP_ARGS(inode, offset, len, mode),
1282
1283 TP_STRUCT__entry(
1284 __field( ino_t, ino )
1285 __field( dev_t, dev )
1286 __field( loff_t, pos )
1287 __field( loff_t, len )
1288 __field( int, mode )
1289 ),
1290
1291 TP_fast_assign(
1292 __entry->ino = inode->i_ino;
1293 __entry->dev = inode->i_sb->s_dev;
1294 __entry->pos = offset;
1295 __entry->len = len;
1296 __entry->mode = mode;
1297 ),
1298
1299 TP_printk("dev %d,%d ino %ld pos %llu len %llu mode %d",
1300 MAJOR(__entry->dev), MINOR(__entry->dev),
1301 (unsigned long) __entry->ino,
1302 (unsigned long long) __entry->pos,
1303 (unsigned long long) __entry->len, __entry->mode)
1304);
1305
1306TRACE_EVENT(ext4_fallocate_exit,
1307 TP_PROTO(struct inode *inode, loff_t offset, unsigned int max_blocks, int ret),
1308
1309 TP_ARGS(inode, offset, max_blocks, ret),
1310
1311 TP_STRUCT__entry(
1312 __field( ino_t, ino )
1313 __field( dev_t, dev )
1314 __field( loff_t, pos )
1315 __field( unsigned, blocks )
1316 __field( int, ret )
1317 ),
1318
1319 TP_fast_assign(
1320 __entry->ino = inode->i_ino;
1321 __entry->dev = inode->i_sb->s_dev;
1322 __entry->pos = offset;
1323 __entry->blocks = max_blocks;
1324 __entry->ret = ret;
1325 ),
1326
1327 TP_printk("dev %d,%d ino %ld pos %llu blocks %d ret %d",
1328 MAJOR(__entry->dev), MINOR(__entry->dev),
1329 (unsigned long) __entry->ino,
1330 (unsigned long long) __entry->pos, __entry->blocks,
1331 __entry->ret)
1332);
1333
1334TRACE_EVENT(ext4_unlink_enter,
1335 TP_PROTO(struct inode *parent, struct dentry *dentry),
1336
1337 TP_ARGS(parent, dentry),
1338
1339 TP_STRUCT__entry(
1340 __field( ino_t, parent )
1341 __field( ino_t, ino )
1342 __field( loff_t, size )
1343 __field( dev_t, dev )
1344 ),
1345
1346 TP_fast_assign(
1347 __entry->parent = parent->i_ino;
1348 __entry->ino = dentry->d_inode->i_ino;
1349 __entry->size = dentry->d_inode->i_size;
1350 __entry->dev = dentry->d_inode->i_sb->s_dev;
1351 ),
1352
1353 TP_printk("dev %d,%d ino %ld size %lld parent %ld",
1354 MAJOR(__entry->dev), MINOR(__entry->dev),
1355 (unsigned long) __entry->ino, __entry->size,
1356 (unsigned long) __entry->parent)
1357);
1358
1359TRACE_EVENT(ext4_unlink_exit,
1360 TP_PROTO(struct dentry *dentry, int ret),
1361
1362 TP_ARGS(dentry, ret),
1363
1364 TP_STRUCT__entry(
1365 __field( ino_t, ino )
1366 __field( dev_t, dev )
1367 __field( int, ret )
1368 ),
1369
1370 TP_fast_assign(
1371 __entry->ino = dentry->d_inode->i_ino;
1372 __entry->dev = dentry->d_inode->i_sb->s_dev;
1373 __entry->ret = ret;
1374 ),
1375
1376 TP_printk("dev %d,%d ino %ld ret %d",
1377 MAJOR(__entry->dev), MINOR(__entry->dev),
1378 (unsigned long) __entry->ino,
1379 __entry->ret)
1380);
1381
1382DECLARE_EVENT_CLASS(ext4__truncate,
1383 TP_PROTO(struct inode *inode),
1384
1385 TP_ARGS(inode),
1386
1387 TP_STRUCT__entry(
1388 __field( ino_t, ino )
1389 __field( dev_t, dev )
1390 __field( blkcnt_t, blocks )
1391 ),
1392
1393 TP_fast_assign(
1394 __entry->ino = inode->i_ino;
1395 __entry->dev = inode->i_sb->s_dev;
1396 __entry->blocks = inode->i_blocks;
1397 ),
1398
1399 TP_printk("dev %d,%d ino %lu blocks %lu",
1400 MAJOR(__entry->dev), MINOR(__entry->dev),
1401 (unsigned long) __entry->ino, (unsigned long) __entry->blocks)
1402);
1403
1404DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1405
1406 TP_PROTO(struct inode *inode),
1407
1408 TP_ARGS(inode)
1409);
1410
1411DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1412
1413 TP_PROTO(struct inode *inode),
1414
1415 TP_ARGS(inode)
1416);
1417
1418DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1419 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1420 unsigned len, unsigned flags),
1421
1422 TP_ARGS(inode, lblk, len, flags),
1423
1424 TP_STRUCT__entry(
1425 __field( ino_t, ino )
1426 __field( dev_t, dev )
1427 __field( ext4_lblk_t, lblk )
1428 __field( unsigned, len )
1429 __field( unsigned, flags )
1430 ),
1431
1432 TP_fast_assign(
1433 __entry->ino = inode->i_ino;
1434 __entry->dev = inode->i_sb->s_dev;
1435 __entry->lblk = lblk;
1436 __entry->len = len;
1437 __entry->flags = flags;
1438 ),
1439
1440 TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u",
1441 MAJOR(__entry->dev), MINOR(__entry->dev),
1442 (unsigned long) __entry->ino,
1443 (unsigned) __entry->lblk, __entry->len, __entry->flags)
1444);
1445
1446DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1447 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1448 unsigned len, unsigned flags),
1449
1450 TP_ARGS(inode, lblk, len, flags)
1451);
1452
1453DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1454 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1455 unsigned len, unsigned flags),
1456
1457 TP_ARGS(inode, lblk, len, flags)
1458);
1459
1460DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1461 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1462 ext4_fsblk_t pblk, unsigned len, int ret),
1463
1464 TP_ARGS(inode, lblk, pblk, len, ret),
1465
1466 TP_STRUCT__entry(
1467 __field( ino_t, ino )
1468 __field( dev_t, dev )
1469 __field( ext4_lblk_t, lblk )
1470 __field( ext4_fsblk_t, pblk )
1471 __field( unsigned, len )
1472 __field( int, ret )
1473 ),
1474
1475 TP_fast_assign(
1476 __entry->ino = inode->i_ino;
1477 __entry->dev = inode->i_sb->s_dev;
1478 __entry->lblk = lblk;
1479 __entry->pblk = pblk;
1480 __entry->len = len;
1481 __entry->ret = ret;
1482 ),
1483
1484 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
1485 MAJOR(__entry->dev), MINOR(__entry->dev),
1486 (unsigned long) __entry->ino,
1487 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1488 __entry->len, __entry->ret)
1489);
1490
1491DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1492 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1493 ext4_fsblk_t pblk, unsigned len, int ret),
1494
1495 TP_ARGS(inode, lblk, pblk, len, ret)
1496);
1497
1498DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1499 TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1500 ext4_fsblk_t pblk, unsigned len, int ret),
1501
1502 TP_ARGS(inode, lblk, pblk, len, ret)
1503);
1504
1505TRACE_EVENT(ext4_ext_load_extent,
1506 TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1507
1508 TP_ARGS(inode, lblk, pblk),
1509
1510 TP_STRUCT__entry(
1511 __field( ino_t, ino )
1512 __field( dev_t, dev )
1513 __field( ext4_lblk_t, lblk )
1514 __field( ext4_fsblk_t, pblk )
1515 ),
1516
1517 TP_fast_assign(
1518 __entry->ino = inode->i_ino;
1519 __entry->dev = inode->i_sb->s_dev;
1520 __entry->lblk = lblk;
1521 __entry->pblk = pblk;
1522 ),
1523
1524 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1525 MAJOR(__entry->dev), MINOR(__entry->dev),
1526 (unsigned long) __entry->ino,
1527 (unsigned) __entry->lblk, (unsigned long long) __entry->pblk)
1528);
1529
1530TRACE_EVENT(ext4_load_inode,
1531 TP_PROTO(struct inode *inode),
1532
1533 TP_ARGS(inode),
1534
1535 TP_STRUCT__entry(
1536 __field( ino_t, ino )
1537 __field( dev_t, dev )
1538 ),
1539
1540 TP_fast_assign(
1541 __entry->ino = inode->i_ino;
1542 __entry->dev = inode->i_sb->s_dev;
1543 ),
1544
1545 TP_printk("dev %d,%d ino %ld",
1546 MAJOR(__entry->dev), MINOR(__entry->dev),
1547 (unsigned long) __entry->ino)
1548);
1549
1169#endif /* _TRACE_EXT4_H */ 1550#endif /* _TRACE_EXT4_H */
1170 1551
1171/* This part must be outside protection */ 1552/* This part must be outside protection */
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index 7447ea9305b5..bf16545cc977 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -17,19 +17,17 @@ TRACE_EVENT(jbd2_checkpoint,
17 TP_ARGS(journal, result), 17 TP_ARGS(journal, result),
18 18
19 TP_STRUCT__entry( 19 TP_STRUCT__entry(
20 __field( int, dev_major ) 20 __field( dev_t, dev )
21 __field( int, dev_minor )
22 __field( int, result ) 21 __field( int, result )
23 ), 22 ),
24 23
25 TP_fast_assign( 24 TP_fast_assign(
26 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 25 __entry->dev = journal->j_fs_dev->bd_dev;
27 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
28 __entry->result = result; 26 __entry->result = result;
29 ), 27 ),
30 28
31 TP_printk("dev %d,%d result %d", 29 TP_printk("dev %s result %d",
32 __entry->dev_major, __entry->dev_minor, __entry->result) 30 jbd2_dev_to_name(__entry->dev), __entry->result)
33); 31);
34 32
35DECLARE_EVENT_CLASS(jbd2_commit, 33DECLARE_EVENT_CLASS(jbd2_commit,
@@ -39,22 +37,20 @@ DECLARE_EVENT_CLASS(jbd2_commit,
39 TP_ARGS(journal, commit_transaction), 37 TP_ARGS(journal, commit_transaction),
40 38
41 TP_STRUCT__entry( 39 TP_STRUCT__entry(
42 __field( int, dev_major ) 40 __field( dev_t, dev )
43 __field( int, dev_minor )
44 __field( char, sync_commit ) 41 __field( char, sync_commit )
45 __field( int, transaction ) 42 __field( int, transaction )
46 ), 43 ),
47 44
48 TP_fast_assign( 45 TP_fast_assign(
49 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 46 __entry->dev = journal->j_fs_dev->bd_dev;
50 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
51 __entry->sync_commit = commit_transaction->t_synchronous_commit; 47 __entry->sync_commit = commit_transaction->t_synchronous_commit;
52 __entry->transaction = commit_transaction->t_tid; 48 __entry->transaction = commit_transaction->t_tid;
53 ), 49 ),
54 50
55 TP_printk("dev %d,%d transaction %d sync %d", 51 TP_printk("dev %s transaction %d sync %d",
56 __entry->dev_major, __entry->dev_minor, 52 jbd2_dev_to_name(__entry->dev), __entry->transaction,
57 __entry->transaction, __entry->sync_commit) 53 __entry->sync_commit)
58); 54);
59 55
60DEFINE_EVENT(jbd2_commit, jbd2_start_commit, 56DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
@@ -91,24 +87,22 @@ TRACE_EVENT(jbd2_end_commit,
91 TP_ARGS(journal, commit_transaction), 87 TP_ARGS(journal, commit_transaction),
92 88
93 TP_STRUCT__entry( 89 TP_STRUCT__entry(
94 __field( int, dev_major ) 90 __field( dev_t, dev )
95 __field( int, dev_minor )
96 __field( char, sync_commit ) 91 __field( char, sync_commit )
97 __field( int, transaction ) 92 __field( int, transaction )
98 __field( int, head ) 93 __field( int, head )
99 ), 94 ),
100 95
101 TP_fast_assign( 96 TP_fast_assign(
102 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 97 __entry->dev = journal->j_fs_dev->bd_dev;
103 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
104 __entry->sync_commit = commit_transaction->t_synchronous_commit; 98 __entry->sync_commit = commit_transaction->t_synchronous_commit;
105 __entry->transaction = commit_transaction->t_tid; 99 __entry->transaction = commit_transaction->t_tid;
106 __entry->head = journal->j_tail_sequence; 100 __entry->head = journal->j_tail_sequence;
107 ), 101 ),
108 102
109 TP_printk("dev %d,%d transaction %d sync %d head %d", 103 TP_printk("dev %s transaction %d sync %d head %d",
110 __entry->dev_major, __entry->dev_minor, 104 jbd2_dev_to_name(__entry->dev), __entry->transaction,
111 __entry->transaction, __entry->sync_commit, __entry->head) 105 __entry->sync_commit, __entry->head)
112); 106);
113 107
114TRACE_EVENT(jbd2_submit_inode_data, 108TRACE_EVENT(jbd2_submit_inode_data,
@@ -117,20 +111,17 @@ TRACE_EVENT(jbd2_submit_inode_data,
117 TP_ARGS(inode), 111 TP_ARGS(inode),
118 112
119 TP_STRUCT__entry( 113 TP_STRUCT__entry(
120 __field( int, dev_major ) 114 __field( dev_t, dev )
121 __field( int, dev_minor )
122 __field( ino_t, ino ) 115 __field( ino_t, ino )
123 ), 116 ),
124 117
125 TP_fast_assign( 118 TP_fast_assign(
126 __entry->dev_major = MAJOR(inode->i_sb->s_dev); 119 __entry->dev = inode->i_sb->s_dev;
127 __entry->dev_minor = MINOR(inode->i_sb->s_dev);
128 __entry->ino = inode->i_ino; 120 __entry->ino = inode->i_ino;
129 ), 121 ),
130 122
131 TP_printk("dev %d,%d ino %lu", 123 TP_printk("dev %s ino %lu",
132 __entry->dev_major, __entry->dev_minor, 124 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
133 (unsigned long) __entry->ino)
134); 125);
135 126
136TRACE_EVENT(jbd2_run_stats, 127TRACE_EVENT(jbd2_run_stats,
@@ -140,8 +131,7 @@ TRACE_EVENT(jbd2_run_stats,
140 TP_ARGS(dev, tid, stats), 131 TP_ARGS(dev, tid, stats),
141 132
142 TP_STRUCT__entry( 133 TP_STRUCT__entry(
143 __field( int, dev_major ) 134 __field( dev_t, dev )
144 __field( int, dev_minor )
145 __field( unsigned long, tid ) 135 __field( unsigned long, tid )
146 __field( unsigned long, wait ) 136 __field( unsigned long, wait )
147 __field( unsigned long, running ) 137 __field( unsigned long, running )
@@ -154,8 +144,7 @@ TRACE_EVENT(jbd2_run_stats,
154 ), 144 ),
155 145
156 TP_fast_assign( 146 TP_fast_assign(
157 __entry->dev_major = MAJOR(dev); 147 __entry->dev = dev;
158 __entry->dev_minor = MINOR(dev);
159 __entry->tid = tid; 148 __entry->tid = tid;
160 __entry->wait = stats->rs_wait; 149 __entry->wait = stats->rs_wait;
161 __entry->running = stats->rs_running; 150 __entry->running = stats->rs_running;
@@ -167,9 +156,9 @@ TRACE_EVENT(jbd2_run_stats,
167 __entry->blocks_logged = stats->rs_blocks_logged; 156 __entry->blocks_logged = stats->rs_blocks_logged;
168 ), 157 ),
169 158
170 TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u " 159 TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
171 "logging %u handle_count %u blocks %u blocks_logged %u", 160 "logging %u handle_count %u blocks %u blocks_logged %u",
172 __entry->dev_major, __entry->dev_minor, __entry->tid, 161 jbd2_dev_to_name(__entry->dev), __entry->tid,
173 jiffies_to_msecs(__entry->wait), 162 jiffies_to_msecs(__entry->wait),
174 jiffies_to_msecs(__entry->running), 163 jiffies_to_msecs(__entry->running),
175 jiffies_to_msecs(__entry->locked), 164 jiffies_to_msecs(__entry->locked),
@@ -186,8 +175,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
186 TP_ARGS(dev, tid, stats), 175 TP_ARGS(dev, tid, stats),
187 176
188 TP_STRUCT__entry( 177 TP_STRUCT__entry(
189 __field( int, dev_major ) 178 __field( dev_t, dev )
190 __field( int, dev_minor )
191 __field( unsigned long, tid ) 179 __field( unsigned long, tid )
192 __field( unsigned long, chp_time ) 180 __field( unsigned long, chp_time )
193 __field( __u32, forced_to_close ) 181 __field( __u32, forced_to_close )
@@ -196,8 +184,7 @@ TRACE_EVENT(jbd2_checkpoint_stats,
196 ), 184 ),
197 185
198 TP_fast_assign( 186 TP_fast_assign(
199 __entry->dev_major = MAJOR(dev); 187 __entry->dev = dev;
200 __entry->dev_minor = MINOR(dev);
201 __entry->tid = tid; 188 __entry->tid = tid;
202 __entry->chp_time = stats->cs_chp_time; 189 __entry->chp_time = stats->cs_chp_time;
203 __entry->forced_to_close= stats->cs_forced_to_close; 190 __entry->forced_to_close= stats->cs_forced_to_close;
@@ -205,9 +192,9 @@ TRACE_EVENT(jbd2_checkpoint_stats,
205 __entry->dropped = stats->cs_dropped; 192 __entry->dropped = stats->cs_dropped;
206 ), 193 ),
207 194
208 TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u " 195 TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
209 "written %u dropped %u", 196 "written %u dropped %u",
210 __entry->dev_major, __entry->dev_minor, __entry->tid, 197 jbd2_dev_to_name(__entry->dev), __entry->tid,
211 jiffies_to_msecs(__entry->chp_time), 198 jiffies_to_msecs(__entry->chp_time),
212 __entry->forced_to_close, __entry->written, __entry->dropped) 199 __entry->forced_to_close, __entry->written, __entry->dropped)
213); 200);
@@ -220,8 +207,7 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
220 TP_ARGS(journal, first_tid, block_nr, freed), 207 TP_ARGS(journal, first_tid, block_nr, freed),
221 208
222 TP_STRUCT__entry( 209 TP_STRUCT__entry(
223 __field( int, dev_major ) 210 __field( dev_t, dev )
224 __field( int, dev_minor )
225 __field( tid_t, tail_sequence ) 211 __field( tid_t, tail_sequence )
226 __field( tid_t, first_tid ) 212 __field( tid_t, first_tid )
227 __field(unsigned long, block_nr ) 213 __field(unsigned long, block_nr )
@@ -229,18 +215,16 @@ TRACE_EVENT(jbd2_cleanup_journal_tail,
229 ), 215 ),
230 216
231 TP_fast_assign( 217 TP_fast_assign(
232 __entry->dev_major = MAJOR(journal->j_fs_dev->bd_dev); 218 __entry->dev = journal->j_fs_dev->bd_dev;
233 __entry->dev_minor = MINOR(journal->j_fs_dev->bd_dev);
234 __entry->tail_sequence = journal->j_tail_sequence; 219 __entry->tail_sequence = journal->j_tail_sequence;
235 __entry->first_tid = first_tid; 220 __entry->first_tid = first_tid;
236 __entry->block_nr = block_nr; 221 __entry->block_nr = block_nr;
237 __entry->freed = freed; 222 __entry->freed = freed;
238 ), 223 ),
239 224
240 TP_printk("dev %d,%d from %u to %u offset %lu freed %lu", 225 TP_printk("dev %s from %u to %u offset %lu freed %lu",
241 __entry->dev_major, __entry->dev_minor, 226 jbd2_dev_to_name(__entry->dev), __entry->tail_sequence,
242 __entry->tail_sequence, __entry->first_tid, 227 __entry->first_tid, __entry->block_nr, __entry->freed)
243 __entry->block_nr, __entry->freed)
244); 228);
245 229
246#endif /* _TRACE_JBD2_H */ 230#endif /* _TRACE_JBD2_H */
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h
index 7eee77895cb3..4cbbcef6baa8 100644
--- a/include/trace/events/mce.h
+++ b/include/trace/events/mce.h
@@ -17,36 +17,36 @@ TRACE_EVENT(mce_record,
17 TP_STRUCT__entry( 17 TP_STRUCT__entry(
18 __field( u64, mcgcap ) 18 __field( u64, mcgcap )
19 __field( u64, mcgstatus ) 19 __field( u64, mcgstatus )
20 __field( u8, bank )
21 __field( u64, status ) 20 __field( u64, status )
22 __field( u64, addr ) 21 __field( u64, addr )
23 __field( u64, misc ) 22 __field( u64, misc )
24 __field( u64, ip ) 23 __field( u64, ip )
25 __field( u8, cs )
26 __field( u64, tsc ) 24 __field( u64, tsc )
27 __field( u64, walltime ) 25 __field( u64, walltime )
28 __field( u32, cpu ) 26 __field( u32, cpu )
29 __field( u32, cpuid ) 27 __field( u32, cpuid )
30 __field( u32, apicid ) 28 __field( u32, apicid )
31 __field( u32, socketid ) 29 __field( u32, socketid )
30 __field( u8, cs )
31 __field( u8, bank )
32 __field( u8, cpuvendor ) 32 __field( u8, cpuvendor )
33 ), 33 ),
34 34
35 TP_fast_assign( 35 TP_fast_assign(
36 __entry->mcgcap = m->mcgcap; 36 __entry->mcgcap = m->mcgcap;
37 __entry->mcgstatus = m->mcgstatus; 37 __entry->mcgstatus = m->mcgstatus;
38 __entry->bank = m->bank;
39 __entry->status = m->status; 38 __entry->status = m->status;
40 __entry->addr = m->addr; 39 __entry->addr = m->addr;
41 __entry->misc = m->misc; 40 __entry->misc = m->misc;
42 __entry->ip = m->ip; 41 __entry->ip = m->ip;
43 __entry->cs = m->cs;
44 __entry->tsc = m->tsc; 42 __entry->tsc = m->tsc;
45 __entry->walltime = m->time; 43 __entry->walltime = m->time;
46 __entry->cpu = m->extcpu; 44 __entry->cpu = m->extcpu;
47 __entry->cpuid = m->cpuid; 45 __entry->cpuid = m->cpuid;
48 __entry->apicid = m->apicid; 46 __entry->apicid = m->apicid;
49 __entry->socketid = m->socketid; 47 __entry->socketid = m->socketid;
48 __entry->cs = m->cs;
49 __entry->bank = m->bank;
50 __entry->cpuvendor = m->cpuvendor; 50 __entry->cpuvendor = m->cpuvendor;
51 ), 51 ),
52 52
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index c6bae36547e5..21a546d27c0c 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -108,14 +108,14 @@ TRACE_EVENT(module_request,
108 TP_ARGS(name, wait, ip), 108 TP_ARGS(name, wait, ip),
109 109
110 TP_STRUCT__entry( 110 TP_STRUCT__entry(
111 __field( bool, wait )
112 __field( unsigned long, ip ) 111 __field( unsigned long, ip )
112 __field( bool, wait )
113 __string( name, name ) 113 __string( name, name )
114 ), 114 ),
115 115
116 TP_fast_assign( 116 TP_fast_assign(
117 __entry->wait = wait;
118 __entry->ip = ip; 117 __entry->ip = ip;
118 __entry->wait = wait;
119 __assign_str(name, name); 119 __assign_str(name, name);
120 ), 120 ),
121 121
@@ -129,4 +129,3 @@ TRACE_EVENT(module_request,
129 129
130/* This part must be outside protection */ 130/* This part must be outside protection */
131#include <trace/define_trace.h> 131#include <trace/define_trace.h>
132
diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h
index 25fbefdf2f2e..db6c93510f74 100644
--- a/include/trace/events/scsi.h
+++ b/include/trace/events/scsi.h
@@ -184,6 +184,17 @@
184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \ 184 scsi_statusbyte_name(SAM_STAT_ACA_ACTIVE), \
185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED)) 185 scsi_statusbyte_name(SAM_STAT_TASK_ABORTED))
186 186
187#define scsi_prot_op_name(result) { result, #result }
188#define show_prot_op_name(val) \
189 __print_symbolic(val, \
190 scsi_prot_op_name(SCSI_PROT_NORMAL), \
191 scsi_prot_op_name(SCSI_PROT_READ_INSERT), \
192 scsi_prot_op_name(SCSI_PROT_WRITE_STRIP), \
193 scsi_prot_op_name(SCSI_PROT_READ_STRIP), \
194 scsi_prot_op_name(SCSI_PROT_WRITE_INSERT), \
195 scsi_prot_op_name(SCSI_PROT_READ_PASS), \
196 scsi_prot_op_name(SCSI_PROT_WRITE_PASS))
197
187const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int); 198const char *scsi_trace_parse_cdb(struct trace_seq*, unsigned char*, int);
188#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len) 199#define __parse_cdb(cdb, len) scsi_trace_parse_cdb(p, cdb, len)
189 200
@@ -202,6 +213,7 @@ TRACE_EVENT(scsi_dispatch_cmd_start,
202 __field( unsigned int, cmd_len ) 213 __field( unsigned int, cmd_len )
203 __field( unsigned int, data_sglen ) 214 __field( unsigned int, data_sglen )
204 __field( unsigned int, prot_sglen ) 215 __field( unsigned int, prot_sglen )
216 __field( unsigned char, prot_op )
205 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 217 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
206 ), 218 ),
207 219
@@ -214,13 +226,15 @@ TRACE_EVENT(scsi_dispatch_cmd_start,
214 __entry->cmd_len = cmd->cmd_len; 226 __entry->cmd_len = cmd->cmd_len;
215 __entry->data_sglen = scsi_sg_count(cmd); 227 __entry->data_sglen = scsi_sg_count(cmd);
216 __entry->prot_sglen = scsi_prot_sg_count(cmd); 228 __entry->prot_sglen = scsi_prot_sg_count(cmd);
229 __entry->prot_op = scsi_get_prot_op(cmd);
217 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 230 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
218 ), 231 ),
219 232
220 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ 233 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
221 " cmnd=(%s %s raw=%s)", 234 " prot_op=%s cmnd=(%s %s raw=%s)",
222 __entry->host_no, __entry->channel, __entry->id, 235 __entry->host_no, __entry->channel, __entry->id,
223 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 236 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
237 show_prot_op_name(__entry->prot_op),
224 show_opcode_name(__entry->opcode), 238 show_opcode_name(__entry->opcode),
225 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 239 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
226 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len)) 240 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len))
@@ -242,6 +256,7 @@ TRACE_EVENT(scsi_dispatch_cmd_error,
242 __field( unsigned int, cmd_len ) 256 __field( unsigned int, cmd_len )
243 __field( unsigned int, data_sglen ) 257 __field( unsigned int, data_sglen )
244 __field( unsigned int, prot_sglen ) 258 __field( unsigned int, prot_sglen )
259 __field( unsigned char, prot_op )
245 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 260 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
246 ), 261 ),
247 262
@@ -255,13 +270,15 @@ TRACE_EVENT(scsi_dispatch_cmd_error,
255 __entry->cmd_len = cmd->cmd_len; 270 __entry->cmd_len = cmd->cmd_len;
256 __entry->data_sglen = scsi_sg_count(cmd); 271 __entry->data_sglen = scsi_sg_count(cmd);
257 __entry->prot_sglen = scsi_prot_sg_count(cmd); 272 __entry->prot_sglen = scsi_prot_sg_count(cmd);
273 __entry->prot_op = scsi_get_prot_op(cmd);
258 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 274 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
259 ), 275 ),
260 276
261 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \ 277 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u" \
262 " cmnd=(%s %s raw=%s) rtn=%d", 278 " prot_op=%s cmnd=(%s %s raw=%s) rtn=%d",
263 __entry->host_no, __entry->channel, __entry->id, 279 __entry->host_no, __entry->channel, __entry->id,
264 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 280 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
281 show_prot_op_name(__entry->prot_op),
265 show_opcode_name(__entry->opcode), 282 show_opcode_name(__entry->opcode),
266 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 283 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
267 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), 284 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
@@ -284,6 +301,7 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
284 __field( unsigned int, cmd_len ) 301 __field( unsigned int, cmd_len )
285 __field( unsigned int, data_sglen ) 302 __field( unsigned int, data_sglen )
286 __field( unsigned int, prot_sglen ) 303 __field( unsigned int, prot_sglen )
304 __field( unsigned char, prot_op )
287 __dynamic_array(unsigned char, cmnd, cmd->cmd_len) 305 __dynamic_array(unsigned char, cmnd, cmd->cmd_len)
288 ), 306 ),
289 307
@@ -297,14 +315,16 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template,
297 __entry->cmd_len = cmd->cmd_len; 315 __entry->cmd_len = cmd->cmd_len;
298 __entry->data_sglen = scsi_sg_count(cmd); 316 __entry->data_sglen = scsi_sg_count(cmd);
299 __entry->prot_sglen = scsi_prot_sg_count(cmd); 317 __entry->prot_sglen = scsi_prot_sg_count(cmd);
318 __entry->prot_op = scsi_get_prot_op(cmd);
300 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); 319 memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len);
301 ), 320 ),
302 321
303 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \ 322 TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u " \
304 "prot_sgl=%u cmnd=(%s %s raw=%s) result=(driver=%s host=%s " \ 323 "prot_sgl=%u prot_op=%s cmnd=(%s %s raw=%s) result=(driver=" \
305 "message=%s status=%s)", 324 "%s host=%s message=%s status=%s)",
306 __entry->host_no, __entry->channel, __entry->id, 325 __entry->host_no, __entry->channel, __entry->id,
307 __entry->lun, __entry->data_sglen, __entry->prot_sglen, 326 __entry->lun, __entry->data_sglen, __entry->prot_sglen,
327 show_prot_op_name(__entry->prot_op),
308 show_opcode_name(__entry->opcode), 328 show_opcode_name(__entry->opcode),
309 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len), 329 __parse_cdb(__get_dynamic_array(cmnd), __entry->cmd_len),
310 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len), 330 __print_hex(__get_dynamic_array(cmnd), __entry->cmd_len),
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index f10293c41b1e..0c68ae22da22 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -19,14 +19,14 @@ TRACE_EVENT(kfree_skb,
19 19
20 TP_STRUCT__entry( 20 TP_STRUCT__entry(
21 __field( void *, skbaddr ) 21 __field( void *, skbaddr )
22 __field( unsigned short, protocol )
23 __field( void *, location ) 22 __field( void *, location )
23 __field( unsigned short, protocol )
24 ), 24 ),
25 25
26 TP_fast_assign( 26 TP_fast_assign(
27 __entry->skbaddr = skb; 27 __entry->skbaddr = skb;
28 __entry->protocol = ntohs(skb->protocol);
29 __entry->location = location; 28 __entry->location = location;
29 __entry->protocol = ntohs(skb->protocol);
30 ), 30 ),
31 31
32 TP_printk("skbaddr=%p protocol=%u location=%p", 32 TP_printk("skbaddr=%p protocol=%u location=%p",
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 0c864db1a466..28447f1594fa 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -52,6 +52,7 @@ struct atmel_lcdfb_info {
52 u8 bl_power; 52 u8 bl_power;
53#endif 53#endif
54 bool lcdcon_is_backlight; 54 bool lcdcon_is_backlight;
55 bool lcdcon_pol_negative;
55 u8 saved_lcdcon; 56 u8 saved_lcdcon;
56 57
57 u8 default_bpp; 58 u8 default_bpp;
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h
index daabae5817c6..2c8d369190b3 100644
--- a/include/video/sh_mobile_lcdc.h
+++ b/include/video/sh_mobile_lcdc.h
@@ -59,6 +59,8 @@ struct sh_mobile_lcdc_board_cfg {
59 struct sh_mobile_lcdc_sys_bus_ops *sys_ops); 59 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
60 void (*display_on)(void *board_data, struct fb_info *info); 60 void (*display_on)(void *board_data, struct fb_info *info);
61 void (*display_off)(void *board_data); 61 void (*display_off)(void *board_data);
62 int (*set_brightness)(void *board_data, int brightness);
63 int (*get_brightness)(void *board_data);
62}; 64};
63 65
64struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */ 66struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
@@ -66,6 +68,12 @@ struct sh_mobile_lcdc_lcd_size_cfg { /* width and height of panel in mm */
66 unsigned long height; 68 unsigned long height;
67}; 69};
68 70
71/* backlight info */
72struct sh_mobile_lcdc_bl_info {
73 const char *name;
74 int max_brightness;
75};
76
69struct sh_mobile_lcdc_chan_cfg { 77struct sh_mobile_lcdc_chan_cfg {
70 int chan; 78 int chan;
71 int bpp; 79 int bpp;
@@ -76,7 +84,9 @@ struct sh_mobile_lcdc_chan_cfg {
76 int num_cfg; 84 int num_cfg;
77 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg; 85 struct sh_mobile_lcdc_lcd_size_cfg lcd_size_cfg;
78 struct sh_mobile_lcdc_board_cfg board_cfg; 86 struct sh_mobile_lcdc_board_cfg board_cfg;
87 struct sh_mobile_lcdc_bl_info bl_info;
79 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */ 88 struct sh_mobile_lcdc_sys_bus_cfg sys_bus_cfg; /* only for SYSn I/F */
89 int nonstd;
80}; 90};
81 91
82struct sh_mobile_lcdc_info { 92struct sh_mobile_lcdc_info {
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
new file mode 100644
index 000000000000..a2b22f01a51d
--- /dev/null
+++ b/include/xen/balloon.h
@@ -0,0 +1,25 @@
1/******************************************************************************
2 * Xen balloon functionality
3 */
4
5#define RETRY_UNLIMITED 0
6
7struct balloon_stats {
8 /* We aim for 'current allocation' == 'target allocation'. */
9 unsigned long current_pages;
10 unsigned long target_pages;
11 /* Number of pages in high- and low-memory balloons. */
12 unsigned long balloon_low;
13 unsigned long balloon_high;
14 unsigned long schedule_delay;
15 unsigned long max_schedule_delay;
16 unsigned long retry_count;
17 unsigned long max_retry_count;
18};
19
20extern struct balloon_stats balloon_stats;
21
22void balloon_set_new_target(unsigned long target);
23
24int alloc_xenballooned_pages(int nr_pages, struct page** pages);
25void free_xenballooned_pages(int nr_pages, struct page** pages);
diff --git a/include/xen/events.h b/include/xen/events.h
index 00f53ddcc062..f1b87ad48ac7 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -23,6 +23,12 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
23 unsigned long irqflags, 23 unsigned long irqflags,
24 const char *devname, 24 const char *devname,
25 void *dev_id); 25 void *dev_id);
26int bind_interdomain_evtchn_to_irqhandler(unsigned int remote_domain,
27 unsigned int remote_port,
28 irq_handler_t handler,
29 unsigned long irqflags,
30 const char *devname,
31 void *dev_id);
26 32
27/* 33/*
28 * Common unbind function for all event sources. Takes IRQ to unbind from. 34 * Common unbind function for all event sources. Takes IRQ to unbind from.
@@ -41,9 +47,9 @@ static inline void notify_remote_via_evtchn(int port)
41 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send); 47 (void)HYPERVISOR_event_channel_op(EVTCHNOP_send, &send);
42} 48}
43 49
44extern void notify_remote_via_irq(int irq); 50void notify_remote_via_irq(int irq);
45 51
46extern void xen_irq_resume(void); 52void xen_irq_resume(void);
47 53
48/* Clear an irq's pending state, in preparation for polling on it */ 54/* Clear an irq's pending state, in preparation for polling on it */
49void xen_clear_irq_pending(int irq); 55void xen_clear_irq_pending(int irq);
@@ -62,35 +68,29 @@ void xen_poll_irq_timeout(int irq, u64 timeout);
62unsigned irq_from_evtchn(unsigned int evtchn); 68unsigned irq_from_evtchn(unsigned int evtchn);
63 69
64/* Xen HVM evtchn vector callback */ 70/* Xen HVM evtchn vector callback */
65extern void xen_hvm_callback_vector(void); 71void xen_hvm_callback_vector(void);
66extern int xen_have_vector_callback; 72extern int xen_have_vector_callback;
67int xen_set_callback_via(uint64_t via); 73int xen_set_callback_via(uint64_t via);
68void xen_evtchn_do_upcall(struct pt_regs *regs); 74void xen_evtchn_do_upcall(struct pt_regs *regs);
69void xen_hvm_evtchn_do_upcall(void); 75void xen_hvm_evtchn_do_upcall(void);
70 76
71/* Allocate an irq for a physical interrupt, given a gsi. "Legacy" 77/* Allocate a pirq for a physical interrupt, given a gsi. */
72 * GSIs are identity mapped; others are dynamically allocated as 78int xen_allocate_pirq_gsi(unsigned gsi);
73 * usual. */ 79/* Bind a pirq for a physical interrupt to an irq. */
74int xen_allocate_pirq(unsigned gsi, int shareable, char *name); 80int xen_bind_pirq_gsi_to_irq(unsigned gsi,
75int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); 81 unsigned pirq, int shareable, char *name);
76 82
77#ifdef CONFIG_PCI_MSI 83#ifdef CONFIG_PCI_MSI
78/* Allocate an irq and a pirq to be used with MSIs. */ 84/* Allocate a pirq for a MSI style physical interrupt. */
79#define XEN_ALLOC_PIRQ (1 << 0) 85int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
80#define XEN_ALLOC_IRQ (1 << 1) 86/* Bind an PSI pirq to an irq. */
81void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask); 87int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
82int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); 88 int pirq, int vector, const char *name);
83#endif 89#endif
84 90
85/* De-allocates the above mentioned physical interrupt. */ 91/* De-allocates the above mentioned physical interrupt. */
86int xen_destroy_irq(int irq); 92int xen_destroy_irq(int irq);
87 93
88/* Return vector allocated to pirq */
89int xen_vector_from_irq(unsigned pirq);
90
91/* Return gsi allocated to pirq */
92int xen_gsi_from_irq(unsigned pirq);
93
94/* Return irq from pirq */ 94/* Return irq from pirq */
95int xen_irq_from_pirq(unsigned pirq); 95int xen_irq_from_pirq(unsigned pirq);
96 96
diff --git a/include/xen/gntalloc.h b/include/xen/gntalloc.h
new file mode 100644
index 000000000000..76bd58065f4f
--- /dev/null
+++ b/include/xen/gntalloc.h
@@ -0,0 +1,82 @@
1/******************************************************************************
2 * gntalloc.h
3 *
4 * Interface to /dev/xen/gntalloc.
5 *
6 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
7 *
8 * This file is in the public domain.
9 */
10
11#ifndef __LINUX_PUBLIC_GNTALLOC_H__
12#define __LINUX_PUBLIC_GNTALLOC_H__
13
14/*
15 * Allocates a new page and creates a new grant reference.
16 */
17#define IOCTL_GNTALLOC_ALLOC_GREF \
18_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
19struct ioctl_gntalloc_alloc_gref {
20 /* IN parameters */
21 /* The ID of the domain to be given access to the grants. */
22 uint16_t domid;
23 /* Flags for this mapping */
24 uint16_t flags;
25 /* Number of pages to map */
26 uint32_t count;
27 /* OUT parameters */
28 /* The offset to be used on a subsequent call to mmap(). */
29 uint64_t index;
30 /* The grant references of the newly created grant, one per page */
31 /* Variable size, depending on count */
32 uint32_t gref_ids[1];
33};
34
35#define GNTALLOC_FLAG_WRITABLE 1
36
37/*
38 * Deallocates the grant reference, allowing the associated page to be freed if
39 * no other domains are using it.
40 */
41#define IOCTL_GNTALLOC_DEALLOC_GREF \
42_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
43struct ioctl_gntalloc_dealloc_gref {
44 /* IN parameters */
45 /* The offset returned in the map operation */
46 uint64_t index;
47 /* Number of references to unmap */
48 uint32_t count;
49};
50
51/*
52 * Sets up an unmap notification within the page, so that the other side can do
53 * cleanup if this side crashes. Required to implement cross-domain robust
54 * mutexes or close notification on communication channels.
55 *
56 * Each mapped page only supports one notification; multiple calls referring to
57 * the same page overwrite the previous notification. You must clear the
58 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
59 * to occur.
60 */
61#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
62_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
63struct ioctl_gntalloc_unmap_notify {
64 /* IN parameters */
65 /* Offset in the file descriptor for a byte within the page (same as
66 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
67 * be cleared. Otherwise, it can be any byte in the page whose
68 * notification we are adjusting.
69 */
70 uint64_t index;
71 /* Action(s) to take on unmap */
72 uint32_t action;
73 /* Event channel to notify */
74 uint32_t event_channel_port;
75};
76
77/* Clear (set to zero) the byte specified by index */
78#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
79/* Send an interrupt on the indicated event channel */
80#define UNMAP_NOTIFY_SEND_EVENT 0x2
81
82#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */
diff --git a/include/xen/gntdev.h b/include/xen/gntdev.h
index eb23f4188f5a..5304bd3c84c5 100644
--- a/include/xen/gntdev.h
+++ b/include/xen/gntdev.h
@@ -116,4 +116,35 @@ struct ioctl_gntdev_set_max_grants {
116 uint32_t count; 116 uint32_t count;
117}; 117};
118 118
119/*
120 * Sets up an unmap notification within the page, so that the other side can do
121 * cleanup if this side crashes. Required to implement cross-domain robust
122 * mutexes or close notification on communication channels.
123 *
124 * Each mapped page only supports one notification; multiple calls referring to
125 * the same page overwrite the previous notification. You must clear the
126 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
127 * to occur.
128 */
129#define IOCTL_GNTDEV_SET_UNMAP_NOTIFY \
130_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntdev_unmap_notify))
131struct ioctl_gntdev_unmap_notify {
132 /* IN parameters */
133 /* Offset in the file descriptor for a byte within the page (same as
134 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
135 * be cleared. Otherwise, it can be any byte in the page whose
136 * notification we are adjusting.
137 */
138 uint64_t index;
139 /* Action(s) to take on unmap */
140 uint32_t action;
141 /* Event channel to notify */
142 uint32_t event_channel_port;
143};
144
145/* Clear (set to zero) the byte specified by index */
146#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
147/* Send an interrupt on the indicated event channel */
148#define UNMAP_NOTIFY_SEND_EVENT 0x2
149
119#endif /* __LINUX_PUBLIC_GNTDEV_H__ */ 150#endif /* __LINUX_PUBLIC_GNTDEV_H__ */
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index c2d1fa4dc1ee..61e523af3c46 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -51,11 +51,7 @@ typedef uint64_t blkif_sector_t;
51 */ 51 */
52#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 52#define BLKIF_MAX_SEGMENTS_PER_REQUEST 11
53 53
54struct blkif_request { 54struct blkif_request_rw {
55 uint8_t operation; /* BLKIF_OP_??? */
56 uint8_t nr_segments; /* number of segments */
57 blkif_vdev_t handle; /* only for read/write requests */
58 uint64_t id; /* private guest value, echoed in resp */
59 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ 55 blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */
60 struct blkif_request_segment { 56 struct blkif_request_segment {
61 grant_ref_t gref; /* reference to I/O buffer frame */ 57 grant_ref_t gref; /* reference to I/O buffer frame */
@@ -65,6 +61,16 @@ struct blkif_request {
65 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; 61 } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST];
66}; 62};
67 63
64struct blkif_request {
65 uint8_t operation; /* BLKIF_OP_??? */
66 uint8_t nr_segments; /* number of segments */
67 blkif_vdev_t handle; /* only for read/write requests */
68 uint64_t id; /* private guest value, echoed in resp */
69 union {
70 struct blkif_request_rw rw;
71 } u;
72};
73
68struct blkif_response { 74struct blkif_response {
69 uint64_t id; /* copied from request */ 75 uint64_t id; /* copied from request */
70 uint8_t operation; /* copied from request */ 76 uint8_t operation; /* copied from request */
@@ -91,4 +97,25 @@ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response);
91#define VDISK_REMOVABLE 0x2 97#define VDISK_REMOVABLE 0x2
92#define VDISK_READONLY 0x4 98#define VDISK_READONLY 0x4
93 99
100/* Xen-defined major numbers for virtual disks, they look strangely
101 * familiar */
102#define XEN_IDE0_MAJOR 3
103#define XEN_IDE1_MAJOR 22
104#define XEN_SCSI_DISK0_MAJOR 8
105#define XEN_SCSI_DISK1_MAJOR 65
106#define XEN_SCSI_DISK2_MAJOR 66
107#define XEN_SCSI_DISK3_MAJOR 67
108#define XEN_SCSI_DISK4_MAJOR 68
109#define XEN_SCSI_DISK5_MAJOR 69
110#define XEN_SCSI_DISK6_MAJOR 70
111#define XEN_SCSI_DISK7_MAJOR 71
112#define XEN_SCSI_DISK8_MAJOR 128
113#define XEN_SCSI_DISK9_MAJOR 129
114#define XEN_SCSI_DISK10_MAJOR 130
115#define XEN_SCSI_DISK11_MAJOR 131
116#define XEN_SCSI_DISK12_MAJOR 132
117#define XEN_SCSI_DISK13_MAJOR 133
118#define XEN_SCSI_DISK14_MAJOR 134
119#define XEN_SCSI_DISK15_MAJOR 135
120
94#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ 121#endif /* __XEN_PUBLIC_IO_BLKIF_H__ */
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index 518481c95f18..cb94668f6e9f 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -22,50 +22,50 @@
22 22
23/* 23/*
24 * This is the 'wire' format for packets: 24 * This is the 'wire' format for packets:
25 * Request 1: netif_tx_request -- NETTXF_* (any flags) 25 * Request 1: xen_netif_tx_request -- XEN_NETTXF_* (any flags)
26 * [Request 2: netif_tx_extra] (only if request 1 has NETTXF_extra_info) 26 * [Request 2: xen_netif_extra_info] (only if request 1 has XEN_NETTXF_extra_info)
27 * [Request 3: netif_tx_extra] (only if request 2 has XEN_NETIF_EXTRA_MORE) 27 * [Request 3: xen_netif_extra_info] (only if request 2 has XEN_NETIF_EXTRA_MORE)
28 * Request 4: netif_tx_request -- NETTXF_more_data 28 * Request 4: xen_netif_tx_request -- XEN_NETTXF_more_data
29 * Request 5: netif_tx_request -- NETTXF_more_data 29 * Request 5: xen_netif_tx_request -- XEN_NETTXF_more_data
30 * ... 30 * ...
31 * Request N: netif_tx_request -- 0 31 * Request N: xen_netif_tx_request -- 0
32 */ 32 */
33 33
34/* Protocol checksum field is blank in the packet (hardware offload)? */ 34/* Protocol checksum field is blank in the packet (hardware offload)? */
35#define _NETTXF_csum_blank (0) 35#define _XEN_NETTXF_csum_blank (0)
36#define NETTXF_csum_blank (1U<<_NETTXF_csum_blank) 36#define XEN_NETTXF_csum_blank (1U<<_XEN_NETTXF_csum_blank)
37 37
38/* Packet data has been validated against protocol checksum. */ 38/* Packet data has been validated against protocol checksum. */
39#define _NETTXF_data_validated (1) 39#define _XEN_NETTXF_data_validated (1)
40#define NETTXF_data_validated (1U<<_NETTXF_data_validated) 40#define XEN_NETTXF_data_validated (1U<<_XEN_NETTXF_data_validated)
41 41
42/* Packet continues in the next request descriptor. */ 42/* Packet continues in the next request descriptor. */
43#define _NETTXF_more_data (2) 43#define _XEN_NETTXF_more_data (2)
44#define NETTXF_more_data (1U<<_NETTXF_more_data) 44#define XEN_NETTXF_more_data (1U<<_XEN_NETTXF_more_data)
45 45
46/* Packet to be followed by extra descriptor(s). */ 46/* Packet to be followed by extra descriptor(s). */
47#define _NETTXF_extra_info (3) 47#define _XEN_NETTXF_extra_info (3)
48#define NETTXF_extra_info (1U<<_NETTXF_extra_info) 48#define XEN_NETTXF_extra_info (1U<<_XEN_NETTXF_extra_info)
49 49
50struct xen_netif_tx_request { 50struct xen_netif_tx_request {
51 grant_ref_t gref; /* Reference to buffer page */ 51 grant_ref_t gref; /* Reference to buffer page */
52 uint16_t offset; /* Offset within buffer page */ 52 uint16_t offset; /* Offset within buffer page */
53 uint16_t flags; /* NETTXF_* */ 53 uint16_t flags; /* XEN_NETTXF_* */
54 uint16_t id; /* Echoed in response message. */ 54 uint16_t id; /* Echoed in response message. */
55 uint16_t size; /* Packet size in bytes. */ 55 uint16_t size; /* Packet size in bytes. */
56}; 56};
57 57
58/* Types of netif_extra_info descriptors. */ 58/* Types of xen_netif_extra_info descriptors. */
59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */ 59#define XEN_NETIF_EXTRA_TYPE_NONE (0) /* Never used - invalid */
60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */ 60#define XEN_NETIF_EXTRA_TYPE_GSO (1) /* u.gso */
61#define XEN_NETIF_EXTRA_TYPE_MAX (2) 61#define XEN_NETIF_EXTRA_TYPE_MAX (2)
62 62
63/* netif_extra_info flags. */ 63/* xen_netif_extra_info flags. */
64#define _XEN_NETIF_EXTRA_FLAG_MORE (0) 64#define _XEN_NETIF_EXTRA_FLAG_MORE (0)
65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE) 65#define XEN_NETIF_EXTRA_FLAG_MORE (1U<<_XEN_NETIF_EXTRA_FLAG_MORE)
66 66
67/* GSO types - only TCPv4 currently supported. */ 67/* GSO types - only TCPv4 currently supported. */
68#define XEN_NETIF_GSO_TYPE_TCPV4 (1) 68#define XEN_NETIF_GSO_TYPE_TCPV4 (1)
69 69
70/* 70/*
71 * This structure needs to fit within both netif_tx_request and 71 * This structure needs to fit within both netif_tx_request and
@@ -107,7 +107,7 @@ struct xen_netif_extra_info {
107 107
108struct xen_netif_tx_response { 108struct xen_netif_tx_response {
109 uint16_t id; 109 uint16_t id;
110 int16_t status; /* NETIF_RSP_* */ 110 int16_t status; /* XEN_NETIF_RSP_* */
111}; 111};
112 112
113struct xen_netif_rx_request { 113struct xen_netif_rx_request {
@@ -116,25 +116,29 @@ struct xen_netif_rx_request {
116}; 116};
117 117
118/* Packet data has been validated against protocol checksum. */ 118/* Packet data has been validated against protocol checksum. */
119#define _NETRXF_data_validated (0) 119#define _XEN_NETRXF_data_validated (0)
120#define NETRXF_data_validated (1U<<_NETRXF_data_validated) 120#define XEN_NETRXF_data_validated (1U<<_XEN_NETRXF_data_validated)
121 121
122/* Protocol checksum field is blank in the packet (hardware offload)? */ 122/* Protocol checksum field is blank in the packet (hardware offload)? */
123#define _NETRXF_csum_blank (1) 123#define _XEN_NETRXF_csum_blank (1)
124#define NETRXF_csum_blank (1U<<_NETRXF_csum_blank) 124#define XEN_NETRXF_csum_blank (1U<<_XEN_NETRXF_csum_blank)
125 125
126/* Packet continues in the next request descriptor. */ 126/* Packet continues in the next request descriptor. */
127#define _NETRXF_more_data (2) 127#define _XEN_NETRXF_more_data (2)
128#define NETRXF_more_data (1U<<_NETRXF_more_data) 128#define XEN_NETRXF_more_data (1U<<_XEN_NETRXF_more_data)
129 129
130/* Packet to be followed by extra descriptor(s). */ 130/* Packet to be followed by extra descriptor(s). */
131#define _NETRXF_extra_info (3) 131#define _XEN_NETRXF_extra_info (3)
132#define NETRXF_extra_info (1U<<_NETRXF_extra_info) 132#define XEN_NETRXF_extra_info (1U<<_XEN_NETRXF_extra_info)
133
134/* GSO Prefix descriptor. */
135#define _XEN_NETRXF_gso_prefix (4)
136#define XEN_NETRXF_gso_prefix (1U<<_XEN_NETRXF_gso_prefix)
133 137
134struct xen_netif_rx_response { 138struct xen_netif_rx_response {
135 uint16_t id; 139 uint16_t id;
136 uint16_t offset; /* Offset in page of start of received packet */ 140 uint16_t offset; /* Offset in page of start of received packet */
137 uint16_t flags; /* NETRXF_* */ 141 uint16_t flags; /* XEN_NETRXF_* */
138 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */ 142 int16_t status; /* -ve: BLKIF_RSP_* ; +ve: Rx'ed pkt size. */
139}; 143};
140 144
@@ -149,10 +153,10 @@ DEFINE_RING_TYPES(xen_netif_rx,
149 struct xen_netif_rx_request, 153 struct xen_netif_rx_request,
150 struct xen_netif_rx_response); 154 struct xen_netif_rx_response);
151 155
152#define NETIF_RSP_DROPPED -2 156#define XEN_NETIF_RSP_DROPPED -2
153#define NETIF_RSP_ERROR -1 157#define XEN_NETIF_RSP_ERROR -1
154#define NETIF_RSP_OKAY 0 158#define XEN_NETIF_RSP_OKAY 0
155/* No response: used for auxiliary requests (e.g., netif_tx_extra). */ 159/* No response: used for auxiliary requests (e.g., xen_netif_extra_info). */
156#define NETIF_RSP_NULL 1 160#define XEN_NETIF_RSP_NULL 1
157 161
158#endif 162#endif
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index 5fec575a800a..dd55dac340de 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -65,6 +65,39 @@ struct sched_poll {
65DEFINE_GUEST_HANDLE_STRUCT(sched_poll); 65DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
66 66
67/* 67/*
68 * Declare a shutdown for another domain. The main use of this function is
69 * in interpreting shutdown requests and reasons for fully-virtualized
70 * domains. A para-virtualized domain may use SCHEDOP_shutdown directly.
71 * @arg == pointer to sched_remote_shutdown structure.
72 */
73#define SCHEDOP_remote_shutdown 4
74struct sched_remote_shutdown {
75 domid_t domain_id; /* Remote domain ID */
76 unsigned int reason; /* SHUTDOWN_xxx reason */
77};
78
79/*
80 * Latch a shutdown code, so that when the domain later shuts down it
81 * reports this code to the control tools.
82 * @arg == as for SCHEDOP_shutdown.
83 */
84#define SCHEDOP_shutdown_code 5
85
86/*
87 * Setup, poke and destroy a domain watchdog timer.
88 * @arg == pointer to sched_watchdog structure.
89 * With id == 0, setup a domain watchdog timer to cause domain shutdown
90 * after timeout, returns watchdog id.
91 * With id != 0 and timeout == 0, destroy domain watchdog timer.
92 * With id != 0 and timeout != 0, poke watchdog timer and set new timeout.
93 */
94#define SCHEDOP_watchdog 6
95struct sched_watchdog {
96 uint32_t id; /* watchdog ID */
97 uint32_t timeout; /* timeout */
98};
99
100/*
68 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control 101 * Reason codes for SCHEDOP_shutdown. These may be interpreted by control
69 * software to determine the appropriate action. For the most part, Xen does 102 * software to determine the appropriate action. For the most part, Xen does
70 * not care about the shutdown code. 103 * not care about the shutdown code.
@@ -73,5 +106,6 @@ DEFINE_GUEST_HANDLE_STRUCT(sched_poll);
73#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */ 106#define SHUTDOWN_reboot 1 /* Clean up, kill, and then restart. */
74#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ 107#define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */
75#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ 108#define SHUTDOWN_crash 3 /* Tell controller we've crashed. */
109#define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */
76 110
77#endif /* __XEN_PUBLIC_SCHED_H__ */ 111#endif /* __XEN_PUBLIC_SCHED_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 2befa3e2f1bc..b33257bc7e83 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -30,7 +30,7 @@
30#define __HYPERVISOR_stack_switch 3 30#define __HYPERVISOR_stack_switch 3
31#define __HYPERVISOR_set_callbacks 4 31#define __HYPERVISOR_set_callbacks 4
32#define __HYPERVISOR_fpu_taskswitch 5 32#define __HYPERVISOR_fpu_taskswitch 5
33#define __HYPERVISOR_sched_op 6 33#define __HYPERVISOR_sched_op_compat 6
34#define __HYPERVISOR_dom0_op 7 34#define __HYPERVISOR_dom0_op 7
35#define __HYPERVISOR_set_debugreg 8 35#define __HYPERVISOR_set_debugreg 8
36#define __HYPERVISOR_get_debugreg 9 36#define __HYPERVISOR_get_debugreg 9
@@ -52,7 +52,7 @@
52#define __HYPERVISOR_mmuext_op 26 52#define __HYPERVISOR_mmuext_op 26
53#define __HYPERVISOR_acm_op 27 53#define __HYPERVISOR_acm_op 27
54#define __HYPERVISOR_nmi_op 28 54#define __HYPERVISOR_nmi_op 28
55#define __HYPERVISOR_sched_op_new 29 55#define __HYPERVISOR_sched_op 29
56#define __HYPERVISOR_callback_op 30 56#define __HYPERVISOR_callback_op 30
57#define __HYPERVISOR_xenoprof_op 31 57#define __HYPERVISOR_xenoprof_op 31
58#define __HYPERVISOR_event_channel_op 32 58#define __HYPERVISOR_event_channel_op 32
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index 98b92154a264..03c85d7387fb 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -5,9 +5,9 @@
5 5
6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 6DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
7 7
8void xen_pre_suspend(void); 8void xen_arch_pre_suspend(void);
9void xen_post_suspend(int suspend_cancelled); 9void xen_arch_post_suspend(int suspend_cancelled);
10void xen_hvm_post_suspend(int suspend_cancelled); 10void xen_arch_hvm_post_suspend(int suspend_cancelled);
11 11
12void xen_mm_pin_all(void); 12void xen_mm_pin_all(void);
13void xen_mm_unpin_all(void); 13void xen_mm_unpin_all(void);
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 7a1d15ff19b7..5467369e0889 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -92,7 +92,7 @@ struct xenbus_driver {
92 void (*otherend_changed)(struct xenbus_device *dev, 92 void (*otherend_changed)(struct xenbus_device *dev,
93 enum xenbus_state backend_state); 93 enum xenbus_state backend_state);
94 int (*remove)(struct xenbus_device *dev); 94 int (*remove)(struct xenbus_device *dev);
95 int (*suspend)(struct xenbus_device *dev, pm_message_t state); 95 int (*suspend)(struct xenbus_device *dev);
96 int (*resume)(struct xenbus_device *dev); 96 int (*resume)(struct xenbus_device *dev);
97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); 97 int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *);
98 struct device_driver driver; 98 struct device_driver driver;