aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:03:21 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-10-09 10:04:25 -0400
commitffe315012510165ce82e4dd4767f0a5dba9edbf7 (patch)
treef601cd980af9d0ced5ca9aedecef4fa0d2ca0e15 /include
parente2d3a35ee427aaba99b6c68a56609ce276c51270 (diff)
parent4a8e43feeac7996b8de2d5b2823e316917493df4 (diff)
Merge tag 'disintegrate-mtd-20121009' of git://git.infradead.org/users/dhowells/linux-headers
UAPI Disintegration 2012-10-09 Conflicts: MAINTAINERS arch/arm/configs/bcmring_defconfig arch/arm/mach-imx/clk-imx51-imx53.c drivers/mtd/nand/Kconfig drivers/mtd/nand/bcm_umi_nand.c drivers/mtd/nand/nand_bcm_umi.h drivers/mtd/nand/orion_nand.c
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acbuffer.h235
-rw-r--r--include/acpi/acnames.h3
-rw-r--r--include/acpi/acpi.h18
-rw-r--r--include/acpi/acpi_bus.h60
-rw-r--r--include/acpi/acpiosxf.h4
-rw-r--r--include/acpi/acpixf.h13
-rw-r--r--include/acpi/actbl.h60
-rw-r--r--include/acpi/actbl1.h16
-rw-r--r--include/acpi/actbl2.h123
-rw-r--r--include/acpi/actbl3.h13
-rw-r--r--include/acpi/actypes.h7
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/aclinux.h2
-rw-r--r--include/acpi/processor.h9
-rw-r--r--include/asm-generic/Kbuild35
-rw-r--r--include/asm-generic/Kbuild.asm46
-rw-r--r--include/asm-generic/bitops/builtin-__ffs.h15
-rw-r--r--include/asm-generic/bitops/builtin-__fls.h15
-rw-r--r--include/asm-generic/bitops/builtin-ffs.h17
-rw-r--r--include/asm-generic/bitops/builtin-fls.h16
-rw-r--r--include/asm-generic/bitops/le.h10
-rw-r--r--include/asm-generic/bitsperlong.h13
-rw-r--r--include/asm-generic/clkdev.h28
-rw-r--r--include/asm-generic/gpio.h2
-rw-r--r--include/asm-generic/int-l64.h26
-rw-r--r--include/asm-generic/int-ll64.h31
-rw-r--r--include/asm-generic/ioctl.h95
-rw-r--r--include/asm-generic/kvm_para.h5
-rw-r--r--include/asm-generic/mutex-xchg.h11
-rw-r--r--include/asm-generic/param.h17
-rw-r--r--include/asm-generic/pgtable.h72
-rw-r--r--include/asm-generic/resource.h66
-rw-r--r--include/asm-generic/siginfo.h297
-rw-r--r--include/asm-generic/signal.h117
-rw-r--r--include/asm-generic/statfs.h81
-rw-r--r--include/asm-generic/termios.h49
-rw-r--r--include/asm-generic/unistd.h909
-rw-r--r--include/asm-generic/xor.h4
-rw-r--r--include/clocksource/arm_generic.h21
-rw-r--r--include/crypto/cast5.h27
-rw-r--r--include/crypto/cast6.h28
-rw-r--r--include/crypto/internal/hash.h2
-rw-r--r--include/drm/Kbuild15
-rw-r--r--include/drm/drmP.h22
-rw-r--r--include/drm/drm_buffer.h2
-rw-r--r--include/drm/drm_crtc.h31
-rw-r--r--include/drm/drm_dp_helper.h101
-rw-r--r--include/drm/drm_encoder_slave.h4
-rw-r--r--include/drm/drm_fb_cma_helper.h27
-rw-r--r--include/drm/drm_gem_cma_helper.h44
-rw-r--r--include/drm/drm_memory.h2
-rw-r--r--include/drm/exynos_drm.h175
-rw-r--r--include/drm/i915_drm.h886
-rw-r--r--include/drm/intel-gtt.h10
-rw-r--r--include/drm/ttm/ttm_bo_api.h2
-rw-r--r--include/drm/ttm/ttm_bo_driver.h16
-rw-r--r--include/drm/ttm/ttm_execbuf_util.h2
-rw-r--r--include/drm/ttm/ttm_lock.h2
-rw-r--r--include/drm/ttm/ttm_object.h2
-rw-r--r--include/drm/ttm/ttm_page_alloc.h4
-rw-r--r--include/linux/Kbuild18
-rw-r--r--include/linux/acpi.h6
-rw-r--r--include/linux/amba/pl022.h2
-rw-r--r--include/linux/amba/serial.h1
-rw-r--r--include/linux/ata.h30
-rw-r--r--include/linux/atmel-ssc.h1
-rw-r--r--include/linux/atmel_tc.h2
-rw-r--r--include/linux/atomic.h25
-rw-r--r--include/linux/audit.h214
-rw-r--r--include/linux/bcd.h17
-rw-r--r--include/linux/bcm2835_timer.h22
-rw-r--r--include/linux/bcma/bcma.h2
-rw-r--r--include/linux/binfmts.h3
-rw-r--r--include/linux/blkdev.h14
-rw-r--r--include/linux/cd1400.h292
-rw-r--r--include/linux/cdk.h486
-rw-r--r--include/linux/ceph/ceph_fs.h4
-rw-r--r--include/linux/ceph/debugfs.h4
-rw-r--r--include/linux/ceph/decode.h2
-rw-r--r--include/linux/ceph/libceph.h14
-rw-r--r--include/linux/ceph/mdsmap.h2
-rw-r--r--include/linux/ceph/messenger.h4
-rw-r--r--include/linux/ceph/mon_client.h3
-rw-r--r--include/linux/ceph/msgpool.h2
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--include/linux/ceph/osdmap.h10
-rw-r--r--include/linux/ceph/rados.h2
-rw-r--r--include/linux/ceph/types.h6
-rw-r--r--include/linux/cgroup.h40
-rw-r--r--include/linux/cgroup_subsys.h24
-rw-r--r--include/linux/clk-provider.h6
-rw-r--r--include/linux/clk/bcm2835.h24
-rw-r--r--include/linux/clockchips.h8
-rw-r--r--include/linux/compaction.h19
-rw-r--r--include/linux/compat.h8
-rw-r--r--include/linux/compiler-gcc4.h7
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/comstats.h119
-rw-r--r--include/linux/coredump.h5
-rw-r--r--include/linux/cpuidle.h4
-rw-r--r--include/linux/crush/mapper.h2
-rw-r--r--include/linux/dcache.h2
-rw-r--r--include/linux/device.h92
-rw-r--r--include/linux/dmaengine.h7
-rw-r--r--include/linux/drbd_tag_magic.h8
-rw-r--r--include/linux/dvb/frontend.h61
-rw-r--r--include/linux/dvb/version.h2
-rw-r--r--include/linux/efi-bgrt.h21
-rw-r--r--include/linux/efi.h10
-rw-r--r--include/linux/elf.h10
-rw-r--r--include/linux/etherdevice.h11
-rw-r--r--include/linux/ethtool.h17
-rw-r--r--include/linux/eventpoll.h1
-rw-r--r--include/linux/extcon.h18
-rw-r--r--include/linux/extcon/extcon-adc-jack.h71
-rw-r--r--include/linux/falloc.h1
-rw-r--r--include/linux/fdtable.h39
-rw-r--r--include/linux/file.h35
-rw-r--r--include/linux/filter.h7
-rw-r--r--include/linux/firewire.h12
-rw-r--r--include/linux/firmware.h15
-rw-r--r--include/linux/frontswap.h2
-rw-r--r--include/linux/fs.h18
-rw-r--r--include/linux/fsl_devices.h2
-rw-r--r--include/linux/ftrace.h158
-rw-r--r--include/linux/genalloc.h27
-rw-r--r--include/linux/generic_serial.h35
-rw-r--r--include/linux/gfp.h9
-rw-r--r--include/linux/hardirq.h8
-rw-r--r--include/linux/hash.h10
-rw-r--r--include/linux/hid-sensor-hub.h160
-rw-r--r--include/linux/hid-sensor-ids.h112
-rw-r--r--include/linux/hid.h5
-rw-r--r--include/linux/huge_mm.h3
-rw-r--r--include/linux/hyperv.h101
-rw-r--r--include/linux/i2c-mux-gpio.h5
-rw-r--r--include/linux/i2c-mux.h1
-rw-r--r--include/linux/i2c-pnx.h1
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/i2c/pca954x.h1
-rw-r--r--include/linux/i2c/pcf857x.h3
-rw-r--r--include/linux/i2c/twl.h6
-rw-r--r--include/linux/idr.h10
-rw-r--r--include/linux/ieee80211.h80
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_link.h34
-rw-r--r--include/linux/if_team.h41
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--include/linux/iio/adc/ad_sigma_delta.h173
-rw-r--r--include/linux/iio/buffer.h6
-rw-r--r--include/linux/iio/consumer.h44
-rw-r--r--include/linux/iio/frequency/adf4350.h2
-rw-r--r--include/linux/iio/iio.h65
-rw-r--r--include/linux/iio/kfifo_buf.h3
-rw-r--r--include/linux/iio/machine.h5
-rw-r--r--include/linux/iio/trigger.h13
-rw-r--r--include/linux/iio/trigger_consumer.h11
-rw-r--r--include/linux/iio/types.h1
-rw-r--r--include/linux/ima.h27
-rw-r--r--include/linux/inet_diag.h1
-rw-r--r--include/linux/inetdevice.h11
-rw-r--r--include/linux/init.h27
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/input.h35
-rw-r--r--include/linux/input/mt.h57
-rw-r--r--include/linux/input/tegra_kbc.h62
-rw-r--r--include/linux/integrity.h7
-rw-r--r--include/linux/interrupt.h2
-rw-r--r--include/linux/interval_tree.h27
-rw-r--r--include/linux/interval_tree_generic.h191
-rw-r--r--include/linux/iommu.h42
-rw-r--r--include/linux/ioport.h3
-rw-r--r--include/linux/ip6_tunnel.h17
-rw-r--r--include/linux/ipc.h9
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/irqchip/bcm2835.h (renamed from include/linux/mfd/anatop.h)27
-rw-r--r--include/linux/irqdesc.h2
-rw-r--r--include/linux/istallion.h123
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kbd_kern.h13
-rw-r--r--include/linux/kdb.h29
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/kernel_stat.h8
-rw-r--r--include/linux/key.h9
-rw-r--r--include/linux/kgdb.h13
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/kprobes.h27
-rw-r--r--include/linux/kref.h18
-rw-r--r--include/linux/kthread.h11
-rw-r--r--include/linux/ktime.h7
-rw-r--r--include/linux/kvm.h25
-rw-r--r--include/linux/kvm_host.h149
-rw-r--r--include/linux/leds.h16
-rw-r--r--include/linux/libata.h19
-rw-r--r--include/linux/loop.h2
-rw-r--r--include/linux/mISDNhw.h2
-rw-r--r--include/linux/mdio.h83
-rw-r--r--include/linux/memblock.h3
-rw-r--r--include/linux/memcontrol.h14
-rw-r--r--include/linux/memory.h2
-rw-r--r--include/linux/memory_hotplug.h3
-rw-r--r--include/linux/mempolicy.h4
-rw-r--r--include/linux/mfd/88pm860x.h132
-rw-r--r--include/linux/mfd/ab3100.h129
-rw-r--r--include/linux/mfd/abx500.h117
-rw-r--r--include/linux/mfd/abx500/ab8500-codec.h6
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/core.h4
-rw-r--r--include/linux/mfd/da9055/core.h94
-rw-r--r--include/linux/mfd/da9055/pdata.h32
-rw-r--r--include/linux/mfd/da9055/reg.h699
-rw-r--r--include/linux/mfd/dbx500-prcmu.h1
-rw-r--r--include/linux/mfd/lp8788-isink.h52
-rw-r--r--include/linux/mfd/lp8788.h364
-rw-r--r--include/linux/mfd/lpc_ich.h1
-rw-r--r--include/linux/mfd/max77686.h1
-rw-r--r--include/linux/mfd/max8907.h252
-rw-r--r--include/linux/mfd/max8925.h26
-rw-r--r--include/linux/mfd/max8998.h2
-rw-r--r--include/linux/mfd/palmas.h232
-rw-r--r--include/linux/mfd/rc5t583.h22
-rw-r--r--include/linux/mfd/smsc.h109
-rw-r--r--include/linux/mfd/syscon.h23
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h319
-rw-r--r--include/linux/mfd/tc3589x.h1
-rw-r--r--include/linux/mfd/tps65217.h30
-rw-r--r--include/linux/mfd/tps6586x.h2
-rw-r--r--include/linux/mfd/tps65910.h13
-rw-r--r--include/linux/mfd/twl6040.h12
-rw-r--r--include/linux/mfd/wm8994/pdata.h4
-rw-r--r--include/linux/micrel_phy.h19
-rw-r--r--include/linux/mlx4/device.h82
-rw-r--r--include/linux/mlx4/driver.h2
-rw-r--r--include/linux/mlx4/qp.h3
-rw-r--r--include/linux/mm.h140
-rw-r--r--include/linux/mm_types.h16
-rw-r--r--include/linux/mman.h1
-rw-r--r--include/linux/mmc/card.h1
-rw-r--r--include/linux/mmu_notifier.h60
-rw-r--r--include/linux/mmzone.h10
-rw-r--r--include/linux/mod_devicetable.h10
-rw-r--r--include/linux/mtd/partitions.h3
-rw-r--r--include/linux/mv643xx_eth.h2
-rw-r--r--include/linux/nbd.h15
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h59
-rw-r--r--include/linux/netfilter.h14
-rw-r--r--include/linux/netfilter/ipset/ip_set.h15
-rw-r--r--include/linux/netfilter/ipset/ip_set_ahash.h106
-rw-r--r--include/linux/netfilter/nf_conntrack_amanda.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h7
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h15
-rw-r--r--include/linux/netfilter/nf_conntrack_h323_asn1.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_irc.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h23
-rw-r--r--include/linux/netfilter/nf_nat.h8
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h8
-rw-r--r--include/linux/netfilter/nfnetlink_queue.h1
-rw-r--r--include/linux/netfilter/xt_time.h5
-rw-r--r--include/linux/netfilter_ipv4.h1
-rw-r--r--include/linux/netfilter_ipv6/Kbuild1
-rw-r--r--include/linux/netfilter_ipv6/ip6t_NPT.h16
-rw-r--r--include/linux/netlink.h40
-rw-r--r--include/linux/netpoll.h42
-rw-r--r--include/linux/nfc.h11
-rw-r--r--include/linux/nfs_fs.h5
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h3
-rw-r--r--include/linux/nl80211.h24
-rw-r--r--include/linux/nvme.h2
-rw-r--r--include/linux/nx842.h11
-rw-r--r--include/linux/of.h15
-rw-r--r--include/linux/of_address.h1
-rw-r--r--include/linux/of_irq.h5
-rw-r--r--include/linux/of_mdio.h33
-rw-r--r--include/linux/omap3isp.h6
-rw-r--r--include/linux/omapfb.h7
-rw-r--r--include/linux/oom.h11
-rw-r--r--include/linux/opp.h8
-rw-r--r--include/linux/packet_diag.h72
-rw-r--r--include/linux/page-isolation.h7
-rw-r--r--include/linux/pageblock-flags.h19
-rw-r--r--include/linux/pci-acpi.h17
-rw-r--r--include/linux/pci.h55
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/pci_regs.h7
-rw-r--r--include/linux/pcieport_if.h2
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/perf_event.h66
-rw-r--r--include/linux/perf_regs.h25
-rw-r--r--include/linux/pinctrl/consumer.h5
-rw-r--r--include/linux/pinctrl/machine.h2
-rw-r--r--include/linux/pinctrl/pinctrl-state.h15
-rw-r--r--include/linux/pinctrl/pinctrl.h2
-rw-r--r--include/linux/pinctrl/pinmux.h2
-rw-r--r--include/linux/platform_data/ad5755.h103
-rw-r--r--include/linux/platform_data/ad7791.h17
-rw-r--r--include/linux/platform_data/asoc-imx-ssi.h21
-rw-r--r--include/linux/platform_data/asoc-kirkwood.h7
-rw-r--r--include/linux/platform_data/asoc-mx27vis.h11
-rw-r--r--include/linux/platform_data/asoc-palm27x.h8
-rw-r--r--include/linux/platform_data/asoc-s3c.h59
-rw-r--r--include/linux/platform_data/asoc-s3c24xx_simtec.h34
-rw-r--r--include/linux/platform_data/asoc-ti-mcbsp.h60
-rw-r--r--include/linux/platform_data/ata-pxa.h33
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h36
-rw-r--r--include/linux/platform_data/atmel-aes.h2
-rw-r--r--include/linux/platform_data/camera-mx1.h35
-rw-r--r--include/linux/platform_data/camera-mx2.h44
-rw-r--r--include/linux/platform_data/camera-mx3.h48
-rw-r--r--include/linux/platform_data/camera-pxa.h44
-rw-r--r--include/linux/platform_data/clk-realview.h1
-rw-r--r--include/linux/platform_data/clk-ux500.h17
-rw-r--r--include/linux/platform_data/crypto-ux500.h22
-rw-r--r--include/linux/platform_data/davinci_asp.h105
-rw-r--r--include/linux/platform_data/dma-atmel.h61
-rw-r--r--include/linux/platform_data/dma-ep93xx.h93
-rw-r--r--include/linux/platform_data/dma-imx-sdma.h59
-rw-r--r--include/linux/platform_data/dma-imx.h67
-rw-r--r--include/linux/platform_data/dma-mmp_tdma.h35
-rw-r--r--include/linux/platform_data/dma-mv_xor.h24
-rw-r--r--include/linux/platform_data/dsp-omap.h34
-rw-r--r--include/linux/platform_data/eth-netx.h27
-rw-r--r--include/linux/platform_data/gpio-omap.h217
-rw-r--r--include/linux/platform_data/hwmon-s3c.h51
-rw-r--r--include/linux/platform_data/i2c-davinci.h26
-rw-r--r--include/linux/platform_data/i2c-imx.h21
-rw-r--r--include/linux/platform_data/i2c-nuc900.h9
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h77
-rw-r--r--include/linux/platform_data/irda-pxaficp.h25
-rw-r--r--include/linux/platform_data/keyboard-pxa930_rotary.h20
-rw-r--r--include/linux/platform_data/keyboard-spear.h164
-rw-r--r--include/linux/platform_data/keypad-ep93xx.h35
-rw-r--r--include/linux/platform_data/keypad-nomadik-ske.h50
-rw-r--r--include/linux/platform_data/keypad-omap.h52
-rw-r--r--include/linux/platform_data/keypad-pxa27x.h73
-rw-r--r--include/linux/platform_data/keypad-w90p910.h15
-rw-r--r--include/linux/platform_data/keyscan-davinci.h42
-rw-r--r--include/linux/platform_data/lcd-mipid.h29
-rw-r--r--include/linux/platform_data/leds-kirkwood-netxbig.h55
-rw-r--r--include/linux/platform_data/leds-kirkwood-ns2.h26
-rw-r--r--include/linux/platform_data/leds-s3c24xx.h28
-rw-r--r--include/linux/platform_data/lm3630_bl.h57
-rw-r--r--include/linux/platform_data/lm3639_bl.h69
-rw-r--r--include/linux/platform_data/lp855x.h2
-rw-r--r--include/linux/platform_data/lp8727.h51
-rw-r--r--include/linux/platform_data/max197.h21
-rw-r--r--include/linux/platform_data/max310x.h67
-rw-r--r--include/linux/platform_data/mfd-mcp-sa11x0.h22
-rw-r--r--include/linux/platform_data/mipi-csis.h43
-rw-r--r--include/linux/platform_data/mmc-davinci.h39
-rw-r--r--include/linux/platform_data/mmc-esdhc-imx.h43
-rw-r--r--include/linux/platform_data/mmc-msm_sdcc.h30
-rw-r--r--include/linux/platform_data/mmc-mvsdio.h20
-rw-r--r--include/linux/platform_data/mmc-mxcmmc.h39
-rw-r--r--include/linux/platform_data/mmc-pxamci.h28
-rw-r--r--include/linux/platform_data/mmc-s3cmci.h52
-rw-r--r--include/linux/platform_data/mmc-sdhci-tegra.h28
-rw-r--r--include/linux/platform_data/mouse-pxa930_trkball.h10
-rw-r--r--include/linux/platform_data/mtd-davinci-aemif.h36
-rw-r--r--include/linux/platform_data/mtd-davinci.h90
-rw-r--r--include/linux/platform_data/mtd-mxc_nand.h32
-rw-r--r--include/linux/platform_data/mtd-nand-omap2.h43
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h79
-rw-r--r--include/linux/platform_data/mtd-nand-s3c2410.h67
-rw-r--r--include/linux/platform_data/mtd-nomadik-nand.h16
-rw-r--r--include/linux/platform_data/mtd-onenand-omap2.h53
-rw-r--r--include/linux/platform_data/mtd-orion_nand.h26
-rw-r--r--include/linux/platform_data/omap-twl4030.h32
-rw-r--r--include/linux/platform_data/omap1_bl.h11
-rw-r--r--include/linux/platform_data/pcmcia-pxa2xx_viper.h11
-rw-r--r--include/linux/platform_data/pinctrl-coh901.h26
-rw-r--r--include/linux/platform_data/remoteproc-omap.h59
-rw-r--r--include/linux/platform_data/sc18is602.h19
-rw-r--r--include/linux/platform_data/sccnxp.h93
-rw-r--r--include/linux/platform_data/serial-imx.h35
-rw-r--r--include/linux/platform_data/shmob_drm.h99
-rw-r--r--include/linux/platform_data/sht15.h (renamed from include/linux/sht15.h)1
-rw-r--r--include/linux/platform_data/spi-davinci.h89
-rw-r--r--include/linux/platform_data/spi-ep93xx.h29
-rw-r--r--include/linux/platform_data/spi-imx.h27
-rw-r--r--include/linux/platform_data/spi-nuc900.h35
-rw-r--r--include/linux/platform_data/spi-omap2-mcspi.h23
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h68
-rw-r--r--include/linux/platform_data/touchscreen-s3c2410.h25
-rw-r--r--include/linux/platform_data/usb-davinci.h59
-rw-r--r--include/linux/platform_data/usb-ehci-mxc.h59
-rw-r--r--include/linux/platform_data/usb-ehci-orion.h26
-rw-r--r--include/linux/platform_data/usb-ehci-s5p.h21
-rw-r--r--include/linux/platform_data/usb-exynos.h21
-rw-r--r--include/linux/platform_data/usb-imx_udc.h23
-rw-r--r--include/linux/platform_data/usb-musb-ux500.h25
-rw-r--r--include/linux/platform_data/usb-mx2.h38
-rw-r--r--include/linux/platform_data/usb-ohci-pxa27x.h36
-rw-r--r--include/linux/platform_data/usb-ohci-s3c2410.h43
-rw-r--r--include/linux/platform_data/usb-pxa3xx-ulpi.h35
-rw-r--r--include/linux/platform_data/usb-s3c2410_udc.h44
-rw-r--r--include/linux/platform_data/video-ep93xx.h56
-rw-r--r--include/linux/platform_data/video-imxfb.h84
-rw-r--r--include/linux/platform_data/video-msm_fb.h147
-rw-r--r--include/linux/platform_data/video-mx3fb.h53
-rw-r--r--include/linux/platform_data/video-nuc900fb.h83
-rw-r--r--include/linux/platform_data/video-pxafb.h175
-rw-r--r--include/linux/platform_data/video-vt8500lcdfb.h31
-rw-r--r--include/linux/platform_data/voltage-omap.h39
-rw-r--r--include/linux/platform_device.h4
-rw-r--r--include/linux/pm.h7
-rw-r--r--include/linux/pm_domain.h92
-rw-r--r--include/linux/pnfs_osd_xdr.h1
-rw-r--r--include/linux/posix_acl.h8
-rw-r--r--include/linux/posix_acl_xattr.h18
-rw-r--r--include/linux/power/charger-manager.h47
-rw-r--r--include/linux/power/generic-adc-battery.h29
-rw-r--r--include/linux/power/smartreflex.h2
-rw-r--r--include/linux/power_supply.h5
-rw-r--r--include/linux/pps_kernel.h9
-rw-r--r--include/linux/prio_tree.h120
-rw-r--r--include/linux/projid.h104
-rw-r--r--include/linux/pstore.h8
-rw-r--r--include/linux/ptp_clock_kernel.h21
-rw-r--r--include/linux/ptrace.h2
-rw-r--r--include/linux/quota.h136
-rw-r--r--include/linux/quotaops.h6
-rw-r--r--include/linux/rbtree.h119
-rw-r--r--include/linux/rbtree_augmented.h223
-rw-r--r--include/linux/rcupdate.h21
-rw-r--r--include/linux/regmap.h3
-rw-r--r--include/linux/regulator/consumer.h15
-rw-r--r--include/linux/regulator/driver.h18
-rw-r--r--include/linux/regulator/fan53555.h60
-rw-r--r--include/linux/regulator/machine.h2
-rw-r--r--include/linux/remoteproc.h24
-rw-r--r--include/linux/rfkill.h31
-rw-r--r--include/linux/rio.h21
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h36
-rw-r--r--include/linux/rtc-ds2404.h20
-rw-r--r--include/linux/rtc.h2
-rw-r--r--include/linux/sc26198.h533
-rw-r--r--include/linux/sched.h28
-rw-r--r--include/linux/screen_info.h2
-rw-r--r--include/linux/security.h38
-rw-r--r--include/linux/seq_file.h14
-rw-r--r--include/linux/serial.h81
-rw-r--r--include/linux/serial167.h157
-rw-r--r--include/linux/serial_8250.h33
-rw-r--r--include/linux/serial_core.h8
-rw-r--r--include/linux/serial_reg.h4
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/skbuff.h9
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/slab_def.h27
-rw-r--r--include/linux/slob_def.h6
-rw-r--r--include/linux/smpboot.h43
-rw-r--r--include/linux/snmp.h16
-rw-r--r--include/linux/spi/mxs-spi.h150
-rw-r--r--include/linux/stallion.h147
-rw-r--r--include/linux/ste_modem_shm.h56
-rw-r--r--include/linux/stmmac.h1
-rw-r--r--include/linux/string.h2
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/swiotlb.h1
-rw-r--r--include/linux/task_work.h3
-rw-r--r--include/linux/tcp.h49
-rw-r--r--include/linux/tcp_metrics.h54
-rw-r--r--include/linux/ti_wilink_st.h3
-rw-r--r--include/linux/time.h29
-rw-r--r--include/linux/timer.h165
-rw-r--r--include/linux/timerqueue.h2
-rw-r--r--include/linux/tipc_config.h8
-rw-r--r--include/linux/topology.h2
-rw-r--r--include/linux/tpm.h4
-rw-r--r--include/linux/tracepoint.h28
-rw-r--r--include/linux/tsacct_kern.h8
-rw-r--r--include/linux/tty.h96
-rw-r--r--include/linux/tty_driver.h47
-rw-r--r--include/linux/tty_flags.h78
-rw-r--r--include/linux/uinput.h27
-rw-r--r--include/linux/uprobes.h15
-rw-r--r--include/linux/usb.h32
-rw-r--r--include/linux/usb/ch11.h4
-rw-r--r--include/linux/usb/composite.h97
-rw-r--r--include/linux/usb/ehci_def.h35
-rw-r--r--include/linux/usb/ehci_pdriver.h8
-rw-r--r--include/linux/usb/ezusb.h16
-rw-r--r--include/linux/usb/gadget.h33
-rw-r--r--include/linux/usb/hcd.h4
-rw-r--r--include/linux/usb/nop-usb-xceiv.h24
-rw-r--r--include/linux/usb/ohci_pdriver.h8
-rw-r--r--include/linux/usb/omap_usb.h46
-rw-r--r--include/linux/usb/otg.h236
-rw-r--r--include/linux/usb/phy.h233
-rw-r--r--include/linux/usb/phy_companion.h34
-rw-r--r--include/linux/usb/quirks.h4
-rw-r--r--include/linux/usb/serial.h32
-rw-r--r--include/linux/usb/tegra_usb_phy.h80
-rw-r--r--include/linux/usb_usual.h24
-rw-r--r--include/linux/usbdevice_fs.h14
-rw-r--r--include/linux/user_namespace.h3
-rw-r--r--include/linux/v4l2-common.h8
-rw-r--r--include/linux/v4l2-controls.h761
-rw-r--r--include/linux/v4l2-subdev.h10
-rw-r--r--include/linux/videodev2.h726
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_config.h23
-rw-r--r--include/linux/virtio_ring.h3
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmstat.h12
-rw-r--r--include/linux/w1-gpio.h1
-rw-r--r--include/linux/workqueue.h220
-rw-r--r--include/linux/xattr.h51
-rw-r--r--include/linux/xfrm.h2
-rw-r--r--include/media/ad9389b.h49
-rw-r--r--include/media/adv7604.h153
-rw-r--r--include/media/ir-rx51.h10
-rw-r--r--include/media/mt9v032.h3
-rw-r--r--include/media/omap3isp.h14
-rw-r--r--include/media/s5k4ecgx.h37
-rw-r--r--include/media/s5p_fimc.h18
-rw-r--r--include/media/s5p_hdmi.h2
-rw-r--r--include/media/saa7146.h4
-rw-r--r--include/media/soc_camera.h16
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-common.h17
-rw-r--r--include/media/v4l2-ctrls.h43
-rw-r--r--include/media/v4l2-dev.h12
-rw-r--r--include/media/v4l2-event.h4
-rw-r--r--include/media/v4l2-ioctl.h26
-rw-r--r--include/media/v4l2-mem2mem.h4
-rw-r--r--include/media/v4l2-subdev.h8
-rw-r--r--include/media/videobuf-dvb.h4
-rw-r--r--include/media/videobuf2-core.h2
-rw-r--r--include/mtd/Kbuild5
-rw-r--r--include/net/addrconf.h2
-rw-r--r--include/net/arp.h3
-rw-r--r--include/net/ax25.h4
-rw-r--r--include/net/bluetooth/hci.h21
-rw-r--r--include/net/bluetooth/hci_core.h26
-rw-r--r--include/net/bluetooth/l2cap.h3
-rw-r--r--include/net/bluetooth/mgmt.h16
-rw-r--r--include/net/bluetooth/smp.h2
-rw-r--r--include/net/cfg80211.h28
-rw-r--r--include/net/checksum.h3
-rw-r--r--include/net/cls_cgroup.h27
-rw-r--r--include/net/dst.h10
-rw-r--r--include/net/genetlink.h34
-rw-r--r--include/net/gro_cells.h103
-rw-r--r--include/net/inet_ecn.h76
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/net/inet_sock.h4
-rw-r--r--include/net/ip.h2
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip6_tunnel.h41
-rw-r--r--include/net/ip_fib.h1
-rw-r--r--include/net/ip_vs.h16
-rw-r--r--include/net/ipip.h3
-rw-r--r--include/net/ipv6.h38
-rw-r--r--include/net/irda/ircomm_tty.h17
-rw-r--r--include/net/llc.h3
-rw-r--r--include/net/mac80211.h12
-rw-r--r--include/net/ndisc.h3
-rw-r--r--include/net/neighbour.h14
-rw-r--r--include/net/net_namespace.h27
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h33
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h2
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h20
-rw-r--r--include/net/netfilter/nf_nat.h6
-rw-r--r--include/net/netfilter/nf_nat_core.h5
-rw-r--r--include/net/netfilter/nf_nat_helper.h11
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h52
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h72
-rw-r--r--include/net/netfilter/nf_nat_protocol.h67
-rw-r--r--include/net/netfilter/nf_nat_rule.h15
-rw-r--r--include/net/netlabel.h2
-rw-r--r--include/net/netlink.h124
-rw-r--r--include/net/netns/conntrack.h4
-rw-r--r--include/net/netns/ipv4.h6
-rw-r--r--include/net/netns/ipv6.h9
-rw-r--r--include/net/netns/packet.h4
-rw-r--r--include/net/netns/sctp.h131
-rw-r--r--include/net/netprio_cgroup.h30
-rw-r--r--include/net/nfc/hci.h21
-rw-r--r--include/net/nfc/llc.h54
-rw-r--r--include/net/nfc/nci.h29
-rw-r--r--include/net/nfc/nci_core.h5
-rw-r--r--include/net/nfc/nfc.h4
-rw-r--r--include/net/nfc/shdlc.h107
-rw-r--r--include/net/request_sock.h49
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/sch_generic.h3
-rw-r--r--include/net/scm.h29
-rw-r--r--include/net/sctp/sctp.h69
-rw-r--r--include/net/sctp/sm.h8
-rw-r--r--include/net/sctp/structs.h156
-rw-r--r--include/net/snmp.h10
-rw-r--r--include/net/sock.h50
-rw-r--r--include/net/tcp.h93
-rw-r--r--include/net/xfrm.h36
-rw-r--r--include/rdma/ib_cache.h16
-rw-r--r--include/rdma/ib_verbs.h3
-rw-r--r--include/scsi/libsas.h20
-rw-r--r--include/scsi/osd_attributes.h2
-rw-r--r--include/scsi/osd_initiator.h4
-rw-r--r--include/scsi/osd_sec.h4
-rw-r--r--include/scsi/sas_ata.h10
-rw-r--r--include/scsi/scsi_bsg_fc.h2
-rw-r--r--include/scsi/scsi_device.h4
-rw-r--r--include/scsi/scsi_devinfo.h1
-rw-r--r--include/scsi/scsi_host.h6
-rw-r--r--include/scsi/scsi_netlink.h24
-rw-r--r--include/sound/ac97_codec.h9
-rw-r--r--include/sound/ad1816a.h15
-rw-r--r--include/sound/ak4531_codec.h4
-rw-r--r--include/sound/asound.h39
-rw-r--r--include/sound/compress_driver.h1
-rw-r--r--include/sound/compress_params.h1
-rw-r--r--include/sound/da9055.h33
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--include/sound/emu10k1_synth.h4
-rw-r--r--include/sound/emu8000.h4
-rw-r--r--include/sound/emux_legacy.h2
-rw-r--r--include/sound/emux_synth.h14
-rw-r--r--include/sound/es1688.h4
-rw-r--r--include/sound/gus.h10
-rw-r--r--include/sound/initval.h14
-rw-r--r--include/sound/memalloc.h27
-rw-r--r--include/sound/mpu401.h2
-rw-r--r--include/sound/pcm.h92
-rw-r--r--include/sound/rawmidi.h2
-rw-r--r--include/sound/sb.h4
-rw-r--r--include/sound/sb16_csp.h4
-rw-r--r--include/sound/seq_kernel.h2
-rw-r--r--include/sound/seq_midi_emul.h2
-rw-r--r--include/sound/seq_midi_event.h2
-rw-r--r--include/sound/seq_oss.h4
-rw-r--r--include/sound/seq_virmidi.h4
-rw-r--r--include/sound/snd_wavefront.h8
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--include/sound/soc-dapm.h10
-rw-r--r--include/sound/soc.h20
-rw-r--r--include/sound/soundfont.h4
-rw-r--r--include/sound/tea575x-tuner.h4
-rw-r--r--include/sound/tea6330t.h2
-rw-r--r--include/sound/tegra_wm8903.h26
-rw-r--r--include/sound/tlv.h8
-rw-r--r--include/sound/version.h3
-rw-r--r--include/sound/wm0010.h27
-rw-r--r--include/sound/wm8960.h2
-rw-r--r--include/sound/wm8993.h4
-rw-r--r--include/sound/wss.h8
-rw-r--r--include/target/target_core_backend.h4
-rw-r--r--include/target/target_core_base.h3
-rw-r--r--include/trace/define_trace.h2
-rw-r--r--include/trace/events/compaction.h2
-rw-r--r--include/trace/events/ext4.h242
-rw-r--r--include/trace/events/gfpflags.h1
-rw-r--r--include/trace/events/kmem.h6
-rw-r--r--include/trace/events/vmscan.h2
-rw-r--r--include/uapi/Kbuild14
-rw-r--r--include/uapi/asm-generic/Kbuild36
-rw-r--r--include/uapi/asm-generic/Kbuild.asm49
-rw-r--r--include/uapi/asm-generic/auxvec.h (renamed from include/asm-generic/auxvec.h)0
-rw-r--r--include/uapi/asm-generic/bitsperlong.h15
-rw-r--r--include/uapi/asm-generic/errno-base.h (renamed from include/asm-generic/errno-base.h)0
-rw-r--r--include/uapi/asm-generic/errno.h (renamed from include/asm-generic/errno.h)0
-rw-r--r--include/uapi/asm-generic/fcntl.h (renamed from include/asm-generic/fcntl.h)0
-rw-r--r--include/uapi/asm-generic/int-l64.h34
-rw-r--r--include/uapi/asm-generic/int-ll64.h39
-rw-r--r--include/uapi/asm-generic/ioctl.h98
-rw-r--r--include/uapi/asm-generic/ioctls.h (renamed from include/asm-generic/ioctls.h)0
-rw-r--r--include/uapi/asm-generic/ipcbuf.h (renamed from include/asm-generic/ipcbuf.h)0
-rw-r--r--include/uapi/asm-generic/kvm_para.h0
-rw-r--r--include/uapi/asm-generic/mman-common.h (renamed from include/asm-generic/mman-common.h)0
-rw-r--r--include/uapi/asm-generic/mman.h (renamed from include/asm-generic/mman.h)0
-rw-r--r--include/uapi/asm-generic/msgbuf.h (renamed from include/asm-generic/msgbuf.h)0
-rw-r--r--include/uapi/asm-generic/param.h19
-rw-r--r--include/uapi/asm-generic/poll.h (renamed from include/asm-generic/poll.h)0
-rw-r--r--include/uapi/asm-generic/posix_types.h (renamed from include/asm-generic/posix_types.h)0
-rw-r--r--include/uapi/asm-generic/resource.h68
-rw-r--r--include/uapi/asm-generic/sembuf.h (renamed from include/asm-generic/sembuf.h)0
-rw-r--r--include/uapi/asm-generic/setup.h (renamed from include/asm-generic/setup.h)0
-rw-r--r--include/uapi/asm-generic/shmbuf.h (renamed from include/asm-generic/shmbuf.h)0
-rw-r--r--include/uapi/asm-generic/shmparam.h (renamed from include/asm-generic/shmparam.h)0
-rw-r--r--include/uapi/asm-generic/siginfo.h298
-rw-r--r--include/uapi/asm-generic/signal-defs.h (renamed from include/asm-generic/signal-defs.h)0
-rw-r--r--include/uapi/asm-generic/signal.h123
-rw-r--r--include/uapi/asm-generic/socket.h (renamed from include/asm-generic/socket.h)0
-rw-r--r--include/uapi/asm-generic/sockios.h (renamed from include/asm-generic/sockios.h)0
-rw-r--r--include/uapi/asm-generic/stat.h (renamed from include/asm-generic/stat.h)0
-rw-r--r--include/uapi/asm-generic/statfs.h83
-rw-r--r--include/uapi/asm-generic/swab.h (renamed from include/asm-generic/swab.h)0
-rw-r--r--include/uapi/asm-generic/termbits.h (renamed from include/asm-generic/termbits.h)0
-rw-r--r--include/uapi/asm-generic/termios.h50
-rw-r--r--include/uapi/asm-generic/types.h (renamed from include/asm-generic/types.h)0
-rw-r--r--include/uapi/asm-generic/ucontext.h (renamed from include/asm-generic/ucontext.h)0
-rw-r--r--include/uapi/asm-generic/unistd.h902
-rw-r--r--include/uapi/drm/Kbuild16
-rw-r--r--include/uapi/drm/drm.h (renamed from include/drm/drm.h)2
-rw-r--r--include/uapi/drm/drm_fourcc.h (renamed from include/drm/drm_fourcc.h)8
-rw-r--r--include/uapi/drm/drm_mode.h (renamed from include/drm/drm_mode.h)5
-rw-r--r--include/uapi/drm/drm_sarea.h (renamed from include/drm/drm_sarea.h)4
-rw-r--r--include/uapi/drm/exynos_drm.h203
-rw-r--r--include/uapi/drm/i810_drm.h (renamed from include/drm/i810_drm.h)0
-rw-r--r--include/uapi/drm/i915_drm.h947
-rw-r--r--include/uapi/drm/mga_drm.h (renamed from include/drm/mga_drm.h)2
-rw-r--r--include/uapi/drm/nouveau_drm.h (renamed from include/drm/nouveau_drm.h)0
-rw-r--r--include/uapi/drm/r128_drm.h (renamed from include/drm/r128_drm.h)0
-rw-r--r--include/uapi/drm/radeon_drm.h (renamed from include/drm/radeon_drm.h)2
-rw-r--r--include/uapi/drm/savage_drm.h (renamed from include/drm/savage_drm.h)0
-rw-r--r--include/uapi/drm/sis_drm.h (renamed from include/drm/sis_drm.h)0
-rw-r--r--include/uapi/drm/via_drm.h (renamed from include/drm/via_drm.h)2
-rw-r--r--include/uapi/drm/vmwgfx_drm.h (renamed from include/drm/vmwgfx_drm.h)0
-rw-r--r--include/uapi/linux/Kbuild24
-rw-r--r--include/uapi/linux/byteorder/Kbuild1
-rw-r--r--include/uapi/linux/caif/Kbuild1
-rw-r--r--include/uapi/linux/can/Kbuild1
-rw-r--r--include/uapi/linux/dvb/Kbuild1
-rw-r--r--include/uapi/linux/hdlc/Kbuild1
-rw-r--r--include/uapi/linux/hsi/Kbuild1
-rw-r--r--include/uapi/linux/isdn/Kbuild1
-rw-r--r--include/uapi/linux/mmc/Kbuild1
-rw-r--r--include/uapi/linux/netfilter/Kbuild2
-rw-r--r--include/uapi/linux/netfilter/ipset/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_arp/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_bridge/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_ipv4/Kbuild1
-rw-r--r--include/uapi/linux/netfilter_ipv6/Kbuild1
-rw-r--r--include/uapi/linux/nfsd/Kbuild1
-rw-r--r--include/uapi/linux/raid/Kbuild1
-rw-r--r--include/uapi/linux/spi/Kbuild1
-rw-r--r--include/uapi/linux/sunrpc/Kbuild1
-rw-r--r--include/uapi/linux/tc_act/Kbuild1
-rw-r--r--include/uapi/linux/tc_ematch/Kbuild1
-rw-r--r--include/uapi/linux/usb/Kbuild1
-rw-r--r--include/uapi/linux/wimax/Kbuild1
-rw-r--r--include/uapi/mtd/Kbuild6
-rw-r--r--include/uapi/mtd/inftl-user.h (renamed from include/mtd/inftl-user.h)0
-rw-r--r--include/uapi/mtd/mtd-abi.h (renamed from include/mtd/mtd-abi.h)0
-rw-r--r--include/uapi/mtd/mtd-user.h (renamed from include/mtd/mtd-user.h)0
-rw-r--r--include/uapi/mtd/nftl-user.h (renamed from include/mtd/nftl-user.h)0
-rw-r--r--include/uapi/mtd/ubi-user.h (renamed from include/mtd/ubi-user.h)16
-rw-r--r--include/uapi/rdma/Kbuild1
-rw-r--r--include/uapi/scsi/Kbuild2
-rw-r--r--include/uapi/scsi/fc/Kbuild1
-rw-r--r--include/uapi/sound/Kbuild1
-rw-r--r--include/uapi/video/Kbuild1
-rw-r--r--include/uapi/xen/Kbuild1
-rw-r--r--include/video/epson1355.h64
-rw-r--r--include/xen/events.h4
-rw-r--r--include/xen/grant_table.h15
-rw-r--r--include/xen/interface/callback.h2
-rw-r--r--include/xen/interface/features.h3
-rw-r--r--include/xen/interface/grant_table.h12
-rw-r--r--include/xen/interface/hvm/params.h2
-rw-r--r--include/xen/interface/io/blkif.h4
-rw-r--r--include/xen/interface/io/netif.h4
-rw-r--r--include/xen/interface/io/protocols.h3
-rw-r--r--include/xen/interface/memory.h21
-rw-r--r--include/xen/interface/physdev.h18
-rw-r--r--include/xen/interface/platform.h9
-rw-r--r--include/xen/interface/sched.h2
-rw-r--r--include/xen/interface/version.h7
-rw-r--r--include/xen/interface/xen.h8
-rw-r--r--include/xen/privcmd.h27
-rw-r--r--include/xen/swiotlb-xen.h11
-rw-r--r--include/xen/xen.h4
770 files changed, 20524 insertions, 8893 deletions
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h
new file mode 100644
index 000000000000..a1e45cdd729a
--- /dev/null
+++ b/include/acpi/acbuffer.h
@@ -0,0 +1,235 @@
1/******************************************************************************
2 *
3 * Name: acbuffer.h - Support for buffers returned by ACPI predefined names
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACBUFFER_H__
45#define __ACBUFFER_H__
46
47/*
48 * Contains buffer structures for these predefined names:
49 * _FDE, _GRT, _GTM, _PLD, _SRT
50 */
51
52/*
53 * Note: C bitfields are not used for this reason:
54 *
55 * "Bitfields are great and easy to read, but unfortunately the C language
56 * does not specify the layout of bitfields in memory, which means they are
57 * essentially useless for dealing with packed data in on-disk formats or
58 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
59 * this decision was a design error in C. Ritchie could have picked an order
60 * and stuck with it." Norman Ramsey.
61 * See http://stackoverflow.com/a/1053662/41661
62 */
63
64/* _FDE return value */
65
66struct acpi_fde_info {
67 u32 floppy0;
68 u32 floppy1;
69 u32 floppy2;
70 u32 floppy3;
71 u32 tape;
72};
73
74/*
75 * _GRT return value
76 * _SRT input value
77 */
78struct acpi_grt_info {
79 u16 year;
80 u8 month;
81 u8 day;
82 u8 hour;
83 u8 minute;
84 u8 second;
85 u8 valid;
86 u16 milliseconds;
87 u16 timezone;
88 u8 daylight;
89 u8 reserved[3];
90};
91
92/* _GTM return value */
93
94struct acpi_gtm_info {
95 u32 pio_speed0;
96 u32 dma_speed0;
97 u32 pio_speed1;
98 u32 dma_speed1;
99 u32 flags;
100};
101
102/*
103 * Formatted _PLD return value. The minimum size is a package containing
104 * one buffer.
105 * Revision 1: Buffer is 16 bytes (128 bits)
106 * Revision 2: Buffer is 20 bytes (160 bits)
107 *
108 * Note: This structure is returned from the acpi_decode_pld_buffer
109 * interface.
110 */
111struct acpi_pld_info {
112 u8 revision;
113 u8 ignore_color;
114 u32 color;
115 u16 width;
116 u16 height;
117 u8 user_visible;
118 u8 dock;
119 u8 lid;
120 u8 panel;
121 u8 vertical_position;
122 u8 horizontal_position;
123 u8 shape;
124 u8 group_orientation;
125 u8 group_token;
126 u8 group_position;
127 u8 bay;
128 u8 ejectable;
129 u8 ospm_eject_required;
130 u8 cabinet_number;
131 u8 card_cage_number;
132 u8 reference;
133 u8 rotation;
134 u8 order;
135 u8 reserved;
136 u16 vertical_offset;
137 u16 horizontal_offset;
138};
139
140/*
141 * Macros to:
142 * 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET*
143 * (Used by acpi_decode_pld_buffer)
144 * 2) Construct a _PLD buffer - ACPI_PLD_SET*
145 * (Intended for BIOS use only)
146 */
147#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */
148#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
149
150/* First 32-bit dword, bits 0:32 */
151
152#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
153#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */
154
155#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
156#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
157
158#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK)
159#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */
160
161/* Second 32-bit dword, bits 33:63 */
162
163#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
164#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */
165
166#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
167#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */
168
169/* Third 32-bit dword, bits 64:95 */
170
171#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
172#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */
173
174#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
175#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */
176
177#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
178#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */
179
180#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
181#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */
182
183#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
184#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */
185
186#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
187#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */
188
189#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
190#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */
191
192#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
193#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */
194
195#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
196#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */
197
198#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
199#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */
200
201#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
202#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */
203
204/* Fourth 32-bit dword, bits 96:127 */
205
206#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
207#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */
208
209#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
210#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */
211
212#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
213#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */
214
215#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
216#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */
217
218#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
219#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */
220
221#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
222#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */
223
224#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
225#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */
226
227/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
228
229#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
230#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */
231
232#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
233#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
234
235#endif /* ACBUFFER_H */
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index d988ac54f41e..745dd24e3cb5 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -63,11 +63,10 @@
63#define METHOD_NAME__PRW "_PRW" 63#define METHOD_NAME__PRW "_PRW"
64#define METHOD_NAME__SRS "_SRS" 64#define METHOD_NAME__SRS "_SRS"
65#define METHOD_NAME__CBA "_CBA" 65#define METHOD_NAME__CBA "_CBA"
66#define METHOD_NAME__PLD "_PLD"
66 67
67/* Method names - these methods must appear at the namespace root */ 68/* Method names - these methods must appear at the namespace root */
68 69
69#define METHOD_PATHNAME__BFS "\\_BFS"
70#define METHOD_PATHNAME__GTS "\\_GTS"
71#define METHOD_PATHNAME__PTS "\\_PTS" 70#define METHOD_PATHNAME__PTS "\\_PTS"
72#define METHOD_PATHNAME__SST "\\_SI._SST" 71#define METHOD_PATHNAME__SST "\\_SI._SST"
73#define METHOD_PATHNAME__WAK "\\_WAK" 72#define METHOD_PATHNAME__WAK "\\_WAK"
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index c433d5e27679..c1ea8436961f 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -53,14 +53,14 @@
53 * 53 *
54 * Note: The order of these include files is important. 54 * Note: The order of these include files is important.
55 */ 55 */
56#include "platform/acenv.h" /* Environment-specific items */ 56#include <acpi/platform/acenv.h> /* Environment-specific items */
57#include "acnames.h" /* Common ACPI names and strings */ 57#include <acpi/acnames.h> /* Common ACPI names and strings */
58#include "actypes.h" /* ACPICA data types and structures */ 58#include <acpi/actypes.h> /* ACPICA data types and structures */
59#include "acexcep.h" /* ACPICA exceptions */ 59#include <acpi/acexcep.h> /* ACPICA exceptions */
60#include "actbl.h" /* ACPI table definitions */ 60#include <acpi/actbl.h> /* ACPI table definitions */
61#include "acoutput.h" /* Error output and Debug macros */ 61#include <acpi/acoutput.h> /* Error output and Debug macros */
62#include "acrestyp.h" /* Resource Descriptor structs */ 62#include <acpi/acrestyp.h> /* Resource Descriptor structs */
63#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */ 63#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */
64#include "acpixf.h" /* ACPI core subsystem external interfaces */ 64#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */
65 65
66#endif /* __ACPI_H__ */ 66#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bde976ee068d..0daa0fbd8654 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -54,37 +54,8 @@ acpi_status
54acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, 54acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
55 u32 status_code, struct acpi_buffer *status_buf); 55 u32 status_code, struct acpi_buffer *status_buf);
56 56
57struct acpi_pld {
58 unsigned int revision:7; /* 0 */
59 unsigned int ignore_colour:1; /* 7 */
60 unsigned int colour:24; /* 8 */
61 unsigned int width:16; /* 32 */
62 unsigned int height:16; /* 48 */
63 unsigned int user_visible:1; /* 64 */
64 unsigned int dock:1; /* 65 */
65 unsigned int lid:1; /* 66 */
66 unsigned int panel:3; /* 67 */
67 unsigned int vertical_pos:2; /* 70 */
68 unsigned int horizontal_pos:2; /* 72 */
69 unsigned int shape:4; /* 74 */
70 unsigned int group_orientation:1; /* 78 */
71 unsigned int group_token:8; /* 79 */
72 unsigned int group_position:8; /* 87 */
73 unsigned int bay:1; /* 95 */
74 unsigned int ejectable:1; /* 96 */
75 unsigned int ospm_eject_required:1; /* 97 */
76 unsigned int cabinet_number:8; /* 98 */
77 unsigned int card_cage_number:8; /* 106 */
78 unsigned int reference:1; /* 114 */
79 unsigned int rotation:4; /* 115 */
80 unsigned int order:5; /* 119 */
81 unsigned int reserved:4; /* 124 */
82 unsigned int vertical_offset:16; /* 128 */
83 unsigned int horizontal_offset:16; /* 144 */
84} __attribute__((__packed__));
85
86acpi_status 57acpi_status
87acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld); 58acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
88#ifdef CONFIG_ACPI 59#ifdef CONFIG_ACPI
89 60
90#include <linux/proc_fs.h> 61#include <linux/proc_fs.h>
@@ -208,6 +179,7 @@ struct acpi_device_pnp {
208 struct list_head ids; /* _HID and _CIDs */ 179 struct list_head ids; /* _HID and _CIDs */
209 acpi_device_name device_name; /* Driver-determined */ 180 acpi_device_name device_name; /* Driver-determined */
210 acpi_device_class device_class; /* " */ 181 acpi_device_class device_class; /* " */
182 union acpi_object *str_obj; /* unicode string for _STR method */
211}; 183};
212 184
213#define acpi_device_bid(d) ((d)->pnp.bus_id) 185#define acpi_device_bid(d) ((d)->pnp.bus_id)
@@ -282,8 +254,16 @@ struct acpi_device_wakeup {
282 int prepare_count; 254 int prepare_count;
283}; 255};
284 256
285/* Device */ 257struct acpi_device_physical_node {
258 u8 node_id;
259 struct list_head node;
260 struct device *dev;
261};
262
263/* set maximum of physical nodes to 32 for expansibility */
264#define ACPI_MAX_PHYSICAL_NODE 32
286 265
266/* Device */
287struct acpi_device { 267struct acpi_device {
288 int device_type; 268 int device_type;
289 acpi_handle handle; /* no handle for fixed hardware */ 269 acpi_handle handle; /* no handle for fixed hardware */
@@ -304,6 +284,10 @@ struct acpi_device {
304 struct device dev; 284 struct device dev;
305 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */ 285 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
306 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 286 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
287 u8 physical_node_count;
288 struct list_head physical_node_list;
289 struct mutex physical_node_lock;
290 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
307}; 291};
308 292
309static inline void *acpi_driver_data(struct acpi_device *d) 293static inline void *acpi_driver_data(struct acpi_device *d)
@@ -381,6 +365,19 @@ int acpi_match_device_ids(struct acpi_device *device,
381int acpi_create_dir(struct acpi_device *); 365int acpi_create_dir(struct acpi_device *);
382void acpi_remove_dir(struct acpi_device *); 366void acpi_remove_dir(struct acpi_device *);
383 367
368
369/**
370 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
371 * @__acpi_driver: acpi_driver struct
372 *
373 * Helper macro for ACPI drivers which do not do anything special in module
374 * init/exit. This eliminates a lot of boilerplate. Each module may only
375 * use this macro once, and calling it replaces module_init() and module_exit()
376 */
377#define module_acpi_driver(__acpi_driver) \
378 module_driver(__acpi_driver, acpi_bus_register_driver, \
379 acpi_bus_unregister_driver)
380
384/* 381/*
385 * Bind physical devices with ACPI devices 382 * Bind physical devices with ACPI devices
386 */ 383 */
@@ -394,7 +391,6 @@ struct acpi_bus_type {
394}; 391};
395int register_acpi_bus_type(struct acpi_bus_type *); 392int register_acpi_bus_type(struct acpi_bus_type *);
396int unregister_acpi_bus_type(struct acpi_bus_type *); 393int unregister_acpi_bus_type(struct acpi_bus_type *);
397struct device *acpi_get_physical_device(acpi_handle);
398 394
399struct acpi_pci_root { 395struct acpi_pci_root {
400 struct list_head node; 396 struct list_head node;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 0650f5fa7ce9..1222ba93d80a 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -47,8 +47,8 @@
47#ifndef __ACPIOSXF_H__ 47#ifndef __ACPIOSXF_H__
48#define __ACPIOSXF_H__ 48#define __ACPIOSXF_H__
49 49
50#include "platform/acenv.h" 50#include <acpi/platform/acenv.h>
51#include "actypes.h" 51#include <acpi/actypes.h>
52 52
53/* Types for acpi_os_execute */ 53/* Types for acpi_os_execute */
54 54
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 26a92fc28a59..8b891dbead66 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,11 +47,12 @@
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 0x20120711 50#define ACPI_CA_VERSION 0x20120913
51 51
52#include "acconfig.h" 52#include <acpi/acconfig.h>
53#include "actypes.h" 53#include <acpi/actypes.h>
54#include "actbl.h" 54#include <acpi/actbl.h>
55#include <acpi/acbuffer.h>
55 56
56extern u8 acpi_gbl_permanent_mmap; 57extern u8 acpi_gbl_permanent_mmap;
57 58
@@ -144,6 +145,10 @@ acpi_check_address_range(acpi_adr_space_type space_id,
144 acpi_physical_address address, 145 acpi_physical_address address,
145 acpi_size length, u8 warn); 146 acpi_size length, u8 warn);
146 147
148acpi_status
149acpi_decode_pld_buffer(u8 *in_buffer,
150 acpi_size length, struct acpi_pld_info **return_buffer);
151
147/* 152/*
148 * ACPI Memory management 153 * ACPI Memory management
149 */ 154 */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 59a73e1b2845..4f94b1d812d5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -79,9 +79,15 @@
79#pragma pack(1) 79#pragma pack(1)
80 80
81/* 81/*
82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note: C bitfields are not used for this reason:
83 * This is the only type that is even remotely portable. Anything else is not 83 *
84 * portable, so do not use any other bitfield types. 84 * "Bitfields are great and easy to read, but unfortunately the C language
85 * does not specify the layout of bitfields in memory, which means they are
86 * essentially useless for dealing with packed data in on-disk formats or
87 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
88 * this decision was a design error in C. Ritchie could have picked an order
89 * and stuck with it." Norman Ramsey.
90 * See http://stackoverflow.com/a/1053662/41661
85 */ 91 */
86 92
87/******************************************************************************* 93/*******************************************************************************
@@ -94,7 +100,7 @@
94struct acpi_table_header { 100struct acpi_table_header {
95 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */ 101 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */
96 u32 length; /* Length of table in bytes, including this header */ 102 u32 length; /* Length of table in bytes, including this header */
97 u8 revision; /* ACPI Specification minor version # */ 103 u8 revision; /* ACPI Specification minor version number */
98 u8 checksum; /* To make sum of entire table == 0 */ 104 u8 checksum; /* To make sum of entire table == 0 */
99 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ 105 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
100 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ 106 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
@@ -108,7 +114,7 @@ struct acpi_table_header {
108 * GAS - Generic Address Structure (ACPI 2.0+) 114 * GAS - Generic Address Structure (ACPI 2.0+)
109 * 115 *
110 * Note: Since this structure is used in the ACPI tables, it is byte aligned. 116 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
111 * If misaliged access is not supported by the hardware, accesses to the 117 * If misaligned access is not supported by the hardware, accesses to the
112 * 64-bit Address field must be performed with care. 118 * 64-bit Address field must be performed with care.
113 * 119 *
114 ******************************************************************************/ 120 ******************************************************************************/
@@ -210,18 +216,18 @@ struct acpi_table_fadt {
210 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */ 216 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */
211 u16 sci_interrupt; /* System vector of SCI interrupt */ 217 u16 sci_interrupt; /* System vector of SCI interrupt */
212 u32 smi_command; /* 32-bit Port address of SMI command port */ 218 u32 smi_command; /* 32-bit Port address of SMI command port */
213 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 219 u8 acpi_enable; /* Value to write to SMI_CMD to enable ACPI */
214 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 220 u8 acpi_disable; /* Value to write to SMI_CMD to disable ACPI */
215 u8 s4_bios_request; /* Value to write to SMI CMD to enter S4BIOS state */ 221 u8 s4_bios_request; /* Value to write to SMI_CMD to enter S4BIOS state */
216 u8 pstate_control; /* Processor performance state control */ 222 u8 pstate_control; /* Processor performance state control */
217 u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ 223 u32 pm1a_event_block; /* 32-bit port address of Power Mgt 1a Event Reg Blk */
218 u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ 224 u32 pm1b_event_block; /* 32-bit port address of Power Mgt 1b Event Reg Blk */
219 u32 pm1a_control_block; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */ 225 u32 pm1a_control_block; /* 32-bit port address of Power Mgt 1a Control Reg Blk */
220 u32 pm1b_control_block; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */ 226 u32 pm1b_control_block; /* 32-bit port address of Power Mgt 1b Control Reg Blk */
221 u32 pm2_control_block; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */ 227 u32 pm2_control_block; /* 32-bit port address of Power Mgt 2 Control Reg Blk */
222 u32 pm_timer_block; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ 228 u32 pm_timer_block; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */
223 u32 gpe0_block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */ 229 u32 gpe0_block; /* 32-bit port address of General Purpose Event 0 Reg Blk */
224 u32 gpe1_block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */ 230 u32 gpe1_block; /* 32-bit port address of General Purpose Event 1 Reg Blk */
225 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */ 231 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */
226 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */ 232 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */
227 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */ 233 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */
@@ -229,12 +235,12 @@ struct acpi_table_fadt {
229 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */ 235 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */
230 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ 236 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */
231 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ 237 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */
232 u8 cst_control; /* Support for the _CST object and C States change notification */ 238 u8 cst_control; /* Support for the _CST object and C-States change notification */
233 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */ 239 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */
234 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */ 240 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */
235 u16 flush_size; /* Processor's memory cache line width, in bytes */ 241 u16 flush_size; /* Processor memory cache line width, in bytes */
236 u16 flush_stride; /* Number of flush strides that need to be read */ 242 u16 flush_stride; /* Number of flush strides that need to be read */
237 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ 243 u8 duty_offset; /* Processor duty cycle index in processor P_CNT reg */
238 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ 244 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */
239 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ 245 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
240 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ 246 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
@@ -255,11 +261,11 @@ struct acpi_table_fadt {
255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 261 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ 262 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 263 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
258 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register */ 264 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register (ACPI 5.0) */
259 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register */ 265 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */
260}; 266};
261 267
262/* Masks for FADT Boot Architecture Flags (boot_flags) */ 268/* Masks for FADT Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */
263 269
264#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 270#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
265#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ 271#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -272,13 +278,13 @@ struct acpi_table_fadt {
272 278
273/* Masks for FADT flags */ 279/* Masks for FADT flags */
274 280
275#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ 281#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */
276#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ 282#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */
277#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ 283#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */
278#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ 284#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */
279#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ 285#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */
280#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ 286#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */
281#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ 287#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */
282#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ 288#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */
283#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ 289#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
284#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ 290#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */
@@ -297,7 +303,7 @@ struct acpi_table_fadt {
297 303
298/* Values for preferred_profile (Preferred Power Management Profiles) */ 304/* Values for preferred_profile (Preferred Power Management Profiles) */
299 305
300enum acpi_prefered_pm_profiles { 306enum acpi_preferred_pm_profiles {
301 PM_UNSPECIFIED = 0, 307 PM_UNSPECIFIED = 0,
302 PM_DESKTOP = 1, 308 PM_DESKTOP = 1,
303 PM_MOBILE = 2, 309 PM_MOBILE = 2,
@@ -335,7 +341,7 @@ union acpi_name_union {
335struct acpi_table_desc { 341struct acpi_table_desc {
336 acpi_physical_address address; 342 acpi_physical_address address;
337 struct acpi_table_header *pointer; 343 struct acpi_table_header *pointer;
338 u32 length; /* Length fixed at 32 bits */ 344 u32 length; /* Length fixed at 32 bits (fixed in table header) */
339 union acpi_name_union signature; 345 union acpi_name_union signature;
340 acpi_owner_id owner_id; 346 acpi_owner_id owner_id;
341 u8 flags; 347 u8 flags;
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 300d14e7c5d5..280fc45b59dd 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -79,9 +79,15 @@
79#pragma pack(1) 79#pragma pack(1)
80 80
81/* 81/*
82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note: C bitfields are not used for this reason:
83 * This is the only type that is even remotely portable. Anything else is not 83 *
84 * portable, so do not use any other bitfield types. 84 * "Bitfields are great and easy to read, but unfortunately the C language
85 * does not specify the layout of bitfields in memory, which means they are
86 * essentially useless for dealing with packed data in on-disk formats or
87 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
88 * this decision was a design error in C. Ritchie could have picked an order
89 * and stuck with it." Norman Ramsey.
90 * See http://stackoverflow.com/a/1053662/41661
85 */ 91 */
86 92
87/******************************************************************************* 93/*******************************************************************************
@@ -489,7 +495,9 @@ enum acpi_hest_notify_types {
489 ACPI_HEST_NOTIFY_LOCAL = 2, 495 ACPI_HEST_NOTIFY_LOCAL = 2,
490 ACPI_HEST_NOTIFY_SCI = 3, 496 ACPI_HEST_NOTIFY_SCI = 3,
491 ACPI_HEST_NOTIFY_NMI = 4, 497 ACPI_HEST_NOTIFY_NMI = 4,
492 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ 498 ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */
499 ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */
500 ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */
493}; 501};
494 502
495/* Values for config_write_enable bitfield above */ 503/* Values for config_write_enable bitfield above */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index d9ceb3d31629..1b2b356486d1 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -63,6 +63,8 @@
63 */ 63 */
64#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ 64#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
65#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ 65#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
66#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */
67#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */
66#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 68#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
67#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ 69#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
68#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
@@ -96,9 +98,15 @@
96#pragma pack(1) 98#pragma pack(1)
97 99
98/* 100/*
99 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 101 * Note: C bitfields are not used for this reason:
100 * This is the only type that is even remotely portable. Anything else is not 102 *
101 * portable, so do not use any other bitfield types. 103 * "Bitfields are great and easy to read, but unfortunately the C language
104 * does not specify the layout of bitfields in memory, which means they are
105 * essentially useless for dealing with packed data in on-disk formats or
106 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
107 * this decision was a design error in C. Ritchie could have picked an order
108 * and stuck with it." Norman Ramsey.
109 * See http://stackoverflow.com/a/1053662/41661
102 */ 110 */
103 111
104/******************************************************************************* 112/*******************************************************************************
@@ -232,6 +240,115 @@ struct acpi_table_boot {
232 240
233/******************************************************************************* 241/*******************************************************************************
234 * 242 *
243 * CSRT - Core System Resource Table
244 * Version 0
245 *
246 * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011
247 *
248 ******************************************************************************/
249
250struct acpi_table_csrt {
251 struct acpi_table_header header; /* Common ACPI table header */
252};
253
254/* Resource Group subtable */
255
256struct acpi_csrt_group {
257 u32 length;
258 u32 vendor_id;
259 u32 subvendor_id;
260 u16 device_id;
261 u16 subdevice_id;
262 u16 revision;
263 u16 reserved;
264 u32 info_length;
265
266 /* Shared data (length = info_length) immediately follows */
267};
268
269/* Resource Descriptor subtable */
270
271struct acpi_csrt_descriptor {
272 u32 length;
273 u16 type;
274 u16 subtype;
275 u32 uid;
276
277 /* Resource-specific information immediately follows */
278};
279
280/* Resource Types */
281
282#define ACPI_CSRT_TYPE_INTERRUPT 0x0001
283#define ACPI_CSRT_TYPE_TIMER 0x0002
284#define ACPI_CSRT_TYPE_DMA 0x0003
285
286/* Resource Subtypes */
287
288#define ACPI_CSRT_XRUPT_LINE 0x0000
289#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001
290#define ACPI_CSRT_TIMER 0x0000
291#define ACPI_CSRT_DMA_CHANNEL 0x0000
292#define ACPI_CSRT_DMA_CONTROLLER 0x0001
293
294/*******************************************************************************
295 *
296 * DBG2 - Debug Port Table 2
297 * Version 0 (Both main table and subtables)
298 *
299 * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
300 *
301 ******************************************************************************/
302
303struct acpi_table_dbg2 {
304 struct acpi_table_header header; /* Common ACPI table header */
305 u32 info_offset;
306 u32 info_count;
307};
308
309/* Debug Device Information Subtable */
310
311struct acpi_dbg2_device {
312 u8 revision;
313 u16 length;
314 u8 register_count; /* Number of base_address registers */
315 u16 namepath_length;
316 u16 namepath_offset;
317 u16 oem_data_length;
318 u16 oem_data_offset;
319 u16 port_type;
320 u16 port_subtype;
321 u16 reserved;
322 u16 base_address_offset;
323 u16 address_size_offset;
324 /*
325 * Data that follows:
326 * base_address (required) - Each in 12-byte Generic Address Structure format.
327 * address_size (required) - Array of u32 sizes corresponding to each base_address register.
328 * Namepath (required) - Null terminated string. Single dot if not supported.
329 * oem_data (optional) - Length is oem_data_length.
330 */
331};
332
333/* Types for port_type field above */
334
335#define ACPI_DBG2_SERIAL_PORT 0x8000
336#define ACPI_DBG2_1394_PORT 0x8001
337#define ACPI_DBG2_USB_PORT 0x8002
338#define ACPI_DBG2_NET_PORT 0x8003
339
340/* Subtypes for port_subtype field above */
341
342#define ACPI_DBG2_16550_COMPATIBLE 0x0000
343#define ACPI_DBG2_16550_SUBSET 0x0001
344
345#define ACPI_DBG2_1394_STANDARD 0x0000
346
347#define ACPI_DBG2_USB_XHCI 0x0000
348#define ACPI_DBG2_USB_EHCI 0x0001
349
350/*******************************************************************************
351 *
235 * DBGP - Debug Port table 352 * DBGP - Debug Port table
236 * Version 1 353 * Version 1
237 * 354 *
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index f65a0ed869eb..8c61b5fe42a4 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -75,7 +75,6 @@
75/* Reserved table signatures */ 75/* Reserved table signatures */
76 76
77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ 77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
78#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
79#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ 78#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
80#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ 79#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
81#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ 80#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
@@ -87,9 +86,15 @@
87#pragma pack(1) 86#pragma pack(1)
88 87
89/* 88/*
90 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 89 * Note: C bitfields are not used for this reason:
91 * This is the only type that is even remotely portable. Anything else is not 90 *
92 * portable, so do not use any other bitfield types. 91 * "Bitfields are great and easy to read, but unfortunately the C language
92 * does not specify the layout of bitfields in memory, which means they are
93 * essentially useless for dealing with packed data in on-disk formats or
94 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
95 * this decision was a design error in C. Ritchie could have picked an order
96 * and stuck with it." Norman Ramsey.
97 * See http://stackoverflow.com/a/1053662/41661
93 */ 98 */
94 99
95/******************************************************************************* 100/*******************************************************************************
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3d00bd5bd7e3..a85bae968262 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -519,13 +519,6 @@ typedef u64 acpi_integer;
519#define ACPI_SLEEP_TYPE_INVALID 0xFF 519#define ACPI_SLEEP_TYPE_INVALID 0xFF
520 520
521/* 521/*
522 * Sleep/Wake flags
523 */
524#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */
525#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */
526#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */
527
528/*
529 * Standard notify values 522 * Standard notify values
530 */ 523 */
531#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 524#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 560a9f272f34..89cee88dd2a5 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -138,7 +138,7 @@
138/*! [Begin] no source code translation */ 138/*! [Begin] no source code translation */
139 139
140#if defined(_LINUX) || defined(__linux__) 140#if defined(_LINUX) || defined(__linux__)
141#include "aclinux.h" 141#include <acpi/platform/aclinux.h>
142 142
143#elif defined(_AED_EFI) 143#elif defined(_AED_EFI)
144#include "acefi.h" 144#include "acefi.h"
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 7509be30ca01..85d5d8f38452 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -106,7 +106,7 @@
106 106
107/* Linux uses GCC */ 107/* Linux uses GCC */
108 108
109#include "acgcc.h" 109#include <acpi/platform/acgcc.h>
110 110
111 111
112#ifdef __KERNEL__ 112#ifdef __KERNEL__
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 64ec644808bc..555d0337ad95 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -3,7 +3,6 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/cpu.h> 5#include <linux/cpu.h>
6#include <linux/cpuidle.h>
7#include <linux/thermal.h> 6#include <linux/thermal.h>
8#include <asm/acpi.h> 7#include <asm/acpi.h>
9 8
@@ -59,13 +58,11 @@ struct acpi_processor_cx {
59 u8 entry_method; 58 u8 entry_method;
60 u8 index; 59 u8 index;
61 u32 latency; 60 u32 latency;
62 u32 power;
63 u8 bm_sts_skip; 61 u8 bm_sts_skip;
64 char desc[ACPI_CX_DESC_LEN]; 62 char desc[ACPI_CX_DESC_LEN];
65}; 63};
66 64
67struct acpi_processor_power { 65struct acpi_processor_power {
68 struct cpuidle_device dev;
69 struct acpi_processor_cx *state; 66 struct acpi_processor_cx *state;
70 unsigned long bm_check_timestamp; 67 unsigned long bm_check_timestamp;
71 u32 default_state; 68 u32 default_state;
@@ -325,12 +322,10 @@ extern void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
325extern const struct file_operations acpi_processor_throttling_fops; 322extern const struct file_operations acpi_processor_throttling_fops;
326extern void acpi_processor_throttling_init(void); 323extern void acpi_processor_throttling_init(void);
327/* in processor_idle.c */ 324/* in processor_idle.c */
328int acpi_processor_power_init(struct acpi_processor *pr, 325int acpi_processor_power_init(struct acpi_processor *pr);
329 struct acpi_device *device); 326int acpi_processor_power_exit(struct acpi_processor *pr);
330int acpi_processor_cst_has_changed(struct acpi_processor *pr); 327int acpi_processor_cst_has_changed(struct acpi_processor *pr);
331int acpi_processor_hotplug(struct acpi_processor *pr); 328int acpi_processor_hotplug(struct acpi_processor *pr);
332int acpi_processor_power_exit(struct acpi_processor *pr,
333 struct acpi_device *device);
334int acpi_processor_suspend(struct device *dev); 329int acpi_processor_suspend(struct device *dev);
335int acpi_processor_resume(struct device *dev); 330int acpi_processor_resume(struct device *dev);
336extern struct cpuidle_driver acpi_idle_driver; 331extern struct cpuidle_driver acpi_idle_driver;
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 2c85a0f647b7..e69de29bb2d1 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -1,35 +0,0 @@
1header-y += auxvec.h
2header-y += bitsperlong.h
3header-y += errno-base.h
4header-y += errno.h
5header-y += fcntl.h
6header-y += int-l64.h
7header-y += int-ll64.h
8header-y += ioctl.h
9header-y += ioctls.h
10header-y += ipcbuf.h
11header-y += kvm_para.h
12header-y += mman-common.h
13header-y += mman.h
14header-y += msgbuf.h
15header-y += param.h
16header-y += poll.h
17header-y += posix_types.h
18header-y += resource.h
19header-y += sembuf.h
20header-y += setup.h
21header-y += shmbuf.h
22header-y += shmparam.h
23header-y += siginfo.h
24header-y += signal-defs.h
25header-y += signal.h
26header-y += socket.h
27header-y += sockios.h
28header-y += stat.h
29header-y += statfs.h
30header-y += swab.h
31header-y += termbits.h
32header-y += termios.h
33header-y += types.h
34header-y += ucontext.h
35header-y += unistd.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index c5d2e5dd871b..d2ee86b4c091 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -1,45 +1 @@
1ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ include include/uapi/asm-generic/Kbuild.asm
2 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
3header-y += kvm.h
4endif
5
6ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
7 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
8header-y += kvm_para.h
9endif
10
11ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
12 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
13header-y += a.out.h
14endif
15
16header-y += auxvec.h
17header-y += bitsperlong.h
18header-y += byteorder.h
19header-y += errno.h
20header-y += fcntl.h
21header-y += ioctl.h
22header-y += ioctls.h
23header-y += ipcbuf.h
24header-y += mman.h
25header-y += msgbuf.h
26header-y += param.h
27header-y += poll.h
28header-y += posix_types.h
29header-y += ptrace.h
30header-y += resource.h
31header-y += sembuf.h
32header-y += setup.h
33header-y += shmbuf.h
34header-y += sigcontext.h
35header-y += siginfo.h
36header-y += signal.h
37header-y += socket.h
38header-y += sockios.h
39header-y += stat.h
40header-y += statfs.h
41header-y += swab.h
42header-y += termbits.h
43header-y += termios.h
44header-y += types.h
45header-y += unistd.h
diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h
new file mode 100644
index 000000000000..90041e3a41f0
--- /dev/null
+++ b/include/asm-generic/bitops/builtin-__ffs.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
3
4/**
5 * __ffs - find first bit in word.
6 * @word: The word to search
7 *
8 * Undefined if no bit exists, so code should check against 0 first.
9 */
10static __always_inline unsigned long __ffs(unsigned long word)
11{
12 return __builtin_ctzl(word);
13}
14
15#endif
diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h
new file mode 100644
index 000000000000..0248f386635f
--- /dev/null
+++ b/include/asm-generic/bitops/builtin-__fls.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
3
4/**
5 * __fls - find last (most-significant) set bit in a long word
6 * @word: the word to search
7 *
8 * Undefined if no set bit exists, so code should check against 0 first.
9 */
10static __always_inline unsigned long __fls(unsigned long word)
11{
12 return (sizeof(word) * 8) - 1 - __builtin_clzl(word);
13}
14
15#endif
diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h
new file mode 100644
index 000000000000..064825829e1c
--- /dev/null
+++ b/include/asm-generic/bitops/builtin-ffs.h
@@ -0,0 +1,17 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
3
4/**
5 * ffs - find first bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as
9 * the libc and compiler builtin ffs routines, therefore
10 * differs in spirit from the above ffz (man ffs).
11 */
12static __always_inline int ffs(int x)
13{
14 return __builtin_ffs(x);
15}
16
17#endif
diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h
new file mode 100644
index 000000000000..eda652d0ac7f
--- /dev/null
+++ b/include/asm-generic/bitops/builtin-fls.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
2#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
3
4/**
5 * fls - find last (most-significant) bit set
6 * @x: the word to search
7 *
8 * This is defined the same way as ffs.
9 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
10 */
11static __always_inline int fls(int x)
12{
13 return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
14}
15
16#endif
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index f95c663a6a41..61731543c00e 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -54,6 +54,16 @@ static inline int test_bit_le(int nr, const void *addr)
54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr); 54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
55} 55}
56 56
57static inline void set_bit_le(int nr, void *addr)
58{
59 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
60}
61
62static inline void clear_bit_le(int nr, void *addr)
63{
64 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
65}
66
57static inline void __set_bit_le(int nr, void *addr) 67static inline void __set_bit_le(int nr, void *addr)
58{ 68{
59 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); 69 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index a7b0914348fd..d1d70aa19021 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -1,18 +1,8 @@
1#ifndef __ASM_GENERIC_BITS_PER_LONG 1#ifndef __ASM_GENERIC_BITS_PER_LONG
2#define __ASM_GENERIC_BITS_PER_LONG 2#define __ASM_GENERIC_BITS_PER_LONG
3 3
4/* 4#include <uapi/asm-generic/bitsperlong.h>
5 * There seems to be no way of detecting this automatically from user
6 * space, so 64 bit architectures should override this in their
7 * bitsperlong.h. In particular, an architecture that supports
8 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
9 * to decide it, but rather check a compiler provided macro.
10 */
11#ifndef __BITS_PER_LONG
12#define __BITS_PER_LONG 32
13#endif
14 5
15#ifdef __KERNEL__
16 6
17#ifdef CONFIG_64BIT 7#ifdef CONFIG_64BIT
18#define BITS_PER_LONG 64 8#define BITS_PER_LONG 64
@@ -32,5 +22,4 @@
32#define BITS_PER_LONG_LONG 64 22#define BITS_PER_LONG_LONG 64
33#endif 23#endif
34 24
35#endif /* __KERNEL__ */
36#endif /* __ASM_GENERIC_BITS_PER_LONG */ 25#endif /* __ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h
new file mode 100644
index 000000000000..90a32a61dd21
--- /dev/null
+++ b/include/asm-generic/clkdev.h
@@ -0,0 +1,28 @@
1/*
2 * include/asm-generic/clkdev.h
3 *
4 * Based on the ARM clkdev.h:
5 * Copyright (C) 2008 Russell King.
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 * Helper for the clk API to assist looking up a struct clk.
12 */
13#ifndef __ASM_CLKDEV_H
14#define __ASM_CLKDEV_H
15
16#include <linux/slab.h>
17
18struct clk;
19
20static inline int __clk_get(struct clk *clk) { return 1; }
21static inline void __clk_put(struct clk *clk) { }
22
23static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
24{
25 return kzalloc(size, GFP_KERNEL);
26}
27
28#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 365ea09ed3b0..a9432fc6b8ba 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -60,6 +60,8 @@ struct device_node;
60 * @get: returns value for signal "offset"; for output signals this 60 * @get: returns value for signal "offset"; for output signals this
61 * returns either the value actually sensed, or zero 61 * returns either the value actually sensed, or zero
62 * @direction_output: configures signal "offset" as output, or returns error 62 * @direction_output: configures signal "offset" as output, or returns error
63 * @set_debounce: optional hook for setting debounce time for specified gpio in
64 * interrupt triggered gpio chips
63 * @set: assigns output value for signal "offset" 65 * @set: assigns output value for signal "offset"
64 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings; 66 * @to_irq: optional hook supporting non-static gpio_to_irq() mappings;
65 * implementation may not sleep 67 * implementation may not sleep
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 1ca3efc976cc..27d4ec0dfce0 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -4,33 +4,11 @@
4 * Integer declarations for architectures which use "long" 4 * Integer declarations for architectures which use "long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
8#ifndef _ASM_GENERIC_INT_L64_H 7#ifndef _ASM_GENERIC_INT_L64_H
9#define _ASM_GENERIC_INT_L64_H 8#define _ASM_GENERIC_INT_L64_H
10 9
11#include <asm/bitsperlong.h> 10#include <uapi/asm-generic/int-l64.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21 11
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28typedef __signed__ long __s64;
29typedef unsigned long __u64;
30
31#endif /* __ASSEMBLY__ */
32
33#ifdef __KERNEL__
34 12
35#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
36 14
@@ -68,6 +46,4 @@ typedef unsigned long u64;
68 46
69#endif /* __ASSEMBLY__ */ 47#endif /* __ASSEMBLY__ */
70 48
71#endif /* __KERNEL__ */
72
73#endif /* _ASM_GENERIC_INT_L64_H */ 49#endif /* _ASM_GENERIC_INT_L64_H */
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index f394147c0739..4cd84855cb46 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -4,38 +4,11 @@
4 * Integer declarations for architectures which use "long long" 4 * Integer declarations for architectures which use "long long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
8#ifndef _ASM_GENERIC_INT_LL64_H 7#ifndef _ASM_GENERIC_INT_LL64_H
9#define _ASM_GENERIC_INT_LL64_H 8#define _ASM_GENERIC_INT_LL64_H
10 9
11#include <asm/bitsperlong.h> 10#include <uapi/asm-generic/int-ll64.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21 11
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#ifdef __GNUC__
29__extension__ typedef __signed__ long long __s64;
30__extension__ typedef unsigned long long __u64;
31#else
32typedef __signed__ long long __s64;
33typedef unsigned long long __u64;
34#endif
35
36#endif /* __ASSEMBLY__ */
37
38#ifdef __KERNEL__
39 12
40#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
41 14
@@ -73,6 +46,4 @@ typedef unsigned long long u64;
73 46
74#endif /* __ASSEMBLY__ */ 47#endif /* __ASSEMBLY__ */
75 48
76#endif /* __KERNEL__ */
77
78#endif /* _ASM_GENERIC_INT_LL64_H */ 49#endif /* _ASM_GENERIC_INT_LL64_H */
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index 15828b2d663c..d17295b290fa 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -1,105 +1,12 @@
1#ifndef _ASM_GENERIC_IOCTL_H 1#ifndef _ASM_GENERIC_IOCTL_H
2#define _ASM_GENERIC_IOCTL_H 2#define _ASM_GENERIC_IOCTL_H
3 3
4/* ioctl command encoding: 32 bits total, command in lower 16 bits, 4#include <uapi/asm-generic/ioctl.h>
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
13 5
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24
25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
37
38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
40#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
41#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
42
43#define _IOC_NRSHIFT 0
44#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
45#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
47
48/*
49 * Direction bits, which any architecture can choose to override
50 * before including this file.
51 */
52
53#ifndef _IOC_NONE
54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
64
65#define _IOC(dir,type,nr,size) \
66 (((dir) << _IOC_DIRSHIFT) | \
67 ((type) << _IOC_TYPESHIFT) | \
68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT))
70
71#ifdef __KERNEL__
72/* provoke compile error for invalid uses of size argument */ 6/* provoke compile error for invalid uses of size argument */
73extern unsigned int __invalid_size_argument_for_IOC; 7extern unsigned int __invalid_size_argument_for_IOC;
74#define _IOC_TYPECHECK(t) \ 8#define _IOC_TYPECHECK(t) \
75 ((sizeof(t) == sizeof(t[1]) && \ 9 ((sizeof(t) == sizeof(t[1]) && \
76 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ 10 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
77 sizeof(t) : __invalid_size_argument_for_IOC) 11 sizeof(t) : __invalid_size_argument_for_IOC)
78#else
79#define _IOC_TYPECHECK(t) (sizeof(t))
80#endif
81
82/* used to create numbers */
83#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
84#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
85#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
86#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
87#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
88#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
89#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
90
91/* used to decode ioctl numbers.. */
92#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
93#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
94#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
95#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
96
97/* ...and for the drivers/sound files... */
98
99#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
100#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
101#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
102#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
103#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
104
105#endif /* _ASM_GENERIC_IOCTL_H */ 12#endif /* _ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h
index 5cba37f9eae1..9d96605f160a 100644
--- a/include/asm-generic/kvm_para.h
+++ b/include/asm-generic/kvm_para.h
@@ -1,7 +1,8 @@
1#ifndef _ASM_GENERIC_KVM_PARA_H 1#ifndef _ASM_GENERIC_KVM_PARA_H
2#define _ASM_GENERIC_KVM_PARA_H 2#define _ASM_GENERIC_KVM_PARA_H
3 3
4#ifdef __KERNEL__ 4#include <uapi/asm-generic/kvm_para.h>
5
5 6
6/* 7/*
7 * This function is used by architectures that support kvm to avoid issuing 8 * This function is used by architectures that support kvm to avoid issuing
@@ -17,6 +18,4 @@ static inline unsigned int kvm_arch_para_features(void)
17 return 0; 18 return 0;
18} 19}
19 20
20#endif /* _KERNEL__ */
21
22#endif 21#endif
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index 580a6d35c700..c04e0db8a2d6 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -26,7 +26,13 @@ static inline void
26__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) 26__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
27{ 27{
28 if (unlikely(atomic_xchg(count, 0) != 1)) 28 if (unlikely(atomic_xchg(count, 0) != 1))
29 fail_fn(count); 29 /*
30 * We failed to acquire the lock, so mark it contended
31 * to ensure that any waiting tasks are woken up by the
32 * unlock slow path.
33 */
34 if (likely(atomic_xchg(count, -1) != 1))
35 fail_fn(count);
30} 36}
31 37
32/** 38/**
@@ -43,7 +49,8 @@ static inline int
43__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) 49__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
44{ 50{
45 if (unlikely(atomic_xchg(count, 0) != 1)) 51 if (unlikely(atomic_xchg(count, 0) != 1))
46 return fail_fn(count); 52 if (likely(atomic_xchg(count, -1) != 1))
53 return fail_fn(count);
47 return 0; 54 return 0;
48} 55}
49 56
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
index 835632a3b468..04e715bccceb 100644
--- a/include/asm-generic/param.h
+++ b/include/asm-generic/param.h
@@ -1,25 +1,10 @@
1#ifndef __ASM_GENERIC_PARAM_H 1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H 2#define __ASM_GENERIC_PARAM_H
3 3
4#ifndef HZ 4#include <uapi/asm-generic/param.h>
5#define HZ 100
6#endif
7 5
8#ifndef EXEC_PAGESIZE
9#define EXEC_PAGESIZE 4096
10#endif
11
12#ifndef NOGROUP
13#define NOGROUP (-1)
14#endif
15
16#define MAXHOSTNAMELEN 64 /* max length of hostname */
17
18#ifdef __KERNEL__
19# undef HZ 6# undef HZ
20# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 7# define HZ CONFIG_HZ /* Internal kernel timer frequency */
21# define USER_HZ 100 /* some user interfaces are */ 8# define USER_HZ 100 /* some user interfaces are */
22# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */ 9# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
23#endif
24
25#endif /* __ASM_GENERIC_PARAM_H */ 10#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index ff4947b7a976..b36ce40bd1c6 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -87,7 +87,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
87 pmd_t *pmdp) 87 pmd_t *pmdp)
88{ 88{
89 pmd_t pmd = *pmdp; 89 pmd_t pmd = *pmdp;
90 pmd_clear(mm, address, pmdp); 90 pmd_clear(pmdp);
91 return pmd; 91 return pmd;
92} 92}
93#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 93#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -162,6 +162,19 @@ extern void pmdp_splitting_flush(struct vm_area_struct *vma,
162 unsigned long address, pmd_t *pmdp); 162 unsigned long address, pmd_t *pmdp);
163#endif 163#endif
164 164
165#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT
166extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
167#endif
168
169#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW
170extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
171#endif
172
173#ifndef __HAVE_ARCH_PMDP_INVALIDATE
174extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
175 pmd_t *pmdp);
176#endif
177
165#ifndef __HAVE_ARCH_PTE_SAME 178#ifndef __HAVE_ARCH_PTE_SAME
166static inline int pte_same(pte_t pte_a, pte_t pte_b) 179static inline int pte_same(pte_t pte_a, pte_t pte_b)
167{ 180{
@@ -381,48 +394,59 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
381 394
382#ifndef __HAVE_PFNMAP_TRACKING 395#ifndef __HAVE_PFNMAP_TRACKING
383/* 396/*
384 * Interface that can be used by architecture code to keep track of 397 * Interfaces that can be used by architecture code to keep track of
385 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 398 * memory type of pfn mappings specified by the remap_pfn_range,
386 * 399 * vm_insert_pfn.
387 * track_pfn_vma_new is called when a _new_ pfn mapping is being established 400 */
388 * for physical range indicated by pfn and size. 401
402/*
403 * track_pfn_remap is called when a _new_ pfn mapping is being established
404 * by remap_pfn_range() for physical range indicated by pfn and size.
389 */ 405 */
390static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 406static inline int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
391 unsigned long pfn, unsigned long size) 407 unsigned long pfn, unsigned long addr,
408 unsigned long size)
392{ 409{
393 return 0; 410 return 0;
394} 411}
395 412
396/* 413/*
397 * Interface that can be used by architecture code to keep track of 414 * track_pfn_insert is called when a _new_ single pfn is established
398 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 415 * by vm_insert_pfn().
399 * 416 */
400 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets 417static inline int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
418 unsigned long pfn)
419{
420 return 0;
421}
422
423/*
424 * track_pfn_copy is called when vma that is covering the pfnmap gets
401 * copied through copy_page_range(). 425 * copied through copy_page_range().
402 */ 426 */
403static inline int track_pfn_vma_copy(struct vm_area_struct *vma) 427static inline int track_pfn_copy(struct vm_area_struct *vma)
404{ 428{
405 return 0; 429 return 0;
406} 430}
407 431
408/* 432/*
409 * Interface that can be used by architecture code to keep track of
410 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
411 *
412 * untrack_pfn_vma is called while unmapping a pfnmap for a region. 433 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
413 * untrack can be called for a specific region indicated by pfn and size or 434 * untrack can be called for a specific region indicated by pfn and size or
414 * can be for the entire vma (in which case size can be zero). 435 * can be for the entire vma (in which case pfn, size are zero).
415 */ 436 */
416static inline void untrack_pfn_vma(struct vm_area_struct *vma, 437static inline void untrack_pfn(struct vm_area_struct *vma,
417 unsigned long pfn, unsigned long size) 438 unsigned long pfn, unsigned long size)
418{ 439{
419} 440}
420#else 441#else
421extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 442extern int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
422 unsigned long pfn, unsigned long size); 443 unsigned long pfn, unsigned long addr,
423extern int track_pfn_vma_copy(struct vm_area_struct *vma); 444 unsigned long size);
424extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, 445extern int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
425 unsigned long size); 446 unsigned long pfn);
447extern int track_pfn_copy(struct vm_area_struct *vma);
448extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
449 unsigned long size);
426#endif 450#endif
427 451
428#ifdef CONFIG_MMU 452#ifdef CONFIG_MMU
diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index 61fa862fe08d..b4ea8f50fc65 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -1,70 +1,8 @@
1#ifndef _ASM_GENERIC_RESOURCE_H 1#ifndef _ASM_GENERIC_RESOURCE_H
2#define _ASM_GENERIC_RESOURCE_H 2#define _ASM_GENERIC_RESOURCE_H
3 3
4/* 4#include <uapi/asm-generic/resource.h>
5 * Resource limit IDs
6 *
7 * ( Compatibility detail: there are architectures that have
8 * a different rlimit ID order in the 5-9 range and want
9 * to keep that order for binary compatibility. The reasons
10 * are historic and all new rlimits are identical across all
11 * arches. If an arch has such special order for some rlimits
12 * then it defines them prior including asm-generic/resource.h. )
13 */
14
15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */
19#define RLIMIT_CORE 4 /* max core file size */
20
21#ifndef RLIMIT_RSS
22# define RLIMIT_RSS 5 /* max resident set size */
23#endif
24
25#ifndef RLIMIT_NPROC
26# define RLIMIT_NPROC 6 /* max number of processes */
27#endif
28
29#ifndef RLIMIT_NOFILE
30# define RLIMIT_NOFILE 7 /* max number of open files */
31#endif
32 5
33#ifndef RLIMIT_MEMLOCK
34# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
35#endif
36
37#ifndef RLIMIT_AS
38# define RLIMIT_AS 9 /* address space limit */
39#endif
40
41#define RLIMIT_LOCKS 10 /* maximum file locks held */
42#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
43#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
44#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
45 0-39 for nice level 19 .. -20 */
46#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
47#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
48#define RLIM_NLIMITS 16
49
50/*
51 * SuS says limits have to be unsigned.
52 * Which makes a ton more sense anyway.
53 *
54 * Some architectures override this (for compatibility reasons):
55 */
56#ifndef RLIM_INFINITY
57# define RLIM_INFINITY (~0UL)
58#endif
59
60/*
61 * RLIMIT_STACK default maximum - some architectures override it:
62 */
63#ifndef _STK_LIM_MAX
64# define _STK_LIM_MAX RLIM_INFINITY
65#endif
66
67#ifdef __KERNEL__
68 6
69/* 7/*
70 * boot-time rlimit defaults for the init task: 8 * boot-time rlimit defaults for the init task:
@@ -89,6 +27,4 @@
89 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \ 27 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \
90} 28}
91 29
92#endif /* __KERNEL__ */
93
94#endif 30#endif
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 8ed67779fc09..b685d3bd32e2 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -1,145 +1,8 @@
1#ifndef _ASM_GENERIC_SIGINFO_H 1#ifndef _ASM_GENERIC_SIGINFO_H
2#define _ASM_GENERIC_SIGINFO_H 2#define _ASM_GENERIC_SIGINFO_H
3 3
4#include <linux/compiler.h> 4#include <uapi/asm-generic/siginfo.h>
5#include <linux/types.h>
6 5
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12/*
13 * This is the size (including padding) of the part of the
14 * struct siginfo that is before the union.
15 */
16#ifndef __ARCH_SI_PREAMBLE_SIZE
17#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
18#endif
19
20#define SI_MAX_SIZE 128
21#ifndef SI_PAD_SIZE
22#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
23#endif
24
25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif
28
29/*
30 * The default "si_band" type is "long", as specified by POSIX.
31 * However, some architectures want to override this to "int"
32 * for historical compatibility reasons, so we allow that.
33 */
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef __ARCH_SI_CLOCK_T
39#define __ARCH_SI_CLOCK_T __kernel_clock_t
40#endif
41
42#ifndef __ARCH_SI_ATTRIBUTES
43#define __ARCH_SI_ATTRIBUTES
44#endif
45
46#ifndef HAVE_ARCH_SIGINFO_T
47
48typedef struct siginfo {
49 int si_signo;
50 int si_errno;
51 int si_code;
52
53 union {
54 int _pad[SI_PAD_SIZE];
55
56 /* kill() */
57 struct {
58 __kernel_pid_t _pid; /* sender's pid */
59 __ARCH_SI_UID_T _uid; /* sender's uid */
60 } _kill;
61
62 /* POSIX.1b timers */
63 struct {
64 __kernel_timer_t _tid; /* timer id */
65 int _overrun; /* overrun count */
66 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
67 sigval_t _sigval; /* same as below */
68 int _sys_private; /* not to be passed to user */
69 } _timer;
70
71 /* POSIX.1b signals */
72 struct {
73 __kernel_pid_t _pid; /* sender's pid */
74 __ARCH_SI_UID_T _uid; /* sender's uid */
75 sigval_t _sigval;
76 } _rt;
77
78 /* SIGCHLD */
79 struct {
80 __kernel_pid_t _pid; /* which child */
81 __ARCH_SI_UID_T _uid; /* sender's uid */
82 int _status; /* exit code */
83 __ARCH_SI_CLOCK_T _utime;
84 __ARCH_SI_CLOCK_T _stime;
85 } _sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90#ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92#endif
93 short _addr_lsb; /* LSB of the reported address */
94 } _sigfault;
95
96 /* SIGPOLL */
97 struct {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd;
100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
108 } _sifields;
109} __ARCH_SI_ATTRIBUTES siginfo_t;
110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
113#endif
114
115/*
116 * How these fields are to be accessed.
117 */
118#define si_pid _sifields._kill._pid
119#define si_uid _sifields._kill._uid
120#define si_tid _sifields._timer._tid
121#define si_overrun _sifields._timer._overrun
122#define si_sys_private _sifields._timer._sys_private
123#define si_status _sifields._sigchld._status
124#define si_utime _sifields._sigchld._utime
125#define si_stime _sifields._sigchld._stime
126#define si_value _sifields._rt._sigval
127#define si_int _sifields._rt._sigval.sival_int
128#define si_ptr _sifields._rt._sigval.sival_ptr
129#define si_addr _sifields._sigfault._addr
130#ifdef __ARCH_SI_TRAPNO
131#define si_trapno _sifields._sigfault._trapno
132#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb
134#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
141
142#ifdef __KERNEL__
143#define __SI_MASK 0xffff0000u 6#define __SI_MASK 0xffff0000u
144#define __SI_KILL (0 << 16) 7#define __SI_KILL (0 << 16)
145#define __SI_TIMER (1 << 16) 8#define __SI_TIMER (1 << 16)
@@ -150,162 +13,6 @@ typedef struct siginfo {
150#define __SI_MESGQ (6 << 16) 13#define __SI_MESGQ (6 << 16)
151#define __SI_SYS (7 << 16) 14#define __SI_SYS (7 << 16)
152#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 15#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
153#else
154#define __SI_KILL 0
155#define __SI_TIMER 0
156#define __SI_POLL 0
157#define __SI_FAULT 0
158#define __SI_CHLD 0
159#define __SI_RT 0
160#define __SI_MESGQ 0
161#define __SI_SYS 0
162#define __SI_CODE(T,N) (N)
163#endif
164
165/*
166 * si_code values
167 * Digital reserves positive values for kernel-generated signals.
168 */
169#define SI_USER 0 /* sent by kill, sigsend, raise */
170#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
171#define SI_QUEUE -1 /* sent by sigqueue */
172#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
173#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
174#define SI_ASYNCIO -4 /* sent by AIO completion */
175#define SI_SIGIO -5 /* sent by queued SIGIO */
176#define SI_TKILL -6 /* sent by tkill system call */
177#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
178
179#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
180#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
181
182/*
183 * SIGILL si_codes
184 */
185#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
186#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
187#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
188#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
189#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
190#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
191#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
192#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
193#define NSIGILL 8
194
195/*
196 * SIGFPE si_codes
197 */
198#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
199#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
200#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
201#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
202#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
203#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
204#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
205#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
206#define NSIGFPE 8
207
208/*
209 * SIGSEGV si_codes
210 */
211#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
212#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
213#define NSIGSEGV 2
214
215/*
216 * SIGBUS si_codes
217 */
218#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
219#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
220#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
221/* hardware memory error consumed on a machine check: action required */
222#define BUS_MCEERR_AR (__SI_FAULT|4)
223/* hardware memory error detected in process but not consumed: action optional*/
224#define BUS_MCEERR_AO (__SI_FAULT|5)
225#define NSIGBUS 5
226
227/*
228 * SIGTRAP si_codes
229 */
230#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
231#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
232#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
233#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
234#define NSIGTRAP 4
235
236/*
237 * SIGCHLD si_codes
238 */
239#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
240#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
241#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
242#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
243#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
244#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
245#define NSIGCHLD 6
246
247/*
248 * SIGPOLL si_codes
249 */
250#define POLL_IN (__SI_POLL|1) /* data input available */
251#define POLL_OUT (__SI_POLL|2) /* output buffers available */
252#define POLL_MSG (__SI_POLL|3) /* input message available */
253#define POLL_ERR (__SI_POLL|4) /* i/o error */
254#define POLL_PRI (__SI_POLL|5) /* high priority input available */
255#define POLL_HUP (__SI_POLL|6) /* device disconnected */
256#define NSIGPOLL 6
257
258/*
259 * SIGSYS si_codes
260 */
261#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
262#define NSIGSYS 1
263
264/*
265 * sigevent definitions
266 *
267 * It seems likely that SIGEV_THREAD will have to be handled from
268 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
269 * thread manager then catches and does the appropriate nonsense.
270 * However, everything is written out here so as to not get lost.
271 */
272#define SIGEV_SIGNAL 0 /* notify via signal */
273#define SIGEV_NONE 1 /* other notification: meaningless */
274#define SIGEV_THREAD 2 /* deliver via thread creation */
275#define SIGEV_THREAD_ID 4 /* deliver to thread */
276
277/*
278 * This works because the alignment is ok on all current architectures
279 * but we leave open this being overridden in the future
280 */
281#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
282#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
283#endif
284
285#define SIGEV_MAX_SIZE 64
286#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
287 / sizeof(int))
288
289typedef struct sigevent {
290 sigval_t sigev_value;
291 int sigev_signo;
292 int sigev_notify;
293 union {
294 int _pad[SIGEV_PAD_SIZE];
295 int _tid;
296
297 struct {
298 void (*_function)(sigval_t);
299 void *_attribute; /* really pthread_attr_t */
300 } _sigev_thread;
301 } _sigev_un;
302} sigevent_t;
303
304#define sigev_notify_function _sigev_un._sigev_thread._function
305#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
306#define sigev_notify_thread_id _sigev_un._tid
307
308#ifdef __KERNEL__
309 16
310struct siginfo; 17struct siginfo;
311void do_schedule_next_timer(struct siginfo *info); 18void do_schedule_next_timer(struct siginfo *info);
@@ -327,6 +34,4 @@ static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
327 34
328extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from); 35extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
329 36
330#endif /* __KERNEL__ */
331
332#endif 37#endif
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index 555c0aee8a47..98caa306122a 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -1,131 +1,16 @@
1#ifndef __ASM_GENERIC_SIGNAL_H 1#ifndef __ASM_GENERIC_SIGNAL_H
2#define __ASM_GENERIC_SIGNAL_H 2#define __ASM_GENERIC_SIGNAL_H
3 3
4#include <linux/types.h> 4#include <uapi/asm-generic/signal.h>
5
6#define _NSIG 64
7#define _NSIG_BPW __BITS_PER_LONG
8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9
10#define SIGHUP 1
11#define SIGINT 2
12#define SIGQUIT 3
13#define SIGILL 4
14#define SIGTRAP 5
15#define SIGABRT 6
16#define SIGIOT 6
17#define SIGBUS 7
18#define SIGFPE 8
19#define SIGKILL 9
20#define SIGUSR1 10
21#define SIGSEGV 11
22#define SIGUSR2 12
23#define SIGPIPE 13
24#define SIGALRM 14
25#define SIGTERM 15
26#define SIGSTKFLT 16
27#define SIGCHLD 17
28#define SIGCONT 18
29#define SIGSTOP 19
30#define SIGTSTP 20
31#define SIGTTIN 21
32#define SIGTTOU 22
33#define SIGURG 23
34#define SIGXCPU 24
35#define SIGXFSZ 25
36#define SIGVTALRM 26
37#define SIGPROF 27
38#define SIGWINCH 28
39#define SIGIO 29
40#define SIGPOLL SIGIO
41/*
42#define SIGLOST 29
43*/
44#define SIGPWR 30
45#define SIGSYS 31
46#define SIGUNUSED 31
47
48/* These should not be considered constants from userland. */
49#define SIGRTMIN 32
50#ifndef SIGRTMAX
51#define SIGRTMAX _NSIG
52#endif
53
54/*
55 * SA_FLAGS values:
56 *
57 * SA_ONSTACK indicates that a registered stack_t will be used.
58 * SA_RESTART flag to get restarting signals (which were the default long ago)
59 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
60 * SA_RESETHAND clears the handler when the signal is delivered.
61 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
62 * SA_NODEFER prevents the current signal from being masked in the handler.
63 *
64 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
65 * Unix names RESETHAND and NODEFER respectively.
66 */
67#define SA_NOCLDSTOP 0x00000001
68#define SA_NOCLDWAIT 0x00000002
69#define SA_SIGINFO 0x00000004
70#define SA_ONSTACK 0x08000000
71#define SA_RESTART 0x10000000
72#define SA_NODEFER 0x40000000
73#define SA_RESETHAND 0x80000000
74
75#define SA_NOMASK SA_NODEFER
76#define SA_ONESHOT SA_RESETHAND
77
78/*
79 * New architectures should not define the obsolete
80 * SA_RESTORER 0x04000000
81 */
82
83/*
84 * sigaltstack controls
85 */
86#define SS_ONSTACK 1
87#define SS_DISABLE 2
88
89#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192
91 5
92#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
93typedef struct {
94 unsigned long sig[_NSIG_WORDS];
95} sigset_t;
96
97/* not actually used, but required for linux/syscalls.h */
98typedef unsigned long old_sigset_t;
99
100#include <asm-generic/signal-defs.h>
101
102struct sigaction {
103 __sighandler_t sa_handler;
104 unsigned long sa_flags;
105#ifdef SA_RESTORER 7#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
107#endif 8#endif
108 sigset_t sa_mask; /* mask last for extensibility */
109};
110
111struct k_sigaction {
112 struct sigaction sa;
113};
114
115typedef struct sigaltstack {
116 void __user *ss_sp;
117 int ss_flags;
118 size_t ss_size;
119} stack_t;
120
121#ifdef __KERNEL__
122 9
123#include <asm/sigcontext.h> 10#include <asm/sigcontext.h>
124#undef __HAVE_ARCH_SIG_BITOPS 11#undef __HAVE_ARCH_SIG_BITOPS
125 12
126#define ptrace_signal_deliver(regs, cookie) do { } while (0) 13#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127 14
128#endif /* __KERNEL__ */
129#endif /* __ASSEMBLY__ */ 15#endif /* __ASSEMBLY__ */
130
131#endif /* _ASM_GENERIC_SIGNAL_H */ 16#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index c749af9c0983..4b934e9ec970 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -1,86 +1,7 @@
1#ifndef _GENERIC_STATFS_H 1#ifndef _GENERIC_STATFS_H
2#define _GENERIC_STATFS_H 2#define _GENERIC_STATFS_H
3 3
4#include <linux/types.h> 4#include <uapi/asm-generic/statfs.h>
5 5
6#ifdef __KERNEL__
7typedef __kernel_fsid_t fsid_t; 6typedef __kernel_fsid_t fsid_t;
8#endif 7#endif
9
10/*
11 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
12 * Yes, they differ in signedness as well as size.
13 * Special cases can override it for themselves -- except for S390x, which
14 * is just a little too special for us. And MIPS, which I'm not touching
15 * with a 10' pole.
16 */
17#ifndef __statfs_word
18#if __BITS_PER_LONG == 64
19#define __statfs_word long
20#else
21#define __statfs_word __u32
22#endif
23#endif
24
25struct statfs {
26 __statfs_word f_type;
27 __statfs_word f_bsize;
28 __statfs_word f_blocks;
29 __statfs_word f_bfree;
30 __statfs_word f_bavail;
31 __statfs_word f_files;
32 __statfs_word f_ffree;
33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen;
35 __statfs_word f_frsize;
36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
38};
39
40/*
41 * ARM needs to avoid the 32-bit padding at the end, for consistency
42 * between EABI and OABI
43 */
44#ifndef ARCH_PACK_STATFS64
45#define ARCH_PACK_STATFS64
46#endif
47
48struct statfs64 {
49 __statfs_word f_type;
50 __statfs_word f_bsize;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_bavail;
54 __u64 f_files;
55 __u64 f_ffree;
56 __kernel_fsid_t f_fsid;
57 __statfs_word f_namelen;
58 __statfs_word f_frsize;
59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
61} ARCH_PACK_STATFS64;
62
63/*
64 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
65 * to be compatible with the i386 ABI
66 */
67#ifndef ARCH_PACK_COMPAT_STATFS64
68#define ARCH_PACK_COMPAT_STATFS64
69#endif
70
71struct compat_statfs64 {
72 __u32 f_type;
73 __u32 f_bsize;
74 __u64 f_blocks;
75 __u64 f_bfree;
76 __u64 f_bavail;
77 __u64 f_files;
78 __u64 f_ffree;
79 __kernel_fsid_t f_fsid;
80 __u32 f_namelen;
81 __u32 f_frsize;
82 __u32 f_flags;
83 __u32 f_spare[4];
84} ARCH_PACK_COMPAT_STATFS64;
85
86#endif
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index d0922adc56d4..4fa6fe0fc2a2 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -1,54 +1,9 @@
1#ifndef _ASM_GENERIC_TERMIOS_H 1#ifndef _ASM_GENERIC_TERMIOS_H
2#define _ASM_GENERIC_TERMIOS_H 2#define _ASM_GENERIC_TERMIOS_H
3/*
4 * Most architectures have straight copies of the x86 code, with
5 * varying levels of bug fixes on top. Usually it's a good idea
6 * to use this generic version instead, but be careful to avoid
7 * ABI changes.
8 * New architectures should not provide their own version.
9 */
10 3
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49#ifdef __KERNEL__
50 4
51#include <asm/uaccess.h> 5#include <asm/uaccess.h>
6#include <uapi/asm-generic/termios.h>
52 7
53/* intr=^C quit=^\ erase=del kill=^U 8/* intr=^C quit=^\ erase=del kill=^U
54 eof=^D vtime=\0 vmin=\1 sxtc=\0 9 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -149,6 +104,4 @@ static inline int kernel_termios_to_user_termios(struct termios __user *u,
149} 104}
150#endif /* TCGETS2 */ 105#endif /* TCGETS2 */
151 106
152#endif /* __KERNEL__ */
153
154#endif /* _ASM_GENERIC_TERMIOS_H */ 107#endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 991ef01cd77e..a36991ab334e 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -1,908 +1,4 @@
1#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL) 1#include <uapi/asm-generic/unistd.h>
2#define _ASM_GENERIC_UNISTD_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * This file contains the system call numbers, based on the
8 * layout of the x86-64 architecture, which embeds the
9 * pointer to the syscall in the table.
10 *
11 * As a basic principle, no duplication of functionality
12 * should be added, e.g. we don't use lseek when llseek
13 * is present. New architectures should use this file
14 * and implement the less feature-full calls in user space.
15 */
16
17#ifndef __SYSCALL
18#define __SYSCALL(x, y)
19#endif
20
21#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
23#else
24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
25#endif
26
27#ifdef __SYSCALL_COMPAT
28#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
29#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
30#else
31#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
32#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
33#endif
34
35#define __NR_io_setup 0
36__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
37#define __NR_io_destroy 1
38__SYSCALL(__NR_io_destroy, sys_io_destroy)
39#define __NR_io_submit 2
40__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
41#define __NR_io_cancel 3
42__SYSCALL(__NR_io_cancel, sys_io_cancel)
43#define __NR_io_getevents 4
44__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
45
46/* fs/xattr.c */
47#define __NR_setxattr 5
48__SYSCALL(__NR_setxattr, sys_setxattr)
49#define __NR_lsetxattr 6
50__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
51#define __NR_fsetxattr 7
52__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
53#define __NR_getxattr 8
54__SYSCALL(__NR_getxattr, sys_getxattr)
55#define __NR_lgetxattr 9
56__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
57#define __NR_fgetxattr 10
58__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
59#define __NR_listxattr 11
60__SYSCALL(__NR_listxattr, sys_listxattr)
61#define __NR_llistxattr 12
62__SYSCALL(__NR_llistxattr, sys_llistxattr)
63#define __NR_flistxattr 13
64__SYSCALL(__NR_flistxattr, sys_flistxattr)
65#define __NR_removexattr 14
66__SYSCALL(__NR_removexattr, sys_removexattr)
67#define __NR_lremovexattr 15
68__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
69#define __NR_fremovexattr 16
70__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
71
72/* fs/dcache.c */
73#define __NR_getcwd 17
74__SYSCALL(__NR_getcwd, sys_getcwd)
75
76/* fs/cookies.c */
77#define __NR_lookup_dcookie 18
78__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
79
80/* fs/eventfd.c */
81#define __NR_eventfd2 19
82__SYSCALL(__NR_eventfd2, sys_eventfd2)
83
84/* fs/eventpoll.c */
85#define __NR_epoll_create1 20
86__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
87#define __NR_epoll_ctl 21
88__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
89#define __NR_epoll_pwait 22
90__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
91
92/* fs/fcntl.c */
93#define __NR_dup 23
94__SYSCALL(__NR_dup, sys_dup)
95#define __NR_dup3 24
96__SYSCALL(__NR_dup3, sys_dup3)
97#define __NR3264_fcntl 25
98__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
99
100/* fs/inotify_user.c */
101#define __NR_inotify_init1 26
102__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
103#define __NR_inotify_add_watch 27
104__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
105#define __NR_inotify_rm_watch 28
106__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
107
108/* fs/ioctl.c */
109#define __NR_ioctl 29
110__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
111
112/* fs/ioprio.c */
113#define __NR_ioprio_set 30
114__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
115#define __NR_ioprio_get 31
116__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
117
118/* fs/locks.c */
119#define __NR_flock 32
120__SYSCALL(__NR_flock, sys_flock)
121
122/* fs/namei.c */
123#define __NR_mknodat 33
124__SYSCALL(__NR_mknodat, sys_mknodat)
125#define __NR_mkdirat 34
126__SYSCALL(__NR_mkdirat, sys_mkdirat)
127#define __NR_unlinkat 35
128__SYSCALL(__NR_unlinkat, sys_unlinkat)
129#define __NR_symlinkat 36
130__SYSCALL(__NR_symlinkat, sys_symlinkat)
131#define __NR_linkat 37
132__SYSCALL(__NR_linkat, sys_linkat)
133#define __NR_renameat 38
134__SYSCALL(__NR_renameat, sys_renameat)
135
136/* fs/namespace.c */
137#define __NR_umount2 39
138__SYSCALL(__NR_umount2, sys_umount)
139#define __NR_mount 40
140__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
141#define __NR_pivot_root 41
142__SYSCALL(__NR_pivot_root, sys_pivot_root)
143
144/* fs/nfsctl.c */
145#define __NR_nfsservctl 42
146__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
147
148/* fs/open.c */
149#define __NR3264_statfs 43
150__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
151 compat_sys_statfs64)
152#define __NR3264_fstatfs 44
153__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
154 compat_sys_fstatfs64)
155#define __NR3264_truncate 45
156__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
157 compat_sys_truncate64)
158#define __NR3264_ftruncate 46
159__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
160 compat_sys_ftruncate64)
161
162#define __NR_fallocate 47
163__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
164#define __NR_faccessat 48
165__SYSCALL(__NR_faccessat, sys_faccessat)
166#define __NR_chdir 49
167__SYSCALL(__NR_chdir, sys_chdir)
168#define __NR_fchdir 50
169__SYSCALL(__NR_fchdir, sys_fchdir)
170#define __NR_chroot 51
171__SYSCALL(__NR_chroot, sys_chroot)
172#define __NR_fchmod 52
173__SYSCALL(__NR_fchmod, sys_fchmod)
174#define __NR_fchmodat 53
175__SYSCALL(__NR_fchmodat, sys_fchmodat)
176#define __NR_fchownat 54
177__SYSCALL(__NR_fchownat, sys_fchownat)
178#define __NR_fchown 55
179__SYSCALL(__NR_fchown, sys_fchown)
180#define __NR_openat 56
181__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
182#define __NR_close 57
183__SYSCALL(__NR_close, sys_close)
184#define __NR_vhangup 58
185__SYSCALL(__NR_vhangup, sys_vhangup)
186
187/* fs/pipe.c */
188#define __NR_pipe2 59
189__SYSCALL(__NR_pipe2, sys_pipe2)
190
191/* fs/quota.c */
192#define __NR_quotactl 60
193__SYSCALL(__NR_quotactl, sys_quotactl)
194
195/* fs/readdir.c */
196#define __NR_getdents64 61
197__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
198
199/* fs/read_write.c */
200#define __NR3264_lseek 62
201__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
202#define __NR_read 63
203__SYSCALL(__NR_read, sys_read)
204#define __NR_write 64
205__SYSCALL(__NR_write, sys_write)
206#define __NR_readv 65
207__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
208#define __NR_writev 66
209__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
210#define __NR_pread64 67
211__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
212#define __NR_pwrite64 68
213__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
214#define __NR_preadv 69
215__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
216#define __NR_pwritev 70
217__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
218
219/* fs/sendfile.c */
220#define __NR3264_sendfile 71
221__SYSCALL(__NR3264_sendfile, sys_sendfile64)
222
223/* fs/select.c */
224#define __NR_pselect6 72
225__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
226#define __NR_ppoll 73
227__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
228
229/* fs/signalfd.c */
230#define __NR_signalfd4 74
231__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
232
233/* fs/splice.c */
234#define __NR_vmsplice 75
235__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
236#define __NR_splice 76
237__SYSCALL(__NR_splice, sys_splice)
238#define __NR_tee 77
239__SYSCALL(__NR_tee, sys_tee)
240
241/* fs/stat.c */
242#define __NR_readlinkat 78
243__SYSCALL(__NR_readlinkat, sys_readlinkat)
244#define __NR3264_fstatat 79
245__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
246#define __NR3264_fstat 80
247__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
248
249/* fs/sync.c */
250#define __NR_sync 81
251__SYSCALL(__NR_sync, sys_sync)
252#define __NR_fsync 82
253__SYSCALL(__NR_fsync, sys_fsync)
254#define __NR_fdatasync 83
255__SYSCALL(__NR_fdatasync, sys_fdatasync)
256#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
257#define __NR_sync_file_range2 84
258__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
259 compat_sys_sync_file_range2)
260#else
261#define __NR_sync_file_range 84
262__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
263 compat_sys_sync_file_range)
264#endif
265
266/* fs/timerfd.c */
267#define __NR_timerfd_create 85
268__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
269#define __NR_timerfd_settime 86
270__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
271 compat_sys_timerfd_settime)
272#define __NR_timerfd_gettime 87
273__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
274 compat_sys_timerfd_gettime)
275
276/* fs/utimes.c */
277#define __NR_utimensat 88
278__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
279
280/* kernel/acct.c */
281#define __NR_acct 89
282__SYSCALL(__NR_acct, sys_acct)
283
284/* kernel/capability.c */
285#define __NR_capget 90
286__SYSCALL(__NR_capget, sys_capget)
287#define __NR_capset 91
288__SYSCALL(__NR_capset, sys_capset)
289
290/* kernel/exec_domain.c */
291#define __NR_personality 92
292__SYSCALL(__NR_personality, sys_personality)
293
294/* kernel/exit.c */
295#define __NR_exit 93
296__SYSCALL(__NR_exit, sys_exit)
297#define __NR_exit_group 94
298__SYSCALL(__NR_exit_group, sys_exit_group)
299#define __NR_waitid 95
300__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
301
302/* kernel/fork.c */
303#define __NR_set_tid_address 96
304__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
305#define __NR_unshare 97
306__SYSCALL(__NR_unshare, sys_unshare)
307
308/* kernel/futex.c */
309#define __NR_futex 98
310__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
311#define __NR_set_robust_list 99
312__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
313 compat_sys_set_robust_list)
314#define __NR_get_robust_list 100
315__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
316 compat_sys_get_robust_list)
317
318/* kernel/hrtimer.c */
319#define __NR_nanosleep 101
320__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
321
322/* kernel/itimer.c */
323#define __NR_getitimer 102
324__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
325#define __NR_setitimer 103
326__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
327
328/* kernel/kexec.c */
329#define __NR_kexec_load 104
330__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
331
332/* kernel/module.c */
333#define __NR_init_module 105
334__SYSCALL(__NR_init_module, sys_init_module)
335#define __NR_delete_module 106
336__SYSCALL(__NR_delete_module, sys_delete_module)
337
338/* kernel/posix-timers.c */
339#define __NR_timer_create 107
340__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
341#define __NR_timer_gettime 108
342__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
343#define __NR_timer_getoverrun 109
344__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
345#define __NR_timer_settime 110
346__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
347#define __NR_timer_delete 111
348__SYSCALL(__NR_timer_delete, sys_timer_delete)
349#define __NR_clock_settime 112
350__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
351#define __NR_clock_gettime 113
352__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
353#define __NR_clock_getres 114
354__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
355#define __NR_clock_nanosleep 115
356__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
357 compat_sys_clock_nanosleep)
358
359/* kernel/printk.c */
360#define __NR_syslog 116
361__SYSCALL(__NR_syslog, sys_syslog)
362
363/* kernel/ptrace.c */
364#define __NR_ptrace 117
365__SYSCALL(__NR_ptrace, sys_ptrace)
366
367/* kernel/sched.c */
368#define __NR_sched_setparam 118
369__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
370#define __NR_sched_setscheduler 119
371__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
372#define __NR_sched_getscheduler 120
373__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
374#define __NR_sched_getparam 121
375__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
376#define __NR_sched_setaffinity 122
377__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
378 compat_sys_sched_setaffinity)
379#define __NR_sched_getaffinity 123
380__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
381 compat_sys_sched_getaffinity)
382#define __NR_sched_yield 124
383__SYSCALL(__NR_sched_yield, sys_sched_yield)
384#define __NR_sched_get_priority_max 125
385__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
386#define __NR_sched_get_priority_min 126
387__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
388#define __NR_sched_rr_get_interval 127
389__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
390 compat_sys_sched_rr_get_interval)
391
392/* kernel/signal.c */
393#define __NR_restart_syscall 128
394__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
395#define __NR_kill 129
396__SYSCALL(__NR_kill, sys_kill)
397#define __NR_tkill 130
398__SYSCALL(__NR_tkill, sys_tkill)
399#define __NR_tgkill 131
400__SYSCALL(__NR_tgkill, sys_tgkill)
401#define __NR_sigaltstack 132
402__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
403#define __NR_rt_sigsuspend 133
404__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
405#define __NR_rt_sigaction 134
406__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
407#define __NR_rt_sigprocmask 135
408__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
409#define __NR_rt_sigpending 136
410__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
411#define __NR_rt_sigtimedwait 137
412__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
413 compat_sys_rt_sigtimedwait)
414#define __NR_rt_sigqueueinfo 138
415__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
416 compat_sys_rt_sigqueueinfo)
417#define __NR_rt_sigreturn 139
418__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
419
420/* kernel/sys.c */
421#define __NR_setpriority 140
422__SYSCALL(__NR_setpriority, sys_setpriority)
423#define __NR_getpriority 141
424__SYSCALL(__NR_getpriority, sys_getpriority)
425#define __NR_reboot 142
426__SYSCALL(__NR_reboot, sys_reboot)
427#define __NR_setregid 143
428__SYSCALL(__NR_setregid, sys_setregid)
429#define __NR_setgid 144
430__SYSCALL(__NR_setgid, sys_setgid)
431#define __NR_setreuid 145
432__SYSCALL(__NR_setreuid, sys_setreuid)
433#define __NR_setuid 146
434__SYSCALL(__NR_setuid, sys_setuid)
435#define __NR_setresuid 147
436__SYSCALL(__NR_setresuid, sys_setresuid)
437#define __NR_getresuid 148
438__SYSCALL(__NR_getresuid, sys_getresuid)
439#define __NR_setresgid 149
440__SYSCALL(__NR_setresgid, sys_setresgid)
441#define __NR_getresgid 150
442__SYSCALL(__NR_getresgid, sys_getresgid)
443#define __NR_setfsuid 151
444__SYSCALL(__NR_setfsuid, sys_setfsuid)
445#define __NR_setfsgid 152
446__SYSCALL(__NR_setfsgid, sys_setfsgid)
447#define __NR_times 153
448__SC_COMP(__NR_times, sys_times, compat_sys_times)
449#define __NR_setpgid 154
450__SYSCALL(__NR_setpgid, sys_setpgid)
451#define __NR_getpgid 155
452__SYSCALL(__NR_getpgid, sys_getpgid)
453#define __NR_getsid 156
454__SYSCALL(__NR_getsid, sys_getsid)
455#define __NR_setsid 157
456__SYSCALL(__NR_setsid, sys_setsid)
457#define __NR_getgroups 158
458__SYSCALL(__NR_getgroups, sys_getgroups)
459#define __NR_setgroups 159
460__SYSCALL(__NR_setgroups, sys_setgroups)
461#define __NR_uname 160
462__SYSCALL(__NR_uname, sys_newuname)
463#define __NR_sethostname 161
464__SYSCALL(__NR_sethostname, sys_sethostname)
465#define __NR_setdomainname 162
466__SYSCALL(__NR_setdomainname, sys_setdomainname)
467#define __NR_getrlimit 163
468__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
469#define __NR_setrlimit 164
470__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
471#define __NR_getrusage 165
472__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
473#define __NR_umask 166
474__SYSCALL(__NR_umask, sys_umask)
475#define __NR_prctl 167
476__SYSCALL(__NR_prctl, sys_prctl)
477#define __NR_getcpu 168
478__SYSCALL(__NR_getcpu, sys_getcpu)
479
480/* kernel/time.c */
481#define __NR_gettimeofday 169
482__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
483#define __NR_settimeofday 170
484__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
485#define __NR_adjtimex 171
486__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
487
488/* kernel/timer.c */
489#define __NR_getpid 172
490__SYSCALL(__NR_getpid, sys_getpid)
491#define __NR_getppid 173
492__SYSCALL(__NR_getppid, sys_getppid)
493#define __NR_getuid 174
494__SYSCALL(__NR_getuid, sys_getuid)
495#define __NR_geteuid 175
496__SYSCALL(__NR_geteuid, sys_geteuid)
497#define __NR_getgid 176
498__SYSCALL(__NR_getgid, sys_getgid)
499#define __NR_getegid 177
500__SYSCALL(__NR_getegid, sys_getegid)
501#define __NR_gettid 178
502__SYSCALL(__NR_gettid, sys_gettid)
503#define __NR_sysinfo 179
504__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
505
506/* ipc/mqueue.c */
507#define __NR_mq_open 180
508__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
509#define __NR_mq_unlink 181
510__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
511#define __NR_mq_timedsend 182
512__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
513#define __NR_mq_timedreceive 183
514__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
515 compat_sys_mq_timedreceive)
516#define __NR_mq_notify 184
517__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
518#define __NR_mq_getsetattr 185
519__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
520
521/* ipc/msg.c */
522#define __NR_msgget 186
523__SYSCALL(__NR_msgget, sys_msgget)
524#define __NR_msgctl 187
525__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
526#define __NR_msgrcv 188
527__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
528#define __NR_msgsnd 189
529__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
530
531/* ipc/sem.c */
532#define __NR_semget 190
533__SYSCALL(__NR_semget, sys_semget)
534#define __NR_semctl 191
535__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
536#define __NR_semtimedop 192
537__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
538#define __NR_semop 193
539__SYSCALL(__NR_semop, sys_semop)
540
541/* ipc/shm.c */
542#define __NR_shmget 194
543__SYSCALL(__NR_shmget, sys_shmget)
544#define __NR_shmctl 195
545__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
546#define __NR_shmat 196
547__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
548#define __NR_shmdt 197
549__SYSCALL(__NR_shmdt, sys_shmdt)
550
551/* net/socket.c */
552#define __NR_socket 198
553__SYSCALL(__NR_socket, sys_socket)
554#define __NR_socketpair 199
555__SYSCALL(__NR_socketpair, sys_socketpair)
556#define __NR_bind 200
557__SYSCALL(__NR_bind, sys_bind)
558#define __NR_listen 201
559__SYSCALL(__NR_listen, sys_listen)
560#define __NR_accept 202
561__SYSCALL(__NR_accept, sys_accept)
562#define __NR_connect 203
563__SYSCALL(__NR_connect, sys_connect)
564#define __NR_getsockname 204
565__SYSCALL(__NR_getsockname, sys_getsockname)
566#define __NR_getpeername 205
567__SYSCALL(__NR_getpeername, sys_getpeername)
568#define __NR_sendto 206
569__SYSCALL(__NR_sendto, sys_sendto)
570#define __NR_recvfrom 207
571__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
572#define __NR_setsockopt 208
573__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
574#define __NR_getsockopt 209
575__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
576#define __NR_shutdown 210
577__SYSCALL(__NR_shutdown, sys_shutdown)
578#define __NR_sendmsg 211
579__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
580#define __NR_recvmsg 212
581__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
582
583/* mm/filemap.c */
584#define __NR_readahead 213
585__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
586
587/* mm/nommu.c, also with MMU */
588#define __NR_brk 214
589__SYSCALL(__NR_brk, sys_brk)
590#define __NR_munmap 215
591__SYSCALL(__NR_munmap, sys_munmap)
592#define __NR_mremap 216
593__SYSCALL(__NR_mremap, sys_mremap)
594
595/* security/keys/keyctl.c */
596#define __NR_add_key 217
597__SYSCALL(__NR_add_key, sys_add_key)
598#define __NR_request_key 218
599__SYSCALL(__NR_request_key, sys_request_key)
600#define __NR_keyctl 219
601__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
602
603/* arch/example/kernel/sys_example.c */
604#define __NR_clone 220
605__SYSCALL(__NR_clone, sys_clone)
606#define __NR_execve 221
607__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
608
609#define __NR3264_mmap 222
610__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
611/* mm/fadvise.c */
612#define __NR3264_fadvise64 223
613__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
614
615/* mm/, CONFIG_MMU only */
616#ifndef __ARCH_NOMMU
617#define __NR_swapon 224
618__SYSCALL(__NR_swapon, sys_swapon)
619#define __NR_swapoff 225
620__SYSCALL(__NR_swapoff, sys_swapoff)
621#define __NR_mprotect 226
622__SYSCALL(__NR_mprotect, sys_mprotect)
623#define __NR_msync 227
624__SYSCALL(__NR_msync, sys_msync)
625#define __NR_mlock 228
626__SYSCALL(__NR_mlock, sys_mlock)
627#define __NR_munlock 229
628__SYSCALL(__NR_munlock, sys_munlock)
629#define __NR_mlockall 230
630__SYSCALL(__NR_mlockall, sys_mlockall)
631#define __NR_munlockall 231
632__SYSCALL(__NR_munlockall, sys_munlockall)
633#define __NR_mincore 232
634__SYSCALL(__NR_mincore, sys_mincore)
635#define __NR_madvise 233
636__SYSCALL(__NR_madvise, sys_madvise)
637#define __NR_remap_file_pages 234
638__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
639#define __NR_mbind 235
640__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
641#define __NR_get_mempolicy 236
642__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
643#define __NR_set_mempolicy 237
644__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
645#define __NR_migrate_pages 238
646__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
647#define __NR_move_pages 239
648__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
649#endif
650
651#define __NR_rt_tgsigqueueinfo 240
652__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
653 compat_sys_rt_tgsigqueueinfo)
654#define __NR_perf_event_open 241
655__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
656#define __NR_accept4 242
657__SYSCALL(__NR_accept4, sys_accept4)
658#define __NR_recvmmsg 243
659__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
660
661/*
662 * Architectures may provide up to 16 syscalls of their own
663 * starting with this value.
664 */
665#define __NR_arch_specific_syscall 244
666
667#define __NR_wait4 260
668__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
669#define __NR_prlimit64 261
670__SYSCALL(__NR_prlimit64, sys_prlimit64)
671#define __NR_fanotify_init 262
672__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
673#define __NR_fanotify_mark 263
674__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
675#define __NR_name_to_handle_at 264
676__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
677#define __NR_open_by_handle_at 265
678__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
679 compat_sys_open_by_handle_at)
680#define __NR_clock_adjtime 266
681__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
682#define __NR_syncfs 267
683__SYSCALL(__NR_syncfs, sys_syncfs)
684#define __NR_setns 268
685__SYSCALL(__NR_setns, sys_setns)
686#define __NR_sendmmsg 269
687__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
688#define __NR_process_vm_readv 270
689__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
690 compat_sys_process_vm_readv)
691#define __NR_process_vm_writev 271
692__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
693 compat_sys_process_vm_writev)
694
695#undef __NR_syscalls
696#define __NR_syscalls 272
697
698/*
699 * All syscalls below here should go away really,
700 * these are provided for both review and as a porting
701 * help for the C library version.
702*
703 * Last chance: are any of these important enough to
704 * enable by default?
705 */
706#ifdef __ARCH_WANT_SYSCALL_NO_AT
707#define __NR_open 1024
708__SYSCALL(__NR_open, sys_open)
709#define __NR_link 1025
710__SYSCALL(__NR_link, sys_link)
711#define __NR_unlink 1026
712__SYSCALL(__NR_unlink, sys_unlink)
713#define __NR_mknod 1027
714__SYSCALL(__NR_mknod, sys_mknod)
715#define __NR_chmod 1028
716__SYSCALL(__NR_chmod, sys_chmod)
717#define __NR_chown 1029
718__SYSCALL(__NR_chown, sys_chown)
719#define __NR_mkdir 1030
720__SYSCALL(__NR_mkdir, sys_mkdir)
721#define __NR_rmdir 1031
722__SYSCALL(__NR_rmdir, sys_rmdir)
723#define __NR_lchown 1032
724__SYSCALL(__NR_lchown, sys_lchown)
725#define __NR_access 1033
726__SYSCALL(__NR_access, sys_access)
727#define __NR_rename 1034
728__SYSCALL(__NR_rename, sys_rename)
729#define __NR_readlink 1035
730__SYSCALL(__NR_readlink, sys_readlink)
731#define __NR_symlink 1036
732__SYSCALL(__NR_symlink, sys_symlink)
733#define __NR_utimes 1037
734__SYSCALL(__NR_utimes, sys_utimes)
735#define __NR3264_stat 1038
736__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
737#define __NR3264_lstat 1039
738__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
739
740#undef __NR_syscalls
741#define __NR_syscalls (__NR3264_lstat+1)
742#endif /* __ARCH_WANT_SYSCALL_NO_AT */
743
744#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
745#define __NR_pipe 1040
746__SYSCALL(__NR_pipe, sys_pipe)
747#define __NR_dup2 1041
748__SYSCALL(__NR_dup2, sys_dup2)
749#define __NR_epoll_create 1042
750__SYSCALL(__NR_epoll_create, sys_epoll_create)
751#define __NR_inotify_init 1043
752__SYSCALL(__NR_inotify_init, sys_inotify_init)
753#define __NR_eventfd 1044
754__SYSCALL(__NR_eventfd, sys_eventfd)
755#define __NR_signalfd 1045
756__SYSCALL(__NR_signalfd, sys_signalfd)
757
758#undef __NR_syscalls
759#define __NR_syscalls (__NR_signalfd+1)
760#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
761
762#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
763 defined(__ARCH_WANT_SYSCALL_OFF_T)
764#define __NR_sendfile 1046
765__SYSCALL(__NR_sendfile, sys_sendfile)
766#define __NR_ftruncate 1047
767__SYSCALL(__NR_ftruncate, sys_ftruncate)
768#define __NR_truncate 1048
769__SYSCALL(__NR_truncate, sys_truncate)
770#define __NR_stat 1049
771__SYSCALL(__NR_stat, sys_newstat)
772#define __NR_lstat 1050
773__SYSCALL(__NR_lstat, sys_newlstat)
774#define __NR_fstat 1051
775__SYSCALL(__NR_fstat, sys_newfstat)
776#define __NR_fcntl 1052
777__SYSCALL(__NR_fcntl, sys_fcntl)
778#define __NR_fadvise64 1053
779#define __ARCH_WANT_SYS_FADVISE64
780__SYSCALL(__NR_fadvise64, sys_fadvise64)
781#define __NR_newfstatat 1054
782#define __ARCH_WANT_SYS_NEWFSTATAT
783__SYSCALL(__NR_newfstatat, sys_newfstatat)
784#define __NR_fstatfs 1055
785__SYSCALL(__NR_fstatfs, sys_fstatfs)
786#define __NR_statfs 1056
787__SYSCALL(__NR_statfs, sys_statfs)
788#define __NR_lseek 1057
789__SYSCALL(__NR_lseek, sys_lseek)
790#define __NR_mmap 1058
791__SYSCALL(__NR_mmap, sys_mmap)
792
793#undef __NR_syscalls
794#define __NR_syscalls (__NR_mmap+1)
795#endif /* 32 bit off_t syscalls */
796
797#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
798#define __NR_alarm 1059
799#define __ARCH_WANT_SYS_ALARM
800__SYSCALL(__NR_alarm, sys_alarm)
801#define __NR_getpgrp 1060
802#define __ARCH_WANT_SYS_GETPGRP
803__SYSCALL(__NR_getpgrp, sys_getpgrp)
804#define __NR_pause 1061
805#define __ARCH_WANT_SYS_PAUSE
806__SYSCALL(__NR_pause, sys_pause)
807#define __NR_time 1062
808#define __ARCH_WANT_SYS_TIME
809#define __ARCH_WANT_COMPAT_SYS_TIME
810__SYSCALL(__NR_time, sys_time)
811#define __NR_utime 1063
812#define __ARCH_WANT_SYS_UTIME
813__SYSCALL(__NR_utime, sys_utime)
814
815#define __NR_creat 1064
816__SYSCALL(__NR_creat, sys_creat)
817#define __NR_getdents 1065
818#define __ARCH_WANT_SYS_GETDENTS
819__SYSCALL(__NR_getdents, sys_getdents)
820#define __NR_futimesat 1066
821__SYSCALL(__NR_futimesat, sys_futimesat)
822#define __NR_select 1067
823#define __ARCH_WANT_SYS_SELECT
824__SYSCALL(__NR_select, sys_select)
825#define __NR_poll 1068
826__SYSCALL(__NR_poll, sys_poll)
827#define __NR_epoll_wait 1069
828__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
829#define __NR_ustat 1070
830__SYSCALL(__NR_ustat, sys_ustat)
831#define __NR_vfork 1071
832__SYSCALL(__NR_vfork, sys_vfork)
833#define __NR_oldwait4 1072
834__SYSCALL(__NR_oldwait4, sys_wait4)
835#define __NR_recv 1073
836__SYSCALL(__NR_recv, sys_recv)
837#define __NR_send 1074
838__SYSCALL(__NR_send, sys_send)
839#define __NR_bdflush 1075
840__SYSCALL(__NR_bdflush, sys_bdflush)
841#define __NR_umount 1076
842__SYSCALL(__NR_umount, sys_oldumount)
843#define __ARCH_WANT_SYS_OLDUMOUNT
844#define __NR_uselib 1077
845__SYSCALL(__NR_uselib, sys_uselib)
846#define __NR__sysctl 1078
847__SYSCALL(__NR__sysctl, sys_sysctl)
848
849#define __NR_fork 1079
850#ifdef CONFIG_MMU
851__SYSCALL(__NR_fork, sys_fork)
852#else
853__SYSCALL(__NR_fork, sys_ni_syscall)
854#endif /* CONFIG_MMU */
855
856#undef __NR_syscalls
857#define __NR_syscalls (__NR_fork+1)
858
859#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
860
861/*
862 * 32 bit systems traditionally used different
863 * syscalls for off_t and loff_t arguments, while
864 * 64 bit systems only need the off_t version.
865 * For new 32 bit platforms, there is no need to
866 * implement the old 32 bit off_t syscalls, so
867 * they take different names.
868 * Here we map the numbers so that both versions
869 * use the same syscall table layout.
870 */
871#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
872#define __NR_fcntl __NR3264_fcntl
873#define __NR_statfs __NR3264_statfs
874#define __NR_fstatfs __NR3264_fstatfs
875#define __NR_truncate __NR3264_truncate
876#define __NR_ftruncate __NR3264_ftruncate
877#define __NR_lseek __NR3264_lseek
878#define __NR_sendfile __NR3264_sendfile
879#define __NR_newfstatat __NR3264_fstatat
880#define __NR_fstat __NR3264_fstat
881#define __NR_mmap __NR3264_mmap
882#define __NR_fadvise64 __NR3264_fadvise64
883#ifdef __NR3264_stat
884#define __NR_stat __NR3264_stat
885#define __NR_lstat __NR3264_lstat
886#endif
887#else
888#define __NR_fcntl64 __NR3264_fcntl
889#define __NR_statfs64 __NR3264_statfs
890#define __NR_fstatfs64 __NR3264_fstatfs
891#define __NR_truncate64 __NR3264_truncate
892#define __NR_ftruncate64 __NR3264_ftruncate
893#define __NR_llseek __NR3264_lseek
894#define __NR_sendfile64 __NR3264_sendfile
895#define __NR_fstatat64 __NR3264_fstatat
896#define __NR_fstat64 __NR3264_fstat
897#define __NR_mmap2 __NR3264_mmap
898#define __NR_fadvise64_64 __NR3264_fadvise64
899#ifdef __NR3264_stat
900#define __NR_stat64 __NR3264_stat
901#define __NR_lstat64 __NR3264_lstat
902#endif
903#endif
904
905#ifdef __KERNEL__
906 2
907/* 3/*
908 * These are required system calls, we should 4 * These are required system calls, we should
@@ -926,6 +22,3 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
926#ifndef cond_syscall 22#ifndef cond_syscall
927#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 23#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
928#endif 24#endif
929
930#endif /* __KERNEL__ */
931#endif /* _ASM_GENERIC_UNISTD_H */
diff --git a/include/asm-generic/xor.h b/include/asm-generic/xor.h
index 6028fb862254..b4d843225afd 100644
--- a/include/asm-generic/xor.h
+++ b/include/asm-generic/xor.h
@@ -693,7 +693,7 @@ static struct xor_block_template xor_block_32regs = {
693 .do_5 = xor_32regs_5, 693 .do_5 = xor_32regs_5,
694}; 694};
695 695
696static struct xor_block_template xor_block_8regs_p = { 696static struct xor_block_template xor_block_8regs_p __maybe_unused = {
697 .name = "8regs_prefetch", 697 .name = "8regs_prefetch",
698 .do_2 = xor_8regs_p_2, 698 .do_2 = xor_8regs_p_2,
699 .do_3 = xor_8regs_p_3, 699 .do_3 = xor_8regs_p_3,
@@ -701,7 +701,7 @@ static struct xor_block_template xor_block_8regs_p = {
701 .do_5 = xor_8regs_p_5, 701 .do_5 = xor_8regs_p_5,
702}; 702};
703 703
704static struct xor_block_template xor_block_32regs_p = { 704static struct xor_block_template xor_block_32regs_p __maybe_unused = {
705 .name = "32regs_prefetch", 705 .name = "32regs_prefetch",
706 .do_2 = xor_32regs_p_2, 706 .do_2 = xor_32regs_p_2,
707 .do_3 = xor_32regs_p_3, 707 .do_3 = xor_32regs_p_3,
diff --git a/include/clocksource/arm_generic.h b/include/clocksource/arm_generic.h
new file mode 100644
index 000000000000..5b41b0d27f0f
--- /dev/null
+++ b/include/clocksource/arm_generic.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __CLKSOURCE_ARM_GENERIC_H
17#define __CLKSOURCE_ARM_GENERIC_H
18
19extern int arm_generic_timer_init(void);
20
21#endif
diff --git a/include/crypto/cast5.h b/include/crypto/cast5.h
new file mode 100644
index 000000000000..586183a0406e
--- /dev/null
+++ b/include/crypto/cast5.h
@@ -0,0 +1,27 @@
1#ifndef _CRYPTO_CAST5_H
2#define _CRYPTO_CAST5_H
3
4#include <linux/types.h>
5#include <linux/crypto.h>
6
7#define CAST5_BLOCK_SIZE 8
8#define CAST5_MIN_KEY_SIZE 5
9#define CAST5_MAX_KEY_SIZE 16
10
11struct cast5_ctx {
12 u32 Km[16];
13 u8 Kr[16];
14 int rr; /* rr ? rounds = 12 : rounds = 16; (rfc 2144) */
15};
16
17int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
18
19void __cast5_encrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
20void __cast5_decrypt(struct cast5_ctx *ctx, u8 *dst, const u8 *src);
21
22extern const u32 cast5_s1[256];
23extern const u32 cast5_s2[256];
24extern const u32 cast5_s3[256];
25extern const u32 cast5_s4[256];
26
27#endif
diff --git a/include/crypto/cast6.h b/include/crypto/cast6.h
new file mode 100644
index 000000000000..157af6f342c8
--- /dev/null
+++ b/include/crypto/cast6.h
@@ -0,0 +1,28 @@
1#ifndef _CRYPTO_CAST6_H
2#define _CRYPTO_CAST6_H
3
4#include <linux/types.h>
5#include <linux/crypto.h>
6
7#define CAST6_BLOCK_SIZE 16
8#define CAST6_MIN_KEY_SIZE 16
9#define CAST6_MAX_KEY_SIZE 32
10
11struct cast6_ctx {
12 u32 Km[12][4];
13 u8 Kr[12][4];
14};
15
16int __cast6_setkey(struct cast6_ctx *ctx, const u8 *key,
17 unsigned int keylen, u32 *flags);
18int cast6_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen);
19
20void __cast6_encrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
21void __cast6_decrypt(struct cast6_ctx *ctx, u8 *dst, const u8 *src);
22
23extern const u32 cast6_s1[256];
24extern const u32 cast6_s2[256];
25extern const u32 cast6_s3[256];
26extern const u32 cast6_s4[256];
27
28#endif
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 5bfad8c80595..821eae8cbd8c 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -83,6 +83,8 @@ struct hash_alg_common *ahash_attr_alg(struct rtattr *rta, u32 type, u32 mask);
83 83
84int crypto_register_shash(struct shash_alg *alg); 84int crypto_register_shash(struct shash_alg *alg);
85int crypto_unregister_shash(struct shash_alg *alg); 85int crypto_unregister_shash(struct shash_alg *alg);
86int crypto_register_shashes(struct shash_alg *algs, int count);
87int crypto_unregister_shashes(struct shash_alg *algs, int count);
86int shash_register_instance(struct crypto_template *tmpl, 88int shash_register_instance(struct crypto_template *tmpl,
87 struct shash_instance *inst); 89 struct shash_instance *inst);
88void shash_free_instance(struct crypto_instance *inst); 90void shash_free_instance(struct crypto_instance *inst);
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index 1e38a19d68f6..e69de29bb2d1 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -1,15 +0,0 @@
1header-y += drm.h
2header-y += drm_fourcc.h
3header-y += drm_mode.h
4header-y += drm_sarea.h
5header-y += exynos_drm.h
6header-y += i810_drm.h
7header-y += i915_drm.h
8header-y += mga_drm.h
9header-y += nouveau_drm.h
10header-y += r128_drm.h
11header-y += radeon_drm.h
12header-y += savage_drm.h
13header-y += sis_drm.h
14header-y += via_drm.h
15header-y += vmwgfx_drm.h
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index d6b67bb9075f..3fd82809b2d4 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -72,7 +72,8 @@
72#include <linux/workqueue.h> 72#include <linux/workqueue.h>
73#include <linux/poll.h> 73#include <linux/poll.h>
74#include <asm/pgalloc.h> 74#include <asm/pgalloc.h>
75#include "drm.h" 75#include <drm/drm.h>
76#include <drm/drm_sarea.h>
76 77
77#include <linux/idr.h> 78#include <linux/idr.h>
78 79
@@ -84,9 +85,9 @@ struct module;
84struct drm_file; 85struct drm_file;
85struct drm_device; 86struct drm_device;
86 87
87#include "drm_os_linux.h" 88#include <drm/drm_os_linux.h>
88#include "drm_hashtab.h" 89#include <drm/drm_hashtab.h>
89#include "drm_mm.h" 90#include <drm/drm_mm.h>
90 91
91#define DRM_UT_CORE 0x01 92#define DRM_UT_CORE 0x01
92#define DRM_UT_DRIVER 0x02 93#define DRM_UT_DRIVER 0x02
@@ -426,8 +427,8 @@ struct drm_prime_file_private {
426/** File private data */ 427/** File private data */
427struct drm_file { 428struct drm_file {
428 int authenticated; 429 int authenticated;
429 pid_t pid; 430 struct pid *pid;
430 uid_t uid; 431 kuid_t uid;
431 drm_magic_t magic; 432 drm_magic_t magic;
432 unsigned long ioctl_count; 433 unsigned long ioctl_count;
433 struct list_head lhead; 434 struct list_head lhead;
@@ -675,7 +676,7 @@ struct drm_gem_object {
675 struct dma_buf_attachment *import_attach; 676 struct dma_buf_attachment *import_attach;
676}; 677};
677 678
678#include "drm_crtc.h" 679#include <drm/drm_crtc.h>
679 680
680/* per-master structure */ 681/* per-master structure */
681struct drm_master { 682struct drm_master {
@@ -1303,7 +1304,7 @@ extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *v
1303extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1304extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1304 1305
1305 /* Memory management support (drm_memory.h) */ 1306 /* Memory management support (drm_memory.h) */
1306#include "drm_memory.h" 1307#include <drm/drm_memory.h>
1307extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); 1308extern void drm_free_agp(DRM_AGP_MEM * handle, int pages);
1308extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); 1309extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start);
1309extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, 1310extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev,
@@ -1367,6 +1368,7 @@ extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
1367 1368
1368/* Cache management (drm_cache.c) */ 1369/* Cache management (drm_cache.c) */
1369void drm_clflush_pages(struct page *pages[], unsigned long num_pages); 1370void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
1371void drm_clflush_sg(struct sg_table *st);
1370void drm_clflush_virt_range(char *addr, unsigned long length); 1372void drm_clflush_virt_range(char *addr, unsigned long length);
1371 1373
1372 /* Locking IOCTL support (drm_lock.h) */ 1374 /* Locking IOCTL support (drm_lock.h) */
@@ -1612,7 +1614,7 @@ void drm_gem_vm_open(struct vm_area_struct *vma);
1612void drm_gem_vm_close(struct vm_area_struct *vma); 1614void drm_gem_vm_close(struct vm_area_struct *vma);
1613int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1615int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1614 1616
1615#include "drm_global.h" 1617#include <drm/drm_global.h>
1616 1618
1617static inline void 1619static inline void
1618drm_gem_object_reference(struct drm_gem_object *obj) 1620drm_gem_object_reference(struct drm_gem_object *obj)
@@ -1721,7 +1723,7 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1721{ 1723{
1722} 1724}
1723 1725
1724#include "drm_mem_util.h" 1726#include <drm/drm_mem_util.h>
1725 1727
1726extern int drm_fill_in_dev(struct drm_device *dev, 1728extern int drm_fill_in_dev(struct drm_device *dev,
1727 const struct pci_device_id *ent, 1729 const struct pci_device_id *ent,
diff --git a/include/drm/drm_buffer.h b/include/drm/drm_buffer.h
index 322dbff3f861..c80d3a340b94 100644
--- a/include/drm/drm_buffer.h
+++ b/include/drm/drm_buffer.h
@@ -35,7 +35,7 @@
35#ifndef _DRM_BUFFER_H_ 35#ifndef _DRM_BUFFER_H_
36#define _DRM_BUFFER_H_ 36#define _DRM_BUFFER_H_
37 37
38#include "drmP.h" 38#include <drm/drmP.h>
39 39
40struct drm_buffer { 40struct drm_buffer {
41 int iterator; 41 int iterator;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a1a0386e0160..3fa18b7e9497 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -30,6 +30,7 @@
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/idr.h> 31#include <linux/idr.h>
32#include <linux/fb.h> 32#include <linux/fb.h>
33#include <drm/drm_mode.h>
33 34
34#include <drm/drm_fourcc.h> 35#include <drm/drm_fourcc.h>
35 36
@@ -118,7 +119,8 @@ enum drm_mode_status {
118 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \ 119 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
119 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \ 120 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
120 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \ 121 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
121 .vscan = (vs), .flags = (f), .vrefresh = 0 122 .vscan = (vs), .flags = (f), .vrefresh = 0, \
123 .base.type = DRM_MODE_OBJECT_MODE
122 124
123#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */ 125#define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
124 126
@@ -166,8 +168,6 @@ struct drm_display_mode {
166 int crtc_vsync_start; 168 int crtc_vsync_start;
167 int crtc_vsync_end; 169 int crtc_vsync_end;
168 int crtc_vtotal; 170 int crtc_vtotal;
169 int crtc_hadjusted;
170 int crtc_vadjusted;
171 171
172 /* Driver private mode info */ 172 /* Driver private mode info */
173 int private_size; 173 int private_size;
@@ -216,11 +216,10 @@ struct drm_display_info {
216 u32 color_formats; 216 u32 color_formats;
217 217
218 u8 cea_rev; 218 u8 cea_rev;
219
220 char *raw_edid; /* if any */
221}; 219};
222 220
223struct drm_framebuffer_funcs { 221struct drm_framebuffer_funcs {
222 /* note: use drm_framebuffer_remove() */
224 void (*destroy)(struct drm_framebuffer *framebuffer); 223 void (*destroy)(struct drm_framebuffer *framebuffer);
225 int (*create_handle)(struct drm_framebuffer *fb, 224 int (*create_handle)(struct drm_framebuffer *fb,
226 struct drm_file *file_priv, 225 struct drm_file *file_priv,
@@ -245,6 +244,16 @@ struct drm_framebuffer_funcs {
245 244
246struct drm_framebuffer { 245struct drm_framebuffer {
247 struct drm_device *dev; 246 struct drm_device *dev;
247 /*
248 * Note that the fb is refcounted for the benefit of driver internals,
249 * for example some hw, disabling a CRTC/plane is asynchronous, and
250 * scanout does not actually complete until the next vblank. So some
251 * cleanup (like releasing the reference(s) on the backing GEM bo(s))
252 * should be deferred. In cases like this, the driver would like to
253 * hold a ref to the fb even though it has already been removed from
254 * userspace perspective.
255 */
256 struct kref refcount;
248 struct list_head head; 257 struct list_head head;
249 struct drm_mode_object base; 258 struct drm_mode_object base;
250 const struct drm_framebuffer_funcs *funcs; 259 const struct drm_framebuffer_funcs *funcs;
@@ -360,6 +369,9 @@ struct drm_crtc_funcs {
360 * @enabled: is this CRTC enabled? 369 * @enabled: is this CRTC enabled?
361 * @mode: current mode timings 370 * @mode: current mode timings
362 * @hwmode: mode timings as programmed to hw regs 371 * @hwmode: mode timings as programmed to hw regs
372 * @invert_dimensions: for purposes of error checking crtc vs fb sizes,
373 * invert the width/height of the crtc. This is used if the driver
374 * is performing 90 or 270 degree rotated scanout
363 * @x: x position on screen 375 * @x: x position on screen
364 * @y: y position on screen 376 * @y: y position on screen
365 * @funcs: CRTC control functions 377 * @funcs: CRTC control functions
@@ -393,6 +405,8 @@ struct drm_crtc {
393 */ 405 */
394 struct drm_display_mode hwmode; 406 struct drm_display_mode hwmode;
395 407
408 bool invert_dimensions;
409
396 int x, y; 410 int x, y;
397 const struct drm_crtc_funcs *funcs; 411 const struct drm_crtc_funcs *funcs;
398 412
@@ -594,6 +608,7 @@ struct drm_connector {
594 int video_latency[2]; /* [0]: progressive, [1]: interlaced */ 608 int video_latency[2]; /* [0]: progressive, [1]: interlaced */
595 int audio_latency[2]; 609 int audio_latency[2];
596 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ 610 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
611 unsigned bad_edid_counter;
597}; 612};
598 613
599/** 614/**
@@ -863,6 +878,7 @@ extern char *drm_get_tv_subconnector_name(int val);
863extern char *drm_get_tv_select_name(int val); 878extern char *drm_get_tv_select_name(int val);
864extern void drm_fb_release(struct drm_file *file_priv); 879extern void drm_fb_release(struct drm_file *file_priv);
865extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 880extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
881extern bool drm_probe_ddc(struct i2c_adapter *adapter);
866extern struct edid *drm_get_edid(struct drm_connector *connector, 882extern struct edid *drm_get_edid(struct drm_connector *connector,
867 struct i2c_adapter *adapter); 883 struct i2c_adapter *adapter);
868extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 884extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
@@ -921,6 +937,9 @@ extern void drm_framebuffer_set_object(struct drm_device *dev,
921extern int drm_framebuffer_init(struct drm_device *dev, 937extern int drm_framebuffer_init(struct drm_device *dev,
922 struct drm_framebuffer *fb, 938 struct drm_framebuffer *fb,
923 const struct drm_framebuffer_funcs *funcs); 939 const struct drm_framebuffer_funcs *funcs);
940extern void drm_framebuffer_unreference(struct drm_framebuffer *fb);
941extern void drm_framebuffer_reference(struct drm_framebuffer *fb);
942extern void drm_framebuffer_remove(struct drm_framebuffer *fb);
924extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb); 943extern void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
925extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc); 944extern int drmfb_probe(struct drm_device *dev, struct drm_crtc *crtc);
926extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); 945extern int drmfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
@@ -1036,7 +1055,7 @@ extern int drm_add_modes_noedid(struct drm_connector *connector,
1036 int hdisplay, int vdisplay); 1055 int hdisplay, int vdisplay);
1037 1056
1038extern int drm_edid_header_is_valid(const u8 *raw_edid); 1057extern int drm_edid_header_is_valid(const u8 *raw_edid);
1039extern bool drm_edid_block_valid(u8 *raw_edid, int block); 1058extern bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid);
1040extern bool drm_edid_is_valid(struct edid *edid); 1059extern bool drm_edid_is_valid(struct edid *edid);
1041struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, 1060struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
1042 int hsize, int vsize, int fresh, 1061 int hsize, int vsize, int fresh,
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 1744b18c06b3..fe061489f91f 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -26,7 +26,19 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28 28
29/* From the VESA DisplayPort spec */ 29/*
30 * Unless otherwise noted, all values are from the DP 1.1a spec. Note that
31 * DP and DPCD versions are independent. Differences from 1.0 are not noted,
32 * 1.0 devices basically don't exist in the wild.
33 *
34 * Abbreviations, in chronological order:
35 *
36 * eDP: Embedded DisplayPort version 1
37 * DPI: DisplayPort Interoperability Guideline v1.1a
38 * 1.2: DisplayPort 1.2
39 *
40 * 1.2 formally includes both eDP and DPI definitions.
41 */
30 42
31#define AUX_NATIVE_WRITE 0x8 43#define AUX_NATIVE_WRITE 0x8
32#define AUX_NATIVE_READ 0x9 44#define AUX_NATIVE_READ 0x9
@@ -53,7 +65,7 @@
53 65
54#define DP_MAX_LANE_COUNT 0x002 66#define DP_MAX_LANE_COUNT 0x002
55# define DP_MAX_LANE_COUNT_MASK 0x1f 67# define DP_MAX_LANE_COUNT_MASK 0x1f
56# define DP_TPS3_SUPPORTED (1 << 6) 68# define DP_TPS3_SUPPORTED (1 << 6) /* 1.2 */
57# define DP_ENHANCED_FRAME_CAP (1 << 7) 69# define DP_ENHANCED_FRAME_CAP (1 << 7)
58 70
59#define DP_MAX_DOWNSPREAD 0x003 71#define DP_MAX_DOWNSPREAD 0x003
@@ -69,19 +81,33 @@
69/* 10b = TMDS or HDMI */ 81/* 10b = TMDS or HDMI */
70/* 11b = Other */ 82/* 11b = Other */
71# define DP_FORMAT_CONVERSION (1 << 3) 83# define DP_FORMAT_CONVERSION (1 << 3)
84# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */
72 85
73#define DP_MAIN_LINK_CHANNEL_CODING 0x006 86#define DP_MAIN_LINK_CHANNEL_CODING 0x006
74 87
75#define DP_DOWN_STREAM_PORT_COUNT 0x007 88#define DP_DOWN_STREAM_PORT_COUNT 0x007
76#define DP_PORT_COUNT_MASK 0x0f 89# define DP_PORT_COUNT_MASK 0x0f
77#define DP_OUI_SUPPORT (1 << 7) 90# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */
78 91# define DP_OUI_SUPPORT (1 << 7)
79#define DP_EDP_CONFIGURATION_CAP 0x00d 92
80#define DP_TRAINING_AUX_RD_INTERVAL 0x00e 93#define DP_I2C_SPEED_CAP 0x00c /* DPI */
81 94# define DP_I2C_SPEED_1K 0x01
82#define DP_PSR_SUPPORT 0x070 95# define DP_I2C_SPEED_5K 0x02
96# define DP_I2C_SPEED_10K 0x04
97# define DP_I2C_SPEED_100K 0x08
98# define DP_I2C_SPEED_400K 0x10
99# define DP_I2C_SPEED_1M 0x20
100
101#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */
102#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */
103
104/* Multiple stream transport */
105#define DP_MSTM_CAP 0x021 /* 1.2 */
106# define DP_MST_CAP (1 << 0)
107
108#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
83# define DP_PSR_IS_SUPPORTED 1 109# define DP_PSR_IS_SUPPORTED 1
84#define DP_PSR_CAPS 0x071 110#define DP_PSR_CAPS 0x071 /* XXX 1.2? */
85# define DP_PSR_NO_TRAIN_ON_EXIT 1 111# define DP_PSR_NO_TRAIN_ON_EXIT 1
86# define DP_PSR_SETUP_TIME_330 (0 << 1) 112# define DP_PSR_SETUP_TIME_330 (0 << 1)
87# define DP_PSR_SETUP_TIME_275 (1 << 1) 113# define DP_PSR_SETUP_TIME_275 (1 << 1)
@@ -93,11 +119,36 @@
93# define DP_PSR_SETUP_TIME_MASK (7 << 1) 119# define DP_PSR_SETUP_TIME_MASK (7 << 1)
94# define DP_PSR_SETUP_TIME_SHIFT 1 120# define DP_PSR_SETUP_TIME_SHIFT 1
95 121
122/*
123 * 0x80-0x8f describe downstream port capabilities, but there are two layouts
124 * based on whether DP_DETAILED_CAP_INFO_AVAILABLE was set. If it was not,
125 * each port's descriptor is one byte wide. If it was set, each port's is
126 * four bytes wide, starting with the one byte from the base info. As of
127 * DP interop v1.1a only VGA defines additional detail.
128 */
129
130/* offset 0 */
131#define DP_DOWNSTREAM_PORT_0 0x80
132# define DP_DS_PORT_TYPE_MASK (7 << 0)
133# define DP_DS_PORT_TYPE_DP 0
134# define DP_DS_PORT_TYPE_VGA 1
135# define DP_DS_PORT_TYPE_DVI 2
136# define DP_DS_PORT_TYPE_HDMI 3
137# define DP_DS_PORT_TYPE_NON_EDID 4
138# define DP_DS_PORT_HPD (1 << 3)
139/* offset 1 for VGA is maximum megapixels per second / 8 */
140/* offset 2 */
141# define DP_DS_VGA_MAX_BPC_MASK (3 << 0)
142# define DP_DS_VGA_8BPC 0
143# define DP_DS_VGA_10BPC 1
144# define DP_DS_VGA_12BPC 2
145# define DP_DS_VGA_16BPC 3
146
96/* link configuration */ 147/* link configuration */
97#define DP_LINK_BW_SET 0x100 148#define DP_LINK_BW_SET 0x100
98# define DP_LINK_BW_1_62 0x06 149# define DP_LINK_BW_1_62 0x06
99# define DP_LINK_BW_2_7 0x0a 150# define DP_LINK_BW_2_7 0x0a
100# define DP_LINK_BW_5_4 0x14 151# define DP_LINK_BW_5_4 0x14 /* 1.2 */
101 152
102#define DP_LANE_COUNT_SET 0x101 153#define DP_LANE_COUNT_SET 0x101
103# define DP_LANE_COUNT_MASK 0x0f 154# define DP_LANE_COUNT_MASK 0x0f
@@ -107,7 +158,7 @@
107# define DP_TRAINING_PATTERN_DISABLE 0 158# define DP_TRAINING_PATTERN_DISABLE 0
108# define DP_TRAINING_PATTERN_1 1 159# define DP_TRAINING_PATTERN_1 1
109# define DP_TRAINING_PATTERN_2 2 160# define DP_TRAINING_PATTERN_2 2
110# define DP_TRAINING_PATTERN_3 3 161# define DP_TRAINING_PATTERN_3 3 /* 1.2 */
111# define DP_TRAINING_PATTERN_MASK 0x3 162# define DP_TRAINING_PATTERN_MASK 0x3
112 163
113# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) 164# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2)
@@ -148,24 +199,38 @@
148 199
149#define DP_DOWNSPREAD_CTRL 0x107 200#define DP_DOWNSPREAD_CTRL 0x107
150# define DP_SPREAD_AMP_0_5 (1 << 4) 201# define DP_SPREAD_AMP_0_5 (1 << 4)
202# define DP_MSA_TIMING_PAR_IGNORE_EN (1 << 7) /* eDP */
151 203
152#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 204#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
153# define DP_SET_ANSI_8B10B (1 << 0) 205# define DP_SET_ANSI_8B10B (1 << 0)
154 206
155#define DP_PSR_EN_CFG 0x170 207#define DP_I2C_SPEED_CONTROL_STATUS 0x109 /* DPI */
208/* bitmask as for DP_I2C_SPEED_CAP */
209
210#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */
211
212#define DP_MSTM_CTRL 0x111 /* 1.2 */
213# define DP_MST_EN (1 << 0)
214# define DP_UP_REQ_EN (1 << 1)
215# define DP_UPSTREAM_IS_SRC (1 << 2)
216
217#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */
156# define DP_PSR_ENABLE (1 << 0) 218# define DP_PSR_ENABLE (1 << 0)
157# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) 219# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1)
158# define DP_PSR_CRC_VERIFICATION (1 << 2) 220# define DP_PSR_CRC_VERIFICATION (1 << 2)
159# define DP_PSR_FRAME_CAPTURE (1 << 3) 221# define DP_PSR_FRAME_CAPTURE (1 << 3)
160 222
223#define DP_SINK_COUNT 0x200
224/* prior to 1.2 bit 7 was reserved mbz */
225# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f))
226# define DP_SINK_CP_READY (1 << 6)
227
161#define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201 228#define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201
162# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) 229# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0)
163# define DP_AUTOMATED_TEST_REQUEST (1 << 1) 230# define DP_AUTOMATED_TEST_REQUEST (1 << 1)
164# define DP_CP_IRQ (1 << 2) 231# define DP_CP_IRQ (1 << 2)
165# define DP_SINK_SPECIFIC_IRQ (1 << 6) 232# define DP_SINK_SPECIFIC_IRQ (1 << 6)
166 233
167#define DP_EDP_CONFIGURATION_SET 0x10a
168
169#define DP_LANE0_1_STATUS 0x202 234#define DP_LANE0_1_STATUS 0x202
170#define DP_LANE2_3_STATUS 0x203 235#define DP_LANE2_3_STATUS 0x203
171# define DP_LANE_CR_DONE (1 << 0) 236# define DP_LANE_CR_DONE (1 << 0)
@@ -225,14 +290,14 @@
225# define DP_SET_POWER_D0 0x1 290# define DP_SET_POWER_D0 0x1
226# define DP_SET_POWER_D3 0x2 291# define DP_SET_POWER_D3 0x2
227 292
228#define DP_PSR_ERROR_STATUS 0x2006 293#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
229# define DP_PSR_LINK_CRC_ERROR (1 << 0) 294# define DP_PSR_LINK_CRC_ERROR (1 << 0)
230# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 295# define DP_PSR_RFB_STORAGE_ERROR (1 << 1)
231 296
232#define DP_PSR_ESI 0x2007 297#define DP_PSR_ESI 0x2007 /* XXX 1.2? */
233# define DP_PSR_CAPS_CHANGE (1 << 0) 298# define DP_PSR_CAPS_CHANGE (1 << 0)
234 299
235#define DP_PSR_STATUS 0x2008 300#define DP_PSR_STATUS 0x2008 /* XXX 1.2? */
236# define DP_PSR_SINK_INACTIVE 0 301# define DP_PSR_SINK_INACTIVE 0
237# define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1 302# define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1
238# define DP_PSR_SINK_ACTIVE_RFB 2 303# define DP_PSR_SINK_ACTIVE_RFB 2
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h
index 7dc385233805..b0c11a7809bb 100644
--- a/include/drm/drm_encoder_slave.h
+++ b/include/drm/drm_encoder_slave.h
@@ -27,8 +27,8 @@
27#ifndef __DRM_ENCODER_SLAVE_H__ 27#ifndef __DRM_ENCODER_SLAVE_H__
28#define __DRM_ENCODER_SLAVE_H__ 28#define __DRM_ENCODER_SLAVE_H__
29 29
30#include "drmP.h" 30#include <drm/drmP.h>
31#include "drm_crtc.h" 31#include <drm/drm_crtc.h>
32 32
33/** 33/**
34 * struct drm_encoder_slave_funcs - Entry points exposed by a slave encoder driver 34 * struct drm_encoder_slave_funcs - Entry points exposed by a slave encoder driver
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
new file mode 100644
index 000000000000..76c709837543
--- /dev/null
+++ b/include/drm/drm_fb_cma_helper.h
@@ -0,0 +1,27 @@
1#ifndef __DRM_FB_CMA_HELPER_H__
2#define __DRM_FB_CMA_HELPER_H__
3
4struct drm_fbdev_cma;
5struct drm_gem_cma_object;
6
7struct drm_framebuffer;
8struct drm_device;
9struct drm_file;
10struct drm_mode_fb_cmd2;
11
12struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device *dev,
13 unsigned int preferred_bpp, unsigned int num_crtc,
14 unsigned int max_conn_count);
15void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
16
17void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
18void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
19
20struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
21 struct drm_file *file_priv, struct drm_mode_fb_cmd2 *mode_cmd);
22
23struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
24 unsigned int plane);
25
26#endif
27
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
new file mode 100644
index 000000000000..f0f6b1af25ad
--- /dev/null
+++ b/include/drm/drm_gem_cma_helper.h
@@ -0,0 +1,44 @@
1#ifndef __DRM_GEM_CMA_HELPER_H__
2#define __DRM_GEM_CMA_HELPER_H__
3
4struct drm_gem_cma_object {
5 struct drm_gem_object base;
6 dma_addr_t paddr;
7 void *vaddr;
8};
9
10static inline struct drm_gem_cma_object *
11to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
12{
13 return container_of(gem_obj, struct drm_gem_cma_object, base);
14}
15
16/* free gem object. */
17void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
18
19/* create memory region for drm framebuffer. */
20int drm_gem_cma_dumb_create(struct drm_file *file_priv,
21 struct drm_device *drm, struct drm_mode_create_dumb *args);
22
23/* map memory region for drm framebuffer to user space. */
24int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
25 struct drm_device *drm, uint32_t handle, uint64_t *offset);
26
27/* set vm_flags and we can change the vm attribute to other one at here. */
28int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
29
30/*
31 * destroy memory region allocated.
32 * - a gem handle and physical memory region pointed by a gem object
33 * would be released by drm_gem_handle_delete().
34 */
35int drm_gem_cma_dumb_destroy(struct drm_file *file_priv,
36 struct drm_device *drm, unsigned int handle);
37
38/* allocate physical memory. */
39struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
40 unsigned int size);
41
42extern const struct vm_operations_struct drm_gem_cma_vm_ops;
43
44#endif /* __DRM_GEM_CMA_HELPER_H__ */
diff --git a/include/drm/drm_memory.h b/include/drm/drm_memory.h
index 15af9b32ae42..4baf57a207e7 100644
--- a/include/drm/drm_memory.h
+++ b/include/drm/drm_memory.h
@@ -35,7 +35,7 @@
35 35
36#include <linux/highmem.h> 36#include <linux/highmem.h>
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include "drmP.h" 38#include <drm/drmP.h>
39 39
40/** 40/**
41 * Cut down version of drm_memory_debug.h, which used to be called 41 * Cut down version of drm_memory_debug.h, which used to be called
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index c20b00181530..3c13a3a4b158 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -25,182 +25,10 @@
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE. 26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 27 */
28
29#ifndef _EXYNOS_DRM_H_ 28#ifndef _EXYNOS_DRM_H_
30#define _EXYNOS_DRM_H_ 29#define _EXYNOS_DRM_H_
31 30
32#include "drm.h" 31#include <uapi/drm/exynos_drm.h>
33
34/**
35 * User-desired buffer creation information structure.
36 *
37 * @size: user-desired memory allocation size.
38 * - this size value would be page-aligned internally.
39 * @flags: user request for setting memory type or cache attributes.
40 * @handle: returned a handle to created gem object.
41 * - this handle will be set by gem module of kernel side.
42 */
43struct drm_exynos_gem_create {
44 uint64_t size;
45 unsigned int flags;
46 unsigned int handle;
47};
48
49/**
50 * A structure for getting buffer offset.
51 *
52 * @handle: a pointer to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @offset: relatived offset value of the memory region allocated.
55 * - this value should be set by user.
56 */
57struct drm_exynos_gem_map_off {
58 unsigned int handle;
59 unsigned int pad;
60 uint64_t offset;
61};
62
63/**
64 * A structure for mapping buffer.
65 *
66 * @handle: a handle to gem object created.
67 * @pad: just padding to be 64-bit aligned.
68 * @size: memory size to be mapped.
69 * @mapped: having user virtual address mmaped.
70 * - this variable would be filled by exynos gem module
71 * of kernel side with user virtual address which is allocated
72 * by do_mmap().
73 */
74struct drm_exynos_gem_mmap {
75 unsigned int handle;
76 unsigned int pad;
77 uint64_t size;
78 uint64_t mapped;
79};
80
81/**
82 * A structure to gem information.
83 *
84 * @handle: a handle to gem object created.
85 * @flags: flag value including memory type and cache attribute and
86 * this value would be set by driver.
87 * @size: size to memory region allocated by gem and this size would
88 * be set by driver.
89 */
90struct drm_exynos_gem_info {
91 unsigned int handle;
92 unsigned int flags;
93 uint64_t size;
94};
95
96/**
97 * A structure for user connection request of virtual display.
98 *
99 * @connection: indicate whether doing connetion or not by user.
100 * @extensions: if this value is 1 then the vidi driver would need additional
101 * 128bytes edid data.
102 * @edid: the edid data pointer from user side.
103 */
104struct drm_exynos_vidi_connection {
105 unsigned int connection;
106 unsigned int extensions;
107 uint64_t edid;
108};
109
110/* memory type definitions. */
111enum e_drm_exynos_gem_mem_type {
112 /* Physically Continuous memory and used as default. */
113 EXYNOS_BO_CONTIG = 0 << 0,
114 /* Physically Non-Continuous memory. */
115 EXYNOS_BO_NONCONTIG = 1 << 0,
116 /* non-cachable mapping and used as default. */
117 EXYNOS_BO_NONCACHABLE = 0 << 1,
118 /* cachable mapping. */
119 EXYNOS_BO_CACHABLE = 1 << 1,
120 /* write-combine mapping. */
121 EXYNOS_BO_WC = 1 << 2,
122 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
123 EXYNOS_BO_WC
124};
125
126struct drm_exynos_g2d_get_ver {
127 __u32 major;
128 __u32 minor;
129};
130
131struct drm_exynos_g2d_cmd {
132 __u32 offset;
133 __u32 data;
134};
135
136enum drm_exynos_g2d_event_type {
137 G2D_EVENT_NOT,
138 G2D_EVENT_NONSTOP,
139 G2D_EVENT_STOP, /* not yet */
140};
141
142struct drm_exynos_g2d_set_cmdlist {
143 __u64 cmd;
144 __u64 cmd_gem;
145 __u32 cmd_nr;
146 __u32 cmd_gem_nr;
147
148 /* for g2d event */
149 __u64 event_type;
150 __u64 user_data;
151};
152
153struct drm_exynos_g2d_exec {
154 __u64 async;
155};
156
157#define DRM_EXYNOS_GEM_CREATE 0x00
158#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
159#define DRM_EXYNOS_GEM_MMAP 0x02
160/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
161#define DRM_EXYNOS_GEM_GET 0x04
162#define DRM_EXYNOS_VIDI_CONNECTION 0x07
163
164/* G2D */
165#define DRM_EXYNOS_G2D_GET_VER 0x20
166#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
167#define DRM_EXYNOS_G2D_EXEC 0x22
168
169#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
170 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
171
172#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
173 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
174
175#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
176 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
177
178#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
179 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
180
181#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
182 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
183
184#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
185 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
186#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
187 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
188#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
189 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
190
191/* EXYNOS specific events */
192#define DRM_EXYNOS_G2D_EVENT 0x80000000
193
194struct drm_exynos_g2d_event {
195 struct drm_event base;
196 __u64 user_data;
197 __u32 tv_sec;
198 __u32 tv_usec;
199 __u32 cmdlist_no;
200 __u32 reserved;
201};
202
203#ifdef __KERNEL__
204 32
205/** 33/**
206 * A structure for lcd panel information. 34 * A structure for lcd panel information.
@@ -257,5 +85,4 @@ struct exynos_drm_hdmi_pdata {
257 int (*get_hpd)(void); 85 int (*get_hpd)(void);
258}; 86};
259 87
260#endif /* __KERNEL__ */
261#endif /* _EXYNOS_DRM_H_ */ 88#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 8cc70837f929..63d609d8a3f6 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -23,899 +23,15 @@
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * 24 *
25 */ 25 */
26
27#ifndef _I915_DRM_H_ 26#ifndef _I915_DRM_H_
28#define _I915_DRM_H_ 27#define _I915_DRM_H_
29 28
30#include "drm.h" 29#include <uapi/drm/i915_drm.h>
31
32/* Please note that modifications to all structs defined here are
33 * subject to backwards-compatibility constraints.
34 */
35 30
36#ifdef __KERNEL__
37/* For use by IPS driver */ 31/* For use by IPS driver */
38extern unsigned long i915_read_mch_val(void); 32extern unsigned long i915_read_mch_val(void);
39extern bool i915_gpu_raise(void); 33extern bool i915_gpu_raise(void);
40extern bool i915_gpu_lower(void); 34extern bool i915_gpu_lower(void);
41extern bool i915_gpu_busy(void); 35extern bool i915_gpu_busy(void);
42extern bool i915_gpu_turbo_disable(void); 36extern bool i915_gpu_turbo_disable(void);
43#endif
44
45/* Each region is a minimum of 16k, and there are at most 255 of them.
46 */
47#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
48 * of chars for next/prev indices */
49#define I915_LOG_MIN_TEX_REGION_SIZE 14
50
51typedef struct _drm_i915_init {
52 enum {
53 I915_INIT_DMA = 0x01,
54 I915_CLEANUP_DMA = 0x02,
55 I915_RESUME_DMA = 0x03
56 } func;
57 unsigned int mmio_offset;
58 int sarea_priv_offset;
59 unsigned int ring_start;
60 unsigned int ring_end;
61 unsigned int ring_size;
62 unsigned int front_offset;
63 unsigned int back_offset;
64 unsigned int depth_offset;
65 unsigned int w;
66 unsigned int h;
67 unsigned int pitch;
68 unsigned int pitch_bits;
69 unsigned int back_pitch;
70 unsigned int depth_pitch;
71 unsigned int cpp;
72 unsigned int chipset;
73} drm_i915_init_t;
74
75typedef struct _drm_i915_sarea {
76 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
77 int last_upload; /* last time texture was uploaded */
78 int last_enqueue; /* last time a buffer was enqueued */
79 int last_dispatch; /* age of the most recently dispatched buffer */
80 int ctxOwner; /* last context to upload state */
81 int texAge;
82 int pf_enabled; /* is pageflipping allowed? */
83 int pf_active;
84 int pf_current_page; /* which buffer is being displayed? */
85 int perf_boxes; /* performance boxes to be displayed */
86 int width, height; /* screen size in pixels */
87
88 drm_handle_t front_handle;
89 int front_offset;
90 int front_size;
91
92 drm_handle_t back_handle;
93 int back_offset;
94 int back_size;
95
96 drm_handle_t depth_handle;
97 int depth_offset;
98 int depth_size;
99
100 drm_handle_t tex_handle;
101 int tex_offset;
102 int tex_size;
103 int log_tex_granularity;
104 int pitch;
105 int rotation; /* 0, 90, 180 or 270 */
106 int rotated_offset;
107 int rotated_size;
108 int rotated_pitch;
109 int virtualX, virtualY;
110
111 unsigned int front_tiled;
112 unsigned int back_tiled;
113 unsigned int depth_tiled;
114 unsigned int rotated_tiled;
115 unsigned int rotated2_tiled;
116
117 int pipeA_x;
118 int pipeA_y;
119 int pipeA_w;
120 int pipeA_h;
121 int pipeB_x;
122 int pipeB_y;
123 int pipeB_w;
124 int pipeB_h;
125
126 /* fill out some space for old userspace triple buffer */
127 drm_handle_t unused_handle;
128 __u32 unused1, unused2, unused3;
129
130 /* buffer object handles for static buffers. May change
131 * over the lifetime of the client.
132 */
133 __u32 front_bo_handle;
134 __u32 back_bo_handle;
135 __u32 unused_bo_handle;
136 __u32 depth_bo_handle;
137
138} drm_i915_sarea_t;
139
140/* due to userspace building against these headers we need some compat here */
141#define planeA_x pipeA_x
142#define planeA_y pipeA_y
143#define planeA_w pipeA_w
144#define planeA_h pipeA_h
145#define planeB_x pipeB_x
146#define planeB_y pipeB_y
147#define planeB_w pipeB_w
148#define planeB_h pipeB_h
149
150/* Flags for perf_boxes
151 */
152#define I915_BOX_RING_EMPTY 0x1
153#define I915_BOX_FLIP 0x2
154#define I915_BOX_WAIT 0x4
155#define I915_BOX_TEXTURE_LOAD 0x8
156#define I915_BOX_LOST_CONTEXT 0x10
157
158/* I915 specific ioctls
159 * The device specific ioctl range is 0x40 to 0x79.
160 */
161#define DRM_I915_INIT 0x00
162#define DRM_I915_FLUSH 0x01
163#define DRM_I915_FLIP 0x02
164#define DRM_I915_BATCHBUFFER 0x03
165#define DRM_I915_IRQ_EMIT 0x04
166#define DRM_I915_IRQ_WAIT 0x05
167#define DRM_I915_GETPARAM 0x06
168#define DRM_I915_SETPARAM 0x07
169#define DRM_I915_ALLOC 0x08
170#define DRM_I915_FREE 0x09
171#define DRM_I915_INIT_HEAP 0x0a
172#define DRM_I915_CMDBUFFER 0x0b
173#define DRM_I915_DESTROY_HEAP 0x0c
174#define DRM_I915_SET_VBLANK_PIPE 0x0d
175#define DRM_I915_GET_VBLANK_PIPE 0x0e
176#define DRM_I915_VBLANK_SWAP 0x0f
177#define DRM_I915_HWS_ADDR 0x11
178#define DRM_I915_GEM_INIT 0x13
179#define DRM_I915_GEM_EXECBUFFER 0x14
180#define DRM_I915_GEM_PIN 0x15
181#define DRM_I915_GEM_UNPIN 0x16
182#define DRM_I915_GEM_BUSY 0x17
183#define DRM_I915_GEM_THROTTLE 0x18
184#define DRM_I915_GEM_ENTERVT 0x19
185#define DRM_I915_GEM_LEAVEVT 0x1a
186#define DRM_I915_GEM_CREATE 0x1b
187#define DRM_I915_GEM_PREAD 0x1c
188#define DRM_I915_GEM_PWRITE 0x1d
189#define DRM_I915_GEM_MMAP 0x1e
190#define DRM_I915_GEM_SET_DOMAIN 0x1f
191#define DRM_I915_GEM_SW_FINISH 0x20
192#define DRM_I915_GEM_SET_TILING 0x21
193#define DRM_I915_GEM_GET_TILING 0x22
194#define DRM_I915_GEM_GET_APERTURE 0x23
195#define DRM_I915_GEM_MMAP_GTT 0x24
196#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
197#define DRM_I915_GEM_MADVISE 0x26
198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
199#define DRM_I915_OVERLAY_ATTRS 0x28
200#define DRM_I915_GEM_EXECBUFFER2 0x29
201#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
202#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
203#define DRM_I915_GEM_WAIT 0x2c
204#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
205#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
206
207#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
208#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
209#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
210#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
211#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
212#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
213#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
214#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
215#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
216#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
217#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
218#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
219#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
220#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
221#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
222#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
223#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
224#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
225#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
226#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
227#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
228#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
229#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
230#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
231#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
232#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
233#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
234#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
235#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
236#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
237#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
238#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
239#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
240#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
241#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
242#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
243#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
244#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
245#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
246#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
247#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
248#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
249#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
250#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
251#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
252
253/* Allow drivers to submit batchbuffers directly to hardware, relying
254 * on the security mechanisms provided by hardware.
255 */
256typedef struct drm_i915_batchbuffer {
257 int start; /* agp offset */
258 int used; /* nr bytes in use */
259 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
260 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
261 int num_cliprects; /* mulitpass with multiple cliprects? */
262 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
263} drm_i915_batchbuffer_t;
264
265/* As above, but pass a pointer to userspace buffer which can be
266 * validated by the kernel prior to sending to hardware.
267 */
268typedef struct _drm_i915_cmdbuffer {
269 char __user *buf; /* pointer to userspace command buffer */
270 int sz; /* nr bytes in buf */
271 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
272 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
273 int num_cliprects; /* mulitpass with multiple cliprects? */
274 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
275} drm_i915_cmdbuffer_t;
276
277/* Userspace can request & wait on irq's:
278 */
279typedef struct drm_i915_irq_emit {
280 int __user *irq_seq;
281} drm_i915_irq_emit_t;
282
283typedef struct drm_i915_irq_wait {
284 int irq_seq;
285} drm_i915_irq_wait_t;
286
287/* Ioctl to query kernel params:
288 */
289#define I915_PARAM_IRQ_ACTIVE 1
290#define I915_PARAM_ALLOW_BATCHBUFFER 2
291#define I915_PARAM_LAST_DISPATCH 3
292#define I915_PARAM_CHIPSET_ID 4
293#define I915_PARAM_HAS_GEM 5
294#define I915_PARAM_NUM_FENCES_AVAIL 6
295#define I915_PARAM_HAS_OVERLAY 7
296#define I915_PARAM_HAS_PAGEFLIPPING 8
297#define I915_PARAM_HAS_EXECBUF2 9
298#define I915_PARAM_HAS_BSD 10
299#define I915_PARAM_HAS_BLT 11
300#define I915_PARAM_HAS_RELAXED_FENCING 12
301#define I915_PARAM_HAS_COHERENT_RINGS 13
302#define I915_PARAM_HAS_EXEC_CONSTANTS 14
303#define I915_PARAM_HAS_RELAXED_DELTA 15
304#define I915_PARAM_HAS_GEN7_SOL_RESET 16
305#define I915_PARAM_HAS_LLC 17
306#define I915_PARAM_HAS_ALIASING_PPGTT 18
307#define I915_PARAM_HAS_WAIT_TIMEOUT 19
308
309typedef struct drm_i915_getparam {
310 int param;
311 int __user *value;
312} drm_i915_getparam_t;
313
314/* Ioctl to set kernel params:
315 */
316#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
317#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
318#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
319#define I915_SETPARAM_NUM_USED_FENCES 4
320
321typedef struct drm_i915_setparam {
322 int param;
323 int value;
324} drm_i915_setparam_t;
325
326/* A memory manager for regions of shared memory:
327 */
328#define I915_MEM_REGION_AGP 1
329
330typedef struct drm_i915_mem_alloc {
331 int region;
332 int alignment;
333 int size;
334 int __user *region_offset; /* offset from start of fb or agp */
335} drm_i915_mem_alloc_t;
336
337typedef struct drm_i915_mem_free {
338 int region;
339 int region_offset;
340} drm_i915_mem_free_t;
341
342typedef struct drm_i915_mem_init_heap {
343 int region;
344 int size;
345 int start;
346} drm_i915_mem_init_heap_t;
347
348/* Allow memory manager to be torn down and re-initialized (eg on
349 * rotate):
350 */
351typedef struct drm_i915_mem_destroy_heap {
352 int region;
353} drm_i915_mem_destroy_heap_t;
354
355/* Allow X server to configure which pipes to monitor for vblank signals
356 */
357#define DRM_I915_VBLANK_PIPE_A 1
358#define DRM_I915_VBLANK_PIPE_B 2
359
360typedef struct drm_i915_vblank_pipe {
361 int pipe;
362} drm_i915_vblank_pipe_t;
363
364/* Schedule buffer swap at given vertical blank:
365 */
366typedef struct drm_i915_vblank_swap {
367 drm_drawable_t drawable;
368 enum drm_vblank_seq_type seqtype;
369 unsigned int sequence;
370} drm_i915_vblank_swap_t;
371
372typedef struct drm_i915_hws_addr {
373 __u64 addr;
374} drm_i915_hws_addr_t;
375
376struct drm_i915_gem_init {
377 /**
378 * Beginning offset in the GTT to be managed by the DRM memory
379 * manager.
380 */
381 __u64 gtt_start;
382 /**
383 * Ending offset in the GTT to be managed by the DRM memory
384 * manager.
385 */
386 __u64 gtt_end;
387};
388
389struct drm_i915_gem_create {
390 /**
391 * Requested size for the object.
392 *
393 * The (page-aligned) allocated size for the object will be returned.
394 */
395 __u64 size;
396 /**
397 * Returned handle for the object.
398 *
399 * Object handles are nonzero.
400 */
401 __u32 handle;
402 __u32 pad;
403};
404
405struct drm_i915_gem_pread {
406 /** Handle for the object being read. */
407 __u32 handle;
408 __u32 pad;
409 /** Offset into the object to read from */
410 __u64 offset;
411 /** Length of data to read */
412 __u64 size;
413 /**
414 * Pointer to write the data into.
415 *
416 * This is a fixed-size type for 32/64 compatibility.
417 */
418 __u64 data_ptr;
419};
420
421struct drm_i915_gem_pwrite {
422 /** Handle for the object being written to. */
423 __u32 handle;
424 __u32 pad;
425 /** Offset into the object to write to */
426 __u64 offset;
427 /** Length of data to write */
428 __u64 size;
429 /**
430 * Pointer to read the data from.
431 *
432 * This is a fixed-size type for 32/64 compatibility.
433 */
434 __u64 data_ptr;
435};
436
437struct drm_i915_gem_mmap {
438 /** Handle for the object being mapped. */
439 __u32 handle;
440 __u32 pad;
441 /** Offset in the object to map. */
442 __u64 offset;
443 /**
444 * Length of data to map.
445 *
446 * The value will be page-aligned.
447 */
448 __u64 size;
449 /**
450 * Returned pointer the data was mapped at.
451 *
452 * This is a fixed-size type for 32/64 compatibility.
453 */
454 __u64 addr_ptr;
455};
456
457struct drm_i915_gem_mmap_gtt {
458 /** Handle for the object being mapped. */
459 __u32 handle;
460 __u32 pad;
461 /**
462 * Fake offset to use for subsequent mmap call
463 *
464 * This is a fixed-size type for 32/64 compatibility.
465 */
466 __u64 offset;
467};
468
469struct drm_i915_gem_set_domain {
470 /** Handle for the object */
471 __u32 handle;
472
473 /** New read domains */
474 __u32 read_domains;
475
476 /** New write domain */
477 __u32 write_domain;
478};
479
480struct drm_i915_gem_sw_finish {
481 /** Handle for the object */
482 __u32 handle;
483};
484
485struct drm_i915_gem_relocation_entry {
486 /**
487 * Handle of the buffer being pointed to by this relocation entry.
488 *
489 * It's appealing to make this be an index into the mm_validate_entry
490 * list to refer to the buffer, but this allows the driver to create
491 * a relocation list for state buffers and not re-write it per
492 * exec using the buffer.
493 */
494 __u32 target_handle;
495
496 /**
497 * Value to be added to the offset of the target buffer to make up
498 * the relocation entry.
499 */
500 __u32 delta;
501
502 /** Offset in the buffer the relocation entry will be written into */
503 __u64 offset;
504
505 /**
506 * Offset value of the target buffer that the relocation entry was last
507 * written as.
508 *
509 * If the buffer has the same offset as last time, we can skip syncing
510 * and writing the relocation. This value is written back out by
511 * the execbuffer ioctl when the relocation is written.
512 */
513 __u64 presumed_offset;
514
515 /**
516 * Target memory domains read by this operation.
517 */
518 __u32 read_domains;
519
520 /**
521 * Target memory domains written by this operation.
522 *
523 * Note that only one domain may be written by the whole
524 * execbuffer operation, so that where there are conflicts,
525 * the application will get -EINVAL back.
526 */
527 __u32 write_domain;
528};
529
530/** @{
531 * Intel memory domains
532 *
533 * Most of these just align with the various caches in
534 * the system and are used to flush and invalidate as
535 * objects end up cached in different domains.
536 */
537/** CPU cache */
538#define I915_GEM_DOMAIN_CPU 0x00000001
539/** Render cache, used by 2D and 3D drawing */
540#define I915_GEM_DOMAIN_RENDER 0x00000002
541/** Sampler cache, used by texture engine */
542#define I915_GEM_DOMAIN_SAMPLER 0x00000004
543/** Command queue, used to load batch buffers */
544#define I915_GEM_DOMAIN_COMMAND 0x00000008
545/** Instruction cache, used by shader programs */
546#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
547/** Vertex address cache */
548#define I915_GEM_DOMAIN_VERTEX 0x00000020
549/** GTT domain - aperture and scanout */
550#define I915_GEM_DOMAIN_GTT 0x00000040
551/** @} */
552
553struct drm_i915_gem_exec_object {
554 /**
555 * User's handle for a buffer to be bound into the GTT for this
556 * operation.
557 */
558 __u32 handle;
559
560 /** Number of relocations to be performed on this buffer */
561 __u32 relocation_count;
562 /**
563 * Pointer to array of struct drm_i915_gem_relocation_entry containing
564 * the relocations to be performed in this buffer.
565 */
566 __u64 relocs_ptr;
567
568 /** Required alignment in graphics aperture */
569 __u64 alignment;
570
571 /**
572 * Returned value of the updated offset of the object, for future
573 * presumed_offset writes.
574 */
575 __u64 offset;
576};
577
578struct drm_i915_gem_execbuffer {
579 /**
580 * List of buffers to be validated with their relocations to be
581 * performend on them.
582 *
583 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
584 *
585 * These buffers must be listed in an order such that all relocations
586 * a buffer is performing refer to buffers that have already appeared
587 * in the validate list.
588 */
589 __u64 buffers_ptr;
590 __u32 buffer_count;
591
592 /** Offset in the batchbuffer to start execution from. */
593 __u32 batch_start_offset;
594 /** Bytes used in batchbuffer from batch_start_offset */
595 __u32 batch_len;
596 __u32 DR1;
597 __u32 DR4;
598 __u32 num_cliprects;
599 /** This is a struct drm_clip_rect *cliprects */
600 __u64 cliprects_ptr;
601};
602
603struct drm_i915_gem_exec_object2 {
604 /**
605 * User's handle for a buffer to be bound into the GTT for this
606 * operation.
607 */
608 __u32 handle;
609
610 /** Number of relocations to be performed on this buffer */
611 __u32 relocation_count;
612 /**
613 * Pointer to array of struct drm_i915_gem_relocation_entry containing
614 * the relocations to be performed in this buffer.
615 */
616 __u64 relocs_ptr;
617
618 /** Required alignment in graphics aperture */
619 __u64 alignment;
620
621 /**
622 * Returned value of the updated offset of the object, for future
623 * presumed_offset writes.
624 */
625 __u64 offset;
626
627#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
628 __u64 flags;
629 __u64 rsvd1;
630 __u64 rsvd2;
631};
632
633struct drm_i915_gem_execbuffer2 {
634 /**
635 * List of gem_exec_object2 structs
636 */
637 __u64 buffers_ptr;
638 __u32 buffer_count;
639
640 /** Offset in the batchbuffer to start execution from. */
641 __u32 batch_start_offset;
642 /** Bytes used in batchbuffer from batch_start_offset */
643 __u32 batch_len;
644 __u32 DR1;
645 __u32 DR4;
646 __u32 num_cliprects;
647 /** This is a struct drm_clip_rect *cliprects */
648 __u64 cliprects_ptr;
649#define I915_EXEC_RING_MASK (7<<0)
650#define I915_EXEC_DEFAULT (0<<0)
651#define I915_EXEC_RENDER (1<<0)
652#define I915_EXEC_BSD (2<<0)
653#define I915_EXEC_BLT (3<<0)
654
655/* Used for switching the constants addressing mode on gen4+ RENDER ring.
656 * Gen6+ only supports relative addressing to dynamic state (default) and
657 * absolute addressing.
658 *
659 * These flags are ignored for the BSD and BLT rings.
660 */
661#define I915_EXEC_CONSTANTS_MASK (3<<6)
662#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
663#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
664#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
665 __u64 flags;
666 __u64 rsvd1; /* now used for context info */
667 __u64 rsvd2;
668};
669
670/** Resets the SO write offset registers for transform feedback on gen7. */
671#define I915_EXEC_GEN7_SOL_RESET (1<<8)
672
673#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
674#define i915_execbuffer2_set_context_id(eb2, context) \
675 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
676#define i915_execbuffer2_get_context_id(eb2) \
677 ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
678
679struct drm_i915_gem_pin {
680 /** Handle of the buffer to be pinned. */
681 __u32 handle;
682 __u32 pad;
683
684 /** alignment required within the aperture */
685 __u64 alignment;
686
687 /** Returned GTT offset of the buffer. */
688 __u64 offset;
689};
690
691struct drm_i915_gem_unpin {
692 /** Handle of the buffer to be unpinned. */
693 __u32 handle;
694 __u32 pad;
695};
696
697struct drm_i915_gem_busy {
698 /** Handle of the buffer to check for busy */
699 __u32 handle;
700
701 /** Return busy status (1 if busy, 0 if idle) */
702 __u32 busy;
703};
704
705#define I915_TILING_NONE 0
706#define I915_TILING_X 1
707#define I915_TILING_Y 2
708
709#define I915_BIT_6_SWIZZLE_NONE 0
710#define I915_BIT_6_SWIZZLE_9 1
711#define I915_BIT_6_SWIZZLE_9_10 2
712#define I915_BIT_6_SWIZZLE_9_11 3
713#define I915_BIT_6_SWIZZLE_9_10_11 4
714/* Not seen by userland */
715#define I915_BIT_6_SWIZZLE_UNKNOWN 5
716/* Seen by userland. */
717#define I915_BIT_6_SWIZZLE_9_17 6
718#define I915_BIT_6_SWIZZLE_9_10_17 7
719
720struct drm_i915_gem_set_tiling {
721 /** Handle of the buffer to have its tiling state updated */
722 __u32 handle;
723
724 /**
725 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
726 * I915_TILING_Y).
727 *
728 * This value is to be set on request, and will be updated by the
729 * kernel on successful return with the actual chosen tiling layout.
730 *
731 * The tiling mode may be demoted to I915_TILING_NONE when the system
732 * has bit 6 swizzling that can't be managed correctly by GEM.
733 *
734 * Buffer contents become undefined when changing tiling_mode.
735 */
736 __u32 tiling_mode;
737
738 /**
739 * Stride in bytes for the object when in I915_TILING_X or
740 * I915_TILING_Y.
741 */
742 __u32 stride;
743
744 /**
745 * Returned address bit 6 swizzling required for CPU access through
746 * mmap mapping.
747 */
748 __u32 swizzle_mode;
749};
750
751struct drm_i915_gem_get_tiling {
752 /** Handle of the buffer to get tiling state for. */
753 __u32 handle;
754
755 /**
756 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
757 * I915_TILING_Y).
758 */
759 __u32 tiling_mode;
760
761 /**
762 * Returned address bit 6 swizzling required for CPU access through
763 * mmap mapping.
764 */
765 __u32 swizzle_mode;
766};
767
768struct drm_i915_gem_get_aperture {
769 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
770 __u64 aper_size;
771
772 /**
773 * Available space in the aperture used by i915_gem_execbuffer, in
774 * bytes
775 */
776 __u64 aper_available_size;
777};
778
779struct drm_i915_get_pipe_from_crtc_id {
780 /** ID of CRTC being requested **/
781 __u32 crtc_id;
782
783 /** pipe of requested CRTC **/
784 __u32 pipe;
785};
786
787#define I915_MADV_WILLNEED 0
788#define I915_MADV_DONTNEED 1
789#define __I915_MADV_PURGED 2 /* internal state */
790
791struct drm_i915_gem_madvise {
792 /** Handle of the buffer to change the backing store advice */
793 __u32 handle;
794
795 /* Advice: either the buffer will be needed again in the near future,
796 * or wont be and could be discarded under memory pressure.
797 */
798 __u32 madv;
799
800 /** Whether the backing store still exists. */
801 __u32 retained;
802};
803
804/* flags */
805#define I915_OVERLAY_TYPE_MASK 0xff
806#define I915_OVERLAY_YUV_PLANAR 0x01
807#define I915_OVERLAY_YUV_PACKED 0x02
808#define I915_OVERLAY_RGB 0x03
809
810#define I915_OVERLAY_DEPTH_MASK 0xff00
811#define I915_OVERLAY_RGB24 0x1000
812#define I915_OVERLAY_RGB16 0x2000
813#define I915_OVERLAY_RGB15 0x3000
814#define I915_OVERLAY_YUV422 0x0100
815#define I915_OVERLAY_YUV411 0x0200
816#define I915_OVERLAY_YUV420 0x0300
817#define I915_OVERLAY_YUV410 0x0400
818
819#define I915_OVERLAY_SWAP_MASK 0xff0000
820#define I915_OVERLAY_NO_SWAP 0x000000
821#define I915_OVERLAY_UV_SWAP 0x010000
822#define I915_OVERLAY_Y_SWAP 0x020000
823#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
824
825#define I915_OVERLAY_FLAGS_MASK 0xff000000
826#define I915_OVERLAY_ENABLE 0x01000000
827
828struct drm_intel_overlay_put_image {
829 /* various flags and src format description */
830 __u32 flags;
831 /* source picture description */
832 __u32 bo_handle;
833 /* stride values and offsets are in bytes, buffer relative */
834 __u16 stride_Y; /* stride for packed formats */
835 __u16 stride_UV;
836 __u32 offset_Y; /* offset for packet formats */
837 __u32 offset_U;
838 __u32 offset_V;
839 /* in pixels */
840 __u16 src_width;
841 __u16 src_height;
842 /* to compensate the scaling factors for partially covered surfaces */
843 __u16 src_scan_width;
844 __u16 src_scan_height;
845 /* output crtc description */
846 __u32 crtc_id;
847 __u16 dst_x;
848 __u16 dst_y;
849 __u16 dst_width;
850 __u16 dst_height;
851};
852
853/* flags */
854#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
855#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
856struct drm_intel_overlay_attrs {
857 __u32 flags;
858 __u32 color_key;
859 __s32 brightness;
860 __u32 contrast;
861 __u32 saturation;
862 __u32 gamma0;
863 __u32 gamma1;
864 __u32 gamma2;
865 __u32 gamma3;
866 __u32 gamma4;
867 __u32 gamma5;
868};
869
870/*
871 * Intel sprite handling
872 *
873 * Color keying works with a min/mask/max tuple. Both source and destination
874 * color keying is allowed.
875 *
876 * Source keying:
877 * Sprite pixels within the min & max values, masked against the color channels
878 * specified in the mask field, will be transparent. All other pixels will
879 * be displayed on top of the primary plane. For RGB surfaces, only the min
880 * and mask fields will be used; ranged compares are not allowed.
881 *
882 * Destination keying:
883 * Primary plane pixels that match the min value, masked against the color
884 * channels specified in the mask field, will be replaced by corresponding
885 * pixels from the sprite plane.
886 *
887 * Note that source & destination keying are exclusive; only one can be
888 * active on a given plane.
889 */
890
891#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
892#define I915_SET_COLORKEY_DESTINATION (1<<1)
893#define I915_SET_COLORKEY_SOURCE (1<<2)
894struct drm_intel_sprite_colorkey {
895 __u32 plane_id;
896 __u32 min_value;
897 __u32 channel_mask;
898 __u32 max_value;
899 __u32 flags;
900};
901
902struct drm_i915_gem_wait {
903 /** Handle of BO we shall wait on */
904 __u32 bo_handle;
905 __u32 flags;
906 /** Number of nanoseconds to wait, Returns time remaining. */
907 __s64 timeout_ns;
908};
909
910struct drm_i915_gem_context_create {
911 /* output: id of new context*/
912 __u32 ctx_id;
913 __u32 pad;
914};
915
916struct drm_i915_gem_context_destroy {
917 __u32 ctx_id;
918 __u32 pad;
919};
920
921#endif /* _I915_DRM_H_ */ 37#endif /* _I915_DRM_H_ */
diff --git a/include/drm/intel-gtt.h b/include/drm/intel-gtt.h
index 8e29d551bb3c..2e37e9f02e71 100644
--- a/include/drm/intel-gtt.h
+++ b/include/drm/intel-gtt.h
@@ -30,16 +30,10 @@ void intel_gmch_remove(void);
30bool intel_enable_gtt(void); 30bool intel_enable_gtt(void);
31 31
32void intel_gtt_chipset_flush(void); 32void intel_gtt_chipset_flush(void);
33void intel_gtt_unmap_memory(struct scatterlist *sg_list, int num_sg); 33void intel_gtt_insert_sg_entries(struct sg_table *st,
34void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
35int intel_gtt_map_memory(struct page **pages, unsigned int num_entries,
36 struct scatterlist **sg_list, int *num_sg);
37void intel_gtt_insert_sg_entries(struct scatterlist *sg_list,
38 unsigned int sg_len,
39 unsigned int pg_start, 34 unsigned int pg_start,
40 unsigned int flags); 35 unsigned int flags);
41void intel_gtt_insert_pages(unsigned int first_entry, unsigned int num_entries, 36void intel_gtt_clear_range(unsigned int first_entry, unsigned int num_entries);
42 struct page **pages, unsigned int flags);
43 37
44/* Special gtt memory types */ 38/* Special gtt memory types */
45#define AGP_DCACHE_MEMORY 1 39#define AGP_DCACHE_MEMORY 1
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index e15f2a89a270..e8028ade567f 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -31,7 +31,7 @@
31#ifndef _TTM_BO_API_H_ 31#ifndef _TTM_BO_API_H_
32#define _TTM_BO_API_H_ 32#define _TTM_BO_API_H_
33 33
34#include "drm_hashtab.h" 34#include <drm/drm_hashtab.h>
35#include <linux/kref.h> 35#include <linux/kref.h>
36#include <linux/list.h> 36#include <linux/list.h>
37#include <linux/wait.h> 37#include <linux/wait.h>
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 084e8989a6e1..d803b92b0324 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -30,14 +30,14 @@
30#ifndef _TTM_BO_DRIVER_H_ 30#ifndef _TTM_BO_DRIVER_H_
31#define _TTM_BO_DRIVER_H_ 31#define _TTM_BO_DRIVER_H_
32 32
33#include "ttm/ttm_bo_api.h" 33#include <ttm/ttm_bo_api.h>
34#include "ttm/ttm_memory.h" 34#include <ttm/ttm_memory.h>
35#include "ttm/ttm_module.h" 35#include <ttm/ttm_module.h>
36#include "drm_mm.h" 36#include <drm/drm_mm.h>
37#include "drm_global.h" 37#include <drm/drm_global.h>
38#include "linux/workqueue.h" 38#include <linux/workqueue.h>
39#include "linux/fs.h" 39#include <linux/fs.h>
40#include "linux/spinlock.h" 40#include <linux/spinlock.h>
41 41
42struct ttm_backend_func { 42struct ttm_backend_func {
43 /** 43 /**
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h
index 26cc7f9ffa41..1926cae373ba 100644
--- a/include/drm/ttm/ttm_execbuf_util.h
+++ b/include/drm/ttm/ttm_execbuf_util.h
@@ -31,7 +31,7 @@
31#ifndef _TTM_EXECBUF_UTIL_H_ 31#ifndef _TTM_EXECBUF_UTIL_H_
32#define _TTM_EXECBUF_UTIL_H_ 32#define _TTM_EXECBUF_UTIL_H_
33 33
34#include "ttm/ttm_bo_api.h" 34#include <ttm/ttm_bo_api.h>
35#include <linux/list.h> 35#include <linux/list.h>
36 36
37/** 37/**
diff --git a/include/drm/ttm/ttm_lock.h b/include/drm/ttm/ttm_lock.h
index 2e7f0c941b5d..2902beb5f689 100644
--- a/include/drm/ttm/ttm_lock.h
+++ b/include/drm/ttm/ttm_lock.h
@@ -49,7 +49,7 @@
49#ifndef _TTM_LOCK_H_ 49#ifndef _TTM_LOCK_H_
50#define _TTM_LOCK_H_ 50#define _TTM_LOCK_H_
51 51
52#include "ttm/ttm_object.h" 52#include <ttm/ttm_object.h>
53#include <linux/wait.h> 53#include <linux/wait.h>
54#include <linux/atomic.h> 54#include <linux/atomic.h>
55 55
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index e46054e5255b..b01c563b2751 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -38,7 +38,7 @@
38#define _TTM_OBJECT_H_ 38#define _TTM_OBJECT_H_
39 39
40#include <linux/list.h> 40#include <linux/list.h>
41#include "drm_hashtab.h" 41#include <drm/drm_hashtab.h>
42#include <linux/kref.h> 42#include <linux/kref.h>
43#include <ttm/ttm_memory.h> 43#include <ttm/ttm_memory.h>
44 44
diff --git a/include/drm/ttm/ttm_page_alloc.h b/include/drm/ttm/ttm_page_alloc.h
index 5fe27400d176..706b962c6467 100644
--- a/include/drm/ttm/ttm_page_alloc.h
+++ b/include/drm/ttm/ttm_page_alloc.h
@@ -26,8 +26,8 @@
26#ifndef TTM_PAGE_ALLOC 26#ifndef TTM_PAGE_ALLOC
27#define TTM_PAGE_ALLOC 27#define TTM_PAGE_ALLOC
28 28
29#include "ttm_bo_driver.h" 29#include <drm/ttm/ttm_bo_driver.h>
30#include "ttm_memory.h" 30#include <drm/ttm/ttm_memory.h>
31 31
32/** 32/**
33 * Initialize pool allocator. 33 * Initialize pool allocator.
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index fa217607c582..d114db9477f4 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -20,21 +20,16 @@ header-y += netfilter_ipv6/
20header-y += usb/ 20header-y += usb/
21header-y += wimax/ 21header-y += wimax/
22 22
23objhdr-y += version.h
24
25ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \ 23ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
26 $(srctree)/include/asm-$(SRCARCH)/a.out.h \ 24 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h),)
27 $(INSTALL_HDR_PATH)/include/asm-*/a.out.h),)
28header-y += a.out.h 25header-y += a.out.h
29endif 26endif
30ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \ 27ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
31 $(srctree)/include/asm-$(SRCARCH)/kvm.h \ 28 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h),)
32 $(INSTALL_HDR_PATH)/include/asm-*/kvm.h),)
33header-y += kvm.h 29header-y += kvm.h
34endif 30endif
35ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \ 31ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
36 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h \ 32 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h),)
37 $(INSTALL_HDR_PATH)/include/asm-*/kvm_para.h),)
38header-y += kvm_para.h 33header-y += kvm_para.h
39endif 34endif
40 35
@@ -84,7 +79,6 @@ header-y += capability.h
84header-y += capi.h 79header-y += capi.h
85header-y += cciss_defs.h 80header-y += cciss_defs.h
86header-y += cciss_ioctl.h 81header-y += cciss_ioctl.h
87header-y += cdk.h
88header-y += cdrom.h 82header-y += cdrom.h
89header-y += cgroupstats.h 83header-y += cgroupstats.h
90header-y += chio.h 84header-y += chio.h
@@ -93,7 +87,6 @@ header-y += cn_proc.h
93header-y += coda.h 87header-y += coda.h
94header-y += coda_psdev.h 88header-y += coda_psdev.h
95header-y += coff.h 89header-y += coff.h
96header-y += comstats.h
97header-y += connector.h 90header-y += connector.h
98header-y += const.h 91header-y += const.h
99header-y += cramfs_fs.h 92header-y += cramfs_fs.h
@@ -140,7 +133,6 @@ header-y += fuse.h
140header-y += futex.h 133header-y += futex.h
141header-y += gameport.h 134header-y += gameport.h
142header-y += gen_stats.h 135header-y += gen_stats.h
143header-y += generic_serial.h
144header-y += genetlink.h 136header-y += genetlink.h
145header-y += gfs2_ondisk.h 137header-y += gfs2_ondisk.h
146header-y += gigaset_dev.h 138header-y += gigaset_dev.h
@@ -195,6 +187,7 @@ header-y += in_route.h
195header-y += sock_diag.h 187header-y += sock_diag.h
196header-y += inet_diag.h 188header-y += inet_diag.h
197header-y += unix_diag.h 189header-y += unix_diag.h
190header-y += packet_diag.h
198header-y += inotify.h 191header-y += inotify.h
199header-y += input.h 192header-y += input.h
200header-y += ioctl.h 193header-y += ioctl.h
@@ -362,6 +355,7 @@ header-y += sysctl.h
362header-y += sysinfo.h 355header-y += sysinfo.h
363header-y += taskstats.h 356header-y += taskstats.h
364header-y += tcp.h 357header-y += tcp.h
358header-y += tcp_metrics.h
365header-y += telephony.h 359header-y += telephony.h
366header-y += termios.h 360header-y += termios.h
367header-y += time.h 361header-y += time.h
@@ -372,6 +366,7 @@ header-y += tipc.h
372header-y += tipc_config.h 366header-y += tipc_config.h
373header-y += toshiba.h 367header-y += toshiba.h
374header-y += tty.h 368header-y += tty.h
369header-y += tty_flags.h
375header-y += types.h 370header-y += types.h
376header-y += udf_fs_i.h 371header-y += udf_fs_i.h
377header-y += udp.h 372header-y += udp.h
@@ -387,6 +382,7 @@ header-y += utsname.h
387header-y += uuid.h 382header-y += uuid.h
388header-y += uvcvideo.h 383header-y += uvcvideo.h
389header-y += v4l2-common.h 384header-y += v4l2-common.h
385header-y += v4l2-controls.h
390header-y += v4l2-dv-timings.h 386header-y += v4l2-dv-timings.h
391header-y += v4l2-mediabus.h 387header-y += v4l2-mediabus.h
392header-y += v4l2-subdev.h 388header-y += v4l2-subdev.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4f2a76224509..90be98981102 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -138,9 +138,9 @@ void acpi_penalize_isa_irq(int irq, int active);
138void acpi_pci_irq_disable (struct pci_dev *dev); 138void acpi_pci_irq_disable (struct pci_dev *dev);
139 139
140struct acpi_pci_driver { 140struct acpi_pci_driver {
141 struct acpi_pci_driver *next; 141 struct list_head node;
142 int (*add)(acpi_handle handle); 142 int (*add)(struct acpi_pci_root *root);
143 void (*remove)(acpi_handle handle); 143 void (*remove)(struct acpi_pci_root *root);
144}; 144};
145 145
146int acpi_pci_register_driver(struct acpi_pci_driver *driver); 146int acpi_pci_register_driver(struct acpi_pci_driver *driver);
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
index fe1d7b283cb6..854b7294f6c6 100644
--- a/include/linux/amba/pl022.h
+++ b/include/linux/amba/pl022.h
@@ -244,6 +244,7 @@ struct dma_chan;
244 * indicates no delay and the device will be suspended immediately. 244 * indicates no delay and the device will be suspended immediately.
245 * @rt: indicates the controller should run the message pump with realtime 245 * @rt: indicates the controller should run the message pump with realtime
246 * priority to minimise the transfer latency on the bus. 246 * priority to minimise the transfer latency on the bus.
247 * @chipselects: list of <num_chipselects> chip select gpios
247 */ 248 */
248struct pl022_ssp_controller { 249struct pl022_ssp_controller {
249 u16 bus_id; 250 u16 bus_id;
@@ -254,6 +255,7 @@ struct pl022_ssp_controller {
254 void *dma_tx_param; 255 void *dma_tx_param;
255 int autosuspend_delay; 256 int autosuspend_delay;
256 bool rt; 257 bool rt;
258 int *chipselects;
257}; 259};
258 260
259/** 261/**
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index d117b29d1062..f612c783170f 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -205,7 +205,6 @@ struct amba_pl011_data {
205 void *dma_tx_param; 205 void *dma_tx_param;
206 void (*init) (void); 206 void (*init) (void);
207 void (*exit) (void); 207 void (*exit) (void);
208 void (*reset) (void);
209}; 208};
210#endif 209#endif
211 210
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 5713d3ac381a..408da9502177 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -77,6 +77,9 @@ enum {
77 ATA_ID_EIDE_PIO_IORDY = 68, 77 ATA_ID_EIDE_PIO_IORDY = 68,
78 ATA_ID_ADDITIONAL_SUPP = 69, 78 ATA_ID_ADDITIONAL_SUPP = 69,
79 ATA_ID_QUEUE_DEPTH = 75, 79 ATA_ID_QUEUE_DEPTH = 75,
80 ATA_ID_SATA_CAPABILITY = 76,
81 ATA_ID_SATA_CAPABILITY_2 = 77,
82 ATA_ID_FEATURE_SUPP = 78,
80 ATA_ID_MAJOR_VER = 80, 83 ATA_ID_MAJOR_VER = 80,
81 ATA_ID_COMMAND_SET_1 = 82, 84 ATA_ID_COMMAND_SET_1 = 82,
82 ATA_ID_COMMAND_SET_2 = 83, 85 ATA_ID_COMMAND_SET_2 = 83,
@@ -292,6 +295,13 @@ enum {
292 295
293 /* READ_LOG_EXT pages */ 296 /* READ_LOG_EXT pages */
294 ATA_LOG_SATA_NCQ = 0x10, 297 ATA_LOG_SATA_NCQ = 0x10,
298 ATA_LOG_SATA_ID_DEV_DATA = 0x30,
299 ATA_LOG_SATA_SETTINGS = 0x08,
300 ATA_LOG_DEVSLP_MDAT = 0x30,
301 ATA_LOG_DEVSLP_MDAT_MASK = 0x1F,
302 ATA_LOG_DEVSLP_DETO = 0x31,
303 ATA_LOG_DEVSLP_VALID = 0x37,
304 ATA_LOG_DEVSLP_VALID_MASK = 0x80,
295 305
296 /* READ/WRITE LONG (obsolete) */ 306 /* READ/WRITE LONG (obsolete) */
297 ATA_CMD_READ_LONG = 0x22, 307 ATA_CMD_READ_LONG = 0x22,
@@ -345,6 +355,7 @@ enum {
345 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */ 355 SATA_FPDMA_IN_ORDER = 0x04, /* FPDMA in-order data delivery */
346 SATA_AN = 0x05, /* Asynchronous Notification */ 356 SATA_AN = 0x05, /* Asynchronous Notification */
347 SATA_SSP = 0x06, /* Software Settings Preservation */ 357 SATA_SSP = 0x06, /* Software Settings Preservation */
358 SATA_DEVSLP = 0x09, /* Device Sleep */
348 359
349 /* feature values for SET_MAX */ 360 /* feature values for SET_MAX */
350 ATA_SET_MAX_ADDR = 0x00, 361 ATA_SET_MAX_ADDR = 0x00,
@@ -558,15 +569,17 @@ static inline int ata_is_data(u8 prot)
558#define ata_id_is_ata(id) (((id)[ATA_ID_CONFIG] & (1 << 15)) == 0) 569#define ata_id_is_ata(id) (((id)[ATA_ID_CONFIG] & (1 << 15)) == 0)
559#define ata_id_has_lba(id) ((id)[ATA_ID_CAPABILITY] & (1 << 9)) 570#define ata_id_has_lba(id) ((id)[ATA_ID_CAPABILITY] & (1 << 9))
560#define ata_id_has_dma(id) ((id)[ATA_ID_CAPABILITY] & (1 << 8)) 571#define ata_id_has_dma(id) ((id)[ATA_ID_CAPABILITY] & (1 << 8))
561#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 572#define ata_id_has_ncq(id) ((id)[ATA_ID_SATA_CAPABILITY] & (1 << 8))
562#define ata_id_queue_depth(id) (((id)[ATA_ID_QUEUE_DEPTH] & 0x1f) + 1) 573#define ata_id_queue_depth(id) (((id)[ATA_ID_QUEUE_DEPTH] & 0x1f) + 1)
563#define ata_id_removeable(id) ((id)[ATA_ID_CONFIG] & (1 << 7)) 574#define ata_id_removeable(id) ((id)[ATA_ID_CONFIG] & (1 << 7))
564#define ata_id_has_atapi_AN(id) \ 575#define ata_id_has_atapi_AN(id) \
565 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 576 ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \
566 ((id)[78] & (1 << 5)) ) 577 ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \
578 ((id)[ATA_ID_FEATURE_SUPP] & (1 << 5)))
567#define ata_id_has_fpdma_aa(id) \ 579#define ata_id_has_fpdma_aa(id) \
568 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 580 ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \
569 ((id)[78] & (1 << 2)) ) 581 ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \
582 ((id)[ATA_ID_FEATURE_SUPP] & (1 << 2)))
570#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10)) 583#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
571#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11)) 584#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
572#define ata_id_u32(id,n) \ 585#define ata_id_u32(id,n) \
@@ -578,11 +591,12 @@ static inline int ata_is_data(u8 prot)
578 ((u64) (id)[(n) + 0]) ) 591 ((u64) (id)[(n) + 0]) )
579 592
580#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20) 593#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
581#define ata_id_has_da(id) ((id)[77] & (1 << 4)) 594#define ata_id_has_da(id) ((id)[ATA_ID_SATA_CAPABILITY_2] & (1 << 4))
595#define ata_id_has_devslp(id) ((id)[ATA_ID_FEATURE_SUPP] & (1 << 8))
582 596
583static inline bool ata_id_has_hipm(const u16 *id) 597static inline bool ata_id_has_hipm(const u16 *id)
584{ 598{
585 u16 val = id[76]; 599 u16 val = id[ATA_ID_SATA_CAPABILITY];
586 600
587 if (val == 0 || val == 0xffff) 601 if (val == 0 || val == 0xffff)
588 return false; 602 return false;
@@ -592,7 +606,7 @@ static inline bool ata_id_has_hipm(const u16 *id)
592 606
593static inline bool ata_id_has_dipm(const u16 *id) 607static inline bool ata_id_has_dipm(const u16 *id)
594{ 608{
595 u16 val = id[78]; 609 u16 val = id[ATA_ID_FEATURE_SUPP];
596 610
597 if (val == 0 || val == 0xffff) 611 if (val == 0 || val == 0xffff)
598 return false; 612 return false;
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 06023393fba9..4eb31752e2b7 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/platform_device.h> 4#include <linux/platform_device.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/io.h>
6 7
7struct ssc_device { 8struct ssc_device {
8 struct list_head list; 9 struct list_head list;
diff --git a/include/linux/atmel_tc.h b/include/linux/atmel_tc.h
index 1d14b1dc1aee..89a931babecf 100644
--- a/include/linux/atmel_tc.h
+++ b/include/linux/atmel_tc.h
@@ -63,7 +63,7 @@ struct atmel_tc {
63 struct platform_device *pdev; 63 struct platform_device *pdev;
64 struct resource *iomem; 64 struct resource *iomem;
65 void __iomem *regs; 65 void __iomem *regs;
66 struct atmel_tcb_config *tcb_config; 66 const struct atmel_tcb_config *tcb_config;
67 int irq[3]; 67 int irq[3];
68 struct clk *clk[3]; 68 struct clk *clk[3];
69 struct list_head node; 69 struct list_head node;
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index 70cfcb2d63c4..5b08a8540ecf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -86,6 +86,31 @@ static inline int atomic_dec_unless_positive(atomic_t *p)
86} 86}
87#endif 87#endif
88 88
89/*
90 * atomic_dec_if_positive - decrement by 1 if old value positive
91 * @v: pointer of type atomic_t
92 *
93 * The function returns the old value of *v minus 1, even if
94 * the atomic variable, v, was not decremented.
95 */
96#ifndef atomic_dec_if_positive
97static inline int atomic_dec_if_positive(atomic_t *v)
98{
99 int c, old, dec;
100 c = atomic_read(v);
101 for (;;) {
102 dec = c - 1;
103 if (unlikely(dec < 0))
104 break;
105 old = atomic_cmpxchg((v), c, dec);
106 if (likely(old == c))
107 break;
108 c = old;
109 }
110 return dec;
111}
112#endif
113
89#ifndef CONFIG_ARCH_HAS_ATOMIC_OR 114#ifndef CONFIG_ARCH_HAS_ATOMIC_OR
90static inline void atomic_or(int i, atomic_t *v) 115static inline void atomic_or(int i, atomic_t *v)
91{ 116{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 36abf2aa7e68..2c83e5f7edb1 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -442,6 +442,8 @@ struct audit_krule {
442struct audit_field { 442struct audit_field {
443 u32 type; 443 u32 type;
444 u32 val; 444 u32 val;
445 kuid_t uid;
446 kgid_t gid;
445 u32 op; 447 u32 op;
446 char *lsm_str; 448 char *lsm_str;
447 void *lsm_rule; 449 void *lsm_rule;
@@ -525,10 +527,20 @@ static inline void audit_ptrace(struct task_struct *t)
525extern unsigned int audit_serial(void); 527extern unsigned int audit_serial(void);
526extern int auditsc_get_stamp(struct audit_context *ctx, 528extern int auditsc_get_stamp(struct audit_context *ctx,
527 struct timespec *t, unsigned int *serial); 529 struct timespec *t, unsigned int *serial);
528extern int audit_set_loginuid(uid_t loginuid); 530extern int audit_set_loginuid(kuid_t loginuid);
529#define audit_get_loginuid(t) ((t)->loginuid) 531
530#define audit_get_sessionid(t) ((t)->sessionid) 532static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
533{
534 return tsk->loginuid;
535}
536
537static inline int audit_get_sessionid(struct task_struct *tsk)
538{
539 return tsk->sessionid;
540}
541
531extern void audit_log_task_context(struct audit_buffer *ab); 542extern void audit_log_task_context(struct audit_buffer *ab);
543extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk);
532extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 544extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
533extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode); 545extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, umode_t mode);
534extern int __audit_bprm(struct linux_binprm *bprm); 546extern int __audit_bprm(struct linux_binprm *bprm);
@@ -623,37 +635,101 @@ static inline void audit_mmap_fd(int fd, int flags)
623extern int audit_n_rules; 635extern int audit_n_rules;
624extern int audit_signals; 636extern int audit_signals;
625#else /* CONFIG_AUDITSYSCALL */ 637#else /* CONFIG_AUDITSYSCALL */
626#define audit_alloc(t) ({ 0; }) 638static inline int audit_alloc(struct task_struct *task)
627#define audit_free(t) do { ; } while (0) 639{
628#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 640 return 0;
629#define audit_syscall_exit(r) do { ; } while (0) 641}
630#define audit_dummy_context() 1 642static inline void audit_free(struct task_struct *task)
631#define audit_getname(n) do { ; } while (0) 643{ }
632#define audit_putname(n) do { ; } while (0) 644static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
633#define __audit_inode(n,d) do { ; } while (0) 645 unsigned long a1, unsigned long a2,
634#define __audit_inode_child(i,p) do { ; } while (0) 646 unsigned long a3)
635#define audit_inode(n,d) do { (void)(d); } while (0) 647{ }
636#define audit_inode_child(i,p) do { ; } while (0) 648static inline void audit_syscall_exit(void *pt_regs)
637#define audit_core_dumps(i) do { ; } while (0) 649{ }
638#define audit_seccomp(i,s,c) do { ; } while (0) 650static inline int audit_dummy_context(void)
639#define auditsc_get_stamp(c,t,s) (0) 651{
640#define audit_get_loginuid(t) (-1) 652 return 1;
641#define audit_get_sessionid(t) (-1) 653}
642#define audit_log_task_context(b) do { ; } while (0) 654static inline void audit_getname(const char *name)
643#define audit_ipc_obj(i) ((void)0) 655{ }
644#define audit_ipc_set_perm(q,u,g,m) ((void)0) 656static inline void audit_putname(const char *name)
645#define audit_bprm(p) ({ 0; }) 657{ }
646#define audit_socketcall(n,a) ((void)0) 658static inline void __audit_inode(const char *name, const struct dentry *dentry)
647#define audit_fd_pair(n,a) ((void)0) 659{ }
648#define audit_sockaddr(len, addr) ({ 0; }) 660static inline void __audit_inode_child(const struct dentry *dentry,
649#define audit_mq_open(o,m,a) ((void)0) 661 const struct inode *parent)
650#define audit_mq_sendrecv(d,l,p,t) ((void)0) 662{ }
651#define audit_mq_notify(d,n) ((void)0) 663static inline void audit_inode(const char *name, const struct dentry *dentry)
652#define audit_mq_getsetattr(d,s) ((void)0) 664{ }
653#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; }) 665static inline void audit_inode_child(const struct dentry *dentry,
654#define audit_log_capset(pid, ncr, ocr) ((void)0) 666 const struct inode *parent)
655#define audit_mmap_fd(fd, flags) ((void)0) 667{ }
656#define audit_ptrace(t) ((void)0) 668static inline void audit_core_dumps(long signr)
669{ }
670static inline void __audit_seccomp(unsigned long syscall, long signr, int code)
671{ }
672static inline void audit_seccomp(unsigned long syscall, long signr, int code)
673{ }
674static inline int auditsc_get_stamp(struct audit_context *ctx,
675 struct timespec *t, unsigned int *serial)
676{
677 return 0;
678}
679static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
680{
681 return INVALID_UID;
682}
683static inline int audit_get_sessionid(struct task_struct *tsk)
684{
685 return -1;
686}
687static inline void audit_log_task_context(struct audit_buffer *ab)
688{ }
689static inline void audit_log_task_info(struct audit_buffer *ab,
690 struct task_struct *tsk)
691{ }
692static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
693{ }
694static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
695 gid_t gid, umode_t mode)
696{ }
697static inline int audit_bprm(struct linux_binprm *bprm)
698{
699 return 0;
700}
701static inline void audit_socketcall(int nargs, unsigned long *args)
702{ }
703static inline void audit_fd_pair(int fd1, int fd2)
704{ }
705static inline int audit_sockaddr(int len, void *addr)
706{
707 return 0;
708}
709static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
710{ }
711static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
712 unsigned int msg_prio,
713 const struct timespec *abs_timeout)
714{ }
715static inline void audit_mq_notify(mqd_t mqdes,
716 const struct sigevent *notification)
717{ }
718static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
719{ }
720static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
721 const struct cred *new,
722 const struct cred *old)
723{
724 return 0;
725}
726static inline void audit_log_capset(pid_t pid, const struct cred *new,
727 const struct cred *old)
728{ }
729static inline void audit_mmap_fd(int fd, int flags)
730{ }
731static inline void audit_ptrace(struct task_struct *t)
732{ }
657#define audit_n_rules 0 733#define audit_n_rules 0
658#define audit_signals 0 734#define audit_signals 0
659#endif /* CONFIG_AUDITSYSCALL */ 735#endif /* CONFIG_AUDITSYSCALL */
@@ -677,7 +753,6 @@ extern void audit_log_n_hex(struct audit_buffer *ab,
677extern void audit_log_n_string(struct audit_buffer *ab, 753extern void audit_log_n_string(struct audit_buffer *ab,
678 const char *buf, 754 const char *buf,
679 size_t n); 755 size_t n);
680#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
681extern void audit_log_n_untrustedstring(struct audit_buffer *ab, 756extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
682 const char *string, 757 const char *string,
683 size_t n); 758 size_t n);
@@ -694,34 +769,63 @@ extern void audit_log_lost(const char *message);
694#ifdef CONFIG_SECURITY 769#ifdef CONFIG_SECURITY
695extern void audit_log_secctx(struct audit_buffer *ab, u32 secid); 770extern void audit_log_secctx(struct audit_buffer *ab, u32 secid);
696#else 771#else
697#define audit_log_secctx(b,s) do { ; } while (0) 772static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
773{ }
698#endif 774#endif
699 775
700extern int audit_update_lsm_rules(void); 776extern int audit_update_lsm_rules(void);
701 777
702 /* Private API (for audit.c only) */ 778 /* Private API (for audit.c only) */
703extern int audit_filter_user(struct netlink_skb_parms *cb); 779extern int audit_filter_user(void);
704extern int audit_filter_type(int type); 780extern int audit_filter_type(int type);
705extern int audit_receive_filter(int type, int pid, int uid, int seq, 781extern int audit_receive_filter(int type, int pid, int seq,
706 void *data, size_t datasz, uid_t loginuid, 782 void *data, size_t datasz, kuid_t loginuid,
707 u32 sessionid, u32 sid); 783 u32 sessionid, u32 sid);
708extern int audit_enabled; 784extern int audit_enabled;
709#else 785#else /* CONFIG_AUDIT */
710#define audit_log(c,g,t,f,...) do { ; } while (0) 786static inline __printf(4, 5)
711#define audit_log_start(c,g,t) ({ NULL; }) 787void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
712#define audit_log_vformat(b,f,a) do { ; } while (0) 788 const char *fmt, ...)
713#define audit_log_format(b,f,...) do { ; } while (0) 789{ }
714#define audit_log_end(b) do { ; } while (0) 790static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
715#define audit_log_n_hex(a,b,l) do { ; } while (0) 791 gfp_t gfp_mask, int type)
716#define audit_log_n_string(a,c,l) do { ; } while (0) 792{
717#define audit_log_string(a,c) do { ; } while (0) 793 return NULL;
718#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 794}
719#define audit_log_untrustedstring(a,s) do { ; } while (0) 795static inline __printf(2, 3)
720#define audit_log_d_path(b, p, d) do { ; } while (0) 796void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
721#define audit_log_key(b, k) do { ; } while (0) 797{ }
722#define audit_log_link_denied(o, l) do { ; } while (0) 798static inline void audit_log_end(struct audit_buffer *ab)
723#define audit_log_secctx(b,s) do { ; } while (0) 799{ }
800static inline void audit_log_n_hex(struct audit_buffer *ab,
801 const unsigned char *buf, size_t len)
802{ }
803static inline void audit_log_n_string(struct audit_buffer *ab,
804 const char *buf, size_t n)
805{ }
806static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
807 const char *string, size_t n)
808{ }
809static inline void audit_log_untrustedstring(struct audit_buffer *ab,
810 const char *string)
811{ }
812static inline void audit_log_d_path(struct audit_buffer *ab,
813 const char *prefix,
814 const struct path *path)
815{ }
816static inline void audit_log_key(struct audit_buffer *ab, char *key)
817{ }
818static inline void audit_log_link_denied(const char *string,
819 const struct path *link)
820{ }
821static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
822{ }
724#define audit_enabled 0 823#define audit_enabled 0
725#endif 824#endif /* CONFIG_AUDIT */
825static inline void audit_log_string(struct audit_buffer *ab, const char *buf)
826{
827 audit_log_n_string(ab, buf, strlen(buf));
828}
829
726#endif 830#endif
727#endif 831#endif
diff --git a/include/linux/bcd.h b/include/linux/bcd.h
index 22ea563ba3eb..18fff11fb3ea 100644
--- a/include/linux/bcd.h
+++ b/include/linux/bcd.h
@@ -3,7 +3,20 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5 5
6unsigned bcd2bin(unsigned char val) __attribute_const__; 6#define bcd2bin(x) \
7unsigned char bin2bcd(unsigned val) __attribute_const__; 7 (__builtin_constant_p((u8 )(x)) ? \
8 const_bcd2bin(x) : \
9 _bcd2bin(x))
10
11#define bin2bcd(x) \
12 (__builtin_constant_p((u8 )(x)) ? \
13 const_bin2bcd(x) : \
14 _bin2bcd(x))
15
16#define const_bcd2bin(x) (((x) & 0x0f) + ((x) >> 4) * 10)
17#define const_bin2bcd(x) ((((x) / 10) << 4) + (x) % 10)
18
19unsigned _bcd2bin(unsigned char val) __attribute_const__;
20unsigned char _bin2bcd(unsigned val) __attribute_const__;
8 21
9#endif /* _BCD_H */ 22#endif /* _BCD_H */
diff --git a/include/linux/bcm2835_timer.h b/include/linux/bcm2835_timer.h
new file mode 100644
index 000000000000..25680fe0903c
--- /dev/null
+++ b/include/linux/bcm2835_timer.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright 2012 Simon Arlott
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __BCM2835_TIMER_H
16#define __BCM2835_TIMER_H
17
18#include <asm/mach/time.h>
19
20extern struct sys_timer bcm2835_timer;
21
22#endif
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 1954a4e305a3..4180eb78d575 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -10,7 +10,7 @@
10#include <linux/bcma/bcma_driver_gmac_cmn.h> 10#include <linux/bcma/bcma_driver_gmac_cmn.h>
11#include <linux/ssb/ssb.h> /* SPROM sharing */ 11#include <linux/ssb/ssb.h> /* SPROM sharing */
12 12
13#include "bcma_regs.h" 13#include <linux/bcma/bcma_regs.h>
14 14
15struct bcma_device; 15struct bcma_device;
16struct bcma_bus; 16struct bcma_bus;
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 366422bc1633..37935c2d2e8f 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -72,7 +72,7 @@ struct linux_binprm {
72 72
73/* Function parameter for binfmt->coredump */ 73/* Function parameter for binfmt->coredump */
74struct coredump_params { 74struct coredump_params {
75 long signr; 75 siginfo_t *siginfo;
76 struct pt_regs *regs; 76 struct pt_regs *regs;
77 struct file *file; 77 struct file *file;
78 unsigned long limit; 78 unsigned long limit;
@@ -132,7 +132,6 @@ extern int copy_strings_kernel(int argc, const char *const *argv,
132 struct linux_binprm *bprm); 132 struct linux_binprm *bprm);
133extern int prepare_bprm_creds(struct linux_binprm *bprm); 133extern int prepare_bprm_creds(struct linux_binprm *bprm);
134extern void install_exec_creds(struct linux_binprm *bprm); 134extern void install_exec_creds(struct linux_binprm *bprm);
135extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
136extern void set_binfmt(struct linux_binfmt *new); 135extern void set_binfmt(struct linux_binfmt *new);
137extern void free_bprm(struct linux_binprm *); 136extern void free_bprm(struct linux_binprm *);
138 137
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4e72a9d48232..4a2ab7c85393 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -601,7 +601,7 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync)
601 * it already be started by driver. 601 * it already be started by driver.
602 */ 602 */
603#define RQ_NOMERGE_FLAGS \ 603#define RQ_NOMERGE_FLAGS \
604 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA) 604 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA | REQ_DISCARD)
605#define rq_mergeable(rq) \ 605#define rq_mergeable(rq) \
606 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 606 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
607 (((rq)->cmd_flags & REQ_DISCARD) || \ 607 (((rq)->cmd_flags & REQ_DISCARD) || \
@@ -894,6 +894,8 @@ extern void blk_queue_flush_queueable(struct request_queue *q, bool queueable);
894extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 894extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
895 895
896extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 896extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
897extern int blk_bio_map_sg(struct request_queue *q, struct bio *bio,
898 struct scatterlist *sglist);
897extern void blk_dump_rq_flags(struct request *, char *); 899extern void blk_dump_rq_flags(struct request *, char *);
898extern long nr_blockdev_pages(void); 900extern long nr_blockdev_pages(void);
899 901
@@ -1139,6 +1141,16 @@ static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector
1139 & (lim->discard_granularity - 1); 1141 & (lim->discard_granularity - 1);
1140} 1142}
1141 1143
1144static inline int bdev_discard_alignment(struct block_device *bdev)
1145{
1146 struct request_queue *q = bdev_get_queue(bdev);
1147
1148 if (bdev != bdev->bd_contains)
1149 return bdev->bd_part->discard_alignment;
1150
1151 return q->limits.discard_alignment;
1152}
1153
1142static inline unsigned int queue_discard_zeroes_data(struct request_queue *q) 1154static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)
1143{ 1155{
1144 if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data == 1) 1156 if (q->limits.max_discard_sectors && q->limits.discard_zeroes_data == 1)
diff --git a/include/linux/cd1400.h b/include/linux/cd1400.h
deleted file mode 100644
index 1dc3ab0523fd..000000000000
--- a/include/linux/cd1400.h
+++ /dev/null
@@ -1,292 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * cd1400.h -- cd1400 UART hardware info.
5 *
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/*****************************************************************************/
25#ifndef _CD1400_H
26#define _CD1400_H
27/*****************************************************************************/
28
29/*
30 * Define the number of async ports per cd1400 uart chip.
31 */
32#define CD1400_PORTS 4
33
34/*
35 * Define the cd1400 uarts internal FIFO sizes.
36 */
37#define CD1400_TXFIFOSIZE 12
38#define CD1400_RXFIFOSIZE 12
39
40/*
41 * Local RX FIFO thresh hold level. Also define the RTS thresh hold
42 * based on the RX thresh hold.
43 */
44#define FIFO_RXTHRESHOLD 6
45#define FIFO_RTSTHRESHOLD 7
46
47/*****************************************************************************/
48
49/*
50 * Define the cd1400 register addresses. These are all the valid
51 * registers with the cd1400. Some are global, some virtual, some
52 * per port.
53 */
54#define GFRCR 0x40
55#define CAR 0x68
56#define GCR 0x4b
57#define SVRR 0x67
58#define RICR 0x44
59#define TICR 0x45
60#define MICR 0x46
61#define RIR 0x6b
62#define TIR 0x6a
63#define MIR 0x69
64#define PPR 0x7e
65
66#define RIVR 0x43
67#define TIVR 0x42
68#define MIVR 0x41
69#define TDR 0x63
70#define RDSR 0x62
71#define MISR 0x4c
72#define EOSRR 0x60
73
74#define LIVR 0x18
75#define CCR 0x05
76#define SRER 0x06
77#define COR1 0x08
78#define COR2 0x09
79#define COR3 0x0a
80#define COR4 0x1e
81#define COR5 0x1f
82#define CCSR 0x0b
83#define RDCR 0x0e
84#define SCHR1 0x1a
85#define SCHR2 0x1b
86#define SCHR3 0x1c
87#define SCHR4 0x1d
88#define SCRL 0x22
89#define SCRH 0x23
90#define LNC 0x24
91#define MCOR1 0x15
92#define MCOR2 0x16
93#define RTPR 0x21
94#define MSVR1 0x6c
95#define MSVR2 0x6d
96#define PSVR 0x6f
97#define RBPR 0x78
98#define RCOR 0x7c
99#define TBPR 0x72
100#define TCOR 0x76
101
102/*****************************************************************************/
103
104/*
105 * Define the set of baud rate clock divisors.
106 */
107#define CD1400_CLK0 8
108#define CD1400_CLK1 32
109#define CD1400_CLK2 128
110#define CD1400_CLK3 512
111#define CD1400_CLK4 2048
112
113#define CD1400_NUMCLKS 5
114
115/*****************************************************************************/
116
117/*
118 * Define the clock pre-scalar value to be a 5 ms clock. This should be
119 * OK for now. It would probably be better to make it 10 ms, but we
120 * can't fit that divisor into 8 bits!
121 */
122#define PPR_SCALAR 244
123
124/*****************************************************************************/
125
126/*
127 * Define values used to set character size options.
128 */
129#define COR1_CHL5 0x00
130#define COR1_CHL6 0x01
131#define COR1_CHL7 0x02
132#define COR1_CHL8 0x03
133
134/*
135 * Define values used to set the number of stop bits.
136 */
137#define COR1_STOP1 0x00
138#define COR1_STOP15 0x04
139#define COR1_STOP2 0x08
140
141/*
142 * Define values used to set the parity scheme in use.
143 */
144#define COR1_PARNONE 0x00
145#define COR1_PARFORCE 0x20
146#define COR1_PARENB 0x40
147#define COR1_PARIGNORE 0x10
148
149#define COR1_PARODD 0x80
150#define COR1_PAREVEN 0x00
151
152#define COR2_IXM 0x80
153#define COR2_TXIBE 0x40
154#define COR2_ETC 0x20
155#define COR2_LLM 0x10
156#define COR2_RLM 0x08
157#define COR2_RTSAO 0x04
158#define COR2_CTSAE 0x02
159
160#define COR3_SCDRNG 0x80
161#define COR3_SCD34 0x40
162#define COR3_FCT 0x20
163#define COR3_SCD12 0x10
164
165/*
166 * Define values used by COR4.
167 */
168#define COR4_BRKINT 0x08
169#define COR4_IGNBRK 0x18
170
171/*****************************************************************************/
172
173/*
174 * Define the modem control register values.
175 * Note that the actual hardware is a little different to the conventional
176 * pin names on the cd1400.
177 */
178#define MSVR1_DTR 0x01
179#define MSVR1_DSR 0x10
180#define MSVR1_RI 0x20
181#define MSVR1_CTS 0x40
182#define MSVR1_DCD 0x80
183
184#define MSVR2_RTS 0x02
185#define MSVR2_DSR 0x10
186#define MSVR2_RI 0x20
187#define MSVR2_CTS 0x40
188#define MSVR2_DCD 0x80
189
190#define MCOR1_DCD 0x80
191#define MCOR1_CTS 0x40
192#define MCOR1_RI 0x20
193#define MCOR1_DSR 0x10
194
195#define MCOR2_DCD 0x80
196#define MCOR2_CTS 0x40
197#define MCOR2_RI 0x20
198#define MCOR2_DSR 0x10
199
200/*****************************************************************************/
201
202/*
203 * Define the bits used with the service (interrupt) enable register.
204 */
205#define SRER_NNDT 0x01
206#define SRER_TXEMPTY 0x02
207#define SRER_TXDATA 0x04
208#define SRER_RXDATA 0x10
209#define SRER_MODEM 0x80
210
211/*****************************************************************************/
212
213/*
214 * Define operational commands for the command register.
215 */
216#define CCR_RESET 0x80
217#define CCR_CORCHANGE 0x4e
218#define CCR_SENDCH 0x20
219#define CCR_CHANCTRL 0x10
220
221#define CCR_TXENABLE (CCR_CHANCTRL | 0x08)
222#define CCR_TXDISABLE (CCR_CHANCTRL | 0x04)
223#define CCR_RXENABLE (CCR_CHANCTRL | 0x02)
224#define CCR_RXDISABLE (CCR_CHANCTRL | 0x01)
225
226#define CCR_SENDSCHR1 (CCR_SENDCH | 0x01)
227#define CCR_SENDSCHR2 (CCR_SENDCH | 0x02)
228#define CCR_SENDSCHR3 (CCR_SENDCH | 0x03)
229#define CCR_SENDSCHR4 (CCR_SENDCH | 0x04)
230
231#define CCR_RESETCHAN (CCR_RESET | 0x00)
232#define CCR_RESETFULL (CCR_RESET | 0x01)
233#define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
234
235#define CCR_MAXWAIT 10000
236
237/*****************************************************************************/
238
239/*
240 * Define the valid acknowledgement types (for hw ack cycle).
241 */
242#define ACK_TYPMASK 0x07
243#define ACK_TYPTX 0x02
244#define ACK_TYPMDM 0x01
245#define ACK_TYPRXGOOD 0x03
246#define ACK_TYPRXBAD 0x07
247
248#define SVRR_RX 0x01
249#define SVRR_TX 0x02
250#define SVRR_MDM 0x04
251
252#define ST_OVERRUN 0x01
253#define ST_FRAMING 0x02
254#define ST_PARITY 0x04
255#define ST_BREAK 0x08
256#define ST_SCHAR1 0x10
257#define ST_SCHAR2 0x20
258#define ST_SCHAR3 0x30
259#define ST_SCHAR4 0x40
260#define ST_RANGE 0x70
261#define ST_SCHARMASK 0x70
262#define ST_TIMEOUT 0x80
263
264#define MISR_DCD 0x80
265#define MISR_CTS 0x40
266#define MISR_RI 0x20
267#define MISR_DSR 0x10
268
269/*****************************************************************************/
270
271/*
272 * Defines for the CCSR status register.
273 */
274#define CCSR_RXENABLED 0x80
275#define CCSR_RXFLOWON 0x40
276#define CCSR_RXFLOWOFF 0x20
277#define CCSR_TXENABLED 0x08
278#define CCSR_TXFLOWON 0x04
279#define CCSR_TXFLOWOFF 0x02
280
281/*****************************************************************************/
282
283/*
284 * Define the embedded commands.
285 */
286#define ETC_CMD 0x00
287#define ETC_STARTBREAK 0x81
288#define ETC_DELAY 0x82
289#define ETC_STOPBREAK 0x83
290
291/*****************************************************************************/
292#endif
diff --git a/include/linux/cdk.h b/include/linux/cdk.h
deleted file mode 100644
index 80093a8d4f64..000000000000
--- a/include/linux/cdk.h
+++ /dev/null
@@ -1,486 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * cdk.h -- CDK interface definitions.
5 *
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/*****************************************************************************/
25#ifndef _CDK_H
26#define _CDK_H
27/*****************************************************************************/
28
29#pragma pack(2)
30
31/*
32 * The following set of definitions is used to communicate with the
33 * shared memory interface of the Stallion intelligent multiport serial
34 * boards. The definitions in this file are taken directly from the
35 * document titled "Generic Stackable Interface, Downloader and
36 * Communications Development Kit".
37 */
38
39/*
40 * Define the set of important shared memory addresses. These are
41 * required to initialize the board and get things started. All of these
42 * addresses are relative to the start of the shared memory.
43 */
44#define CDK_SIGADDR 0x200
45#define CDK_FEATADDR 0x280
46#define CDK_CDKADDR 0x300
47#define CDK_RDYADDR 0x262
48
49#define CDK_ALIVEMARKER 13
50
51/*
52 * On hardware power up the ROMs located on the EasyConnection 8/64 will
53 * fill out the following signature information into shared memory. This
54 * way the host system can quickly determine that the board is present
55 * and is operational.
56 */
57typedef struct cdkecpsig {
58 unsigned long magic;
59 unsigned short romver;
60 unsigned short cputype;
61 unsigned char panelid[8];
62} cdkecpsig_t;
63
64#define ECP_MAGIC 0x21504345
65
66/*
67 * On hardware power up the ROMs located on the ONboard, Stallion and
68 * Brumbys will fill out the following signature information into shared
69 * memory. This way the host system can quickly determine that the board
70 * is present and is operational.
71 */
72typedef struct cdkonbsig {
73 unsigned short magic0;
74 unsigned short magic1;
75 unsigned short magic2;
76 unsigned short magic3;
77 unsigned short romver;
78 unsigned short memoff;
79 unsigned short memseg;
80 unsigned short amask0;
81 unsigned short pic;
82 unsigned short status;
83 unsigned short btype;
84 unsigned short clkticks;
85 unsigned short clkspeed;
86 unsigned short amask1;
87 unsigned short amask2;
88} cdkonbsig_t;
89
90#define ONB_MAGIC0 0xf2a7
91#define ONB_MAGIC1 0xa149
92#define ONB_MAGIC2 0x6352
93#define ONB_MAGIC3 0xf121
94
95/*
96 * Define the feature area structure. The feature area is the set of
97 * startup parameters used by the slave image when it starts executing.
98 * They allow for the specification of buffer sizes, debug trace, etc.
99 */
100typedef struct cdkfeature {
101 unsigned long debug;
102 unsigned long banner;
103 unsigned long etype;
104 unsigned long nrdevs;
105 unsigned long brdspec;
106 unsigned long txrqsize;
107 unsigned long rxrqsize;
108 unsigned long flags;
109} cdkfeature_t;
110
111#define ETYP_DDK 0
112#define ETYP_CDK 1
113
114/*
115 * Define the CDK header structure. This is the info that the slave
116 * environment sets up after it has been downloaded and started. It
117 * essentially provides a memory map for the shared memory interface.
118 */
119typedef struct cdkhdr {
120 unsigned short command;
121 unsigned short status;
122 unsigned short port;
123 unsigned short mode;
124 unsigned long cmd_buf[14];
125 unsigned short alive_cnt;
126 unsigned short intrpt_mode;
127 unsigned char intrpt_id[8];
128 unsigned char ver_release;
129 unsigned char ver_modification;
130 unsigned char ver_fix;
131 unsigned char deadman_restart;
132 unsigned short deadman;
133 unsigned short nrdevs;
134 unsigned long memp;
135 unsigned long hostp;
136 unsigned long slavep;
137 unsigned char hostreq;
138 unsigned char slavereq;
139 unsigned char cmd_reserved[30];
140} cdkhdr_t;
141
142#define MODE_DDK 0
143#define MODE_CDK 1
144
145#define IMD_INTR 0x0
146#define IMD_PPINTR 0x1
147#define IMD_POLL 0xff
148
149/*
150 * Define the memory mapping structure. This structure is pointed to by
151 * the memp field in the stlcdkhdr struct. As many as these structures
152 * as required are laid out in shared memory to define how the rest of
153 * shared memory is divided up. There will be one for each port.
154 */
155typedef struct cdkmem {
156 unsigned short dtype;
157 unsigned long offset;
158} cdkmem_t;
159
160#define TYP_UNDEFINED 0x0
161#define TYP_ASYNCTRL 0x1
162#define TYP_ASYNC 0x20
163#define TYP_PARALLEL 0x40
164#define TYP_SYNCX21 0x60
165
166/*****************************************************************************/
167
168/*
169 * Following is a set of defines and structures used to actually deal
170 * with the serial ports on the board. Firstly is the set of commands
171 * that can be applied to ports.
172 */
173#define ASYCMD (((unsigned long) 'a') << 8)
174
175#define A_NULL (ASYCMD | 0)
176#define A_FLUSH (ASYCMD | 1)
177#define A_BREAK (ASYCMD | 2)
178#define A_GETPORT (ASYCMD | 3)
179#define A_SETPORT (ASYCMD | 4)
180#define A_SETPORTF (ASYCMD | 5)
181#define A_SETPORTFTX (ASYCMD | 6)
182#define A_SETPORTFRX (ASYCMD | 7)
183#define A_GETSIGNALS (ASYCMD | 8)
184#define A_SETSIGNALS (ASYCMD | 9)
185#define A_SETSIGNALSF (ASYCMD | 10)
186#define A_SETSIGNALSFTX (ASYCMD | 11)
187#define A_SETSIGNALSFRX (ASYCMD | 12)
188#define A_GETNOTIFY (ASYCMD | 13)
189#define A_SETNOTIFY (ASYCMD | 14)
190#define A_NOTIFY (ASYCMD | 15)
191#define A_PORTCTRL (ASYCMD | 16)
192#define A_GETSTATS (ASYCMD | 17)
193#define A_RQSTATE (ASYCMD | 18)
194#define A_FLOWSTATE (ASYCMD | 19)
195#define A_CLEARSTATS (ASYCMD | 20)
196
197/*
198 * Define those arguments used for simple commands.
199 */
200#define FLUSHRX 0x1
201#define FLUSHTX 0x2
202
203#define BREAKON -1
204#define BREAKOFF -2
205
206/*
207 * Define the port setting structure, and all those defines that go along
208 * with it. Basically this structure defines the characteristics of this
209 * port: baud rate, chars, parity, input/output char cooking etc.
210 */
211typedef struct asyport {
212 unsigned long baudout;
213 unsigned long baudin;
214 unsigned long iflag;
215 unsigned long oflag;
216 unsigned long lflag;
217 unsigned long pflag;
218 unsigned long flow;
219 unsigned long spare1;
220 unsigned short vtime;
221 unsigned short vmin;
222 unsigned short txlo;
223 unsigned short txhi;
224 unsigned short rxlo;
225 unsigned short rxhi;
226 unsigned short rxhog;
227 unsigned short spare2;
228 unsigned char csize;
229 unsigned char stopbs;
230 unsigned char parity;
231 unsigned char stopin;
232 unsigned char startin;
233 unsigned char stopout;
234 unsigned char startout;
235 unsigned char parmark;
236 unsigned char brkmark;
237 unsigned char cc[11];
238} asyport_t;
239
240#define PT_STOP1 0x0
241#define PT_STOP15 0x1
242#define PT_STOP2 0x2
243
244#define PT_NOPARITY 0x0
245#define PT_ODDPARITY 0x1
246#define PT_EVENPARITY 0x2
247#define PT_MARKPARITY 0x3
248#define PT_SPACEPARITY 0x4
249
250#define F_NONE 0x0
251#define F_IXON 0x1
252#define F_IXOFF 0x2
253#define F_IXANY 0x4
254#define F_IOXANY 0x8
255#define F_RTSFLOW 0x10
256#define F_CTSFLOW 0x20
257#define F_DTRFLOW 0x40
258#define F_DCDFLOW 0x80
259#define F_DSROFLOW 0x100
260#define F_DSRIFLOW 0x200
261
262#define FI_NORX 0x1
263#define FI_RAW 0x2
264#define FI_ISTRIP 0x4
265#define FI_UCLC 0x8
266#define FI_INLCR 0x10
267#define FI_ICRNL 0x20
268#define FI_IGNCR 0x40
269#define FI_IGNBREAK 0x80
270#define FI_DSCRDBREAK 0x100
271#define FI_1MARKBREAK 0x200
272#define FI_2MARKBREAK 0x400
273#define FI_XCHNGBREAK 0x800
274#define FI_IGNRXERRS 0x1000
275#define FI_DSCDRXERRS 0x2000
276#define FI_1MARKRXERRS 0x4000
277#define FI_2MARKRXERRS 0x8000
278#define FI_XCHNGRXERRS 0x10000
279#define FI_DSCRDNULL 0x20000
280
281#define FO_OLCUC 0x1
282#define FO_ONLCR 0x2
283#define FO_OOCRNL 0x4
284#define FO_ONOCR 0x8
285#define FO_ONLRET 0x10
286#define FO_ONL 0x20
287#define FO_OBS 0x40
288#define FO_OVT 0x80
289#define FO_OFF 0x100
290#define FO_OTAB1 0x200
291#define FO_OTAB2 0x400
292#define FO_OTAB3 0x800
293#define FO_OCR1 0x1000
294#define FO_OCR2 0x2000
295#define FO_OCR3 0x4000
296#define FO_OFILL 0x8000
297#define FO_ODELL 0x10000
298
299#define P_RTSLOCK 0x1
300#define P_CTSLOCK 0x2
301#define P_MAPRTS 0x4
302#define P_MAPCTS 0x8
303#define P_LOOPBACK 0x10
304#define P_DTRFOLLOW 0x20
305#define P_FAKEDCD 0x40
306
307#define P_RXIMIN 0x10000
308#define P_RXITIME 0x20000
309#define P_RXTHOLD 0x40000
310
311/*
312 * Define a structure to communicate serial port signal and data state
313 * information.
314 */
315typedef struct asysigs {
316 unsigned long data;
317 unsigned long signal;
318 unsigned long sigvalue;
319} asysigs_t;
320
321#define DT_TXBUSY 0x1
322#define DT_TXEMPTY 0x2
323#define DT_TXLOW 0x4
324#define DT_TXHIGH 0x8
325#define DT_TXFULL 0x10
326#define DT_TXHOG 0x20
327#define DT_TXFLOWED 0x40
328#define DT_TXBREAK 0x80
329
330#define DT_RXBUSY 0x100
331#define DT_RXEMPTY 0x200
332#define DT_RXLOW 0x400
333#define DT_RXHIGH 0x800
334#define DT_RXFULL 0x1000
335#define DT_RXHOG 0x2000
336#define DT_RXFLOWED 0x4000
337#define DT_RXBREAK 0x8000
338
339#define SG_DTR 0x1
340#define SG_DCD 0x2
341#define SG_RTS 0x4
342#define SG_CTS 0x8
343#define SG_DSR 0x10
344#define SG_RI 0x20
345
346/*
347 * Define the notification setting structure. This is used to tell the
348 * port what events we want to be informed about. Fields here use the
349 * same defines as for the asysigs structure above.
350 */
351typedef struct asynotify {
352 unsigned long ctrl;
353 unsigned long data;
354 unsigned long signal;
355 unsigned long sigvalue;
356} asynotify_t;
357
358/*
359 * Define the port control structure. It is used to do fine grain
360 * control operations on the port.
361 */
362typedef struct {
363 unsigned long rxctrl;
364 unsigned long txctrl;
365 char rximdch;
366 char tximdch;
367 char spare1;
368 char spare2;
369} asyctrl_t;
370
371#define CT_ENABLE 0x1
372#define CT_DISABLE 0x2
373#define CT_STOP 0x4
374#define CT_START 0x8
375#define CT_STARTFLOW 0x10
376#define CT_STOPFLOW 0x20
377#define CT_SENDCHR 0x40
378
379/*
380 * Define the stats structure kept for each port. This is a useful set
381 * of data collected for each port on the slave. The A_GETSTATS command
382 * is used to retrieve this data from the slave.
383 */
384typedef struct asystats {
385 unsigned long opens;
386 unsigned long txchars;
387 unsigned long rxchars;
388 unsigned long txringq;
389 unsigned long rxringq;
390 unsigned long txmsgs;
391 unsigned long rxmsgs;
392 unsigned long txflushes;
393 unsigned long rxflushes;
394 unsigned long overruns;
395 unsigned long framing;
396 unsigned long parity;
397 unsigned long ringover;
398 unsigned long lost;
399 unsigned long rxstart;
400 unsigned long rxstop;
401 unsigned long txstart;
402 unsigned long txstop;
403 unsigned long dcdcnt;
404 unsigned long dtrcnt;
405 unsigned long ctscnt;
406 unsigned long rtscnt;
407 unsigned long dsrcnt;
408 unsigned long ricnt;
409 unsigned long txbreaks;
410 unsigned long rxbreaks;
411 unsigned long signals;
412 unsigned long state;
413 unsigned long hwid;
414} asystats_t;
415
416/*****************************************************************************/
417
418/*
419 * All command and control communication with a device on the slave is
420 * via a control block in shared memory. Each device has its own control
421 * block, defined by the following structure. The control block allows
422 * the host to open, close and control the device on the slave.
423 */
424typedef struct cdkctrl {
425 unsigned char open;
426 unsigned char close;
427 unsigned long openarg;
428 unsigned long closearg;
429 unsigned long cmd;
430 unsigned long status;
431 unsigned long args[32];
432} cdkctrl_t;
433
434/*
435 * Each device on the slave passes data to and from the host via a ring
436 * queue in shared memory. Define a ring queue structure to hold the
437 * vital information about each ring queue. Two ring queues will be
438 * allocated for each port, one for receive data and one for transmit
439 * data.
440 */
441typedef struct cdkasyrq {
442 unsigned long offset;
443 unsigned short size;
444 unsigned short head;
445 unsigned short tail;
446} cdkasyrq_t;
447
448/*
449 * Each asynchronous port is defined in shared memory by the following
450 * structure. It contains a control block to command a device, and also
451 * the necessary data channel information as well.
452 */
453typedef struct cdkasy {
454 cdkctrl_t ctrl;
455 unsigned short notify;
456 asynotify_t changed;
457 unsigned short receive;
458 cdkasyrq_t rxq;
459 unsigned short transmit;
460 cdkasyrq_t txq;
461} cdkasy_t;
462
463#pragma pack()
464
465/*****************************************************************************/
466
467/*
468 * Define the set of ioctls used by the driver to do special things
469 * to the board. These include interrupting it, and initializing
470 * the driver after board startup and shutdown.
471 */
472#include <linux/ioctl.h>
473
474#define STL_BINTR _IO('s',20)
475#define STL_BSTART _IO('s',21)
476#define STL_BSTOP _IO('s',22)
477#define STL_BRESET _IO('s',23)
478
479/*
480 * Define a set of ioctl extensions, used to get at special stuff.
481 */
482#define STL_GETPFLAG _IO('s',80)
483#define STL_SETPFLAG _IO('s',81)
484
485/*****************************************************************************/
486#endif
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index d021610efd65..cf6f4d998a76 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -12,8 +12,8 @@
12#ifndef CEPH_FS_H 12#ifndef CEPH_FS_H
13#define CEPH_FS_H 13#define CEPH_FS_H
14 14
15#include "msgr.h" 15#include <linux/ceph/msgr.h>
16#include "rados.h" 16#include <linux/ceph/rados.h>
17 17
18/* 18/*
19 * subprotocol versions. when specific messages types or high-level 19 * subprotocol versions. when specific messages types or high-level
diff --git a/include/linux/ceph/debugfs.h b/include/linux/ceph/debugfs.h
index 2a79702e092b..1df086d7882d 100644
--- a/include/linux/ceph/debugfs.h
+++ b/include/linux/ceph/debugfs.h
@@ -1,8 +1,8 @@
1#ifndef _FS_CEPH_DEBUGFS_H 1#ifndef _FS_CEPH_DEBUGFS_H
2#define _FS_CEPH_DEBUGFS_H 2#define _FS_CEPH_DEBUGFS_H
3 3
4#include "ceph_debug.h" 4#include <linux/ceph/ceph_debug.h>
5#include "types.h" 5#include <linux/ceph/types.h>
6 6
7#define CEPH_DEFINE_SHOW_FUNC(name) \ 7#define CEPH_DEFINE_SHOW_FUNC(name) \
8static int name##_open(struct inode *inode, struct file *file) \ 8static int name##_open(struct inode *inode, struct file *file) \
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index 4bbf2db45f46..63d092822bad 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -6,7 +6,7 @@
6#include <linux/time.h> 6#include <linux/time.h>
7#include <asm/unaligned.h> 7#include <asm/unaligned.h>
8 8
9#include "types.h" 9#include <linux/ceph/types.h>
10 10
11/* 11/*
12 * in all cases, 12 * in all cases,
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 42624789b06f..6470792b13d3 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -1,7 +1,7 @@
1#ifndef _FS_CEPH_LIBCEPH_H 1#ifndef _FS_CEPH_LIBCEPH_H
2#define _FS_CEPH_LIBCEPH_H 2#define _FS_CEPH_LIBCEPH_H
3 3
4#include "ceph_debug.h" 4#include <linux/ceph/ceph_debug.h>
5 5
6#include <asm/unaligned.h> 6#include <asm/unaligned.h>
7#include <linux/backing-dev.h> 7#include <linux/backing-dev.h>
@@ -15,12 +15,12 @@
15#include <linux/writeback.h> 15#include <linux/writeback.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17 17
18#include "types.h" 18#include <linux/ceph/types.h>
19#include "messenger.h" 19#include <linux/ceph/messenger.h>
20#include "msgpool.h" 20#include <linux/ceph/msgpool.h>
21#include "mon_client.h" 21#include <linux/ceph/mon_client.h>
22#include "osd_client.h" 22#include <linux/ceph/osd_client.h>
23#include "ceph_fs.h" 23#include <linux/ceph/ceph_fs.h>
24 24
25/* 25/*
26 * mount options 26 * mount options
diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
index 9935fac8c107..cb15b5d867c7 100644
--- a/include/linux/ceph/mdsmap.h
+++ b/include/linux/ceph/mdsmap.h
@@ -2,7 +2,7 @@
2#define _FS_CEPH_MDSMAP_H 2#define _FS_CEPH_MDSMAP_H
3 3
4#include <linux/bug.h> 4#include <linux/bug.h>
5#include "types.h" 5#include <linux/ceph/types.h>
6 6
7/* 7/*
8 * mds map - describe servers in the mds cluster. 8 * mds map - describe servers in the mds cluster.
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 189ae0637634..14ba5ee738a9 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -8,8 +8,8 @@
8#include <linux/uio.h> 8#include <linux/uio.h>
9#include <linux/workqueue.h> 9#include <linux/workqueue.h>
10 10
11#include "types.h" 11#include <linux/ceph/types.h>
12#include "buffer.h" 12#include <linux/ceph/buffer.h>
13 13
14struct ceph_msg; 14struct ceph_msg;
15struct ceph_connection; 15struct ceph_connection;
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 2113e3850a4e..a486f390dfbe 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -5,7 +5,7 @@
5#include <linux/kref.h> 5#include <linux/kref.h>
6#include <linux/rbtree.h> 6#include <linux/rbtree.h>
7 7
8#include "messenger.h" 8#include <linux/ceph/messenger.h>
9 9
10struct ceph_client; 10struct ceph_client;
11struct ceph_mount_args; 11struct ceph_mount_args;
@@ -71,7 +71,6 @@ struct ceph_mon_client {
71 int cur_mon; /* last monitor i contacted */ 71 int cur_mon; /* last monitor i contacted */
72 unsigned long sub_sent, sub_renew_after; 72 unsigned long sub_sent, sub_renew_after;
73 struct ceph_connection con; 73 struct ceph_connection con;
74 bool have_fsid;
75 74
76 /* pending generic requests */ 75 /* pending generic requests */
77 struct rb_root generic_request_tree; 76 struct rb_root generic_request_tree;
diff --git a/include/linux/ceph/msgpool.h b/include/linux/ceph/msgpool.h
index 09fa96b43436..4b0d38960726 100644
--- a/include/linux/ceph/msgpool.h
+++ b/include/linux/ceph/msgpool.h
@@ -2,7 +2,7 @@
2#define _FS_CEPH_MSGPOOL 2#define _FS_CEPH_MSGPOOL
3 3
4#include <linux/mempool.h> 4#include <linux/mempool.h>
5#include "messenger.h" 5#include <linux/ceph/messenger.h>
6 6
7/* 7/*
8 * we use memory pools for preallocating messages we may receive, to 8 * we use memory pools for preallocating messages we may receive, to
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index cedfb1a8434a..d9b880e977e6 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -207,7 +207,7 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
208 struct ceph_msg *msg); 208 struct ceph_msg *msg);
209 209
210extern void ceph_calc_raw_layout(struct ceph_osd_client *osdc, 210extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
211 struct ceph_file_layout *layout, 211 struct ceph_file_layout *layout,
212 u64 snapid, 212 u64 snapid,
213 u64 off, u64 *plen, u64 *bno, 213 u64 off, u64 *plen, u64 *bno,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 311ef8d6aa9e..e37acbe989a9 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -2,8 +2,8 @@
2#define _FS_CEPH_OSDMAP_H 2#define _FS_CEPH_OSDMAP_H
3 3
4#include <linux/rbtree.h> 4#include <linux/rbtree.h>
5#include "types.h" 5#include <linux/ceph/types.h>
6#include "ceph_fs.h" 6#include <linux/ceph/ceph_fs.h>
7#include <linux/crush/crush.h> 7#include <linux/crush/crush.h>
8 8
9/* 9/*
@@ -109,9 +109,9 @@ extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
109extern void ceph_osdmap_destroy(struct ceph_osdmap *map); 109extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
110 110
111/* calculate mapping of a file extent to an object */ 111/* calculate mapping of a file extent to an object */
112extern void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 112extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
113 u64 off, u64 *plen, 113 u64 off, u64 *plen,
114 u64 *bno, u64 *oxoff, u64 *oxlen); 114 u64 *bno, u64 *oxoff, u64 *oxlen);
115 115
116/* calculate mapping of object to a placement group */ 116/* calculate mapping of object to a placement group */
117extern int ceph_calc_object_layout(struct ceph_object_layout *ol, 117extern int ceph_calc_object_layout(struct ceph_object_layout *ol,
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 0a99099801a4..de91fbdf127e 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -6,7 +6,7 @@
6 * (Reliable Autonomic Distributed Object Store). 6 * (Reliable Autonomic Distributed Object Store).
7 */ 7 */
8 8
9#include "msgr.h" 9#include <linux/ceph/msgr.h>
10 10
11/* 11/*
12 * osdmap encoding versions 12 * osdmap encoding versions
diff --git a/include/linux/ceph/types.h b/include/linux/ceph/types.h
index 28b35a005ec2..d3ff1cf2d27e 100644
--- a/include/linux/ceph/types.h
+++ b/include/linux/ceph/types.h
@@ -7,9 +7,9 @@
7#include <linux/fcntl.h> 7#include <linux/fcntl.h>
8#include <linux/string.h> 8#include <linux/string.h>
9 9
10#include "ceph_fs.h" 10#include <linux/ceph/ceph_fs.h>
11#include "ceph_frag.h" 11#include <linux/ceph/ceph_frag.h>
12#include "ceph_hash.h" 12#include <linux/ceph/ceph_hash.h>
13 13
14/* 14/*
15 * Identify inodes by both their ino AND snapshot id (a u64). 15 * Identify inodes by both their ino AND snapshot id (a u64).
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c90eaa803440..f8a030ced0c7 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -17,6 +17,7 @@
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/idr.h> 18#include <linux/idr.h>
19#include <linux/workqueue.h> 19#include <linux/workqueue.h>
20#include <linux/xattr.h>
20 21
21#ifdef CONFIG_CGROUPS 22#ifdef CONFIG_CGROUPS
22 23
@@ -45,17 +46,13 @@ extern const struct file_operations proc_cgroup_operations;
45 46
46/* Define the enumeration of all builtin cgroup subsystems */ 47/* Define the enumeration of all builtin cgroup subsystems */
47#define SUBSYS(_x) _x ## _subsys_id, 48#define SUBSYS(_x) _x ## _subsys_id,
49#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)
48enum cgroup_subsys_id { 50enum cgroup_subsys_id {
49#include <linux/cgroup_subsys.h> 51#include <linux/cgroup_subsys.h>
50 CGROUP_BUILTIN_SUBSYS_COUNT 52 CGROUP_SUBSYS_COUNT,
51}; 53};
54#undef IS_SUBSYS_ENABLED
52#undef SUBSYS 55#undef SUBSYS
53/*
54 * This define indicates the maximum number of subsystems that can be loaded
55 * at once. We limit to this many since cgroupfs_root has subsys_bits to keep
56 * track of all of them.
57 */
58#define CGROUP_SUBSYS_COUNT (BITS_PER_BYTE*sizeof(unsigned long))
59 56
60/* Per-subsystem/per-cgroup state maintained by the system. */ 57/* Per-subsystem/per-cgroup state maintained by the system. */
61struct cgroup_subsys_state { 58struct cgroup_subsys_state {
@@ -216,6 +213,9 @@ struct cgroup {
216 /* List of events which userspace want to receive */ 213 /* List of events which userspace want to receive */
217 struct list_head event_list; 214 struct list_head event_list;
218 spinlock_t event_list_lock; 215 spinlock_t event_list_lock;
216
217 /* directory xattrs */
218 struct simple_xattrs xattrs;
219}; 219};
220 220
221/* 221/*
@@ -309,6 +309,9 @@ struct cftype {
309 /* CFTYPE_* flags */ 309 /* CFTYPE_* flags */
310 unsigned int flags; 310 unsigned int flags;
311 311
312 /* file xattrs */
313 struct simple_xattrs xattrs;
314
312 int (*open)(struct inode *inode, struct file *file); 315 int (*open)(struct inode *inode, struct file *file);
313 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, 316 ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,
314 struct file *file, 317 struct file *file,
@@ -394,7 +397,7 @@ struct cftype {
394 */ 397 */
395struct cftype_set { 398struct cftype_set {
396 struct list_head node; /* chained at subsys->cftsets */ 399 struct list_head node; /* chained at subsys->cftsets */
397 const struct cftype *cfts; 400 struct cftype *cfts;
398}; 401};
399 402
400struct cgroup_scanner { 403struct cgroup_scanner {
@@ -406,8 +409,8 @@ struct cgroup_scanner {
406 void *data; 409 void *data;
407}; 410};
408 411
409int cgroup_add_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); 412int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
410int cgroup_rm_cftypes(struct cgroup_subsys *ss, const struct cftype *cfts); 413int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
411 414
412int cgroup_is_removed(const struct cgroup *cgrp); 415int cgroup_is_removed(const struct cgroup *cgrp);
413 416
@@ -496,6 +499,21 @@ struct cgroup_subsys {
496 */ 499 */
497 bool __DEPRECATED_clear_css_refs; 500 bool __DEPRECATED_clear_css_refs;
498 501
502 /*
503 * If %false, this subsystem is properly hierarchical -
504 * configuration, resource accounting and restriction on a parent
505 * cgroup cover those of its children. If %true, hierarchy support
506 * is broken in some ways - some subsystems ignore hierarchy
507 * completely while others are only implemented half-way.
508 *
509 * It's now disallowed to create nested cgroups if the subsystem is
510 * broken and cgroup core will emit a warning message on such
511 * cases. Eventually, all subsystems will be made properly
512 * hierarchical and this will go away.
513 */
514 bool broken_hierarchy;
515 bool warned_broken_hierarchy;
516
499#define MAX_CGROUP_TYPE_NAMELEN 32 517#define MAX_CGROUP_TYPE_NAMELEN 32
500 const char *name; 518 const char *name;
501 519
@@ -521,7 +539,9 @@ struct cgroup_subsys {
521}; 539};
522 540
523#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 541#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
542#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
524#include <linux/cgroup_subsys.h> 543#include <linux/cgroup_subsys.h>
544#undef IS_SUBSYS_ENABLED
525#undef SUBSYS 545#undef SUBSYS
526 546
527static inline struct cgroup_subsys_state *cgroup_subsys_state( 547static inline struct cgroup_subsys_state *cgroup_subsys_state(
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index dfae957398c3..f204a7a9cf38 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -7,73 +7,73 @@
7 7
8/* */ 8/* */
9 9
10#ifdef CONFIG_CPUSETS 10#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS)
11SUBSYS(cpuset) 11SUBSYS(cpuset)
12#endif 12#endif
13 13
14/* */ 14/* */
15 15
16#ifdef CONFIG_CGROUP_DEBUG 16#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG)
17SUBSYS(debug) 17SUBSYS(debug)
18#endif 18#endif
19 19
20/* */ 20/* */
21 21
22#ifdef CONFIG_CGROUP_SCHED 22#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED)
23SUBSYS(cpu_cgroup) 23SUBSYS(cpu_cgroup)
24#endif 24#endif
25 25
26/* */ 26/* */
27 27
28#ifdef CONFIG_CGROUP_CPUACCT 28#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT)
29SUBSYS(cpuacct) 29SUBSYS(cpuacct)
30#endif 30#endif
31 31
32/* */ 32/* */
33 33
34#ifdef CONFIG_MEMCG 34#if IS_SUBSYS_ENABLED(CONFIG_MEMCG)
35SUBSYS(mem_cgroup) 35SUBSYS(mem_cgroup)
36#endif 36#endif
37 37
38/* */ 38/* */
39 39
40#ifdef CONFIG_CGROUP_DEVICE 40#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE)
41SUBSYS(devices) 41SUBSYS(devices)
42#endif 42#endif
43 43
44/* */ 44/* */
45 45
46#ifdef CONFIG_CGROUP_FREEZER 46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER)
47SUBSYS(freezer) 47SUBSYS(freezer)
48#endif 48#endif
49 49
50/* */ 50/* */
51 51
52#ifdef CONFIG_NET_CLS_CGROUP 52#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
53SUBSYS(net_cls) 53SUBSYS(net_cls)
54#endif 54#endif
55 55
56/* */ 56/* */
57 57
58#ifdef CONFIG_BLK_CGROUP 58#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP)
59SUBSYS(blkio) 59SUBSYS(blkio)
60#endif 60#endif
61 61
62/* */ 62/* */
63 63
64#ifdef CONFIG_CGROUP_PERF 64#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF)
65SUBSYS(perf) 65SUBSYS(perf)
66#endif 66#endif
67 67
68/* */ 68/* */
69 69
70#ifdef CONFIG_NETPRIO_CGROUP 70#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
71SUBSYS(net_prio) 71SUBSYS(net_prio)
72#endif 72#endif
73 73
74/* */ 74/* */
75 75
76#ifdef CONFIG_CGROUP_HUGETLB 76#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB)
77SUBSYS(hugetlb) 77SUBSYS(hugetlb)
78#endif 78#endif
79 79
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 77335fac943e..c12731582920 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -26,6 +26,7 @@
26#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */ 26#define CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */
27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */ 27#define CLK_IS_ROOT BIT(4) /* root clk, has no parent */
28#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ 28#define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */
29#define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */
29 30
30struct clk_hw; 31struct clk_hw;
31 32
@@ -360,6 +361,11 @@ int of_clk_add_provider(struct device_node *np,
360void of_clk_del_provider(struct device_node *np); 361void of_clk_del_provider(struct device_node *np);
361struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec, 362struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
362 void *data); 363 void *data);
364struct clk_onecell_data {
365 struct clk **clks;
366 unsigned int clk_num;
367};
368struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
363const char *of_clk_get_parent_name(struct device_node *np, int index); 369const char *of_clk_get_parent_name(struct device_node *np, int index);
364void of_clk_init(const struct of_device_id *matches); 370void of_clk_init(const struct of_device_id *matches);
365 371
diff --git a/include/linux/clk/bcm2835.h b/include/linux/clk/bcm2835.h
new file mode 100644
index 000000000000..aa937f6c17da
--- /dev/null
+++ b/include/linux/clk/bcm2835.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __LINUX_CLK_BCM2835_H_
20#define __LINUX_CLK_BCM2835_H_
21
22void __init bcm2835_init_clocks(void);
23
24#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index acba894374a1..8a7096fcb01e 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -97,6 +97,8 @@ struct clock_event_device {
97 void (*broadcast)(const struct cpumask *mask); 97 void (*broadcast)(const struct cpumask *mask);
98 void (*set_mode)(enum clock_event_mode mode, 98 void (*set_mode)(enum clock_event_mode mode,
99 struct clock_event_device *); 99 struct clock_event_device *);
100 void (*suspend)(struct clock_event_device *);
101 void (*resume)(struct clock_event_device *);
100 unsigned long min_delta_ticks; 102 unsigned long min_delta_ticks;
101 unsigned long max_delta_ticks; 103 unsigned long max_delta_ticks;
102 104
@@ -156,6 +158,9 @@ clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
156 freq, minsec); 158 freq, minsec);
157} 159}
158 160
161extern void clockevents_suspend(void);
162extern void clockevents_resume(void);
163
159#ifdef CONFIG_GENERIC_CLOCKEVENTS 164#ifdef CONFIG_GENERIC_CLOCKEVENTS
160extern void clockevents_notify(unsigned long reason, void *arg); 165extern void clockevents_notify(unsigned long reason, void *arg);
161#else 166#else
@@ -164,6 +169,9 @@ extern void clockevents_notify(unsigned long reason, void *arg);
164 169
165#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ 170#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
166 171
172static inline void clockevents_suspend(void) {}
173static inline void clockevents_resume(void) {}
174
167#define clockevents_notify(reason, arg) do { } while (0) 175#define clockevents_notify(reason, arg) do { } while (0)
168 176
169#endif 177#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index 133ddcf83397..6ecb6dc2f303 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,8 +22,9 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync); 25 bool sync, bool *contended, struct page **page);
26extern int compact_pgdat(pg_data_t *pgdat, int order); 26extern int compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat);
27extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
28 29
29/* Do not skip compaction more than 64 times */ 30/* Do not skip compaction more than 64 times */
@@ -61,10 +62,20 @@ static inline bool compaction_deferred(struct zone *zone, int order)
61 return zone->compact_considered < defer_limit; 62 return zone->compact_considered < defer_limit;
62} 63}
63 64
65/* Returns true if restarting compaction after many failures */
66static inline bool compaction_restarting(struct zone *zone, int order)
67{
68 if (order < zone->compact_order_failed)
69 return false;
70
71 return zone->compact_defer_shift == COMPACT_MAX_DEFER_SHIFT &&
72 zone->compact_considered >= 1UL << zone->compact_defer_shift;
73}
74
64#else 75#else
65static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
66 int order, gfp_t gfp_mask, nodemask_t *nodemask, 77 int order, gfp_t gfp_mask, nodemask_t *nodemask,
67 bool sync) 78 bool sync, bool *contended, struct page **page)
68{ 79{
69 return COMPACT_CONTINUE; 80 return COMPACT_CONTINUE;
70} 81}
@@ -74,6 +85,10 @@ static inline int compact_pgdat(pg_data_t *pgdat, int order)
74 return COMPACT_CONTINUE; 85 return COMPACT_CONTINUE;
75} 86}
76 87
88static inline void reset_isolation_suitable(pg_data_t *pgdat)
89{
90}
91
77static inline unsigned long compaction_suitable(struct zone *zone, int order) 92static inline unsigned long compaction_suitable(struct zone *zone, int order)
78{ 93{
79 return COMPACT_SKIPPED; 94 return COMPACT_SKIPPED;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 09b28b7369d7..3f53d002c7c5 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -160,11 +160,6 @@ struct compat_ustat {
160 char f_fpack[6]; 160 char f_fpack[6];
161}; 161};
162 162
163typedef union compat_sigval {
164 compat_int_t sival_int;
165 compat_uptr_t sival_ptr;
166} compat_sigval_t;
167
168#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) 163#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
169 164
170typedef struct compat_sigevent { 165typedef struct compat_sigevent {
@@ -590,6 +585,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
590 unsigned long liovcnt, const struct compat_iovec __user *rvec, 585 unsigned long liovcnt, const struct compat_iovec __user *rvec,
591 unsigned long riovcnt, unsigned long flags); 586 unsigned long riovcnt, unsigned long flags);
592 587
588asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,
589 compat_off_t __user *offset, compat_size_t count);
590
593#else 591#else
594 592
595#define is_compat_task() (0) 593#define is_compat_task() (0)
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2f4079175afb..934bc34d5f99 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -49,6 +49,13 @@
49#endif 49#endif
50#endif 50#endif
51 51
52#if __GNUC_MINOR__ >= 6
53/*
54 * Tell the optimizer that something else uses this function or variable.
55 */
56#define __visible __attribute__((externally_visible))
57#endif
58
52#if __GNUC_MINOR__ > 0 59#if __GNUC_MINOR__ > 0
53#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) 60#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
54#endif 61#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 923d093c9cea..f430e4162f41 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -278,6 +278,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
278# define __section(S) __attribute__ ((__section__(#S))) 278# define __section(S) __attribute__ ((__section__(#S)))
279#endif 279#endif
280 280
281#ifndef __visible
282#define __visible
283#endif
284
281/* Are two types/vars the same type (ignoring qualifiers)? */ 285/* Are two types/vars the same type (ignoring qualifiers)? */
282#ifndef __same_type 286#ifndef __same_type
283# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) 287# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
diff --git a/include/linux/comstats.h b/include/linux/comstats.h
deleted file mode 100644
index 3f5ea8e8026d..000000000000
--- a/include/linux/comstats.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * comstats.h -- Serial Port Stats.
5 *
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/*****************************************************************************/
25#ifndef _COMSTATS_H
26#define _COMSTATS_H
27/*****************************************************************************/
28
29/*
30 * Serial port stats structure. The structure itself is UART
31 * independent, but some fields may be UART/driver specific (for
32 * example state).
33 */
34
35typedef struct {
36 unsigned long brd;
37 unsigned long panel;
38 unsigned long port;
39 unsigned long hwid;
40 unsigned long type;
41 unsigned long txtotal;
42 unsigned long rxtotal;
43 unsigned long txbuffered;
44 unsigned long rxbuffered;
45 unsigned long rxoverrun;
46 unsigned long rxparity;
47 unsigned long rxframing;
48 unsigned long rxlost;
49 unsigned long txbreaks;
50 unsigned long rxbreaks;
51 unsigned long txxon;
52 unsigned long txxoff;
53 unsigned long rxxon;
54 unsigned long rxxoff;
55 unsigned long txctson;
56 unsigned long txctsoff;
57 unsigned long rxrtson;
58 unsigned long rxrtsoff;
59 unsigned long modem;
60 unsigned long state;
61 unsigned long flags;
62 unsigned long ttystate;
63 unsigned long cflags;
64 unsigned long iflags;
65 unsigned long oflags;
66 unsigned long lflags;
67 unsigned long signals;
68} comstats_t;
69
70
71/*
72 * Board stats structure. Returns useful info about the board.
73 */
74
75#define COM_MAXPANELS 8
76
77typedef struct {
78 unsigned long panel;
79 unsigned long type;
80 unsigned long hwid;
81 unsigned long nrports;
82} companel_t;
83
84typedef struct {
85 unsigned long brd;
86 unsigned long type;
87 unsigned long hwid;
88 unsigned long state;
89 unsigned long ioaddr;
90 unsigned long ioaddr2;
91 unsigned long memaddr;
92 unsigned long irq;
93 unsigned long nrpanels;
94 unsigned long nrports;
95 companel_t panels[COM_MAXPANELS];
96} combrd_t;
97
98
99/*
100 * Define the ioctl operations for stats stuff.
101 */
102#include <linux/ioctl.h>
103
104#define COM_GETPORTSTATS _IO('c',30)
105#define COM_CLRPORTSTATS _IO('c',31)
106#define COM_GETBRDSTATS _IO('c',32)
107
108
109/*
110 * Define the set of ioctls that give user level access to the
111 * private port, panel and board structures. The argument required
112 * will be driver dependent!
113 */
114#define COM_READPORT _IO('c',40)
115#define COM_READBOARD _IO('c',41)
116#define COM_READPANEL _IO('c',42)
117
118/*****************************************************************************/
119#endif
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index ba4b85a6d9b8..1775eb8acc03 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -11,5 +11,10 @@
11 */ 11 */
12extern int dump_write(struct file *file, const void *addr, int nr); 12extern int dump_write(struct file *file, const void *addr, int nr);
13extern int dump_seek(struct file *file, loff_t off); 13extern int dump_seek(struct file *file, loff_t off);
14#ifdef CONFIG_COREDUMP
15extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs);
16#else
17static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {}
18#endif
14 19
15#endif /* _LINUX_COREDUMP_H */ 20#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 040b13b5c14a..279b1eaa8b73 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -194,6 +194,10 @@ static inline int cpuidle_play_dead(void) {return -ENODEV; }
194 194
195#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 195#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
196void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a); 196void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a);
197#else
198static inline void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a)
199{
200}
197#endif 201#endif
198 202
199/****************************** 203/******************************
diff --git a/include/linux/crush/mapper.h b/include/linux/crush/mapper.h
index 71d79f44a7d0..5772dee3ecbf 100644
--- a/include/linux/crush/mapper.h
+++ b/include/linux/crush/mapper.h
@@ -8,7 +8,7 @@
8 * LGPL2 8 * LGPL2
9 */ 9 */
10 10
11#include "crush.h" 11#include <linux/crush/crush.h>
12 12
13extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, int size); 13extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, int size);
14extern int crush_do_rule(const struct crush_map *map, 14extern int crush_do_rule(const struct crush_map *map,
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index caa34e50537e..59200795482e 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -206,6 +206,8 @@ struct dentry_operations {
206#define DCACHE_MANAGED_DENTRY \ 206#define DCACHE_MANAGED_DENTRY \
207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) 207 (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT)
208 208
209#define DCACHE_DENTRY_KILLED 0x100000
210
209extern seqlock_t rename_lock; 211extern seqlock_t rename_lock;
210 212
211static inline int dname_external(struct dentry *dentry) 213static inline int dname_external(struct dentry *dentry)
diff --git a/include/linux/device.h b/include/linux/device.h
index 52a5f15a2223..86ef6ab553b1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -536,6 +536,10 @@ extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
536#else 536#else
537extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp); 537extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
538#endif 538#endif
539extern void devres_for_each_res(struct device *dev, dr_release_t release,
540 dr_match_t match, void *match_data,
541 void (*fn)(struct device *, void *, void *),
542 void *data);
539extern void devres_free(void *res); 543extern void devres_free(void *res);
540extern void devres_add(struct device *dev, void *res); 544extern void devres_add(struct device *dev, void *res);
541extern void *devres_find(struct device *dev, dr_release_t release, 545extern void *devres_find(struct device *dev, dr_release_t release,
@@ -772,6 +776,13 @@ static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
772 dev->power.ignore_children = enable; 776 dev->power.ignore_children = enable;
773} 777}
774 778
779static inline void dev_pm_syscore_device(struct device *dev, bool val)
780{
781#ifdef CONFIG_PM_SLEEP
782 dev->power.syscore = val;
783#endif
784}
785
775static inline void device_lock(struct device *dev) 786static inline void device_lock(struct device *dev)
776{ 787{
777 mutex_lock(&dev->mutex); 788 mutex_lock(&dev->mutex);
@@ -891,12 +902,15 @@ extern const char *dev_driver_string(const struct device *dev);
891 902
892#ifdef CONFIG_PRINTK 903#ifdef CONFIG_PRINTK
893 904
894extern int __dev_printk(const char *level, const struct device *dev, 905extern __printf(3, 0)
895 struct va_format *vaf); 906int dev_vprintk_emit(int level, const struct device *dev,
907 const char *fmt, va_list args);
908extern __printf(3, 4)
909int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
910
896extern __printf(3, 4) 911extern __printf(3, 4)
897int dev_printk(const char *level, const struct device *dev, 912int dev_printk(const char *level, const struct device *dev,
898 const char *fmt, ...) 913 const char *fmt, ...);
899 ;
900extern __printf(2, 3) 914extern __printf(2, 3)
901int dev_emerg(const struct device *dev, const char *fmt, ...); 915int dev_emerg(const struct device *dev, const char *fmt, ...);
902extern __printf(2, 3) 916extern __printf(2, 3)
@@ -914,6 +928,14 @@ int _dev_info(const struct device *dev, const char *fmt, ...);
914 928
915#else 929#else
916 930
931static inline __printf(3, 0)
932int dev_vprintk_emit(int level, const struct device *dev,
933 const char *fmt, va_list args)
934{ return 0; }
935static inline __printf(3, 4)
936int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...)
937{ return 0; }
938
917static inline int __dev_printk(const char *level, const struct device *dev, 939static inline int __dev_printk(const char *level, const struct device *dev,
918 struct va_format *vaf) 940 struct va_format *vaf)
919{ return 0; } 941{ return 0; }
@@ -946,6 +968,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
946 968
947#endif 969#endif
948 970
971/*
972 * Stupid hackaround for existing uses of non-printk uses dev_info
973 *
974 * Note that the definition of dev_info below is actually _dev_info
975 * and a macro is used to avoid redefining dev_info
976 */
977
978#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
979
980#if defined(CONFIG_DYNAMIC_DEBUG)
981#define dev_dbg(dev, format, ...) \
982do { \
983 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
984} while (0)
985#elif defined(DEBUG)
986#define dev_dbg(dev, format, arg...) \
987 dev_printk(KERN_DEBUG, dev, format, ##arg)
988#else
989#define dev_dbg(dev, format, arg...) \
990({ \
991 if (0) \
992 dev_printk(KERN_DEBUG, dev, format, ##arg); \
993 0; \
994})
995#endif
996
949#define dev_level_ratelimited(dev_level, dev, fmt, ...) \ 997#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
950do { \ 998do { \
951 static DEFINE_RATELIMIT_STATE(_rs, \ 999 static DEFINE_RATELIMIT_STATE(_rs, \
@@ -969,33 +1017,21 @@ do { \
969 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) 1017 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
970#define dev_info_ratelimited(dev, fmt, ...) \ 1018#define dev_info_ratelimited(dev, fmt, ...) \
971 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) 1019 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
1020#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
972#define dev_dbg_ratelimited(dev, fmt, ...) \ 1021#define dev_dbg_ratelimited(dev, fmt, ...) \
973 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__) 1022do { \
974 1023 static DEFINE_RATELIMIT_STATE(_rs, \
975/* 1024 DEFAULT_RATELIMIT_INTERVAL, \
976 * Stupid hackaround for existing uses of non-printk uses dev_info 1025 DEFAULT_RATELIMIT_BURST); \
977 * 1026 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
978 * Note that the definition of dev_info below is actually _dev_info 1027 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
979 * and a macro is used to avoid redefining dev_info 1028 __ratelimit(&_rs)) \
980 */ 1029 __dynamic_pr_debug(&descriptor, pr_fmt(fmt), \
981 1030 ##__VA_ARGS__); \
982#define dev_info(dev, fmt, arg...) _dev_info(dev, fmt, ##arg)
983
984#if defined(CONFIG_DYNAMIC_DEBUG)
985#define dev_dbg(dev, format, ...) \
986do { \
987 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
988} while (0) 1031} while (0)
989#elif defined(DEBUG)
990#define dev_dbg(dev, format, arg...) \
991 dev_printk(KERN_DEBUG, dev, format, ##arg)
992#else 1032#else
993#define dev_dbg(dev, format, arg...) \ 1033#define dev_dbg_ratelimited(dev, fmt, ...) \
994({ \ 1034 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
995 if (0) \
996 dev_printk(KERN_DEBUG, dev, format, ##arg); \
997 0; \
998})
999#endif 1035#endif
1000 1036
1001#ifdef VERBOSE_DEBUG 1037#ifdef VERBOSE_DEBUG
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 9c02a4508b25..d3201e438d16 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -591,7 +591,7 @@ struct dma_device {
591 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 591 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
592 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 592 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
593 size_t period_len, enum dma_transfer_direction direction, 593 size_t period_len, enum dma_transfer_direction direction,
594 void *context); 594 unsigned long flags, void *context);
595 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 595 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
596 struct dma_chan *chan, struct dma_interleaved_template *xt, 596 struct dma_chan *chan, struct dma_interleaved_template *xt,
597 unsigned long flags); 597 unsigned long flags);
@@ -653,10 +653,11 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
653 653
654static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( 654static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
655 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 655 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
656 size_t period_len, enum dma_transfer_direction dir) 656 size_t period_len, enum dma_transfer_direction dir,
657 unsigned long flags)
657{ 658{
658 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, 659 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
659 period_len, dir, NULL); 660 period_len, dir, flags, NULL);
660} 661}
661 662
662static inline int dmaengine_terminate_all(struct dma_chan *chan) 663static inline int dmaengine_terminate_all(struct dma_chan *chan)
diff --git a/include/linux/drbd_tag_magic.h b/include/linux/drbd_tag_magic.h
index 81f52f2c5724..82de1f9e48b1 100644
--- a/include/linux/drbd_tag_magic.h
+++ b/include/linux/drbd_tag_magic.h
@@ -12,7 +12,7 @@ enum packet_types {
12#define NL_INT64(pn, pr, member) 12#define NL_INT64(pn, pr, member)
13#define NL_BIT(pn, pr, member) 13#define NL_BIT(pn, pr, member)
14#define NL_STRING(pn, pr, member, len) 14#define NL_STRING(pn, pr, member, len)
15#include "drbd_nl.h" 15#include <linux/drbd_nl.h>
16 P_nl_after_last_packet, 16 P_nl_after_last_packet,
17}; 17};
18 18
@@ -37,7 +37,7 @@ static const int tag_list_sizes[] = {
37#define NL_INT64(pn, pr, member) + 4 + 8 37#define NL_INT64(pn, pr, member) + 4 + 8
38#define NL_BIT(pn, pr, member) + 4 + 1 38#define NL_BIT(pn, pr, member) + 4 + 1
39#define NL_STRING(pn, pr, member, len) + 4 + (len) 39#define NL_STRING(pn, pr, member, len) + 4 + (len)
40#include "drbd_nl.h" 40#include <linux/drbd_nl.h>
41}; 41};
42 42
43/* The two highest bits are used for the tag type */ 43/* The two highest bits are used for the tag type */
@@ -62,7 +62,7 @@ enum drbd_tags {
62#define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr , 62#define NL_INT64(pn, pr, member) T_ ## member = pn | TT_INT64 | pr ,
63#define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr , 63#define NL_BIT(pn, pr, member) T_ ## member = pn | TT_BIT | pr ,
64#define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr , 64#define NL_STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING | pr ,
65#include "drbd_nl.h" 65#include <linux/drbd_nl.h>
66}; 66};
67 67
68struct tag { 68struct tag {
@@ -78,7 +78,7 @@ static const struct tag tag_descriptions[] = {
78#define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) }, 78#define NL_INT64(pn, pr, member) [ pn ] = { #member, TT_INT64 | pr, sizeof(__u64) },
79#define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) }, 79#define NL_BIT(pn, pr, member) [ pn ] = { #member, TT_BIT | pr, sizeof(int) },
80#define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) }, 80#define NL_STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING | pr, (len) },
81#include "drbd_nl.h" 81#include <linux/drbd_nl.h>
82}; 82};
83 83
84#endif 84#endif
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index f50d4058c5fb..c12d452cb40d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_8VSB = 0x200000, 62 FE_CAN_8VSB = 0x200000,
63 FE_CAN_16VSB = 0x400000, 63 FE_CAN_16VSB = 0x400000,
64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ 64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
65 FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */
65 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ 66 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */
66 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ 67 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
67 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ 68 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
@@ -121,16 +122,27 @@ typedef enum fe_sec_mini_cmd {
121} fe_sec_mini_cmd_t; 122} fe_sec_mini_cmd_t;
122 123
123 124
125/**
126 * enum fe_status - enumerates the possible frontend status
127 * @FE_HAS_SIGNAL: found something above the noise level
128 * @FE_HAS_CARRIER: found a DVB signal
129 * @FE_HAS_VITERBI: FEC is stable
130 * @FE_HAS_SYNC: found sync bytes
131 * @FE_HAS_LOCK: everything's working
132 * @FE_TIMEDOUT: no lock within the last ~2 seconds
133 * @FE_REINIT: frontend was reinitialized, application is recommended
134 * to reset DiSEqC, tone and parameters
135 */
136
124typedef enum fe_status { 137typedef enum fe_status {
125 FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ 138 FE_HAS_SIGNAL = 0x01,
126 FE_HAS_CARRIER = 0x02, /* found a DVB signal */ 139 FE_HAS_CARRIER = 0x02,
127 FE_HAS_VITERBI = 0x04, /* FEC is stable */ 140 FE_HAS_VITERBI = 0x04,
128 FE_HAS_SYNC = 0x08, /* found sync bytes */ 141 FE_HAS_SYNC = 0x08,
129 FE_HAS_LOCK = 0x10, /* everything's working... */ 142 FE_HAS_LOCK = 0x10,
130 FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ 143 FE_TIMEDOUT = 0x20,
131 FE_REINIT = 0x40 /* frontend was reinitialized, */ 144 FE_REINIT = 0x40,
132} fe_status_t; /* application is recommended to reset */ 145} fe_status_t;
133 /* DiSEqC, tone and parameters */
134 146
135typedef enum fe_spectral_inversion { 147typedef enum fe_spectral_inversion {
136 INVERSION_OFF, 148 INVERSION_OFF,
@@ -152,6 +164,7 @@ typedef enum fe_code_rate {
152 FEC_AUTO, 164 FEC_AUTO,
153 FEC_3_5, 165 FEC_3_5,
154 FEC_9_10, 166 FEC_9_10,
167 FEC_2_5,
155} fe_code_rate_t; 168} fe_code_rate_t;
156 169
157 170
@@ -169,6 +182,7 @@ typedef enum fe_modulation {
169 APSK_16, 182 APSK_16,
170 APSK_32, 183 APSK_32,
171 DQPSK, 184 DQPSK,
185 QAM_4_NR,
172} fe_modulation_t; 186} fe_modulation_t;
173 187
174typedef enum fe_transmit_mode { 188typedef enum fe_transmit_mode {
@@ -179,6 +193,8 @@ typedef enum fe_transmit_mode {
179 TRANSMISSION_MODE_1K, 193 TRANSMISSION_MODE_1K,
180 TRANSMISSION_MODE_16K, 194 TRANSMISSION_MODE_16K,
181 TRANSMISSION_MODE_32K, 195 TRANSMISSION_MODE_32K,
196 TRANSMISSION_MODE_C1,
197 TRANSMISSION_MODE_C3780,
182} fe_transmit_mode_t; 198} fe_transmit_mode_t;
183 199
184#if defined(__DVB_CORE__) || !defined (__KERNEL__) 200#if defined(__DVB_CORE__) || !defined (__KERNEL__)
@@ -202,6 +218,9 @@ typedef enum fe_guard_interval {
202 GUARD_INTERVAL_1_128, 218 GUARD_INTERVAL_1_128,
203 GUARD_INTERVAL_19_128, 219 GUARD_INTERVAL_19_128,
204 GUARD_INTERVAL_19_256, 220 GUARD_INTERVAL_19_256,
221 GUARD_INTERVAL_PN420,
222 GUARD_INTERVAL_PN595,
223 GUARD_INTERVAL_PN945,
205} fe_guard_interval_t; 224} fe_guard_interval_t;
206 225
207 226
@@ -213,6 +232,12 @@ typedef enum fe_hierarchy {
213 HIERARCHY_AUTO 232 HIERARCHY_AUTO
214} fe_hierarchy_t; 233} fe_hierarchy_t;
215 234
235enum fe_interleaving {
236 INTERLEAVING_NONE,
237 INTERLEAVING_AUTO,
238 INTERLEAVING_240,
239 INTERLEAVING_720,
240};
216 241
217#if defined(__DVB_CORE__) || !defined (__KERNEL__) 242#if defined(__DVB_CORE__) || !defined (__KERNEL__)
218struct dvb_qpsk_parameters { 243struct dvb_qpsk_parameters {
@@ -314,9 +339,9 @@ struct dvb_frontend_event {
314 339
315#define DTV_ISDBT_LAYER_ENABLED 41 340#define DTV_ISDBT_LAYER_ENABLED 41
316 341
317#define DTV_ISDBS_TS_ID 42 342#define DTV_STREAM_ID 42
318 343#define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
319#define DTV_DVBT2_PLP_ID 43 344#define DTV_DVBT2_PLP_ID_LEGACY 43
320 345
321#define DTV_ENUM_DELSYS 44 346#define DTV_ENUM_DELSYS 44
322 347
@@ -337,7 +362,10 @@ struct dvb_frontend_event {
337#define DTV_ATSCMH_SCCC_CODE_MODE_C 58 362#define DTV_ATSCMH_SCCC_CODE_MODE_C 58
338#define DTV_ATSCMH_SCCC_CODE_MODE_D 59 363#define DTV_ATSCMH_SCCC_CODE_MODE_D 59
339 364
340#define DTV_MAX_COMMAND DTV_ATSCMH_SCCC_CODE_MODE_D 365#define DTV_INTERLEAVING 60
366#define DTV_LNA 61
367
368#define DTV_MAX_COMMAND DTV_LNA
341 369
342typedef enum fe_pilot { 370typedef enum fe_pilot {
343 PILOT_ON, 371 PILOT_ON,
@@ -366,7 +394,7 @@ typedef enum fe_delivery_system {
366 SYS_ISDBC, 394 SYS_ISDBC,
367 SYS_ATSC, 395 SYS_ATSC,
368 SYS_ATSCMH, 396 SYS_ATSCMH,
369 SYS_DMBTH, 397 SYS_DTMB,
370 SYS_CMMB, 398 SYS_CMMB,
371 SYS_DAB, 399 SYS_DAB,
372 SYS_DVBT2, 400 SYS_DVBT2,
@@ -374,8 +402,9 @@ typedef enum fe_delivery_system {
374 SYS_DVBC_ANNEX_C, 402 SYS_DVBC_ANNEX_C,
375} fe_delivery_system_t; 403} fe_delivery_system_t;
376 404
377 405/* backward compatibility */
378#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A 406#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
407#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */
379 408
380/* ATSC-MH */ 409/* ATSC-MH */
381 410
@@ -409,6 +438,8 @@ enum atscmh_rs_code_mode {
409 ATSCMH_RSCODE_RES = 3, 438 ATSCMH_RSCODE_RES = 3,
410}; 439};
411 440
441#define NO_STREAM_ID_FILTER (~0U)
442#define LNA_AUTO (~0U)
412 443
413struct dtv_cmds_h { 444struct dtv_cmds_h {
414 char *name; /* A display name for debugging purposes */ 445 char *name; /* A display name for debugging purposes */
diff --git a/include/linux/dvb/version.h b/include/linux/dvb/version.h
index 43d9e8d462d4..20e5eac2ffd3 100644
--- a/include/linux/dvb/version.h
+++ b/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 6 27#define DVB_API_VERSION_MINOR 8
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/linux/efi-bgrt.h b/include/linux/efi-bgrt.h
new file mode 100644
index 000000000000..051b21fedf68
--- /dev/null
+++ b/include/linux/efi-bgrt.h
@@ -0,0 +1,21 @@
1#ifndef _LINUX_EFI_BGRT_H
2#define _LINUX_EFI_BGRT_H
3
4#ifdef CONFIG_ACPI_BGRT
5
6#include <linux/acpi.h>
7
8void efi_bgrt_init(void);
9
10/* The BGRT data itself; only valid if bgrt_image != NULL. */
11extern void *bgrt_image;
12extern size_t bgrt_image_size;
13extern struct acpi_table_bgrt *bgrt_tab;
14
15#else /* !CONFIG_ACPI_BGRT */
16
17static inline void efi_bgrt_init(void) {}
18
19#endif /* !CONFIG_ACPI_BGRT */
20
21#endif /* _LINUX_EFI_BGRT_H */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 103adc6d7e3a..8670eb1eb8cd 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -496,6 +496,14 @@ extern void efi_map_pal_code (void);
496extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); 496extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
497extern void efi_gettimeofday (struct timespec *ts); 497extern void efi_gettimeofday (struct timespec *ts);
498extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ 498extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
499#ifdef CONFIG_X86
500extern void efi_late_init(void);
501extern void efi_free_boot_services(void);
502#else
503static inline void efi_late_init(void) {}
504static inline void efi_free_boot_services(void) {}
505#endif
506extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
499extern u64 efi_get_iobase (void); 507extern u64 efi_get_iobase (void);
500extern u32 efi_mem_type (unsigned long phys_addr); 508extern u32 efi_mem_type (unsigned long phys_addr);
501extern u64 efi_mem_attributes (unsigned long phys_addr); 509extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -503,6 +511,8 @@ extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
503extern int __init efi_uart_console_only (void); 511extern int __init efi_uart_console_only (void);
504extern void efi_initialize_iomem_resources(struct resource *code_resource, 512extern void efi_initialize_iomem_resources(struct resource *code_resource,
505 struct resource *data_resource, struct resource *bss_resource); 513 struct resource *data_resource, struct resource *bss_resource);
514extern unsigned long efi_get_time(void);
515extern int efi_set_rtc_mmss(unsigned long nowtime);
506extern void efi_reserve_boot_services(void); 516extern void efi_reserve_boot_services(void);
507extern struct efi_memory_map memmap; 517extern struct efi_memory_map memmap;
508 518
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 999b4f52e8e5..59ef40650e1e 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -372,6 +372,12 @@ typedef struct elf64_shdr {
372#define NT_PRPSINFO 3 372#define NT_PRPSINFO 3
373#define NT_TASKSTRUCT 4 373#define NT_TASKSTRUCT 4
374#define NT_AUXV 6 374#define NT_AUXV 6
375/*
376 * Note to userspace developers: size of NT_SIGINFO note may increase
377 * in the future to accomodate more fields, don't assume it is fixed!
378 */
379#define NT_SIGINFO 0x53494749
380#define NT_FILE 0x46494c45
375#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 381#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
376#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 382#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
377#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 383#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
@@ -387,7 +393,11 @@ typedef struct elf64_shdr {
387#define NT_S390_PREFIX 0x305 /* s390 prefix register */ 393#define NT_S390_PREFIX 0x305 /* s390 prefix register */
388#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 394#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
389#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 395#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
396#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
390#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 397#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
398#define NT_ARM_TLS 0x401 /* ARM TLS register */
399#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
400#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
391 401
392 402
393/* Note header in a PT_NOTE section */ 403/* Note header in a PT_NOTE section */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index d426336d92d9..b006ba0a9f42 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -151,6 +151,17 @@ static inline void eth_broadcast_addr(u8 *addr)
151} 151}
152 152
153/** 153/**
154 * eth_zero_addr - Assign zero address
155 * @addr: Pointer to a six-byte array containing the Ethernet address
156 *
157 * Assign the zero address to the given address array.
158 */
159static inline void eth_zero_addr(u8 *addr)
160{
161 memset(addr, 0x00, ETH_ALEN);
162}
163
164/**
154 * eth_hw_addr_random - Generate software assigned random Ethernet and 165 * eth_hw_addr_random - Generate software assigned random Ethernet and
155 * set device flag 166 * set device flag
156 * @dev: pointer to net_device structure 167 * @dev: pointer to net_device structure
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 21eff418091b..fcb4f8e60c1c 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -45,8 +45,10 @@ struct ethtool_cmd {
45 * bits) in Mbps. Please use 45 * bits) in Mbps. Please use
46 * ethtool_cmd_speed()/_set() to 46 * ethtool_cmd_speed()/_set() to
47 * access it */ 47 * access it */
48 __u8 eth_tp_mdix; 48 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
49 __u8 reserved2; 49 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
50 * link should be renegotiated if necessary
51 */
50 __u32 lp_advertising; /* Features the link partner advertises */ 52 __u32 lp_advertising; /* Features the link partner advertises */
51 __u32 reserved[2]; 53 __u32 reserved[2];
52}; 54};
@@ -1229,10 +1231,13 @@ struct ethtool_ops {
1229#define AUTONEG_DISABLE 0x00 1231#define AUTONEG_DISABLE 0x00
1230#define AUTONEG_ENABLE 0x01 1232#define AUTONEG_ENABLE 0x01
1231 1233
1232/* Mode MDI or MDI-X */ 1234/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
1233#define ETH_TP_MDI_INVALID 0x00 1235 * the driver is required to renegotiate link
1234#define ETH_TP_MDI 0x01 1236 */
1235#define ETH_TP_MDI_X 0x02 1237#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
1238#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
1239#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
1240#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
1236 1241
1237/* Wake-On-Lan options. */ 1242/* Wake-On-Lan options. */
1238#define WAKE_PHY (1 << 0) 1243#define WAKE_PHY (1 << 0)
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f4bb378ccf6a..41085d0f3955 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -25,6 +25,7 @@
25#define EPOLL_CTL_ADD 1 25#define EPOLL_CTL_ADD 1
26#define EPOLL_CTL_DEL 2 26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3 27#define EPOLL_CTL_MOD 3
28#define EPOLL_CTL_DISABLE 4
28 29
29/* 30/*
30 * Request the handling of system wakeup events so as to prevent system suspends 31 * Request the handling of system wakeup events so as to prevent system suspends
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index cdd401477656..7443a560c9d0 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -30,19 +30,19 @@
30 30
31/* 31/*
32 * The standard cable name is to help support general notifier 32 * The standard cable name is to help support general notifier
33 * and notifee device drivers to share the common names. 33 * and notifiee device drivers to share the common names.
34 * Please use standard cable names unless your notifier device has 34 * Please use standard cable names unless your notifier device has
35 * a very unique and abnormal cable or 35 * a very unique and abnormal cable or
36 * the cable type is supposed to be used with only one unique 36 * the cable type is supposed to be used with only one unique
37 * pair of notifier/notifee devices. 37 * pair of notifier/notifiee devices.
38 * 38 *
39 * Please add any other "standard" cables used with extcon dev. 39 * Please add any other "standard" cables used with extcon dev.
40 * 40 *
41 * You may add a dot and number to specify version or specification 41 * You may add a dot and number to specify version or specification
42 * of the specific cable if it is required. (e.g., "Fast-charger.18" 42 * of the specific cable if it is required. (e.g., "Fast-charger.18"
43 * and "Fast-charger.10" for 1.8A and 1.0A chargers) 43 * and "Fast-charger.10" for 1.8A and 1.0A chargers)
44 * However, the notifee and notifier should be able to handle such 44 * However, the notifiee and notifier should be able to handle such
45 * string and if the notifee can negotiate the protocol or idenify, 45 * string and if the notifiee can negotiate the protocol or identify,
46 * you don't need such convention. This convention is helpful when 46 * you don't need such convention. This convention is helpful when
47 * notifier can distinguish but notifiee cannot. 47 * notifier can distinguish but notifiee cannot.
48 */ 48 */
@@ -76,7 +76,7 @@ struct extcon_cable;
76 * struct extcon_dev - An extcon device represents one external connector. 76 * struct extcon_dev - An extcon device represents one external connector.
77 * @name The name of this extcon device. Parent device name is used 77 * @name The name of this extcon device. Parent device name is used
78 * if NULL. 78 * if NULL.
79 * @supported_cable Array of supported cable name ending with NULL. 79 * @supported_cable Array of supported cable names ending with NULL.
80 * If supported_cable is NULL, cable name related APIs 80 * If supported_cable is NULL, cable name related APIs
81 * are disabled. 81 * are disabled.
82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot 82 * @mutually_exclusive Array of mutually exclusive set of cables that cannot
@@ -95,7 +95,7 @@ struct extcon_cable;
95 * @state Attach/detach state of this extcon. Do not provide at 95 * @state Attach/detach state of this extcon. Do not provide at
96 * register-time 96 * register-time
97 * @nh Notifier for the state change events from this extcon 97 * @nh Notifier for the state change events from this extcon
98 * @entry To support list of extcon devices so that uses can search 98 * @entry To support list of extcon devices so that users can search
99 * for extcon devices based on the extcon name. 99 * for extcon devices based on the extcon name.
100 * @lock 100 * @lock
101 * @max_supported Internal value to store the number of cables. 101 * @max_supported Internal value to store the number of cables.
@@ -199,7 +199,7 @@ extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state);
199/* 199/*
200 * get/set_cable_state access each bit of the 32b encoded state value. 200 * get/set_cable_state access each bit of the 32b encoded state value.
201 * They are used to access the status of each cable based on the cable_name 201 * They are used to access the status of each cable based on the cable_name
202 * or cable_index, which is retrived by extcon_find_cable_index 202 * or cable_index, which is retrieved by extcon_find_cable_index
203 */ 203 */
204extern int extcon_find_cable_index(struct extcon_dev *sdev, 204extern int extcon_find_cable_index(struct extcon_dev *sdev,
205 const char *cable_name); 205 const char *cable_name);
@@ -226,9 +226,9 @@ extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
226 226
227/* 227/*
228 * Following APIs are to monitor every action of a notifier. 228 * Following APIs are to monitor every action of a notifier.
229 * Registerer gets notified for every external port of a connection device. 229 * Registrar gets notified for every external port of a connection device.
230 * Probably this could be used to debug an action of notifier; however, 230 * Probably this could be used to debug an action of notifier; however,
231 * we do not recommend to use this at normal 'notifiee' device drivers who 231 * we do not recommend to use this for normal 'notifiee' device drivers who
232 * want to be notified by a specific external port of the notifier. 232 * want to be notified by a specific external port of the notifier.
233 */ 233 */
234extern int extcon_register_notifier(struct extcon_dev *edev, 234extern int extcon_register_notifier(struct extcon_dev *edev,
diff --git a/include/linux/extcon/extcon-adc-jack.h b/include/linux/extcon/extcon-adc-jack.h
new file mode 100644
index 000000000000..20e9eef25d4c
--- /dev/null
+++ b/include/linux/extcon/extcon-adc-jack.h
@@ -0,0 +1,71 @@
1/*
2 * include/linux/extcon/extcon-adc-jack.h
3 *
4 * Analog Jack extcon driver with ADC-based detection capability.
5 *
6 * Copyright (C) 2012 Samsung Electronics
7 * MyungJoo Ham <myungjoo.ham@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 version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#ifndef _EXTCON_ADC_JACK_H_
16#define _EXTCON_ADC_JACK_H_ __FILE__
17
18#include <linux/module.h>
19#include <linux/extcon.h>
20
21/**
22 * struct adc_jack_cond - condition to use an extcon state
23 * @state - the corresponding extcon state (if 0, this struct denotes
24 * the last adc_jack_cond element among the array)
25 * @min_adc - min adc value for this condition
26 * @max_adc - max adc value for this condition
27 *
28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means
29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and
30 * 1 are attached (1<<0 | 1<<1 == 0x3)
31 *
32 * Note that you don't need to describe condition for "no cable attached"
33 * because when no adc_jack_cond is met, state = 0 is automatically chosen.
34 */
35struct adc_jack_cond {
36 u32 state; /* extcon state value. 0 if invalid */
37 u32 min_adc;
38 u32 max_adc;
39};
40
41/**
42 * struct adc_jack_pdata - platform data for adc jack device.
43 * @name - name of the extcon device. If null, "adc-jack" is used.
44 * @consumer_channel - Unique name to identify the channel on the consumer
45 * side. This typically describes the channels used within
46 * the consumer. E.g. 'battery_voltage'
47 * @cable_names - array of cable names ending with null.
48 * @adc_contitions - array of struct adc_jack_cond conditions ending
49 * with .state = 0 entry. This describes how to decode
50 * adc values into extcon state.
51 * @irq_flags - irq flags used for the @irq
52 * @handling_delay_ms - in some devices, we need to read ADC value some
53 * milli-seconds after the interrupt occurs. You may
54 * describe such delays with @handling_delay_ms, which
55 * is rounded-off by jiffies.
56 */
57struct adc_jack_pdata {
58 const char *name;
59 const char *consumer_channel;
60 /*
61 * The last entry should be NULL
62 */
63 const char **cable_names;
64 /* The last entry's state should be 0 */
65 struct adc_jack_cond *adc_conditions;
66
67 unsigned long irq_flags;
68 unsigned long handling_delay_ms; /* in ms */
69};
70
71#endif /* _EXTCON_ADC_JACK_H */
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index 73e0b628e058..d39b824a780c 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -3,6 +3,7 @@
3 3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ 4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
5#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ 5#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
6#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */
6 7
7#ifdef __KERNEL__ 8#ifdef __KERNEL__
8 9
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 158a41eed314..45052aa814c8 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -30,31 +30,11 @@ struct fdtable {
30 struct fdtable *next; 30 struct fdtable *next;
31}; 31};
32 32
33static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
34{
35 __set_bit(fd, fdt->close_on_exec);
36}
37
38static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
39{
40 __clear_bit(fd, fdt->close_on_exec);
41}
42
43static inline bool close_on_exec(int fd, const struct fdtable *fdt) 33static inline bool close_on_exec(int fd, const struct fdtable *fdt)
44{ 34{
45 return test_bit(fd, fdt->close_on_exec); 35 return test_bit(fd, fdt->close_on_exec);
46} 36}
47 37
48static inline void __set_open_fd(int fd, struct fdtable *fdt)
49{
50 __set_bit(fd, fdt->open_fds);
51}
52
53static inline void __clear_open_fd(int fd, struct fdtable *fdt)
54{
55 __clear_bit(fd, fdt->open_fds);
56}
57
58static inline bool fd_is_open(int fd, const struct fdtable *fdt) 38static inline bool fd_is_open(int fd, const struct fdtable *fdt)
59{ 39{
60 return test_bit(fd, fdt->open_fds); 40 return test_bit(fd, fdt->open_fds);
@@ -93,15 +73,8 @@ struct file_operations;
93struct vfsmount; 73struct vfsmount;
94struct dentry; 74struct dentry;
95 75
96extern int expand_files(struct files_struct *, int nr);
97extern void free_fdtable_rcu(struct rcu_head *rcu);
98extern void __init files_defer_init(void); 76extern void __init files_defer_init(void);
99 77
100static inline void free_fdtable(struct fdtable *fdt)
101{
102 call_rcu(&fdt->rcu, free_fdtable_rcu);
103}
104
105static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd) 78static inline struct file * fcheck_files(struct files_struct *files, unsigned int fd)
106{ 79{
107 struct file * file = NULL; 80 struct file * file = NULL;
@@ -122,8 +95,20 @@ struct task_struct;
122struct files_struct *get_files_struct(struct task_struct *); 95struct files_struct *get_files_struct(struct task_struct *);
123void put_files_struct(struct files_struct *fs); 96void put_files_struct(struct files_struct *fs);
124void reset_files_struct(struct files_struct *); 97void reset_files_struct(struct files_struct *);
98void daemonize_descriptors(void);
125int unshare_files(struct files_struct **); 99int unshare_files(struct files_struct **);
126struct files_struct *dup_fd(struct files_struct *, int *); 100struct files_struct *dup_fd(struct files_struct *, int *);
101void do_close_on_exec(struct files_struct *);
102int iterate_fd(struct files_struct *, unsigned,
103 int (*)(const void *, struct file *, unsigned),
104 const void *);
105
106extern int __alloc_fd(struct files_struct *files,
107 unsigned start, unsigned end, unsigned flags);
108extern void __fd_install(struct files_struct *files,
109 unsigned int fd, struct file *file);
110extern int __close_fd(struct files_struct *files,
111 unsigned int fd);
127 112
128extern struct kmem_cache *files_cachep; 113extern struct kmem_cache *files_cachep;
129 114
diff --git a/include/linux/file.h b/include/linux/file.h
index a22408bac0d0..cbacf4faf447 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -26,15 +26,44 @@ static inline void fput_light(struct file *file, int fput_needed)
26 fput(file); 26 fput(file);
27} 27}
28 28
29struct fd {
30 struct file *file;
31 int need_put;
32};
33
34static inline void fdput(struct fd fd)
35{
36 if (fd.need_put)
37 fput(fd.file);
38}
39
29extern struct file *fget(unsigned int fd); 40extern struct file *fget(unsigned int fd);
30extern struct file *fget_light(unsigned int fd, int *fput_needed); 41extern struct file *fget_light(unsigned int fd, int *fput_needed);
42
43static inline struct fd fdget(unsigned int fd)
44{
45 int b;
46 struct file *f = fget_light(fd, &b);
47 return (struct fd){f,b};
48}
49
31extern struct file *fget_raw(unsigned int fd); 50extern struct file *fget_raw(unsigned int fd);
32extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); 51extern struct file *fget_raw_light(unsigned int fd, int *fput_needed);
52
53static inline struct fd fdget_raw(unsigned int fd)
54{
55 int b;
56 struct file *f = fget_raw_light(fd, &b);
57 return (struct fd){f,b};
58}
59
60extern int f_dupfd(unsigned int from, struct file *file, unsigned flags);
61extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
33extern void set_close_on_exec(unsigned int fd, int flag); 62extern void set_close_on_exec(unsigned int fd, int flag);
63extern bool get_close_on_exec(unsigned int fd);
34extern void put_filp(struct file *); 64extern void put_filp(struct file *);
35extern int alloc_fd(unsigned start, unsigned flags); 65extern int get_unused_fd_flags(unsigned flags);
36extern int get_unused_fd(void); 66#define get_unused_fd() get_unused_fd_flags(0)
37#define get_unused_fd_flags(flags) alloc_fd(0, (flags))
38extern void put_unused_fd(unsigned int fd); 67extern void put_unused_fd(unsigned int fd);
39 68
40extern void fd_install(unsigned int fd, struct file *file); 69extern void fd_install(unsigned int fd, struct file *file);
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 82b01357af8b..2ded090e10f4 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -74,6 +74,9 @@ struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
74#define BPF_LSH 0x60 74#define BPF_LSH 0x60
75#define BPF_RSH 0x70 75#define BPF_RSH 0x70
76#define BPF_NEG 0x80 76#define BPF_NEG 0x80
77#define BPF_MOD 0x90
78#define BPF_XOR 0xa0
79
77#define BPF_JA 0x00 80#define BPF_JA 0x00
78#define BPF_JEQ 0x10 81#define BPF_JEQ 0x10
79#define BPF_JGT 0x20 82#define BPF_JGT 0x20
@@ -196,10 +199,14 @@ enum {
196 BPF_S_ALU_MUL_K, 199 BPF_S_ALU_MUL_K,
197 BPF_S_ALU_MUL_X, 200 BPF_S_ALU_MUL_X,
198 BPF_S_ALU_DIV_X, 201 BPF_S_ALU_DIV_X,
202 BPF_S_ALU_MOD_K,
203 BPF_S_ALU_MOD_X,
199 BPF_S_ALU_AND_K, 204 BPF_S_ALU_AND_K,
200 BPF_S_ALU_AND_X, 205 BPF_S_ALU_AND_X,
201 BPF_S_ALU_OR_K, 206 BPF_S_ALU_OR_K,
202 BPF_S_ALU_OR_X, 207 BPF_S_ALU_OR_X,
208 BPF_S_ALU_XOR_K,
209 BPF_S_ALU_XOR_X,
203 BPF_S_ALU_LSH_K, 210 BPF_S_ALU_LSH_K,
204 BPF_S_ALU_LSH_X, 211 BPF_S_ALU_LSH_X,
205 BPF_S_ALU_RSH_K, 212 BPF_S_ALU_RSH_K,
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
index db04ec5121cb..191501afd7fb 100644
--- a/include/linux/firewire.h
+++ b/include/linux/firewire.h
@@ -265,8 +265,16 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
265 void *data, size_t length, 265 void *data, size_t length,
266 void *callback_data); 266 void *callback_data);
267/* 267/*
268 * Important note: Except for the FCP registers, the callback must guarantee 268 * This callback handles an inbound request subaction. It is called in
269 * that either fw_send_response() or kfree() is called on the @request. 269 * RCU read-side context, therefore must not sleep.
270 *
271 * The callback should not initiate outbound request subactions directly.
272 * Otherwise there is a danger of recursion of inbound and outbound
273 * transactions from and to the local node.
274 *
275 * The callback is responsible that either fw_send_response() or kfree()
276 * is called on the @request, except for FCP registers for which the core
277 * takes care of that.
270 */ 278 */
271typedef void (*fw_address_callback_t)(struct fw_card *card, 279typedef void (*fw_address_callback_t)(struct fw_card *card,
272 struct fw_request *request, 280 struct fw_request *request,
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 1e7c01189fa6..e4279fedb93a 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -12,6 +12,9 @@ struct firmware {
12 size_t size; 12 size_t size;
13 const u8 *data; 13 const u8 *data;
14 struct page **pages; 14 struct page **pages;
15
16 /* firmware loader private fields */
17 void *priv;
15}; 18};
16 19
17struct module; 20struct module;
@@ -44,6 +47,8 @@ int request_firmware_nowait(
44 void (*cont)(const struct firmware *fw, void *context)); 47 void (*cont)(const struct firmware *fw, void *context));
45 48
46void release_firmware(const struct firmware *fw); 49void release_firmware(const struct firmware *fw);
50int cache_firmware(const char *name);
51int uncache_firmware(const char *name);
47#else 52#else
48static inline int request_firmware(const struct firmware **fw, 53static inline int request_firmware(const struct firmware **fw,
49 const char *name, 54 const char *name,
@@ -62,6 +67,16 @@ static inline int request_firmware_nowait(
62static inline void release_firmware(const struct firmware *fw) 67static inline void release_firmware(const struct firmware *fw)
63{ 68{
64} 69}
70
71static inline int cache_firmware(const char *name)
72{
73 return -ENOENT;
74}
75
76static inline int uncache_firmware(const char *name)
77{
78 return -EINVAL;
79}
65#endif 80#endif
66 81
67#endif 82#endif
diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h
index 0e4e2eec5c1d..30442547b9e6 100644
--- a/include/linux/frontswap.h
+++ b/include/linux/frontswap.h
@@ -19,6 +19,8 @@ extern struct frontswap_ops
19extern void frontswap_shrink(unsigned long); 19extern void frontswap_shrink(unsigned long);
20extern unsigned long frontswap_curr_pages(void); 20extern unsigned long frontswap_curr_pages(void);
21extern void frontswap_writethrough(bool); 21extern void frontswap_writethrough(bool);
22#define FRONTSWAP_HAS_EXCLUSIVE_GETS
23extern void frontswap_tmem_exclusive_gets(bool);
22 24
23extern void __frontswap_init(unsigned type); 25extern void __frontswap_init(unsigned type);
24extern int __frontswap_store(struct page *page); 26extern int __frontswap_store(struct page *page);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aa110476a95b..c617ed024df8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -401,7 +401,7 @@ struct inodes_stat_t {
401#include <linux/cache.h> 401#include <linux/cache.h>
402#include <linux/list.h> 402#include <linux/list.h>
403#include <linux/radix-tree.h> 403#include <linux/radix-tree.h>
404#include <linux/prio_tree.h> 404#include <linux/rbtree.h>
405#include <linux/init.h> 405#include <linux/init.h>
406#include <linux/pid.h> 406#include <linux/pid.h>
407#include <linux/bug.h> 407#include <linux/bug.h>
@@ -669,7 +669,7 @@ struct address_space {
669 struct radix_tree_root page_tree; /* radix tree of all pages */ 669 struct radix_tree_root page_tree; /* radix tree of all pages */
670 spinlock_t tree_lock; /* and lock protecting it */ 670 spinlock_t tree_lock; /* and lock protecting it */
671 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 671 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
672 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 672 struct rb_root i_mmap; /* tree of private and shared mappings */
673 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 673 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
674 struct mutex i_mmap_mutex; /* protect tree, count, list */ 674 struct mutex i_mmap_mutex; /* protect tree, count, list */
675 /* Protected by tree_lock together with the radix tree */ 675 /* Protected by tree_lock together with the radix tree */
@@ -741,7 +741,7 @@ int mapping_tagged(struct address_space *mapping, int tag);
741 */ 741 */
742static inline int mapping_mapped(struct address_space *mapping) 742static inline int mapping_mapped(struct address_space *mapping)
743{ 743{
744 return !prio_tree_empty(&mapping->i_mmap) || 744 return !RB_EMPTY_ROOT(&mapping->i_mmap) ||
745 !list_empty(&mapping->i_mmap_nonlinear); 745 !list_empty(&mapping->i_mmap_nonlinear);
746} 746}
747 747
@@ -1074,7 +1074,11 @@ struct file_handle {
1074 unsigned char f_handle[0]; 1074 unsigned char f_handle[0];
1075}; 1075};
1076 1076
1077#define get_file(x) atomic_long_inc(&(x)->f_count) 1077static inline struct file *get_file(struct file *f)
1078{
1079 atomic_long_inc(&f->f_count);
1080 return f;
1081}
1078#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 1082#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
1079#define file_count(x) atomic_long_read(&(x)->f_count) 1083#define file_count(x) atomic_long_read(&(x)->f_count)
1080 1084
@@ -1126,9 +1130,9 @@ static inline int file_check_writeable(struct file *filp)
1126/* Page cache limit. The filesystems should put that into their s_maxbytes 1130/* Page cache limit. The filesystems should put that into their s_maxbytes
1127 limits, otherwise bad things can happen in VM. */ 1131 limits, otherwise bad things can happen in VM. */
1128#if BITS_PER_LONG==32 1132#if BITS_PER_LONG==32
1129#define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 1133#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
1130#elif BITS_PER_LONG==64 1134#elif BITS_PER_LONG==64
1131#define MAX_LFS_FILESIZE 0x7fffffffffffffffUL 1135#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffff)
1132#endif 1136#endif
1133 1137
1134#define FL_POSIX 1 1138#define FL_POSIX 1
@@ -2548,6 +2552,8 @@ extern int sb_min_blocksize(struct super_block *, int);
2548 2552
2549extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2553extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2550extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2554extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2555extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2556 unsigned long size, pgoff_t pgoff);
2551extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 2557extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2552int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2558int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2553extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2559extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 15be561e7397..a82296af413f 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -19,9 +19,11 @@
19 19
20#define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI 20#define FSL_UTMI_PHY_DLY 10 /*As per P1010RM, delay for UTMI
21 PHY CLK to become stable - 10ms*/ 21 PHY CLK to become stable - 10ms*/
22#define FSL_USB_PHY_CLK_TIMEOUT 10000 /* uSec */
22#define FSL_USB_VER_OLD 0 23#define FSL_USB_VER_OLD 0
23#define FSL_USB_VER_1_6 1 24#define FSL_USB_VER_1_6 1
24#define FSL_USB_VER_2_2 2 25#define FSL_USB_VER_2_2 2
26#define FSL_USB_VER_2_4 3
25 27
26#include <linux/types.h> 28#include <linux/types.h>
27 29
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 55e6d63d46d0..a52f2f4fe030 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -10,6 +10,7 @@
10#include <linux/kallsyms.h> 10#include <linux/kallsyms.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/ptrace.h>
13#include <linux/ktime.h> 14#include <linux/ktime.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/types.h> 16#include <linux/types.h>
@@ -18,6 +19,28 @@
18 19
19#include <asm/ftrace.h> 20#include <asm/ftrace.h>
20 21
22/*
23 * If the arch supports passing the variable contents of
24 * function_trace_op as the third parameter back from the
25 * mcount call, then the arch should define this as 1.
26 */
27#ifndef ARCH_SUPPORTS_FTRACE_OPS
28#define ARCH_SUPPORTS_FTRACE_OPS 0
29#endif
30
31/*
32 * If the arch's mcount caller does not support all of ftrace's
33 * features, then it must call an indirect function that
34 * does. Or at least does enough to prevent any unwelcomed side effects.
35 */
36#if !defined(CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST) || \
37 !ARCH_SUPPORTS_FTRACE_OPS
38# define FTRACE_FORCE_LIST_FUNC 1
39#else
40# define FTRACE_FORCE_LIST_FUNC 0
41#endif
42
43
21struct module; 44struct module;
22struct ftrace_hash; 45struct ftrace_hash;
23 46
@@ -29,7 +52,10 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
29 void __user *buffer, size_t *lenp, 52 void __user *buffer, size_t *lenp,
30 loff_t *ppos); 53 loff_t *ppos);
31 54
32typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip); 55struct ftrace_ops;
56
57typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
58 struct ftrace_ops *op, struct pt_regs *regs);
33 59
34/* 60/*
35 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are 61 * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
@@ -45,12 +71,33 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
45 * could be controled by following calls: 71 * could be controled by following calls:
46 * ftrace_function_local_enable 72 * ftrace_function_local_enable
47 * ftrace_function_local_disable 73 * ftrace_function_local_disable
74 * SAVE_REGS - The ftrace_ops wants regs saved at each function called
75 * and passed to the callback. If this flag is set, but the
76 * architecture does not support passing regs
77 * (ARCH_SUPPORTS_FTRACE_SAVE_REGS is not defined), then the
78 * ftrace_ops will fail to register, unless the next flag
79 * is set.
80 * SAVE_REGS_IF_SUPPORTED - This is the same as SAVE_REGS, but if the
81 * handler can handle an arch that does not save regs
82 * (the handler tests if regs == NULL), then it can set
83 * this flag instead. It will not fail registering the ftrace_ops
84 * but, the regs field will be NULL if the arch does not support
85 * passing regs to the handler.
86 * Note, if this flag is set, the SAVE_REGS flag will automatically
87 * get set upon registering the ftrace_ops, if the arch supports it.
88 * RECURSION_SAFE - The ftrace_ops can set this to tell the ftrace infrastructure
89 * that the call back has its own recursion protection. If it does
90 * not set this, then the ftrace infrastructure will add recursion
91 * protection for the caller.
48 */ 92 */
49enum { 93enum {
50 FTRACE_OPS_FL_ENABLED = 1 << 0, 94 FTRACE_OPS_FL_ENABLED = 1 << 0,
51 FTRACE_OPS_FL_GLOBAL = 1 << 1, 95 FTRACE_OPS_FL_GLOBAL = 1 << 1,
52 FTRACE_OPS_FL_DYNAMIC = 1 << 2, 96 FTRACE_OPS_FL_DYNAMIC = 1 << 2,
53 FTRACE_OPS_FL_CONTROL = 1 << 3, 97 FTRACE_OPS_FL_CONTROL = 1 << 3,
98 FTRACE_OPS_FL_SAVE_REGS = 1 << 4,
99 FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 1 << 5,
100 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6,
54}; 101};
55 102
56struct ftrace_ops { 103struct ftrace_ops {
@@ -163,7 +210,8 @@ static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
163 return *this_cpu_ptr(ops->disabled); 210 return *this_cpu_ptr(ops->disabled);
164} 211}
165 212
166extern void ftrace_stub(unsigned long a0, unsigned long a1); 213extern void ftrace_stub(unsigned long a0, unsigned long a1,
214 struct ftrace_ops *op, struct pt_regs *regs);
167 215
168#else /* !CONFIG_FUNCTION_TRACER */ 216#else /* !CONFIG_FUNCTION_TRACER */
169/* 217/*
@@ -172,6 +220,10 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1);
172 */ 220 */
173#define register_ftrace_function(ops) ({ 0; }) 221#define register_ftrace_function(ops) ({ 0; })
174#define unregister_ftrace_function(ops) ({ 0; }) 222#define unregister_ftrace_function(ops) ({ 0; })
223static inline int ftrace_nr_registered_ops(void)
224{
225 return 0;
226}
175static inline void clear_ftrace_function(void) { } 227static inline void clear_ftrace_function(void) { }
176static inline void ftrace_kill(void) { } 228static inline void ftrace_kill(void) { }
177static inline void ftrace_stop(void) { } 229static inline void ftrace_stop(void) { }
@@ -227,12 +279,33 @@ extern void unregister_ftrace_function_probe_all(char *glob);
227 279
228extern int ftrace_text_reserved(void *start, void *end); 280extern int ftrace_text_reserved(void *start, void *end);
229 281
282extern int ftrace_nr_registered_ops(void);
283
284/*
285 * The dyn_ftrace record's flags field is split into two parts.
286 * the first part which is '0-FTRACE_REF_MAX' is a counter of
287 * the number of callbacks that have registered the function that
288 * the dyn_ftrace descriptor represents.
289 *
290 * The second part is a mask:
291 * ENABLED - the function is being traced
292 * REGS - the record wants the function to save regs
293 * REGS_EN - the function is set up to save regs.
294 *
295 * When a new ftrace_ops is registered and wants a function to save
296 * pt_regs, the rec->flag REGS is set. When the function has been
297 * set up to save regs, the REG_EN flag is set. Once a function
298 * starts saving regs it will do so until all ftrace_ops are removed
299 * from tracing that function.
300 */
230enum { 301enum {
231 FTRACE_FL_ENABLED = (1 << 30), 302 FTRACE_FL_ENABLED = (1UL << 29),
303 FTRACE_FL_REGS = (1UL << 30),
304 FTRACE_FL_REGS_EN = (1UL << 31)
232}; 305};
233 306
234#define FTRACE_FL_MASK (0x3UL << 30) 307#define FTRACE_FL_MASK (0x7UL << 29)
235#define FTRACE_REF_MAX ((1 << 30) - 1) 308#define FTRACE_REF_MAX ((1UL << 29) - 1)
236 309
237struct dyn_ftrace { 310struct dyn_ftrace {
238 union { 311 union {
@@ -244,6 +317,8 @@ struct dyn_ftrace {
244}; 317};
245 318
246int ftrace_force_update(void); 319int ftrace_force_update(void);
320int ftrace_set_filter_ip(struct ftrace_ops *ops, unsigned long ip,
321 int remove, int reset);
247int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, 322int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
248 int len, int reset); 323 int len, int reset);
249int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, 324int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
@@ -263,9 +338,23 @@ enum {
263 FTRACE_STOP_FUNC_RET = (1 << 4), 338 FTRACE_STOP_FUNC_RET = (1 << 4),
264}; 339};
265 340
341/*
342 * The FTRACE_UPDATE_* enum is used to pass information back
343 * from the ftrace_update_record() and ftrace_test_record()
344 * functions. These are called by the code update routines
345 * to find out what is to be done for a given function.
346 *
347 * IGNORE - The function is already what we want it to be
348 * MAKE_CALL - Start tracing the function
349 * MODIFY_CALL - Stop saving regs for the function
350 * MODIFY_CALL_REGS - Start saving regs for the function
351 * MAKE_NOP - Stop tracing the function
352 */
266enum { 353enum {
267 FTRACE_UPDATE_IGNORE, 354 FTRACE_UPDATE_IGNORE,
268 FTRACE_UPDATE_MAKE_CALL, 355 FTRACE_UPDATE_MAKE_CALL,
356 FTRACE_UPDATE_MODIFY_CALL,
357 FTRACE_UPDATE_MODIFY_CALL_REGS,
269 FTRACE_UPDATE_MAKE_NOP, 358 FTRACE_UPDATE_MAKE_NOP,
270}; 359};
271 360
@@ -317,7 +406,9 @@ extern int ftrace_dyn_arch_init(void *data);
317extern void ftrace_replace_code(int enable); 406extern void ftrace_replace_code(int enable);
318extern int ftrace_update_ftrace_func(ftrace_func_t func); 407extern int ftrace_update_ftrace_func(ftrace_func_t func);
319extern void ftrace_caller(void); 408extern void ftrace_caller(void);
409extern void ftrace_regs_caller(void);
320extern void ftrace_call(void); 410extern void ftrace_call(void);
411extern void ftrace_regs_call(void);
321extern void mcount_call(void); 412extern void mcount_call(void);
322 413
323void ftrace_modify_all_code(int command); 414void ftrace_modify_all_code(int command);
@@ -325,6 +416,15 @@ void ftrace_modify_all_code(int command);
325#ifndef FTRACE_ADDR 416#ifndef FTRACE_ADDR
326#define FTRACE_ADDR ((unsigned long)ftrace_caller) 417#define FTRACE_ADDR ((unsigned long)ftrace_caller)
327#endif 418#endif
419
420#ifndef FTRACE_REGS_ADDR
421#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
422# define FTRACE_REGS_ADDR ((unsigned long)ftrace_regs_caller)
423#else
424# define FTRACE_REGS_ADDR FTRACE_ADDR
425#endif
426#endif
427
328#ifdef CONFIG_FUNCTION_GRAPH_TRACER 428#ifdef CONFIG_FUNCTION_GRAPH_TRACER
329extern void ftrace_graph_caller(void); 429extern void ftrace_graph_caller(void);
330extern int ftrace_enable_ftrace_graph_caller(void); 430extern int ftrace_enable_ftrace_graph_caller(void);
@@ -380,6 +480,39 @@ extern int ftrace_make_nop(struct module *mod,
380 */ 480 */
381extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr); 481extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
382 482
483#ifdef ARCH_SUPPORTS_FTRACE_SAVE_REGS
484/**
485 * ftrace_modify_call - convert from one addr to another (no nop)
486 * @rec: the mcount call site record
487 * @old_addr: the address expected to be currently called to
488 * @addr: the address to change to
489 *
490 * This is a very sensitive operation and great care needs
491 * to be taken by the arch. The operation should carefully
492 * read the location, check to see if what is read is indeed
493 * what we expect it to be, and then on success of the compare,
494 * it should write to the location.
495 *
496 * The code segment at @rec->ip should be a caller to @old_addr
497 *
498 * Return must be:
499 * 0 on success
500 * -EFAULT on error reading the location
501 * -EINVAL on a failed compare of the contents
502 * -EPERM on error writing to the location
503 * Any other value will be considered a failure.
504 */
505extern int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
506 unsigned long addr);
507#else
508/* Should never be called */
509static inline int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
510 unsigned long addr)
511{
512 return -EINVAL;
513}
514#endif
515
383/* May be defined in arch */ 516/* May be defined in arch */
384extern int ftrace_arch_read_dyn_info(char *buf, int size); 517extern int ftrace_arch_read_dyn_info(char *buf, int size);
385 518
@@ -387,7 +520,7 @@ extern int skip_trace(unsigned long ip);
387 520
388extern void ftrace_disable_daemon(void); 521extern void ftrace_disable_daemon(void);
389extern void ftrace_enable_daemon(void); 522extern void ftrace_enable_daemon(void);
390#else 523#else /* CONFIG_DYNAMIC_FTRACE */
391static inline int skip_trace(unsigned long ip) { return 0; } 524static inline int skip_trace(unsigned long ip) { return 0; }
392static inline int ftrace_force_update(void) { return 0; } 525static inline int ftrace_force_update(void) { return 0; }
393static inline void ftrace_disable_daemon(void) { } 526static inline void ftrace_disable_daemon(void) { }
@@ -405,6 +538,10 @@ static inline int ftrace_text_reserved(void *start, void *end)
405{ 538{
406 return 0; 539 return 0;
407} 540}
541static inline unsigned long ftrace_location(unsigned long ip)
542{
543 return 0;
544}
408 545
409/* 546/*
410 * Again users of functions that have ftrace_ops may not 547 * Again users of functions that have ftrace_ops may not
@@ -413,6 +550,7 @@ static inline int ftrace_text_reserved(void *start, void *end)
413 */ 550 */
414#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; }) 551#define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
415#define ftrace_set_early_filter(ops, buf, enable) do { } while (0) 552#define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
553#define ftrace_set_filter_ip(ops, ip, remove, reset) ({ -ENODEV; })
416#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; }) 554#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
417#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; }) 555#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
418#define ftrace_free_filter(ops) do { } while (0) 556#define ftrace_free_filter(ops) do { } while (0)
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 5e98eeb2af3b..dd7c569aacad 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -29,6 +29,20 @@
29 29
30#ifndef __GENALLOC_H__ 30#ifndef __GENALLOC_H__
31#define __GENALLOC_H__ 31#define __GENALLOC_H__
32/**
33 * Allocation callback function type definition
34 * @map: Pointer to bitmap
35 * @size: The bitmap size in bits
36 * @start: The bitnumber to start searching at
37 * @nr: The number of zeroed bits we're looking for
38 * @data: optional additional data used by @genpool_algo_t
39 */
40typedef unsigned long (*genpool_algo_t)(unsigned long *map,
41 unsigned long size,
42 unsigned long start,
43 unsigned int nr,
44 void *data);
45
32/* 46/*
33 * General purpose special memory pool descriptor. 47 * General purpose special memory pool descriptor.
34 */ 48 */
@@ -36,6 +50,9 @@ struct gen_pool {
36 spinlock_t lock; 50 spinlock_t lock;
37 struct list_head chunks; /* list of chunks in this pool */ 51 struct list_head chunks; /* list of chunks in this pool */
38 int min_alloc_order; /* minimum allocation order */ 52 int min_alloc_order; /* minimum allocation order */
53
54 genpool_algo_t algo; /* allocation function */
55 void *data;
39}; 56};
40 57
41/* 58/*
@@ -78,4 +95,14 @@ extern void gen_pool_for_each_chunk(struct gen_pool *,
78 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); 95 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *);
79extern size_t gen_pool_avail(struct gen_pool *); 96extern size_t gen_pool_avail(struct gen_pool *);
80extern size_t gen_pool_size(struct gen_pool *); 97extern size_t gen_pool_size(struct gen_pool *);
98
99extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
100 void *data);
101
102extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
103 unsigned long start, unsigned int nr, void *data);
104
105extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
106 unsigned long start, unsigned int nr, void *data);
107
81#endif /* __GENALLOC_H__ */ 108#endif /* __GENALLOC_H__ */
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
deleted file mode 100644
index 79b3eb37243a..000000000000
--- a/include/linux/generic_serial.h
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * generic_serial.h
3 *
4 * Copyright (C) 1998 R.E.Wolff@BitWizard.nl
5 *
6 * written for the SX serial driver.
7 *
8 * Version 0.1 -- December, 1998.
9 */
10
11#ifndef GENERIC_SERIAL_H
12#define GENERIC_SERIAL_H
13
14#warning Use of this header is deprecated.
15#warning Since nobody sets the constants defined here for you, you should not, in any case, use them. Including the header is thus pointless.
16
17/* Flags */
18/* Warning: serial.h defines some ASYNC_ flags, they say they are "only"
19 used in serial.c, but they are also used in all other serial drivers.
20 Make sure they don't clash with these here... */
21#define GS_TX_INTEN 0x00800000
22#define GS_RX_INTEN 0x00400000
23#define GS_ACTIVE 0x00200000
24
25#define GS_TYPE_NORMAL 1
26
27#define GS_DEBUG_FLUSH 0x00000001
28#define GS_DEBUG_BTR 0x00000002
29#define GS_DEBUG_TERMIOS 0x00000004
30#define GS_DEBUG_STUFF 0x00000008
31#define GS_DEBUG_CLOSE 0x00000010
32#define GS_DEBUG_FLOW 0x00000020
33#define GS_DEBUG_WRITE 0x00000040
34
35#endif
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4883f393f50a..02c1c9710be0 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -30,12 +30,7 @@ struct vm_area_struct;
30#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
31#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
32#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
33#ifdef CONFIG_KMEMCHECK
34#define ___GFP_NOTRACK 0x200000u 33#define ___GFP_NOTRACK 0x200000u
35#else
36#define ___GFP_NOTRACK 0
37#endif
38#define ___GFP_NO_KSWAPD 0x400000u
39#define ___GFP_OTHER_NODE 0x800000u 34#define ___GFP_OTHER_NODE 0x800000u
40#define ___GFP_WRITE 0x1000000u 35#define ___GFP_WRITE 0x1000000u
41 36
@@ -90,7 +85,6 @@ struct vm_area_struct;
90#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 85#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
91#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 86#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
92 87
93#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
94#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
95#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
96 90
@@ -120,8 +114,7 @@ struct vm_area_struct;
120 __GFP_MOVABLE) 114 __GFP_MOVABLE)
121#define GFP_IOFS (__GFP_IO | __GFP_FS) 115#define GFP_IOFS (__GFP_IO | __GFP_FS)
122#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 116#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
123 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN)
124 __GFP_NO_KSWAPD)
125 118
126#ifdef CONFIG_NUMA 119#ifdef CONFIG_NUMA
127#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 120#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 305f23cd7cff..cab3da3d0949 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -132,11 +132,11 @@ extern void synchronize_irq(unsigned int irq);
132struct task_struct; 132struct task_struct;
133 133
134#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING) 134#if !defined(CONFIG_VIRT_CPU_ACCOUNTING) && !defined(CONFIG_IRQ_TIME_ACCOUNTING)
135static inline void account_system_vtime(struct task_struct *tsk) 135static inline void vtime_account(struct task_struct *tsk)
136{ 136{
137} 137}
138#else 138#else
139extern void account_system_vtime(struct task_struct *tsk); 139extern void vtime_account(struct task_struct *tsk);
140#endif 140#endif
141 141
142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 142#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
@@ -162,7 +162,7 @@ extern void rcu_nmi_exit(void);
162 */ 162 */
163#define __irq_enter() \ 163#define __irq_enter() \
164 do { \ 164 do { \
165 account_system_vtime(current); \ 165 vtime_account(current); \
166 add_preempt_count(HARDIRQ_OFFSET); \ 166 add_preempt_count(HARDIRQ_OFFSET); \
167 trace_hardirq_enter(); \ 167 trace_hardirq_enter(); \
168 } while (0) 168 } while (0)
@@ -178,7 +178,7 @@ extern void irq_enter(void);
178#define __irq_exit() \ 178#define __irq_exit() \
179 do { \ 179 do { \
180 trace_hardirq_exit(); \ 180 trace_hardirq_exit(); \
181 account_system_vtime(current); \ 181 vtime_account(current); \
182 sub_preempt_count(HARDIRQ_OFFSET); \ 182 sub_preempt_count(HARDIRQ_OFFSET); \
183 } while (0) 183 } while (0)
184 184
diff --git a/include/linux/hash.h b/include/linux/hash.h
index b80506bdd733..24df9e70406f 100644
--- a/include/linux/hash.h
+++ b/include/linux/hash.h
@@ -67,4 +67,14 @@ static inline unsigned long hash_ptr(const void *ptr, unsigned int bits)
67{ 67{
68 return hash_long((unsigned long)ptr, bits); 68 return hash_long((unsigned long)ptr, bits);
69} 69}
70
71static inline u32 hash32_ptr(const void *ptr)
72{
73 unsigned long val = (unsigned long)ptr;
74
75#if BITS_PER_LONG == 64
76 val ^= (val >> 32);
77#endif
78 return (u32)val;
79}
70#endif /* _LINUX_HASH_H */ 80#endif /* _LINUX_HASH_H */
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
new file mode 100644
index 000000000000..0aa5f4c42ae6
--- /dev/null
+++ b/include/linux/hid-sensor-hub.h
@@ -0,0 +1,160 @@
1/*
2 * HID Sensors Driver
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19#ifndef _HID_SENSORS_HUB_H
20#define _HID_SENSORS_HUB_H
21
22#include <linux/hid.h>
23#include <linux/hid-sensor-ids.h>
24
25/**
26 * struct hid_sensor_hub_attribute_info - Attribute info
27 * @usage_id: Parent usage id of a physical device.
28 * @attrib_id: Attribute id for this attribute.
29 * @report_id: Report id in which this information resides.
30 * @index: Field index in the report.
31 * @units: Measurment unit for this attribute.
32 * @unit_expo: Exponent used in the data.
33 * @size: Size in bytes for data size.
34 */
35struct hid_sensor_hub_attribute_info {
36 u32 usage_id;
37 u32 attrib_id;
38 s32 report_id;
39 s32 index;
40 s32 units;
41 s32 unit_expo;
42 s32 size;
43};
44
45/**
46 * struct hid_sensor_hub_device - Stores the hub instance data
47 * @hdev: Stores the hid instance.
48 * @vendor_id: Vendor id of hub device.
49 * @product_id: Product id of hub device.
50 */
51struct hid_sensor_hub_device {
52 struct hid_device *hdev;
53 u32 vendor_id;
54 u32 product_id;
55};
56
57/**
58 * struct hid_sensor_hub_callbacks - Client callback functions
59 * @pdev: Platform device instance of the client driver.
60 * @suspend: Suspend callback.
61 * @resume: Resume callback.
62 * @capture_sample: Callback to get a sample.
63 * @send_event: Send notification to indicate all samples are
64 * captured, process and send event
65 */
66struct hid_sensor_hub_callbacks {
67 struct platform_device *pdev;
68 int (*suspend)(struct hid_sensor_hub_device *hsdev, void *priv);
69 int (*resume)(struct hid_sensor_hub_device *hsdev, void *priv);
70 int (*capture_sample)(struct hid_sensor_hub_device *hsdev,
71 u32 usage_id, size_t raw_len, char *raw_data,
72 void *priv);
73 int (*send_event)(struct hid_sensor_hub_device *hsdev, u32 usage_id,
74 void *priv);
75};
76
77/* Registration functions */
78
79/**
80* sensor_hub_register_callback() - Register client callbacks
81* @hsdev: Hub device instance.
82* @usage_id: Usage id of the client (E.g. 0x200076 for Gyro).
83* @usage_callback: Callback function storage
84*
85* Used to register callbacks by client processing drivers. Sensor
86* hub core driver will call these callbacks to offload processing
87* of data streams and notifications.
88*/
89int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
90 u32 usage_id,
91 struct hid_sensor_hub_callbacks *usage_callback);
92
93/**
94* sensor_hub_remove_callback() - Remove client callbacks
95* @hsdev: Hub device instance.
96* @usage_id: Usage id of the client (E.g. 0x200076 for Gyro).
97*
98* If there is a callback registred, this call will remove that
99* callbacks, so that it will stop data and event notifications.
100*/
101int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev,
102 u32 usage_id);
103
104
105/* Hid sensor hub core interfaces */
106
107/**
108* sensor_hub_input_get_attribute_info() - Get an attribute information
109* @hsdev: Hub device instance.
110* @type: Type of this attribute, input/output/feature
111* @usage_id: Attribute usage id of parent physical device as per spec
112* @attr_usage_id: Attribute usage id as per spec
113* @info: return information about attribute after parsing report
114*
115* Parses report and returns the attribute information such as report id,
116* field index, units and exponet etc.
117*/
118int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
119 u8 type,
120 u32 usage_id, u32 attr_usage_id,
121 struct hid_sensor_hub_attribute_info *info);
122
123/**
124* sensor_hub_input_attr_get_raw_value() - Synchronous read request
125* @usage_id: Attribute usage id of parent physical device as per spec
126* @attr_usage_id: Attribute usage id as per spec
127* @report_id: Report id to look for
128*
129* Issues a synchronous read request for an input attribute. Returns
130* data upto 32 bits. Since client can get events, so this call should
131* not be used for data paths, this will impact performance.
132*/
133
134int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
135 u32 usage_id,
136 u32 attr_usage_id, u32 report_id);
137/**
138* sensor_hub_set_feature() - Feature set request
139* @report_id: Report id to look for
140* @field_index: Field index inside a report
141* @value: Value to set
142*
143* Used to set a field in feature report. For example this can set polling
144* interval, sensitivity, activate/deactivate state.
145*/
146int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
147 u32 field_index, s32 value);
148
149/**
150* sensor_hub_get_feature() - Feature get request
151* @report_id: Report id to look for
152* @field_index: Field index inside a report
153* @value: Place holder for return value
154*
155* Used to get a field in feature report. For example this can get polling
156* interval, sensitivity, activate/deactivate state.
157*/
158int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
159 u32 field_index, s32 *value);
160#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
new file mode 100644
index 000000000000..ca8d7e94eb3c
--- /dev/null
+++ b/include/linux/hid-sensor-ids.h
@@ -0,0 +1,112 @@
1/*
2 * HID Sensors Driver
3 * Copyright (c) 2012, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19#ifndef _HID_SENSORS_IDS_H
20#define _HID_SENSORS_IDS_H
21
22#define HID_UP_SENSOR 0x00200000
23#define HID_MAX_PHY_DEVICES 0xFF
24
25/* Accel 3D (200073) */
26#define HID_USAGE_SENSOR_ACCEL_3D 0x200073
27#define HID_USAGE_SENSOR_ACCEL_X_AXIS 0x200453
28#define HID_USAGE_SENSOR_ACCEL_Y_AXIS 0x200454
29#define HID_USAGE_SENSOR_ACCEL_Z_AXIS 0x200455
30
31/* ALS (200041) */
32#define HID_USAGE_SENSOR_ALS 0x200041
33#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
34
35/* Gyro 3D: (200076) */
36#define HID_USAGE_SENSOR_GYRO_3D 0x200076
37#define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS 0x200457
38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458
39#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459
40
41/*ORIENTATION: Compass 3D: (200083) */
42#define HID_USAGE_SENSOR_COMPASS_3D 0x200083
43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471
44#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472
45#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y 0x200473
46#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Z 0x200474
47
48#define HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH 0x200475
49#define HID_USAGE_SENSOR_ORIENT_COMP_TRUE_NORTH 0x200476
50#define HID_USAGE_SENSOR_ORIENT_MAGN_NORTH 0x200477
51#define HID_USAGE_SENSOR_ORIENT_TRUE_NORTH 0x200478
52
53#define HID_USAGE_SENSOR_ORIENT_DISTANCE 0x200479
54#define HID_USAGE_SENSOR_ORIENT_DISTANCE_X 0x20047A
55#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Y 0x20047B
56#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Z 0x20047C
57#define HID_USAGE_SENSOR_ORIENT_DISTANCE_OUT_OF_RANGE 0x20047D
58#define HID_USAGE_SENSOR_ORIENT_TILT 0x20047E
59#define HID_USAGE_SENSOR_ORIENT_TILT_X 0x20047F
60#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
61#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
62#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
63#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
64#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
65
66#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_X_AXIS 0x200485
67#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Y_AXIS 0x200486
68#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX_Z_AXIS 0x200487
69
70/* Units */
71#define HID_USAGE_SENSOR_UNITS_NOT_SPECIFIED 0x00
72#define HID_USAGE_SENSOR_UNITS_LUX 0x01
73#define HID_USAGE_SENSOR_UNITS_KELVIN 0x01000100
74#define HID_USAGE_SENSOR_UNITS_FAHRENHEIT 0x03000100
75#define HID_USAGE_SENSOR_UNITS_PASCAL 0xF1E1
76#define HID_USAGE_SENSOR_UNITS_NEWTON 0x11E1
77#define HID_USAGE_SENSOR_UNITS_METERS_PER_SECOND 0x11F0
78#define HID_USAGE_SENSOR_UNITS_METERS_PER_SEC_SQRD 0x11E0
79#define HID_USAGE_SENSOR_UNITS_FARAD 0xE14F2000
80#define HID_USAGE_SENSOR_UNITS_AMPERE 0x01001000
81#define HID_USAGE_SENSOR_UNITS_WATT 0x21d1
82#define HID_USAGE_SENSOR_UNITS_HENRY 0x21E1E000
83#define HID_USAGE_SENSOR_UNITS_OHM 0x21D1E000
84#define HID_USAGE_SENSOR_UNITS_VOLT 0x21D1F000
85#define HID_USAGE_SENSOR_UNITS_HERTZ 0x01F0
86#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SEC_SQRD 0x14E0
87#define HID_USAGE_SENSOR_UNITS_RADIANS 0x12
88#define HID_USAGE_SENSOR_UNITS_RADIANS_PER_SECOND 0x12F0
89#define HID_USAGE_SENSOR_UNITS_RADIANS_PER_SEC_SQRD 0x12E0
90#define HID_USAGE_SENSOR_UNITS_SECOND 0x0110
91#define HID_USAGE_SENSOR_UNITS_GAUSS 0x01E1F000
92#define HID_USAGE_SENSOR_UNITS_GRAM 0x0101
93#define HID_USAGE_SENSOR_UNITS_CENTIMETER 0x11
94#define HID_USAGE_SENSOR_UNITS_G 0x1A
95#define HID_USAGE_SENSOR_UNITS_MILLISECOND 0x19
96#define HID_USAGE_SENSOR_UNITS_PERCENT 0x17
97#define HID_USAGE_SENSOR_UNITS_DEGREES 0x14
98#define HID_USAGE_SENSOR_UNITS_DEGREES_PER_SECOND 0x15
99
100/* Common selectors */
101#define HID_USAGE_SENSOR_PROP_REPORT_INTERVAL 0x20030E
102#define HID_USAGE_SENSOR_PROP_SENSITIVITY_ABS 0x20030F
103#define HID_USAGE_SENSOR_PROP_SENSITIVITY_RANGE_PCT 0x200310
104#define HID_USAGE_SENSOR_PROP_SENSITIVITY_REL_PCT 0x200311
105#define HID_USAGE_SENSOR_PROP_ACCURACY 0x200312
106#define HID_USAGE_SENSOR_PROP_RESOLUTION 0x200313
107#define HID_USAGE_SENSOR_PROP_RANGE_MAXIMUM 0x200314
108#define HID_USAGE_SENSOR_PROP_RANGE_MINIMUM 0x200315
109#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
110#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
111
112#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 42970de1b40c..7e1f37db7582 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -414,7 +414,7 @@ struct hid_field {
414 __u16 dpad; /* dpad input code */ 414 __u16 dpad; /* dpad input code */
415}; 415};
416 416
417#define HID_MAX_FIELDS 128 417#define HID_MAX_FIELDS 256
418 418
419struct hid_report { 419struct hid_report {
420 struct list_head list; 420 struct list_head list;
@@ -626,6 +626,7 @@ struct hid_usage_id {
626 * @report_fixup: called before report descriptor parsing (NULL means nop) 626 * @report_fixup: called before report descriptor parsing (NULL means nop)
627 * @input_mapping: invoked on input registering before mapping an usage 627 * @input_mapping: invoked on input registering before mapping an usage
628 * @input_mapped: invoked on input registering after mapping an usage 628 * @input_mapped: invoked on input registering after mapping an usage
629 * @input_configured: invoked just before the device is registered
629 * @feature_mapping: invoked on feature registering 630 * @feature_mapping: invoked on feature registering
630 * @suspend: invoked on suspend (NULL means nop) 631 * @suspend: invoked on suspend (NULL means nop)
631 * @resume: invoked on resume if device was not reset (NULL means nop) 632 * @resume: invoked on resume if device was not reset (NULL means nop)
@@ -670,6 +671,8 @@ struct hid_driver {
670 int (*input_mapped)(struct hid_device *hdev, 671 int (*input_mapped)(struct hid_device *hdev,
671 struct hid_input *hidinput, struct hid_field *field, 672 struct hid_input *hidinput, struct hid_field *field,
672 struct hid_usage *usage, unsigned long **bit, int *max); 673 struct hid_usage *usage, unsigned long **bit, int *max);
674 void (*input_configured)(struct hid_device *hdev,
675 struct hid_input *hidinput);
673 void (*feature_mapping)(struct hid_device *hdev, 676 void (*feature_mapping)(struct hid_device *hdev,
674 struct hid_field *field, 677 struct hid_field *field,
675 struct hid_usage *usage); 678 struct hid_usage *usage);
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 4c59b1131187..b31cb7da0346 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -11,8 +11,7 @@ extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, 11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
12 unsigned long address, pmd_t *pmd, 12 unsigned long address, pmd_t *pmd,
13 pmd_t orig_pmd); 13 pmd_t orig_pmd);
14extern pgtable_t get_pmd_huge_pte(struct mm_struct *mm); 14extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
15extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
16 unsigned long addr, 15 unsigned long addr,
17 pmd_t *pmd, 16 pmd_t *pmd,
18 unsigned int flags); 17 unsigned int flags);
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 68ed7f7e1fc9..e73b852156b1 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -122,12 +122,53 @@
122#define REG_U32 4 122#define REG_U32 4
123#define REG_U64 8 123#define REG_U64 8
124 124
125/*
126 * As we look at expanding the KVP functionality to include
127 * IP injection functionality, we need to maintain binary
128 * compatibility with older daemons.
129 *
130 * The KVP opcodes are defined by the host and it was unfortunate
131 * that I chose to treat the registration operation as part of the
132 * KVP operations defined by the host.
133 * Here is the level of compatibility
134 * (between the user level daemon and the kernel KVP driver) that we
135 * will implement:
136 *
137 * An older daemon will always be supported on a newer driver.
138 * A given user level daemon will require a minimal version of the
139 * kernel driver.
140 * If we cannot handle the version differences, we will fail gracefully
141 * (this can happen when we have a user level daemon that is more
142 * advanced than the KVP driver.
143 *
144 * We will use values used in this handshake for determining if we have
145 * workable user level daemon and the kernel driver. We begin by taking the
146 * registration opcode out of the KVP opcode namespace. We will however,
147 * maintain compatibility with the existing user-level daemon code.
148 */
149
150/*
151 * Daemon code not supporting IP injection (legacy daemon).
152 */
153
154#define KVP_OP_REGISTER 4
155
156/*
157 * Daemon code supporting IP injection.
158 * The KVP opcode field is used to communicate the
159 * registration information; so define a namespace that
160 * will be distinct from the host defined KVP opcode.
161 */
162
163#define KVP_OP_REGISTER1 100
164
125enum hv_kvp_exchg_op { 165enum hv_kvp_exchg_op {
126 KVP_OP_GET = 0, 166 KVP_OP_GET = 0,
127 KVP_OP_SET, 167 KVP_OP_SET,
128 KVP_OP_DELETE, 168 KVP_OP_DELETE,
129 KVP_OP_ENUMERATE, 169 KVP_OP_ENUMERATE,
130 KVP_OP_REGISTER, 170 KVP_OP_GET_IP_INFO,
171 KVP_OP_SET_IP_INFO,
131 KVP_OP_COUNT /* Number of operations, must be last. */ 172 KVP_OP_COUNT /* Number of operations, must be last. */
132}; 173};
133 174
@@ -140,6 +181,39 @@ enum hv_kvp_exchg_pool {
140 KVP_POOL_COUNT /* Number of pools, must be last. */ 181 KVP_POOL_COUNT /* Number of pools, must be last. */
141}; 182};
142 183
184/*
185 * Some Hyper-V status codes.
186 */
187
188#define HV_S_OK 0x00000000
189#define HV_E_FAIL 0x80004005
190#define HV_S_CONT 0x80070103
191#define HV_ERROR_NOT_SUPPORTED 0x80070032
192#define HV_ERROR_MACHINE_LOCKED 0x800704F7
193#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
194#define HV_INVALIDARG 0x80070057
195#define HV_GUID_NOTFOUND 0x80041002
196
197#define ADDR_FAMILY_NONE 0x00
198#define ADDR_FAMILY_IPV4 0x01
199#define ADDR_FAMILY_IPV6 0x02
200
201#define MAX_ADAPTER_ID_SIZE 128
202#define MAX_IP_ADDR_SIZE 1024
203#define MAX_GATEWAY_SIZE 512
204
205
206struct hv_kvp_ipaddr_value {
207 __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
208 __u8 addr_family;
209 __u8 dhcp_enabled;
210 __u16 ip_addr[MAX_IP_ADDR_SIZE];
211 __u16 sub_net[MAX_IP_ADDR_SIZE];
212 __u16 gate_way[MAX_GATEWAY_SIZE];
213 __u16 dns_addr[MAX_IP_ADDR_SIZE];
214} __attribute__((packed));
215
216
143struct hv_kvp_hdr { 217struct hv_kvp_hdr {
144 __u8 operation; 218 __u8 operation;
145 __u8 pool; 219 __u8 pool;
@@ -181,16 +255,26 @@ struct hv_kvp_register {
181}; 255};
182 256
183struct hv_kvp_msg { 257struct hv_kvp_msg {
184 struct hv_kvp_hdr kvp_hdr; 258 union {
259 struct hv_kvp_hdr kvp_hdr;
260 int error;
261 };
185 union { 262 union {
186 struct hv_kvp_msg_get kvp_get; 263 struct hv_kvp_msg_get kvp_get;
187 struct hv_kvp_msg_set kvp_set; 264 struct hv_kvp_msg_set kvp_set;
188 struct hv_kvp_msg_delete kvp_delete; 265 struct hv_kvp_msg_delete kvp_delete;
189 struct hv_kvp_msg_enumerate kvp_enum_data; 266 struct hv_kvp_msg_enumerate kvp_enum_data;
267 struct hv_kvp_ipaddr_value kvp_ip_val;
190 struct hv_kvp_register kvp_register; 268 struct hv_kvp_register kvp_register;
191 } body; 269 } body;
192} __attribute__((packed)); 270} __attribute__((packed));
193 271
272struct hv_kvp_ip_msg {
273 __u8 operation;
274 __u8 pool;
275 struct hv_kvp_ipaddr_value kvp_ip_val;
276} __attribute__((packed));
277
194#ifdef __KERNEL__ 278#ifdef __KERNEL__
195#include <linux/scatterlist.h> 279#include <linux/scatterlist.h>
196#include <linux/list.h> 280#include <linux/list.h>
@@ -405,7 +489,7 @@ struct vmtransfer_page_range {
405struct vmtransfer_page_packet_header { 489struct vmtransfer_page_packet_header {
406 struct vmpacket_descriptor d; 490 struct vmpacket_descriptor d;
407 u16 xfer_pageset_id; 491 u16 xfer_pageset_id;
408 bool sender_owns_set; 492 u8 sender_owns_set;
409 u8 reserved; 493 u8 reserved;
410 u32 range_cnt; 494 u32 range_cnt;
411 struct vmtransfer_page_range ranges[1]; 495 struct vmtransfer_page_range ranges[1];
@@ -559,7 +643,7 @@ struct vmbus_channel_query_vmbus_version {
559/* VMBus Version Supported parameters */ 643/* VMBus Version Supported parameters */
560struct vmbus_channel_version_supported { 644struct vmbus_channel_version_supported {
561 struct vmbus_channel_message_header header; 645 struct vmbus_channel_message_header header;
562 bool version_supported; 646 u8 version_supported;
563} __packed; 647} __packed;
564 648
565/* Offer Channel parameters */ 649/* Offer Channel parameters */
@@ -568,7 +652,7 @@ struct vmbus_channel_offer_channel {
568 struct vmbus_channel_offer offer; 652 struct vmbus_channel_offer offer;
569 u32 child_relid; 653 u32 child_relid;
570 u8 monitorid; 654 u8 monitorid;
571 bool monitor_allocated; 655 u8 monitor_allocated;
572} __packed; 656} __packed;
573 657
574/* Rescind Offer parameters */ 658/* Rescind Offer parameters */
@@ -704,7 +788,7 @@ struct vmbus_channel_initiate_contact {
704 788
705struct vmbus_channel_version_response { 789struct vmbus_channel_version_response {
706 struct vmbus_channel_message_header header; 790 struct vmbus_channel_message_header header;
707 bool version_supported; 791 u8 version_supported;
708} __packed; 792} __packed;
709 793
710enum vmbus_channel_state { 794enum vmbus_channel_state {
@@ -977,11 +1061,6 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
977#define ICMSGHDRFLAG_REQUEST 2 1061#define ICMSGHDRFLAG_REQUEST 2
978#define ICMSGHDRFLAG_RESPONSE 4 1062#define ICMSGHDRFLAG_RESPONSE 4
979 1063
980#define HV_S_OK 0x00000000
981#define HV_E_FAIL 0x80004005
982#define HV_S_CONT 0x80070103
983#define HV_ERROR_NOT_SUPPORTED 0x80070032
984#define HV_ERROR_MACHINE_LOCKED 0x800704F7
985 1064
986/* 1065/*
987 * While we want to handle util services as regular devices, 1066 * While we want to handle util services as regular devices,
diff --git a/include/linux/i2c-mux-gpio.h b/include/linux/i2c-mux-gpio.h
index a36343a37ebc..4406108201fe 100644
--- a/include/linux/i2c-mux-gpio.h
+++ b/include/linux/i2c-mux-gpio.h
@@ -21,6 +21,9 @@
21 * @values: Array of bitmasks of GPIO settings (low/high) for each 21 * @values: Array of bitmasks of GPIO settings (low/high) for each
22 * position 22 * position
23 * @n_values: Number of multiplexer positions (busses to instantiate) 23 * @n_values: Number of multiplexer positions (busses to instantiate)
24 * @classes: Optional I2C auto-detection classes
25 * @gpio_chip: Optional GPIO chip name; if set, GPIO pin numbers are given
26 * relative to the base GPIO number of that chip
24 * @gpios: Array of GPIO numbers used to control MUX 27 * @gpios: Array of GPIO numbers used to control MUX
25 * @n_gpios: Number of GPIOs used to control MUX 28 * @n_gpios: Number of GPIOs used to control MUX
26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used 29 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
@@ -30,6 +33,8 @@ struct i2c_mux_gpio_platform_data {
30 int base_nr; 33 int base_nr;
31 const unsigned *values; 34 const unsigned *values;
32 int n_values; 35 int n_values;
36 const unsigned *classes;
37 char *gpio_chip;
33 const unsigned *gpios; 38 const unsigned *gpios;
34 int n_gpios; 39 int n_gpios;
35 unsigned idle; 40 unsigned idle;
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index c79083830014..40cb05a97b46 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -36,6 +36,7 @@
36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, 36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
37 struct device *mux_dev, 37 struct device *mux_dev,
38 void *mux_priv, u32 force_nr, u32 chan_id, 38 void *mux_priv, u32 force_nr, u32 chan_id,
39 unsigned int class,
39 int (*select) (struct i2c_adapter *, 40 int (*select) (struct i2c_adapter *,
40 void *mux_dev, u32 chan_id), 41 void *mux_dev, u32 chan_id),
41 int (*deselect) (struct i2c_adapter *, 42 int (*deselect) (struct i2c_adapter *,
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index 1bc74afe7a35..49ed17fdf055 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -22,6 +22,7 @@ struct i2c_pnx_mif {
22 struct timer_list timer; /* Timeout */ 22 struct timer_list timer; /* Timeout */
23 u8 * buf; /* Data buffer */ 23 u8 * buf; /* Data buffer */
24 int len; /* Length of data buffer */ 24 int len; /* Length of data buffer */
25 int order; /* RX Bytes to order via TX */
25}; 26};
26 27
27struct i2c_pnx_algo_data { 28struct i2c_pnx_algo_data {
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5970266930a2..94aed0c85bb0 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -144,7 +144,7 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
144 * The driver.owner field should be set to the module owner of this driver. 144 * The driver.owner field should be set to the module owner of this driver.
145 * The driver.name field should be set to the name of this driver. 145 * The driver.name field should be set to the name of this driver.
146 * 146 *
147 * For automatic device detection, both @detect and @address_data must 147 * For automatic device detection, both @detect and @address_list must
148 * be defined. @class should also be set, otherwise only devices forced 148 * be defined. @class should also be set, otherwise only devices forced
149 * with module parameters will be created. The detect function must 149 * with module parameters will be created. The detect function must
150 * fill at least the name field of the i2c_board_info structure it is 150 * fill at least the name field of the i2c_board_info structure it is
diff --git a/include/linux/i2c/pca954x.h b/include/linux/i2c/pca954x.h
index 28f1f8d5ab1f..1712677d5904 100644
--- a/include/linux/i2c/pca954x.h
+++ b/include/linux/i2c/pca954x.h
@@ -36,6 +36,7 @@
36struct pca954x_platform_mode { 36struct pca954x_platform_mode {
37 int adap_id; 37 int adap_id;
38 unsigned int deselect_on_exit:1; 38 unsigned int deselect_on_exit:1;
39 unsigned int class;
39}; 40};
40 41
41/* Per mux/switch data, used with i2c_register_board_info */ 42/* Per mux/switch data, used with i2c_register_board_info */
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h
index 0767a2a6b2f1..781e6bd06c34 100644
--- a/include/linux/i2c/pcf857x.h
+++ b/include/linux/i2c/pcf857x.h
@@ -10,6 +10,7 @@
10 * @setup: optional callback issued once the GPIOs are valid 10 * @setup: optional callback issued once the GPIOs are valid
11 * @teardown: optional callback issued before the GPIOs are invalidated 11 * @teardown: optional callback issued before the GPIOs are invalidated
12 * @context: optional parameter passed to setup() and teardown() 12 * @context: optional parameter passed to setup() and teardown()
13 * @irq: optional interrupt number
13 * 14 *
14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip, 15 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15 * the i2c_board_info used with the pcf875x driver must provide its 16 * the i2c_board_info used with the pcf875x driver must provide its
@@ -39,6 +40,8 @@ struct pcf857x_platform_data {
39 int gpio, unsigned ngpio, 40 int gpio, unsigned ngpio,
40 void *context); 41 void *context);
41 void *context; 42 void *context;
43
44 int irq;
42}; 45};
43 46
44#endif /* __LINUX_PCF857X_H */ 47#endif /* __LINUX_PCF857X_H */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 7ea898c55a60..9a5e28462324 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -188,6 +188,7 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
188 188
189int twl_get_type(void); 189int twl_get_type(void);
190int twl_get_version(void); 190int twl_get_version(void);
191int twl_get_hfclk_rate(void);
191 192
192int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); 193int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
193int twl6030_interrupt_mask(u8 bit_mask, u8 offset); 194int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
@@ -561,9 +562,6 @@ struct twl4030_bci_platform_data {
561 562
562/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ 563/* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */
563struct twl4030_gpio_platform_data { 564struct twl4030_gpio_platform_data {
564 int gpio_base;
565 unsigned irq_base, irq_end;
566
567 /* package the two LED signals as output-only GPIOs? */ 565 /* package the two LED signals as output-only GPIOs? */
568 bool use_leds; 566 bool use_leds;
569 567
@@ -666,7 +664,7 @@ struct twl4030_codec_data {
666 unsigned int check_defaults:1; 664 unsigned int check_defaults:1;
667 unsigned int reset_registers:1; 665 unsigned int reset_registers:1;
668 unsigned int hs_extmute:1; 666 unsigned int hs_extmute:1;
669 void (*set_hs_extmute)(int mute); 667 int hs_extmute_gpio;
670}; 668};
671 669
672struct twl4030_vibra_data { 670struct twl4030_vibra_data {
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 255491cf522e..87259a44c251 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -38,15 +38,15 @@
38#define IDR_SIZE (1 << IDR_BITS) 38#define IDR_SIZE (1 << IDR_BITS)
39#define IDR_MASK ((1 << IDR_BITS)-1) 39#define IDR_MASK ((1 << IDR_BITS)-1)
40 40
41#define MAX_ID_SHIFT (sizeof(int)*8 - 1) 41#define MAX_IDR_SHIFT (sizeof(int)*8 - 1)
42#define MAX_ID_BIT (1U << MAX_ID_SHIFT) 42#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
43#define MAX_ID_MASK (MAX_ID_BIT - 1) 43#define MAX_IDR_MASK (MAX_IDR_BIT - 1)
44 44
45/* Leave the possibility of an incomplete final layer */ 45/* Leave the possibility of an incomplete final layer */
46#define MAX_LEVEL (MAX_ID_SHIFT + IDR_BITS - 1) / IDR_BITS 46#define MAX_IDR_LEVEL ((MAX_IDR_SHIFT + IDR_BITS - 1) / IDR_BITS)
47 47
48/* Number of id_layer structs to leave in free list */ 48/* Number of id_layer structs to leave in free list */
49#define IDR_FREE_MAX MAX_LEVEL + MAX_LEVEL 49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
50 50
51struct idr_layer { 51struct idr_layer {
52 unsigned long bitmap; /* A zero bit means "space here" */ 52 unsigned long bitmap; /* A zero bit means "space here" */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index e02fc682bb68..2385119f8bb0 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1935,36 +1935,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
1935} 1935}
1936 1936
1937/** 1937/**
1938 * ieee80211_fhss_chan_to_freq - get channel frequency
1939 * @channel: the FHSS channel
1940 *
1941 * Convert IEEE802.11 FHSS channel to frequency (MHz)
1942 * Ref IEEE 802.11-2007 section 14.6
1943 */
1944static inline int ieee80211_fhss_chan_to_freq(int channel)
1945{
1946 if ((channel > 1) && (channel < 96))
1947 return channel + 2400;
1948 else
1949 return -1;
1950}
1951
1952/**
1953 * ieee80211_freq_to_fhss_chan - get channel
1954 * @freq: the channels frequency
1955 *
1956 * Convert frequency (MHz) to IEEE802.11 FHSS channel
1957 * Ref IEEE 802.11-2007 section 14.6
1958 */
1959static inline int ieee80211_freq_to_fhss_chan(int freq)
1960{
1961 if ((freq > 2401) && (freq < 2496))
1962 return freq - 2400;
1963 else
1964 return -1;
1965}
1966
1967/**
1968 * ieee80211_dsss_chan_to_freq - get channel center frequency 1938 * ieee80211_dsss_chan_to_freq - get channel center frequency
1969 * @channel: the DSSS channel 1939 * @channel: the DSSS channel
1970 * 1940 *
@@ -2000,56 +1970,6 @@ static inline int ieee80211_freq_to_dsss_chan(int freq)
2000 return -1; 1970 return -1;
2001} 1971}
2002 1972
2003/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
2004 * Ref IEEE 802.11-2007 section 18.4.6.2
2005 *
2006 * The channels and frequencies are the same as those defined for DSSS
2007 */
2008#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
2009#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
2010
2011/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
2012 * Ref IEEE 802.11-2007 section 19.4.2
2013 */
2014#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
2015#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
2016
2017/**
2018 * ieee80211_ofdm_chan_to_freq - get channel center frequency
2019 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
2020 * @channel: the OFDM channel
2021 *
2022 * Convert IEEE802.11 OFDM channel to center frequency (MHz)
2023 * Ref IEEE 802.11-2007 section 17.3.8.3.2
2024 */
2025static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
2026{
2027 if ((channel > 0) && (channel <= 200) &&
2028 (s_freq >= 4000))
2029 return s_freq + (channel * 5);
2030 else
2031 return -1;
2032}
2033
2034/**
2035 * ieee80211_freq_to_ofdm_channel - get channel
2036 * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
2037 * @freq: the frequency
2038 *
2039 * Convert frequency (MHz) to IEEE802.11 OFDM channel
2040 * Ref IEEE 802.11-2007 section 17.3.8.3.2
2041 *
2042 * This routine selects the channel with the closest center frequency.
2043 */
2044static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
2045{
2046 if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
2047 (s_freq >= 4000))
2048 return (freq + 2 - s_freq) / 5;
2049 else
2050 return -1;
2051}
2052
2053/** 1973/**
2054 * ieee80211_tu_to_usec - convert time units (TU) to microseconds 1974 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
2055 * @tu: the TUs 1975 * @tu: the TUs
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index f0e69c6e8208..9adcc29f084a 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -92,6 +92,7 @@
92#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */ 94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
95 96
96#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
97#define ARPHRD_NONE 0xFFFE /* zero header length */ 98#define ARPHRD_NONE 0xFFFE /* zero header length */
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index ac173bd2ab65..e4dad4ddf085 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -272,6 +272,22 @@ enum macvlan_mode {
272 272
273#define MACVLAN_FLAG_NOPROMISC 1 273#define MACVLAN_FLAG_NOPROMISC 1
274 274
275/* VXLAN section */
276enum {
277 IFLA_VXLAN_UNSPEC,
278 IFLA_VXLAN_ID,
279 IFLA_VXLAN_GROUP,
280 IFLA_VXLAN_LINK,
281 IFLA_VXLAN_LOCAL,
282 IFLA_VXLAN_TTL,
283 IFLA_VXLAN_TOS,
284 IFLA_VXLAN_LEARNING,
285 IFLA_VXLAN_AGEING,
286 IFLA_VXLAN_LIMIT,
287 __IFLA_VXLAN_MAX
288};
289#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
290
275/* SR-IOV virtual function management section */ 291/* SR-IOV virtual function management section */
276 292
277enum { 293enum {
@@ -398,4 +414,22 @@ struct ifla_port_vsi {
398 __u8 pad[3]; 414 __u8 pad[3];
399}; 415};
400 416
417
418/* IPoIB section */
419
420enum {
421 IFLA_IPOIB_UNSPEC,
422 IFLA_IPOIB_PKEY,
423 IFLA_IPOIB_MODE,
424 IFLA_IPOIB_UMCAST,
425 __IFLA_IPOIB_MAX
426};
427
428enum {
429 IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */
430 IPOIB_MODE_CONNECTED = 1, /* using connected QPs */
431};
432
433#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
434
401#endif /* _LINUX_IF_LINK_H */ 435#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 6960fc1841a7..6d88a7f57680 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -67,6 +67,9 @@ struct team_port {
67 struct netpoll *np; 67 struct netpoll *np;
68#endif 68#endif
69 69
70 s32 priority; /* lower number ~ higher priority */
71 u16 queue_id;
72 struct list_head qom_list; /* node in queue override mapping list */
70 long mode_priv[0]; 73 long mode_priv[0];
71}; 74};
72 75
@@ -96,21 +99,6 @@ static inline void team_netpoll_send_skb(struct team_port *port,
96} 99}
97#endif 100#endif
98 101
99static inline int team_dev_queue_xmit(struct team *team, struct team_port *port,
100 struct sk_buff *skb)
101{
102 BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
103 sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping));
104 skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping);
105
106 skb->dev = port->dev;
107 if (unlikely(netpoll_tx_running(port->dev))) {
108 team_netpoll_send_skb(port, skb);
109 return 0;
110 }
111 return dev_queue_xmit(skb);
112}
113
114struct team_mode_ops { 102struct team_mode_ops {
115 int (*init)(struct team *team); 103 int (*init)(struct team *team);
116 void (*exit)(struct team *team); 104 void (*exit)(struct team *team);
@@ -120,7 +108,7 @@ struct team_mode_ops {
120 bool (*transmit)(struct team *team, struct sk_buff *skb); 108 bool (*transmit)(struct team *team, struct sk_buff *skb);
121 int (*port_enter)(struct team *team, struct team_port *port); 109 int (*port_enter)(struct team *team, struct team_port *port);
122 void (*port_leave)(struct team *team, struct team_port *port); 110 void (*port_leave)(struct team *team, struct team_port *port);
123 void (*port_change_mac)(struct team *team, struct team_port *port); 111 void (*port_change_dev_addr)(struct team *team, struct team_port *port);
124 void (*port_enabled)(struct team *team, struct team_port *port); 112 void (*port_enabled)(struct team *team, struct team_port *port);
125 void (*port_disabled)(struct team *team, struct team_port *port); 113 void (*port_disabled)(struct team *team, struct team_port *port);
126}; 114};
@@ -130,6 +118,7 @@ enum team_option_type {
130 TEAM_OPTION_TYPE_STRING, 118 TEAM_OPTION_TYPE_STRING,
131 TEAM_OPTION_TYPE_BINARY, 119 TEAM_OPTION_TYPE_BINARY,
132 TEAM_OPTION_TYPE_BOOL, 120 TEAM_OPTION_TYPE_BOOL,
121 TEAM_OPTION_TYPE_S32,
133}; 122};
134 123
135struct team_option_inst_info { 124struct team_option_inst_info {
@@ -146,6 +135,7 @@ struct team_gsetter_ctx {
146 u32 len; 135 u32 len;
147 } bin_val; 136 } bin_val;
148 bool bool_val; 137 bool bool_val;
138 s32 s32_val;
149 } data; 139 } data;
150 struct team_option_inst_info *info; 140 struct team_option_inst_info *info;
151}; 141};
@@ -197,9 +187,26 @@ struct team {
197 187
198 const struct team_mode *mode; 188 const struct team_mode *mode;
199 struct team_mode_ops ops; 189 struct team_mode_ops ops;
190 bool queue_override_enabled;
191 struct list_head *qom_lists; /* array of queue override mapping lists */
200 long mode_priv[TEAM_MODE_PRIV_LONGS]; 192 long mode_priv[TEAM_MODE_PRIV_LONGS];
201}; 193};
202 194
195static inline int team_dev_queue_xmit(struct team *team, struct team_port *port,
196 struct sk_buff *skb)
197{
198 BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
199 sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping));
200 skb_set_queue_mapping(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping);
201
202 skb->dev = port->dev;
203 if (unlikely(netpoll_tx_running(team->dev))) {
204 team_netpoll_send_skb(port, skb);
205 return 0;
206 }
207 return dev_queue_xmit(skb);
208}
209
203static inline struct hlist_head *team_port_index_hash(struct team *team, 210static inline struct hlist_head *team_port_index_hash(struct team *team,
204 int port_index) 211 int port_index)
205{ 212{
@@ -231,7 +238,7 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
231 return NULL; 238 return NULL;
232} 239}
233 240
234extern int team_port_set_team_mac(struct team_port *port); 241extern int team_port_set_team_dev_addr(struct team_port *port);
235extern int team_options_register(struct team *team, 242extern int team_options_register(struct team *team,
236 const struct team_option *option, 243 const struct team_option *option,
237 size_t option_count); 244 size_t option_count);
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5efff60b6f56..8c5035ac3142 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -75,6 +75,9 @@ enum {
75 IFLA_GRE_TTL, 75 IFLA_GRE_TTL,
76 IFLA_GRE_TOS, 76 IFLA_GRE_TOS,
77 IFLA_GRE_PMTUDISC, 77 IFLA_GRE_PMTUDISC,
78 IFLA_GRE_ENCAP_LIMIT,
79 IFLA_GRE_FLOWINFO,
80 IFLA_GRE_FLAGS,
78 __IFLA_GRE_MAX, 81 __IFLA_GRE_MAX,
79}; 82};
80 83
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a810987cb80e..e6ff12dd717b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -74,8 +74,6 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
74/* found in socket.c */ 74/* found in socket.c */
75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 75extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 76
77struct vlan_info;
78
79static inline int is_vlan_dev(struct net_device *dev) 77static inline int is_vlan_dev(struct net_device *dev)
80{ 78{
81 return dev->priv_flags & IFF_802_1Q_VLAN; 79 return dev->priv_flags & IFF_802_1Q_VLAN;
@@ -101,6 +99,8 @@ extern int vlan_vids_add_by_dev(struct net_device *dev,
101 const struct net_device *by_dev); 99 const struct net_device *by_dev);
102extern void vlan_vids_del_by_dev(struct net_device *dev, 100extern void vlan_vids_del_by_dev(struct net_device *dev,
103 const struct net_device *by_dev); 101 const struct net_device *by_dev);
102
103extern bool vlan_uses_dev(const struct net_device *dev);
104#else 104#else
105static inline struct net_device * 105static inline struct net_device *
106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) 106__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
@@ -151,6 +151,11 @@ static inline void vlan_vids_del_by_dev(struct net_device *dev,
151 const struct net_device *by_dev) 151 const struct net_device *by_dev)
152{ 152{
153} 153}
154
155static inline bool vlan_uses_dev(const struct net_device *dev)
156{
157 return false;
158}
154#endif 159#endif
155 160
156/** 161/**
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h
new file mode 100644
index 000000000000..2e4eab9868a3
--- /dev/null
+++ b/include/linux/iio/adc/ad_sigma_delta.h
@@ -0,0 +1,173 @@
1/*
2 * Support code for Analog Devices Sigma-Delta ADCs
3 *
4 * Copyright 2012 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9#ifndef __AD_SIGMA_DELTA_H__
10#define __AD_SIGMA_DELTA_H__
11
12enum ad_sigma_delta_mode {
13 AD_SD_MODE_CONTINUOUS = 0,
14 AD_SD_MODE_SINGLE = 1,
15 AD_SD_MODE_IDLE = 2,
16 AD_SD_MODE_POWERDOWN = 3,
17};
18
19/**
20 * struct ad_sigma_delta_calib_data - Calibration data for Sigma Delta devices
21 * @mode: Calibration mode.
22 * @channel: Calibration channel.
23 */
24struct ad_sd_calib_data {
25 unsigned int mode;
26 unsigned int channel;
27};
28
29struct ad_sigma_delta;
30struct iio_dev;
31
32/**
33 * struct ad_sigma_delta_info - Sigma Delta driver specific callbacks and options
34 * @set_channel: Will be called to select the current channel, may be NULL.
35 * @set_mode: Will be called to select the current mode, may be NULL.
36 * @postprocess_sample: Is called for each sampled data word, can be used to
37 * modify or drop the sample data, it, may be NULL.
38 * @has_registers: true if the device has writable and readable registers, false
39 * if there is just one read-only sample data shift register.
40 * @addr_shift: Shift of the register address in the communications register.
41 * @read_mask: Mask for the communications register having the read bit set.
42 */
43struct ad_sigma_delta_info {
44 int (*set_channel)(struct ad_sigma_delta *, unsigned int channel);
45 int (*set_mode)(struct ad_sigma_delta *, enum ad_sigma_delta_mode mode);
46 int (*postprocess_sample)(struct ad_sigma_delta *, unsigned int raw_sample);
47 bool has_registers;
48 unsigned int addr_shift;
49 unsigned int read_mask;
50};
51
52/**
53 * struct ad_sigma_delta - Sigma Delta device struct
54 * @spi: The spi device associated with the Sigma Delta device.
55 * @trig: The IIO trigger associated with the Sigma Delta device.
56 *
57 * Most of the fields are private to the sigma delta library code and should not
58 * be accessed by individual drivers.
59 */
60struct ad_sigma_delta {
61 struct spi_device *spi;
62 struct iio_trigger *trig;
63
64/* private: */
65 struct completion completion;
66 bool irq_dis;
67
68 bool bus_locked;
69
70 uint8_t comm;
71
72 const struct ad_sigma_delta_info *info;
73
74 /*
75 * DMA (thus cache coherency maintenance) requires the
76 * transfer buffers to live in their own cache lines.
77 */
78 uint8_t data[4] ____cacheline_aligned;
79};
80
81static inline int ad_sigma_delta_set_channel(struct ad_sigma_delta *sd,
82 unsigned int channel)
83{
84 if (sd->info->set_channel)
85 return sd->info->set_channel(sd, channel);
86
87 return 0;
88}
89
90static inline int ad_sigma_delta_set_mode(struct ad_sigma_delta *sd,
91 unsigned int mode)
92{
93 if (sd->info->set_mode)
94 return sd->info->set_mode(sd, mode);
95
96 return 0;
97}
98
99static inline int ad_sigma_delta_postprocess_sample(struct ad_sigma_delta *sd,
100 unsigned int raw_sample)
101{
102 if (sd->info->postprocess_sample)
103 return sd->info->postprocess_sample(sd, raw_sample);
104
105 return 0;
106}
107
108void ad_sd_set_comm(struct ad_sigma_delta *sigma_delta, uint8_t comm);
109int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg,
110 unsigned int size, unsigned int val);
111int ad_sd_read_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg,
112 unsigned int size, unsigned int *val);
113
114int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev,
115 const struct iio_chan_spec *chan, int *val);
116int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta,
117 const struct ad_sd_calib_data *cd, unsigned int n);
118int ad_sd_init(struct ad_sigma_delta *sigma_delta, struct iio_dev *indio_dev,
119 struct spi_device *spi, const struct ad_sigma_delta_info *info);
120
121int ad_sd_setup_buffer_and_trigger(struct iio_dev *indio_dev);
122void ad_sd_cleanup_buffer_and_trigger(struct iio_dev *indio_dev);
123
124int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig);
125
126#define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
127 _storagebits, _shift, _extend_name, _type) \
128 { \
129 .type = (_type), \
130 .differential = (_channel2 == -1 ? 0 : 1), \
131 .indexed = 1, \
132 .channel = (_channel1), \
133 .channel2 = (_channel2), \
134 .address = (_address), \
135 .extend_name = (_extend_name), \
136 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
137 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
138 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
139 .scan_index = (_si), \
140 .scan_type = { \
141 .sign = 'u', \
142 .realbits = (_bits), \
143 .storagebits = (_storagebits), \
144 .shift = (_shift), \
145 .endianness = IIO_BE, \
146 }, \
147 }
148
149#define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
150 _storagebits, _shift) \
151 __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
152 _storagebits, _shift, NULL, IIO_VOLTAGE)
153
154#define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \
155 _storagebits, _shift) \
156 __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \
157 _storagebits, _shift, "shorted", IIO_VOLTAGE)
158
159#define AD_SD_CHANNEL(_si, _channel, _address, _bits, \
160 _storagebits, _shift) \
161 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
162 _storagebits, _shift, NULL, IIO_VOLTAGE)
163
164#define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \
165 __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \
166 _storagebits, _shift, NULL, IIO_TEMP)
167
168#define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \
169 _shift) \
170 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
171 _storagebits, _shift, "supply", IIO_VOLTAGE)
172
173#endif
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 8ba516fc2ec6..c629b3a1d9a9 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -36,7 +36,7 @@ struct iio_buffer;
36 * any of them not existing. 36 * any of them not existing.
37 **/ 37 **/
38struct iio_buffer_access_funcs { 38struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp); 39 int (*store_to)(struct iio_buffer *buffer, u8 *data);
40 int (*read_first_n)(struct iio_buffer *buffer, 40 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n, 41 size_t n,
42 char __user *buf); 42 char __user *buf);
@@ -118,10 +118,8 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
118 * iio_push_to_buffer() - push to a registered buffer. 118 * iio_push_to_buffer() - push to a registered buffer.
119 * @buffer: IIO buffer structure for device 119 * @buffer: IIO buffer structure for device
120 * @data: the data to push to the buffer 120 * @data: the data to push to the buffer
121 * @timestamp: timestamp to associate with the data
122 */ 121 */
123int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data, 122int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data);
124 s64 timestamp);
125 123
126int iio_update_demux(struct iio_dev *indio_dev); 124int iio_update_demux(struct iio_dev *indio_dev);
127 125
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index e2657e6d4d26..e875bcf0478f 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -8,7 +8,7 @@
8 * the Free Software Foundation. 8 * the Free Software Foundation.
9 */ 9 */
10#ifndef _IIO_INKERN_CONSUMER_H_ 10#ifndef _IIO_INKERN_CONSUMER_H_
11#define _IIO_INKERN_CONSUMER_H 11#define _IIO_INKERN_CONSUMER_H_
12#include <linux/iio/types.h> 12#include <linux/iio/types.h>
13 13
14struct iio_dev; 14struct iio_dev;
@@ -61,7 +61,7 @@ void iio_channel_release_all(struct iio_channel *chan);
61 61
62/** 62/**
63 * iio_read_channel_raw() - read from a given channel 63 * iio_read_channel_raw() - read from a given channel
64 * @channel: The channel being queried. 64 * @chan: The channel being queried.
65 * @val: Value read back. 65 * @val: Value read back.
66 * 66 *
67 * Note raw reads from iio channels are in adc counts and hence 67 * Note raw reads from iio channels are in adc counts and hence
@@ -71,6 +71,21 @@ int iio_read_channel_raw(struct iio_channel *chan,
71 int *val); 71 int *val);
72 72
73/** 73/**
74 * iio_read_channel_processed() - read processed value from a given channel
75 * @chan: The channel being queried.
76 * @val: Value read back.
77 *
78 * Returns an error code or 0.
79 *
80 * This function will read a processed value from a channel. A processed value
81 * means that this value will have the correct unit and not some device internal
82 * representation. If the device does not support reporting a processed value
83 * the function will query the raw value and the channels scale and offset and
84 * do the appropriate transformation.
85 */
86int iio_read_channel_processed(struct iio_channel *chan, int *val);
87
88/**
74 * iio_get_channel_type() - get the type of a channel 89 * iio_get_channel_type() - get the type of a channel
75 * @channel: The channel being queried. 90 * @channel: The channel being queried.
76 * @type: The type of the channel. 91 * @type: The type of the channel.
@@ -82,7 +97,7 @@ int iio_get_channel_type(struct iio_channel *channel,
82 97
83/** 98/**
84 * iio_read_channel_scale() - read the scale value for a channel 99 * iio_read_channel_scale() - read the scale value for a channel
85 * @channel: The channel being queried. 100 * @chan: The channel being queried.
86 * @val: First part of value read back. 101 * @val: First part of value read back.
87 * @val2: Second part of value read back. 102 * @val2: Second part of value read back.
88 * 103 *
@@ -93,4 +108,27 @@ int iio_get_channel_type(struct iio_channel *channel,
93int iio_read_channel_scale(struct iio_channel *chan, int *val, 108int iio_read_channel_scale(struct iio_channel *chan, int *val,
94 int *val2); 109 int *val2);
95 110
111/**
112 * iio_convert_raw_to_processed() - Converts a raw value to a processed value
113 * @chan: The channel being queried
114 * @raw: The raw IIO to convert
115 * @processed: The result of the conversion
116 * @scale: Scale factor to apply during the conversion
117 *
118 * Returns an error code or 0.
119 *
120 * This function converts a raw value to processed value for a specific channel.
121 * A raw value is the device internal representation of a sample and the value
122 * returned by iio_read_channel_raw, so the unit of that value is device
123 * depended. A processed value on the other hand is value has a normed unit
124 * according with the IIO specification.
125 *
126 * The scale factor allows to increase the precession of the returned value. For
127 * a scale factor of 1 the function will return the result in the normal IIO
128 * unit for the channel type. E.g. millivolt for voltage channels, if you want
129 * nanovolts instead pass 1000 as the scale factor.
130 */
131int iio_convert_raw_to_processed(struct iio_channel *chan, int raw,
132 int *processed, unsigned int scale);
133
96#endif 134#endif
diff --git a/include/linux/iio/frequency/adf4350.h b/include/linux/iio/frequency/adf4350.h
index b76b4a87065e..be91f344d5fc 100644
--- a/include/linux/iio/frequency/adf4350.h
+++ b/include/linux/iio/frequency/adf4350.h
@@ -87,6 +87,8 @@
87#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */ 87#define ADF4350_MAX_BANDSEL_CLK 125000 /* Hz */
88#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */ 88#define ADF4350_MAX_FREQ_REFIN 250000000 /* Hz */
89#define ADF4350_MAX_MODULUS 4095 89#define ADF4350_MAX_MODULUS 4095
90#define ADF4350_MAX_R_CNT 1023
91
90 92
91/** 93/**
92 * struct adf4350_platform_data - platform specific information 94 * struct adf4350_platform_data - platform specific information
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index be82936c4089..c0ae76ac4e0b 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -35,10 +35,13 @@ enum iio_chan_info_enum {
35 IIO_CHAN_INFO_FREQUENCY, 35 IIO_CHAN_INFO_FREQUENCY,
36 IIO_CHAN_INFO_PHASE, 36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN, 37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS,
38}; 39};
39 40
40#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2) 41#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
41#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1) 42#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
43#define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \
44 IIO_CHAN_INFO_SEPARATE_BIT(type))
42 45
43#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \ 46#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
44 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW) 47 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
@@ -100,6 +103,10 @@ enum iio_chan_info_enum {
100 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN) 103 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
101#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \ 104#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
102 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN) 105 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
106#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT \
107 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)
108#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT \
109 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)
103 110
104enum iio_endian { 111enum iio_endian {
105 IIO_CPU, 112 IIO_CPU,
@@ -164,7 +171,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
164 * IIO_ENUM() - Initialize enum extended channel attribute 171 * IIO_ENUM() - Initialize enum extended channel attribute
165 * @_name: Attribute name 172 * @_name: Attribute name
166 * @_shared: Whether the attribute is shared between all channels 173 * @_shared: Whether the attribute is shared between all channels
167 * @_e: Pointer to a iio_enum struct 174 * @_e: Pointer to an iio_enum struct
168 * 175 *
169 * This should usually be used together with IIO_ENUM_AVAILABLE() 176 * This should usually be used together with IIO_ENUM_AVAILABLE()
170 */ 177 */
@@ -180,9 +187,9 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
180/** 187/**
181 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute 188 * IIO_ENUM_AVAILABLE() - Initialize enum available extended channel attribute
182 * @_name: Attribute name ("_available" will be appended to the name) 189 * @_name: Attribute name ("_available" will be appended to the name)
183 * @_e: Pointer to a iio_enum struct 190 * @_e: Pointer to an iio_enum struct
184 * 191 *
185 * Creates a read only attribute which list all the available enum items in a 192 * Creates a read only attribute which lists all the available enum items in a
186 * space separated list. This should usually be used together with IIO_ENUM() 193 * space separated list. This should usually be used together with IIO_ENUM()
187 */ 194 */
188#define IIO_ENUM_AVAILABLE(_name, _e) \ 195#define IIO_ENUM_AVAILABLE(_name, _e) \
@@ -229,6 +236,7 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
229 * @indexed: Specify the channel has a numerical index. If not, 236 * @indexed: Specify the channel has a numerical index. If not,
230 * the channel index number will be suppressed for sysfs 237 * the channel index number will be suppressed for sysfs
231 * attributes but not for event codes. 238 * attributes but not for event codes.
239 * @output: Channel is output.
232 * @differential: Channel is differential. 240 * @differential: Channel is differential.
233 */ 241 */
234struct iio_chan_spec { 242struct iio_chan_spec {
@@ -255,6 +263,21 @@ struct iio_chan_spec {
255 unsigned differential:1; 263 unsigned differential:1;
256}; 264};
257 265
266
267/**
268 * iio_channel_has_info() - Checks whether a channel supports a info attribute
269 * @chan: The channel to be queried
270 * @type: Type of the info attribute to be checked
271 *
272 * Returns true if the channels supports reporting values for the given info
273 * attribute type, false otherwise.
274 */
275static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
276 enum iio_chan_info_enum type)
277{
278 return chan->info_mask & IIO_CHAN_INFO_BITS(type);
279}
280
258#define IIO_ST(si, rb, sb, sh) \ 281#define IIO_ST(si, rb, sb, sh) \
259 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh } 282 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh }
260 283
@@ -312,6 +335,9 @@ struct iio_dev;
312 * Meaning is event dependent. 335 * Meaning is event dependent.
313 * @validate_trigger: function to validate the trigger when the 336 * @validate_trigger: function to validate the trigger when the
314 * current trigger gets changed. 337 * current trigger gets changed.
338 * @update_scan_mode: function to configure device and scan buffer when
339 * channels have changed
340 * @debugfs_reg_access: function to read or write register value of device
315 **/ 341 **/
316struct iio_info { 342struct iio_info {
317 struct module *driver_module; 343 struct module *driver_module;
@@ -367,10 +393,10 @@ struct iio_info {
367 * scan mask is valid for the device. 393 * scan mask is valid for the device.
368 */ 394 */
369struct iio_buffer_setup_ops { 395struct iio_buffer_setup_ops {
370 int (*preenable)(struct iio_dev *); 396 int (*preenable)(struct iio_dev *);
371 int (*postenable)(struct iio_dev *); 397 int (*postenable)(struct iio_dev *);
372 int (*predisable)(struct iio_dev *); 398 int (*predisable)(struct iio_dev *);
373 int (*postdisable)(struct iio_dev *); 399 int (*postdisable)(struct iio_dev *);
374 bool (*validate_scan_mask)(struct iio_dev *indio_dev, 400 bool (*validate_scan_mask)(struct iio_dev *indio_dev,
375 const unsigned long *scan_mask); 401 const unsigned long *scan_mask);
376}; 402};
@@ -516,6 +542,31 @@ static inline struct iio_dev *iio_device_get(struct iio_dev *indio_dev)
516 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL; 542 return indio_dev ? dev_to_iio_dev(get_device(&indio_dev->dev)) : NULL;
517} 543}
518 544
545
546/**
547 * iio_device_set_drvdata() - Set device driver data
548 * @indio_dev: IIO device structure
549 * @data: Driver specific data
550 *
551 * Allows to attach an arbitrary pointer to an IIO device, which can later be
552 * retrieved by iio_device_get_drvdata().
553 */
554static inline void iio_device_set_drvdata(struct iio_dev *indio_dev, void *data)
555{
556 dev_set_drvdata(&indio_dev->dev, data);
557}
558
559/**
560 * iio_device_get_drvdata() - Get device driver data
561 * @indio_dev: IIO device structure
562 *
563 * Returns the data previously set with iio_device_set_drvdata()
564 */
565static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
566{
567 return dev_get_drvdata(&indio_dev->dev);
568}
569
519/* Can we make this smaller? */ 570/* Can we make this smaller? */
520#define IIO_ALIGN L1_CACHE_BYTES 571#define IIO_ALIGN L1_CACHE_BYTES
521/** 572/**
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
index 014d5a13b32b..25eeac762e84 100644
--- a/include/linux/iio/kfifo_buf.h
+++ b/include/linux/iio/kfifo_buf.h
@@ -1,3 +1,5 @@
1#ifndef __LINUX_IIO_KFIFO_BUF_H__
2#define __LINUX_IIO_KFIFO_BUF_H__
1 3
2#include <linux/kfifo.h> 4#include <linux/kfifo.h>
3#include <linux/iio/iio.h> 5#include <linux/iio/iio.h>
@@ -6,3 +8,4 @@
6struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev); 8struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev);
7void iio_kfifo_free(struct iio_buffer *r); 9void iio_kfifo_free(struct iio_buffer *r);
8 10
11#endif
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h
index 400a453ff67b..809a3f08d5a5 100644
--- a/include/linux/iio/machine.h
+++ b/include/linux/iio/machine.h
@@ -8,6 +8,9 @@
8 * the Free Software Foundation. 8 * the Free Software Foundation.
9 */ 9 */
10 10
11#ifndef __LINUX_IIO_MACHINE_H__
12#define __LINUX_IIO_MACHINE_H__
13
11/** 14/**
12 * struct iio_map - description of link between consumer and device channels 15 * struct iio_map - description of link between consumer and device channels
13 * @adc_channel_label: Label used to identify the channel on the provider. 16 * @adc_channel_label: Label used to identify the channel on the provider.
@@ -22,3 +25,5 @@ struct iio_map {
22 const char *consumer_dev_name; 25 const char *consumer_dev_name;
23 const char *consumer_channel; 26 const char *consumer_channel;
24}; 27};
28
29#endif
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h
index a9819940a84c..20239da1d0f7 100644
--- a/include/linux/iio/trigger.h
+++ b/include/linux/iio/trigger.h
@@ -29,7 +29,7 @@ struct iio_subirq {
29 * instances of a given device. 29 * instances of a given device.
30 **/ 30 **/
31struct iio_trigger_ops { 31struct iio_trigger_ops {
32 struct module *owner; 32 struct module *owner;
33 int (*set_trigger_state)(struct iio_trigger *trig, bool state); 33 int (*set_trigger_state)(struct iio_trigger *trig, bool state);
34 int (*try_reenable)(struct iio_trigger *trig); 34 int (*try_reenable)(struct iio_trigger *trig);
35 int (*validate_device)(struct iio_trigger *trig, 35 int (*validate_device)(struct iio_trigger *trig,
@@ -39,7 +39,7 @@ struct iio_trigger_ops {
39 39
40/** 40/**
41 * struct iio_trigger - industrial I/O trigger device 41 * struct iio_trigger - industrial I/O trigger device
42 * 42 * @ops: [DRIVER] operations structure
43 * @id: [INTERN] unique id number 43 * @id: [INTERN] unique id number
44 * @name: [DRIVER] unique name 44 * @name: [DRIVER] unique name
45 * @dev: [DRIVER] associated device (if relevant) 45 * @dev: [DRIVER] associated device (if relevant)
@@ -76,19 +76,19 @@ struct iio_trigger {
76static inline struct iio_trigger *to_iio_trigger(struct device *d) 76static inline struct iio_trigger *to_iio_trigger(struct device *d)
77{ 77{
78 return container_of(d, struct iio_trigger, dev); 78 return container_of(d, struct iio_trigger, dev);
79}; 79}
80 80
81static inline void iio_trigger_put(struct iio_trigger *trig) 81static inline void iio_trigger_put(struct iio_trigger *trig)
82{ 82{
83 module_put(trig->ops->owner); 83 module_put(trig->ops->owner);
84 put_device(&trig->dev); 84 put_device(&trig->dev);
85}; 85}
86 86
87static inline void iio_trigger_get(struct iio_trigger *trig) 87static inline void iio_trigger_get(struct iio_trigger *trig)
88{ 88{
89 get_device(&trig->dev); 89 get_device(&trig->dev);
90 __module_get(trig->ops->owner); 90 __module_get(trig->ops->owner);
91}; 91}
92 92
93/** 93/**
94 * iio_trigger_register() - register a trigger with the IIO core 94 * iio_trigger_register() - register a trigger with the IIO core
@@ -104,7 +104,8 @@ void iio_trigger_unregister(struct iio_trigger *trig_info);
104 104
105/** 105/**
106 * iio_trigger_poll() - called on a trigger occurring 106 * iio_trigger_poll() - called on a trigger occurring
107 * @trig: trigger which occurred 107 * @trig: trigger which occurred
108 * @time: timestamp when trigger occurred
108 * 109 *
109 * Typically called in relevant hardware interrupt handler. 110 * Typically called in relevant hardware interrupt handler.
110 **/ 111 **/
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h
index 60d64b356945..c4f8c7409666 100644
--- a/include/linux/iio/trigger_consumer.h
+++ b/include/linux/iio/trigger_consumer.h
@@ -7,6 +7,15 @@
7 * the Free Software Foundation. 7 * the Free Software Foundation.
8 */ 8 */
9 9
10#ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
11#define __LINUX_IIO_TRIGGER_CONSUMER_H__
12
13#include <linux/interrupt.h>
14#include <linux/types.h>
15
16struct iio_dev;
17struct iio_trigger;
18
10/** 19/**
11 * struct iio_poll_func - poll function pair 20 * struct iio_poll_func - poll function pair
12 * 21 *
@@ -50,3 +59,5 @@ void iio_trigger_notify_done(struct iio_trigger *trig);
50 */ 59 */
51int iio_triggered_buffer_postenable(struct iio_dev *indio_dev); 60int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52int iio_triggered_buffer_predisable(struct iio_dev *indio_dev); 61int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
62
63#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 44e397705d7f..5c647ecfd5ba 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -57,5 +57,6 @@ enum iio_modifier {
57#define IIO_VAL_INT_PLUS_MICRO 2 57#define IIO_VAL_INT_PLUS_MICRO 2
58#define IIO_VAL_INT_PLUS_NANO 3 58#define IIO_VAL_INT_PLUS_NANO 3
59#define IIO_VAL_INT_PLUS_MICRO_DB 4 59#define IIO_VAL_INT_PLUS_MICRO_DB 4
60#define IIO_VAL_FRACTIONAL 10
60 61
61#endif /* _IIO_TYPES_H_ */ 62#endif /* _IIO_TYPES_H_ */
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 6ac8e50c6cf5..2c7223d7e73b 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -39,5 +39,32 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
39{ 39{
40 return 0; 40 return 0;
41} 41}
42
42#endif /* CONFIG_IMA_H */ 43#endif /* CONFIG_IMA_H */
44
45#ifdef CONFIG_IMA_APPRAISE
46extern void ima_inode_post_setattr(struct dentry *dentry);
47extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
48 const void *xattr_value, size_t xattr_value_len);
49extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
50#else
51static inline void ima_inode_post_setattr(struct dentry *dentry)
52{
53 return;
54}
55
56static inline int ima_inode_setxattr(struct dentry *dentry,
57 const char *xattr_name,
58 const void *xattr_value,
59 size_t xattr_value_len)
60{
61 return 0;
62}
63
64static inline int ima_inode_removexattr(struct dentry *dentry,
65 const char *xattr_name)
66{
67 return 0;
68}
69#endif /* CONFIG_IMA_APPRAISE_H */
43#endif /* _LINUX_IMA_H */ 70#endif /* _LINUX_IMA_H */
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index f1362b5447fc..e788c186ed3a 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -159,6 +159,7 @@ struct inet_diag_handler {
159struct inet_connection_sock; 159struct inet_connection_sock;
160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, 160int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
161 struct sk_buff *skb, struct inet_diag_req_v2 *req, 161 struct sk_buff *skb, struct inet_diag_req_v2 *req,
162 struct user_namespace *user_ns,
162 u32 pid, u32 seq, u16 nlmsg_flags, 163 u32 pid, u32 seq, u16 nlmsg_flags,
163 const struct nlmsghdr *unlh); 164 const struct nlmsghdr *unlh);
164void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, 165void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb,
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 67f9ddacb70c..d032780d0ce5 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -104,9 +104,14 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
104#define IN_DEV_ANDCONF(in_dev, attr) \ 104#define IN_DEV_ANDCONF(in_dev, attr) \
105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ 105 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
106 IN_DEV_CONF_GET((in_dev), attr)) 106 IN_DEV_CONF_GET((in_dev), attr))
107#define IN_DEV_ORCONF(in_dev, attr) \ 107
108 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ 108#define IN_DEV_NET_ORCONF(in_dev, net, attr) \
109 (IPV4_DEVCONF_ALL(net, attr) || \
109 IN_DEV_CONF_GET((in_dev), attr)) 110 IN_DEV_CONF_GET((in_dev), attr))
111
112#define IN_DEV_ORCONF(in_dev, attr) \
113 IN_DEV_NET_ORCONF(in_dev, dev_net(in_dev->dev), attr)
114
110#define IN_DEV_MAXCONF(in_dev, attr) \ 115#define IN_DEV_MAXCONF(in_dev, attr) \
111 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ 116 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
112 IN_DEV_CONF_GET((in_dev), attr))) 117 IN_DEV_CONF_GET((in_dev), attr)))
@@ -133,6 +138,8 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
133 IN_DEV_ORCONF((in_dev), \ 138 IN_DEV_ORCONF((in_dev), \
134 PROMOTE_SECONDARIES) 139 PROMOTE_SECONDARIES)
135#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET) 140#define IN_DEV_ROUTE_LOCALNET(in_dev) IN_DEV_ORCONF(in_dev, ROUTE_LOCALNET)
141#define IN_DEV_NET_ROUTE_LOCALNET(in_dev, net) \
142 IN_DEV_NET_ORCONF(in_dev, net, ROUTE_LOCALNET)
136 143
137#define IN_DEV_RX_REDIRECTS(in_dev) \ 144#define IN_DEV_RX_REDIRECTS(in_dev) \
138 ((IN_DEV_FORWARD(in_dev) && \ 145 ((IN_DEV_FORWARD(in_dev) && \
diff --git a/include/linux/init.h b/include/linux/init.h
index 5e664f671615..e59041e21df3 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,11 +43,22 @@
43 discard it in modules) */ 43 discard it in modules) */
44#define __init __section(.init.text) __cold notrace 44#define __init __section(.init.text) __cold notrace
45#define __initdata __section(.init.data) 45#define __initdata __section(.init.data)
46#define __initconst __section(.init.rodata) 46#define __initconst __constsection(.init.rodata)
47#define __exitdata __section(.exit.data) 47#define __exitdata __section(.exit.data)
48#define __exit_call __used __section(.exitcall.exit) 48#define __exit_call __used __section(.exitcall.exit)
49 49
50/* 50/*
51 * Some architecture have tool chains which do not handle rodata attributes
52 * correctly. For those disable special sections for const, so that other
53 * architectures can annotate correctly.
54 */
55#ifdef CONFIG_BROKEN_RODATA
56#define __constsection(x)
57#else
58#define __constsection(x) __section(x)
59#endif
60
61/*
51 * modpost check for section mismatches during the kernel build. 62 * modpost check for section mismatches during the kernel build.
52 * A section mismatch happens when there are references from a 63 * A section mismatch happens when there are references from a
53 * code or data section to an init section (both code or data). 64 * code or data section to an init section (both code or data).
@@ -66,7 +77,7 @@
66 */ 77 */
67#define __ref __section(.ref.text) noinline 78#define __ref __section(.ref.text) noinline
68#define __refdata __section(.ref.data) 79#define __refdata __section(.ref.data)
69#define __refconst __section(.ref.rodata) 80#define __refconst __constsection(.ref.rodata)
70 81
71/* compatibility defines */ 82/* compatibility defines */
72#define __init_refok __ref 83#define __init_refok __ref
@@ -85,26 +96,26 @@
85/* Used for HOTPLUG */ 96/* Used for HOTPLUG */
86#define __devinit __section(.devinit.text) __cold notrace 97#define __devinit __section(.devinit.text) __cold notrace
87#define __devinitdata __section(.devinit.data) 98#define __devinitdata __section(.devinit.data)
88#define __devinitconst __section(.devinit.rodata) 99#define __devinitconst __constsection(.devinit.rodata)
89#define __devexit __section(.devexit.text) __exitused __cold notrace 100#define __devexit __section(.devexit.text) __exitused __cold notrace
90#define __devexitdata __section(.devexit.data) 101#define __devexitdata __section(.devexit.data)
91#define __devexitconst __section(.devexit.rodata) 102#define __devexitconst __constsection(.devexit.rodata)
92 103
93/* Used for HOTPLUG_CPU */ 104/* Used for HOTPLUG_CPU */
94#define __cpuinit __section(.cpuinit.text) __cold notrace 105#define __cpuinit __section(.cpuinit.text) __cold notrace
95#define __cpuinitdata __section(.cpuinit.data) 106#define __cpuinitdata __section(.cpuinit.data)
96#define __cpuinitconst __section(.cpuinit.rodata) 107#define __cpuinitconst __constsection(.cpuinit.rodata)
97#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace 108#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
98#define __cpuexitdata __section(.cpuexit.data) 109#define __cpuexitdata __section(.cpuexit.data)
99#define __cpuexitconst __section(.cpuexit.rodata) 110#define __cpuexitconst __constsection(.cpuexit.rodata)
100 111
101/* Used for MEMORY_HOTPLUG */ 112/* Used for MEMORY_HOTPLUG */
102#define __meminit __section(.meminit.text) __cold notrace 113#define __meminit __section(.meminit.text) __cold notrace
103#define __meminitdata __section(.meminit.data) 114#define __meminitdata __section(.meminit.data)
104#define __meminitconst __section(.meminit.rodata) 115#define __meminitconst __constsection(.meminit.rodata)
105#define __memexit __section(.memexit.text) __exitused __cold notrace 116#define __memexit __section(.memexit.text) __exitused __cold notrace
106#define __memexitdata __section(.memexit.data) 117#define __memexitdata __section(.memexit.data)
107#define __memexitconst __section(.memexit.rodata) 118#define __memexitconst __constsection(.memexit.rodata)
108 119
109/* For assembly routines */ 120/* For assembly routines */
110#define __HEAD .section ".head.text","ax" 121#define __HEAD .section ".head.text","ax"
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 89f1cb1056f0..6d087c5f57f7 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -92,7 +92,7 @@ extern struct group_info init_groups;
92 92
93#ifdef CONFIG_AUDITSYSCALL 93#ifdef CONFIG_AUDITSYSCALL
94#define INIT_IDS \ 94#define INIT_IDS \
95 .loginuid = -1, \ 95 .loginuid = INVALID_UID, \
96 .sessionid = -1, 96 .sessionid = -1,
97#else 97#else
98#define INIT_IDS 98#define INIT_IDS
diff --git a/include/linux/input.h b/include/linux/input.h
index 725dcd0f63a4..ba4874302939 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1169,6 +1169,18 @@ struct ff_effect {
1169#include <linux/mod_devicetable.h> 1169#include <linux/mod_devicetable.h>
1170 1170
1171/** 1171/**
1172 * struct input_value - input value representation
1173 * @type: type of value (EV_KEY, EV_ABS, etc)
1174 * @code: the value code
1175 * @value: the value
1176 */
1177struct input_value {
1178 __u16 type;
1179 __u16 code;
1180 __s32 value;
1181};
1182
1183/**
1172 * struct input_dev - represents an input device 1184 * struct input_dev - represents an input device
1173 * @name: name of the device 1185 * @name: name of the device
1174 * @phys: physical path to the device in the system hierarchy 1186 * @phys: physical path to the device in the system hierarchy
@@ -1203,11 +1215,7 @@ struct ff_effect {
1203 * software autorepeat 1215 * software autorepeat
1204 * @timer: timer for software autorepeat 1216 * @timer: timer for software autorepeat
1205 * @rep: current values for autorepeat parameters (delay, rate) 1217 * @rep: current values for autorepeat parameters (delay, rate)
1206 * @mt: pointer to array of struct input_mt_slot holding current values 1218 * @mt: pointer to multitouch state
1207 * of tracked contacts
1208 * @mtsize: number of MT slots the device uses
1209 * @slot: MT slot currently being transmitted
1210 * @trkid: stores MT tracking ID for the current contact
1211 * @absinfo: array of &struct input_absinfo elements holding information 1219 * @absinfo: array of &struct input_absinfo elements holding information
1212 * about absolute axes (current value, min, max, flat, fuzz, 1220 * about absolute axes (current value, min, max, flat, fuzz,
1213 * resolution) 1221 * resolution)
@@ -1244,7 +1252,6 @@ struct ff_effect {
1244 * last user closes the device 1252 * last user closes the device
1245 * @going_away: marks devices that are in a middle of unregistering and 1253 * @going_away: marks devices that are in a middle of unregistering and
1246 * causes input_open_device*() fail with -ENODEV. 1254 * causes input_open_device*() fail with -ENODEV.
1247 * @sync: set to %true when there were no new events since last EV_SYN
1248 * @dev: driver model's view of this device 1255 * @dev: driver model's view of this device
1249 * @h_list: list of input handles associated with the device. When 1256 * @h_list: list of input handles associated with the device. When
1250 * accessing the list dev->mutex must be held 1257 * accessing the list dev->mutex must be held
@@ -1287,10 +1294,7 @@ struct input_dev {
1287 1294
1288 int rep[REP_CNT]; 1295 int rep[REP_CNT];
1289 1296
1290 struct input_mt_slot *mt; 1297 struct input_mt *mt;
1291 int mtsize;
1292 int slot;
1293 int trkid;
1294 1298
1295 struct input_absinfo *absinfo; 1299 struct input_absinfo *absinfo;
1296 1300
@@ -1312,12 +1316,14 @@ struct input_dev {
1312 unsigned int users; 1316 unsigned int users;
1313 bool going_away; 1317 bool going_away;
1314 1318
1315 bool sync;
1316
1317 struct device dev; 1319 struct device dev;
1318 1320
1319 struct list_head h_list; 1321 struct list_head h_list;
1320 struct list_head node; 1322 struct list_head node;
1323
1324 unsigned int num_vals;
1325 unsigned int max_vals;
1326 struct input_value *vals;
1321}; 1327};
1322#define to_input_dev(d) container_of(d, struct input_dev, dev) 1328#define to_input_dev(d) container_of(d, struct input_dev, dev)
1323 1329
@@ -1378,6 +1384,9 @@ struct input_handle;
1378 * @event: event handler. This method is being called by input core with 1384 * @event: event handler. This method is being called by input core with
1379 * interrupts disabled and dev->event_lock spinlock held and so 1385 * interrupts disabled and dev->event_lock spinlock held and so
1380 * it may not sleep 1386 * it may not sleep
1387 * @events: event sequence handler. This method is being called by
1388 * input core with interrupts disabled and dev->event_lock
1389 * spinlock held and so it may not sleep
1381 * @filter: similar to @event; separates normal event handlers from 1390 * @filter: similar to @event; separates normal event handlers from
1382 * "filters". 1391 * "filters".
1383 * @match: called after comparing device's id with handler's id_table 1392 * @match: called after comparing device's id with handler's id_table
@@ -1414,6 +1423,8 @@ struct input_handler {
1414 void *private; 1423 void *private;
1415 1424
1416 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1425 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1426 void (*events)(struct input_handle *handle,
1427 const struct input_value *vals, unsigned int count);
1417 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1428 bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1418 bool (*match)(struct input_handler *handler, struct input_dev *dev); 1429 bool (*match)(struct input_handler *handler, struct input_dev *dev);
1419 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1430 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index f86737586e19..cc5cca774bab 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -15,12 +15,41 @@
15 15
16#define TRKID_MAX 0xffff 16#define TRKID_MAX 0xffff
17 17
18#define INPUT_MT_POINTER 0x0001 /* pointer device, e.g. trackpad */
19#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
20#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
21#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
22
18/** 23/**
19 * struct input_mt_slot - represents the state of an input MT slot 24 * struct input_mt_slot - represents the state of an input MT slot
20 * @abs: holds current values of ABS_MT axes for this slot 25 * @abs: holds current values of ABS_MT axes for this slot
26 * @frame: last frame at which input_mt_report_slot_state() was called
27 * @key: optional driver designation of this slot
21 */ 28 */
22struct input_mt_slot { 29struct input_mt_slot {
23 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; 30 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
31 unsigned int frame;
32 unsigned int key;
33};
34
35/**
36 * struct input_mt - state of tracked contacts
37 * @trkid: stores MT tracking ID for the next contact
38 * @num_slots: number of MT slots the device uses
39 * @slot: MT slot currently being transmitted
40 * @flags: input_mt operation flags
41 * @frame: increases every time input_mt_sync_frame() is called
42 * @red: reduced cost matrix for in-kernel tracking
43 * @slots: array of slots holding current values of tracked contacts
44 */
45struct input_mt {
46 int trkid;
47 int num_slots;
48 int slot;
49 unsigned int flags;
50 unsigned int frame;
51 int *red;
52 struct input_mt_slot slots[];
24}; 53};
25 54
26static inline void input_mt_set_value(struct input_mt_slot *slot, 55static inline void input_mt_set_value(struct input_mt_slot *slot,
@@ -35,12 +64,18 @@ static inline int input_mt_get_value(const struct input_mt_slot *slot,
35 return slot->abs[code - ABS_MT_FIRST]; 64 return slot->abs[code - ABS_MT_FIRST];
36} 65}
37 66
38int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots); 67static inline bool input_mt_is_active(const struct input_mt_slot *slot)
68{
69 return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0;
70}
71
72int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
73 unsigned int flags);
39void input_mt_destroy_slots(struct input_dev *dev); 74void input_mt_destroy_slots(struct input_dev *dev);
40 75
41static inline int input_mt_new_trkid(struct input_dev *dev) 76static inline int input_mt_new_trkid(struct input_mt *mt)
42{ 77{
43 return dev->trkid++ & TRKID_MAX; 78 return mt->trkid++ & TRKID_MAX;
44} 79}
45 80
46static inline void input_mt_slot(struct input_dev *dev, int slot) 81static inline void input_mt_slot(struct input_dev *dev, int slot)
@@ -64,4 +99,20 @@ void input_mt_report_slot_state(struct input_dev *dev,
64void input_mt_report_finger_count(struct input_dev *dev, int count); 99void input_mt_report_finger_count(struct input_dev *dev, int count);
65void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 100void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
66 101
102void input_mt_sync_frame(struct input_dev *dev);
103
104/**
105 * struct input_mt_pos - contact position
106 * @x: horizontal coordinate
107 * @y: vertical coordinate
108 */
109struct input_mt_pos {
110 s16 x, y;
111};
112
113int input_mt_assign_slots(struct input_dev *dev, int *slots,
114 const struct input_mt_pos *pos, int num_pos);
115
116int input_mt_get_slot_by_key(struct input_dev *dev, int key);
117
67#endif 118#endif
diff --git a/include/linux/input/tegra_kbc.h b/include/linux/input/tegra_kbc.h
new file mode 100644
index 000000000000..a13025612939
--- /dev/null
+++ b/include/linux/input/tegra_kbc.h
@@ -0,0 +1,62 @@
1/*
2 * Platform definitions for tegra-kbc keyboard input driver
3 *
4 * Copyright (c) 2010-2011, 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 ASMARM_ARCH_TEGRA_KBC_H
22#define ASMARM_ARCH_TEGRA_KBC_H
23
24#include <linux/types.h>
25#include <linux/input/matrix_keypad.h>
26
27#define KBC_MAX_GPIO 24
28#define KBC_MAX_KPENT 8
29
30#define KBC_MAX_ROW 16
31#define KBC_MAX_COL 8
32#define KBC_MAX_KEY (KBC_MAX_ROW * KBC_MAX_COL)
33
34enum tegra_pin_type {
35 PIN_CFG_IGNORE,
36 PIN_CFG_COL,
37 PIN_CFG_ROW,
38};
39
40struct tegra_kbc_pin_cfg {
41 enum tegra_pin_type type;
42 unsigned char num;
43};
44
45struct tegra_kbc_wake_key {
46 u8 row:4;
47 u8 col:4;
48};
49
50struct tegra_kbc_platform_data {
51 unsigned int debounce_cnt;
52 unsigned int repeat_cnt;
53
54 struct tegra_kbc_pin_cfg pin_cfg[KBC_MAX_GPIO];
55 const struct matrix_keymap_data *keymap_data;
56
57 u32 wakeup_key;
58 bool wakeup;
59 bool use_fn_map;
60 bool use_ghost_filter;
61};
62#endif
diff --git a/include/linux/integrity.h b/include/linux/integrity.h
index a0c41256cb92..66c5fe9550a5 100644
--- a/include/linux/integrity.h
+++ b/include/linux/integrity.h
@@ -22,13 +22,14 @@ enum integrity_status {
22 22
23/* List of EVM protected security xattrs */ 23/* List of EVM protected security xattrs */
24#ifdef CONFIG_INTEGRITY 24#ifdef CONFIG_INTEGRITY
25extern int integrity_inode_alloc(struct inode *inode); 25extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode);
26extern void integrity_inode_free(struct inode *inode); 26extern void integrity_inode_free(struct inode *inode);
27 27
28#else 28#else
29static inline int integrity_inode_alloc(struct inode *inode) 29static inline struct integrity_iint_cache *
30 integrity_inode_get(struct inode *inode)
30{ 31{
31 return 0; 32 return NULL;
32} 33}
33 34
34static inline void integrity_inode_free(struct inode *inode) 35static inline void integrity_inode_free(struct inode *inode)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index c5f856a040b9..5e4e6170f43a 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -430,6 +430,8 @@ enum
430 NR_SOFTIRQS 430 NR_SOFTIRQS
431}; 431};
432 432
433#define SOFTIRQ_STOP_IDLE_MASK (~(1 << RCU_SOFTIRQ))
434
433/* map softirq index to softirq name. update 'softirq_to_name' in 435/* map softirq index to softirq name. update 'softirq_to_name' in
434 * kernel/softirq.c when adding a new softirq. 436 * kernel/softirq.c when adding a new softirq.
435 */ 437 */
diff --git a/include/linux/interval_tree.h b/include/linux/interval_tree.h
new file mode 100644
index 000000000000..724556aa3c95
--- /dev/null
+++ b/include/linux/interval_tree.h
@@ -0,0 +1,27 @@
1#ifndef _LINUX_INTERVAL_TREE_H
2#define _LINUX_INTERVAL_TREE_H
3
4#include <linux/rbtree.h>
5
6struct interval_tree_node {
7 struct rb_node rb;
8 unsigned long start; /* Start of interval */
9 unsigned long last; /* Last location _in_ interval */
10 unsigned long __subtree_last;
11};
12
13extern void
14interval_tree_insert(struct interval_tree_node *node, struct rb_root *root);
15
16extern void
17interval_tree_remove(struct interval_tree_node *node, struct rb_root *root);
18
19extern struct interval_tree_node *
20interval_tree_iter_first(struct rb_root *root,
21 unsigned long start, unsigned long last);
22
23extern struct interval_tree_node *
24interval_tree_iter_next(struct interval_tree_node *node,
25 unsigned long start, unsigned long last);
26
27#endif /* _LINUX_INTERVAL_TREE_H */
diff --git a/include/linux/interval_tree_generic.h b/include/linux/interval_tree_generic.h
new file mode 100644
index 000000000000..58370e1862ad
--- /dev/null
+++ b/include/linux/interval_tree_generic.h
@@ -0,0 +1,191 @@
1/*
2 Interval Trees
3 (C) 2012 Michel Lespinasse <walken@google.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 include/linux/interval_tree_generic.h
20*/
21
22#include <linux/rbtree_augmented.h>
23
24/*
25 * Template for implementing interval trees
26 *
27 * ITSTRUCT: struct type of the interval tree nodes
28 * ITRB: name of struct rb_node field within ITSTRUCT
29 * ITTYPE: type of the interval endpoints
30 * ITSUBTREE: name of ITTYPE field within ITSTRUCT holding last-in-subtree
31 * ITSTART(n): start endpoint of ITSTRUCT node n
32 * ITLAST(n): last endpoint of ITSTRUCT node n
33 * ITSTATIC: 'static' or empty
34 * ITPREFIX: prefix to use for the inline tree definitions
35 *
36 * Note - before using this, please consider if non-generic version
37 * (interval_tree.h) would work for you...
38 */
39
40#define INTERVAL_TREE_DEFINE(ITSTRUCT, ITRB, ITTYPE, ITSUBTREE, \
41 ITSTART, ITLAST, ITSTATIC, ITPREFIX) \
42 \
43/* Callbacks for augmented rbtree insert and remove */ \
44 \
45static inline ITTYPE ITPREFIX ## _compute_subtree_last(ITSTRUCT *node) \
46{ \
47 ITTYPE max = ITLAST(node), subtree_last; \
48 if (node->ITRB.rb_left) { \
49 subtree_last = rb_entry(node->ITRB.rb_left, \
50 ITSTRUCT, ITRB)->ITSUBTREE; \
51 if (max < subtree_last) \
52 max = subtree_last; \
53 } \
54 if (node->ITRB.rb_right) { \
55 subtree_last = rb_entry(node->ITRB.rb_right, \
56 ITSTRUCT, ITRB)->ITSUBTREE; \
57 if (max < subtree_last) \
58 max = subtree_last; \
59 } \
60 return max; \
61} \
62 \
63RB_DECLARE_CALLBACKS(static, ITPREFIX ## _augment, ITSTRUCT, ITRB, \
64 ITTYPE, ITSUBTREE, ITPREFIX ## _compute_subtree_last) \
65 \
66/* Insert / remove interval nodes from the tree */ \
67 \
68ITSTATIC void ITPREFIX ## _insert(ITSTRUCT *node, struct rb_root *root) \
69{ \
70 struct rb_node **link = &root->rb_node, *rb_parent = NULL; \
71 ITTYPE start = ITSTART(node), last = ITLAST(node); \
72 ITSTRUCT *parent; \
73 \
74 while (*link) { \
75 rb_parent = *link; \
76 parent = rb_entry(rb_parent, ITSTRUCT, ITRB); \
77 if (parent->ITSUBTREE < last) \
78 parent->ITSUBTREE = last; \
79 if (start < ITSTART(parent)) \
80 link = &parent->ITRB.rb_left; \
81 else \
82 link = &parent->ITRB.rb_right; \
83 } \
84 \
85 node->ITSUBTREE = last; \
86 rb_link_node(&node->ITRB, rb_parent, link); \
87 rb_insert_augmented(&node->ITRB, root, &ITPREFIX ## _augment); \
88} \
89 \
90ITSTATIC void ITPREFIX ## _remove(ITSTRUCT *node, struct rb_root *root) \
91{ \
92 rb_erase_augmented(&node->ITRB, root, &ITPREFIX ## _augment); \
93} \
94 \
95/* \
96 * Iterate over intervals intersecting [start;last] \
97 * \
98 * Note that a node's interval intersects [start;last] iff: \
99 * Cond1: ITSTART(node) <= last \
100 * and \
101 * Cond2: start <= ITLAST(node) \
102 */ \
103 \
104static ITSTRUCT * \
105ITPREFIX ## _subtree_search(ITSTRUCT *node, ITTYPE start, ITTYPE last) \
106{ \
107 while (true) { \
108 /* \
109 * Loop invariant: start <= node->ITSUBTREE \
110 * (Cond2 is satisfied by one of the subtree nodes) \
111 */ \
112 if (node->ITRB.rb_left) { \
113 ITSTRUCT *left = rb_entry(node->ITRB.rb_left, \
114 ITSTRUCT, ITRB); \
115 if (start <= left->ITSUBTREE) { \
116 /* \
117 * Some nodes in left subtree satisfy Cond2. \
118 * Iterate to find the leftmost such node N. \
119 * If it also satisfies Cond1, that's the \
120 * match we are looking for. Otherwise, there \
121 * is no matching interval as nodes to the \
122 * right of N can't satisfy Cond1 either. \
123 */ \
124 node = left; \
125 continue; \
126 } \
127 } \
128 if (ITSTART(node) <= last) { /* Cond1 */ \
129 if (start <= ITLAST(node)) /* Cond2 */ \
130 return node; /* node is leftmost match */ \
131 if (node->ITRB.rb_right) { \
132 node = rb_entry(node->ITRB.rb_right, \
133 ITSTRUCT, ITRB); \
134 if (start <= node->ITSUBTREE) \
135 continue; \
136 } \
137 } \
138 return NULL; /* No match */ \
139 } \
140} \
141 \
142ITSTATIC ITSTRUCT * \
143ITPREFIX ## _iter_first(struct rb_root *root, ITTYPE start, ITTYPE last) \
144{ \
145 ITSTRUCT *node; \
146 \
147 if (!root->rb_node) \
148 return NULL; \
149 node = rb_entry(root->rb_node, ITSTRUCT, ITRB); \
150 if (node->ITSUBTREE < start) \
151 return NULL; \
152 return ITPREFIX ## _subtree_search(node, start, last); \
153} \
154 \
155ITSTATIC ITSTRUCT * \
156ITPREFIX ## _iter_next(ITSTRUCT *node, ITTYPE start, ITTYPE last) \
157{ \
158 struct rb_node *rb = node->ITRB.rb_right, *prev; \
159 \
160 while (true) { \
161 /* \
162 * Loop invariants: \
163 * Cond1: ITSTART(node) <= last \
164 * rb == node->ITRB.rb_right \
165 * \
166 * First, search right subtree if suitable \
167 */ \
168 if (rb) { \
169 ITSTRUCT *right = rb_entry(rb, ITSTRUCT, ITRB); \
170 if (start <= right->ITSUBTREE) \
171 return ITPREFIX ## _subtree_search(right, \
172 start, last); \
173 } \
174 \
175 /* Move up the tree until we come from a node's left child */ \
176 do { \
177 rb = rb_parent(&node->ITRB); \
178 if (!rb) \
179 return NULL; \
180 prev = &node->ITRB; \
181 node = rb_entry(rb, ITSTRUCT, ITRB); \
182 rb = node->ITRB.rb_right; \
183 } while (prev == rb); \
184 \
185 /* Check if the node intersects [start;last] */ \
186 if (last < ITSTART(node)) /* !Cond1 */ \
187 return NULL; \
188 else if (start <= ITLAST(node)) /* Cond2 */ \
189 return node; \
190 } \
191}
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 7e83370e6fd2..f3b99e1c1042 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -256,72 +256,78 @@ static inline void iommu_set_fault_handler(struct iommu_domain *domain,
256{ 256{
257} 257}
258 258
259int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) 259static inline int iommu_attach_group(struct iommu_domain *domain,
260 struct iommu_group *group)
260{ 261{
261 return -ENODEV; 262 return -ENODEV;
262} 263}
263 264
264void iommu_detach_group(struct iommu_domain *domain, struct iommu_group *group) 265static inline void iommu_detach_group(struct iommu_domain *domain,
266 struct iommu_group *group)
265{ 267{
266} 268}
267 269
268struct iommu_group *iommu_group_alloc(void) 270static inline struct iommu_group *iommu_group_alloc(void)
269{ 271{
270 return ERR_PTR(-ENODEV); 272 return ERR_PTR(-ENODEV);
271} 273}
272 274
273void *iommu_group_get_iommudata(struct iommu_group *group) 275static inline void *iommu_group_get_iommudata(struct iommu_group *group)
274{ 276{
275 return NULL; 277 return NULL;
276} 278}
277 279
278void iommu_group_set_iommudata(struct iommu_group *group, void *iommu_data, 280static inline void iommu_group_set_iommudata(struct iommu_group *group,
279 void (*release)(void *iommu_data)) 281 void *iommu_data,
282 void (*release)(void *iommu_data))
280{ 283{
281} 284}
282 285
283int iommu_group_set_name(struct iommu_group *group, const char *name) 286static inline int iommu_group_set_name(struct iommu_group *group,
287 const char *name)
284{ 288{
285 return -ENODEV; 289 return -ENODEV;
286} 290}
287 291
288int iommu_group_add_device(struct iommu_group *group, struct device *dev) 292static inline int iommu_group_add_device(struct iommu_group *group,
293 struct device *dev)
289{ 294{
290 return -ENODEV; 295 return -ENODEV;
291} 296}
292 297
293void iommu_group_remove_device(struct device *dev) 298static inline void iommu_group_remove_device(struct device *dev)
294{ 299{
295} 300}
296 301
297int iommu_group_for_each_dev(struct iommu_group *group, void *data, 302static inline int iommu_group_for_each_dev(struct iommu_group *group,
298 int (*fn)(struct device *, void *)) 303 void *data,
304 int (*fn)(struct device *, void *))
299{ 305{
300 return -ENODEV; 306 return -ENODEV;
301} 307}
302 308
303struct iommu_group *iommu_group_get(struct device *dev) 309static inline struct iommu_group *iommu_group_get(struct device *dev)
304{ 310{
305 return NULL; 311 return NULL;
306} 312}
307 313
308void iommu_group_put(struct iommu_group *group) 314static inline void iommu_group_put(struct iommu_group *group)
309{ 315{
310} 316}
311 317
312int iommu_group_register_notifier(struct iommu_group *group, 318static inline int iommu_group_register_notifier(struct iommu_group *group,
313 struct notifier_block *nb) 319 struct notifier_block *nb)
314{ 320{
315 return -ENODEV; 321 return -ENODEV;
316} 322}
317 323
318int iommu_group_unregister_notifier(struct iommu_group *group, 324static inline int iommu_group_unregister_notifier(struct iommu_group *group,
319 struct notifier_block *nb) 325 struct notifier_block *nb)
320{ 326{
321 return 0; 327 return 0;
322} 328}
323 329
324int iommu_group_id(struct iommu_group *group) 330static inline int iommu_group_id(struct iommu_group *group)
325{ 331{
326 return -ENODEV; 332 return -ENODEV;
327} 333}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 589e0e75efae..85ac9b9b72a2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -29,8 +29,9 @@ struct resource {
29#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 29#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
30 30
31#define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ 31#define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */
32#define IORESOURCE_IO 0x00000100 32#define IORESOURCE_IO 0x00000100 /* PCI/ISA I/O ports */
33#define IORESOURCE_MEM 0x00000200 33#define IORESOURCE_MEM 0x00000200
34#define IORESOURCE_REG 0x00000300 /* Register offsets */
34#define IORESOURCE_IRQ 0x00000400 35#define IORESOURCE_IRQ 0x00000400
35#define IORESOURCE_DMA 0x00000800 36#define IORESOURCE_DMA 0x00000800
36#define IORESOURCE_BUS 0x00001000 37#define IORESOURCE_BUS 0x00001000
diff --git a/include/linux/ip6_tunnel.h b/include/linux/ip6_tunnel.h
index bf22b0317902..48af63c9a48d 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/linux/ip6_tunnel.h
@@ -31,4 +31,21 @@ struct ip6_tnl_parm {
31 struct in6_addr raddr; /* remote tunnel end-point address */ 31 struct in6_addr raddr; /* remote tunnel end-point address */
32}; 32};
33 33
34struct ip6_tnl_parm2 {
35 char name[IFNAMSIZ]; /* name of tunnel device */
36 int link; /* ifindex of underlying L2 interface */
37 __u8 proto; /* tunnel protocol */
38 __u8 encap_limit; /* encapsulation limit for tunnel */
39 __u8 hop_limit; /* hop limit for tunnel */
40 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
41 __u32 flags; /* tunnel flags */
42 struct in6_addr laddr; /* local tunnel end-point address */
43 struct in6_addr raddr; /* remote tunnel end-point address */
44
45 __be16 i_flags;
46 __be16 o_flags;
47 __be32 i_key;
48 __be32 o_key;
49};
50
34#endif 51#endif
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index 30e816148df4..ca833fdc3138 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -79,6 +79,7 @@ struct ipc_kludge {
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81#include <linux/spinlock.h> 81#include <linux/spinlock.h>
82#include <linux/uidgid.h>
82 83
83#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 84#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
84 85
@@ -89,10 +90,10 @@ struct kern_ipc_perm
89 int deleted; 90 int deleted;
90 int id; 91 int id;
91 key_t key; 92 key_t key;
92 uid_t uid; 93 kuid_t uid;
93 gid_t gid; 94 kgid_t gid;
94 uid_t cuid; 95 kuid_t cuid;
95 gid_t cgid; 96 kgid_t cgid;
96 umode_t mode; 97 umode_t mode;
97 unsigned long seq; 98 unsigned long seq;
98 void *security; 99 void *security;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 879db26ec401..0b94e91ed685 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -256,6 +256,7 @@ struct inet6_skb_parm {
256#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 256#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
257 __u16 dsthao; 257 __u16 dsthao;
258#endif 258#endif
259 __u16 frag_max_size;
259 260
260#define IP6SKB_XFRM_TRANSFORMED 1 261#define IP6SKB_XFRM_TRANSFORMED 1
261#define IP6SKB_FORWARDED 2 262#define IP6SKB_FORWARDED 2
diff --git a/include/linux/mfd/anatop.h b/include/linux/irqchip/bcm2835.h
index 7f92acf03d9e..48a859bc9dca 100644
--- a/include/linux/mfd/anatop.h
+++ b/include/linux/irqchip/bcm2835.h
@@ -1,8 +1,5 @@
1/* 1/*
2 * anatop.h - Anatop MFD driver 2 * Copyright (C) 2010 Broadcom
3 *
4 * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
5 * Copyright (C) 2012 Linaro
6 * 3 *
7 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
@@ -19,22 +16,14 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 17 */
21 18
22#ifndef __LINUX_MFD_ANATOP_H 19#ifndef __LINUX_IRQCHIP_BCM2835_H_
23#define __LINUX_MFD_ANATOP_H 20#define __LINUX_IRQCHIP_BCM2835_H_
24 21
25#include <linux/spinlock.h> 22#include <asm/exception.h>
26 23
27/** 24extern void bcm2835_init_irq(void);
28 * anatop - MFD data
29 * @ioreg: ioremap register
30 * @reglock: spinlock for register read/write
31 */
32struct anatop {
33 void *ioreg;
34 spinlock_t reglock;
35};
36 25
37extern u32 anatop_read_reg(struct anatop *, u32); 26extern asmlinkage void __exception_irq_entry bcm2835_handle_irq(
38extern void anatop_write_reg(struct anatop *, u32, u32, u32); 27 struct pt_regs *regs);
39 28
40#endif /* __LINUX_MFD_ANATOP_H */ 29#endif
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 9a323d12de1c..0ba014c55056 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -10,12 +10,10 @@
10 10
11struct irq_affinity_notify; 11struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct timer_rand_state;
14struct module; 13struct module;
15/** 14/**
16 * struct irq_desc - interrupt descriptor 15 * struct irq_desc - interrupt descriptor
17 * @irq_data: per irq and chip data passed down to chip functions 16 * @irq_data: per irq and chip data passed down to chip functions
18 * @timer_rand_state: pointer to timer rand state struct
19 * @kstat_irqs: irq stats per cpu 17 * @kstat_irqs: irq stats per cpu
20 * @handle_irq: highlevel irq-events handler 18 * @handle_irq: highlevel irq-events handler
21 * @preflow_handler: handler called before the flow handler (currently used by sparc) 19 * @preflow_handler: handler called before the flow handler (currently used by sparc)
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
deleted file mode 100644
index ad700a60c158..000000000000
--- a/include/linux/istallion.h
+++ /dev/null
@@ -1,123 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * istallion.h -- stallion intelligent multiport serial driver.
5 *
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/*****************************************************************************/
25#ifndef _ISTALLION_H
26#define _ISTALLION_H
27/*****************************************************************************/
28
29/*
30 * Define important driver constants here.
31 */
32#define STL_MAXBRDS 4
33#define STL_MAXPANELS 4
34#define STL_MAXPORTS 64
35#define STL_MAXCHANS (STL_MAXPORTS + 1)
36#define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS)
37
38
39/*
40 * Define a set of structures to hold all the board/panel/port info
41 * for our ports. These will be dynamically allocated as required at
42 * driver initialization time.
43 */
44
45/*
46 * Port and board structures to hold status info about each object.
47 * The board structure contains pointers to structures for each port
48 * connected to it. Panels are not distinguished here, since
49 * communication with the slave board will always be on a per port
50 * basis.
51 */
52struct stliport {
53 unsigned long magic;
54 struct tty_port port;
55 unsigned int portnr;
56 unsigned int panelnr;
57 unsigned int brdnr;
58 unsigned long state;
59 unsigned int devnr;
60 int baud_base;
61 int custom_divisor;
62 int closing_wait;
63 int rc;
64 int argsize;
65 void *argp;
66 unsigned int rxmarkmsk;
67 wait_queue_head_t raw_wait;
68 struct asysigs asig;
69 unsigned long addr;
70 unsigned long rxoffset;
71 unsigned long txoffset;
72 unsigned long sigs;
73 unsigned long pflag;
74 unsigned int rxsize;
75 unsigned int txsize;
76 unsigned char reqbit;
77 unsigned char portidx;
78 unsigned char portbit;
79};
80
81/*
82 * Use a structure of function pointers to do board level operations.
83 * These include, enable/disable, paging shared memory, interrupting, etc.
84 */
85struct stlibrd {
86 unsigned long magic;
87 unsigned int brdnr;
88 unsigned int brdtype;
89 unsigned long state;
90 unsigned int nrpanels;
91 unsigned int nrports;
92 unsigned int nrdevs;
93 unsigned int iobase;
94 int iosize;
95 unsigned long memaddr;
96 void __iomem *membase;
97 unsigned long memsize;
98 int pagesize;
99 int hostoffset;
100 int slaveoffset;
101 int bitsize;
102 int enabval;
103 unsigned int panels[STL_MAXPANELS];
104 int panelids[STL_MAXPANELS];
105 void (*init)(struct stlibrd *brdp);
106 void (*enable)(struct stlibrd *brdp);
107 void (*reenable)(struct stlibrd *brdp);
108 void (*disable)(struct stlibrd *brdp);
109 void __iomem *(*getmemptr)(struct stlibrd *brdp, unsigned long offset, int line);
110 void (*intr)(struct stlibrd *brdp);
111 void (*reset)(struct stlibrd *brdp);
112 struct stliport *ports[STL_MAXPORTS];
113};
114
115
116/*
117 * Define MAGIC numbers used for above structures.
118 */
119#define STLI_PORTMAGIC 0xe671c7a1
120#define STLI_BOARDMAGIC 0x4bc6c825
121
122/*****************************************************************************/
123#endif
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index f334c7fab967..3efc43f3f162 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1125,6 +1125,7 @@ extern int jbd2_journal_destroy (journal_t *);
1125extern int jbd2_journal_recover (journal_t *journal); 1125extern int jbd2_journal_recover (journal_t *journal);
1126extern int jbd2_journal_wipe (journal_t *, int); 1126extern int jbd2_journal_wipe (journal_t *, int);
1127extern int jbd2_journal_skip_recovery (journal_t *); 1127extern int jbd2_journal_skip_recovery (journal_t *);
1128extern void jbd2_journal_update_sb_errno(journal_t *);
1128extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, 1129extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t,
1129 unsigned long, int); 1130 unsigned long, int);
1130extern void __jbd2_journal_abort_hard (journal_t *); 1131extern void __jbd2_journal_abort_hard (journal_t *);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 82680541576d..05e3c2c7a8cf 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -312,7 +312,13 @@ extern void jiffies_to_timespec(const unsigned long jiffies,
312extern unsigned long timeval_to_jiffies(const struct timeval *value); 312extern unsigned long timeval_to_jiffies(const struct timeval *value);
313extern void jiffies_to_timeval(const unsigned long jiffies, 313extern void jiffies_to_timeval(const unsigned long jiffies,
314 struct timeval *value); 314 struct timeval *value);
315
315extern clock_t jiffies_to_clock_t(unsigned long x); 316extern clock_t jiffies_to_clock_t(unsigned long x);
317static inline clock_t jiffies_delta_to_clock_t(long delta)
318{
319 return jiffies_to_clock_t(max(0L, delta));
320}
321
316extern unsigned long clock_t_to_jiffies(unsigned long x); 322extern unsigned long clock_t_to_jiffies(unsigned long x);
317extern u64 jiffies_64_to_clock_t(u64 x); 323extern u64 jiffies_64_to_clock_t(u64 x);
318extern u64 nsec_to_clock_t(u64 x); 324extern u64 nsec_to_clock_t(u64 x);
diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h
index daf4a3a40ee0..b7c8cdc1d422 100644
--- a/include/linux/kbd_kern.h
+++ b/include/linux/kbd_kern.h
@@ -65,7 +65,6 @@ struct kbd_struct {
65 65
66extern int kbd_init(void); 66extern int kbd_init(void);
67 67
68extern unsigned char getledstate(void);
69extern void setledstate(struct kbd_struct *kbd, unsigned int led); 68extern void setledstate(struct kbd_struct *kbd, unsigned int led);
70 69
71extern int do_poke_blanked_console; 70extern int do_poke_blanked_console;
@@ -145,16 +144,4 @@ void compute_shiftstate(void);
145 144
146extern unsigned int keymap_count; 145extern unsigned int keymap_count;
147 146
148/* console.c */
149
150static inline void con_schedule_flip(struct tty_struct *t)
151{
152 unsigned long flags;
153 spin_lock_irqsave(&t->buf.lock, flags);
154 if (t->buf.tail != NULL)
155 t->buf.tail->commit = t->buf.tail->used;
156 spin_unlock_irqrestore(&t->buf.lock, flags);
157 schedule_work(&t->buf.work);
158}
159
160#endif 147#endif
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 42d9e863a313..7f6fe6e015bc 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -13,6 +13,14 @@
13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com> 13 * Copyright (C) 2009 Jason Wessel <jason.wessel@windriver.com>
14 */ 14 */
15 15
16typedef enum {
17 KDB_REPEAT_NONE = 0, /* Do not repeat this command */
18 KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */
19 KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */
20} kdb_repeat_t;
21
22typedef int (*kdb_func_t)(int, const char **);
23
16#ifdef CONFIG_KGDB_KDB 24#ifdef CONFIG_KGDB_KDB
17#include <linux/init.h> 25#include <linux/init.h>
18#include <linux/sched.h> 26#include <linux/sched.h>
@@ -32,14 +40,6 @@ extern atomic_t kdb_event;
32 40
33#define KDB_MAXARGS 16 /* Maximum number of arguments to a function */ 41#define KDB_MAXARGS 16 /* Maximum number of arguments to a function */
34 42
35typedef enum {
36 KDB_REPEAT_NONE = 0, /* Do not repeat this command */
37 KDB_REPEAT_NO_ARGS, /* Repeat the command without arguments */
38 KDB_REPEAT_WITH_ARGS, /* Repeat the command including its arguments */
39} kdb_repeat_t;
40
41typedef int (*kdb_func_t)(int, const char **);
42
43/* KDB return codes from a command or internal kdb function */ 43/* KDB return codes from a command or internal kdb function */
44#define KDB_NOTFOUND (-1) 44#define KDB_NOTFOUND (-1)
45#define KDB_ARGCOUNT (-2) 45#define KDB_ARGCOUNT (-2)
@@ -149,11 +149,14 @@ extern int kdb_register_repeat(char *, kdb_func_t, char *, char *,
149 short, kdb_repeat_t); 149 short, kdb_repeat_t);
150extern int kdb_unregister(char *); 150extern int kdb_unregister(char *);
151#else /* ! CONFIG_KGDB_KDB */ 151#else /* ! CONFIG_KGDB_KDB */
152#define kdb_printf(...) 152static inline __printf(1, 2) int kdb_printf(const char *fmt, ...) { return 0; }
153#define kdb_init(x) 153static inline void kdb_init(int level) {}
154#define kdb_register(...) 154static inline int kdb_register(char *cmd, kdb_func_t func, char *usage,
155#define kdb_register_repeat(...) 155 char *help, short minlen) { return 0; }
156#define kdb_uregister(x) 156static inline int kdb_register_repeat(char *cmd, kdb_func_t func, char *usage,
157 char *help, short minlen,
158 kdb_repeat_t repeat) { return 0; }
159static inline int kdb_unregister(char *cmd) { return 0; }
157#endif /* CONFIG_KGDB_KDB */ 160#endif /* CONFIG_KGDB_KDB */
158enum { 161enum {
159 KDB_NOT_INITIALIZED, 162 KDB_NOT_INITIALIZED,
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 604382143bcf..2451f1f7a1d9 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -82,10 +82,18 @@
82 __x - (__x % (y)); \ 82 __x - (__x % (y)); \
83} \ 83} \
84) 84)
85
86/*
87 * Divide positive or negative dividend by positive divisor and round
88 * to closest integer. Result is undefined for negative divisors.
89 */
85#define DIV_ROUND_CLOSEST(x, divisor)( \ 90#define DIV_ROUND_CLOSEST(x, divisor)( \
86{ \ 91{ \
87 typeof(divisor) __divisor = divisor; \ 92 typeof(x) __x = x; \
88 (((x) + ((__divisor) / 2)) / (__divisor)); \ 93 typeof(divisor) __d = divisor; \
94 (((typeof(x))-1) > 0 || (__x) > 0) ? \
95 (((__x) + ((__d) / 2)) / (__d)) : \
96 (((__x) - ((__d) / 2)) / (__d)); \
89} \ 97} \
90) 98)
91 99
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 2fbd9053c2df..36d12f0884c3 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -130,4 +130,12 @@ extern void account_process_tick(struct task_struct *, int user);
130extern void account_steal_ticks(unsigned long ticks); 130extern void account_steal_ticks(unsigned long ticks);
131extern void account_idle_ticks(unsigned long ticks); 131extern void account_idle_ticks(unsigned long ticks);
132 132
133#ifdef CONFIG_VIRT_CPU_ACCOUNTING
134extern void vtime_task_switch(struct task_struct *prev);
135extern void vtime_account_system(struct task_struct *tsk);
136extern void vtime_account_idle(struct task_struct *tsk);
137#else
138static inline void vtime_task_switch(struct task_struct *prev) { }
139#endif
140
133#endif /* _LINUX_KERNEL_STAT_H */ 141#endif /* _LINUX_KERNEL_STAT_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index cef3b315ba7c..2393b1c040b6 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -24,6 +24,7 @@
24#include <linux/atomic.h> 24#include <linux/atomic.h>
25 25
26#ifdef __KERNEL__ 26#ifdef __KERNEL__
27#include <linux/uidgid.h>
27 28
28/* key handle serial number */ 29/* key handle serial number */
29typedef int32_t key_serial_t; 30typedef int32_t key_serial_t;
@@ -137,8 +138,8 @@ struct key {
137 time_t revoked_at; /* time at which key was revoked */ 138 time_t revoked_at; /* time at which key was revoked */
138 }; 139 };
139 time_t last_used_at; /* last time used for LRU keyring discard */ 140 time_t last_used_at; /* last time used for LRU keyring discard */
140 uid_t uid; 141 kuid_t uid;
141 gid_t gid; 142 kgid_t gid;
142 key_perm_t perm; /* access permissions */ 143 key_perm_t perm; /* access permissions */
143 unsigned short quotalen; /* length added to quota */ 144 unsigned short quotalen; /* length added to quota */
144 unsigned short datalen; /* payload data length 145 unsigned short datalen; /* payload data length
@@ -193,7 +194,7 @@ struct key {
193 194
194extern struct key *key_alloc(struct key_type *type, 195extern struct key *key_alloc(struct key_type *type,
195 const char *desc, 196 const char *desc,
196 uid_t uid, gid_t gid, 197 kuid_t uid, kgid_t gid,
197 const struct cred *cred, 198 const struct cred *cred,
198 key_perm_t perm, 199 key_perm_t perm,
199 unsigned long flags); 200 unsigned long flags);
@@ -262,7 +263,7 @@ extern int key_link(struct key *keyring,
262extern int key_unlink(struct key *keyring, 263extern int key_unlink(struct key *keyring,
263 struct key *key); 264 struct key *key);
264 265
265extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 266extern struct key *keyring_alloc(const char *description, kuid_t uid, kgid_t gid,
266 const struct cred *cred, 267 const struct cred *cred,
267 unsigned long flags, 268 unsigned long flags,
268 struct key *dest); 269 struct key *dest);
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index c4d2fc194ede..4dff0c6ed58f 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -240,6 +240,7 @@ extern void kgdb_arch_late(void);
240 * hardware breakpoints. 240 * hardware breakpoints.
241 * @correct_hw_break: Allow an architecture to specify how to correct the 241 * @correct_hw_break: Allow an architecture to specify how to correct the
242 * hardware debug registers. 242 * hardware debug registers.
243 * @enable_nmi: Manage NMI-triggered entry to KGDB
243 */ 244 */
244struct kgdb_arch { 245struct kgdb_arch {
245 unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; 246 unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE];
@@ -252,6 +253,8 @@ struct kgdb_arch {
252 void (*disable_hw_break)(struct pt_regs *regs); 253 void (*disable_hw_break)(struct pt_regs *regs);
253 void (*remove_all_hw_break)(void); 254 void (*remove_all_hw_break)(void);
254 void (*correct_hw_break)(void); 255 void (*correct_hw_break)(void);
256
257 void (*enable_nmi)(bool on);
255}; 258};
256 259
257/** 260/**
@@ -283,6 +286,16 @@ extern struct kgdb_arch arch_kgdb_ops;
283 286
284extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs); 287extern unsigned long __weak kgdb_arch_pc(int exception, struct pt_regs *regs);
285 288
289#ifdef CONFIG_SERIAL_KGDB_NMI
290extern int kgdb_register_nmi_console(void);
291extern int kgdb_unregister_nmi_console(void);
292extern bool kgdb_nmi_poll_knock(void);
293#else
294static inline int kgdb_register_nmi_console(void) { return 0; }
295static inline int kgdb_unregister_nmi_console(void) { return 0; }
296static inline bool kgdb_nmi_poll_knock(void) { return 1; }
297#endif
298
286extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); 299extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
287extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops); 300extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
288extern struct kgdb_io *dbg_io_ops; 301extern struct kgdb_io *dbg_io_ops;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index fc615a97e2d3..1e57449395b1 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -224,7 +224,7 @@ static inline int kobject_uevent_env(struct kobject *kobj,
224 224
225static inline __printf(2, 3) 225static inline __printf(2, 3)
226int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) 226int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
227{ return 0; } 227{ return -ENOMEM; }
228 228
229static inline int kobject_action_type(const char *buf, size_t count, 229static inline int kobject_action_type(const char *buf, size_t count,
230 enum kobject_action *type) 230 enum kobject_action *type)
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index b6e1f8c00577..23755ba42abc 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -38,6 +38,7 @@
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <linux/rcupdate.h> 39#include <linux/rcupdate.h>
40#include <linux/mutex.h> 40#include <linux/mutex.h>
41#include <linux/ftrace.h>
41 42
42#ifdef CONFIG_KPROBES 43#ifdef CONFIG_KPROBES
43#include <asm/kprobes.h> 44#include <asm/kprobes.h>
@@ -48,14 +49,26 @@
48#define KPROBE_REENTER 0x00000004 49#define KPROBE_REENTER 0x00000004
49#define KPROBE_HIT_SSDONE 0x00000008 50#define KPROBE_HIT_SSDONE 0x00000008
50 51
52/*
53 * If function tracer is enabled and the arch supports full
54 * passing of pt_regs to function tracing, then kprobes can
55 * optimize on top of function tracing.
56 */
57#if defined(CONFIG_FUNCTION_TRACER) && defined(ARCH_SUPPORTS_FTRACE_SAVE_REGS) \
58 && defined(ARCH_SUPPORTS_KPROBES_ON_FTRACE)
59# define KPROBES_CAN_USE_FTRACE
60#endif
61
51/* Attach to insert probes on any functions which should be ignored*/ 62/* Attach to insert probes on any functions which should be ignored*/
52#define __kprobes __attribute__((__section__(".kprobes.text"))) 63#define __kprobes __attribute__((__section__(".kprobes.text")))
64
53#else /* CONFIG_KPROBES */ 65#else /* CONFIG_KPROBES */
54typedef int kprobe_opcode_t; 66typedef int kprobe_opcode_t;
55struct arch_specific_insn { 67struct arch_specific_insn {
56 int dummy; 68 int dummy;
57}; 69};
58#define __kprobes 70#define __kprobes
71
59#endif /* CONFIG_KPROBES */ 72#endif /* CONFIG_KPROBES */
60 73
61struct kprobe; 74struct kprobe;
@@ -128,6 +141,7 @@ struct kprobe {
128 * NOTE: 141 * NOTE:
129 * this flag is only for optimized_kprobe. 142 * this flag is only for optimized_kprobe.
130 */ 143 */
144#define KPROBE_FLAG_FTRACE 8 /* probe is using ftrace */
131 145
132/* Has this kprobe gone ? */ 146/* Has this kprobe gone ? */
133static inline int kprobe_gone(struct kprobe *p) 147static inline int kprobe_gone(struct kprobe *p)
@@ -146,6 +160,13 @@ static inline int kprobe_optimized(struct kprobe *p)
146{ 160{
147 return p->flags & KPROBE_FLAG_OPTIMIZED; 161 return p->flags & KPROBE_FLAG_OPTIMIZED;
148} 162}
163
164/* Is this kprobe uses ftrace ? */
165static inline int kprobe_ftrace(struct kprobe *p)
166{
167 return p->flags & KPROBE_FLAG_FTRACE;
168}
169
149/* 170/*
150 * Special probe type that uses setjmp-longjmp type tricks to resume 171 * Special probe type that uses setjmp-longjmp type tricks to resume
151 * execution at a specified entry with a matching prototype corresponding 172 * execution at a specified entry with a matching prototype corresponding
@@ -295,6 +316,12 @@ extern int proc_kprobes_optimization_handler(struct ctl_table *table,
295#endif 316#endif
296 317
297#endif /* CONFIG_OPTPROBES */ 318#endif /* CONFIG_OPTPROBES */
319#ifdef KPROBES_CAN_USE_FTRACE
320extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
321 struct ftrace_ops *ops, struct pt_regs *regs);
322extern int arch_prepare_kprobe_ftrace(struct kprobe *p);
323#endif
324
298 325
299/* Get the kprobe at this addr (if any) - called with preemption disabled */ 326/* Get the kprobe at this addr (if any) - called with preemption disabled */
300struct kprobe *get_kprobe(void *addr); 327struct kprobe *get_kprobe(void *addr);
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 9c07dcebded7..65af6887872f 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -18,6 +18,7 @@
18#include <linux/bug.h> 18#include <linux/bug.h>
19#include <linux/atomic.h> 19#include <linux/atomic.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/mutex.h>
21 22
22struct kref { 23struct kref {
23 atomic_t refcount; 24 atomic_t refcount;
@@ -93,4 +94,21 @@ static inline int kref_put(struct kref *kref, void (*release)(struct kref *kref)
93{ 94{
94 return kref_sub(kref, 1, release); 95 return kref_sub(kref, 1, release);
95} 96}
97
98static inline int kref_put_mutex(struct kref *kref,
99 void (*release)(struct kref *kref),
100 struct mutex *lock)
101{
102 WARN_ON(release == NULL);
103 if (unlikely(!atomic_add_unless(&kref->refcount, -1, 1))) {
104 mutex_lock(lock);
105 if (unlikely(!atomic_dec_and_test(&kref->refcount))) {
106 mutex_unlock(lock);
107 return 0;
108 }
109 release(kref);
110 return 1;
111 }
112 return 0;
113}
96#endif /* _KREF_H_ */ 114#endif /* _KREF_H_ */
diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 22ccf9dee177..8d816646f766 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -14,6 +14,11 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
14 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg) 14 kthread_create_on_node(threadfn, data, -1, namefmt, ##arg)
15 15
16 16
17struct task_struct *kthread_create_on_cpu(int (*threadfn)(void *data),
18 void *data,
19 unsigned int cpu,
20 const char *namefmt);
21
17/** 22/**
18 * kthread_run - create and wake a thread. 23 * kthread_run - create and wake a thread.
19 * @threadfn: the function to run until signal_pending(current). 24 * @threadfn: the function to run until signal_pending(current).
@@ -34,9 +39,13 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
34 39
35void kthread_bind(struct task_struct *k, unsigned int cpu); 40void kthread_bind(struct task_struct *k, unsigned int cpu);
36int kthread_stop(struct task_struct *k); 41int kthread_stop(struct task_struct *k);
37int kthread_should_stop(void); 42bool kthread_should_stop(void);
43bool kthread_should_park(void);
38bool kthread_freezable_should_stop(bool *was_frozen); 44bool kthread_freezable_should_stop(bool *was_frozen);
39void *kthread_data(struct task_struct *k); 45void *kthread_data(struct task_struct *k);
46int kthread_park(struct task_struct *k);
47void kthread_unpark(struct task_struct *k);
48void kthread_parkme(void);
40 49
41int kthreadd(void *unused); 50int kthreadd(void *unused);
42extern struct task_struct *kthreadd_task; 51extern struct task_struct *kthreadd_task;
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 603bec2913b0..06177ba10a16 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -58,13 +58,6 @@ union ktime {
58 58
59typedef union ktime ktime_t; /* Kill this */ 59typedef union ktime ktime_t; /* Kill this */
60 60
61#define KTIME_MAX ((s64)~((u64)1 << 63))
62#if (BITS_PER_LONG == 64)
63# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
64#else
65# define KTIME_SEC_MAX LONG_MAX
66#endif
67
68/* 61/*
69 * ktime_t definitions when using the 64-bit scalar representation: 62 * ktime_t definitions when using the 64-bit scalar representation:
70 */ 63 */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 2ce09aa7d3b3..0a6d6ba44c85 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -101,9 +101,13 @@ struct kvm_userspace_memory_region {
101 __u64 userspace_addr; /* start of the userspace allocated memory */ 101 __u64 userspace_addr; /* start of the userspace allocated memory */
102}; 102};
103 103
104/* for kvm_memory_region::flags */ 104/*
105#define KVM_MEM_LOG_DIRTY_PAGES 1UL 105 * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace,
106#define KVM_MEMSLOT_INVALID (1UL << 1) 106 * other bits are reserved for kvm internal use which are defined in
107 * include/linux/kvm_host.h.
108 */
109#define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
110#define KVM_MEM_READONLY (1UL << 1)
107 111
108/* for KVM_IRQ_LINE */ 112/* for KVM_IRQ_LINE */
109struct kvm_irq_level { 113struct kvm_irq_level {
@@ -618,6 +622,10 @@ struct kvm_ppc_smmu_info {
618#define KVM_CAP_PPC_GET_SMMU_INFO 78 622#define KVM_CAP_PPC_GET_SMMU_INFO 78
619#define KVM_CAP_S390_COW 79 623#define KVM_CAP_S390_COW 79
620#define KVM_CAP_PPC_ALLOC_HTAB 80 624#define KVM_CAP_PPC_ALLOC_HTAB 80
625#ifdef __KVM_HAVE_READONLY_MEM
626#define KVM_CAP_READONLY_MEM 81
627#endif
628#define KVM_CAP_IRQFD_RESAMPLE 82
621 629
622#ifdef KVM_CAP_IRQ_ROUTING 630#ifdef KVM_CAP_IRQ_ROUTING
623 631
@@ -683,12 +691,21 @@ struct kvm_xen_hvm_config {
683#endif 691#endif
684 692
685#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) 693#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0)
694/*
695 * Available with KVM_CAP_IRQFD_RESAMPLE
696 *
697 * KVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies
698 * the irqfd to operate in resampling mode for level triggered interrupt
699 * emlation. See Documentation/virtual/kvm/api.txt.
700 */
701#define KVM_IRQFD_FLAG_RESAMPLE (1 << 1)
686 702
687struct kvm_irqfd { 703struct kvm_irqfd {
688 __u32 fd; 704 __u32 fd;
689 __u32 gsi; 705 __u32 gsi;
690 __u32 flags; 706 __u32 flags;
691 __u8 pad[20]; 707 __u32 resamplefd;
708 __u8 pad[16];
692}; 709};
693 710
694struct kvm_clock_data { 711struct kvm_clock_data {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b70b48b01098..93bfc9f9815c 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -21,6 +21,7 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/rcupdate.h> 22#include <linux/rcupdate.h>
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/err.h>
24#include <asm/signal.h> 25#include <asm/signal.h>
25 26
26#include <linux/kvm.h> 27#include <linux/kvm.h>
@@ -35,6 +36,13 @@
35#endif 36#endif
36 37
37/* 38/*
39 * The bit 16 ~ bit 31 of kvm_memory_region::flags are internally used
40 * in kvm, other bits are visible for userspace which are defined in
41 * include/linux/kvm_h.
42 */
43#define KVM_MEMSLOT_INVALID (1UL << 16)
44
45/*
38 * If we support unaligned MMIO, at most one fragment will be split into two: 46 * If we support unaligned MMIO, at most one fragment will be split into two:
39 */ 47 */
40#ifdef KVM_UNALIGNED_MMIO 48#ifdef KVM_UNALIGNED_MMIO
@@ -49,6 +57,47 @@
49 (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS) 57 (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)
50 58
51/* 59/*
60 * For the normal pfn, the highest 12 bits should be zero,
61 * so we can mask these bits to indicate the error.
62 */
63#define KVM_PFN_ERR_MASK (0xfffULL << 52)
64
65#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK)
66#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1)
67#define KVM_PFN_ERR_BAD (KVM_PFN_ERR_MASK + 2)
68#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 3)
69
70static inline bool is_error_pfn(pfn_t pfn)
71{
72 return !!(pfn & KVM_PFN_ERR_MASK);
73}
74
75static inline bool is_noslot_pfn(pfn_t pfn)
76{
77 return pfn == KVM_PFN_ERR_BAD;
78}
79
80static inline bool is_invalid_pfn(pfn_t pfn)
81{
82 return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
83}
84
85#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
86#define KVM_HVA_ERR_RO_BAD (PAGE_OFFSET + PAGE_SIZE)
87
88static inline bool kvm_is_error_hva(unsigned long addr)
89{
90 return addr >= PAGE_OFFSET;
91}
92
93#define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT))
94
95static inline bool is_error_page(struct page *page)
96{
97 return IS_ERR(page);
98}
99
100/*
52 * vcpu->requests bit members 101 * vcpu->requests bit members
53 */ 102 */
54#define KVM_REQ_TLB_FLUSH 0 103#define KVM_REQ_TLB_FLUSH 0
@@ -70,7 +119,8 @@
70#define KVM_REQ_PMU 16 119#define KVM_REQ_PMU 16
71#define KVM_REQ_PMI 17 120#define KVM_REQ_PMI 17
72 121
73#define KVM_USERSPACE_IRQ_SOURCE_ID 0 122#define KVM_USERSPACE_IRQ_SOURCE_ID 0
123#define KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID 1
74 124
75struct kvm; 125struct kvm;
76struct kvm_vcpu; 126struct kvm_vcpu;
@@ -183,6 +233,18 @@ struct kvm_vcpu {
183 } async_pf; 233 } async_pf;
184#endif 234#endif
185 235
236#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
237 /*
238 * Cpu relax intercept or pause loop exit optimization
239 * in_spin_loop: set when a vcpu does a pause loop exit
240 * or cpu relax intercepted.
241 * dy_eligible: indicates whether vcpu is eligible for directed yield.
242 */
243 struct {
244 bool in_spin_loop;
245 bool dy_eligible;
246 } spin_loop;
247#endif
186 struct kvm_vcpu_arch arch; 248 struct kvm_vcpu_arch arch;
187}; 249};
188 250
@@ -201,7 +263,6 @@ struct kvm_memory_slot {
201 gfn_t base_gfn; 263 gfn_t base_gfn;
202 unsigned long npages; 264 unsigned long npages;
203 unsigned long flags; 265 unsigned long flags;
204 unsigned long *rmap;
205 unsigned long *dirty_bitmap; 266 unsigned long *dirty_bitmap;
206 struct kvm_arch_memory_slot arch; 267 struct kvm_arch_memory_slot arch;
207 unsigned long userspace_addr; 268 unsigned long userspace_addr;
@@ -283,6 +344,8 @@ struct kvm {
283 struct { 344 struct {
284 spinlock_t lock; 345 spinlock_t lock;
285 struct list_head items; 346 struct list_head items;
347 struct list_head resampler_list;
348 struct mutex resampler_lock;
286 } irqfds; 349 } irqfds;
287 struct list_head ioeventfds; 350 struct list_head ioeventfds;
288#endif 351#endif
@@ -348,7 +411,7 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
348int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); 411int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
349void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); 412void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
350 413
351void vcpu_load(struct kvm_vcpu *vcpu); 414int __must_check vcpu_load(struct kvm_vcpu *vcpu);
352void vcpu_put(struct kvm_vcpu *vcpu); 415void vcpu_put(struct kvm_vcpu *vcpu);
353 416
354int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, 417int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
@@ -378,23 +441,6 @@ id_to_memslot(struct kvm_memslots *slots, int id)
378 return slot; 441 return slot;
379} 442}
380 443
381#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
382#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
383static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
384
385extern struct page *bad_page;
386extern struct page *fault_page;
387
388extern pfn_t bad_pfn;
389extern pfn_t fault_pfn;
390
391int is_error_page(struct page *page);
392int is_error_pfn(pfn_t pfn);
393int is_hwpoison_pfn(pfn_t pfn);
394int is_fault_pfn(pfn_t pfn);
395int is_noslot_pfn(pfn_t pfn);
396int is_invalid_pfn(pfn_t pfn);
397int kvm_is_error_hva(unsigned long addr);
398int kvm_set_memory_region(struct kvm *kvm, 444int kvm_set_memory_region(struct kvm *kvm,
399 struct kvm_userspace_memory_region *mem, 445 struct kvm_userspace_memory_region *mem,
400 int user_alloc); 446 int user_alloc);
@@ -415,28 +461,33 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
415 int user_alloc); 461 int user_alloc);
416bool kvm_largepages_enabled(void); 462bool kvm_largepages_enabled(void);
417void kvm_disable_largepages(void); 463void kvm_disable_largepages(void);
418void kvm_arch_flush_shadow(struct kvm *kvm); 464/* flush all memory translations */
465void kvm_arch_flush_shadow_all(struct kvm *kvm);
466/* flush memory translations pointing to 'slot' */
467void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
468 struct kvm_memory_slot *slot);
419 469
420int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages, 470int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages,
421 int nr_pages); 471 int nr_pages);
422 472
423struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); 473struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
424unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); 474unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
475unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
425void kvm_release_page_clean(struct page *page); 476void kvm_release_page_clean(struct page *page);
426void kvm_release_page_dirty(struct page *page); 477void kvm_release_page_dirty(struct page *page);
427void kvm_set_page_dirty(struct page *page); 478void kvm_set_page_dirty(struct page *page);
428void kvm_set_page_accessed(struct page *page); 479void kvm_set_page_accessed(struct page *page);
429 480
430pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr);
431pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); 481pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
432pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async, 482pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async,
433 bool write_fault, bool *writable); 483 bool write_fault, bool *writable);
434pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); 484pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
435pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault, 485pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
436 bool *writable); 486 bool *writable);
437pfn_t gfn_to_pfn_memslot(struct kvm *kvm, 487pfn_t gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
438 struct kvm_memory_slot *slot, gfn_t gfn); 488pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn);
439void kvm_release_pfn_dirty(pfn_t); 489
490void kvm_release_pfn_dirty(pfn_t pfn);
440void kvm_release_pfn_clean(pfn_t pfn); 491void kvm_release_pfn_clean(pfn_t pfn);
441void kvm_set_pfn_dirty(pfn_t pfn); 492void kvm_set_pfn_dirty(pfn_t pfn);
442void kvm_set_pfn_accessed(pfn_t pfn); 493void kvm_set_pfn_accessed(pfn_t pfn);
@@ -494,6 +545,7 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
494 struct 545 struct
495 kvm_userspace_memory_region *mem, 546 kvm_userspace_memory_region *mem,
496 int user_alloc); 547 int user_alloc);
548int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_level);
497long kvm_arch_vm_ioctl(struct file *filp, 549long kvm_arch_vm_ioctl(struct file *filp,
498 unsigned int ioctl, unsigned long arg); 550 unsigned int ioctl, unsigned long arg);
499 551
@@ -573,7 +625,7 @@ void kvm_arch_sync_events(struct kvm *kvm);
573int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu); 625int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
574void kvm_vcpu_kick(struct kvm_vcpu *vcpu); 626void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
575 627
576int kvm_is_mmio_pfn(pfn_t pfn); 628bool kvm_is_mmio_pfn(pfn_t pfn);
577 629
578struct kvm_irq_ack_notifier { 630struct kvm_irq_ack_notifier {
579 struct hlist_node link; 631 struct hlist_node link;
@@ -685,7 +737,7 @@ static inline int kvm_deassign_device(struct kvm *kvm,
685static inline void kvm_guest_enter(void) 737static inline void kvm_guest_enter(void)
686{ 738{
687 BUG_ON(preemptible()); 739 BUG_ON(preemptible());
688 account_system_vtime(current); 740 vtime_account(current);
689 current->flags |= PF_VCPU; 741 current->flags |= PF_VCPU;
690 /* KVM does not hold any references to rcu protected data when it 742 /* KVM does not hold any references to rcu protected data when it
691 * switches CPU into a guest mode. In fact switching to a guest mode 743 * switches CPU into a guest mode. In fact switching to a guest mode
@@ -699,7 +751,7 @@ static inline void kvm_guest_enter(void)
699 751
700static inline void kvm_guest_exit(void) 752static inline void kvm_guest_exit(void)
701{ 753{
702 account_system_vtime(current); 754 vtime_account(current);
703 current->flags &= ~PF_VCPU; 755 current->flags &= ~PF_VCPU;
704} 756}
705 757
@@ -728,6 +780,12 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn)
728 return search_memslots(slots, gfn); 780 return search_memslots(slots, gfn);
729} 781}
730 782
783static inline unsigned long
784__gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
785{
786 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
787}
788
731static inline int memslot_id(struct kvm *kvm, gfn_t gfn) 789static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
732{ 790{
733 return gfn_to_memslot(kvm, gfn)->id; 791 return gfn_to_memslot(kvm, gfn)->id;
@@ -740,10 +798,12 @@ static inline gfn_t gfn_to_index(gfn_t gfn, gfn_t base_gfn, int level)
740 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level)); 798 (base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
741} 799}
742 800
743static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, 801static inline gfn_t
744 gfn_t gfn) 802hva_to_gfn_memslot(unsigned long hva, struct kvm_memory_slot *slot)
745{ 803{
746 return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE; 804 gfn_t gfn_offset = (hva - slot->userspace_addr) >> PAGE_SHIFT;
805
806 return slot->base_gfn + gfn_offset;
747} 807}
748 808
749static inline gpa_t gfn_to_gpa(gfn_t gfn) 809static inline gpa_t gfn_to_gpa(gfn_t gfn)
@@ -899,5 +959,32 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
899 } 959 }
900} 960}
901 961
962#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
963
964static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
965{
966 vcpu->spin_loop.in_spin_loop = val;
967}
968static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
969{
970 vcpu->spin_loop.dy_eligible = val;
971}
972
973#else /* !CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
974
975static inline void kvm_vcpu_set_in_spin_loop(struct kvm_vcpu *vcpu, bool val)
976{
977}
978
979static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val)
980{
981}
982
983static inline bool kvm_vcpu_eligible_for_directed_yield(struct kvm_vcpu *vcpu)
984{
985 return true;
986}
987
988#endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */
902#endif 989#endif
903 990
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 3aade1d8f410..c6f8dad2ceb0 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -237,4 +237,20 @@ struct gpio_led_platform_data {
237struct platform_device *gpio_led_register_device( 237struct platform_device *gpio_led_register_device(
238 int id, const struct gpio_led_platform_data *pdata); 238 int id, const struct gpio_led_platform_data *pdata);
239 239
240enum cpu_led_event {
241 CPU_LED_IDLE_START, /* CPU enters idle */
242 CPU_LED_IDLE_END, /* CPU idle ends */
243 CPU_LED_START, /* Machine starts, especially resume */
244 CPU_LED_STOP, /* Machine stops, especially suspend */
245 CPU_LED_HALTED, /* Machine shutdown */
246};
247#ifdef CONFIG_LEDS_TRIGGER_CPU
248extern void ledtrig_cpu(enum cpu_led_event evt);
249#else
250static inline void ledtrig_cpu(enum cpu_led_event evt)
251{
252 return;
253}
254#endif
255
240#endif /* __LINUX_LEDS_H_INCLUDED */ 256#endif /* __LINUX_LEDS_H_INCLUDED */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 64f90e17e51d..77eeeda2b6e2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -162,6 +162,7 @@ enum {
162 ATA_DFLAG_DETACHED = (1 << 25), 162 ATA_DFLAG_DETACHED = (1 << 25),
163 163
164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */ 164 ATA_DFLAG_DA = (1 << 26), /* device supports Device Attention */
165 ATA_DFLAG_DEVSLP = (1 << 27), /* device supports Device Sleep */
165 166
166 ATA_DEV_UNKNOWN = 0, /* unknown device */ 167 ATA_DEV_UNKNOWN = 0, /* unknown device */
167 ATA_DEV_ATA = 1, /* ATA device */ 168 ATA_DEV_ATA = 1, /* ATA device */
@@ -184,6 +185,7 @@ enum {
184 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ 185 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
185 ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ 186 ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */
186 ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ 187 ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */
188 ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */
187 189
188 /* struct ata_port flags */ 190 /* struct ata_port flags */
189 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 191 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -649,6 +651,9 @@ struct ata_device {
649 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ 651 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
650 }; 652 };
651 653
654 /* Identify Device Data Log (30h), SATA Settings (page 08h) */
655 u8 sata_settings[ATA_SECT_SIZE];
656
652 /* error history */ 657 /* error history */
653 int spdn_cnt; 658 int spdn_cnt;
654 /* ering is CLEAR_END, read comment above CLEAR_END */ 659 /* ering is CLEAR_END, read comment above CLEAR_END */
@@ -986,8 +991,7 @@ extern int ata_host_activate(struct ata_host *host, int irq,
986 irq_handler_t irq_handler, unsigned long irq_flags, 991 irq_handler_t irq_handler, unsigned long irq_flags,
987 struct scsi_host_template *sht); 992 struct scsi_host_template *sht);
988extern void ata_host_detach(struct ata_host *host); 993extern void ata_host_detach(struct ata_host *host);
989extern void ata_host_init(struct ata_host *, struct device *, 994extern void ata_host_init(struct ata_host *, struct device *, struct ata_port_operations *);
990 unsigned long, struct ata_port_operations *);
991extern int ata_scsi_detect(struct scsi_host_template *sht); 995extern int ata_scsi_detect(struct scsi_host_template *sht);
992extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg); 996extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
993extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd); 997extern int ata_scsi_queuecmd(struct Scsi_Host *h, struct scsi_cmnd *cmd);
@@ -1012,6 +1016,17 @@ extern bool ata_link_offline(struct ata_link *link);
1012#ifdef CONFIG_PM 1016#ifdef CONFIG_PM
1013extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 1017extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
1014extern void ata_host_resume(struct ata_host *host); 1018extern void ata_host_resume(struct ata_host *host);
1019extern int ata_sas_port_async_suspend(struct ata_port *ap, int *async);
1020extern int ata_sas_port_async_resume(struct ata_port *ap, int *async);
1021#else
1022static inline int ata_sas_port_async_suspend(struct ata_port *ap, int *async)
1023{
1024 return 0;
1025}
1026static inline int ata_sas_port_async_resume(struct ata_port *ap, int *async)
1027{
1028 return 0;
1029}
1015#endif 1030#endif
1016extern int ata_ratelimit(void); 1031extern int ata_ratelimit(void);
1017extern void ata_msleep(struct ata_port *ap, unsigned int msecs); 1032extern void ata_msleep(struct ata_port *ap, unsigned int msecs);
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 11a41a8f08eb..9635116dd830 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -44,7 +44,7 @@ struct loop_device {
44 int lo_encrypt_key_size; 44 int lo_encrypt_key_size;
45 struct loop_func_table *lo_encryption; 45 struct loop_func_table *lo_encryption;
46 __u32 lo_init[2]; 46 __u32 lo_init[2];
47 uid_t lo_key_owner; /* Who set the key */ 47 kuid_t lo_key_owner; /* Who set the key */
48 int (*ioctl)(struct loop_device *, int cmd, 48 int (*ioctl)(struct loop_device *, int cmd,
49 unsigned long arg); 49 unsigned long arg);
50 50
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index d0752eca9b44..9d96d5d4dfed 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -183,7 +183,7 @@ extern int mISDN_initbchannel(struct bchannel *, unsigned short,
183 unsigned short); 183 unsigned short);
184extern int mISDN_freedchannel(struct dchannel *); 184extern int mISDN_freedchannel(struct dchannel *);
185extern void mISDN_clear_bchannel(struct bchannel *); 185extern void mISDN_clear_bchannel(struct bchannel *);
186extern int mISDN_freebchannel(struct bchannel *); 186extern void mISDN_freebchannel(struct bchannel *);
187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *); 187extern int mISDN_ctrl_bchannel(struct bchannel *, struct mISDN_ctrl_req *);
188extern void queue_ch_frame(struct mISDNchannel *, u_int, 188extern void queue_ch_frame(struct mISDNchannel *, u_int,
189 int, struct sk_buff *); 189 int, struct sk_buff *);
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 7cccafe50e7b..6c406845f7e2 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -377,5 +377,88 @@ static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
377extern int mdio_mii_ioctl(const struct mdio_if_info *mdio, 377extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
378 struct mii_ioctl_data *mii_data, int cmd); 378 struct mii_ioctl_data *mii_data, int cmd);
379 379
380/**
381 * mmd_eee_cap_to_ethtool_sup_t
382 * @eee_cap: value of the MMD EEE Capability register
383 *
384 * A small helper function that translates MMD EEE Capability (3.20) bits
385 * to ethtool supported settings.
386 */
387static inline u32 mmd_eee_cap_to_ethtool_sup_t(u16 eee_cap)
388{
389 u32 supported = 0;
390
391 if (eee_cap & MDIO_EEE_100TX)
392 supported |= SUPPORTED_100baseT_Full;
393 if (eee_cap & MDIO_EEE_1000T)
394 supported |= SUPPORTED_1000baseT_Full;
395 if (eee_cap & MDIO_EEE_10GT)
396 supported |= SUPPORTED_10000baseT_Full;
397 if (eee_cap & MDIO_EEE_1000KX)
398 supported |= SUPPORTED_1000baseKX_Full;
399 if (eee_cap & MDIO_EEE_10GKX4)
400 supported |= SUPPORTED_10000baseKX4_Full;
401 if (eee_cap & MDIO_EEE_10GKR)
402 supported |= SUPPORTED_10000baseKR_Full;
403
404 return supported;
405}
406
407/**
408 * mmd_eee_adv_to_ethtool_adv_t
409 * @eee_adv: value of the MMD EEE Advertisement/Link Partner Ability registers
410 *
411 * A small helper function that translates the MMD EEE Advertisment (7.60)
412 * and MMD EEE Link Partner Ability (7.61) bits to ethtool advertisement
413 * settings.
414 */
415static inline u32 mmd_eee_adv_to_ethtool_adv_t(u16 eee_adv)
416{
417 u32 adv = 0;
418
419 if (eee_adv & MDIO_EEE_100TX)
420 adv |= ADVERTISED_100baseT_Full;
421 if (eee_adv & MDIO_EEE_1000T)
422 adv |= ADVERTISED_1000baseT_Full;
423 if (eee_adv & MDIO_EEE_10GT)
424 adv |= ADVERTISED_10000baseT_Full;
425 if (eee_adv & MDIO_EEE_1000KX)
426 adv |= ADVERTISED_1000baseKX_Full;
427 if (eee_adv & MDIO_EEE_10GKX4)
428 adv |= ADVERTISED_10000baseKX4_Full;
429 if (eee_adv & MDIO_EEE_10GKR)
430 adv |= ADVERTISED_10000baseKR_Full;
431
432 return adv;
433}
434
435/**
436 * ethtool_adv_to_mmd_eee_adv_t
437 * @adv: the ethtool advertisement settings
438 *
439 * A small helper function that translates ethtool advertisement settings
440 * to EEE advertisements for the MMD EEE Advertisement (7.60) and
441 * MMD EEE Link Partner Ability (7.61) registers.
442 */
443static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
444{
445 u16 reg = 0;
446
447 if (adv & ADVERTISED_100baseT_Full)
448 reg |= MDIO_EEE_100TX;
449 if (adv & ADVERTISED_1000baseT_Full)
450 reg |= MDIO_EEE_1000T;
451 if (adv & ADVERTISED_10000baseT_Full)
452 reg |= MDIO_EEE_10GT;
453 if (adv & ADVERTISED_1000baseKX_Full)
454 reg |= MDIO_EEE_1000KX;
455 if (adv & ADVERTISED_10000baseKX4_Full)
456 reg |= MDIO_EEE_10GKX4;
457 if (adv & ADVERTISED_10000baseKR_Full)
458 reg |= MDIO_EEE_10GKR;
459
460 return reg;
461}
462
380#endif /* __KERNEL__ */ 463#endif /* __KERNEL__ */
381#endif /* __LINUX_MDIO_H__ */ 464#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 19dc455b4f3d..569d67d4243e 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -70,8 +70,7 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
70 * @p_end: ptr to ulong for end pfn of the range, can be %NULL 70 * @p_end: ptr to ulong for end pfn of the range, can be %NULL
71 * @p_nid: ptr to int for nid of the range, can be %NULL 71 * @p_nid: ptr to int for nid of the range, can be %NULL
72 * 72 *
73 * Walks over configured memory ranges. Available after early_node_map is 73 * Walks over configured memory ranges.
74 * populated.
75 */ 74 */
76#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \ 75#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
77 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \ 76 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 8d9489fdab2e..fd0e6d53836e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -84,14 +84,14 @@ extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
84extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); 84extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
85 85
86static inline 86static inline
87int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 87bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
88{ 88{
89 struct mem_cgroup *memcg; 89 struct mem_cgroup *task_memcg;
90 int match; 90 bool match;
91 91
92 rcu_read_lock(); 92 rcu_read_lock();
93 memcg = mem_cgroup_from_task(rcu_dereference((mm)->owner)); 93 task_memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
94 match = __mem_cgroup_same_or_subtree(cgroup, memcg); 94 match = __mem_cgroup_same_or_subtree(memcg, task_memcg);
95 rcu_read_unlock(); 95 rcu_read_unlock();
96 return match; 96 return match;
97} 97}
@@ -258,10 +258,10 @@ static inline struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm
258 return NULL; 258 return NULL;
259} 259}
260 260
261static inline int mm_match_cgroup(struct mm_struct *mm, 261static inline bool mm_match_cgroup(struct mm_struct *mm,
262 struct mem_cgroup *memcg) 262 struct mem_cgroup *memcg)
263{ 263{
264 return 1; 264 return true;
265} 265}
266 266
267static inline int task_in_mem_cgroup(struct task_struct *task, 267static inline int task_in_mem_cgroup(struct task_struct *task,
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 1ac7f6e405f9..ff9a9f8e0ed9 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -19,7 +19,7 @@
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21 21
22#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS) 22#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
23 23
24struct memory_block { 24struct memory_block {
25 unsigned long start_section_nr; 25 unsigned long start_section_nr;
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 910550f3b70e..95573ec4ee6c 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -10,6 +10,7 @@ struct page;
10struct zone; 10struct zone;
11struct pglist_data; 11struct pglist_data;
12struct mem_section; 12struct mem_section;
13struct memory_block;
13 14
14#ifdef CONFIG_MEMORY_HOTPLUG 15#ifdef CONFIG_MEMORY_HOTPLUG
15 16
@@ -233,6 +234,8 @@ static inline int is_mem_section_removable(unsigned long pfn,
233extern int mem_online_node(int nid); 234extern int mem_online_node(int nid);
234extern int add_memory(int nid, u64 start, u64 size); 235extern int add_memory(int nid, u64 start, u64 size);
235extern int arch_add_memory(int nid, u64 start, u64 size); 236extern int arch_add_memory(int nid, u64 start, u64 size);
237extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238extern int offline_memory_block(struct memory_block *mem);
236extern int remove_memory(u64 start, u64 size); 239extern int remove_memory(u64 start, u64 size);
237extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 240extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
238 int nr_pages); 241 int nr_pages);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 95b738c7abff..cec569325608 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -188,7 +188,7 @@ struct sp_node {
188 188
189struct shared_policy { 189struct shared_policy {
190 struct rb_root root; 190 struct rb_root root;
191 spinlock_t lock; 191 struct mutex mutex;
192}; 192};
193 193
194void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 194void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
@@ -239,7 +239,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
239/* Check if a vma is migratable */ 239/* Check if a vma is migratable */
240static inline int vma_migratable(struct vm_area_struct *vma) 240static inline int vma_migratable(struct vm_area_struct *vma)
241{ 241{
242 if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED)) 242 if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP))
243 return 0; 243 return 0;
244 /* 244 /*
245 * Migration allocates pages in the highest zone. If we cannot 245 * Migration allocates pages in the highest zone. If we cannot
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 7b24943779fa..cd97530205c2 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -34,27 +34,26 @@ enum {
34 PM8606_ID_MAX, 34 PM8606_ID_MAX,
35}; 35};
36 36
37enum {
38 PM8606_BACKLIGHT1 = 0,
39 PM8606_BACKLIGHT2,
40 PM8606_BACKLIGHT3,
41};
42
43enum {
44 PM8606_LED1_RED = 0,
45 PM8606_LED1_GREEN,
46 PM8606_LED1_BLUE,
47 PM8606_LED2_RED,
48 PM8606_LED2_GREEN,
49 PM8606_LED2_BLUE,
50 PM8607_LED_VIBRATOR,
51};
52
53 37
54/* 8606 Registers */ 38/* 8606 Registers */
55#define PM8606_DCM_BOOST (0x00) 39#define PM8606_DCM_BOOST (0x00)
56#define PM8606_PWM (0x01) 40#define PM8606_PWM (0x01)
57 41
42#define PM8607_MISC2 (0x42)
43
44/* Power Up Log Register */
45#define PM8607_POWER_UP_LOG (0x3F)
46
47/* Charger Control Registers */
48#define PM8607_CCNT (0x47)
49#define PM8607_CHG_CTRL1 (0x48)
50#define PM8607_CHG_CTRL2 (0x49)
51#define PM8607_CHG_CTRL3 (0x4A)
52#define PM8607_CHG_CTRL4 (0x4B)
53#define PM8607_CHG_CTRL5 (0x4C)
54#define PM8607_CHG_CTRL6 (0x4D)
55#define PM8607_CHG_CTRL7 (0x4E)
56
58/* Backlight Registers */ 57/* Backlight Registers */
59#define PM8606_WLED1A (0x02) 58#define PM8606_WLED1A (0x02)
60#define PM8606_WLED1B (0x03) 59#define PM8606_WLED1B (0x03)
@@ -205,6 +204,71 @@ enum {
205#define PM8607_PD_PREBIAS (0x56) /* prebias time */ 204#define PM8607_PD_PREBIAS (0x56) /* prebias time */
206#define PM8607_GPADC_MISC1 (0x57) 205#define PM8607_GPADC_MISC1 (0x57)
207 206
207/* bit definitions of MEAS_EN1*/
208#define PM8607_MEAS_EN1_VBAT (1 << 0)
209#define PM8607_MEAS_EN1_VCHG (1 << 1)
210#define PM8607_MEAS_EN1_VSYS (1 << 2)
211#define PM8607_MEAS_EN1_TINT (1 << 3)
212#define PM8607_MEAS_EN1_RFTMP (1 << 4)
213#define PM8607_MEAS_EN1_TBAT (1 << 5)
214#define PM8607_MEAS_EN1_GPADC2 (1 << 6)
215#define PM8607_MEAS_EN1_GPADC3 (1 << 7)
216
217/* Battery Monitor Registers */
218#define PM8607_GP_BIAS2 (0x5A)
219#define PM8607_VBAT_LOWTH (0x5B)
220#define PM8607_VCHG_LOWTH (0x5C)
221#define PM8607_VSYS_LOWTH (0x5D)
222#define PM8607_TINT_LOWTH (0x5E)
223#define PM8607_GPADC0_LOWTH (0x5F)
224#define PM8607_GPADC1_LOWTH (0x60)
225#define PM8607_GPADC2_LOWTH (0x61)
226#define PM8607_GPADC3_LOWTH (0x62)
227#define PM8607_VBAT_HIGHTH (0x63)
228#define PM8607_VCHG_HIGHTH (0x64)
229#define PM8607_VSYS_HIGHTH (0x65)
230#define PM8607_TINT_HIGHTH (0x66)
231#define PM8607_GPADC0_HIGHTH (0x67)
232#define PM8607_GPADC1_HIGHTH (0x68)
233#define PM8607_GPADC2_HIGHTH (0x69)
234#define PM8607_GPADC3_HIGHTH (0x6A)
235#define PM8607_IBAT_MEAS1 (0x6B)
236#define PM8607_IBAT_MEAS2 (0x6C)
237#define PM8607_VBAT_MEAS1 (0x6D)
238#define PM8607_VBAT_MEAS2 (0x6E)
239#define PM8607_VCHG_MEAS1 (0x6F)
240#define PM8607_VCHG_MEAS2 (0x70)
241#define PM8607_VSYS_MEAS1 (0x71)
242#define PM8607_VSYS_MEAS2 (0x72)
243#define PM8607_TINT_MEAS1 (0x73)
244#define PM8607_TINT_MEAS2 (0x74)
245#define PM8607_GPADC0_MEAS1 (0x75)
246#define PM8607_GPADC0_MEAS2 (0x76)
247#define PM8607_GPADC1_MEAS1 (0x77)
248#define PM8607_GPADC1_MEAS2 (0x78)
249#define PM8607_GPADC2_MEAS1 (0x79)
250#define PM8607_GPADC2_MEAS2 (0x7A)
251#define PM8607_GPADC3_MEAS1 (0x7B)
252#define PM8607_GPADC3_MEAS2 (0x7C)
253#define PM8607_CCNT_MEAS1 (0x95)
254#define PM8607_CCNT_MEAS2 (0x96)
255#define PM8607_VBAT_AVG (0x97)
256#define PM8607_VCHG_AVG (0x98)
257#define PM8607_VSYS_AVG (0x99)
258#define PM8607_VBAT_MIN (0x9A)
259#define PM8607_VCHG_MIN (0x9B)
260#define PM8607_VSYS_MIN (0x9C)
261#define PM8607_VBAT_MAX (0x9D)
262#define PM8607_VCHG_MAX (0x9E)
263#define PM8607_VSYS_MAX (0x9F)
264
265#define PM8607_GPADC_MISC2 (0x59)
266#define PM8607_GPADC0_GP_BIAS_A0 (1 << 0)
267#define PM8607_GPADC1_GP_BIAS_A1 (1 << 1)
268#define PM8607_GPADC2_GP_BIAS_A2 (1 << 2)
269#define PM8607_GPADC3_GP_BIAS_A3 (1 << 3)
270#define PM8607_GPADC2_GP_BIAS_OUT2 (1 << 6)
271
208/* RTC Control Registers */ 272/* RTC Control Registers */
209#define PM8607_RTC1 (0xA0) 273#define PM8607_RTC1 (0xA0)
210#define PM8607_RTC_COUNTER1 (0xA1) 274#define PM8607_RTC_COUNTER1 (0xA1)
@@ -322,7 +386,7 @@ struct pm860x_chip {
322 struct regmap *regmap_companion; 386 struct regmap *regmap_companion;
323 387
324 int buck3_double; /* DVC ramp slope double */ 388 int buck3_double; /* DVC ramp slope double */
325 unsigned short companion_addr; 389 int companion_addr;
326 unsigned short osc_vote; 390 unsigned short osc_vote;
327 int id; 391 int id;
328 int irq_mode; 392 int irq_mode;
@@ -340,16 +404,12 @@ enum {
340}; 404};
341 405
342struct pm860x_backlight_pdata { 406struct pm860x_backlight_pdata {
343 int id;
344 int pwm; 407 int pwm;
345 int iset; 408 int iset;
346 unsigned long flags;
347}; 409};
348 410
349struct pm860x_led_pdata { 411struct pm860x_led_pdata {
350 int id;
351 int iset; 412 int iset;
352 unsigned long flags;
353}; 413};
354 414
355struct pm860x_rtc_pdata { 415struct pm860x_rtc_pdata {
@@ -370,7 +430,8 @@ struct pm860x_touch_pdata {
370}; 430};
371 431
372struct pm860x_power_pdata { 432struct pm860x_power_pdata {
373 unsigned fast_charge; /* charge current */ 433 int max_capacity;
434 int resistor;
374}; 435};
375 436
376struct pm860x_platform_data { 437struct pm860x_platform_data {
@@ -379,15 +440,30 @@ struct pm860x_platform_data {
379 struct pm860x_rtc_pdata *rtc; 440 struct pm860x_rtc_pdata *rtc;
380 struct pm860x_touch_pdata *touch; 441 struct pm860x_touch_pdata *touch;
381 struct pm860x_power_pdata *power; 442 struct pm860x_power_pdata *power;
382 struct regulator_init_data *regulator; 443 struct regulator_init_data *buck1;
383 444 struct regulator_init_data *buck2;
384 unsigned short companion_addr; /* I2C address of companion chip */ 445 struct regulator_init_data *buck3;
446 struct regulator_init_data *ldo1;
447 struct regulator_init_data *ldo2;
448 struct regulator_init_data *ldo3;
449 struct regulator_init_data *ldo4;
450 struct regulator_init_data *ldo5;
451 struct regulator_init_data *ldo6;
452 struct regulator_init_data *ldo7;
453 struct regulator_init_data *ldo8;
454 struct regulator_init_data *ldo9;
455 struct regulator_init_data *ldo10;
456 struct regulator_init_data *ldo12;
457 struct regulator_init_data *ldo_vibrator;
458 struct regulator_init_data *ldo14;
459 struct charger_desc *chg_desc;
460
461 int companion_addr; /* I2C address of companion chip */
385 int i2c_port; /* Controlled by GI2C or PI2C */ 462 int i2c_port; /* Controlled by GI2C or PI2C */
386 int irq_mode; /* Clear interrupt by read/write(0/1) */ 463 int irq_mode; /* Clear interrupt by read/write(0/1) */
387 int irq_base; /* IRQ base number of 88pm860x */ 464 int irq_base; /* IRQ base number of 88pm860x */
388 int num_leds; 465 int num_leds;
389 int num_backlights; 466 int num_backlights;
390 int num_regulators;
391}; 467};
392 468
393extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short); 469extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short);
@@ -408,8 +484,4 @@ extern int pm860x_page_bulk_write(struct i2c_client *, int, int,
408extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char, 484extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char,
409 unsigned char); 485 unsigned char);
410 486
411extern int pm860x_device_init(struct pm860x_chip *chip,
412 struct pm860x_platform_data *pdata) __devinit ;
413extern void pm860x_device_exit(struct pm860x_chip *chip) __devexit ;
414
415#endif /* __LINUX_MFD_88PM860X_H */ 487#endif /* __LINUX_MFD_88PM860X_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
new file mode 100644
index 000000000000..afd3080bde24
--- /dev/null
+++ b/include/linux/mfd/ab3100.h
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2007-2009 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 *
7 */
8
9#include <linux/regulator/machine.h>
10
11struct device;
12
13#ifndef MFD_AB3100_H
14#define MFD_AB3100_H
15
16
17#define AB3100_P1A 0xc0
18#define AB3100_P1B 0xc1
19#define AB3100_P1C 0xc2
20#define AB3100_P1D 0xc3
21#define AB3100_P1E 0xc4
22#define AB3100_P1F 0xc5
23#define AB3100_P1G 0xc6
24#define AB3100_R2A 0xc7
25#define AB3100_R2B 0xc8
26
27/*
28 * AB3100, EVENTA1, A2 and A3 event register flags
29 * these are catenated into a single 32-bit flag in the code
30 * for event notification broadcasts.
31 */
32#define AB3100_EVENTA1_ONSWA (0x01<<16)
33#define AB3100_EVENTA1_ONSWB (0x02<<16)
34#define AB3100_EVENTA1_ONSWC (0x04<<16)
35#define AB3100_EVENTA1_DCIO (0x08<<16)
36#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
37#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
38#define AB3100_EVENTA1_VBUS (0x40<<16)
39#define AB3100_EVENTA1_VSET_USB (0x80<<16)
40
41#define AB3100_EVENTA2_READY_TX (0x01<<8)
42#define AB3100_EVENTA2_READY_RX (0x02<<8)
43#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
44#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
45#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
46#define AB3100_EVENTA2_MIDR (0x20<<8)
47#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
48#define AB3100_EVENTA2_ALARM (0x80<<8)
49
50#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
51#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
52#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
53#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
54#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
55#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
56#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
57#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
58
59/* AB3100, STR register flags */
60#define AB3100_STR_ONSWA (0x01)
61#define AB3100_STR_ONSWB (0x02)
62#define AB3100_STR_ONSWC (0x04)
63#define AB3100_STR_DCIO (0x08)
64#define AB3100_STR_BOOT_MODE (0x10)
65#define AB3100_STR_SIM_OFF (0x20)
66#define AB3100_STR_BATT_REMOVAL (0x40)
67#define AB3100_STR_VBUS (0x80)
68
69/*
70 * AB3100 contains 8 regulators, one external regulator controller
71 * and a buck converter, further the LDO E and buck converter can
72 * have separate settings if they are in sleep mode, this is
73 * modeled as a separate regulator.
74 */
75#define AB3100_NUM_REGULATORS 10
76
77/**
78 * struct ab3100
79 * @access_mutex: lock out concurrent accesses to the AB3100 registers
80 * @dev: pointer to the containing device
81 * @i2c_client: I2C client for this chip
82 * @testreg_client: secondary client for test registers
83 * @chip_name: name of this chip variant
84 * @chip_id: 8 bit chip ID for this chip variant
85 * @event_subscribers: event subscribers are listed here
86 * @startup_events: a copy of the first reading of the event registers
87 * @startup_events_read: whether the first events have been read
88 *
89 * This struct is PRIVATE and devices using it should NOT
90 * access ANY fields. It is used as a token for calling the
91 * AB3100 functions.
92 */
93struct ab3100 {
94 struct mutex access_mutex;
95 struct device *dev;
96 struct i2c_client *i2c_client;
97 struct i2c_client *testreg_client;
98 char chip_name[32];
99 u8 chip_id;
100 struct blocking_notifier_head event_subscribers;
101 u8 startup_events[3];
102 bool startup_events_read;
103};
104
105/**
106 * struct ab3100_platform_data
107 * Data supplied to initialize board connections to the AB3100
108 * @reg_constraints: regulator constraints for target board
109 * the order of these constraints are: LDO A, C, D, E,
110 * F, G, H, K, EXT and BUCK.
111 * @reg_initvals: initial values for the regulator registers
112 * plus two sleep settings for LDO E and the BUCK converter.
113 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
114 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
115 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
116 * @external_voltage: voltage level of the external regulator.
117 */
118struct ab3100_platform_data {
119 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
120 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
121 int external_voltage;
122};
123
124int ab3100_event_register(struct ab3100 *ab3100,
125 struct notifier_block *nb);
126int ab3100_event_unregister(struct ab3100 *ab3100,
127 struct notifier_block *nb);
128
129#endif /* MFD_AB3100_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 1318ca622633..5d5298d56026 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -1,12 +1,9 @@
1/* 1/*
2 * Copyright (C) 2007-2009 ST-Ericsson AB 2 * Copyright (C) 2007-2009 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 * 4 *
7 * ABX500 core access functions. 5 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 6 * The abx500 interface is used for the Analog Baseband chips.
9 * ab3100 and ab8500.
10 * 7 *
11 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 8 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 9 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -21,118 +18,6 @@ struct device;
21#ifndef MFD_ABX500_H 18#ifndef MFD_ABX500_H
22#define MFD_ABX500_H 19#define MFD_ABX500_H
23 20
24#define AB3100_P1A 0xc0
25#define AB3100_P1B 0xc1
26#define AB3100_P1C 0xc2
27#define AB3100_P1D 0xc3
28#define AB3100_P1E 0xc4
29#define AB3100_P1F 0xc5
30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8
33
34/*
35 * AB3100, EVENTA1, A2 and A3 event register flags
36 * these are catenated into a single 32-bit flag in the code
37 * for event notification broadcasts.
38 */
39#define AB3100_EVENTA1_ONSWA (0x01<<16)
40#define AB3100_EVENTA1_ONSWB (0x02<<16)
41#define AB3100_EVENTA1_ONSWC (0x04<<16)
42#define AB3100_EVENTA1_DCIO (0x08<<16)
43#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
44#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
45#define AB3100_EVENTA1_VBUS (0x40<<16)
46#define AB3100_EVENTA1_VSET_USB (0x80<<16)
47
48#define AB3100_EVENTA2_READY_TX (0x01<<8)
49#define AB3100_EVENTA2_READY_RX (0x02<<8)
50#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
51#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
52#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
53#define AB3100_EVENTA2_MIDR (0x20<<8)
54#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
55#define AB3100_EVENTA2_ALARM (0x80<<8)
56
57#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
58#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
59#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
60#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
61#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
62#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
63#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
64#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
65
66/* AB3100, STR register flags */
67#define AB3100_STR_ONSWA (0x01)
68#define AB3100_STR_ONSWB (0x02)
69#define AB3100_STR_ONSWC (0x04)
70#define AB3100_STR_DCIO (0x08)
71#define AB3100_STR_BOOT_MODE (0x10)
72#define AB3100_STR_SIM_OFF (0x20)
73#define AB3100_STR_BATT_REMOVAL (0x40)
74#define AB3100_STR_VBUS (0x80)
75
76/*
77 * AB3100 contains 8 regulators, one external regulator controller
78 * and a buck converter, further the LDO E and buck converter can
79 * have separate settings if they are in sleep mode, this is
80 * modeled as a separate regulator.
81 */
82#define AB3100_NUM_REGULATORS 10
83
84/**
85 * struct ab3100
86 * @access_mutex: lock out concurrent accesses to the AB3100 registers
87 * @dev: pointer to the containing device
88 * @i2c_client: I2C client for this chip
89 * @testreg_client: secondary client for test registers
90 * @chip_name: name of this chip variant
91 * @chip_id: 8 bit chip ID for this chip variant
92 * @event_subscribers: event subscribers are listed here
93 * @startup_events: a copy of the first reading of the event registers
94 * @startup_events_read: whether the first events have been read
95 *
96 * This struct is PRIVATE and devices using it should NOT
97 * access ANY fields. It is used as a token for calling the
98 * AB3100 functions.
99 */
100struct ab3100 {
101 struct mutex access_mutex;
102 struct device *dev;
103 struct i2c_client *i2c_client;
104 struct i2c_client *testreg_client;
105 char chip_name[32];
106 u8 chip_id;
107 struct blocking_notifier_head event_subscribers;
108 u8 startup_events[3];
109 bool startup_events_read;
110};
111
112/**
113 * struct ab3100_platform_data
114 * Data supplied to initialize board connections to the AB3100
115 * @reg_constraints: regulator constraints for target board
116 * the order of these constraints are: LDO A, C, D, E,
117 * F, G, H, K, EXT and BUCK.
118 * @reg_initvals: initial values for the regulator registers
119 * plus two sleep settings for LDO E and the BUCK converter.
120 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
121 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
122 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
123 * @external_voltage: voltage level of the external regulator.
124 */
125struct ab3100_platform_data {
126 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
127 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
128 int external_voltage;
129};
130
131int ab3100_event_register(struct ab3100 *ab3100,
132 struct notifier_block *nb);
133int ab3100_event_unregister(struct ab3100 *ab3100,
134 struct notifier_block *nb);
135
136/** 21/**
137 * struct abx500_init_setting 22 * struct abx500_init_setting
138 * Initial value of the registers for driver to use during setup. 23 * Initial value of the registers for driver to use during setup.
diff --git a/include/linux/mfd/abx500/ab8500-codec.h b/include/linux/mfd/abx500/ab8500-codec.h
index dc6529202cdd..d7079413def0 100644
--- a/include/linux/mfd/abx500/ab8500-codec.h
+++ b/include/linux/mfd/abx500/ab8500-codec.h
@@ -23,7 +23,8 @@ enum amic_type {
23/* Mic-biases */ 23/* Mic-biases */
24enum amic_micbias { 24enum amic_micbias {
25 AMIC_MICBIAS_VAMIC1, 25 AMIC_MICBIAS_VAMIC1,
26 AMIC_MICBIAS_VAMIC2 26 AMIC_MICBIAS_VAMIC2,
27 AMIC_MICBIAS_UNKNOWN
27}; 28};
28 29
29/* Bias-voltage */ 30/* Bias-voltage */
@@ -31,7 +32,8 @@ enum ear_cm_voltage {
31 EAR_CMV_0_95V, 32 EAR_CMV_0_95V,
32 EAR_CMV_1_10V, 33 EAR_CMV_1_10V,
33 EAR_CMV_1_27V, 34 EAR_CMV_1_27V,
34 EAR_CMV_1_58V 35 EAR_CMV_1_58V,
36 EAR_CMV_UNKNOWN
35}; 37};
36 38
37/* Analog microphone settings */ 39/* Analog microphone settings */
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 3764cb6759e3..1491044efa10 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -341,6 +341,4 @@ static inline int is_ab8500_2p0(struct ab8500 *ab)
341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); 341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
342} 342}
343 343
344int ab8500_irq_get_virq(struct ab8500 *ab8500, int irq);
345
346#endif /* MFD_AB8500_H */ 344#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 3a8435a8058f..cebe97ee98b8 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -16,6 +16,8 @@
16 16
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18 18
19struct irq_domain;
20
19/* 21/*
20 * This struct describes the MFD part ("cell"). 22 * This struct describes the MFD part ("cell").
21 * After registration the copy of this structure will become the platform data 23 * After registration the copy of this structure will become the platform data
@@ -98,7 +100,7 @@ static inline const struct mfd_cell *mfd_get_cell(struct platform_device *pdev)
98extern int mfd_add_devices(struct device *parent, int id, 100extern int mfd_add_devices(struct device *parent, int id,
99 struct mfd_cell *cells, int n_devs, 101 struct mfd_cell *cells, int n_devs,
100 struct resource *mem_base, 102 struct resource *mem_base,
101 int irq_base); 103 int irq_base, struct irq_domain *irq_domain);
102 104
103extern void mfd_remove_devices(struct device *parent); 105extern void mfd_remove_devices(struct device *parent);
104 106
diff --git a/include/linux/mfd/da9055/core.h b/include/linux/mfd/da9055/core.h
new file mode 100644
index 000000000000..c96ad682c59e
--- /dev/null
+++ b/include/linux/mfd/da9055/core.h
@@ -0,0 +1,94 @@
1/*
2 * da9055 declarations for DA9055 PMICs.
3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __DA9055_CORE_H
25#define __DA9055_CORE_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29
30/*
31 * PMIC IRQ
32 */
33#define DA9055_IRQ_ALARM 0x01
34#define DA9055_IRQ_TICK 0x02
35#define DA9055_IRQ_NONKEY 0x00
36#define DA9055_IRQ_REGULATOR 0x0B
37#define DA9055_IRQ_HWMON 0x03
38
39struct da9055_pdata;
40
41struct da9055 {
42 struct regmap *regmap;
43 struct regmap_irq_chip_data *irq_data;
44 struct device *dev;
45 struct i2c_client *i2c_client;
46
47 int irq_base;
48 int chip_irq;
49};
50
51/* Device I/O */
52static inline int da9055_reg_read(struct da9055 *da9055, unsigned char reg)
53{
54 int val, ret;
55
56 ret = regmap_read(da9055->regmap, reg, &val);
57 if (ret < 0)
58 return ret;
59
60 return val;
61}
62
63static inline int da9055_reg_write(struct da9055 *da9055, unsigned char reg,
64 unsigned char val)
65{
66 return regmap_write(da9055->regmap, reg, val);
67}
68
69static inline int da9055_group_read(struct da9055 *da9055, unsigned char reg,
70 unsigned reg_cnt, unsigned char *val)
71{
72 return regmap_bulk_read(da9055->regmap, reg, val, reg_cnt);
73}
74
75static inline int da9055_group_write(struct da9055 *da9055, unsigned char reg,
76 unsigned reg_cnt, unsigned char *val)
77{
78 return regmap_raw_write(da9055->regmap, reg, val, reg_cnt);
79}
80
81static inline int da9055_reg_update(struct da9055 *da9055, unsigned char reg,
82 unsigned char bit_mask,
83 unsigned char reg_val)
84{
85 return regmap_update_bits(da9055->regmap, reg, bit_mask, reg_val);
86}
87
88/* Generic Device API */
89int da9055_device_init(struct da9055 *da9055);
90void da9055_device_exit(struct da9055 *da9055);
91
92extern struct regmap_config da9055_regmap_config;
93
94#endif /* __DA9055_CORE_H */
diff --git a/include/linux/mfd/da9055/pdata.h b/include/linux/mfd/da9055/pdata.h
new file mode 100644
index 000000000000..147293b4471d
--- /dev/null
+++ b/include/linux/mfd/da9055/pdata.h
@@ -0,0 +1,32 @@
1/* Copyright (C) 2012 Dialog Semiconductor Ltd.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 */
9#ifndef __DA9055_PDATA_H
10#define __DA9055_PDATA_H
11
12#define DA9055_MAX_REGULATORS 8
13
14struct da9055;
15
16enum gpio_select {
17 NO_GPIO = 0,
18 GPIO_1,
19 GPIO_2
20};
21
22struct da9055_pdata {
23 int (*init) (struct da9055 *da9055);
24 int irq_base;
25 int gpio_base;
26
27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS];
28 bool reset_enable; /* Enable RTC in RESET Mode */
29 enum gpio_select *gpio_rsel; /* Select regulator set thru GPIO 1/2 */
30 enum gpio_select *gpio_ren; /* Enable regulator thru GPIO 1/2 */
31};
32#endif /* __DA9055_PDATA_H */
diff --git a/include/linux/mfd/da9055/reg.h b/include/linux/mfd/da9055/reg.h
new file mode 100644
index 000000000000..df237ee54803
--- /dev/null
+++ b/include/linux/mfd/da9055/reg.h
@@ -0,0 +1,699 @@
1/*
2 * DA9055 declarations for DA9055 PMICs.
3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __DA9055_REG_H
25#define __DA9055_REG_H
26
27/*
28 * PMIC registers
29 */
30 /* PAGE0 */
31#define DA9055_REG_PAGE_CON 0x00
32
33/* System Control and Event Registers */
34#define DA9055_REG_STATUS_A 0x01
35#define DA9055_REG_STATUS_B 0x02
36#define DA9055_REG_FAULT_LOG 0x03
37#define DA9055_REG_EVENT_A 0x04
38#define DA9055_REG_EVENT_B 0x05
39#define DA9055_REG_EVENT_C 0x06
40#define DA9055_REG_IRQ_MASK_A 0x07
41#define DA9055_REG_IRQ_MASK_B 0x08
42#define DA9055_REG_IRQ_MASK_C 0x09
43#define DA9055_REG_CONTROL_A 0x0A
44#define DA9055_REG_CONTROL_B 0x0B
45#define DA9055_REG_CONTROL_C 0x0C
46#define DA9055_REG_CONTROL_D 0x0D
47#define DA9055_REG_CONTROL_E 0x0E
48#define DA9055_REG_PD_DIS 0x0F
49
50/* GPIO Control Registers */
51#define DA9055_REG_GPIO0_1 0x10
52#define DA9055_REG_GPIO2 0x11
53#define DA9055_REG_GPIO_MODE0_2 0x12
54
55/* Regulator Control Registers */
56#define DA9055_REG_BCORE_CONT 0x13
57#define DA9055_REG_BMEM_CONT 0x14
58#define DA9055_REG_LDO1_CONT 0x15
59#define DA9055_REG_LDO2_CONT 0x16
60#define DA9055_REG_LDO3_CONT 0x17
61#define DA9055_REG_LDO4_CONT 0x18
62#define DA9055_REG_LDO5_CONT 0x19
63#define DA9055_REG_LDO6_CONT 0x1A
64
65/* GP-ADC Control Registers */
66#define DA9055_REG_ADC_MAN 0x1B
67#define DA9055_REG_ADC_CONT 0x1C
68#define DA9055_REG_VSYS_MON 0x1D
69#define DA9055_REG_ADC_RES_L 0x1E
70#define DA9055_REG_ADC_RES_H 0x1F
71#define DA9055_REG_VSYS_RES 0x20
72#define DA9055_REG_ADCIN1_RES 0x21
73#define DA9055_REG_ADCIN2_RES 0x22
74#define DA9055_REG_ADCIN3_RES 0x23
75
76/* Sequencer Control Registers */
77#define DA9055_REG_EN_32K 0x35
78
79/* Regulator Setting Registers */
80#define DA9055_REG_BUCK_LIM 0x37
81#define DA9055_REG_BCORE_MODE 0x38
82#define DA9055_REG_VBCORE_A 0x39
83#define DA9055_REG_VBMEM_A 0x3A
84#define DA9055_REG_VLDO1_A 0x3B
85#define DA9055_REG_VLDO2_A 0x3C
86#define DA9055_REG_VLDO3_A 0x3D
87#define DA9055_REG_VLDO4_A 0x3E
88#define DA9055_REG_VLDO5_A 0x3F
89#define DA9055_REG_VLDO6_A 0x40
90#define DA9055_REG_VBCORE_B 0x41
91#define DA9055_REG_VBMEM_B 0x42
92#define DA9055_REG_VLDO1_B 0x43
93#define DA9055_REG_VLDO2_B 0x44
94#define DA9055_REG_VLDO3_B 0x45
95#define DA9055_REG_VLDO4_B 0x46
96#define DA9055_REG_VLDO5_B 0x47
97#define DA9055_REG_VLDO6_B 0x48
98
99/* GP-ADC Threshold Registers */
100#define DA9055_REG_AUTO1_HIGH 0x49
101#define DA9055_REG_AUTO1_LOW 0x4A
102#define DA9055_REG_AUTO2_HIGH 0x4B
103#define DA9055_REG_AUTO2_LOW 0x4C
104#define DA9055_REG_AUTO3_HIGH 0x4D
105#define DA9055_REG_AUTO3_LOW 0x4E
106
107/* OTP */
108#define DA9055_REG_OPT_COUNT 0x50
109#define DA9055_REG_OPT_ADDR 0x51
110#define DA9055_REG_OPT_DATA 0x52
111
112/* RTC Calendar and Alarm Registers */
113#define DA9055_REG_COUNT_S 0x53
114#define DA9055_REG_COUNT_MI 0x54
115#define DA9055_REG_COUNT_H 0x55
116#define DA9055_REG_COUNT_D 0x56
117#define DA9055_REG_COUNT_MO 0x57
118#define DA9055_REG_COUNT_Y 0x58
119#define DA9055_REG_ALARM_MI 0x59
120#define DA9055_REG_ALARM_H 0x5A
121#define DA9055_REG_ALARM_D 0x5B
122#define DA9055_REG_ALARM_MO 0x5C
123#define DA9055_REG_ALARM_Y 0x5D
124#define DA9055_REG_SECOND_A 0x5E
125#define DA9055_REG_SECOND_B 0x5F
126#define DA9055_REG_SECOND_C 0x60
127#define DA9055_REG_SECOND_D 0x61
128
129/* Customer Trim and Configuration */
130#define DA9055_REG_T_OFFSET 0x63
131#define DA9055_REG_INTERFACE 0x64
132#define DA9055_REG_CONFIG_A 0x65
133#define DA9055_REG_CONFIG_B 0x66
134#define DA9055_REG_CONFIG_C 0x67
135#define DA9055_REG_CONFIG_D 0x68
136#define DA9055_REG_CONFIG_E 0x69
137#define DA9055_REG_TRIM_CLDR 0x6F
138
139/* General Purpose Registers */
140#define DA9055_REG_GP_ID_0 0x70
141#define DA9055_REG_GP_ID_1 0x71
142#define DA9055_REG_GP_ID_2 0x72
143#define DA9055_REG_GP_ID_3 0x73
144#define DA9055_REG_GP_ID_4 0x74
145#define DA9055_REG_GP_ID_5 0x75
146#define DA9055_REG_GP_ID_6 0x76
147#define DA9055_REG_GP_ID_7 0x77
148#define DA9055_REG_GP_ID_8 0x78
149#define DA9055_REG_GP_ID_9 0x79
150#define DA9055_REG_GP_ID_10 0x7A
151#define DA9055_REG_GP_ID_11 0x7B
152#define DA9055_REG_GP_ID_12 0x7C
153#define DA9055_REG_GP_ID_13 0x7D
154#define DA9055_REG_GP_ID_14 0x7E
155#define DA9055_REG_GP_ID_15 0x7F
156#define DA9055_REG_GP_ID_16 0x80
157#define DA9055_REG_GP_ID_17 0x81
158#define DA9055_REG_GP_ID_18 0x82
159#define DA9055_REG_GP_ID_19 0x83
160
161#define DA9055_MAX_REGISTER_CNT DA9055_REG_GP_ID_19
162
163/*
164 * PMIC registers bits
165 */
166
167/* DA9055_REG_PAGE_CON (addr=0x00) */
168#define DA9055_PAGE_WRITE_MODE (0<<6)
169#define DA9055_REPEAT_WRITE_MODE (1<<6)
170
171/* DA9055_REG_STATUS_A (addr=0x01) */
172#define DA9055_NOKEY_STS 0x01
173#define DA9055_WAKE_STS 0x02
174#define DA9055_DVC_BUSY_STS 0x04
175#define DA9055_COMP1V2_STS 0x08
176#define DA9055_NJIG_STS 0x10
177#define DA9055_LDO5_LIM_STS 0x20
178#define DA9055_LDO6_LIM_STS 0x40
179
180/* DA9055_REG_STATUS_B (addr=0x02) */
181#define DA9055_GPI0_STS 0x01
182#define DA9055_GPI1_STS 0x02
183#define DA9055_GPI2_STS 0x04
184
185/* DA9055_REG_FAULT_LOG (addr=0x03) */
186#define DA9055_TWD_ERROR_FLG 0x01
187#define DA9055_POR_FLG 0x02
188#define DA9055_VDD_FAULT_FLG 0x04
189#define DA9055_VDD_START_FLG 0x08
190#define DA9055_TEMP_CRIT_FLG 0x10
191#define DA9055_KEY_RESET_FLG 0x20
192#define DA9055_WAIT_SHUT_FLG 0x80
193
194/* DA9055_REG_EVENT_A (addr=0x04) */
195#define DA9055_NOKEY_EINT 0x01
196#define DA9055_ALARM_EINT 0x02
197#define DA9055_TICK_EINT 0x04
198#define DA9055_ADC_RDY_EINT 0x08
199#define DA9055_SEQ_RDY_EINT 0x10
200#define DA9055_EVENTS_B_EINT 0x20
201#define DA9055_EVENTS_C_EINT 0x40
202
203/* DA9055_REG_EVENT_B (addr=0x05) */
204#define DA9055_E_WAKE_EINT 0x01
205#define DA9055_E_TEMP_EINT 0x02
206#define DA9055_E_COMP1V2_EINT 0x04
207#define DA9055_E_LDO_LIM_EINT 0x08
208#define DA9055_E_NJIG_EINT 0x20
209#define DA9055_E_VDD_MON_EINT 0x40
210#define DA9055_E_VDD_WARN_EINT 0x80
211
212/* DA9055_REG_EVENT_C (addr=0x06) */
213#define DA9055_E_GPI0_EINT 0x01
214#define DA9055_E_GPI1_EINT 0x02
215#define DA9055_E_GPI2_EINT 0x04
216
217/* DA9055_REG_IRQ_MASK_A (addr=0x07) */
218#define DA9055_M_NONKEY_EINT 0x01
219#define DA9055_M_ALARM_EINT 0x02
220#define DA9055_M_TICK_EINT 0x04
221#define DA9055_M_ADC_RDY_EINT 0x08
222#define DA9055_M_SEQ_RDY_EINT 0x10
223
224/* DA9055_REG_IRQ_MASK_B (addr=0x08) */
225#define DA9055_M_WAKE_EINT 0x01
226#define DA9055_M_TEMP_EINT 0x02
227#define DA9055_M_COMP_1V2_EINT 0x04
228#define DA9055_M_LDO_LIM_EINT 0x08
229#define DA9055_M_NJIG_EINT 0x20
230#define DA9055_M_VDD_MON_EINT 0x40
231#define DA9055_M_VDD_WARN_EINT 0x80
232
233/* DA9055_REG_IRQ_MASK_C (addr=0x09) */
234#define DA9055_M_GPI0_EINT 0x01
235#define DA9055_M_GPI1_EINT 0x02
236#define DA9055_M_GPI2_EINT 0x04
237
238/* DA9055_REG_CONTROL_A (addr=0xA) */
239#define DA9055_DEBOUNCING_SHIFT 0x00
240#define DA9055_DEBOUNCING_MASK 0x07
241#define DA9055_NRES_MODE_SHIFT 0x03
242#define DA9055_NRES_MODE_MASK 0x08
243#define DA9055_SLEW_RATE_SHIFT 0x04
244#define DA9055_SLEW_RATE_MASK 0x30
245#define DA9055_NOKEY_LOCK_SHIFT 0x06
246#define DA9055_NOKEY_LOCK_MASK 0x40
247
248/* DA9055_REG_CONTROL_B (addr=0xB) */
249#define DA9055_RTC_MODE_PD 0x01
250#define DA9055_RTC_MODE_SD_SHIFT 0x01
251#define DA9055_RTC_MODE_SD 0x02
252#define DA9055_RTC_EN 0x04
253#define DA9055_ECO_MODE_SHIFT 0x03
254#define DA9055_ECO_MODE_MASK 0x08
255#define DA9055_TWDSCALE_SHIFT 4
256#define DA9055_TWDSCALE_MASK 0x70
257#define DA9055_V_LOCK_SHIFT 0x07
258#define DA9055_V_LOCK_MASK 0x80
259
260/* DA9055_REG_CONTROL_C (addr=0xC) */
261#define DA9055_SYSTEM_EN_SHIFT 0x00
262#define DA9055_SYSTEM_EN_MASK 0x01
263#define DA9055_POWERN_EN_SHIFT 0x01
264#define DA9055_POWERN_EN_MASK 0x02
265#define DA9055_POWER1_EN_SHIFT 0x02
266#define DA9055_POWER1_EN_MASK 0x04
267
268/* DA9055_REG_CONTROL_D (addr=0xD) */
269#define DA9055_STANDBY_SHIFT 0x02
270#define DA9055_STANDBY_MASK 0x08
271#define DA9055_AUTO_BOOT_SHIFT 0x03
272#define DA9055_AUTO_BOOT_MASK 0x04
273
274/* DA9055_REG_CONTROL_E (addr=0xE) */
275#define DA9055_WATCHDOG_SHIFT 0x00
276#define DA9055_WATCHDOG_MASK 0x01
277#define DA9055_SHUTDOWN_SHIFT 0x01
278#define DA9055_SHUTDOWN_MASK 0x02
279#define DA9055_WAKE_UP_SHIFT 0x02
280#define DA9055_WAKE_UP_MASK 0x04
281
282/* DA9055_REG_GPIO (addr=0x10/0x11) */
283#define DA9055_GPIO0_PIN_SHIFT 0x00
284#define DA9055_GPIO0_PIN_MASK 0x03
285#define DA9055_GPIO0_TYPE_SHIFT 0x02
286#define DA9055_GPIO0_TYPE_MASK 0x04
287#define DA9055_GPIO0_WEN_SHIFT 0x03
288#define DA9055_GPIO0_WEN_MASK 0x08
289#define DA9055_GPIO1_PIN_SHIFT 0x04
290#define DA9055_GPIO1_PIN_MASK 0x30
291#define DA9055_GPIO1_TYPE_SHIFT 0x06
292#define DA9055_GPIO1_TYPE_MASK 0x40
293#define DA9055_GPIO1_WEN_SHIFT 0x07
294#define DA9055_GPIO1_WEN_MASK 0x80
295#define DA9055_GPIO2_PIN_SHIFT 0x00
296#define DA9055_GPIO2_PIN_MASK 0x30
297#define DA9055_GPIO2_TYPE_SHIFT 0x02
298#define DA9055_GPIO2_TYPE_MASK 0x04
299#define DA9055_GPIO2_WEN_SHIFT 0x03
300#define DA9055_GPIO2_WEN_MASK 0x08
301
302/* DA9055_REG_GPIO_MODE (addr=0x12) */
303#define DA9055_GPIO0_MODE_SHIFT 0x00
304#define DA9055_GPIO0_MODE_MASK 0x01
305#define DA9055_GPIO1_MODE_SHIFT 0x01
306#define DA9055_GPIO1_MODE_MASK 0x02
307#define DA9055_GPIO2_MODE_SHIFT 0x02
308#define DA9055_GPIO2_MODE_MASK 0x04
309
310/* DA9055_REG_BCORE_CONT (addr=0x13) */
311#define DA9055_BCORE_EN_SHIFT 0x00
312#define DA9055_BCORE_EN_MASK 0x01
313#define DA9055_BCORE_GPI_SHIFT 0x01
314#define DA9055_BCORE_GPI_MASK 0x02
315#define DA9055_BCORE_PD_DIS_SHIFT 0x03
316#define DA9055_BCORE_PD_DIS_MASK 0x04
317#define DA9055_VBCORE_SEL_SHIFT 0x04
318#define DA9055_SEL_REG_A 0x0
319#define DA9055_SEL_REG_B 0x10
320#define DA9055_VBCORE_SEL_MASK 0x10
321#define DA9055_V_GPI_MASK 0x60
322#define DA9055_V_GPI_SHIFT 0x05
323#define DA9055_E_GPI_MASK 0x06
324#define DA9055_E_GPI_SHIFT 0x01
325#define DA9055_VBCORE_GPI_SHIFT 0x05
326#define DA9055_VBCORE_GPI_MASK 0x60
327#define DA9055_BCORE_CONF_SHIFT 0x07
328#define DA9055_BCORE_CONF_MASK 0x80
329
330/* DA9055_REG_BMEM_CONT (addr=0x14) */
331#define DA9055_BMEM_EN_SHIFT 0x00
332#define DA9055_BMEM_EN_MASK 0x01
333#define DA9055_BMEM_GPI_SHIFT 0x01
334#define DA9055_BMEM_GPI_MASK 0x06
335#define DA9055_BMEM_PD_DIS_SHIFT 0x03
336#define DA9055_BMEM_PD_DIS_MASK 0x08
337#define DA9055_VBMEM_SEL_SHIT 0x04
338#define DA9055_VBMEM_SEL_VBMEM_A (0<<4)
339#define DA9055_VBMEM_SEL_VBMEM_B (1<<4)
340#define DA9055_VBMEM_SEL_MASK 0x10
341#define DA9055_VBMEM_GPI_SHIFT 0x05
342#define DA9055_VBMEM_GPI_MASK 0x60
343#define DA9055_BMEM_CONF_SHIFT 0x07
344#define DA9055_BMEM_CONF_MASK 0x80
345
346/* DA9055_REG_LDO_CONT (addr=0x15-0x1A) */
347#define DA9055_LDO_EN_SHIFT 0x00
348#define DA9055_LDO_EN_MASK 0x01
349#define DA9055_LDO_GPI_SHIFT 0x01
350#define DA9055_LDO_GPI_MASK 0x06
351#define DA9055_LDO_PD_DIS_SHIFT 0x03
352#define DA9055_LDO_PD_DIS_MASK 0x08
353#define DA9055_VLDO_SEL_SHIFT 0x04
354#define DA9055_VLDO_SEL_MASK 0x10
355#define DA9055_VLDO_SEL_VLDO_A 0x00
356#define DA9055_VLDO_SEL_VLDO_B 0x01
357#define DA9055_VLDO_GPI_SHIFT 0x05
358#define DA9055_VLDO_GPI_MASK 0x60
359#define DA9055_LDO_CONF_SHIFT 0x07
360#define DA9055_LDO_CONF_MASK 0x80
361#define DA9055_REGUALTOR_SET_A 0x00
362#define DA9055_REGUALTOR_SET_B 0x10
363
364/* DA9055_REG_ADC_MAN (addr=0x1B) */
365#define DA9055_ADC_MUX_SHIFT 0
366#define DA9055_ADC_MUX_MASK 0xF
367#define DA9055_ADC_MUX_VSYS 0x0
368#define DA9055_ADC_MUX_ADCIN1 0x01
369#define DA9055_ADC_MUX_ADCIN2 0x02
370#define DA9055_ADC_MUX_ADCIN3 0x03
371#define DA9055_ADC_MUX_T_SENSE 0x04
372#define DA9055_ADC_MAN_SHIFT 0x04
373#define DA9055_ADC_MAN_CONV 0x10
374#define DA9055_ADC_LSB_MASK 0X03
375#define DA9055_ADC_MODE_MASK 0x20
376#define DA9055_ADC_MODE_SHIFT 5
377#define DA9055_ADC_MODE_1MS (1<<5)
378#define DA9055_COMP1V2_EN_SHIFT 7
379
380/* DA9055_REG_ADC_CONT (addr=0x1C) */
381#define DA9055_ADC_AUTO_VSYS_EN_SHIFT 0
382#define DA9055_ADC_AUTO_AD1_EN_SHIFT 1
383#define DA9055_ADC_AUTO_AD2_EN_SHIFT 2
384#define DA9055_ADC_AUTO_AD3_EN_SHIFT 3
385#define DA9055_ADC_ISRC_EN_SHIFT 4
386#define DA9055_ADC_ADCIN1_DEB_SHIFT 5
387#define DA9055_ADC_ADCIN2_DEB_SHIFT 6
388#define DA9055_ADC_ADCIN3_DEB_SHIFT 7
389#define DA9055_AD1_ISRC_MASK 0x10
390#define DA9055_AD1_ISRC_SHIFT 4
391
392/* DA9055_REG_VSYS_MON (addr=0x1D) */
393#define DA9055_VSYS_VAL_SHIFT 0
394#define DA9055_VSYS_VAL_MASK 0xFF
395#define DA9055_VSYS_VAL_BASE 0x00
396#define DA9055_VSYS_VAL_MAX DA9055_VSYS_VAL_MASK
397#define DA9055_VSYS_VOLT_BASE 2500
398#define DA9055_VSYS_VOLT_INC 10
399#define DA9055_VSYS_STEPS 255
400#define DA9055_VSYS_VOLT_MIN 2500
401
402/* DA9044_REG_XXX_RES (addr=0x20-0x23) */
403#define DA9055_ADC_VAL_SHIFT 0
404#define DA9055_ADC_VAL_MASK 0xFF
405#define DA9055_ADC_VAL_BASE 0x00
406#define DA9055_ADC_VAL_MAX DA9055_ADC_VAL_MASK
407#define DA9055_ADC_VOLT_BASE 0
408#define DA9055_ADC_VSYS_VOLT_BASE 2500
409#define DA9055_ADC_VOLT_INC 10
410#define DA9055_ADC_VSYS_VOLT_INC 12
411#define DA9055_ADC_STEPS 255
412
413/* DA9055_REG_EN_32K (addr=0x35)*/
414#define DA9055_STARTUP_TIME_MASK 0x07
415#define DA9055_STARTUP_TIME_0S 0x0
416#define DA9055_STARTUP_TIME_0_52S 0x1
417#define DA9055_STARTUP_TIME_1S 0x2
418#define DA9055_CRYSTAL_EN 0x08
419#define DA9055_DELAY_MODE_EN 0x10
420#define DA9055_OUT_CLCK_GATED 0x20
421#define DA9055_RTC_CLOCK_GATED 0x40
422#define DA9055_EN_32KOUT_BUF 0x80
423
424/* DA9055_REG_RESET (addr=0x36) */
425/* Timer up to 31.744 ms */
426#define DA9055_RESET_TIMER_VAL_SHIFT 0
427#define DA9055_RESET_LOW_VAL_MASK 0x3F
428#define DA9055_RESET_LOW_VAL_BASE 0
429#define DA9055_RESET_LOW_VAL_MAX DA9055_RESET_LOW_VAL_MASK
430#define DA9055_RESET_US_LOW_BASE 1024 /* min val in units of us */
431#define DA9055_RESET_US_LOW_INC 1024 /* inc val in units of us */
432#define DA9055_RESET_US_LOW_STEP 30
433
434/* Timer up to 1048.576ms */
435#define DA9055_RESET_HIGH_VAL_MASK 0x3F
436#define DA9055_RESET_HIGH_VAL_BASE 0
437#define DA9055_RESET_HIGH_VAL_MAX DA9055_RESET_HIGH_VAL_MASK
438#define DA9055_RESET_US_HIGH_BASE 32768 /* min val in units of us */
439#define DA9055_RESET_US_HIGH_INC 32768 /* inv val in units of us */
440#define DA9055_RESET_US_HIGH_STEP 31
441
442/* DA9055_REG_BUCK_ILIM (addr=0x37)*/
443#define DA9055_BMEM_ILIM_SHIFT 0
444#define DA9055_ILIM_MASK 0x3
445#define DA9055_ILIM_500MA 0x0
446#define DA9055_ILIM_600MA 0x1
447#define DA9055_ILIM_700MA 0x2
448#define DA9055_ILIM_800MA 0x3
449#define DA9055_BCORE_ILIM_SHIFT 2
450
451/* DA9055_REG_BCORE_MODE (addr=0x38) */
452#define DA9055_BMEM_MODE_SHIFT 0
453#define DA9055_MODE_MASK 0x3
454#define DA9055_MODE_AB 0x0
455#define DA9055_MODE_SLEEP 0x1
456#define DA9055_MODE_SYNCHRO 0x2
457#define DA9055_MODE_AUTO 0x3
458#define DA9055_BCORE_MODE_SHIFT 2
459
460/* DA9055_REG_VBCORE_A/B (addr=0x39/0x41)*/
461#define DA9055_VBCORE_VAL_SHIFT 0
462#define DA9055_VBCORE_VAL_MASK 0x3F
463#define DA9055_VBCORE_VAL_BASE 0x09
464#define DA9055_VBCORE_VAL_MAX DA9055_VBCORE_VAL_MASK
465#define DA9055_VBCORE_VOLT_BASE 750
466#define DA9055_VBCORE_VOLT_INC 25
467#define DA9055_VBCORE_STEPS 53
468#define DA9055_VBCORE_VOLT_MIN DA9055_VBCORE_VOLT_BASE
469#define DA9055_BCORE_SL_SYNCHRO (0<<7)
470#define DA9055_BCORE_SL_SLEEP (1<<7)
471
472/* DA9055_REG_VBMEM_A/B (addr=0x3A/0x42)*/
473#define DA9055_VBMEM_VAL_SHIFT 0
474#define DA9055_VBMEM_VAL_MASK 0x3F
475#define DA9055_VBMEM_VAL_BASE 0x00
476#define DA9055_VBMEM_VAL_MAX DA9055_VBMEM_VAL_MASK
477#define DA9055_VBMEM_VOLT_BASE 925
478#define DA9055_VBMEM_VOLT_INC 25
479#define DA9055_VBMEM_STEPS 63
480#define DA9055_VBMEM_VOLT_MIN DA9055_VBMEM_VOLT_BASE
481#define DA9055_BCMEM_SL_SYNCHRO (0<<7)
482#define DA9055_BCMEM_SL_SLEEP (1<<7)
483
484
485/* DA9055_REG_VLDO (addr=0x3B-0x40/0x43-0x48)*/
486#define DA9055_VLDO_VAL_SHIFT 0
487#define DA9055_VLDO_VAL_MASK 0x3F
488#define DA9055_VLDO6_VAL_MASK 0x7F
489#define DA9055_VLDO_VAL_BASE 0x02
490#define DA9055_VLDO2_VAL_BASE 0x03
491#define DA9055_VLDO6_VAL_BASE 0x00
492#define DA9055_VLDO_VAL_MAX DA9055_VLDO_VAL_MASK
493#define DA9055_VLDO6_VAL_MAX DA9055_VLDO6_VAL_MASK
494#define DA9055_VLDO_VOLT_BASE 900
495#define DA9055_VLDO_VOLT_INC 50
496#define DA9055_VLDO6_VOLT_INC 20
497#define DA9055_VLDO_STEPS 48
498#define DA9055_VLDO5_STEPS 37
499#define DA9055_VLDO6_STEPS 120
500#define DA9055_VLDO_VOLT_MIN DA9055_VLDO_VOLT_BASE
501#define DA9055_LDO_MODE_SHIFT 7
502#define DA9055_LDO_SL_NORMAL 0
503#define DA9055_LDO_SL_SLEEP 1
504
505/* DA9055_REG_OTP_CONT (addr=0x50) */
506#define DA9055_OTP_TIM_NORMAL (0<<0)
507#define DA9055_OTP_TIM_MARGINAL (1<<0)
508#define DA9055_OTP_GP_RD_SHIFT 1
509#define DA9055_OTP_APPS_RD_SHIFT 2
510#define DA9055_PC_DONE_SHIFT 3
511#define DA9055_OTP_GP_LOCK_SHIFT 4
512#define DA9055_OTP_APPS_LOCK_SHIFT 5
513#define DA9055_OTP_CONF_LOCK_SHIFT 6
514#define DA9055_OTP_WRITE_DIS_SHIFT 7
515
516/* DA9055_REG_COUNT_S (addr=0x53) */
517#define DA9055_RTC_SEC 0x3F
518#define DA9055_RTC_MONITOR_EN 0x40
519#define DA9055_RTC_READ 0x80
520
521/* DA9055_REG_COUNT_MI (addr=0x54) */
522#define DA9055_RTC_MIN 0x3F
523
524/* DA9055_REG_COUNT_H (addr=0x55) */
525#define DA9055_RTC_HOUR 0x1F
526
527/* DA9055_REG_COUNT_D (addr=0x56) */
528#define DA9055_RTC_DAY 0x1F
529
530/* DA9055_REG_COUNT_MO (addr=0x57) */
531#define DA9055_RTC_MONTH 0x0F
532
533/* DA9055_REG_COUNT_Y (addr=0x58) */
534#define DA9055_RTC_YEAR 0x3F
535#define DA9055_RTC_YEAR_BASE 2000
536
537/* DA9055_REG_ALARM_MI (addr=0x59) */
538#define DA9055_RTC_ALM_MIN 0x3F
539#define DA9055_ALARM_STATUS_SHIFT 6
540#define DA9055_ALARM_STATUS_MASK 0x3
541#define DA9055_ALARM_STATUS_NO_ALARM 0x0
542#define DA9055_ALARM_STATUS_TICK 0x1
543#define DA9055_ALARM_STATUS_TIMER_ALARM 0x2
544#define DA9055_ALARM_STATUS_BOTH 0x3
545
546/* DA9055_REG_ALARM_H (addr=0x5A) */
547#define DA9055_RTC_ALM_HOUR 0x1F
548
549/* DA9055_REG_ALARM_D (addr=0x5B) */
550#define DA9055_RTC_ALM_DAY 0x1F
551
552/* DA9055_REG_ALARM_MO (addr=0x5C) */
553#define DA9055_RTC_ALM_MONTH 0x0F
554#define DA9055_RTC_TICK_WAKE_MASK 0x20
555#define DA9055_RTC_TICK_WAKE_SHIFT 5
556#define DA9055_RTC_TICK_TYPE 0x10
557#define DA9055_RTC_TICK_TYPE_SHIFT 0x4
558#define DA9055_RTC_TICK_SEC 0x0
559#define DA9055_RTC_TICK_MIN 0x1
560#define DA9055_ALARAM_TICK_WAKE 0x20
561
562/* DA9055_REG_ALARM_Y (addr=0x5D) */
563#define DA9055_RTC_TICK_EN 0x80
564#define DA9055_RTC_ALM_EN 0x40
565#define DA9055_RTC_TICK_ALM_MASK 0xC0
566#define DA9055_RTC_ALM_YEAR 0x3F
567
568/* DA9055_REG_TRIM_CLDR (addr=0x62) */
569#define DA9055_TRIM_32K_SHIFT 0
570#define DA9055_TRIM_32K_MASK 0x7F
571#define DA9055_TRIM_DECREMENT (1<<7)
572#define DA9055_TRIM_INCREMENT (0<<7)
573#define DA9055_TRIM_VAL_BASE 0x0
574#define DA9055_TRIM_PPM_BASE 0x0 /* min val in units of 0.1PPM */
575#define DA9055_TRIM_PPM_INC 19 /* min inc in units of 0.1PPM */
576#define DA9055_TRIM_STEPS 127
577
578/* DA9055_REG_CONFIG_A (addr=0x65) */
579#define DA9055_PM_I_V_VDDCORE (0<<0)
580#define DA9055_PM_I_V_VDD_IO (1<<0)
581#define DA9055_VDD_FAULT_TYPE_ACT_LOW (0<<1)
582#define DA9055_VDD_FAULT_TYPE_ACT_HIGH (1<<1)
583#define DA9055_PM_O_TYPE_PUSH_PULL (0<<2)
584#define DA9055_PM_O_TYPE_OPEN_DRAIN (1<<2)
585#define DA9055_IRQ_TYPE_ACT_LOW (0<<3)
586#define DA9055_IRQ_TYPE_ACT_HIGH (1<<3)
587#define DA9055_NIRQ_MODE_IMM (0<<4)
588#define DA9055_NIRQ_MODE_ACTIVE (1<<4)
589#define DA9055_GPI_V_VDDCORE (0<<5)
590#define DA9055_GPI_V_VDD_IO (1<<5)
591#define DA9055_PM_IF_V_VDDCORE (0<<6)
592#define DA9055_PM_IF_V_VDD_IO (1<<6)
593
594/* DA9055_REG_CONFIG_B (addr=0x66) */
595#define DA9055_VDD_FAULT_VAL_SHIFT 0
596#define DA9055_VDD_FAULT_VAL_MASK 0xF
597#define DA9055_VDD_FAULT_VAL_BASE 0x0
598#define DA9055_VDD_FAULT_VAL_MAX DA9055_VDD_FAULT_VAL_MASK
599#define DA9055_VDD_FAULT_VOLT_BASE 2500
600#define DA9055_VDD_FAULT_VOLT_INC 50
601#define DA9055_VDD_FAULT_STEPS 15
602
603#define DA9055_VDD_HYST_VAL_SHIFT 4
604#define DA9055_VDD_HYST_VAL_MASK 0x7
605#define DA9055_VDD_HYST_VAL_BASE 0x0
606#define DA9055_VDD_HYST_VAL_MAX DA9055_VDD_HYST_VAL_MASK
607#define DA9055_VDD_HYST_VOLT_BASE 100
608#define DA9055_VDD_HYST_VOLT_INC 50
609#define DA9055_VDD_HYST_STEPS 7
610#define DA9055_VDD_HYST_VOLT_MIN DA9055_VDD_HYST_VOLT_BASE
611
612#define DA9055_VDD_FAULT_EN_SHIFT 7
613
614/* DA9055_REG_CONFIG_C (addr=0x67) */
615#define DA9055_BCORE_CLK_INV_SHIFT 0
616#define DA9055_BMEM_CLK_INV_SHIFT 1
617#define DA9055_NFAULT_CONF_SHIFT 2
618#define DA9055_LDO_SD_SHIFT 4
619#define DA9055_LDO5_BYP_SHIFT 6
620#define DA9055_LDO6_BYP_SHIFT 7
621
622/* DA9055_REG_CONFIG_D (addr=0x68) */
623#define DA9055_NONKEY_PIN_SHIFT 0
624#define DA9055_NONKEY_PIN_MASK 0x3
625#define DA9055_NONKEY_PIN_PORT_MODE 0x0
626#define DA9055_NONKEY_PIN_KEY_MODE 0x1
627#define DA9055_NONKEY_PIN_MULTI_FUNC 0x2
628#define DA9055_NONKEY_PIN_DEDICT 0x3
629#define DA9055_NONKEY_SD_SHIFT 2
630#define DA9055_KEY_DELAY_SHIFT 3
631#define DA9055_KEY_DELAY_MASK 0x3
632#define DA9055_KEY_DELAY_4S 0x0
633#define DA9055_KEY_DELAY_6S 0x1
634#define DA9055_KEY_DELAY_8S 0x2
635#define DA9055_KEY_DELAY_10S 0x3
636
637/* DA9055_REG_CONFIG_E (addr=0x69) */
638#define DA9055_GPIO_PUPD_PULL_UP 0x0
639#define DA9055_GPIO_PUPD_OPEN_DRAIN 0x1
640#define DA9055_GPIO0_PUPD_SHIFT 0
641#define DA9055_GPIO1_PUPD_SHIFT 1
642#define DA9055_GPIO2_PUPD_SHIFT 2
643#define DA9055_UVOV_DELAY_SHIFT 4
644#define DA9055_UVOV_DELAY_MASK 0x3
645#define DA9055_RESET_DURATION_SHIFT 6
646#define DA9055_RESET_DURATION_MASK 0x3
647#define DA9055_RESET_DURATION_0MS 0x0
648#define DA9055_RESET_DURATION_100MS 0x1
649#define DA9055_RESET_DURATION_500MS 0x2
650#define DA9055_RESET_DURATION_1000MS 0x3
651
652/* DA9055_REG_MON_REG_1 (addr=0x6A) */
653#define DA9055_MON_THRES_SHIFT 0
654#define DA9055_MON_THRES_MASK 0x3
655#define DA9055_MON_RES_SHIFT 2
656#define DA9055_MON_DEB_SHIFT 3
657#define DA9055_MON_MODE_SHIFT 4
658#define DA9055_MON_MODE_MASK 0x3
659#define DA9055_START_MAX_SHIFT 6
660#define DA9055_START_MAX_MASK 0x3
661
662/* DA9055_REG_MON_REG_2 (addr=0x6B) */
663#define DA9055_LDO1_MON_EN_SHIFT 0
664#define DA9055_LDO2_MON_EN_SHIFT 1
665#define DA9055_LDO3_MON_EN_SHIFT 2
666#define DA9055_LDO4_MON_EN_SHIFT 3
667#define DA9055_LDO5_MON_EN_SHIFT 4
668#define DA9055_LDO6_MON_EN_SHIFT 5
669#define DA9055_BCORE_MON_EN_SHIFT 6
670#define DA9055_BMEM_MON_EN_SHIFT 7
671
672/* DA9055_REG_CONFIG_F (addr=0x6C) */
673#define DA9055_LDO1_DEF_SHIFT 0
674#define DA9055_LDO2_DEF_SHIFT 1
675#define DA9055_LDO3_DEF_SHIFT 2
676#define DA9055_LDO4_DEF_SHIFT 3
677#define DA9055_LDO5_DEF_SHIFT 4
678#define DA9055_LDO6_DEF_SHIFT 5
679#define DA9055_BCORE_DEF_SHIFT 6
680#define DA9055_BMEM_DEF_SHIFT 7
681
682/* DA9055_REG_MON_REG_4 (addr=0x6D) */
683#define DA9055_MON_A8_IDX_SHIFT 0
684#define DA9055_MON_A89_IDX_MASK 0x3
685#define DA9055_MON_A89_IDX_NONE 0x0
686#define DA9055_MON_A89_IDX_BUCKCORE 0x1
687#define DA9055_MON_A89_IDX_LDO3 0x2
688#define DA9055_MON_A9_IDX_SHIFT 5
689
690/* DA9055_REG_MON_REG_5 (addr=0x6E) */
691#define DA9055_MON_A10_IDX_SHIFT 0
692#define DA9055_MON_A10_IDX_MASK 0x3
693#define DA9055_MON_A10_IDX_NONE 0x0
694#define DA9055_MON_A10_IDX_LDO1 0x1
695#define DA9055_MON_A10_IDX_LDO2 0x2
696#define DA9055_MON_A10_IDX_LDO5 0x3
697#define DA9055_MON_A10_IDX_LDO6 0x4
698
699#endif /* __DA9055_REG_H */
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 5b90e94399e1..c410d99bd667 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -136,6 +136,7 @@ enum prcmu_clock {
136 PRCMU_TIMCLK, 136 PRCMU_TIMCLK,
137 PRCMU_PLLSOC0, 137 PRCMU_PLLSOC0,
138 PRCMU_PLLSOC1, 138 PRCMU_PLLSOC1,
139 PRCMU_ARMSS,
139 PRCMU_PLLDDR, 140 PRCMU_PLLDDR,
140 PRCMU_PLLDSI, 141 PRCMU_PLLDSI,
141 PRCMU_DSI0CLK, 142 PRCMU_DSI0CLK,
diff --git a/include/linux/mfd/lp8788-isink.h b/include/linux/mfd/lp8788-isink.h
new file mode 100644
index 000000000000..f38262d21ff1
--- /dev/null
+++ b/include/linux/mfd/lp8788-isink.h
@@ -0,0 +1,52 @@
1/*
2 * TI LP8788 MFD - common definitions for current sinks
3 *
4 * Copyright 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef __ISINK_LP8788_H__
15#define __ISINK_LP8788_H__
16
17/* register address */
18#define LP8788_ISINK_CTRL 0x99
19#define LP8788_ISINK12_IOUT 0x9A
20#define LP8788_ISINK3_IOUT 0x9B
21#define LP8788_ISINK1_PWM 0x9C
22#define LP8788_ISINK2_PWM 0x9D
23#define LP8788_ISINK3_PWM 0x9E
24
25/* mask bits */
26#define LP8788_ISINK1_IOUT_M 0x0F /* Addr 9Ah */
27#define LP8788_ISINK2_IOUT_M 0xF0
28#define LP8788_ISINK3_IOUT_M 0x0F /* Addr 9Bh */
29
30/* 6 bits used for PWM code : Addr 9C ~ 9Eh */
31#define LP8788_ISINK_MAX_PWM 63
32#define LP8788_ISINK_SCALE_OFFSET 3
33
34static const u8 lp8788_iout_addr[] = {
35 LP8788_ISINK12_IOUT,
36 LP8788_ISINK12_IOUT,
37 LP8788_ISINK3_IOUT,
38};
39
40static const u8 lp8788_iout_mask[] = {
41 LP8788_ISINK1_IOUT_M,
42 LP8788_ISINK2_IOUT_M,
43 LP8788_ISINK3_IOUT_M,
44};
45
46static const u8 lp8788_pwm_addr[] = {
47 LP8788_ISINK1_PWM,
48 LP8788_ISINK2_PWM,
49 LP8788_ISINK3_PWM,
50};
51
52#endif
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
new file mode 100644
index 000000000000..cec364bdccfa
--- /dev/null
+++ b/include/linux/mfd/lp8788.h
@@ -0,0 +1,364 @@
1/*
2 * TI LP8788 MFD Device
3 *
4 * Copyright 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef __MFD_LP8788_H__
15#define __MFD_LP8788_H__
16
17#include <linux/gpio.h>
18#include <linux/irqdomain.h>
19#include <linux/regmap.h>
20
21#define LP8788_DEV_BUCK "lp8788-buck"
22#define LP8788_DEV_DLDO "lp8788-dldo"
23#define LP8788_DEV_ALDO "lp8788-aldo"
24#define LP8788_DEV_CHARGER "lp8788-charger"
25#define LP8788_DEV_RTC "lp8788-rtc"
26#define LP8788_DEV_BACKLIGHT "lp8788-backlight"
27#define LP8788_DEV_VIBRATOR "lp8788-vibrator"
28#define LP8788_DEV_KEYLED "lp8788-keyled"
29#define LP8788_DEV_ADC "lp8788-adc"
30
31#define LP8788_NUM_BUCKS 4
32#define LP8788_NUM_DLDOS 12
33#define LP8788_NUM_ALDOS 10
34#define LP8788_NUM_BUCK2_DVS 2
35
36#define LP8788_CHG_IRQ "CHG_IRQ"
37#define LP8788_PRSW_IRQ "PRSW_IRQ"
38#define LP8788_BATT_IRQ "BATT_IRQ"
39#define LP8788_ALM_IRQ "ALARM_IRQ"
40
41enum lp8788_int_id {
42 /* interrup register 1 : Addr 00h */
43 LP8788_INT_TSDL,
44 LP8788_INT_TSDH,
45 LP8788_INT_UVLO,
46 LP8788_INT_FLAGMON,
47 LP8788_INT_PWRON_TIME,
48 LP8788_INT_PWRON,
49 LP8788_INT_COMP1,
50 LP8788_INT_COMP2,
51
52 /* interrupt register 2 : Addr 01h */
53 LP8788_INT_CHG_INPUT_STATE,
54 LP8788_INT_CHG_STATE,
55 LP8788_INT_EOC,
56 LP8788_INT_CHG_RESTART,
57 LP8788_INT_RESTART_TIMEOUT,
58 LP8788_INT_FULLCHG_TIMEOUT,
59 LP8788_INT_PRECHG_TIMEOUT,
60
61 /* interrupt register 3 : Addr 02h */
62 LP8788_INT_RTC_ALARM1 = 17,
63 LP8788_INT_RTC_ALARM2,
64 LP8788_INT_ENTER_SYS_SUPPORT,
65 LP8788_INT_EXIT_SYS_SUPPORT,
66 LP8788_INT_BATT_LOW,
67 LP8788_INT_NO_BATT,
68
69 LP8788_INT_MAX = 24,
70};
71
72enum lp8788_dvs_sel {
73 DVS_SEL_V0,
74 DVS_SEL_V1,
75 DVS_SEL_V2,
76 DVS_SEL_V3,
77};
78
79enum lp8788_ext_ldo_en_id {
80 EN_ALDO1,
81 EN_ALDO234,
82 EN_ALDO5,
83 EN_ALDO7,
84 EN_DLDO7,
85 EN_DLDO911,
86 EN_LDOS_MAX,
87};
88
89enum lp8788_charger_event {
90 NO_CHARGER,
91 CHARGER_DETECTED,
92};
93
94enum lp8788_bl_ctrl_mode {
95 LP8788_BL_REGISTER_ONLY,
96 LP8788_BL_COMB_PWM_BASED, /* PWM + I2C, changed by PWM input */
97 LP8788_BL_COMB_REGISTER_BASED, /* PWM + I2C, changed by I2C */
98};
99
100enum lp8788_bl_dim_mode {
101 LP8788_DIM_EXPONENTIAL,
102 LP8788_DIM_LINEAR,
103};
104
105enum lp8788_bl_full_scale_current {
106 LP8788_FULLSCALE_5000uA,
107 LP8788_FULLSCALE_8500uA,
108 LP8788_FULLSCALE_1200uA,
109 LP8788_FULLSCALE_1550uA,
110 LP8788_FULLSCALE_1900uA,
111 LP8788_FULLSCALE_2250uA,
112 LP8788_FULLSCALE_2600uA,
113 LP8788_FULLSCALE_2950uA,
114};
115
116enum lp8788_bl_ramp_step {
117 LP8788_RAMP_8us,
118 LP8788_RAMP_1024us,
119 LP8788_RAMP_2048us,
120 LP8788_RAMP_4096us,
121 LP8788_RAMP_8192us,
122 LP8788_RAMP_16384us,
123 LP8788_RAMP_32768us,
124 LP8788_RAMP_65538us,
125};
126
127enum lp8788_bl_pwm_polarity {
128 LP8788_PWM_ACTIVE_HIGH,
129 LP8788_PWM_ACTIVE_LOW,
130};
131
132enum lp8788_isink_scale {
133 LP8788_ISINK_SCALE_100mA,
134 LP8788_ISINK_SCALE_120mA,
135};
136
137enum lp8788_isink_number {
138 LP8788_ISINK_1,
139 LP8788_ISINK_2,
140 LP8788_ISINK_3,
141};
142
143enum lp8788_alarm_sel {
144 LP8788_ALARM_1,
145 LP8788_ALARM_2,
146 LP8788_ALARM_MAX,
147};
148
149enum lp8788_adc_id {
150 LPADC_VBATT_5P5,
151 LPADC_VIN_CHG,
152 LPADC_IBATT,
153 LPADC_IC_TEMP,
154 LPADC_VBATT_6P0,
155 LPADC_VBATT_5P0,
156 LPADC_ADC1,
157 LPADC_ADC2,
158 LPADC_VDD,
159 LPADC_VCOIN,
160 LPADC_VDD_LDO,
161 LPADC_ADC3,
162 LPADC_ADC4,
163 LPADC_MAX,
164};
165
166struct lp8788;
167
168/*
169 * lp8788_buck1_dvs
170 * @gpio : gpio pin number for dvs control
171 * @vsel : dvs selector for buck v1 register
172 */
173struct lp8788_buck1_dvs {
174 int gpio;
175 enum lp8788_dvs_sel vsel;
176};
177
178/*
179 * lp8788_buck2_dvs
180 * @gpio : two gpio pin numbers are used for dvs
181 * @vsel : dvs selector for buck v2 register
182 */
183struct lp8788_buck2_dvs {
184 int gpio[LP8788_NUM_BUCK2_DVS];
185 enum lp8788_dvs_sel vsel;
186};
187
188/*
189 * struct lp8788_ldo_enable_pin
190 *
191 * Basically, all LDOs are enabled through the I2C commands.
192 * But ALDO 1 ~ 5, 7, DLDO 7, 9, 11 can be enabled by external gpio pins.
193 *
194 * @gpio : gpio number which is used for enabling ldos
195 * @init_state : initial gpio state (ex. GPIOF_OUT_INIT_LOW)
196 */
197struct lp8788_ldo_enable_pin {
198 int gpio;
199 int init_state;
200};
201
202/*
203 * struct lp8788_chg_param
204 * @addr : charging control register address (range : 0x11 ~ 0x1C)
205 * @val : charging parameter value
206 */
207struct lp8788_chg_param {
208 u8 addr;
209 u8 val;
210};
211
212/*
213 * struct lp8788_charger_platform_data
214 * @vbatt_adc : adc selection id for battery voltage
215 * @batt_temp_adc : adc selection id for battery temperature
216 * @max_vbatt_mv : used for calculating battery capacity
217 * @chg_params : initial charging parameters
218 * @num_chg_params : numbers of charging parameters
219 * @charger_event : the charger event can be reported to the platform side
220 */
221struct lp8788_charger_platform_data {
222 enum lp8788_adc_id vbatt_adc;
223 enum lp8788_adc_id batt_temp_adc;
224 unsigned int max_vbatt_mv;
225 struct lp8788_chg_param *chg_params;
226 int num_chg_params;
227 void (*charger_event) (struct lp8788 *lp,
228 enum lp8788_charger_event event);
229};
230
231/*
232 * struct lp8788_bl_pwm_data
233 * @pwm_set_intensity : set duty of pwm
234 * @pwm_get_intensity : get current duty of pwm
235 */
236struct lp8788_bl_pwm_data {
237 void (*pwm_set_intensity) (int brightness, int max_brightness);
238 int (*pwm_get_intensity) (int max_brightness);
239};
240
241/*
242 * struct lp8788_backlight_platform_data
243 * @name : backlight driver name. (default: "lcd-backlight")
244 * @initial_brightness : initial value of backlight brightness
245 * @bl_mode : brightness control by pwm or lp8788 register
246 * @dim_mode : dimming mode selection
247 * @full_scale : full scale current setting
248 * @rise_time : brightness ramp up step time
249 * @fall_time : brightness ramp down step time
250 * @pwm_pol : pwm polarity setting when bl_mode is pwm based
251 * @pwm_data : platform specific pwm generation functions
252 * only valid when bl_mode is pwm based
253 */
254struct lp8788_backlight_platform_data {
255 char *name;
256 int initial_brightness;
257 enum lp8788_bl_ctrl_mode bl_mode;
258 enum lp8788_bl_dim_mode dim_mode;
259 enum lp8788_bl_full_scale_current full_scale;
260 enum lp8788_bl_ramp_step rise_time;
261 enum lp8788_bl_ramp_step fall_time;
262 enum lp8788_bl_pwm_polarity pwm_pol;
263 struct lp8788_bl_pwm_data pwm_data;
264};
265
266/*
267 * struct lp8788_led_platform_data
268 * @name : led driver name. (default: "keyboard-backlight")
269 * @scale : current scale
270 * @num : current sink number
271 * @iout_code : current output value (Addr 9Ah ~ 9Bh)
272 */
273struct lp8788_led_platform_data {
274 char *name;
275 enum lp8788_isink_scale scale;
276 enum lp8788_isink_number num;
277 int iout_code;
278};
279
280/*
281 * struct lp8788_vib_platform_data
282 * @name : vibrator driver name
283 * @scale : current scale
284 * @num : current sink number
285 * @iout_code : current output value (Addr 9Ah ~ 9Bh)
286 * @pwm_code : PWM code value (Addr 9Ch ~ 9Eh)
287 */
288struct lp8788_vib_platform_data {
289 char *name;
290 enum lp8788_isink_scale scale;
291 enum lp8788_isink_number num;
292 int iout_code;
293 int pwm_code;
294};
295
296/*
297 * struct lp8788_platform_data
298 * @init_func : used for initializing registers
299 * before mfd driver is registered
300 * @buck_data : regulator initial data for buck
301 * @dldo_data : regulator initial data for digital ldo
302 * @aldo_data : regulator initial data for analog ldo
303 * @buck1_dvs : gpio configurations for buck1 dvs
304 * @buck2_dvs : gpio configurations for buck2 dvs
305 * @ldo_pin : gpio configurations for enabling LDOs
306 * @chg_pdata : platform data for charger driver
307 * @alarm_sel : rtc alarm selection (1 or 2)
308 * @bl_pdata : configurable data for backlight driver
309 * @led_pdata : configurable data for led driver
310 * @vib_pdata : configurable data for vibrator driver
311 * @adc_pdata : iio map data for adc driver
312 */
313struct lp8788_platform_data {
314 /* general system information */
315 int (*init_func) (struct lp8788 *lp);
316
317 /* regulators */
318 struct regulator_init_data *buck_data[LP8788_NUM_BUCKS];
319 struct regulator_init_data *dldo_data[LP8788_NUM_DLDOS];
320 struct regulator_init_data *aldo_data[LP8788_NUM_ALDOS];
321 struct lp8788_buck1_dvs *buck1_dvs;
322 struct lp8788_buck2_dvs *buck2_dvs;
323 struct lp8788_ldo_enable_pin *ldo_pin[EN_LDOS_MAX];
324
325 /* charger */
326 struct lp8788_charger_platform_data *chg_pdata;
327
328 /* rtc alarm */
329 enum lp8788_alarm_sel alarm_sel;
330
331 /* backlight */
332 struct lp8788_backlight_platform_data *bl_pdata;
333
334 /* current sinks */
335 struct lp8788_led_platform_data *led_pdata;
336 struct lp8788_vib_platform_data *vib_pdata;
337
338 /* adc iio map data */
339 struct iio_map *adc_pdata;
340};
341
342/*
343 * struct lp8788
344 * @dev : parent device pointer
345 * @regmap : used for i2c communcation on accessing registers
346 * @irqdm : interrupt domain for handling nested interrupt
347 * @irq : pin number of IRQ_N
348 * @pdata : lp8788 platform specific data
349 */
350struct lp8788 {
351 struct device *dev;
352 struct regmap *regmap;
353 struct irq_domain *irqdm;
354 int irq;
355 struct lp8788_platform_data *pdata;
356};
357
358int lp8788_irq_init(struct lp8788 *lp, int chip_irq);
359void lp8788_irq_exit(struct lp8788 *lp);
360int lp8788_read_byte(struct lp8788 *lp, u8 reg, u8 *data);
361int lp8788_read_multi_bytes(struct lp8788 *lp, u8 reg, u8 *data, size_t count);
362int lp8788_write_byte(struct lp8788 *lp, u8 reg, u8 data);
363int lp8788_update_bits(struct lp8788 *lp, u8 reg, u8 mask, u8 data);
364#endif
diff --git a/include/linux/mfd/lpc_ich.h b/include/linux/mfd/lpc_ich.h
index fec5256c3f5d..3e1df644c407 100644
--- a/include/linux/mfd/lpc_ich.h
+++ b/include/linux/mfd/lpc_ich.h
@@ -43,6 +43,7 @@ struct lpc_ich_info {
43 char name[32]; 43 char name[32];
44 unsigned int iTCO_version; 44 unsigned int iTCO_version;
45 unsigned int gpio_version; 45 unsigned int gpio_version;
46 u8 use_gpio;
46}; 47};
47 48
48#endif 49#endif
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
index 3d7ae4d7fd36..46c0f320ed76 100644
--- a/include/linux/mfd/max77686.h
+++ b/include/linux/mfd/max77686.h
@@ -74,6 +74,7 @@ enum max77686_regulators {
74struct max77686_regulator_data { 74struct max77686_regulator_data {
75 int id; 75 int id;
76 struct regulator_init_data *initdata; 76 struct regulator_init_data *initdata;
77 struct device_node *of_node;
77}; 78};
78 79
79enum max77686_opmode { 80enum max77686_opmode {
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
new file mode 100644
index 000000000000..b06f7a6a1e80
--- /dev/null
+++ b/include/linux/mfd/max8907.h
@@ -0,0 +1,252 @@
1/*
2 * Functions to access MAX8907 power management chip.
3 *
4 * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com>
5 * Copyright (C) 2012, NVIDIA CORPORATION. All rights reserved.
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 __LINUX_MFD_MAX8907_H
13#define __LINUX_MFD_MAX8907_H
14
15#include <linux/mutex.h>
16#include <linux/pm.h>
17
18#define MAX8907_GEN_I2C_ADDR (0x78 >> 1)
19#define MAX8907_ADC_I2C_ADDR (0x8e >> 1)
20#define MAX8907_RTC_I2C_ADDR (0xd0 >> 1)
21
22/* MAX8907 register map */
23#define MAX8907_REG_SYSENSEL 0x00
24#define MAX8907_REG_ON_OFF_IRQ1 0x01
25#define MAX8907_REG_ON_OFF_IRQ1_MASK 0x02
26#define MAX8907_REG_ON_OFF_STAT 0x03
27#define MAX8907_REG_SDCTL1 0x04
28#define MAX8907_REG_SDSEQCNT1 0x05
29#define MAX8907_REG_SDV1 0x06
30#define MAX8907_REG_SDCTL2 0x07
31#define MAX8907_REG_SDSEQCNT2 0x08
32#define MAX8907_REG_SDV2 0x09
33#define MAX8907_REG_SDCTL3 0x0A
34#define MAX8907_REG_SDSEQCNT3 0x0B
35#define MAX8907_REG_SDV3 0x0C
36#define MAX8907_REG_ON_OFF_IRQ2 0x0D
37#define MAX8907_REG_ON_OFF_IRQ2_MASK 0x0E
38#define MAX8907_REG_RESET_CNFG 0x0F
39#define MAX8907_REG_LDOCTL16 0x10
40#define MAX8907_REG_LDOSEQCNT16 0x11
41#define MAX8907_REG_LDO16VOUT 0x12
42#define MAX8907_REG_SDBYSEQCNT 0x13
43#define MAX8907_REG_LDOCTL17 0x14
44#define MAX8907_REG_LDOSEQCNT17 0x15
45#define MAX8907_REG_LDO17VOUT 0x16
46#define MAX8907_REG_LDOCTL1 0x18
47#define MAX8907_REG_LDOSEQCNT1 0x19
48#define MAX8907_REG_LDO1VOUT 0x1A
49#define MAX8907_REG_LDOCTL2 0x1C
50#define MAX8907_REG_LDOSEQCNT2 0x1D
51#define MAX8907_REG_LDO2VOUT 0x1E
52#define MAX8907_REG_LDOCTL3 0x20
53#define MAX8907_REG_LDOSEQCNT3 0x21
54#define MAX8907_REG_LDO3VOUT 0x22
55#define MAX8907_REG_LDOCTL4 0x24
56#define MAX8907_REG_LDOSEQCNT4 0x25
57#define MAX8907_REG_LDO4VOUT 0x26
58#define MAX8907_REG_LDOCTL5 0x28
59#define MAX8907_REG_LDOSEQCNT5 0x29
60#define MAX8907_REG_LDO5VOUT 0x2A
61#define MAX8907_REG_LDOCTL6 0x2C
62#define MAX8907_REG_LDOSEQCNT6 0x2D
63#define MAX8907_REG_LDO6VOUT 0x2E
64#define MAX8907_REG_LDOCTL7 0x30
65#define MAX8907_REG_LDOSEQCNT7 0x31
66#define MAX8907_REG_LDO7VOUT 0x32
67#define MAX8907_REG_LDOCTL8 0x34
68#define MAX8907_REG_LDOSEQCNT8 0x35
69#define MAX8907_REG_LDO8VOUT 0x36
70#define MAX8907_REG_LDOCTL9 0x38
71#define MAX8907_REG_LDOSEQCNT9 0x39
72#define MAX8907_REG_LDO9VOUT 0x3A
73#define MAX8907_REG_LDOCTL10 0x3C
74#define MAX8907_REG_LDOSEQCNT10 0x3D
75#define MAX8907_REG_LDO10VOUT 0x3E
76#define MAX8907_REG_LDOCTL11 0x40
77#define MAX8907_REG_LDOSEQCNT11 0x41
78#define MAX8907_REG_LDO11VOUT 0x42
79#define MAX8907_REG_LDOCTL12 0x44
80#define MAX8907_REG_LDOSEQCNT12 0x45
81#define MAX8907_REG_LDO12VOUT 0x46
82#define MAX8907_REG_LDOCTL13 0x48
83#define MAX8907_REG_LDOSEQCNT13 0x49
84#define MAX8907_REG_LDO13VOUT 0x4A
85#define MAX8907_REG_LDOCTL14 0x4C
86#define MAX8907_REG_LDOSEQCNT14 0x4D
87#define MAX8907_REG_LDO14VOUT 0x4E
88#define MAX8907_REG_LDOCTL15 0x50
89#define MAX8907_REG_LDOSEQCNT15 0x51
90#define MAX8907_REG_LDO15VOUT 0x52
91#define MAX8907_REG_OUT5VEN 0x54
92#define MAX8907_REG_OUT5VSEQ 0x55
93#define MAX8907_REG_OUT33VEN 0x58
94#define MAX8907_REG_OUT33VSEQ 0x59
95#define MAX8907_REG_LDOCTL19 0x5C
96#define MAX8907_REG_LDOSEQCNT19 0x5D
97#define MAX8907_REG_LDO19VOUT 0x5E
98#define MAX8907_REG_LBCNFG 0x60
99#define MAX8907_REG_SEQ1CNFG 0x64
100#define MAX8907_REG_SEQ2CNFG 0x65
101#define MAX8907_REG_SEQ3CNFG 0x66
102#define MAX8907_REG_SEQ4CNFG 0x67
103#define MAX8907_REG_SEQ5CNFG 0x68
104#define MAX8907_REG_SEQ6CNFG 0x69
105#define MAX8907_REG_SEQ7CNFG 0x6A
106#define MAX8907_REG_LDOCTL18 0x72
107#define MAX8907_REG_LDOSEQCNT18 0x73
108#define MAX8907_REG_LDO18VOUT 0x74
109#define MAX8907_REG_BBAT_CNFG 0x78
110#define MAX8907_REG_CHG_CNTL1 0x7C
111#define MAX8907_REG_CHG_CNTL2 0x7D
112#define MAX8907_REG_CHG_IRQ1 0x7E
113#define MAX8907_REG_CHG_IRQ2 0x7F
114#define MAX8907_REG_CHG_IRQ1_MASK 0x80
115#define MAX8907_REG_CHG_IRQ2_MASK 0x81
116#define MAX8907_REG_CHG_STAT 0x82
117#define MAX8907_REG_WLED_MODE_CNTL 0x84
118#define MAX8907_REG_ILED_CNTL 0x84
119#define MAX8907_REG_II1RR 0x8E
120#define MAX8907_REG_II2RR 0x8F
121#define MAX8907_REG_LDOCTL20 0x9C
122#define MAX8907_REG_LDOSEQCNT20 0x9D
123#define MAX8907_REG_LDO20VOUT 0x9E
124
125/* RTC register map */
126#define MAX8907_REG_RTC_SEC 0x00
127#define MAX8907_REG_RTC_MIN 0x01
128#define MAX8907_REG_RTC_HOURS 0x02
129#define MAX8907_REG_RTC_WEEKDAY 0x03
130#define MAX8907_REG_RTC_DATE 0x04
131#define MAX8907_REG_RTC_MONTH 0x05
132#define MAX8907_REG_RTC_YEAR1 0x06
133#define MAX8907_REG_RTC_YEAR2 0x07
134#define MAX8907_REG_ALARM0_SEC 0x08
135#define MAX8907_REG_ALARM0_MIN 0x09
136#define MAX8907_REG_ALARM0_HOURS 0x0A
137#define MAX8907_REG_ALARM0_WEEKDAY 0x0B
138#define MAX8907_REG_ALARM0_DATE 0x0C
139#define MAX8907_REG_ALARM0_MONTH 0x0D
140#define MAX8907_REG_ALARM0_YEAR1 0x0E
141#define MAX8907_REG_ALARM0_YEAR2 0x0F
142#define MAX8907_REG_ALARM1_SEC 0x10
143#define MAX8907_REG_ALARM1_MIN 0x11
144#define MAX8907_REG_ALARM1_HOURS 0x12
145#define MAX8907_REG_ALARM1_WEEKDAY 0x13
146#define MAX8907_REG_ALARM1_DATE 0x14
147#define MAX8907_REG_ALARM1_MONTH 0x15
148#define MAX8907_REG_ALARM1_YEAR1 0x16
149#define MAX8907_REG_ALARM1_YEAR2 0x17
150#define MAX8907_REG_ALARM0_CNTL 0x18
151#define MAX8907_REG_ALARM1_CNTL 0x19
152#define MAX8907_REG_RTC_STATUS 0x1A
153#define MAX8907_REG_RTC_CNTL 0x1B
154#define MAX8907_REG_RTC_IRQ 0x1C
155#define MAX8907_REG_RTC_IRQ_MASK 0x1D
156#define MAX8907_REG_MPL_CNTL 0x1E
157
158/* ADC and Touch Screen Controller register map */
159#define MAX8907_CTL 0
160#define MAX8907_SEQCNT 1
161#define MAX8907_VOUT 2
162
163/* mask bit fields */
164#define MAX8907_MASK_LDO_SEQ 0x1C
165#define MAX8907_MASK_LDO_EN 0x01
166#define MAX8907_MASK_VBBATTCV 0x03
167#define MAX8907_MASK_OUT5V_VINEN 0x10
168#define MAX8907_MASK_OUT5V_ENSRC 0x0E
169#define MAX8907_MASK_OUT5V_EN 0x01
170#define MAX8907_MASK_POWER_OFF 0x40
171
172/* Regulator IDs */
173#define MAX8907_MBATT 0
174#define MAX8907_SD1 1
175#define MAX8907_SD2 2
176#define MAX8907_SD3 3
177#define MAX8907_LDO1 4
178#define MAX8907_LDO2 5
179#define MAX8907_LDO3 6
180#define MAX8907_LDO4 7
181#define MAX8907_LDO5 8
182#define MAX8907_LDO6 9
183#define MAX8907_LDO7 10
184#define MAX8907_LDO8 11
185#define MAX8907_LDO9 12
186#define MAX8907_LDO10 13
187#define MAX8907_LDO11 14
188#define MAX8907_LDO12 15
189#define MAX8907_LDO13 16
190#define MAX8907_LDO14 17
191#define MAX8907_LDO15 18
192#define MAX8907_LDO16 19
193#define MAX8907_LDO17 20
194#define MAX8907_LDO18 21
195#define MAX8907_LDO19 22
196#define MAX8907_LDO20 23
197#define MAX8907_OUT5V 24
198#define MAX8907_OUT33V 25
199#define MAX8907_BBAT 26
200#define MAX8907_SDBY 27
201#define MAX8907_VRTC 28
202#define MAX8907_NUM_REGULATORS (MAX8907_VRTC + 1)
203
204/* IRQ definitions */
205enum {
206 MAX8907_IRQ_VCHG_DC_OVP = 0,
207 MAX8907_IRQ_VCHG_DC_F,
208 MAX8907_IRQ_VCHG_DC_R,
209 MAX8907_IRQ_VCHG_THM_OK_R,
210 MAX8907_IRQ_VCHG_THM_OK_F,
211 MAX8907_IRQ_VCHG_MBATTLOW_F,
212 MAX8907_IRQ_VCHG_MBATTLOW_R,
213 MAX8907_IRQ_VCHG_RST,
214 MAX8907_IRQ_VCHG_DONE,
215 MAX8907_IRQ_VCHG_TOPOFF,
216 MAX8907_IRQ_VCHG_TMR_FAULT,
217
218 MAX8907_IRQ_GPM_RSTIN = 0,
219 MAX8907_IRQ_GPM_MPL,
220 MAX8907_IRQ_GPM_SW_3SEC,
221 MAX8907_IRQ_GPM_EXTON_F,
222 MAX8907_IRQ_GPM_EXTON_R,
223 MAX8907_IRQ_GPM_SW_1SEC,
224 MAX8907_IRQ_GPM_SW_F,
225 MAX8907_IRQ_GPM_SW_R,
226 MAX8907_IRQ_GPM_SYSCKEN_F,
227 MAX8907_IRQ_GPM_SYSCKEN_R,
228
229 MAX8907_IRQ_RTC_ALARM1 = 0,
230 MAX8907_IRQ_RTC_ALARM0,
231};
232
233struct max8907_platform_data {
234 struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
235 bool pm_off;
236};
237
238struct regmap_irq_chips_data;
239
240struct max8907 {
241 struct device *dev;
242 struct mutex irq_lock;
243 struct i2c_client *i2c_gen;
244 struct i2c_client *i2c_rtc;
245 struct regmap *regmap_gen;
246 struct regmap *regmap_rtc;
247 struct regmap_irq_chip_data *irqc_chg;
248 struct regmap_irq_chip_data *irqc_on_off;
249 struct regmap_irq_chip_data *irqc_rtc;
250};
251
252#endif
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 15b2392a56fb..74d8e2969630 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -158,8 +158,6 @@ enum {
158#define TSC_IRQ_MASK (0x03) 158#define TSC_IRQ_MASK (0x03)
159#define RTC_IRQ_MASK (0x0c) 159#define RTC_IRQ_MASK (0x0c)
160 160
161#define MAX8925_MAX_REGULATOR (23)
162
163#define MAX8925_NAME_SIZE (32) 161#define MAX8925_NAME_SIZE (32)
164 162
165/* IRQ definitions */ 163/* IRQ definitions */
@@ -236,7 +234,29 @@ struct max8925_platform_data {
236 struct max8925_backlight_pdata *backlight; 234 struct max8925_backlight_pdata *backlight;
237 struct max8925_touch_pdata *touch; 235 struct max8925_touch_pdata *touch;
238 struct max8925_power_pdata *power; 236 struct max8925_power_pdata *power;
239 struct regulator_init_data *regulator[MAX8925_MAX_REGULATOR]; 237 struct regulator_init_data *sd1;
238 struct regulator_init_data *sd2;
239 struct regulator_init_data *sd3;
240 struct regulator_init_data *ldo1;
241 struct regulator_init_data *ldo2;
242 struct regulator_init_data *ldo3;
243 struct regulator_init_data *ldo4;
244 struct regulator_init_data *ldo5;
245 struct regulator_init_data *ldo6;
246 struct regulator_init_data *ldo7;
247 struct regulator_init_data *ldo8;
248 struct regulator_init_data *ldo9;
249 struct regulator_init_data *ldo10;
250 struct regulator_init_data *ldo11;
251 struct regulator_init_data *ldo12;
252 struct regulator_init_data *ldo13;
253 struct regulator_init_data *ldo14;
254 struct regulator_init_data *ldo15;
255 struct regulator_init_data *ldo16;
256 struct regulator_init_data *ldo17;
257 struct regulator_init_data *ldo18;
258 struct regulator_init_data *ldo19;
259 struct regulator_init_data *ldo20;
240 260
241 int irq_base; 261 int irq_base;
242 int tsc_irq; 262 int tsc_irq;
diff --git a/include/linux/mfd/max8998.h b/include/linux/mfd/max8998.h
index f4f0dfa4698a..6823548d0c0a 100644
--- a/include/linux/mfd/max8998.h
+++ b/include/linux/mfd/max8998.h
@@ -67,7 +67,7 @@ struct max8998_regulator_data {
67/** 67/**
68 * struct max8998_board - packages regulator init data 68 * struct max8998_board - packages regulator init data
69 * @regulators: array of defined regulators 69 * @regulators: array of defined regulators
70 * @num_regulators: number of regultors used 70 * @num_regulators: number of regulators used
71 * @irq_base: base IRQ number for max8998, required for IRQs 71 * @irq_base: base IRQ number for max8998, required for IRQs
72 * @ono: power onoff IRQ number for max8998 72 * @ono: power onoff IRQ number for max8998
73 * @buck_voltage_lock: Do NOT change the values of the following six 73 * @buck_voltage_lock: Do NOT change the values of the following six
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9cbc642d40ad..29f6616e12f0 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -23,6 +23,9 @@
23#define PALMAS_NUM_CLIENTS 3 23#define PALMAS_NUM_CLIENTS 3
24 24
25struct palmas_pmic; 25struct palmas_pmic;
26struct palmas_gpadc;
27struct palmas_resource;
28struct palmas_usb;
26 29
27struct palmas { 30struct palmas {
28 struct device *dev; 31 struct device *dev;
@@ -41,6 +44,9 @@ struct palmas {
41 44
42 /* Child Devices */ 45 /* Child Devices */
43 struct palmas_pmic *pmic; 46 struct palmas_pmic *pmic;
47 struct palmas_gpadc *gpadc;
48 struct palmas_resource *resource;
49 struct palmas_usb *usb;
44 50
45 /* GPIO MUXing */ 51 /* GPIO MUXing */
46 u8 gpio_muxed; 52 u8 gpio_muxed;
@@ -48,6 +54,23 @@ struct palmas {
48 u8 pwm_muxed; 54 u8 pwm_muxed;
49}; 55};
50 56
57struct palmas_gpadc_platform_data {
58 /* Channel 3 current source is only enabled during conversion */
59 int ch3_current;
60
61 /* Channel 0 current source can be used for battery detection.
62 * If used for battery detection this will cause a permanent current
63 * consumption depending on current level set here.
64 */
65 int ch0_current;
66
67 /* default BAT_REMOVAL_DAT setting on device probe */
68 int bat_removal;
69
70 /* Sets the START_POLARITY bit in the RT_CTRL register */
71 int start_polarity;
72};
73
51struct palmas_reg_init { 74struct palmas_reg_init {
52 /* warm_rest controls the voltage levels after a warm reset 75 /* warm_rest controls the voltage levels after a warm reset
53 * 76 *
@@ -107,21 +130,94 @@ struct palmas_reg_init {
107 130
108}; 131};
109 132
133enum palmas_regulators {
134 /* SMPS regulators */
135 PALMAS_REG_SMPS12,
136 PALMAS_REG_SMPS123,
137 PALMAS_REG_SMPS3,
138 PALMAS_REG_SMPS45,
139 PALMAS_REG_SMPS457,
140 PALMAS_REG_SMPS6,
141 PALMAS_REG_SMPS7,
142 PALMAS_REG_SMPS8,
143 PALMAS_REG_SMPS9,
144 PALMAS_REG_SMPS10,
145 /* LDO regulators */
146 PALMAS_REG_LDO1,
147 PALMAS_REG_LDO2,
148 PALMAS_REG_LDO3,
149 PALMAS_REG_LDO4,
150 PALMAS_REG_LDO5,
151 PALMAS_REG_LDO6,
152 PALMAS_REG_LDO7,
153 PALMAS_REG_LDO8,
154 PALMAS_REG_LDO9,
155 PALMAS_REG_LDOLN,
156 PALMAS_REG_LDOUSB,
157 /* Total number of regulators */
158 PALMAS_NUM_REGS,
159};
160
110struct palmas_pmic_platform_data { 161struct palmas_pmic_platform_data {
111 /* An array of pointers to regulator init data indexed by regulator 162 /* An array of pointers to regulator init data indexed by regulator
112 * ID 163 * ID
113 */ 164 */
114 struct regulator_init_data **reg_data; 165 struct regulator_init_data *reg_data[PALMAS_NUM_REGS];
115 166
116 /* An array of pointers to structures containing sleep mode and DVS 167 /* An array of pointers to structures containing sleep mode and DVS
117 * configuration for regulators indexed by ID 168 * configuration for regulators indexed by ID
118 */ 169 */
119 struct palmas_reg_init **reg_init; 170 struct palmas_reg_init *reg_init[PALMAS_NUM_REGS];
120 171
121 /* use LDO6 for vibrator control */ 172 /* use LDO6 for vibrator control */
122 int ldo6_vibrator; 173 int ldo6_vibrator;
174};
123 175
176struct palmas_usb_platform_data {
177 /* Set this if platform wishes its own vbus control */
178 int no_control_vbus;
124 179
180 /* Do we enable the wakeup comparator on probe */
181 int wakeup;
182};
183
184struct palmas_resource_platform_data {
185 int regen1_mode_sleep;
186 int regen2_mode_sleep;
187 int sysen1_mode_sleep;
188 int sysen2_mode_sleep;
189
190 /* bitfield to be loaded to NSLEEP_RES_ASSIGN */
191 u8 nsleep_res;
192 /* bitfield to be loaded to NSLEEP_SMPS_ASSIGN */
193 u8 nsleep_smps;
194 /* bitfield to be loaded to NSLEEP_LDO_ASSIGN1 */
195 u8 nsleep_ldo1;
196 /* bitfield to be loaded to NSLEEP_LDO_ASSIGN2 */
197 u8 nsleep_ldo2;
198
199 /* bitfield to be loaded to ENABLE1_RES_ASSIGN */
200 u8 enable1_res;
201 /* bitfield to be loaded to ENABLE1_SMPS_ASSIGN */
202 u8 enable1_smps;
203 /* bitfield to be loaded to ENABLE1_LDO_ASSIGN1 */
204 u8 enable1_ldo1;
205 /* bitfield to be loaded to ENABLE1_LDO_ASSIGN2 */
206 u8 enable1_ldo2;
207
208 /* bitfield to be loaded to ENABLE2_RES_ASSIGN */
209 u8 enable2_res;
210 /* bitfield to be loaded to ENABLE2_SMPS_ASSIGN */
211 u8 enable2_smps;
212 /* bitfield to be loaded to ENABLE2_LDO_ASSIGN1 */
213 u8 enable2_ldo1;
214 /* bitfield to be loaded to ENABLE2_LDO_ASSIGN2 */
215 u8 enable2_ldo2;
216};
217
218struct palmas_clk_platform_data {
219 int clk32kg_mode_sleep;
220 int clk32kgaudio_mode_sleep;
125}; 221};
126 222
127struct palmas_platform_data { 223struct palmas_platform_data {
@@ -138,8 +234,49 @@ struct palmas_platform_data {
138 u8 pad1, pad2; 234 u8 pad1, pad2;
139 235
140 struct palmas_pmic_platform_data *pmic_pdata; 236 struct palmas_pmic_platform_data *pmic_pdata;
237 struct palmas_gpadc_platform_data *gpadc_pdata;
238 struct palmas_usb_platform_data *usb_pdata;
239 struct palmas_resource_platform_data *resource_pdata;
240 struct palmas_clk_platform_data *clk_pdata;
241};
242
243struct palmas_gpadc_calibration {
244 s32 gain;
245 s32 gain_error;
246 s32 offset_error;
141}; 247};
142 248
249struct palmas_gpadc {
250 struct device *dev;
251 struct palmas *palmas;
252
253 int ch3_current;
254 int ch0_current;
255
256 int gpadc_force;
257
258 int bat_removal;
259
260 struct mutex reading_lock;
261 struct completion irq_complete;
262
263 int eoc_sw_irq;
264
265 struct palmas_gpadc_calibration *palmas_cal_tbl;
266
267 int conv0_channel;
268 int conv1_channel;
269 int rt_channel;
270};
271
272struct palmas_gpadc_result {
273 s32 raw_code;
274 s32 corrected_code;
275 s32 result;
276};
277
278#define PALMAS_MAX_CHANNELS 16
279
143/* Define the palmas IRQ numbers */ 280/* Define the palmas IRQ numbers */
144enum palmas_irqs { 281enum palmas_irqs {
145 /* INT1 registers */ 282 /* INT1 registers */
@@ -182,34 +319,6 @@ enum palmas_irqs {
182 PALMAS_NUM_IRQ, 319 PALMAS_NUM_IRQ,
183}; 320};
184 321
185enum palmas_regulators {
186 /* SMPS regulators */
187 PALMAS_REG_SMPS12,
188 PALMAS_REG_SMPS123,
189 PALMAS_REG_SMPS3,
190 PALMAS_REG_SMPS45,
191 PALMAS_REG_SMPS457,
192 PALMAS_REG_SMPS6,
193 PALMAS_REG_SMPS7,
194 PALMAS_REG_SMPS8,
195 PALMAS_REG_SMPS9,
196 PALMAS_REG_SMPS10,
197 /* LDO regulators */
198 PALMAS_REG_LDO1,
199 PALMAS_REG_LDO2,
200 PALMAS_REG_LDO3,
201 PALMAS_REG_LDO4,
202 PALMAS_REG_LDO5,
203 PALMAS_REG_LDO6,
204 PALMAS_REG_LDO7,
205 PALMAS_REG_LDO8,
206 PALMAS_REG_LDO9,
207 PALMAS_REG_LDOLN,
208 PALMAS_REG_LDOUSB,
209 /* Total number of regulators */
210 PALMAS_NUM_REGS,
211};
212
213struct palmas_pmic { 322struct palmas_pmic {
214 struct palmas *palmas; 323 struct palmas *palmas;
215 struct device *dev; 324 struct device *dev;
@@ -223,6 +332,69 @@ struct palmas_pmic {
223 int range[PALMAS_REG_SMPS10]; 332 int range[PALMAS_REG_SMPS10];
224}; 333};
225 334
335struct palmas_resource {
336 struct palmas *palmas;
337 struct device *dev;
338};
339
340struct palmas_usb {
341 struct palmas *palmas;
342 struct device *dev;
343
344 /* for vbus reporting with irqs disabled */
345 spinlock_t lock;
346
347 struct regulator *vbus_reg;
348
349 /* used to set vbus, in atomic path */
350 struct work_struct set_vbus_work;
351
352 int irq1;
353 int irq2;
354 int irq3;
355 int irq4;
356
357 int vbus_enable;
358
359 u8 linkstat;
360};
361
362#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
363
364enum usb_irq_events {
365 /* Wakeup events from INT3 */
366 PALMAS_USB_ID_WAKEPUP,
367 PALMAS_USB_VBUS_WAKEUP,
368
369 /* ID_OTG_EVENTS */
370 PALMAS_USB_ID_GND,
371 N_PALMAS_USB_ID_GND,
372 PALMAS_USB_ID_C,
373 N_PALMAS_USB_ID_C,
374 PALMAS_USB_ID_B,
375 N_PALMAS_USB_ID_B,
376 PALMAS_USB_ID_A,
377 N_PALMAS_USB_ID_A,
378 PALMAS_USB_ID_FLOAT,
379 N_PALMAS_USB_ID_FLOAT,
380
381 /* VBUS_OTG_EVENTS */
382 PALMAS_USB_VB_SESS_END,
383 N_PALMAS_USB_VB_SESS_END,
384 PALMAS_USB_VB_SESS_VLD,
385 N_PALMAS_USB_VB_SESS_VLD,
386 PALMAS_USB_VA_SESS_VLD,
387 N_PALMAS_USB_VA_SESS_VLD,
388 PALMAS_USB_VA_VBUS_VLD,
389 N_PALMAS_USB_VA_VBUS_VLD,
390 PALMAS_USB_VADP_SNS,
391 N_PALMAS_USB_VADP_SNS,
392 PALMAS_USB_VADP_PRB,
393 N_PALMAS_USB_VADP_PRB,
394 PALMAS_USB_VOTG_SESS_VLD,
395 N_PALMAS_USB_VOTG_SESS_VLD,
396};
397
226/* defines so we can store the mux settings */ 398/* defines so we can store the mux settings */
227#define PALMAS_GPIO_0_MUXED (1 << 0) 399#define PALMAS_GPIO_0_MUXED (1 << 0)
228#define PALMAS_GPIO_1_MUXED (1 << 1) 400#define PALMAS_GPIO_1_MUXED (1 << 1)
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 3661c59aa1e9..36c242e52ef1 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -146,6 +146,28 @@
146#define RC5T583_GPIO_MON_IOIN 0xAB 146#define RC5T583_GPIO_MON_IOIN 0xAB
147#define RC5T583_GPIO_GPOFUNC 0xAC 147#define RC5T583_GPIO_GPOFUNC 0xAC
148 148
149/* RTC registers */
150#define RC5T583_RTC_SEC 0xE0
151#define RC5T583_RTC_MIN 0xE1
152#define RC5T583_RTC_HOUR 0xE2
153#define RC5T583_RTC_WDAY 0xE3
154#define RC5T583_RTC_DAY 0xE4
155#define RC5T583_RTC_MONTH 0xE5
156#define RC5T583_RTC_YEAR 0xE6
157#define RC5T583_RTC_ADJ 0xE7
158#define RC5T583_RTC_AW_MIN 0xE8
159#define RC5T583_RTC_AW_HOUR 0xE9
160#define RC5T583_RTC_AW_WEEK 0xEA
161#define RC5T583_RTC_AD_MIN 0xEB
162#define RC5T583_RTC_AD_HOUR 0xEC
163#define RC5T583_RTC_CTL1 0xED
164#define RC5T583_RTC_CTL2 0xEE
165#define RC5T583_RTC_AY_MIN 0xF0
166#define RC5T583_RTC_AY_HOUR 0xF1
167#define RC5T583_RTC_AY_DAY 0xF2
168#define RC5T583_RTC_AY_MONTH 0xF3
169#define RC5T583_RTC_AY_YEAR 0xF4
170
149/* RICOH_RC5T583 IRQ definitions */ 171/* RICOH_RC5T583 IRQ definitions */
150enum { 172enum {
151 RC5T583_IRQ_ONKEY, 173 RC5T583_IRQ_ONKEY,
diff --git a/include/linux/mfd/smsc.h b/include/linux/mfd/smsc.h
new file mode 100644
index 000000000000..9747b29f356f
--- /dev/null
+++ b/include/linux/mfd/smsc.h
@@ -0,0 +1,109 @@
1/*
2 * SMSC ECE1099
3 *
4 * Copyright 2012 Texas Instruments Inc.
5 *
6 * Author: Sourav Poddar <sourav.poddar@ti.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 as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __LINUX_MFD_SMSC_H
16#define __LINUX_MFD_SMSC_H
17
18#include <linux/regmap.h>
19
20#define SMSC_ID_ECE1099 1
21#define SMSC_NUM_CLIENTS 2
22
23#define SMSC_BASE_ADDR 0x38
24#define OMAP_GPIO_SMSC_IRQ 151
25
26#define SMSC_MAXGPIO 32
27#define SMSC_BANK(offs) ((offs) >> 3)
28#define SMSC_BIT(offs) (1u << ((offs) & 0x7))
29
30struct smsc {
31 struct device *dev;
32 struct i2c_client *i2c_clients[SMSC_NUM_CLIENTS];
33 struct regmap *regmap;
34 int clk;
35 /* Stored chip id */
36 int id;
37};
38
39struct smsc_gpio;
40struct smsc_keypad;
41
42static inline int smsc_read(struct device *child, unsigned int reg,
43 unsigned int *dest)
44{
45 struct smsc *smsc = dev_get_drvdata(child->parent);
46
47 return regmap_read(smsc->regmap, reg, dest);
48}
49
50static inline int smsc_write(struct device *child, unsigned int reg,
51 unsigned int value)
52{
53 struct smsc *smsc = dev_get_drvdata(child->parent);
54
55 return regmap_write(smsc->regmap, reg, value);
56}
57
58/* Registers for SMSC */
59#define SMSC_RESET 0xF5
60#define SMSC_GRP_INT 0xF9
61#define SMSC_CLK_CTRL 0xFA
62#define SMSC_WKUP_CTRL 0xFB
63#define SMSC_DEV_ID 0xFC
64#define SMSC_DEV_REV 0xFD
65#define SMSC_VEN_ID_L 0xFE
66#define SMSC_VEN_ID_H 0xFF
67
68/* CLK VALUE */
69#define SMSC_CLK_VALUE 0x13
70
71/* Registers for function GPIO INPUT */
72#define SMSC_GPIO_DATA_IN_START 0x00
73
74/* Registers for function GPIO OUPUT */
75#define SMSC_GPIO_DATA_OUT_START 0x05
76
77/* Definitions for SMSC GPIO CONFIGURATION REGISTER*/
78#define SMSC_GPIO_INPUT_LOW 0x01
79#define SMSC_GPIO_INPUT_RISING 0x09
80#define SMSC_GPIO_INPUT_FALLING 0x11
81#define SMSC_GPIO_INPUT_BOTH_EDGE 0x19
82#define SMSC_GPIO_OUTPUT_PP 0x21
83#define SMSC_GPIO_OUTPUT_OP 0x31
84
85#define GRP_INT_STAT 0xf9
86#define SMSC_GPI_INT 0x0f
87#define SMSC_CFG_START 0x0A
88
89/* Registers for SMSC GPIO INTERRUPT STATUS REGISTER*/
90#define SMSC_GPIO_INT_STAT_START 0x32
91
92/* Registers for SMSC GPIO INTERRUPT MASK REGISTER*/
93#define SMSC_GPIO_INT_MASK_START 0x37
94
95/* Registers for SMSC function KEYPAD*/
96#define SMSC_KP_OUT 0x40
97#define SMSC_KP_IN 0x41
98#define SMSC_KP_INT_STAT 0x42
99#define SMSC_KP_INT_MASK 0x43
100
101/* Definitions for keypad */
102#define SMSC_KP_KSO 0x70
103#define SMSC_KP_KSI 0x51
104#define SMSC_KSO_ALL_LOW 0x20
105#define SMSC_KP_SET_LOW_PWR 0x0B
106#define SMSC_KP_SET_HIGH 0xFF
107#define SMSC_KSO_EVAL 0x00
108
109#endif /* __LINUX_MFD_SMSC_H */
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
new file mode 100644
index 000000000000..6aeb6b8da64d
--- /dev/null
+++ b/include/linux/mfd/syscon.h
@@ -0,0 +1,23 @@
1/*
2 * System Control Driver
3 *
4 * Copyright (C) 2012 Freescale Semiconductor, Inc.
5 * Copyright (C) 2012 Linaro Ltd.
6 *
7 * Author: Dong Aisheng <dong.aisheng@linaro.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#ifndef __LINUX_MFD_SYSCON_H__
16#define __LINUX_MFD_SYSCON_H__
17
18extern struct regmap *syscon_node_to_regmap(struct device_node *np);
19extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
20extern struct regmap *syscon_regmap_lookup_by_phandle(
21 struct device_node *np,
22 const char *property);
23#endif /* __LINUX_MFD_SYSCON_H__ */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
new file mode 100644
index 000000000000..dab34a1deb2c
--- /dev/null
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -0,0 +1,319 @@
1/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc.
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
9#ifndef __LINUX_IMX6Q_IOMUXC_GPR_H
10#define __LINUX_IMX6Q_IOMUXC_GPR_H
11
12#include <linux/bitops.h>
13
14#define IOMUXC_GPR0 0x00
15#define IOMUXC_GPR1 0x04
16#define IOMUXC_GPR2 0x08
17#define IOMUXC_GPR3 0x0c
18#define IOMUXC_GPR4 0x10
19#define IOMUXC_GPR5 0x14
20#define IOMUXC_GPR6 0x18
21#define IOMUXC_GPR7 0x1c
22#define IOMUXC_GPR8 0x20
23#define IOMUXC_GPR9 0x24
24#define IOMUXC_GPR10 0x28
25#define IOMUXC_GPR11 0x2c
26#define IOMUXC_GPR12 0x30
27#define IOMUXC_GPR13 0x34
28
29#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_MASK (0x3 << 30)
30#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_AUDMUX_RXCLK_P7_MUXED (0x0 << 30)
31#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_AUDMUX_RXCLK_P7 (0x1 << 30)
32#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_SSI3_SSI_SRCK (0x2 << 30)
33#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_SSI3_RX_BIT_CLK (0x3 << 30)
34#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_MASK (0x3 << 28)
35#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_IND_SCKR_MUXED (0x0 << 28)
36#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_IND_SCKR (0x1 << 28)
37#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_DO_SCKR (0x2 << 28)
38#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_MASK (0x3 << 26)
39#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_AUDMUX_TXCLK_P7_MUXED (0x0 << 26)
40#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_AUDMUX_TXCLK_P7 (0x1 << 26)
41#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_SSI3_SSI_STCK (0x2 << 26)
42#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_SSI3_TX_BIT_CLK (0x3 << 26)
43#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_MASK (0x3 << 24)
44#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_AUDMUX_RXCLK_P7_MUXED (0x3 << 24)
45#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_AUDMUX_RXCLK_P7 (0x3 << 24)
46#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_SSI3_SSI_SRCK (0x3 << 24)
47#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_SSI3_RX_BIT_CLK (0x3 << 24)
48#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_MASK (0x3 << 22)
49#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_AUDMUX_TXCLK_P2_MUXED (0x0 << 22)
50#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_AUDMUX_TXCLK_P2 (0x1 << 22)
51#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_SSI2_SSI_STCK (0x2 << 22)
52#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_SSI2_TX_BIT_CLK (0x3 << 22)
53#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_MASK (0x3 << 20)
54#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_AUDMUX_RXCLK_P2_MUXED (0x0 << 20)
55#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_AUDMUX_RXCLK_P2 (0x1 << 20)
56#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_SSI2_SSI_SRCK (0x2 << 20)
57#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_SSI2_RX_BIT_CLK (0x3 << 20)
58#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_MASK (0x3 << 18)
59#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_AUDMUX_TXCLK_P1_MUXED (0x0 << 18)
60#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_AUDMUX_TXCLK_P1 (0x1 << 18)
61#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_SSI1_SSI_STCK (0x2 << 18)
62#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_SSI1_SSI_TX_BIT_CLK (0x3 << 18)
63#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_MASK (0x3 << 16)
64#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_AUDMUX_RXCLK_P1_MUXED (0x0 << 16)
65#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_AUDMUX_RXCLK_P1 (0x1 << 16)
66#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_SSI1_SSI_SRCK (0x2 << 16)
67#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_SSI1_SSI_RX_BIT_CLK (0x3 << 16)
68#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_MASK (0x3 << 14)
69#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK1 (0x0 << 14)
70#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK2 (0x1 << 14)
71#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK3 (0x2 << 14)
72#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_MASK BIT(7)
73#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_SPDIF 0x0
74#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_IOMUX BIT(7)
75#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_MASK BIT(6)
76#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_ESAI 0x0
77#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_I2C3 BIT(6)
78#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_MASK BIT(5)
79#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_ECSPI4 0x0
80#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_EPIT2 BIT(5)
81#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_MASK BIT(4)
82#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_ECSPI4 0x0
83#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_I2C1 BIT(4)
84#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_MASK BIT(3)
85#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_ECSPI2 0x0
86#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_I2C1 BIT(3)
87#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_MASK BIT(2)
88#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_ECSPI1 0x0
89#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_I2C2 BIT(2)
90#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_MASK BIT(1)
91#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_ECSPI1 0x0
92#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_I2C3 BIT(1)
93#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_MASK BIT(0)
94#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IPU1 0x0
95#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IOMUX BIT(0)
96
97#define IMX6Q_GPR1_PCIE_REQ_MASK (0x3 << 30)
98#define IMX6Q_GPR1_PCIE_EXIT_L1 BIT(28)
99#define IMX6Q_GPR1_PCIE_RDY_L23 BIT(27)
100#define IMX6Q_GPR1_PCIE_ENTER_L1 BIT(26)
101#define IMX6Q_GPR1_MIPI_COLOR_SW BIT(25)
102#define IMX6Q_GPR1_DPI_OFF BIT(24)
103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22)
104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0
105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22)
106#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21)
107#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0
108#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21)
109#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20)
110#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
111#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19)
115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18)
116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17)
117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0
118#define IMX6Q_GPR1_IPU_VPU_MUX_IPU2 BIT(17)
119#define IMX6Q_GPR1_PCIE_REF_CLK_EN BIT(16)
120#define IMX6Q_GPR1_USB_EXP_MODE BIT(15)
121#define IMX6Q_GPR1_PCIE_INT BIT(14)
122#define IMX6Q_GPR1_USB_OTG_ID_SEL_MASK BIT(13)
123#define IMX6Q_GPR1_USB_OTG_ID_SEL_ENET_RX_ER 0x0
124#define IMX6Q_GPR1_USB_OTG_ID_SEL_GPIO_1 BIT(13)
125#define IMX6Q_GPR1_GINT BIT(12)
126#define IMX6Q_GPR1_ADDRS3_MASK (0x3 << 10)
127#define IMX6Q_GPR1_ADDRS3_32MB (0x0 << 10)
128#define IMX6Q_GPR1_ADDRS3_64MB (0x1 << 10)
129#define IMX6Q_GPR1_ADDRS3_128MB (0x2 << 10)
130#define IMX6Q_GPR1_ACT_CS3 BIT(9)
131#define IMX6Q_GPR1_ADDRS2_MASK (0x3 << 7)
132#define IMX6Q_GPR1_ACT_CS2 BIT(6)
133#define IMX6Q_GPR1_ADDRS1_MASK (0x3 << 4)
134#define IMX6Q_GPR1_ACT_CS1 BIT(3)
135#define IMX6Q_GPR1_ADDRS0_MASK (0x3 << 1)
136#define IMX6Q_GPR1_ACT_CS0 BIT(0)
137
138#define IMX6Q_GPR2_COUNTER_RESET_VAL_MASK (0x3 << 20)
139#define IMX6Q_GPR2_COUNTER_RESET_VAL_5 (0x0 << 20)
140#define IMX6Q_GPR2_COUNTER_RESET_VAL_3 (0x1 << 20)
141#define IMX6Q_GPR2_COUNTER_RESET_VAL_4 (0x2 << 20)
142#define IMX6Q_GPR2_COUNTER_RESET_VAL_6 (0x3 << 20)
143#define IMX6Q_GPR2_LVDS_CLK_SHIFT_MASK (0x7 << 16)
144#define IMX6Q_GPR2_LVDS_CLK_SHIFT_0 (0x0 << 16)
145#define IMX6Q_GPR2_LVDS_CLK_SHIFT_1 (0x1 << 16)
146#define IMX6Q_GPR2_LVDS_CLK_SHIFT_2 (0x2 << 16)
147#define IMX6Q_GPR2_LVDS_CLK_SHIFT_3 (0x3 << 16)
148#define IMX6Q_GPR2_LVDS_CLK_SHIFT_4 (0x4 << 16)
149#define IMX6Q_GPR2_LVDS_CLK_SHIFT_5 (0x5 << 16)
150#define IMX6Q_GPR2_LVDS_CLK_SHIFT_6 (0x6 << 16)
151#define IMX6Q_GPR2_LVDS_CLK_SHIFT_7 (0x7 << 16)
152#define IMX6Q_GPR2_BGREF_RRMODE_MASK BIT(15)
153#define IMX6Q_GPR2_BGREF_RRMODE_EXT_RESISTOR 0x0
154#define IMX6Q_GPR2_BGREF_RRMODE_INT_RESISTOR BIT(15)
155#define IMX6Q_GPR2_DI1_VS_POLARITY_MASK BIT(10)
156#define IMX6Q_GPR2_DI1_VS_POLARITY_ACTIVE_H 0x0
157#define IMX6Q_GPR2_DI1_VS_POLARITY_ACTIVE_L BIT(10)
158#define IMX6Q_GPR2_DI0_VS_POLARITY_MASK BIT(9)
159#define IMX6Q_GPR2_DI0_VS_POLARITY_ACTIVE_H 0x0
160#define IMX6Q_GPR2_DI0_VS_POLARITY_ACTIVE_L BIT(9)
161#define IMX6Q_GPR2_BIT_MAPPING_CH1_MASK BIT(8)
162#define IMX6Q_GPR2_BIT_MAPPING_CH1_SPWG 0x0
163#define IMX6Q_GPR2_BIT_MAPPING_CH1_JEIDA BIT(8)
164#define IMX6Q_GPR2_DATA_WIDTH_CH1_MASK BIT(7)
165#define IMX6Q_GPR2_DATA_WIDTH_CH1_18BIT 0x0
166#define IMX6Q_GPR2_DATA_WIDTH_CH1_24BIT BIT(7)
167#define IMX6Q_GPR2_BIT_MAPPING_CH0_MASK BIT(6)
168#define IMX6Q_GPR2_BIT_MAPPING_CH0_SPWG 0x0
169#define IMX6Q_GPR2_BIT_MAPPING_CH0_JEIDA BIT(6)
170#define IMX6Q_GPR2_DATA_WIDTH_CH0_MASK BIT(5)
171#define IMX6Q_GPR2_DATA_WIDTH_CH0_18BIT 0x0
172#define IMX6Q_GPR2_DATA_WIDTH_CH0_24BIT BIT(5)
173#define IMX6Q_GPR2_SPLIT_MODE_EN BIT(4)
174#define IMX6Q_GPR2_CH1_MODE_MASK (0x3 << 2)
175#define IMX6Q_GPR2_CH1_MODE_DISABLE (0x0 << 2)
176#define IMX6Q_GPR2_CH1_MODE_EN_ROUTE_DI0 (0x1 << 2)
177#define IMX6Q_GPR2_CH1_MODE_EN_ROUTE_DI1 (0x3 << 2)
178#define IMX6Q_GPR2_CH0_MODE_MASK (0x3 << 0)
179#define IMX6Q_GPR2_CH0_MODE_DISABLE (0x0 << 0)
180#define IMX6Q_GPR2_CH0_MODE_EN_ROUTE_DI0 (0x1 << 0)
181#define IMX6Q_GPR2_CH0_MODE_EN_ROUTE_DI1 (0x3 << 0)
182
183#define IMX6Q_GPR3_GPU_DBG_MASK (0x3 << 29)
184#define IMX6Q_GPR3_GPU_DBG_GPU3D (0x0 << 29)
185#define IMX6Q_GPR3_GPU_DBG_GPU2D (0x1 << 29)
186#define IMX6Q_GPR3_GPU_DBG_OPENVG (0x2 << 29)
187#define IMX6Q_GPR3_BCH_WR_CACHE_CTL BIT(28)
188#define IMX6Q_GPR3_BCH_RD_CACHE_CTL BIT(27)
189#define IMX6Q_GPR3_USDHCX_WR_CACHE_CTL BIT(26)
190#define IMX6Q_GPR3_USDHCX_RD_CACHE_CTL BIT(25)
191#define IMX6Q_GPR3_OCRAM_CTL_MASK (0xf << 21)
192#define IMX6Q_GPR3_OCRAM_STATUS_MASK (0xf << 17)
193#define IMX6Q_GPR3_CORE3_DBG_ACK_EN BIT(16)
194#define IMX6Q_GPR3_CORE2_DBG_ACK_EN BIT(15)
195#define IMX6Q_GPR3_CORE1_DBG_ACK_EN BIT(14)
196#define IMX6Q_GPR3_CORE0_DBG_ACK_EN BIT(13)
197#define IMX6Q_GPR3_TZASC2_BOOT_LOCK BIT(12)
198#define IMX6Q_GPR3_TZASC1_BOOT_LOCK BIT(11)
199#define IMX6Q_GPR3_IPU_DIAG_MASK BIT(10)
200#define IMX6Q_GPR3_LVDS1_MUX_CTL_MASK (0x3 << 8)
201#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU1_DI0 (0x0 << 8)
202#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU1_DI1 (0x1 << 8)
203#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU2_DI0 (0x2 << 8)
204#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU2_DI1 (0x3 << 8)
205#define IMX6Q_GPR3_LVDS0_MUX_CTL_MASK (0x3 << 6)
206#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI0 (0x0 << 6)
207#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI1 (0x1 << 6)
208#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI0 (0x2 << 6)
209#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI1 (0x3 << 6)
210#define IMX6Q_GPR3_MIPI_MUX_CTL_MASK (0x3 << 4)
211#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI0 (0x0 << 4)
212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4)
213#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI0 (0x2 << 4)
214#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI1 (0x3 << 4)
215#define IMX6Q_GPR3_HDMI_MUX_CTL_MASK (0x3 << 2)
216#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI0 (0x0 << 2)
217#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI1 (0x1 << 2)
218#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU2_DI0 (0x2 << 2)
219#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU2_DI1 (0x3 << 2)
220
221#define IMX6Q_GPR4_VDOA_WR_CACHE_SEL BIT(31)
222#define IMX6Q_GPR4_VDOA_RD_CACHE_SEL BIT(30)
223#define IMX6Q_GPR4_VDOA_WR_CACHE_VAL BIT(29)
224#define IMX6Q_GPR4_VDOA_RD_CACHE_VAL BIT(28)
225#define IMX6Q_GPR4_PCIE_WR_CACHE_SEL BIT(27)
226#define IMX6Q_GPR4_PCIE_RD_CACHE_SEL BIT(26)
227#define IMX6Q_GPR4_PCIE_WR_CACHE_VAL BIT(25)
228#define IMX6Q_GPR4_PCIE_RD_CACHE_VAL BIT(24)
229#define IMX6Q_GPR4_SDMA_STOP_ACK BIT(19)
230#define IMX6Q_GPR4_CAN2_STOP_ACK BIT(18)
231#define IMX6Q_GPR4_CAN1_STOP_ACK BIT(17)
232#define IMX6Q_GPR4_ENET_STOP_ACK BIT(16)
233#define IMX6Q_GPR4_SOC_VERSION_MASK (0xff << 8)
234#define IMX6Q_GPR4_SOC_VERSION_OFF 0x8
235#define IMX6Q_GPR4_VPU_WR_CACHE_SEL BIT(7)
236#define IMX6Q_GPR4_VPU_RD_CACHE_SEL BIT(6)
237#define IMX6Q_GPR4_VPU_P_WR_CACHE_VAL BIT(3)
238#define IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK BIT(2)
239#define IMX6Q_GPR4_IPU_WR_CACHE_CTL BIT(1)
240#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)
241
242#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
243
244#define IMX6Q_GPR9_TZASC2_BYP BIT(1)
245#define IMX6Q_GPR9_TZASC1_BYP BIT(0)
246
247#define IMX6Q_GPR10_LOCK_DBG_EN BIT(29)
248#define IMX6Q_GPR10_LOCK_DBG_CLK_EN BIT(28)
249#define IMX6Q_GPR10_LOCK_SEC_ERR_RESP BIT(27)
250#define IMX6Q_GPR10_LOCK_OCRAM_TZ_ADDR (0x3f << 21)
251#define IMX6Q_GPR10_LOCK_OCRAM_TZ_EN BIT(20)
252#define IMX6Q_GPR10_LOCK_DCIC2_MUX_MASK (0x3 << 18)
253#define IMX6Q_GPR10_LOCK_DCIC1_MUX_MASK (0x3 << 16)
254#define IMX6Q_GPR10_DBG_EN BIT(13)
255#define IMX6Q_GPR10_DBG_CLK_EN BIT(12)
256#define IMX6Q_GPR10_SEC_ERR_RESP_MASK BIT(11)
257#define IMX6Q_GPR10_SEC_ERR_RESP_OKEY 0x0
258#define IMX6Q_GPR10_SEC_ERR_RESP_SLVE BIT(11)
259#define IMX6Q_GPR10_OCRAM_TZ_ADDR_MASK (0x3f << 5)
260#define IMX6Q_GPR10_OCRAM_TZ_EN_MASK BIT(4)
261#define IMX6Q_GPR10_DCIC2_MUX_CTL_MASK (0x3 << 2)
262#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU1_DI0 (0x0 << 2)
263#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU1_DI1 (0x1 << 2)
264#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU2_DI0 (0x2 << 2)
265#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU2_DI1 (0x3 << 2)
266#define IMX6Q_GPR10_DCIC1_MUX_CTL_MASK (0x3 << 0)
267#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU1_DI0 (0x0 << 0)
268#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU1_DI1 (0x1 << 0)
269#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU2_DI0 (0x2 << 0)
270#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU2_DI1 (0x3 << 0)
271
272#define IMX6Q_GPR12_ARMP_IPG_CLK_EN BIT(27)
273#define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26)
274#define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25)
275#define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24)
276#define IMX6Q_GPR12_PCIE_CTL_2 BIT(10)
277
278#define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30)
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)
281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27)
282#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24)
283#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24)
284#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24)
285#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24)
286#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24)
287#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24)
288#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24)
289#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24)
290#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24)
291#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19)
292#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19)
293#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19)
294#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19)
295#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19)
296#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19)
297#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19)
298#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16)
299#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15)
300#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0
301#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15)
302#define IMX6Q_GPR13_SATA_PHY_5 BIT(14)
303#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11)
304#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11)
305#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11)
306#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11)
307#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11)
308#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11)
309#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11)
310#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7)
311#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7
312#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2)
313#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2
314#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0)
315#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0)
316#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0)
317#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0)
318
319#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 3acb3a8e3af5..6b8e1ff4672b 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -117,6 +117,7 @@ struct tc3589x {
117 struct mutex lock; 117 struct mutex lock;
118 struct device *dev; 118 struct device *dev;
119 struct i2c_client *i2c; 119 struct i2c_client *i2c;
120 struct irq_domain *domain;
120 121
121 int irq_base; 122 int irq_base;
122 int num_gpio; 123 int num_gpio;
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 12c06870829a..290762f93930 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -22,6 +22,9 @@
22#include <linux/regulator/driver.h> 22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h> 23#include <linux/regulator/machine.h>
24 24
25/* TPS chip id list */
26#define TPS65217 0xF0
27
25/* I2C ID for TPS65217 part */ 28/* I2C ID for TPS65217 part */
26#define TPS65217_I2C_ID 0x24 29#define TPS65217_I2C_ID 0x24
27 30
@@ -210,6 +213,23 @@ enum tps65217_regulator_id {
210/* Number of total regulators available */ 213/* Number of total regulators available */
211#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO) 214#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
212 215
216enum tps65217_bl_isel {
217 TPS65217_BL_ISET1 = 1,
218 TPS65217_BL_ISET2,
219};
220
221enum tps65217_bl_fdim {
222 TPS65217_BL_FDIM_100HZ,
223 TPS65217_BL_FDIM_200HZ,
224 TPS65217_BL_FDIM_500HZ,
225 TPS65217_BL_FDIM_1000HZ,
226};
227
228struct tps65217_bl_pdata {
229 enum tps65217_bl_isel isel;
230 enum tps65217_bl_fdim fdim;
231};
232
213/** 233/**
214 * struct tps65217_board - packages regulator init data 234 * struct tps65217_board - packages regulator init data
215 * @tps65217_regulator_data: regulator initialization values 235 * @tps65217_regulator_data: regulator initialization values
@@ -219,6 +239,7 @@ enum tps65217_regulator_id {
219struct tps65217_board { 239struct tps65217_board {
220 struct regulator_init_data *tps65217_init_data[TPS65217_NUM_REGULATOR]; 240 struct regulator_init_data *tps65217_init_data[TPS65217_NUM_REGULATOR];
221 struct device_node *of_node[TPS65217_NUM_REGULATOR]; 241 struct device_node *of_node[TPS65217_NUM_REGULATOR];
242 struct tps65217_bl_pdata *bl_pdata;
222}; 243};
223 244
224/** 245/**
@@ -248,13 +269,11 @@ struct tps_info {
248struct tps65217 { 269struct tps65217 {
249 struct device *dev; 270 struct device *dev;
250 struct tps65217_board *pdata; 271 struct tps65217_board *pdata;
272 unsigned int id;
251 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 273 struct regulator_desc desc[TPS65217_NUM_REGULATOR];
252 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR]; 274 struct regulator_dev *rdev[TPS65217_NUM_REGULATOR];
253 struct tps_info *info[TPS65217_NUM_REGULATOR]; 275 struct tps_info *info[TPS65217_NUM_REGULATOR];
254 struct regmap *regmap; 276 struct regmap *regmap;
255
256 /* Client devices */
257 struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR];
258}; 277};
259 278
260static inline struct tps65217 *dev_to_tps65217(struct device *dev) 279static inline struct tps65217 *dev_to_tps65217(struct device *dev)
@@ -262,6 +281,11 @@ static inline struct tps65217 *dev_to_tps65217(struct device *dev)
262 return dev_get_drvdata(dev); 281 return dev_get_drvdata(dev);
263} 282}
264 283
284static inline int tps65217_chip_id(struct tps65217 *tps65217)
285{
286 return tps65217->id;
287}
288
265int tps65217_reg_read(struct tps65217 *tps, unsigned int reg, 289int tps65217_reg_read(struct tps65217 *tps, unsigned int reg,
266 unsigned int *val); 290 unsigned int *val);
267int tps65217_reg_write(struct tps65217 *tps, unsigned int reg, 291int tps65217_reg_write(struct tps65217 *tps, unsigned int reg,
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index f350fd0ba1df..2dd123194958 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -14,6 +14,7 @@
14#define TPS6586X_SLEW_RATE_MASK 0x07 14#define TPS6586X_SLEW_RATE_MASK 0x07
15 15
16enum { 16enum {
17 TPS6586X_ID_SYS,
17 TPS6586X_ID_SM_0, 18 TPS6586X_ID_SM_0,
18 TPS6586X_ID_SM_1, 19 TPS6586X_ID_SM_1,
19 TPS6586X_ID_SM_2, 20 TPS6586X_ID_SM_2,
@@ -77,6 +78,7 @@ struct tps6586x_platform_data {
77 78
78 int gpio_base; 79 int gpio_base;
79 int irq_base; 80 int irq_base;
81 bool pm_off;
80}; 82};
81 83
82/* 84/*
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 9bf8767818b4..02e894f3ff45 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -132,6 +132,16 @@
132 * 132 *
133 */ 133 */
134 134
135/* RTC_CTRL_REG bitfields */
136#define TPS65910_RTC_CTRL_STOP_RTC 0x01 /*0=stop, 1=run */
137#define TPS65910_RTC_CTRL_GET_TIME 0x40
138
139/* RTC_STATUS_REG bitfields */
140#define TPS65910_RTC_STATUS_ALARM 0x40
141
142/* RTC_INTERRUPTS_REG bitfields */
143#define TPS65910_RTC_INTERRUPTS_EVERY 0x03
144#define TPS65910_RTC_INTERRUPTS_IT_ALARM 0x08
135 145
136/*Register BCK1 (0x80) register.RegisterDescription */ 146/*Register BCK1 (0x80) register.RegisterDescription */
137#define BCK1_BCKUP_MASK 0xFF 147#define BCK1_BCKUP_MASK 0xFF
@@ -366,6 +376,8 @@
366 376
367 377
368/*Register DEVCTRL (0x80) register.RegisterDescription */ 378/*Register DEVCTRL (0x80) register.RegisterDescription */
379#define DEVCTRL_PWR_OFF_MASK 0x80
380#define DEVCTRL_PWR_OFF_SHIFT 7
369#define DEVCTRL_RTC_PWDN_MASK 0x40 381#define DEVCTRL_RTC_PWDN_MASK 0x40
370#define DEVCTRL_RTC_PWDN_SHIFT 6 382#define DEVCTRL_RTC_PWDN_SHIFT 6
371#define DEVCTRL_CK32K_CTRL_MASK 0x20 383#define DEVCTRL_CK32K_CTRL_MASK 0x20
@@ -809,6 +821,7 @@ struct tps65910_board {
809 int vmbch2_threshold; 821 int vmbch2_threshold;
810 bool en_ck32k_xtal; 822 bool en_ck32k_xtal;
811 bool en_dev_slp; 823 bool en_dev_slp;
824 bool pm_off;
812 struct tps65910_sleep_keepon_data *slp_keepon; 825 struct tps65910_sleep_keepon_data *slp_keepon;
813 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; 826 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
814 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; 827 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index eaad49f7c130..a8eff4ad9be5 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -143,7 +143,7 @@
143 143
144#define TWL6040_GPO1 0x01 144#define TWL6040_GPO1 0x01
145#define TWL6040_GPO2 0x02 145#define TWL6040_GPO2 0x02
146#define TWL6040_GPO3 0x03 146#define TWL6040_GPO3 0x04
147 147
148/* ACCCTL (0x2D) fields */ 148/* ACCCTL (0x2D) fields */
149 149
@@ -158,7 +158,7 @@
158#define TWL6040_VIBROCDET 0x20 158#define TWL6040_VIBROCDET 0x20
159#define TWL6040_TSHUTDET 0x40 159#define TWL6040_TSHUTDET 0x40
160 160
161#define TWL6040_CELLS 2 161#define TWL6040_CELLS 3
162 162
163#define TWL6040_REV_ES1_0 0x00 163#define TWL6040_REV_ES1_0 0x00
164#define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */ 164#define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */
@@ -176,6 +176,8 @@
176#define TWL6040_SYSCLK_SEL_LPPLL 0 176#define TWL6040_SYSCLK_SEL_LPPLL 0
177#define TWL6040_SYSCLK_SEL_HPPLL 1 177#define TWL6040_SYSCLK_SEL_HPPLL 1
178 178
179#define TWL6040_GPO_MAX 3
180
179struct twl6040_codec_data { 181struct twl6040_codec_data {
180 u16 hs_left_step; 182 u16 hs_left_step;
181 u16 hs_right_step; 183 u16 hs_right_step;
@@ -192,12 +194,16 @@ struct twl6040_vibra_data {
192 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ 194 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
193}; 195};
194 196
197struct twl6040_gpo_data {
198 int gpio_base;
199};
200
195struct twl6040_platform_data { 201struct twl6040_platform_data {
196 int audpwron_gpio; /* audio power-on gpio */ 202 int audpwron_gpio; /* audio power-on gpio */
197 unsigned int irq_base;
198 203
199 struct twl6040_codec_data *codec; 204 struct twl6040_codec_data *codec;
200 struct twl6040_vibra_data *vibra; 205 struct twl6040_vibra_data *vibra;
206 struct twl6040_gpo_data *gpo;
201}; 207};
202 208
203struct regmap; 209struct regmap;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index f0361c031927..fc87be4fdc25 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -164,6 +164,10 @@ struct wm8994_pdata {
164 int num_micd_rates; 164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates; 165 struct wm8958_micd_rate *micd_rates;
166 166
167 /* Power up delays to add after microphone bias power up (ms) */
168 int micb1_delay;
169 int micb2_delay;
170
167 /* LINEOUT can be differential or single ended */ 171 /* LINEOUT can be differential or single ended */
168 unsigned int lineout1_diff:1; 172 unsigned int lineout1_diff:1;
169 unsigned int lineout2_diff:1; 173 unsigned int lineout2_diff:1;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 61f0905bdc48..de201203bc7c 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -1,3 +1,15 @@
1/*
2 * include/linux/micrel_phy.h
3 *
4 * Micrel PHY IDs
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
1#ifndef _MICREL_PHY_H 13#ifndef _MICREL_PHY_H
2#define _MICREL_PHY_H 14#define _MICREL_PHY_H
3 15
@@ -5,10 +17,11 @@
5 17
6#define PHY_ID_KSZ9021 0x00221610 18#define PHY_ID_KSZ9021 0x00221610
7#define PHY_ID_KS8737 0x00221720 19#define PHY_ID_KS8737 0x00221720
8#define PHY_ID_KS8041 0x00221510 20#define PHY_ID_KSZ8021 0x00221555
9#define PHY_ID_KS8051 0x00221550 21#define PHY_ID_KSZ8041 0x00221510
22#define PHY_ID_KSZ8051 0x00221550
10/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ 23/* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */
11#define PHY_ID_KS8001 0x0022161A 24#define PHY_ID_KSZ8001 0x0022161A
12 25
13/* struct phy_device dev_flags definitions */ 26/* struct phy_device dev_flags definitions */
14#define MICREL_PHY_50MHZ_CLK 0x00000001 27#define MICREL_PHY_50MHZ_CLK 0x00000001
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index bd6c9fcdf2dd..6d1acb04cd17 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -54,7 +54,13 @@ enum {
54}; 54};
55 55
56enum { 56enum {
57 MLX4_MAX_PORTS = 2 57 MLX4_PORT_CAP_IS_SM = 1 << 1,
58 MLX4_PORT_CAP_DEV_MGMT_SUP = 1 << 19,
59};
60
61enum {
62 MLX4_MAX_PORTS = 2,
63 MLX4_MAX_PORT_PKEYS = 128
58}; 64};
59 65
60/* base qkey for use in sriov tunnel-qp/proxy-qp communication. 66/* base qkey for use in sriov tunnel-qp/proxy-qp communication.
@@ -191,6 +197,25 @@ enum {
191 MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0, 197 MLX4_FATAL_WARNING_SUBTYPE_WARMING = 0,
192}; 198};
193 199
200enum slave_port_state {
201 SLAVE_PORT_DOWN = 0,
202 SLAVE_PENDING_UP,
203 SLAVE_PORT_UP,
204};
205
206enum slave_port_gen_event {
207 SLAVE_PORT_GEN_EVENT_DOWN = 0,
208 SLAVE_PORT_GEN_EVENT_UP,
209 SLAVE_PORT_GEN_EVENT_NONE,
210};
211
212enum slave_port_state_event {
213 MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN,
214 MLX4_PORT_STATE_DEV_EVENT_PORT_UP,
215 MLX4_PORT_STATE_IB_PORT_STATE_EVENT_GID_VALID,
216 MLX4_PORT_STATE_IB_EVENT_GID_INVALID,
217};
218
194enum { 219enum {
195 MLX4_PERM_LOCAL_READ = 1 << 10, 220 MLX4_PERM_LOCAL_READ = 1 << 10,
196 MLX4_PERM_LOCAL_WRITE = 1 << 11, 221 MLX4_PERM_LOCAL_WRITE = 1 << 11,
@@ -303,6 +328,9 @@ struct mlx4_phys_caps {
303 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1]; 328 u32 gid_phys_table_len[MLX4_MAX_PORTS + 1];
304 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1]; 329 u32 pkey_phys_table_len[MLX4_MAX_PORTS + 1];
305 u32 num_phys_eqs; 330 u32 num_phys_eqs;
331 u32 base_sqpn;
332 u32 base_proxy_sqpn;
333 u32 base_tunnel_sqpn;
306}; 334};
307 335
308struct mlx4_caps { 336struct mlx4_caps {
@@ -333,9 +361,10 @@ struct mlx4_caps {
333 int max_rq_desc_sz; 361 int max_rq_desc_sz;
334 int max_qp_init_rdma; 362 int max_qp_init_rdma;
335 int max_qp_dest_rdma; 363 int max_qp_dest_rdma;
336 int sqp_start; 364 u32 *qp0_proxy;
337 u32 base_sqpn; 365 u32 *qp1_proxy;
338 u32 base_tunnel_sqpn; 366 u32 *qp0_tunnel;
367 u32 *qp1_tunnel;
339 int num_srqs; 368 int num_srqs;
340 int max_srq_wqes; 369 int max_srq_wqes;
341 int max_srq_sge; 370 int max_srq_sge;
@@ -389,6 +418,7 @@ struct mlx4_caps {
389 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1]; 418 enum mlx4_port_type possible_type[MLX4_MAX_PORTS + 1];
390 u32 max_counters; 419 u32 max_counters;
391 u8 port_ib_mtu[MLX4_MAX_PORTS + 1]; 420 u8 port_ib_mtu[MLX4_MAX_PORTS + 1];
421 u16 sqp_demux;
392}; 422};
393 423
394struct mlx4_buf_list { 424struct mlx4_buf_list {
@@ -671,6 +701,10 @@ struct mlx4_init_port_param {
671 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 701 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
672 if ((type) == (dev)->caps.port_mask[(port)]) 702 if ((type) == (dev)->caps.port_mask[(port)])
673 703
704#define mlx4_foreach_non_ib_transport_port(port, dev) \
705 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
706 if (((dev)->caps.port_mask[port] != MLX4_PORT_TYPE_IB))
707
674#define mlx4_foreach_ib_transport_port(port, dev) \ 708#define mlx4_foreach_ib_transport_port(port, dev) \
675 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \ 709 for ((port) = 1; (port) <= (dev)->caps.num_ports; (port)++) \
676 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \ 710 if (((dev)->caps.port_mask[port] == MLX4_PORT_TYPE_IB) || \
@@ -692,7 +726,18 @@ static inline int mlx4_is_master(struct mlx4_dev *dev)
692 726
693static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn) 727static inline int mlx4_is_qp_reserved(struct mlx4_dev *dev, u32 qpn)
694{ 728{
695 return (qpn < dev->caps.sqp_start + 8); 729 return (qpn < dev->phys_caps.base_sqpn + 8 +
730 16 * MLX4_MFUNC_MAX * !!mlx4_is_master(dev));
731}
732
733static inline int mlx4_is_guest_proxy(struct mlx4_dev *dev, int slave, u32 qpn)
734{
735 int guest_proxy_base = dev->phys_caps.base_proxy_sqpn + slave * 8;
736
737 if (qpn >= guest_proxy_base && qpn < guest_proxy_base + 8)
738 return 1;
739
740 return 0;
696} 741}
697 742
698static inline int mlx4_is_mfunc(struct mlx4_dev *dev) 743static inline int mlx4_is_mfunc(struct mlx4_dev *dev)
@@ -796,6 +841,19 @@ enum mlx4_net_trans_rule_id {
796 MLX4_NET_TRANS_RULE_NUM, /* should be last */ 841 MLX4_NET_TRANS_RULE_NUM, /* should be last */
797}; 842};
798 843
844extern const u16 __sw_id_hw[];
845
846static inline int map_hw_to_sw_id(u16 header_id)
847{
848
849 int i;
850 for (i = 0; i < MLX4_NET_TRANS_RULE_NUM; i++) {
851 if (header_id == __sw_id_hw[i])
852 return i;
853 }
854 return -EINVAL;
855}
856
799enum mlx4_net_trans_promisc_mode { 857enum mlx4_net_trans_promisc_mode {
800 MLX4_FS_PROMISC_NONE = 0, 858 MLX4_FS_PROMISC_NONE = 0,
801 MLX4_FS_PROMISC_UPLINK, 859 MLX4_FS_PROMISC_UPLINK,
@@ -914,6 +972,20 @@ int mlx4_flow_attach(struct mlx4_dev *dev,
914 struct mlx4_net_trans_rule *rule, u64 *reg_id); 972 struct mlx4_net_trans_rule *rule, u64 *reg_id);
915int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 973int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id);
916 974
975void mlx4_sync_pkey_table(struct mlx4_dev *dev, int slave, int port,
976 int i, int val);
977
917int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey); 978int mlx4_get_parav_qkey(struct mlx4_dev *dev, u32 qpn, u32 *qkey);
918 979
980int mlx4_is_slave_active(struct mlx4_dev *dev, int slave);
981int mlx4_gen_pkey_eqe(struct mlx4_dev *dev, int slave, u8 port);
982int mlx4_gen_guid_change_eqe(struct mlx4_dev *dev, int slave, u8 port);
983int mlx4_gen_slaves_port_mgt_ev(struct mlx4_dev *dev, u8 port, int attr);
984int mlx4_gen_port_state_change_eqe(struct mlx4_dev *dev, int slave, u8 port, u8 port_subtype_change);
985enum slave_port_state mlx4_get_slave_port_state(struct mlx4_dev *dev, int slave, u8 port);
986int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int event, enum slave_port_gen_event *gen_event);
987
988void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
989__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
990
919#endif /* MLX4_DEVICE_H */ 991#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index d813704b963b..c257e1b211be 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -45,6 +45,8 @@ enum mlx4_dev_event {
45 MLX4_DEV_EVENT_PORT_DOWN, 45 MLX4_DEV_EVENT_PORT_DOWN,
46 MLX4_DEV_EVENT_PORT_REINIT, 46 MLX4_DEV_EVENT_PORT_REINIT,
47 MLX4_DEV_EVENT_PORT_MGMT_CHANGE, 47 MLX4_DEV_EVENT_PORT_MGMT_CHANGE,
48 MLX4_DEV_EVENT_SLAVE_INIT,
49 MLX4_DEV_EVENT_SLAVE_SHUTDOWN,
48}; 50};
49 51
50struct mlx4_interface { 52struct mlx4_interface {
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 338388ba260a..4b4ad6ffef92 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -126,7 +126,8 @@ struct mlx4_rss_context {
126 126
127struct mlx4_qp_path { 127struct mlx4_qp_path {
128 u8 fl; 128 u8 fl;
129 u8 reserved1[2]; 129 u8 reserved1[1];
130 u8 disable_pkey_check;
130 u8 pkey_index; 131 u8 pkey_index;
131 u8 counter_index; 132 u8 counter_index;
132 u8 grh_mylmc; 133 u8 grh_mylmc;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 311be906b57d..fa0680402738 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -10,7 +10,6 @@
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/mmzone.h> 11#include <linux/mmzone.h>
12#include <linux/rbtree.h> 12#include <linux/rbtree.h>
13#include <linux/prio_tree.h>
14#include <linux/atomic.h> 13#include <linux/atomic.h>
15#include <linux/debug_locks.h> 14#include <linux/debug_locks.h>
16#include <linux/mm_types.h> 15#include <linux/mm_types.h>
@@ -21,6 +20,7 @@
21 20
22struct mempolicy; 21struct mempolicy;
23struct anon_vma; 22struct anon_vma;
23struct anon_vma_chain;
24struct file_ra_state; 24struct file_ra_state;
25struct user_struct; 25struct user_struct;
26struct writeback_control; 26struct writeback_control;
@@ -70,6 +70,8 @@ extern unsigned int kobjsize(const void *objp);
70/* 70/*
71 * vm_flags in vm_area_struct, see mm_types.h. 71 * vm_flags in vm_area_struct, see mm_types.h.
72 */ 72 */
73#define VM_NONE 0x00000000
74
73#define VM_READ 0x00000001 /* currently active flags */ 75#define VM_READ 0x00000001 /* currently active flags */
74#define VM_WRITE 0x00000002 76#define VM_WRITE 0x00000002
75#define VM_EXEC 0x00000004 77#define VM_EXEC 0x00000004
@@ -82,16 +84,9 @@ extern unsigned int kobjsize(const void *objp);
82#define VM_MAYSHARE 0x00000080 84#define VM_MAYSHARE 0x00000080
83 85
84#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 86#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
85#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
86#define VM_GROWSUP 0x00000200
87#else
88#define VM_GROWSUP 0x00000000
89#define VM_NOHUGEPAGE 0x00000200 /* MADV_NOHUGEPAGE marked this vma */
90#endif
91#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
92#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
93 89
94#define VM_EXECUTABLE 0x00001000
95#define VM_LOCKED 0x00002000 90#define VM_LOCKED 0x00002000
96#define VM_IO 0x00004000 /* Memory mapped I/O or similar */ 91#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
97 92
@@ -101,25 +96,34 @@ extern unsigned int kobjsize(const void *objp);
101 96
102#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */ 97#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */
103#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ 98#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */
104#define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */
105#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ 99#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
106#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ 100#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
107#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 101#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
108#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 102#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
109#ifndef CONFIG_TRANSPARENT_HUGEPAGE 103#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
110#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 104#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
111#else
112#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
113#endif
114#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
115#define VM_NODUMP 0x04000000 /* Do not include in the core dump */
116 105
117#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 106#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
119#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 107#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
120#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 108#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
121#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ 109#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
122 110
111#if defined(CONFIG_X86)
112# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */
113#elif defined(CONFIG_PPC)
114# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */
115#elif defined(CONFIG_PARISC)
116# define VM_GROWSUP VM_ARCH_1
117#elif defined(CONFIG_IA64)
118# define VM_GROWSUP VM_ARCH_1
119#elif !defined(CONFIG_MMU)
120# define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */
121#endif
122
123#ifndef VM_GROWSUP
124# define VM_GROWSUP VM_NONE
125#endif
126
123/* Bits set in the VMA until the stack is in its final location */ 127/* Bits set in the VMA until the stack is in its final location */
124#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) 128#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
125 129
@@ -143,7 +147,7 @@ extern unsigned int kobjsize(const void *objp);
143 * Special vmas that are non-mergable, non-mlock()able. 147 * Special vmas that are non-mergable, non-mlock()able.
144 * Note: mm/huge_memory.c VM_NO_THP depends on this definition. 148 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
145 */ 149 */
146#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) 150#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)
147 151
148/* 152/*
149 * mapping from the currently active vm_flags protection bits (the 153 * mapping from the currently active vm_flags protection bits (the
@@ -157,24 +161,7 @@ extern pgprot_t protection_map[16];
157#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ 161#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
158#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ 162#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
159#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */ 163#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */
160 164#define FAULT_FLAG_TRIED 0x40 /* second try */
161/*
162 * This interface is used by x86 PAT code to identify a pfn mapping that is
163 * linear over entire vma. This is to optimize PAT code that deals with
164 * marking the physical region with a particular prot. This is not for generic
165 * mm use. Note also that this check will not work if the pfn mapping is
166 * linear for a vma starting at physical address 0. In which case PAT code
167 * falls back to slow path of reserving physical range page by page.
168 */
169static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
170{
171 return !!(vma->vm_flags & VM_PFN_AT_MMAP);
172}
173
174static inline int is_pfn_mapping(struct vm_area_struct *vma)
175{
176 return !!(vma->vm_flags & VM_PFNMAP);
177}
178 165
179/* 166/*
180 * vm_fault is filled by the the pagefault handler and passed to the vma's 167 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -182,8 +169,7 @@ static inline int is_pfn_mapping(struct vm_area_struct *vma)
182 * of VM_FAULT_xxx flags that give details about how the fault was handled. 169 * of VM_FAULT_xxx flags that give details about how the fault was handled.
183 * 170 *
184 * pgoff should be used in favour of virtual_address, if possible. If pgoff 171 * pgoff should be used in favour of virtual_address, if possible. If pgoff
185 * is used, one may set VM_CAN_NONLINEAR in the vma->vm_flags to get nonlinear 172 * is used, one may implement ->remap_pages to get nonlinear mapping support.
186 * mapping support.
187 */ 173 */
188struct vm_fault { 174struct vm_fault {
189 unsigned int flags; /* FAULT_FLAG_xxx flags */ 175 unsigned int flags; /* FAULT_FLAG_xxx flags */
@@ -241,6 +227,9 @@ struct vm_operations_struct {
241 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, 227 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
242 const nodemask_t *to, unsigned long flags); 228 const nodemask_t *to, unsigned long flags);
243#endif 229#endif
230 /* called by sys_remap_file_pages() to populate non-linear mapping */
231 int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr,
232 unsigned long size, pgoff_t pgoff);
244}; 233};
245 234
246struct mmu_gather; 235struct mmu_gather;
@@ -249,6 +238,18 @@ struct inode;
249#define page_private(page) ((page)->private) 238#define page_private(page) ((page)->private)
250#define set_page_private(page, v) ((page)->private = (v)) 239#define set_page_private(page, v) ((page)->private = (v))
251 240
241/* It's valid only if the page is free path or free_list */
242static inline void set_freepage_migratetype(struct page *page, int migratetype)
243{
244 page->index = migratetype;
245}
246
247/* It's valid only if the page is free path or free_list */
248static inline int get_freepage_migratetype(struct page *page)
249{
250 return page->index;
251}
252
252/* 253/*
253 * FIXME: take this include out, include page-flags.h in 254 * FIXME: take this include out, include page-flags.h in
254 * files which need it (119 of them) 255 * files which need it (119 of them)
@@ -454,6 +455,7 @@ void put_pages_list(struct list_head *pages);
454 455
455void split_page(struct page *page, unsigned int order); 456void split_page(struct page *page, unsigned int order);
456int split_free_page(struct page *page); 457int split_free_page(struct page *page);
458int capture_free_page(struct page *page, int alloc_order, int migratetype);
457 459
458/* 460/*
459 * Compound pages have a destructor function. Provide a 461 * Compound pages have a destructor function. Provide a
@@ -1071,7 +1073,8 @@ vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group);
1071 1073
1072extern unsigned long move_page_tables(struct vm_area_struct *vma, 1074extern unsigned long move_page_tables(struct vm_area_struct *vma,
1073 unsigned long old_addr, struct vm_area_struct *new_vma, 1075 unsigned long old_addr, struct vm_area_struct *new_vma,
1074 unsigned long new_addr, unsigned long len); 1076 unsigned long new_addr, unsigned long len,
1077 bool need_rmap_locks);
1075extern unsigned long do_mremap(unsigned long addr, 1078extern unsigned long do_mremap(unsigned long addr,
1076 unsigned long old_len, unsigned long new_len, 1079 unsigned long old_len, unsigned long new_len,
1077 unsigned long flags, unsigned long new_addr); 1080 unsigned long flags, unsigned long new_addr);
@@ -1366,24 +1369,45 @@ extern void zone_pcp_reset(struct zone *zone);
1366extern atomic_long_t mmap_pages_allocated; 1369extern atomic_long_t mmap_pages_allocated;
1367extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); 1370extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
1368 1371
1369/* prio_tree.c */ 1372/* interval_tree.c */
1370void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1373void vma_interval_tree_insert(struct vm_area_struct *node,
1371void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 1374 struct rb_root *root);
1372void vma_prio_tree_remove(struct vm_area_struct *, struct prio_tree_root *); 1375void vma_interval_tree_insert_after(struct vm_area_struct *node,
1373struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma, 1376 struct vm_area_struct *prev,
1374 struct prio_tree_iter *iter); 1377 struct rb_root *root);
1375 1378void vma_interval_tree_remove(struct vm_area_struct *node,
1376#define vma_prio_tree_foreach(vma, iter, root, begin, end) \ 1379 struct rb_root *root);
1377 for (prio_tree_iter_init(iter, root, begin, end), vma = NULL; \ 1380struct vm_area_struct *vma_interval_tree_iter_first(struct rb_root *root,
1378 (vma = vma_prio_tree_next(vma, iter)); ) 1381 unsigned long start, unsigned long last);
1382struct vm_area_struct *vma_interval_tree_iter_next(struct vm_area_struct *node,
1383 unsigned long start, unsigned long last);
1384
1385#define vma_interval_tree_foreach(vma, root, start, last) \
1386 for (vma = vma_interval_tree_iter_first(root, start, last); \
1387 vma; vma = vma_interval_tree_iter_next(vma, start, last))
1379 1388
1380static inline void vma_nonlinear_insert(struct vm_area_struct *vma, 1389static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
1381 struct list_head *list) 1390 struct list_head *list)
1382{ 1391{
1383 vma->shared.vm_set.parent = NULL; 1392 list_add_tail(&vma->shared.nonlinear, list);
1384 list_add_tail(&vma->shared.vm_set.list, list);
1385} 1393}
1386 1394
1395void anon_vma_interval_tree_insert(struct anon_vma_chain *node,
1396 struct rb_root *root);
1397void anon_vma_interval_tree_remove(struct anon_vma_chain *node,
1398 struct rb_root *root);
1399struct anon_vma_chain *anon_vma_interval_tree_iter_first(
1400 struct rb_root *root, unsigned long start, unsigned long last);
1401struct anon_vma_chain *anon_vma_interval_tree_iter_next(
1402 struct anon_vma_chain *node, unsigned long start, unsigned long last);
1403#ifdef CONFIG_DEBUG_VM_RB
1404void anon_vma_interval_tree_verify(struct anon_vma_chain *node);
1405#endif
1406
1407#define anon_vma_interval_tree_foreach(avc, root, start, last) \
1408 for (avc = anon_vma_interval_tree_iter_first(root, start, last); \
1409 avc; avc = anon_vma_interval_tree_iter_next(avc, start, last))
1410
1387/* mmap.c */ 1411/* mmap.c */
1388extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); 1412extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
1389extern int vma_adjust(struct vm_area_struct *vma, unsigned long start, 1413extern int vma_adjust(struct vm_area_struct *vma, unsigned long start,
@@ -1400,15 +1424,13 @@ extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *,
1400 struct rb_node **, struct rb_node *); 1424 struct rb_node **, struct rb_node *);
1401extern void unlink_file_vma(struct vm_area_struct *); 1425extern void unlink_file_vma(struct vm_area_struct *);
1402extern struct vm_area_struct *copy_vma(struct vm_area_struct **, 1426extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1403 unsigned long addr, unsigned long len, pgoff_t pgoff); 1427 unsigned long addr, unsigned long len, pgoff_t pgoff,
1428 bool *need_rmap_locks);
1404extern void exit_mmap(struct mm_struct *); 1429extern void exit_mmap(struct mm_struct *);
1405 1430
1406extern int mm_take_all_locks(struct mm_struct *mm); 1431extern int mm_take_all_locks(struct mm_struct *mm);
1407extern void mm_drop_all_locks(struct mm_struct *mm); 1432extern void mm_drop_all_locks(struct mm_struct *mm);
1408 1433
1409/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1410extern void added_exe_file_vma(struct mm_struct *mm);
1411extern void removed_exe_file_vma(struct mm_struct *mm);
1412extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); 1434extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
1413extern struct file *get_mm_exe_file(struct mm_struct *mm); 1435extern struct file *get_mm_exe_file(struct mm_struct *mm);
1414 1436
@@ -1662,5 +1684,9 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1662static inline bool page_is_guard(struct page *page) { return false; } 1684static inline bool page_is_guard(struct page *page) { return false; }
1663#endif /* CONFIG_DEBUG_PAGEALLOC */ 1685#endif /* CONFIG_DEBUG_PAGEALLOC */
1664 1686
1687extern void reset_zone_present_pages(void);
1688extern void fixup_zone_present_pages(int nid, unsigned long start_pfn,
1689 unsigned long end_pfn);
1690
1665#endif /* __KERNEL__ */ 1691#endif /* __KERNEL__ */
1666#endif /* _LINUX_MM_H */ 1692#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index bf7867200b95..31f8a3af7d94 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -6,7 +6,6 @@
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/prio_tree.h>
10#include <linux/rbtree.h> 9#include <linux/rbtree.h>
11#include <linux/rwsem.h> 10#include <linux/rwsem.h>
12#include <linux/completion.h> 11#include <linux/completion.h>
@@ -240,18 +239,15 @@ struct vm_area_struct {
240 239
241 /* 240 /*
242 * For areas with an address space and backing store, 241 * For areas with an address space and backing store,
243 * linkage into the address_space->i_mmap prio tree, or 242 * linkage into the address_space->i_mmap interval tree, or
244 * linkage to the list of like vmas hanging off its node, or
245 * linkage of vma in the address_space->i_mmap_nonlinear list. 243 * linkage of vma in the address_space->i_mmap_nonlinear list.
246 */ 244 */
247 union { 245 union {
248 struct { 246 struct {
249 struct list_head list; 247 struct rb_node rb;
250 void *parent; /* aligns with prio_tree_node parent */ 248 unsigned long rb_subtree_last;
251 struct vm_area_struct *head; 249 } linear;
252 } vm_set; 250 struct list_head nonlinear;
253
254 struct raw_prio_tree_node prio_tree_node;
255 } shared; 251 } shared;
256 252
257 /* 253 /*
@@ -349,7 +345,6 @@ struct mm_struct {
349 unsigned long shared_vm; /* Shared pages (files) */ 345 unsigned long shared_vm; /* Shared pages (files) */
350 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */ 346 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */
351 unsigned long stack_vm; /* VM_GROWSUP/DOWN */ 347 unsigned long stack_vm; /* VM_GROWSUP/DOWN */
352 unsigned long reserved_vm; /* VM_RESERVED|VM_IO pages */
353 unsigned long def_flags; 348 unsigned long def_flags;
354 unsigned long nr_ptes; /* Page table pages */ 349 unsigned long nr_ptes; /* Page table pages */
355 unsigned long start_code, end_code, start_data, end_data; 350 unsigned long start_code, end_code, start_data, end_data;
@@ -394,7 +389,6 @@ struct mm_struct {
394 389
395 /* store ref to file /proc/<pid>/exe symlink points to */ 390 /* store ref to file /proc/<pid>/exe symlink points to */
396 struct file *exe_file; 391 struct file *exe_file;
397 unsigned long num_exe_file_vmas;
398#ifdef CONFIG_MMU_NOTIFIER 392#ifdef CONFIG_MMU_NOTIFIER
399 struct mmu_notifier_mm *mmu_notifier_mm; 393 struct mmu_notifier_mm *mmu_notifier_mm;
400#endif 394#endif
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 8b74e9b1d0ad..77cec2f45cb7 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -86,7 +86,6 @@ calc_vm_flag_bits(unsigned long flags)
86{ 86{
87 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | 87 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
88 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 88 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
89 _calc_vm_trans(flags, MAP_EXECUTABLE, VM_EXECUTABLE) |
90 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 89 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED );
91} 90}
92#endif /* __KERNEL__ */ 91#endif /* __KERNEL__ */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 111aca5e97f3..4b27f9f503e4 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -239,6 +239,7 @@ struct mmc_card {
239#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ 239#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
240#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ 240#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
241#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ 241#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
242#define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */
242 /* byte mode */ 243 /* byte mode */
243 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */ 244 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
244#define MMC_NO_POWER_NOTIFICATION 0 245#define MMC_NO_POWER_NOTIFICATION 0
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 1d1b1e13f79f..bc823c4c028b 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/mm_types.h> 6#include <linux/mm_types.h>
7#include <linux/srcu.h>
7 8
8struct mmu_notifier; 9struct mmu_notifier;
9struct mmu_notifier_ops; 10struct mmu_notifier_ops;
@@ -245,50 +246,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
245 __mmu_notifier_mm_destroy(mm); 246 __mmu_notifier_mm_destroy(mm);
246} 247}
247 248
248/*
249 * These two macros will sometime replace ptep_clear_flush.
250 * ptep_clear_flush is implemented as macro itself, so this also is
251 * implemented as a macro until ptep_clear_flush will converted to an
252 * inline function, to diminish the risk of compilation failure. The
253 * invalidate_page method over time can be moved outside the PT lock
254 * and these two macros can be later removed.
255 */
256#define ptep_clear_flush_notify(__vma, __address, __ptep) \
257({ \
258 pte_t __pte; \
259 struct vm_area_struct *___vma = __vma; \
260 unsigned long ___address = __address; \
261 __pte = ptep_clear_flush(___vma, ___address, __ptep); \
262 mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \
263 __pte; \
264})
265
266#define pmdp_clear_flush_notify(__vma, __address, __pmdp) \
267({ \
268 pmd_t __pmd; \
269 struct vm_area_struct *___vma = __vma; \
270 unsigned long ___address = __address; \
271 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
272 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
273 (__address)+HPAGE_PMD_SIZE);\
274 __pmd = pmdp_clear_flush(___vma, ___address, __pmdp); \
275 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
276 (__address)+HPAGE_PMD_SIZE); \
277 __pmd; \
278})
279
280#define pmdp_splitting_flush_notify(__vma, __address, __pmdp) \
281({ \
282 struct vm_area_struct *___vma = __vma; \
283 unsigned long ___address = __address; \
284 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
285 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
286 (__address)+HPAGE_PMD_SIZE);\
287 pmdp_splitting_flush(___vma, ___address, __pmdp); \
288 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
289 (__address)+HPAGE_PMD_SIZE); \
290})
291
292#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \ 249#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
293({ \ 250({ \
294 int __young; \ 251 int __young; \
@@ -311,14 +268,24 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
311 __young; \ 268 __young; \
312}) 269})
313 270
271/*
272 * set_pte_at_notify() sets the pte _after_ running the notifier.
273 * This is safe to start by updating the secondary MMUs, because the primary MMU
274 * pte invalidate must have already happened with a ptep_clear_flush() before
275 * set_pte_at_notify() has been invoked. Updating the secondary MMUs first is
276 * required when we change both the protection of the mapping from read-only to
277 * read-write and the pfn (like during copy on write page faults). Otherwise the
278 * old page would remain mapped readonly in the secondary MMUs after the new
279 * page is already writable by some CPU through the primary MMU.
280 */
314#define set_pte_at_notify(__mm, __address, __ptep, __pte) \ 281#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
315({ \ 282({ \
316 struct mm_struct *___mm = __mm; \ 283 struct mm_struct *___mm = __mm; \
317 unsigned long ___address = __address; \ 284 unsigned long ___address = __address; \
318 pte_t ___pte = __pte; \ 285 pte_t ___pte = __pte; \
319 \ 286 \
320 set_pte_at(___mm, ___address, __ptep, ___pte); \
321 mmu_notifier_change_pte(___mm, ___address, ___pte); \ 287 mmu_notifier_change_pte(___mm, ___address, ___pte); \
288 set_pte_at(___mm, ___address, __ptep, ___pte); \
322}) 289})
323 290
324#else /* CONFIG_MMU_NOTIFIER */ 291#else /* CONFIG_MMU_NOTIFIER */
@@ -369,9 +336,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
369 336
370#define ptep_clear_flush_young_notify ptep_clear_flush_young 337#define ptep_clear_flush_young_notify ptep_clear_flush_young
371#define pmdp_clear_flush_young_notify pmdp_clear_flush_young 338#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
372#define ptep_clear_flush_notify ptep_clear_flush
373#define pmdp_clear_flush_notify pmdp_clear_flush
374#define pmdp_splitting_flush_notify pmdp_splitting_flush
375#define set_pte_at_notify set_pte_at 339#define set_pte_at_notify set_pte_at
376 340
377#endif /* CONFIG_MMU_NOTIFIER */ 341#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 2daa54f55db7..50aaca81f63d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -142,6 +142,7 @@ enum zone_stat_item {
142 NUMA_OTHER, /* allocation from other node */ 142 NUMA_OTHER, /* allocation from other node */
143#endif 143#endif
144 NR_ANON_TRANSPARENT_HUGEPAGES, 144 NR_ANON_TRANSPARENT_HUGEPAGES,
145 NR_FREE_CMA_PAGES,
145 NR_VM_ZONE_STAT_ITEMS }; 146 NR_VM_ZONE_STAT_ITEMS };
146 147
147/* 148/*
@@ -217,6 +218,8 @@ struct lruvec {
217#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) 218#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2)
218/* Isolate for asynchronous migration */ 219/* Isolate for asynchronous migration */
219#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) 220#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4)
221/* Isolate unevictable pages */
222#define ISOLATE_UNEVICTABLE ((__force isolate_mode_t)0x8)
220 223
221/* LRU Isolation modes. */ 224/* LRU Isolation modes. */
222typedef unsigned __bitwise__ isolate_mode_t; 225typedef unsigned __bitwise__ isolate_mode_t;
@@ -369,8 +372,12 @@ struct zone {
369 spinlock_t lock; 372 spinlock_t lock;
370 int all_unreclaimable; /* All pages pinned */ 373 int all_unreclaimable; /* All pages pinned */
371#if defined CONFIG_COMPACTION || defined CONFIG_CMA 374#if defined CONFIG_COMPACTION || defined CONFIG_CMA
372 /* pfn where the last incremental compaction isolated free pages */ 375 /* Set to true when the PG_migrate_skip bits should be cleared */
376 bool compact_blockskip_flush;
377
378 /* pfns where compaction scanners should start */
373 unsigned long compact_cached_free_pfn; 379 unsigned long compact_cached_free_pfn;
380 unsigned long compact_cached_migrate_pfn;
374#endif 381#endif
375#ifdef CONFIG_MEMORY_HOTPLUG 382#ifdef CONFIG_MEMORY_HOTPLUG
376 /* see spanned/present_pages for more description */ 383 /* see spanned/present_pages for more description */
@@ -704,6 +711,7 @@ typedef struct pglist_data {
704 unsigned long node_spanned_pages; /* total size of physical page 711 unsigned long node_spanned_pages; /* total size of physical page
705 range, including holes */ 712 range, including holes */
706 int node_id; 713 int node_id;
714 nodemask_t reclaim_nodes; /* Nodes allowed to reclaim from */
707 wait_queue_head_t kswapd_wait; 715 wait_queue_head_t kswapd_wait;
708 wait_queue_head_t pfmemalloc_wait; 716 wait_queue_head_t pfmemalloc_wait;
709 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 717 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 6955045199b0..fed3def62818 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -232,7 +232,7 @@ struct of_device_id
232 char type[32]; 232 char type[32];
233 char compatible[128]; 233 char compatible[128];
234#ifdef __KERNEL__ 234#ifdef __KERNEL__
235 void *data; 235 const void *data;
236#else 236#else
237 kernel_ulong_t data; 237 kernel_ulong_t data;
238#endif 238#endif
@@ -600,4 +600,12 @@ struct x86_cpu_id {
600#define X86_MODEL_ANY 0 600#define X86_MODEL_ANY 0
601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ 601#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
602 602
603#define IPACK_ANY_FORMAT 0xff
604#define IPACK_ANY_ID (~0)
605struct ipack_device_id {
606 __u8 format; /* Format version or IPACK_ANY_ID */
607 __u32 vendor; /* Vendor ID or IPACK_ANY_ID */
608 __u32 device; /* Device ID or IPACK_ANY_ID */
609};
610
603#endif /* LINUX_MOD_DEVICETABLE_H */ 611#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 2475228c1158..1f8d24bdafda 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -79,9 +79,10 @@ struct mtd_part_parser {
79extern int register_mtd_parser(struct mtd_part_parser *parser); 79extern int register_mtd_parser(struct mtd_part_parser *parser);
80extern int deregister_mtd_parser(struct mtd_part_parser *parser); 80extern int deregister_mtd_parser(struct mtd_part_parser *parser);
81 81
82int mtd_is_partition(struct mtd_info *mtd); 82int mtd_is_partition(const struct mtd_info *mtd);
83int mtd_add_partition(struct mtd_info *master, char *name, 83int mtd_add_partition(struct mtd_info *master, char *name,
84 long long offset, long long length); 84 long long offset, long long length);
85int mtd_del_partition(struct mtd_info *master, int partno); 85int mtd_del_partition(struct mtd_info *master, int partno);
86uint64_t mtd_get_device_size(const struct mtd_info *mtd);
86 87
87#endif 88#endif
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 51bf8ada6dc0..49258e0ed1c6 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -15,6 +15,8 @@
15#define MV643XX_ETH_SIZE_REG_4 0x2224 15#define MV643XX_ETH_SIZE_REG_4 0x2224
16#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290 16#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290
17 17
18#define MV643XX_TX_CSUM_DEFAULT_LIMIT 0
19
18struct mv643xx_eth_shared_platform_data { 20struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 21 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi; 22 struct platform_device *shared_smi;
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index d146ca10c0f5..5c86e2b33e2d 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -27,13 +27,22 @@
27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 ) 27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
28#define NBD_DISCONNECT _IO( 0xab, 8 ) 28#define NBD_DISCONNECT _IO( 0xab, 8 )
29#define NBD_SET_TIMEOUT _IO( 0xab, 9 ) 29#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
30#define NBD_SET_FLAGS _IO( 0xab, 10)
30 31
31enum { 32enum {
32 NBD_CMD_READ = 0, 33 NBD_CMD_READ = 0,
33 NBD_CMD_WRITE = 1, 34 NBD_CMD_WRITE = 1,
34 NBD_CMD_DISC = 2 35 NBD_CMD_DISC = 2,
36 /* there is a gap here to match userspace */
37 NBD_CMD_TRIM = 4
35}; 38};
36 39
40/* values for flags field */
41#define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */
42#define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */
43/* there is a gap here to match userspace */
44#define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */
45
37#define nbd_cmd(req) ((req)->cmd[0]) 46#define nbd_cmd(req) ((req)->cmd[0])
38 47
39/* userspace doesn't need the nbd_device structure */ 48/* userspace doesn't need the nbd_device structure */
@@ -42,10 +51,6 @@ enum {
42#include <linux/wait.h> 51#include <linux/wait.h>
43#include <linux/mutex.h> 52#include <linux/mutex.h>
44 53
45/* values for flags field */
46#define NBD_READ_ONLY 0x0001
47#define NBD_WRITE_NOCHK 0x0002
48
49struct request; 54struct request;
50 55
51struct nbd_device { 56struct nbd_device {
diff --git a/include/linux/net.h b/include/linux/net.h
index 99276c3dc89a..6ab31cabef7c 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -65,6 +65,7 @@ typedef enum {
65struct poll_table_struct; 65struct poll_table_struct;
66struct pipe_inode_info; 66struct pipe_inode_info;
67struct inode; 67struct inode;
68struct file;
68struct net; 69struct net;
69 70
70#define SOCK_ASYNC_NOSPACE 0 71#define SOCK_ASYNC_NOSPACE 0
@@ -246,7 +247,7 @@ extern int sock_sendmsg(struct socket *sock, struct msghdr *msg,
246 size_t len); 247 size_t len);
247extern int sock_recvmsg(struct socket *sock, struct msghdr *msg, 248extern int sock_recvmsg(struct socket *sock, struct msghdr *msg,
248 size_t size, int flags); 249 size_t size, int flags);
249extern int sock_map_fd(struct socket *sock, int flags); 250extern struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
250extern struct socket *sockfd_lookup(int fd, int *err); 251extern struct socket *sockfd_lookup(int fd, int *err);
251extern struct socket *sock_from_file(struct file *file, int *err); 252extern struct socket *sock_from_file(struct file *file, int *err);
252#define sockfd_put(sock) fput(sock->file) 253#define sockfd_put(sock) fput(sock->file)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a9db4f33407f..01646aa53b0e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -338,18 +338,16 @@ struct napi_struct {
338 338
339 unsigned long state; 339 unsigned long state;
340 int weight; 340 int weight;
341 unsigned int gro_count;
341 int (*poll)(struct napi_struct *, int); 342 int (*poll)(struct napi_struct *, int);
342#ifdef CONFIG_NETPOLL 343#ifdef CONFIG_NETPOLL
343 spinlock_t poll_lock; 344 spinlock_t poll_lock;
344 int poll_owner; 345 int poll_owner;
345#endif 346#endif
346
347 unsigned int gro_count;
348
349 struct net_device *dev; 347 struct net_device *dev;
350 struct list_head dev_list;
351 struct sk_buff *gro_list; 348 struct sk_buff *gro_list;
352 struct sk_buff *skb; 349 struct sk_buff *skb;
350 struct list_head dev_list;
353}; 351};
354 352
355enum { 353enum {
@@ -906,11 +904,12 @@ struct netdev_fcoe_hbainfo {
906 * feature set might be less than what was returned by ndo_fix_features()). 904 * feature set might be less than what was returned by ndo_fix_features()).
907 * Must return >0 or -errno if it changed dev->features itself. 905 * Must return >0 or -errno if it changed dev->features itself.
908 * 906 *
909 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev, 907 * int (*ndo_fdb_add)(struct ndmsg *ndm, struct nlattr *tb[],
910 * unsigned char *addr, u16 flags) 908 * struct net_device *dev,
909 * const unsigned char *addr, u16 flags)
911 * Adds an FDB entry to dev for addr. 910 * Adds an FDB entry to dev for addr.
912 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev, 911 * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
913 * unsigned char *addr) 912 * const unsigned char *addr)
914 * Deletes the FDB entry from dev coresponding to addr. 913 * Deletes the FDB entry from dev coresponding to addr.
915 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, 914 * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
916 * struct net_device *dev, int idx) 915 * struct net_device *dev, int idx)
@@ -953,7 +952,8 @@ struct net_device_ops {
953#ifdef CONFIG_NET_POLL_CONTROLLER 952#ifdef CONFIG_NET_POLL_CONTROLLER
954 void (*ndo_poll_controller)(struct net_device *dev); 953 void (*ndo_poll_controller)(struct net_device *dev);
955 int (*ndo_netpoll_setup)(struct net_device *dev, 954 int (*ndo_netpoll_setup)(struct net_device *dev,
956 struct netpoll_info *info); 955 struct netpoll_info *info,
956 gfp_t gfp);
957 void (*ndo_netpoll_cleanup)(struct net_device *dev); 957 void (*ndo_netpoll_cleanup)(struct net_device *dev);
958#endif 958#endif
959 int (*ndo_set_vf_mac)(struct net_device *dev, 959 int (*ndo_set_vf_mac)(struct net_device *dev,
@@ -1015,12 +1015,13 @@ struct net_device_ops {
1015 void (*ndo_neigh_destroy)(struct neighbour *n); 1015 void (*ndo_neigh_destroy)(struct neighbour *n);
1016 1016
1017 int (*ndo_fdb_add)(struct ndmsg *ndm, 1017 int (*ndo_fdb_add)(struct ndmsg *ndm,
1018 struct nlattr *tb[],
1018 struct net_device *dev, 1019 struct net_device *dev,
1019 unsigned char *addr, 1020 const unsigned char *addr,
1020 u16 flags); 1021 u16 flags);
1021 int (*ndo_fdb_del)(struct ndmsg *ndm, 1022 int (*ndo_fdb_del)(struct ndmsg *ndm,
1022 struct net_device *dev, 1023 struct net_device *dev,
1023 unsigned char *addr); 1024 const unsigned char *addr);
1024 int (*ndo_fdb_dump)(struct sk_buff *skb, 1025 int (*ndo_fdb_dump)(struct sk_buff *skb,
1025 struct netlink_callback *cb, 1026 struct netlink_callback *cb,
1026 struct net_device *dev, 1027 struct net_device *dev,
@@ -1321,6 +1322,8 @@ struct net_device {
1321 /* phy device may attach itself for hardware timestamping */ 1322 /* phy device may attach itself for hardware timestamping */
1322 struct phy_device *phydev; 1323 struct phy_device *phydev;
1323 1324
1325 struct lock_class_key *qdisc_tx_busylock;
1326
1324 /* group the device belongs to */ 1327 /* group the device belongs to */
1325 int group; 1328 int group;
1326 1329
@@ -1400,6 +1403,9 @@ static inline void netdev_for_each_tx_queue(struct net_device *dev,
1400 f(dev, &dev->_tx[i], arg); 1403 f(dev, &dev->_tx[i], arg);
1401} 1404}
1402 1405
1406extern struct netdev_queue *netdev_pick_tx(struct net_device *dev,
1407 struct sk_buff *skb);
1408
1403/* 1409/*
1404 * Net namespace inlines 1410 * Net namespace inlines
1405 */ 1411 */
@@ -1521,6 +1527,8 @@ struct packet_type {
1521 struct sk_buff **(*gro_receive)(struct sk_buff **head, 1527 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1522 struct sk_buff *skb); 1528 struct sk_buff *skb);
1523 int (*gro_complete)(struct sk_buff *skb); 1529 int (*gro_complete)(struct sk_buff *skb);
1530 bool (*id_match)(struct packet_type *ptype,
1531 struct sock *sk);
1524 void *af_packet_priv; 1532 void *af_packet_priv;
1525 struct list_head list; 1533 struct list_head list;
1526}; 1534};
@@ -1550,7 +1558,7 @@ struct packet_type {
1550#define NETDEV_PRE_TYPE_CHANGE 0x000E 1558#define NETDEV_PRE_TYPE_CHANGE 0x000E
1551#define NETDEV_POST_TYPE_CHANGE 0x000F 1559#define NETDEV_POST_TYPE_CHANGE 0x000F
1552#define NETDEV_POST_INIT 0x0010 1560#define NETDEV_POST_INIT 0x0010
1553#define NETDEV_UNREGISTER_BATCH 0x0011 1561#define NETDEV_UNREGISTER_FINAL 0x0011
1554#define NETDEV_RELEASE 0x0012 1562#define NETDEV_RELEASE 0x0012
1555#define NETDEV_NOTIFY_PEERS 0x0013 1563#define NETDEV_NOTIFY_PEERS 0x0013
1556#define NETDEV_JOIN 0x0014 1564#define NETDEV_JOIN 0x0014
@@ -2224,6 +2232,7 @@ static inline void dev_hold(struct net_device *dev)
2224 * kind of lower layer not just hardware media. 2232 * kind of lower layer not just hardware media.
2225 */ 2233 */
2226 2234
2235extern void linkwatch_init_dev(struct net_device *dev);
2227extern void linkwatch_fire_event(struct net_device *dev); 2236extern void linkwatch_fire_event(struct net_device *dev);
2228extern void linkwatch_forget_dev(struct net_device *dev); 2237extern void linkwatch_forget_dev(struct net_device *dev);
2229 2238
@@ -2246,8 +2255,6 @@ extern void netif_carrier_on(struct net_device *dev);
2246 2255
2247extern void netif_carrier_off(struct net_device *dev); 2256extern void netif_carrier_off(struct net_device *dev);
2248 2257
2249extern void netif_notify_peers(struct net_device *dev);
2250
2251/** 2258/**
2252 * netif_dormant_on - mark device as dormant. 2259 * netif_dormant_on - mark device as dormant.
2253 * @dev: network device 2260 * @dev: network device
@@ -2557,9 +2564,9 @@ extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
2557extern void __hw_addr_init(struct netdev_hw_addr_list *list); 2564extern void __hw_addr_init(struct netdev_hw_addr_list *list);
2558 2565
2559/* Functions used for device addresses handling */ 2566/* Functions used for device addresses handling */
2560extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 2567extern int dev_addr_add(struct net_device *dev, const unsigned char *addr,
2561 unsigned char addr_type); 2568 unsigned char addr_type);
2562extern int dev_addr_del(struct net_device *dev, unsigned char *addr, 2569extern int dev_addr_del(struct net_device *dev, const unsigned char *addr,
2563 unsigned char addr_type); 2570 unsigned char addr_type);
2564extern int dev_addr_add_multiple(struct net_device *to_dev, 2571extern int dev_addr_add_multiple(struct net_device *to_dev,
2565 struct net_device *from_dev, 2572 struct net_device *from_dev,
@@ -2571,20 +2578,20 @@ extern void dev_addr_flush(struct net_device *dev);
2571extern int dev_addr_init(struct net_device *dev); 2578extern int dev_addr_init(struct net_device *dev);
2572 2579
2573/* Functions used for unicast addresses handling */ 2580/* Functions used for unicast addresses handling */
2574extern int dev_uc_add(struct net_device *dev, unsigned char *addr); 2581extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);
2575extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr); 2582extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);
2576extern int dev_uc_del(struct net_device *dev, unsigned char *addr); 2583extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);
2577extern int dev_uc_sync(struct net_device *to, struct net_device *from); 2584extern int dev_uc_sync(struct net_device *to, struct net_device *from);
2578extern void dev_uc_unsync(struct net_device *to, struct net_device *from); 2585extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2579extern void dev_uc_flush(struct net_device *dev); 2586extern void dev_uc_flush(struct net_device *dev);
2580extern void dev_uc_init(struct net_device *dev); 2587extern void dev_uc_init(struct net_device *dev);
2581 2588
2582/* Functions used for multicast addresses handling */ 2589/* Functions used for multicast addresses handling */
2583extern int dev_mc_add(struct net_device *dev, unsigned char *addr); 2590extern int dev_mc_add(struct net_device *dev, const unsigned char *addr);
2584extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); 2591extern int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
2585extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr); 2592extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);
2586extern int dev_mc_del(struct net_device *dev, unsigned char *addr); 2593extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);
2587extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); 2594extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);
2588extern int dev_mc_sync(struct net_device *to, struct net_device *from); 2595extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2589extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 2596extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2590extern void dev_mc_flush(struct net_device *dev); 2597extern void dev_mc_flush(struct net_device *dev);
@@ -2596,8 +2603,7 @@ extern void __dev_set_rx_mode(struct net_device *dev);
2596extern int dev_set_promiscuity(struct net_device *dev, int inc); 2603extern int dev_set_promiscuity(struct net_device *dev, int inc);
2597extern int dev_set_allmulti(struct net_device *dev, int inc); 2604extern int dev_set_allmulti(struct net_device *dev, int inc);
2598extern void netdev_state_change(struct net_device *dev); 2605extern void netdev_state_change(struct net_device *dev);
2599extern int netdev_bonding_change(struct net_device *dev, 2606extern void netdev_notify_peers(struct net_device *dev);
2600 unsigned long event);
2601extern void netdev_features_change(struct net_device *dev); 2607extern void netdev_features_change(struct net_device *dev);
2602/* Load a device via the kmod */ 2608/* Load a device via the kmod */
2603extern void dev_load(struct net *net, const char *name); 2609extern void dev_load(struct net *net, const char *name);
@@ -2717,9 +2723,6 @@ static inline const char *netdev_name(const struct net_device *dev)
2717 return dev->name; 2723 return dev->name;
2718} 2724}
2719 2725
2720extern int __netdev_printk(const char *level, const struct net_device *dev,
2721 struct va_format *vaf);
2722
2723extern __printf(3, 4) 2726extern __printf(3, 4)
2724int netdev_printk(const char *level, const struct net_device *dev, 2727int netdev_printk(const char *level, const struct net_device *dev,
2725 const char *format, ...); 2728 const char *format, ...);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index c613cf0d7884..1dcf2a38e51f 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -342,7 +342,7 @@ extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
342extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 342extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
343 343
344#include <net/flow.h> 344#include <net/flow.h>
345extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 345extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
346 346
347static inline void 347static inline void
348nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) 348nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
@@ -350,13 +350,11 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
350#ifdef CONFIG_NF_NAT_NEEDED 350#ifdef CONFIG_NF_NAT_NEEDED
351 void (*decodefn)(struct sk_buff *, struct flowi *); 351 void (*decodefn)(struct sk_buff *, struct flowi *);
352 352
353 if (family == AF_INET) { 353 rcu_read_lock();
354 rcu_read_lock(); 354 decodefn = rcu_dereference(nf_nat_decode_session_hook);
355 decodefn = rcu_dereference(ip_nat_decode_session); 355 if (decodefn)
356 if (decodefn) 356 decodefn(skb, fl);
357 decodefn(skb, fl); 357 rcu_read_unlock();
358 rcu_read_unlock();
359 }
360#endif 358#endif
361} 359}
362 360
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 2edc64cab739..528697b3c152 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -190,6 +190,7 @@ enum ip_set_dim {
190 * If changed, new revision of iptables match/target is required. 190 * If changed, new revision of iptables match/target is required.
191 */ 191 */
192 IPSET_DIM_MAX = 6, 192 IPSET_DIM_MAX = 6,
193 IPSET_BIT_RETURN_NOMATCH = 7,
193}; 194};
194 195
195/* Option flags for kernel operations */ 196/* Option flags for kernel operations */
@@ -198,6 +199,7 @@ enum ip_set_kopt {
198 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE), 199 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
199 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO), 200 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
200 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE), 201 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
202 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),
201}; 203};
202 204
203#ifdef __KERNEL__ 205#ifdef __KERNEL__
@@ -206,9 +208,15 @@ enum ip_set_kopt {
206#include <linux/netlink.h> 208#include <linux/netlink.h>
207#include <linux/netfilter.h> 209#include <linux/netfilter.h>
208#include <linux/netfilter/x_tables.h> 210#include <linux/netfilter/x_tables.h>
211#include <linux/stringify.h>
209#include <linux/vmalloc.h> 212#include <linux/vmalloc.h>
210#include <net/netlink.h> 213#include <net/netlink.h>
211 214
215#define _IP_SET_MODULE_DESC(a, b, c) \
216 MODULE_DESCRIPTION(a " type of IP sets, revisions " b "-" c)
217#define IP_SET_MODULE_DESC(a, b, c) \
218 _IP_SET_MODULE_DESC(a, __stringify(b), __stringify(c))
219
212/* Set features */ 220/* Set features */
213enum ip_set_feature { 221enum ip_set_feature {
214 IPSET_TYPE_IP_FLAG = 0, 222 IPSET_TYPE_IP_FLAG = 0,
@@ -223,6 +231,8 @@ enum ip_set_feature {
223 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 231 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
224 IPSET_TYPE_IFACE_FLAG = 5, 232 IPSET_TYPE_IFACE_FLAG = 5,
225 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG), 233 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
234 IPSET_TYPE_NOMATCH_FLAG = 6,
235 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG),
226 /* Strictly speaking not a feature, but a flag for dumping: 236 /* Strictly speaking not a feature, but a flag for dumping:
227 * this settype must be dumped last */ 237 * this settype must be dumped last */
228 IPSET_DUMP_LAST_FLAG = 7, 238 IPSET_DUMP_LAST_FLAG = 7,
@@ -249,7 +259,7 @@ struct ip_set_type_variant {
249 * returns negative error code, 259 * returns negative error code,
250 * zero for no match/success to add/delete 260 * zero for no match/success to add/delete
251 * positive for matching element */ 261 * positive for matching element */
252 int (*kadt)(struct ip_set *set, const struct sk_buff * skb, 262 int (*kadt)(struct ip_set *set, const struct sk_buff *skb,
253 const struct xt_action_param *par, 263 const struct xt_action_param *par,
254 enum ipset_adt adt, const struct ip_set_adt_opt *opt); 264 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
255 265
@@ -424,7 +434,8 @@ static inline int nla_put_ipaddr4(struct sk_buff *skb, int type, __be32 ipaddr)
424 return ret; 434 return ret;
425} 435}
426 436
427static inline int nla_put_ipaddr6(struct sk_buff *skb, int type, const struct in6_addr *ipaddrptr) 437static inline int nla_put_ipaddr6(struct sk_buff *skb, int type,
438 const struct in6_addr *ipaddrptr)
428{ 439{
429 struct nlattr *__nested = ipset_nest_start(skb, type); 440 struct nlattr *__nested = ipset_nest_start(skb, type);
430 int ret; 441 int ret;
diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h
index b114d35aea5e..ef9acd3c8450 100644
--- a/include/linux/netfilter/ipset/ip_set_ahash.h
+++ b/include/linux/netfilter/ipset/ip_set_ahash.h
@@ -137,50 +137,59 @@ htable_bits(u32 hashsize)
137#endif 137#endif
138 138
139#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128) 139#define SET_HOST_MASK(family) (family == AF_INET ? 32 : 128)
140#ifdef IP_SET_HASH_WITH_MULTI
141#define NETS_LENGTH(family) (SET_HOST_MASK(family) + 1)
142#else
143#define NETS_LENGTH(family) SET_HOST_MASK(family)
144#endif
140 145
141/* Network cidr size book keeping when the hash stores different 146/* Network cidr size book keeping when the hash stores different
142 * sized networks */ 147 * sized networks */
143static void 148static void
144add_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) 149add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
145{ 150{
146 u8 i; 151 int i, j;
147
148 ++h->nets[cidr-1].nets;
149
150 pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
151 152
152 if (h->nets[cidr-1].nets > 1) 153 /* Add in increasing prefix order, so larger cidr first */
153 return; 154 for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) {
154 155 if (j != -1)
155 /* New cidr size */ 156 continue;
156 for (i = 0; i < host_mask && h->nets[i].cidr; i++) { 157 else if (h->nets[i].cidr < cidr)
157 /* Add in increasing prefix order, so larger cidr first */ 158 j = i;
158 if (h->nets[i].cidr < cidr) 159 else if (h->nets[i].cidr == cidr) {
159 swap(h->nets[i].cidr, cidr); 160 h->nets[i].nets++;
161 return;
162 }
163 }
164 if (j != -1) {
165 for (; i > j; i--) {
166 h->nets[i].cidr = h->nets[i - 1].cidr;
167 h->nets[i].nets = h->nets[i - 1].nets;
168 }
160 } 169 }
161 if (i < host_mask) 170 h->nets[i].cidr = cidr;
162 h->nets[i].cidr = cidr; 171 h->nets[i].nets = 1;
163} 172}
164 173
165static void 174static void
166del_cidr(struct ip_set_hash *h, u8 cidr, u8 host_mask) 175del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length)
167{ 176{
168 u8 i; 177 u8 i, j;
169
170 --h->nets[cidr-1].nets;
171 178
172 pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets); 179 for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++)
180 ;
181 h->nets[i].nets--;
173 182
174 if (h->nets[cidr-1].nets != 0) 183 if (h->nets[i].nets != 0)
175 return; 184 return;
176 185
177 /* All entries with this cidr size deleted, so cleanup h->cidr[] */ 186 for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) {
178 for (i = 0; i < host_mask - 1 && h->nets[i].cidr; i++) { 187 h->nets[j].cidr = h->nets[j + 1].cidr;
179 if (h->nets[i].cidr == cidr) 188 h->nets[j].nets = h->nets[j + 1].nets;
180 h->nets[i].cidr = cidr = h->nets[i+1].cidr;
181 } 189 }
182 h->nets[i - 1].cidr = 0;
183} 190}
191#else
192#define NETS_LENGTH(family) 0
184#endif 193#endif
185 194
186/* Destroy the hashtable part of the set */ 195/* Destroy the hashtable part of the set */
@@ -202,14 +211,14 @@ ahash_destroy(struct htable *t)
202 211
203/* Calculate the actual memory size of the set data */ 212/* Calculate the actual memory size of the set data */
204static size_t 213static size_t
205ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 host_mask) 214ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length)
206{ 215{
207 u32 i; 216 u32 i;
208 struct htable *t = h->table; 217 struct htable *t = h->table;
209 size_t memsize = sizeof(*h) 218 size_t memsize = sizeof(*h)
210 + sizeof(*t) 219 + sizeof(*t)
211#ifdef IP_SET_HASH_WITH_NETS 220#ifdef IP_SET_HASH_WITH_NETS
212 + sizeof(struct ip_set_hash_nets) * host_mask 221 + sizeof(struct ip_set_hash_nets) * nets_length
213#endif 222#endif
214 + jhash_size(t->htable_bits) * sizeof(struct hbucket); 223 + jhash_size(t->htable_bits) * sizeof(struct hbucket);
215 224
@@ -238,7 +247,7 @@ ip_set_hash_flush(struct ip_set *set)
238 } 247 }
239#ifdef IP_SET_HASH_WITH_NETS 248#ifdef IP_SET_HASH_WITH_NETS
240 memset(h->nets, 0, sizeof(struct ip_set_hash_nets) 249 memset(h->nets, 0, sizeof(struct ip_set_hash_nets)
241 * SET_HOST_MASK(set->family)); 250 * NETS_LENGTH(set->family));
242#endif 251#endif
243 h->elements = 0; 252 h->elements = 0;
244} 253}
@@ -271,9 +280,6 @@ ip_set_hash_destroy(struct ip_set *set)
271(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \ 280(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval) \
272 & jhash_mask(htable_bits)) 281 & jhash_mask(htable_bits))
273 282
274#define CONCAT(a, b, c) a##b##c
275#define TOKEN(a, b, c) CONCAT(a, b, c)
276
277/* Type/family dependent function prototypes */ 283/* Type/family dependent function prototypes */
278 284
279#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal) 285#define type_pf_data_equal TOKEN(TYPE, PF, _data_equal)
@@ -478,7 +484,7 @@ type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags)
478 } 484 }
479 485
480#ifdef IP_SET_HASH_WITH_NETS 486#ifdef IP_SET_HASH_WITH_NETS
481 add_cidr(h, CIDR(d->cidr), HOST_MASK); 487 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
482#endif 488#endif
483 h->elements++; 489 h->elements++;
484out: 490out:
@@ -513,7 +519,7 @@ type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags)
513 n->pos--; 519 n->pos--;
514 h->elements--; 520 h->elements--;
515#ifdef IP_SET_HASH_WITH_NETS 521#ifdef IP_SET_HASH_WITH_NETS
516 del_cidr(h, CIDR(d->cidr), HOST_MASK); 522 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
517#endif 523#endif
518 if (n->pos + AHASH_INIT_SIZE < n->size) { 524 if (n->pos + AHASH_INIT_SIZE < n->size) {
519 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 525 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -546,10 +552,10 @@ type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
546 const struct type_pf_elem *data; 552 const struct type_pf_elem *data;
547 int i, j = 0; 553 int i, j = 0;
548 u32 key, multi = 0; 554 u32 key, multi = 0;
549 u8 host_mask = SET_HOST_MASK(set->family); 555 u8 nets_length = NETS_LENGTH(set->family);
550 556
551 pr_debug("test by nets\n"); 557 pr_debug("test by nets\n");
552 for (; j < host_mask && h->nets[j].cidr && !multi; j++) { 558 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
553 type_pf_data_netmask(d, h->nets[j].cidr); 559 type_pf_data_netmask(d, h->nets[j].cidr);
554 key = HKEY(d, h->initval, t->htable_bits); 560 key = HKEY(d, h->initval, t->htable_bits);
555 n = hbucket(t, key); 561 n = hbucket(t, key);
@@ -604,7 +610,7 @@ type_pf_head(struct ip_set *set, struct sk_buff *skb)
604 memsize = ahash_memsize(h, with_timeout(h->timeout) 610 memsize = ahash_memsize(h, with_timeout(h->timeout)
605 ? sizeof(struct type_pf_telem) 611 ? sizeof(struct type_pf_telem)
606 : sizeof(struct type_pf_elem), 612 : sizeof(struct type_pf_elem),
607 set->family == AF_INET ? 32 : 128); 613 NETS_LENGTH(set->family));
608 read_unlock_bh(&set->lock); 614 read_unlock_bh(&set->lock);
609 615
610 nested = ipset_nest_start(skb, IPSET_ATTR_DATA); 616 nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
@@ -690,7 +696,7 @@ nla_put_failure:
690} 696}
691 697
692static int 698static int
693type_pf_kadt(struct ip_set *set, const struct sk_buff * skb, 699type_pf_kadt(struct ip_set *set, const struct sk_buff *skb,
694 const struct xt_action_param *par, 700 const struct xt_action_param *par,
695 enum ipset_adt adt, const struct ip_set_adt_opt *opt); 701 enum ipset_adt adt, const struct ip_set_adt_opt *opt);
696static int 702static int
@@ -783,7 +789,7 @@ type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
783 789
784/* Delete expired elements from the hashtable */ 790/* Delete expired elements from the hashtable */
785static void 791static void
786type_pf_expire(struct ip_set_hash *h) 792type_pf_expire(struct ip_set_hash *h, u8 nets_length)
787{ 793{
788 struct htable *t = h->table; 794 struct htable *t = h->table;
789 struct hbucket *n; 795 struct hbucket *n;
@@ -798,7 +804,7 @@ type_pf_expire(struct ip_set_hash *h)
798 if (type_pf_data_expired(data)) { 804 if (type_pf_data_expired(data)) {
799 pr_debug("expired %u/%u\n", i, j); 805 pr_debug("expired %u/%u\n", i, j);
800#ifdef IP_SET_HASH_WITH_NETS 806#ifdef IP_SET_HASH_WITH_NETS
801 del_cidr(h, CIDR(data->cidr), HOST_MASK); 807 del_cidr(h, CIDR(data->cidr), nets_length);
802#endif 808#endif
803 if (j != n->pos - 1) 809 if (j != n->pos - 1)
804 /* Not last one */ 810 /* Not last one */
@@ -839,7 +845,7 @@ type_pf_tresize(struct ip_set *set, bool retried)
839 if (!retried) { 845 if (!retried) {
840 i = h->elements; 846 i = h->elements;
841 write_lock_bh(&set->lock); 847 write_lock_bh(&set->lock);
842 type_pf_expire(set->data); 848 type_pf_expire(set->data, NETS_LENGTH(set->family));
843 write_unlock_bh(&set->lock); 849 write_unlock_bh(&set->lock);
844 if (h->elements < i) 850 if (h->elements < i)
845 return 0; 851 return 0;
@@ -904,7 +910,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
904 910
905 if (h->elements >= h->maxelem) 911 if (h->elements >= h->maxelem)
906 /* FIXME: when set is full, we slow down here */ 912 /* FIXME: when set is full, we slow down here */
907 type_pf_expire(h); 913 type_pf_expire(h, NETS_LENGTH(set->family));
908 if (h->elements >= h->maxelem) { 914 if (h->elements >= h->maxelem) {
909 if (net_ratelimit()) 915 if (net_ratelimit())
910 pr_warning("Set %s is full, maxelem %u reached\n", 916 pr_warning("Set %s is full, maxelem %u reached\n",
@@ -933,8 +939,8 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
933 if (j != AHASH_MAX(h) + 1) { 939 if (j != AHASH_MAX(h) + 1) {
934 data = ahash_tdata(n, j); 940 data = ahash_tdata(n, j);
935#ifdef IP_SET_HASH_WITH_NETS 941#ifdef IP_SET_HASH_WITH_NETS
936 del_cidr(h, CIDR(data->cidr), HOST_MASK); 942 del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family));
937 add_cidr(h, CIDR(d->cidr), HOST_MASK); 943 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
938#endif 944#endif
939 type_pf_data_copy(data, d); 945 type_pf_data_copy(data, d);
940 type_pf_data_timeout_set(data, timeout); 946 type_pf_data_timeout_set(data, timeout);
@@ -952,7 +958,7 @@ type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags)
952 } 958 }
953 959
954#ifdef IP_SET_HASH_WITH_NETS 960#ifdef IP_SET_HASH_WITH_NETS
955 add_cidr(h, CIDR(d->cidr), HOST_MASK); 961 add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
956#endif 962#endif
957 h->elements++; 963 h->elements++;
958out: 964out:
@@ -986,7 +992,7 @@ type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags)
986 n->pos--; 992 n->pos--;
987 h->elements--; 993 h->elements--;
988#ifdef IP_SET_HASH_WITH_NETS 994#ifdef IP_SET_HASH_WITH_NETS
989 del_cidr(h, CIDR(d->cidr), HOST_MASK); 995 del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family));
990#endif 996#endif
991 if (n->pos + AHASH_INIT_SIZE < n->size) { 997 if (n->pos + AHASH_INIT_SIZE < n->size) {
992 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) 998 void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
@@ -1016,9 +1022,9 @@ type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
1016 struct hbucket *n; 1022 struct hbucket *n;
1017 int i, j = 0; 1023 int i, j = 0;
1018 u32 key, multi = 0; 1024 u32 key, multi = 0;
1019 u8 host_mask = SET_HOST_MASK(set->family); 1025 u8 nets_length = NETS_LENGTH(set->family);
1020 1026
1021 for (; j < host_mask && h->nets[j].cidr && !multi; j++) { 1027 for (; j < nets_length && h->nets[j].nets && !multi; j++) {
1022 type_pf_data_netmask(d, h->nets[j].cidr); 1028 type_pf_data_netmask(d, h->nets[j].cidr);
1023 key = HKEY(d, h->initval, t->htable_bits); 1029 key = HKEY(d, h->initval, t->htable_bits);
1024 n = hbucket(t, key); 1030 n = hbucket(t, key);
@@ -1147,7 +1153,7 @@ type_pf_gc(unsigned long ul_set)
1147 1153
1148 pr_debug("called\n"); 1154 pr_debug("called\n");
1149 write_lock_bh(&set->lock); 1155 write_lock_bh(&set->lock);
1150 type_pf_expire(h); 1156 type_pf_expire(h, NETS_LENGTH(set->family));
1151 write_unlock_bh(&set->lock); 1157 write_unlock_bh(&set->lock);
1152 1158
1153 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; 1159 h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
index 0bb5a6976bf3..4b59a1584959 100644
--- a/include/linux/netfilter/nf_conntrack_amanda.h
+++ b/include/linux/netfilter/nf_conntrack_amanda.h
@@ -4,6 +4,7 @@
4 4
5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb, 5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb,
6 enum ip_conntrack_info ctinfo, 6 enum ip_conntrack_info ctinfo,
7 unsigned int protoff,
7 unsigned int matchoff, 8 unsigned int matchoff,
8 unsigned int matchlen, 9 unsigned int matchlen,
9 struct nf_conntrack_expect *exp); 10 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index 3e3aa08980c3..8faf3f792d13 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -18,13 +18,17 @@ enum nf_ct_ftp_type {
18 18
19#define FTP_PORT 21 19#define FTP_PORT 21
20 20
21#define NF_CT_FTP_SEQ_PICKUP (1 << 0)
22
21#define NUM_SEQ_TO_REMEMBER 2 23#define NUM_SEQ_TO_REMEMBER 2
22/* This structure exists only once per master */ 24/* This structure exists only once per master */
23struct nf_ct_ftp_master { 25struct nf_ct_ftp_master {
24 /* Valid seq positions for cmd matching after newline */ 26 /* Valid seq positions for cmd matching after newline */
25 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER]; 27 u_int32_t seq_aft_nl[IP_CT_DIR_MAX][NUM_SEQ_TO_REMEMBER];
26 /* 0 means seq_match_aft_nl not set */ 28 /* 0 means seq_match_aft_nl not set */
27 int seq_aft_nl_num[IP_CT_DIR_MAX]; 29 u_int16_t seq_aft_nl_num[IP_CT_DIR_MAX];
30 /* pickup sequence tracking, useful for conntrackd */
31 u_int16_t flags[IP_CT_DIR_MAX];
28}; 32};
29 33
30struct nf_conntrack_expect; 34struct nf_conntrack_expect;
@@ -34,6 +38,7 @@ struct nf_conntrack_expect;
34extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb, 38extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
35 enum ip_conntrack_info ctinfo, 39 enum ip_conntrack_info ctinfo,
36 enum nf_ct_ftp_type type, 40 enum nf_ct_ftp_type type,
41 unsigned int protoff,
37 unsigned int matchoff, 42 unsigned int matchoff,
38 unsigned int matchlen, 43 unsigned int matchlen,
39 struct nf_conntrack_expect *exp); 44 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index 26f9226ea72b..f381020eee92 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -36,12 +36,12 @@ extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37extern void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this); 38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
42 union nf_inet_addr *addr, 42 union nf_inet_addr *addr,
43 __be16 port); 43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff *skb, 44extern int (*set_h225_addr_hook) (struct sk_buff *skb, unsigned int protoff,
45 unsigned char **data, int dataoff, 45 unsigned char **data, int dataoff,
46 TransportAddress *taddr, 46 TransportAddress *taddr,
47 union nf_inet_addr *addr, 47 union nf_inet_addr *addr,
@@ -49,40 +49,45 @@ extern int (*set_h225_addr_hook) (struct sk_buff *skb,
49extern int (*set_sig_addr_hook) (struct sk_buff *skb, 49extern int (*set_sig_addr_hook) (struct sk_buff *skb,
50 struct nf_conn *ct, 50 struct nf_conn *ct,
51 enum ip_conntrack_info ctinfo, 51 enum ip_conntrack_info ctinfo,
52 unsigned char **data, 52 unsigned int protoff, unsigned char **data,
53 TransportAddress *taddr, int count); 53 TransportAddress *taddr, int count);
54extern int (*set_ras_addr_hook) (struct sk_buff *skb, 54extern int (*set_ras_addr_hook) (struct sk_buff *skb,
55 struct nf_conn *ct, 55 struct nf_conn *ct,
56 enum ip_conntrack_info ctinfo, 56 enum ip_conntrack_info ctinfo,
57 unsigned char **data, 57 unsigned int protoff, unsigned char **data,
58 TransportAddress *taddr, int count); 58 TransportAddress *taddr, int count);
59extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb, 59extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
60 struct nf_conn *ct, 60 struct nf_conn *ct,
61 enum ip_conntrack_info ctinfo, 61 enum ip_conntrack_info ctinfo,
62 unsigned char **data, int dataoff, 62 unsigned int protoff, unsigned char **data,
63 int dataoff,
63 H245_TransportAddress *taddr, 64 H245_TransportAddress *taddr,
64 __be16 port, __be16 rtp_port, 65 __be16 port, __be16 rtp_port,
65 struct nf_conntrack_expect *rtp_exp, 66 struct nf_conntrack_expect *rtp_exp,
66 struct nf_conntrack_expect *rtcp_exp); 67 struct nf_conntrack_expect *rtcp_exp);
67extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct, 68extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
68 enum ip_conntrack_info ctinfo, 69 enum ip_conntrack_info ctinfo,
70 unsigned int protoff,
69 unsigned char **data, int dataoff, 71 unsigned char **data, int dataoff,
70 H245_TransportAddress *taddr, __be16 port, 72 H245_TransportAddress *taddr, __be16 port,
71 struct nf_conntrack_expect *exp); 73 struct nf_conntrack_expect *exp);
72extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct, 74extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct,
73 enum ip_conntrack_info ctinfo, 75 enum ip_conntrack_info ctinfo,
76 unsigned int protoff,
74 unsigned char **data, int dataoff, 77 unsigned char **data, int dataoff,
75 TransportAddress *taddr, __be16 port, 78 TransportAddress *taddr, __be16 port,
76 struct nf_conntrack_expect *exp); 79 struct nf_conntrack_expect *exp);
77extern int (*nat_callforwarding_hook) (struct sk_buff *skb, 80extern int (*nat_callforwarding_hook) (struct sk_buff *skb,
78 struct nf_conn *ct, 81 struct nf_conn *ct,
79 enum ip_conntrack_info ctinfo, 82 enum ip_conntrack_info ctinfo,
83 unsigned int protoff,
80 unsigned char **data, int dataoff, 84 unsigned char **data, int dataoff,
81 TransportAddress *taddr, 85 TransportAddress *taddr,
82 __be16 port, 86 __be16 port,
83 struct nf_conntrack_expect *exp); 87 struct nf_conntrack_expect *exp);
84extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct, 88extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct,
85 enum ip_conntrack_info ctinfo, 89 enum ip_conntrack_info ctinfo,
90 unsigned int protoff,
86 unsigned char **data, TransportAddress *taddr, 91 unsigned char **data, TransportAddress *taddr,
87 int idx, __be16 port, 92 int idx, __be16 port,
88 struct nf_conntrack_expect *exp); 93 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_h323_asn1.h b/include/linux/netfilter/nf_conntrack_h323_asn1.h
index 8dab5968fc7e..3176a277eed1 100644
--- a/include/linux/netfilter/nf_conntrack_h323_asn1.h
+++ b/include/linux/netfilter/nf_conntrack_h323_asn1.h
@@ -40,7 +40,7 @@
40/***************************************************************************** 40/*****************************************************************************
41 * H.323 Types 41 * H.323 Types
42 ****************************************************************************/ 42 ****************************************************************************/
43#include "nf_conntrack_h323_types.h" 43#include <linux/netfilter/nf_conntrack_h323_types.h>
44 44
45typedef struct { 45typedef struct {
46 enum { 46 enum {
diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h
index 36282bf71b63..4bb9bae67176 100644
--- a/include/linux/netfilter/nf_conntrack_irc.h
+++ b/include/linux/netfilter/nf_conntrack_irc.h
@@ -7,6 +7,7 @@
7 7
8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb, 8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
9 enum ip_conntrack_info ctinfo, 9 enum ip_conntrack_info ctinfo,
10 unsigned int protoff,
10 unsigned int matchoff, 11 unsigned int matchoff,
11 unsigned int matchlen, 12 unsigned int matchlen,
12 struct nf_conntrack_expect *exp); 13 struct nf_conntrack_expect *exp);
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index 3bbde0c3a8a6..2ab2830316b7 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -303,12 +303,14 @@ struct nf_conntrack_expect;
303extern int 303extern int
304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb, 304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb,
305 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 305 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
306 unsigned int protoff,
306 struct PptpControlHeader *ctlh, 307 struct PptpControlHeader *ctlh,
307 union pptp_ctrl_union *pptpReq); 308 union pptp_ctrl_union *pptpReq);
308 309
309extern int 310extern int
310(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb, 311(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb,
311 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 312 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
313 unsigned int protoff,
312 struct PptpControlHeader *ctlh, 314 struct PptpControlHeader *ctlh,
313 union pptp_ctrl_union *pptpReq); 315 union pptp_ctrl_union *pptpReq);
314 316
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 0dfc8b7210a3..387bdd02945d 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -37,10 +37,12 @@ struct sdp_media_type {
37struct sip_handler { 37struct sip_handler {
38 const char *method; 38 const char *method;
39 unsigned int len; 39 unsigned int len;
40 int (*request)(struct sk_buff *skb, unsigned int dataoff, 40 int (*request)(struct sk_buff *skb, unsigned int protoff,
41 unsigned int dataoff,
41 const char **dptr, unsigned int *datalen, 42 const char **dptr, unsigned int *datalen,
42 unsigned int cseq); 43 unsigned int cseq);
43 int (*response)(struct sk_buff *skb, unsigned int dataoff, 44 int (*response)(struct sk_buff *skb, unsigned int protoff,
45 unsigned int dataoff,
44 const char **dptr, unsigned int *datalen, 46 const char **dptr, unsigned int *datalen,
45 unsigned int cseq, unsigned int code); 47 unsigned int cseq, unsigned int code);
46}; 48};
@@ -97,19 +99,20 @@ enum sip_header_types {
97enum sdp_header_types { 99enum sdp_header_types {
98 SDP_HDR_UNSPEC, 100 SDP_HDR_UNSPEC,
99 SDP_HDR_VERSION, 101 SDP_HDR_VERSION,
100 SDP_HDR_OWNER_IP4, 102 SDP_HDR_OWNER,
101 SDP_HDR_CONNECTION_IP4, 103 SDP_HDR_CONNECTION,
102 SDP_HDR_OWNER_IP6,
103 SDP_HDR_CONNECTION_IP6,
104 SDP_HDR_MEDIA, 104 SDP_HDR_MEDIA,
105}; 105};
106 106
107extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 107extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
108 unsigned int protoff,
108 unsigned int dataoff, 109 unsigned int dataoff,
109 const char **dptr, 110 const char **dptr,
110 unsigned int *datalen); 111 unsigned int *datalen);
111extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb, s16 off); 112extern void (*nf_nat_sip_seq_adjust_hook)(struct sk_buff *skb,
113 unsigned int protoff, s16 off);
112extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, 114extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
115 unsigned int protoff,
113 unsigned int dataoff, 116 unsigned int dataoff,
114 const char **dptr, 117 const char **dptr,
115 unsigned int *datalen, 118 unsigned int *datalen,
@@ -117,6 +120,7 @@ extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
117 unsigned int matchoff, 120 unsigned int matchoff,
118 unsigned int matchlen); 121 unsigned int matchlen);
119extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, 122extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
123 unsigned int protoff,
120 unsigned int dataoff, 124 unsigned int dataoff,
121 const char **dptr, 125 const char **dptr,
122 unsigned int *datalen, 126 unsigned int *datalen,
@@ -125,6 +129,7 @@ extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
125 enum sdp_header_types term, 129 enum sdp_header_types term,
126 const union nf_inet_addr *addr); 130 const union nf_inet_addr *addr);
127extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, 131extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
132 unsigned int protoff,
128 unsigned int dataoff, 133 unsigned int dataoff,
129 const char **dptr, 134 const char **dptr,
130 unsigned int *datalen, 135 unsigned int *datalen,
@@ -132,12 +137,14 @@ extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
132 unsigned int matchlen, 137 unsigned int matchlen,
133 u_int16_t port); 138 u_int16_t port);
134extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, 139extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
140 unsigned int protoff,
135 unsigned int dataoff, 141 unsigned int dataoff,
136 const char **dptr, 142 const char **dptr,
137 unsigned int *datalen, 143 unsigned int *datalen,
138 unsigned int sdpoff, 144 unsigned int sdpoff,
139 const union nf_inet_addr *addr); 145 const union nf_inet_addr *addr);
140extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, 146extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
147 unsigned int protoff,
141 unsigned int dataoff, 148 unsigned int dataoff,
142 const char **dptr, 149 const char **dptr,
143 unsigned int *datalen, 150 unsigned int *datalen,
@@ -164,7 +171,7 @@ extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr
164 unsigned int dataoff, unsigned int datalen, 171 unsigned int dataoff, unsigned int datalen,
165 const char *name, 172 const char *name,
166 unsigned int *matchoff, unsigned int *matchlen, 173 unsigned int *matchoff, unsigned int *matchlen,
167 union nf_inet_addr *addr); 174 union nf_inet_addr *addr, bool delim);
168extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr, 175extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
169 unsigned int off, unsigned int datalen, 176 unsigned int off, unsigned int datalen,
170 const char *name, 177 const char *name,
diff --git a/include/linux/netfilter/nf_nat.h b/include/linux/netfilter/nf_nat.h
index 8df2d13730b2..bf0cc373ffb6 100644
--- a/include/linux/netfilter/nf_nat.h
+++ b/include/linux/netfilter/nf_nat.h
@@ -22,4 +22,12 @@ struct nf_nat_ipv4_multi_range_compat {
22 struct nf_nat_ipv4_range range[1]; 22 struct nf_nat_ipv4_range range[1];
23}; 23};
24 24
25struct nf_nat_range {
26 unsigned int flags;
27 union nf_inet_addr min_addr;
28 union nf_inet_addr max_addr;
29 union nf_conntrack_man_proto min_proto;
30 union nf_conntrack_man_proto max_proto;
31};
32
25#endif /* _NETFILTER_NF_NAT_H */ 33#endif /* _NETFILTER_NF_NAT_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index f649f7423ca2..43bfe3e1685b 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -142,9 +142,13 @@ enum ctattr_tstamp {
142 142
143enum ctattr_nat { 143enum ctattr_nat {
144 CTA_NAT_UNSPEC, 144 CTA_NAT_UNSPEC,
145 CTA_NAT_MINIP, 145 CTA_NAT_V4_MINIP,
146 CTA_NAT_MAXIP, 146#define CTA_NAT_MINIP CTA_NAT_V4_MINIP
147 CTA_NAT_V4_MAXIP,
148#define CTA_NAT_MAXIP CTA_NAT_V4_MAXIP
147 CTA_NAT_PROTO, 149 CTA_NAT_PROTO,
150 CTA_NAT_V6_MINIP,
151 CTA_NAT_V6_MAXIP,
148 __CTA_NAT_MAX 152 __CTA_NAT_MAX
149}; 153};
150#define CTA_NAT_MAX (__CTA_NAT_MAX - 1) 154#define CTA_NAT_MAX (__CTA_NAT_MAX - 1)
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/linux/netfilter/nfnetlink_queue.h
index 3b1c1360aedf..70ec8c2bc11a 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/linux/netfilter/nfnetlink_queue.h
@@ -44,6 +44,7 @@ enum nfqnl_attr_type {
44 NFQA_PAYLOAD, /* opaque data payload */ 44 NFQA_PAYLOAD, /* opaque data payload */
45 NFQA_CT, /* nf_conntrack_netlink.h */ 45 NFQA_CT, /* nf_conntrack_netlink.h */
46 NFQA_CT_INFO, /* enum ip_conntrack_info */ 46 NFQA_CT_INFO, /* enum ip_conntrack_info */
47 NFQA_CAP_LEN, /* __u32 length of captured packet */
47 48
48 __NFQA_MAX 49 __NFQA_MAX
49}; 50};
diff --git a/include/linux/netfilter/xt_time.h b/include/linux/netfilter/xt_time.h
index 7c37fac576c4..095886019396 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/linux/netfilter/xt_time.h
@@ -17,6 +17,9 @@ enum {
17 /* Match against local time (instead of UTC) */ 17 /* Match against local time (instead of UTC) */
18 XT_TIME_LOCAL_TZ = 1 << 0, 18 XT_TIME_LOCAL_TZ = 1 << 0,
19 19
20 /* treat timestart > timestop (e.g. 23:00-01:00) as single period */
21 XT_TIME_CONTIGUOUS = 1 << 1,
22
20 /* Shortcuts */ 23 /* Shortcuts */
21 XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE, 24 XT_TIME_ALL_MONTHDAYS = 0xFFFFFFFE,
22 XT_TIME_ALL_WEEKDAYS = 0xFE, 25 XT_TIME_ALL_WEEKDAYS = 0xFE,
@@ -24,4 +27,6 @@ enum {
24 XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1, 27 XT_TIME_MAX_DAYTIME = 24 * 60 * 60 - 1,
25}; 28};
26 29
30#define XT_TIME_ALL_FLAGS (XT_TIME_LOCAL_TZ|XT_TIME_CONTIGUOUS)
31
27#endif /* _XT_TIME_H */ 32#endif /* _XT_TIME_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index e2b12801378d..b962dfc695ae 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -79,7 +79,6 @@ enum nf_ip_hook_priorities {
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type); 81extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
82extern int ip_xfrm_me_harder(struct sk_buff *skb);
83extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 82extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
84 unsigned int dataoff, u_int8_t protocol); 83 unsigned int dataoff, u_int8_t protocol);
85#endif /*__KERNEL__*/ 84#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index bd095bc075e9..b88c0058bf73 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -1,6 +1,7 @@
1header-y += ip6_tables.h 1header-y += ip6_tables.h
2header-y += ip6t_HL.h 2header-y += ip6t_HL.h
3header-y += ip6t_LOG.h 3header-y += ip6t_LOG.h
4header-y += ip6t_NPT.h
4header-y += ip6t_REJECT.h 5header-y += ip6t_REJECT.h
5header-y += ip6t_ah.h 6header-y += ip6t_ah.h
6header-y += ip6t_frag.h 7header-y += ip6t_frag.h
diff --git a/include/linux/netfilter_ipv6/ip6t_NPT.h b/include/linux/netfilter_ipv6/ip6t_NPT.h
new file mode 100644
index 000000000000..f763355481b5
--- /dev/null
+++ b/include/linux/netfilter_ipv6/ip6t_NPT.h
@@ -0,0 +1,16 @@
1#ifndef __NETFILTER_IP6T_NPT
2#define __NETFILTER_IP6T_NPT
3
4#include <linux/types.h>
5#include <linux/netfilter.h>
6
7struct ip6t_npt_tginfo {
8 union nf_inet_addr src_pfx;
9 union nf_inet_addr dst_pfx;
10 __u8 src_pfx_len;
11 __u8 dst_pfx_len;
12 /* Used internally by the kernel */
13 __sum16 adjustment;
14};
15
16#endif /* __NETFILTER_IP6T_NPT */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f74dd133788f..f80c56ac4d82 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -153,6 +153,8 @@ struct nlattr {
153 153
154#include <linux/capability.h> 154#include <linux/capability.h>
155#include <linux/skbuff.h> 155#include <linux/skbuff.h>
156#include <linux/export.h>
157#include <net/scm.h>
156 158
157struct net; 159struct net;
158 160
@@ -162,9 +164,10 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)
162} 164}
163 165
164struct netlink_skb_parms { 166struct netlink_skb_parms {
165 struct ucred creds; /* Skb credentials */ 167 struct scm_creds creds; /* Skb credentials */
166 __u32 pid; 168 __u32 portid;
167 __u32 dst_group; 169 __u32 dst_group;
170 struct sock *ssk;
168}; 171};
169 172
170#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb)) 173#define NETLINK_CB(skb) (*(struct netlink_skb_parms*)&((skb)->cb))
@@ -174,17 +177,27 @@ struct netlink_skb_parms {
174extern void netlink_table_grab(void); 177extern void netlink_table_grab(void);
175extern void netlink_table_ungrab(void); 178extern void netlink_table_ungrab(void);
176 179
180#define NL_CFG_F_NONROOT_RECV (1 << 0)
181#define NL_CFG_F_NONROOT_SEND (1 << 1)
182
177/* optional Netlink kernel configuration parameters */ 183/* optional Netlink kernel configuration parameters */
178struct netlink_kernel_cfg { 184struct netlink_kernel_cfg {
179 unsigned int groups; 185 unsigned int groups;
186 unsigned int flags;
180 void (*input)(struct sk_buff *skb); 187 void (*input)(struct sk_buff *skb);
181 struct mutex *cb_mutex; 188 struct mutex *cb_mutex;
182 void (*bind)(int group); 189 void (*bind)(int group);
183}; 190};
184 191
185extern struct sock *netlink_kernel_create(struct net *net, int unit, 192extern struct sock *__netlink_kernel_create(struct net *net, int unit,
186 struct module *module, 193 struct module *module,
187 struct netlink_kernel_cfg *cfg); 194 struct netlink_kernel_cfg *cfg);
195static inline struct sock *
196netlink_kernel_create(struct net *net, int unit, struct netlink_kernel_cfg *cfg)
197{
198 return __netlink_kernel_create(net, unit, THIS_MODULE, cfg);
199}
200
188extern void netlink_kernel_release(struct sock *sk); 201extern void netlink_kernel_release(struct sock *sk);
189extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups); 202extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
190extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 203extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
@@ -192,14 +205,14 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
192extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 205extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
193extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 206extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
194extern int netlink_has_listeners(struct sock *sk, unsigned int group); 207extern int netlink_has_listeners(struct sock *sk, unsigned int group);
195extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 208extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
196extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 209extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
197 __u32 group, gfp_t allocation); 210 __u32 group, gfp_t allocation);
198extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, 211extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
199 __u32 pid, __u32 group, gfp_t allocation, 212 __u32 portid, __u32 group, gfp_t allocation,
200 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data), 213 int (*filter)(struct sock *dsk, struct sk_buff *skb, void *data),
201 void *filter_data); 214 void *filter_data);
202extern int netlink_set_err(struct sock *ssk, __u32 pid, __u32 group, int code); 215extern int netlink_set_err(struct sock *ssk, __u32 portid, __u32 group, int code);
203extern int netlink_register_notifier(struct notifier_block *nb); 216extern int netlink_register_notifier(struct notifier_block *nb);
204extern int netlink_unregister_notifier(struct notifier_block *nb); 217extern int netlink_unregister_notifier(struct notifier_block *nb);
205 218
@@ -240,12 +253,12 @@ struct netlink_callback {
240 253
241struct netlink_notify { 254struct netlink_notify {
242 struct net *net; 255 struct net *net;
243 int pid; 256 int portid;
244 int protocol; 257 int protocol;
245}; 258};
246 259
247struct nlmsghdr * 260struct nlmsghdr *
248__nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags); 261__nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int flags);
249 262
250struct netlink_dump_control { 263struct netlink_dump_control {
251 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 264 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
@@ -258,11 +271,6 @@ extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
258 const struct nlmsghdr *nlh, 271 const struct nlmsghdr *nlh,
259 struct netlink_dump_control *control); 272 struct netlink_dump_control *control);
260 273
261
262#define NL_NONROOT_RECV 0x1
263#define NL_NONROOT_SEND 0x2
264extern void netlink_set_nonroot(int protocol, unsigned flag);
265
266#endif /* __KERNEL__ */ 274#endif /* __KERNEL__ */
267 275
268#endif /* __LINUX_NETLINK_H */ 276#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 28f5389c924b..66d5379c305e 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -23,6 +23,7 @@ struct netpoll {
23 u8 remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24 24
25 struct list_head rx; /* rx_np list element */ 25 struct list_head rx; /* rx_np list element */
26 struct rcu_head rcu;
26}; 27};
27 28
28struct netpoll_info { 29struct netpoll_info {
@@ -38,28 +39,40 @@ struct netpoll_info {
38 struct delayed_work tx_work; 39 struct delayed_work tx_work;
39 40
40 struct netpoll *netpoll; 41 struct netpoll *netpoll;
42 struct rcu_head rcu;
41}; 43};
42 44
43void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 45void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
44void netpoll_print_options(struct netpoll *np); 46void netpoll_print_options(struct netpoll *np);
45int netpoll_parse_options(struct netpoll *np, char *opt); 47int netpoll_parse_options(struct netpoll *np, char *opt);
46int __netpoll_setup(struct netpoll *np, struct net_device *ndev); 48int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp);
47int netpoll_setup(struct netpoll *np); 49int netpoll_setup(struct netpoll *np);
48int netpoll_trap(void); 50int netpoll_trap(void);
49void netpoll_set_trap(int trap); 51void netpoll_set_trap(int trap);
50void __netpoll_cleanup(struct netpoll *np); 52void __netpoll_cleanup(struct netpoll *np);
53void __netpoll_free_rcu(struct netpoll *np);
51void netpoll_cleanup(struct netpoll *np); 54void netpoll_cleanup(struct netpoll *np);
52int __netpoll_rx(struct sk_buff *skb); 55int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
53void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 56void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
54 struct net_device *dev); 57 struct net_device *dev);
55static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 58static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
56{ 59{
60 unsigned long flags;
61 local_irq_save(flags);
57 netpoll_send_skb_on_dev(np, skb, np->dev); 62 netpoll_send_skb_on_dev(np, skb, np->dev);
63 local_irq_restore(flags);
58} 64}
59 65
60 66
61 67
62#ifdef CONFIG_NETPOLL 68#ifdef CONFIG_NETPOLL
69static inline bool netpoll_rx_on(struct sk_buff *skb)
70{
71 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
72
73 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
74}
75
63static inline bool netpoll_rx(struct sk_buff *skb) 76static inline bool netpoll_rx(struct sk_buff *skb)
64{ 77{
65 struct netpoll_info *npinfo; 78 struct netpoll_info *npinfo;
@@ -67,14 +80,14 @@ static inline bool netpoll_rx(struct sk_buff *skb)
67 bool ret = false; 80 bool ret = false;
68 81
69 local_irq_save(flags); 82 local_irq_save(flags);
70 npinfo = rcu_dereference_bh(skb->dev->npinfo);
71 83
72 if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) 84 if (!netpoll_rx_on(skb))
73 goto out; 85 goto out;
74 86
87 npinfo = rcu_dereference_bh(skb->dev->npinfo);
75 spin_lock(&npinfo->rx_lock); 88 spin_lock(&npinfo->rx_lock);
76 /* check rx_flags again with the lock held */ 89 /* check rx_flags again with the lock held */
77 if (npinfo->rx_flags && __netpoll_rx(skb)) 90 if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
78 ret = true; 91 ret = true;
79 spin_unlock(&npinfo->rx_lock); 92 spin_unlock(&npinfo->rx_lock);
80 93
@@ -83,13 +96,6 @@ out:
83 return ret; 96 return ret;
84} 97}
85 98
86static inline int netpoll_rx_on(struct sk_buff *skb)
87{
88 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
89
90 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
91}
92
93static inline int netpoll_receive_skb(struct sk_buff *skb) 99static inline int netpoll_receive_skb(struct sk_buff *skb)
94{ 100{
95 if (!list_empty(&skb->dev->napi_list)) 101 if (!list_empty(&skb->dev->napi_list))
@@ -119,7 +125,7 @@ static inline void netpoll_poll_unlock(void *have)
119 } 125 }
120} 126}
121 127
122static inline int netpoll_tx_running(struct net_device *dev) 128static inline bool netpoll_tx_running(struct net_device *dev)
123{ 129{
124 return irqs_disabled(); 130 return irqs_disabled();
125} 131}
@@ -127,11 +133,11 @@ static inline int netpoll_tx_running(struct net_device *dev)
127#else 133#else
128static inline bool netpoll_rx(struct sk_buff *skb) 134static inline bool netpoll_rx(struct sk_buff *skb)
129{ 135{
130 return 0; 136 return false;
131} 137}
132static inline int netpoll_rx_on(struct sk_buff *skb) 138static inline bool netpoll_rx_on(struct sk_buff *skb)
133{ 139{
134 return 0; 140 return false;
135} 141}
136static inline int netpoll_receive_skb(struct sk_buff *skb) 142static inline int netpoll_receive_skb(struct sk_buff *skb)
137{ 143{
@@ -147,9 +153,9 @@ static inline void netpoll_poll_unlock(void *have)
147static inline void netpoll_netdev_init(struct net_device *dev) 153static inline void netpoll_netdev_init(struct net_device *dev)
148{ 154{
149} 155}
150static inline int netpoll_tx_running(struct net_device *dev) 156static inline bool netpoll_tx_running(struct net_device *dev)
151{ 157{
152 return 0; 158 return false;
153} 159}
154#endif 160#endif
155 161
diff --git a/include/linux/nfc.h b/include/linux/nfc.h
index 6189f27e305b..d908d17da56d 100644
--- a/include/linux/nfc.h
+++ b/include/linux/nfc.h
@@ -183,4 +183,15 @@ struct sockaddr_nfc_llcp {
183 183
184#define NFC_HEADER_SIZE 1 184#define NFC_HEADER_SIZE 1
185 185
186/**
187 * Pseudo-header info for raw socket packets
188 * First byte is the adapter index
189 * Second byte contains flags
190 * - 0x01 - Direction (0=RX, 1=TX)
191 * - 0x02-0x80 - Reserved
192 **/
193#define NFC_LLCP_RAW_HEADER_SIZE 2
194#define NFC_LLCP_DIRECTION_RX 0x00
195#define NFC_LLCP_DIRECTION_TX 0x01
196
186#endif /*__LINUX_NFC_H */ 197#endif /*__LINUX_NFC_H */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1f8fc7f9bcd8..4b03f56e280e 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -265,11 +265,6 @@ static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
265 return NFS_SERVER(inode)->nfs_client->rpc_ops; 265 return NFS_SERVER(inode)->nfs_client->rpc_ops;
266} 266}
267 267
268static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
269{
270 return NFS_I(inode)->cookieverf;
271}
272
273static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode) 268static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
274{ 269{
275 struct nfs_server *nfss = NFS_SERVER(inode); 270 struct nfs_server *nfss = NFS_SERVER(inode);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 880805774f9f..92ce5783b707 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -69,6 +69,7 @@ struct nfs_pageio_descriptor {
69 const struct nfs_pgio_completion_ops *pg_completion_ops; 69 const struct nfs_pgio_completion_ops *pg_completion_ops;
70 struct pnfs_layout_segment *pg_lseg; 70 struct pnfs_layout_segment *pg_lseg;
71 struct nfs_direct_req *pg_dreq; 71 struct nfs_direct_req *pg_dreq;
72 void *pg_layout_private;
72}; 73};
73 74
74#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) 75#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 00485e084394..be9cf3c7e79e 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -652,7 +652,7 @@ struct nfs_getaclargs {
652}; 652};
653 653
654/* getxattr ACL interface flags */ 654/* getxattr ACL interface flags */
655#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */ 655#define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
656struct nfs_getaclres { 656struct nfs_getaclres {
657 size_t acl_len; 657 size_t acl_len;
658 size_t acl_data_offset; 658 size_t acl_data_offset;
@@ -1248,6 +1248,7 @@ struct nfs_pgio_header {
1248 void (*release) (struct nfs_pgio_header *hdr); 1248 void (*release) (struct nfs_pgio_header *hdr);
1249 const struct nfs_pgio_completion_ops *completion_ops; 1249 const struct nfs_pgio_completion_ops *completion_ops;
1250 struct nfs_direct_req *dreq; 1250 struct nfs_direct_req *dreq;
1251 void *layout_private;
1251 spinlock_t lock; 1252 spinlock_t lock;
1252 /* fields protected by lock */ 1253 /* fields protected by lock */
1253 int pnfs_error; 1254 int pnfs_error;
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 458416279347..7df9b500c804 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -573,6 +573,11 @@
573 * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by 573 * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by
574 * its %NL80211_ATTR_WDEV identifier. 574 * its %NL80211_ATTR_WDEV identifier.
575 * 575 *
576 * @NL80211_CMD_CONN_FAILED: connection request to an AP failed; used to
577 * notify userspace that AP has rejected the connection request from a
578 * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
579 * is used for this.
580 *
576 * @NL80211_CMD_MAX: highest used command number 581 * @NL80211_CMD_MAX: highest used command number
577 * @__NL80211_CMD_AFTER_LAST: internal use 582 * @__NL80211_CMD_AFTER_LAST: internal use
578 */ 583 */
@@ -719,6 +724,8 @@ enum nl80211_commands {
719 NL80211_CMD_START_P2P_DEVICE, 724 NL80211_CMD_START_P2P_DEVICE,
720 NL80211_CMD_STOP_P2P_DEVICE, 725 NL80211_CMD_STOP_P2P_DEVICE,
721 726
727 NL80211_CMD_CONN_FAILED,
728
722 /* add new commands above here */ 729 /* add new commands above here */
723 730
724 /* used to define NL80211_CMD_MAX below */ 731 /* used to define NL80211_CMD_MAX below */
@@ -1262,6 +1269,10 @@ enum nl80211_commands {
1262 * was used to provide the hint. For the different types of 1269 * was used to provide the hint. For the different types of
1263 * allowed user regulatory hints see nl80211_user_reg_hint_type. 1270 * allowed user regulatory hints see nl80211_user_reg_hint_type.
1264 * 1271 *
1272 * @NL80211_ATTR_CONN_FAILED_REASON: The reason for which AP has rejected
1273 * the connection request from a station. nl80211_connect_failed_reason
1274 * enum has different reasons of connection failure.
1275 *
1265 * @NL80211_ATTR_MAX: highest attribute number currently defined 1276 * @NL80211_ATTR_MAX: highest attribute number currently defined
1266 * @__NL80211_ATTR_AFTER_LAST: internal use 1277 * @__NL80211_ATTR_AFTER_LAST: internal use
1267 */ 1278 */
@@ -1517,6 +1528,8 @@ enum nl80211_attrs {
1517 1528
1518 NL80211_ATTR_USER_REG_HINT_TYPE, 1529 NL80211_ATTR_USER_REG_HINT_TYPE,
1519 1530
1531 NL80211_ATTR_CONN_FAILED_REASON,
1532
1520 /* add attributes here, update the policy in nl80211.c */ 1533 /* add attributes here, update the policy in nl80211.c */
1521 1534
1522 __NL80211_ATTR_AFTER_LAST, 1535 __NL80211_ATTR_AFTER_LAST,
@@ -3045,4 +3058,15 @@ enum nl80211_probe_resp_offload_support_attr {
3045 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, 3058 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3,
3046}; 3059};
3047 3060
3061/**
3062 * enum nl80211_connect_failed_reason - connection request failed reasons
3063 * @NL80211_CONN_FAIL_MAX_CLIENTS: Maximum number of clients that can be
3064 * handled by the AP is reached.
3065 * @NL80211_CONN_FAIL_BLOCKED_CLIENT: Client's MAC is in the AP's blocklist.
3066 */
3067enum nl80211_connect_failed_reason {
3068 NL80211_CONN_FAIL_MAX_CLIENTS,
3069 NL80211_CONN_FAIL_BLOCKED_CLIENT,
3070};
3071
3048#endif /* __LINUX_NL80211_H */ 3072#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 9490a00529f4..c25cccaa555a 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -35,8 +35,10 @@ struct nvme_bar {
35 __u64 acq; /* Admin CQ Base Address */ 35 __u64 acq; /* Admin CQ Base Address */
36}; 36};
37 37
38#define NVME_CAP_MQES(cap) ((cap) & 0xffff)
38#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff) 39#define NVME_CAP_TIMEOUT(cap) (((cap) >> 24) & 0xff)
39#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf) 40#define NVME_CAP_STRIDE(cap) (((cap) >> 32) & 0xf)
41#define NVME_CAP_MPSMIN(cap) (((cap) >> 48) & 0xf)
40 42
41enum { 43enum {
42 NVME_CC_ENABLE = 1 << 0, 44 NVME_CC_ENABLE = 1 << 0,
diff --git a/include/linux/nx842.h b/include/linux/nx842.h
new file mode 100644
index 000000000000..a4d324c6406a
--- /dev/null
+++ b/include/linux/nx842.h
@@ -0,0 +1,11 @@
1#ifndef __NX842_H__
2#define __NX842_H__
3
4int nx842_get_workmem_size(void);
5int nx842_get_workmem_size_aligned(void);
6int nx842_compress(const unsigned char *in, unsigned int in_len,
7 unsigned char *out, unsigned int *out_len, void *wrkmem);
8int nx842_decompress(const unsigned char *in, unsigned int in_len,
9 unsigned char *out, unsigned int *out_len, void *wrkmem);
10
11#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index 5919ee33f2b7..72843b72a2b2 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -190,10 +190,19 @@ extern struct device_node *of_get_parent(const struct device_node *node);
190extern struct device_node *of_get_next_parent(struct device_node *node); 190extern struct device_node *of_get_next_parent(struct device_node *node);
191extern struct device_node *of_get_next_child(const struct device_node *node, 191extern struct device_node *of_get_next_child(const struct device_node *node,
192 struct device_node *prev); 192 struct device_node *prev);
193extern struct device_node *of_get_next_available_child(
194 const struct device_node *node, struct device_node *prev);
195
196extern struct device_node *of_get_child_by_name(const struct device_node *node,
197 const char *name);
193#define for_each_child_of_node(parent, child) \ 198#define for_each_child_of_node(parent, child) \
194 for (child = of_get_next_child(parent, NULL); child != NULL; \ 199 for (child = of_get_next_child(parent, NULL); child != NULL; \
195 child = of_get_next_child(parent, child)) 200 child = of_get_next_child(parent, child))
196 201
202#define for_each_available_child_of_node(parent, child) \
203 for (child = of_get_next_available_child(parent, NULL); child != NULL; \
204 child = of_get_next_available_child(parent, child))
205
197static inline int of_get_child_count(const struct device_node *np) 206static inline int of_get_child_count(const struct device_node *np)
198{ 207{
199 struct device_node *child; 208 struct device_node *child;
@@ -308,6 +317,12 @@ static inline const char* of_node_full_name(struct device_node *np)
308 return "<no-node>"; 317 return "<no-node>";
309} 318}
310 319
320static inline struct device_node *of_find_node_by_name(struct device_node *from,
321 const char *name)
322{
323 return NULL;
324}
325
311static inline bool of_have_populated_dt(void) 326static inline bool of_have_populated_dt(void)
312{ 327{
313 return false; 328 return false;
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 01b925ad8d78..c3cdc1025c30 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -6,6 +6,7 @@
6 6
7#ifdef CONFIG_OF_ADDRESS 7#ifdef CONFIG_OF_ADDRESS
8extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 8extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
9extern bool of_can_translate_address(struct device_node *dev);
9extern int of_address_to_resource(struct device_node *dev, int index, 10extern int of_address_to_resource(struct device_node *dev, int index,
10 struct resource *r); 11 struct resource *r);
11extern struct device_node *of_find_matching_node_by_address( 12extern struct device_node *of_find_matching_node_by_address(
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 1717cd935e1c..b8e241125201 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -83,6 +83,11 @@ static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
83{ 83{
84 return 0; 84 return 0;
85} 85}
86
87static inline void *of_irq_find_parent(struct device_node *child)
88{
89 return NULL;
90}
86#endif /* !CONFIG_OF */ 91#endif /* !CONFIG_OF */
87 92
88#endif /* __OF_IRQ_H */ 93#endif /* __OF_IRQ_H */
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 912c27a0f7ee..6ef49b803efb 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -12,6 +12,7 @@
12#include <linux/phy.h> 12#include <linux/phy.h>
13#include <linux/of.h> 13#include <linux/of.h>
14 14
15#ifdef CONFIG_OF
15extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np); 16extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
16extern struct phy_device *of_phy_find_device(struct device_node *phy_np); 17extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
17extern struct phy_device *of_phy_connect(struct net_device *dev, 18extern struct phy_device *of_phy_connect(struct net_device *dev,
@@ -24,4 +25,36 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
24 25
25extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
26 27
28#else /* CONFIG_OF */
29int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
30{
31 return -ENOSYS;
32}
33
34struct phy_device *of_phy_find_device(struct device_node *phy_np)
35{
36 return NULL;
37}
38
39struct phy_device *of_phy_connect(struct net_device *dev,
40 struct device_node *phy_np,
41 void (*hndlr)(struct net_device *),
42 u32 flags, phy_interface_t iface)
43{
44 return NULL;
45}
46
47struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
48 void (*hndlr)(struct net_device *),
49 phy_interface_t iface)
50{
51 return NULL;
52}
53
54struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
55{
56 return NULL;
57}
58#endif /* CONFIG_OF */
59
27#endif /* __LINUX_OF_MDIO_H */ 60#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/omap3isp.h b/include/linux/omap3isp.h
index c73a34c3434d..c090cf9249bb 100644
--- a/include/linux/omap3isp.h
+++ b/include/linux/omap3isp.h
@@ -28,6 +28,7 @@
28#define OMAP3_ISP_USER_H 28#define OMAP3_ISP_USER_H
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/videodev2.h>
31 32
32/* 33/*
33 * Private IOCTLs 34 * Private IOCTLs
@@ -427,7 +428,7 @@ struct omap3isp_ccdc_update_config {
427#define OMAP3ISP_PREV_COLOR_CONV (1 << 8) 428#define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
428#define OMAP3ISP_PREV_YC_LIMIT (1 << 9) 429#define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
429#define OMAP3ISP_PREV_DEFECT_COR (1 << 10) 430#define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
430#define OMAP3ISP_PREV_GAMMABYPASS (1 << 11) 431/* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */
431#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12) 432#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
432#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13) 433#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
433#define OMAP3ISP_PREV_LENS_SHADING (1 << 14) 434#define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
@@ -436,6 +437,7 @@ struct omap3isp_ccdc_update_config {
436 437
437#define OMAP3ISP_PREV_NF_TBL_SIZE 64 438#define OMAP3ISP_PREV_NF_TBL_SIZE 64
438#define OMAP3ISP_PREV_CFA_TBL_SIZE 576 439#define OMAP3ISP_PREV_CFA_TBL_SIZE 576
440#define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
439#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024 441#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
440#define OMAP3ISP_PREV_YENH_TBL_SIZE 128 442#define OMAP3ISP_PREV_YENH_TBL_SIZE 128
441 443
@@ -477,7 +479,7 @@ struct omap3isp_prev_cfa {
477 enum omap3isp_cfa_fmt format; 479 enum omap3isp_cfa_fmt format;
478 __u8 gradthrs_vert; 480 __u8 gradthrs_vert;
479 __u8 gradthrs_horz; 481 __u8 gradthrs_horz;
480 __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE]; 482 __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE];
481}; 483};
482 484
483/** 485/**
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index 4ff57e81051d..85af8184691a 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -220,7 +220,12 @@ struct omapfb_display_info {
220 220
221#ifdef __KERNEL__ 221#ifdef __KERNEL__
222 222
223#include <plat/board.h> 223struct omap_lcd_config {
224 char panel_name[16];
225 char ctrl_name[16];
226 s16 nreset_gpio;
227 u8 data_lines;
228};
224 229
225struct omapfb_platform_data { 230struct omapfb_platform_data {
226 struct omap_lcd_config lcd; 231 struct omap_lcd_config lcd;
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 49a3031fda50..d36a8221f58b 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -2,17 +2,6 @@
2#define __INCLUDE_LINUX_OOM_H 2#define __INCLUDE_LINUX_OOM_H
3 3
4/* 4/*
5 * /proc/<pid>/oom_adj is deprecated, see
6 * Documentation/feature-removal-schedule.txt.
7 *
8 * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
9 */
10#define OOM_DISABLE (-17)
11/* inclusive */
12#define OOM_ADJUST_MIN (-16)
13#define OOM_ADJUST_MAX 15
14
15/*
16 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for 5 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
17 * pid. 6 * pid.
18 */ 7 */
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 2a4e5faee904..214e0ebcb84d 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -48,6 +48,14 @@ int opp_disable(struct device *dev, unsigned long freq);
48 48
49struct srcu_notifier_head *opp_get_notifier(struct device *dev); 49struct srcu_notifier_head *opp_get_notifier(struct device *dev);
50 50
51#ifdef CONFIG_OF
52int of_init_opp_table(struct device *dev);
53#else
54static inline int of_init_opp_table(struct device *dev)
55{
56 return -EINVAL;
57}
58#endif /* CONFIG_OF */
51#else 59#else
52static inline unsigned long opp_get_voltage(struct opp *opp) 60static inline unsigned long opp_get_voltage(struct opp *opp)
53{ 61{
diff --git a/include/linux/packet_diag.h b/include/linux/packet_diag.h
new file mode 100644
index 000000000000..93f5fa94a431
--- /dev/null
+++ b/include/linux/packet_diag.h
@@ -0,0 +1,72 @@
1#ifndef __PACKET_DIAG_H__
2#define __PACKET_DIAG_H__
3
4#include <linux/types.h>
5
6struct packet_diag_req {
7 __u8 sdiag_family;
8 __u8 sdiag_protocol;
9 __u16 pad;
10 __u32 pdiag_ino;
11 __u32 pdiag_show;
12 __u32 pdiag_cookie[2];
13};
14
15#define PACKET_SHOW_INFO 0x00000001 /* Basic packet_sk information */
16#define PACKET_SHOW_MCLIST 0x00000002 /* A set of packet_diag_mclist-s */
17#define PACKET_SHOW_RING_CFG 0x00000004 /* Rings configuration parameters */
18#define PACKET_SHOW_FANOUT 0x00000008
19
20struct packet_diag_msg {
21 __u8 pdiag_family;
22 __u8 pdiag_type;
23 __u16 pdiag_num;
24
25 __u32 pdiag_ino;
26 __u32 pdiag_cookie[2];
27};
28
29enum {
30 PACKET_DIAG_INFO,
31 PACKET_DIAG_MCLIST,
32 PACKET_DIAG_RX_RING,
33 PACKET_DIAG_TX_RING,
34 PACKET_DIAG_FANOUT,
35
36 PACKET_DIAG_MAX,
37};
38
39struct packet_diag_info {
40 __u32 pdi_index;
41 __u32 pdi_version;
42 __u32 pdi_reserve;
43 __u32 pdi_copy_thresh;
44 __u32 pdi_tstamp;
45 __u32 pdi_flags;
46
47#define PDI_RUNNING 0x1
48#define PDI_AUXDATA 0x2
49#define PDI_ORIGDEV 0x4
50#define PDI_VNETHDR 0x8
51#define PDI_LOSS 0x10
52};
53
54struct packet_diag_mclist {
55 __u32 pdmc_index;
56 __u32 pdmc_count;
57 __u16 pdmc_type;
58 __u16 pdmc_alen;
59 __u8 pdmc_addr[MAX_ADDR_LEN];
60};
61
62struct packet_diag_ring {
63 __u32 pdr_block_size;
64 __u32 pdr_block_nr;
65 __u32 pdr_frame_size;
66 __u32 pdr_frame_nr;
67 __u32 pdr_retire_tmo;
68 __u32 pdr_sizeof_priv;
69 __u32 pdr_features;
70};
71
72#endif
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 105077aa7685..76a9539cfd3f 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -6,6 +6,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count);
6void set_pageblock_migratetype(struct page *page, int migratetype); 6void set_pageblock_migratetype(struct page *page, int migratetype);
7int move_freepages_block(struct zone *zone, struct page *page, 7int move_freepages_block(struct zone *zone, struct page *page,
8 int migratetype); 8 int migratetype);
9int move_freepages(struct zone *zone,
10 struct page *start_page, struct page *end_page,
11 int migratetype);
12
9/* 13/*
10 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. 14 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
11 * If specified range includes migrate types other than MOVABLE or CMA, 15 * If specified range includes migrate types other than MOVABLE or CMA,
@@ -37,6 +41,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
37 */ 41 */
38int set_migratetype_isolate(struct page *page); 42int set_migratetype_isolate(struct page *page);
39void unset_migratetype_isolate(struct page *page, unsigned migratetype); 43void unset_migratetype_isolate(struct page *page, unsigned migratetype);
40 44struct page *alloc_migrate_target(struct page *page, unsigned long private,
45 int **resultp);
41 46
42#endif 47#endif
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index 19ef95d293ae..eed27f4f4c3e 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -30,6 +30,9 @@ enum pageblock_bits {
30 PB_migrate, 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1, 31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */ 32 /* 3 bits required for migrate types */
33#ifdef CONFIG_COMPACTION
34 PB_migrate_skip,/* If set the block is skipped by compaction */
35#endif /* CONFIG_COMPACTION */
33 NR_PAGEBLOCK_BITS 36 NR_PAGEBLOCK_BITS
34}; 37};
35 38
@@ -65,10 +68,22 @@ unsigned long get_pageblock_flags_group(struct page *page,
65void set_pageblock_flags_group(struct page *page, unsigned long flags, 68void set_pageblock_flags_group(struct page *page, unsigned long flags,
66 int start_bitidx, int end_bitidx); 69 int start_bitidx, int end_bitidx);
67 70
71#ifdef CONFIG_COMPACTION
72#define get_pageblock_skip(page) \
73 get_pageblock_flags_group(page, PB_migrate_skip, \
74 PB_migrate_skip + 1)
75#define clear_pageblock_skip(page) \
76 set_pageblock_flags_group(page, 0, PB_migrate_skip, \
77 PB_migrate_skip + 1)
78#define set_pageblock_skip(page) \
79 set_pageblock_flags_group(page, 1, PB_migrate_skip, \
80 PB_migrate_skip + 1)
81#endif /* CONFIG_COMPACTION */
82
68#define get_pageblock_flags(page) \ 83#define get_pageblock_flags(page) \
69 get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) 84 get_pageblock_flags_group(page, 0, PB_migrate_end)
70#define set_pageblock_flags(page, flags) \ 85#define set_pageblock_flags(page, flags) \
71 set_pageblock_flags_group(page, flags, \ 86 set_pageblock_flags_group(page, flags, \
72 0, NR_PAGEBLOCK_BITS-1) 87 0, PB_migrate_end)
73 88
74#endif /* PAGEBLOCK_FLAGS_H */ 89#endif /* PAGEBLOCK_FLAGS_H */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 248fba2af98a..9a22b5efb384 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -22,19 +22,24 @@ extern phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle);
22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 22static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
23{ 23{
24 struct pci_bus *pbus = pdev->bus; 24 struct pci_bus *pbus = pdev->bus;
25
25 /* Find a PCI root bus */ 26 /* Find a PCI root bus */
26 while (!pci_is_root_bus(pbus)) 27 while (!pci_is_root_bus(pbus))
27 pbus = pbus->parent; 28 pbus = pbus->parent;
28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), 29
29 pbus->number); 30 return DEVICE_ACPI_HANDLE(pbus->bridge);
30} 31}
31 32
32static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 33static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
33{ 34{
34 if (!pci_is_root_bus(pbus)) 35 struct device *dev;
35 return DEVICE_ACPI_HANDLE(&(pbus->self->dev)); 36
36 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), 37 if (pci_is_root_bus(pbus))
37 pbus->number); 38 dev = pbus->bridge;
39 else
40 dev = &pbus->self->dev;
41
42 return DEVICE_ACPI_HANDLE(dev);
38} 43}
39#endif 44#endif
40 45
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5faa8310eec9..be1de01de1c4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -254,10 +254,10 @@ struct pci_dev {
254 u8 revision; /* PCI revision, low byte of class word */ 254 u8 revision; /* PCI revision, low byte of class word */
255 u8 hdr_type; /* PCI header type (`multi' flag masked out) */ 255 u8 hdr_type; /* PCI header type (`multi' flag masked out) */
256 u8 pcie_cap; /* PCI-E capability offset */ 256 u8 pcie_cap; /* PCI-E capability offset */
257 u8 pcie_type:4; /* PCI-E device/port type */
258 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ 257 u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */
259 u8 rom_base_reg; /* which config register controls the ROM */ 258 u8 rom_base_reg; /* which config register controls the ROM */
260 u8 pin; /* which interrupt pin this device uses */ 259 u8 pin; /* which interrupt pin this device uses */
260 u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */
261 261
262 struct pci_driver *driver; /* which driver has allocated this device */ 262 struct pci_driver *driver; /* which driver has allocated this device */
263 u64 dma_mask; /* Mask of the bits of bus address this 263 u64 dma_mask; /* Mask of the bits of bus address this
@@ -369,7 +369,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
369 369
370extern struct pci_dev *alloc_pci_dev(void); 370extern struct pci_dev *alloc_pci_dev(void);
371 371
372#define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list)
373#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 372#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
374#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 373#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
375 374
@@ -596,7 +595,7 @@ struct pci_driver {
596 int (*resume_early) (struct pci_dev *dev); 595 int (*resume_early) (struct pci_dev *dev);
597 int (*resume) (struct pci_dev *dev); /* Device woken up */ 596 int (*resume) (struct pci_dev *dev); /* Device woken up */
598 void (*shutdown) (struct pci_dev *dev); 597 void (*shutdown) (struct pci_dev *dev);
599 struct pci_error_handlers *err_handler; 598 const struct pci_error_handlers *err_handler;
600 struct device_driver driver; 599 struct device_driver driver;
601 struct pci_dynids dynids; 600 struct pci_dynids dynids;
602}; 601};
@@ -734,9 +733,7 @@ u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
734extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 733extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
735extern void pci_dev_put(struct pci_dev *dev); 734extern void pci_dev_put(struct pci_dev *dev);
736extern void pci_remove_bus(struct pci_bus *b); 735extern void pci_remove_bus(struct pci_bus *b);
737extern void __pci_remove_bus_device(struct pci_dev *dev);
738extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); 736extern void pci_stop_and_remove_bus_device(struct pci_dev *dev);
739extern void pci_stop_bus_device(struct pci_dev *dev);
740void pci_setup_cardbus(struct pci_bus *bus); 737void pci_setup_cardbus(struct pci_bus *bus);
741extern void pci_sort_breadthfirst(void); 738extern void pci_sort_breadthfirst(void);
742#define dev_is_pci(d) ((d)->bus == &pci_bus_type) 739#define dev_is_pci(d) ((d)->bus == &pci_bus_type)
@@ -755,6 +752,7 @@ enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev);
755int pci_find_capability(struct pci_dev *dev, int cap); 752int pci_find_capability(struct pci_dev *dev, int cap);
756int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 753int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
757int pci_find_ext_capability(struct pci_dev *dev, int cap); 754int pci_find_ext_capability(struct pci_dev *dev, int cap);
755int pci_find_next_ext_capability(struct pci_dev *dev, int pos, int cap);
758int pci_find_ht_capability(struct pci_dev *dev, int ht_cap); 756int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
759int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap); 757int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
760struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 758struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
@@ -816,6 +814,39 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where,
816 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); 814 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
817} 815}
818 816
817int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val);
818int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val);
819int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val);
820int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val);
821int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
822 u16 clear, u16 set);
823int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
824 u32 clear, u32 set);
825
826static inline int pcie_capability_set_word(struct pci_dev *dev, int pos,
827 u16 set)
828{
829 return pcie_capability_clear_and_set_word(dev, pos, 0, set);
830}
831
832static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos,
833 u32 set)
834{
835 return pcie_capability_clear_and_set_dword(dev, pos, 0, set);
836}
837
838static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos,
839 u16 clear)
840{
841 return pcie_capability_clear_and_set_word(dev, pos, clear, 0);
842}
843
844static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
845 u32 clear)
846{
847 return pcie_capability_clear_and_set_dword(dev, pos, clear, 0);
848}
849
819/* user-space driven config access */ 850/* user-space driven config access */
820int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); 851int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val);
821int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); 852int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val);
@@ -1013,7 +1044,6 @@ void pci_unregister_driver(struct pci_driver *dev);
1013 module_driver(__pci_driver, pci_register_driver, \ 1044 module_driver(__pci_driver, pci_register_driver, \
1014 pci_unregister_driver) 1045 pci_unregister_driver)
1015 1046
1016void pci_stop_and_remove_behind_bridge(struct pci_dev *dev);
1017struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 1047struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
1018int pci_add_dynid(struct pci_driver *drv, 1048int pci_add_dynid(struct pci_driver *drv,
1019 unsigned int vendor, unsigned int device, 1049 unsigned int vendor, unsigned int device,
@@ -1031,6 +1061,8 @@ int pci_cfg_space_size_ext(struct pci_dev *dev);
1031int pci_cfg_space_size(struct pci_dev *dev); 1061int pci_cfg_space_size(struct pci_dev *dev);
1032unsigned char pci_bus_max_busnr(struct pci_bus *bus); 1062unsigned char pci_bus_max_busnr(struct pci_bus *bus);
1033void pci_setup_bridge(struct pci_bus *bus); 1063void pci_setup_bridge(struct pci_bus *bus);
1064resource_size_t pcibios_window_alignment(struct pci_bus *bus,
1065 unsigned long type);
1034 1066
1035#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0) 1067#define PCI_VGA_STATE_CHANGE_BRIDGE (1 << 0)
1036#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1) 1068#define PCI_VGA_STATE_CHANGE_DECODES (1 << 1)
@@ -1472,7 +1504,7 @@ enum pci_fixup_pass {
1472/* Anonymous variables would be nice... */ 1504/* Anonymous variables would be nice... */
1473#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \ 1505#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, class, \
1474 class_shift, hook) \ 1506 class_shift, hook) \
1475 static const struct pci_fixup const __pci_fixup_##name __used \ 1507 static const struct pci_fixup __pci_fixup_##name __used \
1476 __attribute__((__section__(#section), aligned((sizeof(void *))))) \ 1508 __attribute__((__section__(#section), aligned((sizeof(void *))))) \
1477 = { vendor, device, class, class_shift, hook }; 1509 = { vendor, device, class, class_shift, hook };
1478 1510
@@ -1650,6 +1682,15 @@ static inline bool pci_is_pcie(struct pci_dev *dev)
1650 return !!pci_pcie_cap(dev); 1682 return !!pci_pcie_cap(dev);
1651} 1683}
1652 1684
1685/**
1686 * pci_pcie_type - get the PCIe device/port type
1687 * @dev: PCI device
1688 */
1689static inline int pci_pcie_type(const struct pci_dev *dev)
1690{
1691 return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4;
1692}
1693
1653void pci_request_acs(void); 1694void pci_request_acs(void);
1654bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); 1695bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags);
1655bool pci_acs_path_enabled(struct pci_dev *start, 1696bool pci_acs_path_enabled(struct pci_dev *start,
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index fc3526077348..9d36b829533a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -753,6 +753,7 @@
753#define PCI_DEVICE_ID_HP_CISSD 0x3238 753#define PCI_DEVICE_ID_HP_CISSD 0x3238
754#define PCI_DEVICE_ID_HP_CISSE 0x323a 754#define PCI_DEVICE_ID_HP_CISSE 0x323a
755#define PCI_DEVICE_ID_HP_CISSF 0x323b 755#define PCI_DEVICE_ID_HP_CISSF 0x323b
756#define PCI_DEVICE_ID_HP_CISSH 0x323c
756#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 757#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031
757 758
758#define PCI_VENDOR_ID_PCTECH 0x1042 759#define PCI_VENDOR_ID_PCTECH 0x1042
@@ -1426,6 +1427,7 @@
1426#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581 1427#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581
1427#define PCI_DEVICE_ID_VIA_VX800 0x8353 1428#define PCI_DEVICE_ID_VIA_VX800 0x8353
1428#define PCI_DEVICE_ID_VIA_VX855 0x8409 1429#define PCI_DEVICE_ID_VIA_VX855 0x8409
1430#define PCI_DEVICE_ID_VIA_VX900 0x8410
1429#define PCI_DEVICE_ID_VIA_8371_1 0x8391 1431#define PCI_DEVICE_ID_VIA_8371_1 0x8391
1430#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 1432#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
1431#define PCI_DEVICE_ID_VIA_838X_1 0xB188 1433#define PCI_DEVICE_ID_VIA_838X_1 0xB188
@@ -1847,7 +1849,6 @@
1847#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081 1849#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081
1848#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082 1850#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082
1849#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 1851#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050
1850#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530
1851 1852
1852#define PCI_VENDOR_ID_RADISYS 0x1331 1853#define PCI_VENDOR_ID_RADISYS 0x1331
1853 1854
@@ -2149,7 +2150,7 @@
2149#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 2150#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
2150#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9 2151#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9
2151#define PCI_DEVICE_ID_NX2_5706S 0x16aa 2152#define PCI_DEVICE_ID_NX2_5706S 0x16aa
2152#define PCI_DEVICE_ID_NX2_57840_MF 0x16ab 2153#define PCI_DEVICE_ID_NX2_57840_MF 0x16a4
2153#define PCI_DEVICE_ID_NX2_5708S 0x16ac 2154#define PCI_DEVICE_ID_NX2_5708S 0x16ac
2154#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad 2155#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad
2155#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae 2156#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 7fb75b143755..20ae747ddf34 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -549,6 +549,7 @@
549#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */ 549#define PCI_EXP_LNKCAP2_SLS_8_0GB 0x04 /* Current Link Speed 8.0GT/s */
550#define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */ 550#define PCI_EXP_LNKCAP2_CROSSLINK 0x100 /* Crosslink supported */
551#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */ 551#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
552#define PCI_EXP_LNKSTA2 50 /* Link Status 2 */
552#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ 553#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
553 554
554/* Extended Capabilities (PCI-X 2.0 and Express) */ 555/* Extended Capabilities (PCI-X 2.0 and Express) */
@@ -677,6 +678,12 @@
677#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */ 678#define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
678#define PCI_EXT_CAP_PWR_SIZEOF 16 679#define PCI_EXT_CAP_PWR_SIZEOF 16
679 680
681/* Vendor-Specific (VSEC, PCI_EXT_CAP_ID_VNDR) */
682#define PCI_VNDR_HEADER 4 /* Vendor-Specific Header */
683#define PCI_VNDR_HEADER_ID(x) ((x) & 0xffff)
684#define PCI_VNDR_HEADER_REV(x) (((x) >> 16) & 0xf)
685#define PCI_VNDR_HEADER_LEN(x) (((x) >> 20) & 0xfff)
686
680/* 687/*
681 * Hypertransport sub capability types 688 * Hypertransport sub capability types
682 * 689 *
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 6775532b92a9..e6f91b1406d8 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -49,7 +49,7 @@ struct pcie_port_service_driver {
49 int (*resume) (struct pcie_device *dev); 49 int (*resume) (struct pcie_device *dev);
50 50
51 /* Service Error Recovery Handler */ 51 /* Service Error Recovery Handler */
52 struct pci_error_handlers *err_handler; 52 const struct pci_error_handlers *err_handler;
53 53
54 /* Link Reset Capability - AER service driver specific */ 54 /* Link Reset Capability - AER service driver specific */
55 pci_ers_result_t (*reset_link) (struct pci_dev *dev); 55 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 2b9f82c037c9..cc88172c7d9a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -107,7 +107,7 @@ enum pcpu_fc {
107 107
108 PCPU_FC_NR, 108 PCPU_FC_NR,
109}; 109};
110extern const char *pcpu_fc_names[PCPU_FC_NR]; 110extern const char * const pcpu_fc_names[PCPU_FC_NR];
111 111
112extern enum pcpu_fc pcpu_chosen_fc; 112extern enum pcpu_fc pcpu_chosen_fc;
113 113
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 7602ccb3f40e..599afc4bb67e 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -130,8 +130,10 @@ enum perf_event_sample_format {
130 PERF_SAMPLE_STREAM_ID = 1U << 9, 130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10, 131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11, 132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13,
133 135
134 PERF_SAMPLE_MAX = 1U << 12, /* non-ABI */ 136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */
135}; 137};
136 138
137/* 139/*
@@ -163,6 +165,15 @@ enum perf_branch_sample_type {
163 PERF_SAMPLE_BRANCH_HV) 165 PERF_SAMPLE_BRANCH_HV)
164 166
165/* 167/*
168 * Values to determine ABI of the registers dump.
169 */
170enum perf_sample_regs_abi {
171 PERF_SAMPLE_REGS_ABI_NONE = 0,
172 PERF_SAMPLE_REGS_ABI_32 = 1,
173 PERF_SAMPLE_REGS_ABI_64 = 2,
174};
175
176/*
166 * The format of the data returned by read() on a perf event fd, 177 * The format of the data returned by read() on a perf event fd,
167 * as specified by attr.read_format: 178 * as specified by attr.read_format:
168 * 179 *
@@ -194,6 +205,8 @@ enum perf_event_read_format {
194#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ 205#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
195#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */ 206#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
196#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */ 207#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
208#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
209 /* add: sample_stack_user */
197 210
198/* 211/*
199 * Hardware event_id to monitor via a performance monitoring event: 212 * Hardware event_id to monitor via a performance monitoring event:
@@ -255,7 +268,10 @@ struct perf_event_attr {
255 exclude_host : 1, /* don't count in host */ 268 exclude_host : 1, /* don't count in host */
256 exclude_guest : 1, /* don't count in guest */ 269 exclude_guest : 1, /* don't count in guest */
257 270
258 __reserved_1 : 43; 271 exclude_callchain_kernel : 1, /* exclude kernel callchains */
272 exclude_callchain_user : 1, /* exclude user callchains */
273
274 __reserved_1 : 41;
259 275
260 union { 276 union {
261 __u32 wakeup_events; /* wakeup every n events */ 277 __u32 wakeup_events; /* wakeup every n events */
@@ -271,9 +287,25 @@ struct perf_event_attr {
271 __u64 bp_len; 287 __u64 bp_len;
272 __u64 config2; /* extension of config1 */ 288 __u64 config2; /* extension of config1 */
273 }; 289 };
274 __u64 branch_sample_type; /* enum branch_sample_type */ 290 __u64 branch_sample_type; /* enum perf_branch_sample_type */
291
292 /*
293 * Defines set of user regs to dump on samples.
294 * See asm/perf_regs.h for details.
295 */
296 __u64 sample_regs_user;
297
298 /*
299 * Defines size of the user stack to dump on samples.
300 */
301 __u32 sample_stack_user;
302
303 /* Align to u64. */
304 __u32 __reserved_2;
275}; 305};
276 306
307#define perf_flags(attr) (*(&(attr)->read_format + 1))
308
277/* 309/*
278 * Ioctls that can be done on a perf event fd: 310 * Ioctls that can be done on a perf event fd:
279 */ 311 */
@@ -548,6 +580,13 @@ enum perf_event_type {
548 * char data[size];}&& PERF_SAMPLE_RAW 580 * char data[size];}&& PERF_SAMPLE_RAW
549 * 581 *
550 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK 582 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
583 *
584 * { u64 abi; # enum perf_sample_regs_abi
585 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
586 *
587 * { u64 size;
588 * char data[size];
589 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
551 * }; 590 * };
552 */ 591 */
553 PERF_RECORD_SAMPLE = 9, 592 PERF_RECORD_SAMPLE = 9,
@@ -609,6 +648,7 @@ struct perf_guest_info_callbacks {
609#include <linux/static_key.h> 648#include <linux/static_key.h>
610#include <linux/atomic.h> 649#include <linux/atomic.h>
611#include <linux/sysfs.h> 650#include <linux/sysfs.h>
651#include <linux/perf_regs.h>
612#include <asm/local.h> 652#include <asm/local.h>
613 653
614struct perf_callchain_entry { 654struct perf_callchain_entry {
@@ -654,6 +694,11 @@ struct perf_branch_stack {
654 struct perf_branch_entry entries[0]; 694 struct perf_branch_entry entries[0];
655}; 695};
656 696
697struct perf_regs_user {
698 __u64 abi;
699 struct pt_regs *regs;
700};
701
657struct task_struct; 702struct task_struct;
658 703
659/* 704/*
@@ -926,7 +971,7 @@ struct perf_event {
926 struct hw_perf_event hw; 971 struct hw_perf_event hw;
927 972
928 struct perf_event_context *ctx; 973 struct perf_event_context *ctx;
929 struct file *filp; 974 atomic_long_t refcount;
930 975
931 /* 976 /*
932 * These accumulate total time (in nanoseconds) that children 977 * These accumulate total time (in nanoseconds) that children
@@ -1133,6 +1178,8 @@ struct perf_sample_data {
1133 struct perf_callchain_entry *callchain; 1178 struct perf_callchain_entry *callchain;
1134 struct perf_raw_record *raw; 1179 struct perf_raw_record *raw;
1135 struct perf_branch_stack *br_stack; 1180 struct perf_branch_stack *br_stack;
1181 struct perf_regs_user regs_user;
1182 u64 stack_user_size;
1136}; 1183};
1137 1184
1138static inline void perf_sample_data_init(struct perf_sample_data *data, 1185static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -1142,7 +1189,10 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
1142 data->addr = addr; 1189 data->addr = addr;
1143 data->raw = NULL; 1190 data->raw = NULL;
1144 data->br_stack = NULL; 1191 data->br_stack = NULL;
1145 data->period = period; 1192 data->period = period;
1193 data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;
1194 data->regs_user.regs = NULL;
1195 data->stack_user_size = 0;
1146} 1196}
1147 1197
1148extern void perf_output_sample(struct perf_output_handle *handle, 1198extern void perf_output_sample(struct perf_output_handle *handle,
@@ -1290,12 +1340,15 @@ static inline bool has_branch_stack(struct perf_event *event)
1290extern int perf_output_begin(struct perf_output_handle *handle, 1340extern int perf_output_begin(struct perf_output_handle *handle,
1291 struct perf_event *event, unsigned int size); 1341 struct perf_event *event, unsigned int size);
1292extern void perf_output_end(struct perf_output_handle *handle); 1342extern void perf_output_end(struct perf_output_handle *handle);
1293extern void perf_output_copy(struct perf_output_handle *handle, 1343extern unsigned int perf_output_copy(struct perf_output_handle *handle,
1294 const void *buf, unsigned int len); 1344 const void *buf, unsigned int len);
1345extern unsigned int perf_output_skip(struct perf_output_handle *handle,
1346 unsigned int len);
1295extern int perf_swevent_get_recursion_context(void); 1347extern int perf_swevent_get_recursion_context(void);
1296extern void perf_swevent_put_recursion_context(int rctx); 1348extern void perf_swevent_put_recursion_context(int rctx);
1297extern void perf_event_enable(struct perf_event *event); 1349extern void perf_event_enable(struct perf_event *event);
1298extern void perf_event_disable(struct perf_event *event); 1350extern void perf_event_disable(struct perf_event *event);
1351extern int __perf_event_disable(void *info);
1299extern void perf_event_task_tick(void); 1352extern void perf_event_task_tick(void);
1300#else 1353#else
1301static inline void 1354static inline void
@@ -1334,6 +1387,7 @@ static inline int perf_swevent_get_recursion_context(void) { return -1; }
1334static inline void perf_swevent_put_recursion_context(int rctx) { } 1387static inline void perf_swevent_put_recursion_context(int rctx) { }
1335static inline void perf_event_enable(struct perf_event *event) { } 1388static inline void perf_event_enable(struct perf_event *event) { }
1336static inline void perf_event_disable(struct perf_event *event) { } 1389static inline void perf_event_disable(struct perf_event *event) { }
1390static inline int __perf_event_disable(void *info) { return -1; }
1337static inline void perf_event_task_tick(void) { } 1391static inline void perf_event_task_tick(void) { }
1338#endif 1392#endif
1339 1393
diff --git a/include/linux/perf_regs.h b/include/linux/perf_regs.h
new file mode 100644
index 000000000000..3c73d5fe18be
--- /dev/null
+++ b/include/linux/perf_regs.h
@@ -0,0 +1,25 @@
1#ifndef _LINUX_PERF_REGS_H
2#define _LINUX_PERF_REGS_H
3
4#ifdef CONFIG_HAVE_PERF_REGS
5#include <asm/perf_regs.h>
6u64 perf_reg_value(struct pt_regs *regs, int idx);
7int perf_reg_validate(u64 mask);
8u64 perf_reg_abi(struct task_struct *task);
9#else
10static inline u64 perf_reg_value(struct pt_regs *regs, int idx)
11{
12 return 0;
13}
14
15static inline int perf_reg_validate(u64 mask)
16{
17 return mask ? -ENOSYS : 0;
18}
19
20static inline u64 perf_reg_abi(struct task_struct *task)
21{
22 return PERF_SAMPLE_REGS_ABI_NONE;
23}
24#endif /* CONFIG_HAVE_PERF_REGS */
25#endif /* _LINUX_PERF_REGS_H */
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 6dd96fb45482..4aad3cea69ae 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -15,11 +15,12 @@
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include "pinctrl-state.h" 18#include <linux/pinctrl/pinctrl-state.h>
19 19
20/* This struct is private to the core and should be regarded as a cookie */ 20/* This struct is private to the core and should be regarded as a cookie */
21struct pinctrl; 21struct pinctrl;
22struct pinctrl_state; 22struct pinctrl_state;
23struct device;
23 24
24#ifdef CONFIG_PINCTRL 25#ifdef CONFIG_PINCTRL
25 26
@@ -139,7 +140,7 @@ static inline struct pinctrl * __must_check devm_pinctrl_get_select(
139 s = pinctrl_lookup_state(p, name); 140 s = pinctrl_lookup_state(p, name);
140 if (IS_ERR(s)) { 141 if (IS_ERR(s)) {
141 devm_pinctrl_put(p); 142 devm_pinctrl_put(p);
142 return ERR_PTR(PTR_ERR(s)); 143 return ERR_CAST(s);
143 } 144 }
144 145
145 ret = pinctrl_select_state(p, s); 146 ret = pinctrl_select_state(p, s);
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index 7d22ab00343f..e5b1716f98cc 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -14,7 +14,7 @@
14 14
15#include <linux/bug.h> 15#include <linux/bug.h>
16 16
17#include "pinctrl-state.h" 17#include <linux/pinctrl/pinctrl-state.h>
18 18
19enum pinctrl_map_type { 19enum pinctrl_map_type {
20 PIN_MAP_TYPE_INVALID, 20 PIN_MAP_TYPE_INVALID,
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
index 634608dc6c89..b5919f8e6d1a 100644
--- a/include/linux/pinctrl/pinctrl-state.h
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -6,13 +6,18 @@
6 * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put 6 * @PINCTRL_STATE_DEFAULT: the state the pinctrl handle shall be put
7 * into as default, usually this means the pins are up and ready to 7 * into as default, usually this means the pins are up and ready to
8 * be used by the device driver. This state is commonly used by 8 * be used by the device driver. This state is commonly used by
9 * hogs to configure muxing and pins at boot. 9 * hogs to configure muxing and pins at boot, and also as a state
10 * to go into when returning from sleep and idle in
11 * .pm_runtime_resume() or ordinary .resume() for example.
10 * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into 12 * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into
11 * when the pins are idle. Could typically be set from a 13 * when the pins are idle. This is a state where the system is relaxed
12 * pm_runtime_suspend() operation. 14 * but not fully sleeping - some power may be on but clocks gated for
15 * example. Could typically be set from a pm_runtime_suspend() or
16 * pm_runtime_idle() operation.
13 * @PINCTRL_STATE_SLEEP: the state the pinctrl handle shall be put into 17 * @PINCTRL_STATE_SLEEP: the state the pinctrl handle shall be put into
14 * when the pins are sleeping. Could typically be set from a 18 * when the pins are sleeping. This is a state where the system is in
15 * common suspend() function. 19 * its lowest sleep state. Could typically be set from an
20 * ordinary .suspend() function.
16 */ 21 */
17#define PINCTRL_STATE_DEFAULT "default" 22#define PINCTRL_STATE_DEFAULT "default"
18#define PINCTRL_STATE_IDLE "idle" 23#define PINCTRL_STATE_IDLE "idle"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 69393a662532..7d087f03e91e 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -17,7 +17,7 @@
17#include <linux/radix-tree.h> 17#include <linux/radix-tree.h>
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include "pinctrl-state.h" 20#include <linux/pinctrl/pinctrl-state.h>
21 21
22struct device; 22struct device;
23struct pinctrl_dev; 23struct pinctrl_dev;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 1818dcbdd9ab..c15395031cb3 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -14,7 +14,7 @@
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include "pinctrl.h" 17#include <linux/pinctrl/pinctrl.h>
18 18
19#ifdef CONFIG_PINMUX 19#ifdef CONFIG_PINMUX
20 20
diff --git a/include/linux/platform_data/ad5755.h b/include/linux/platform_data/ad5755.h
new file mode 100644
index 000000000000..a5a1cb751874
--- /dev/null
+++ b/include/linux/platform_data/ad5755.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright 2012 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2.
5 */
6#ifndef __LINUX_PLATFORM_DATA_AD5755_H__
7#define __LINUX_PLATFORM_DATA_AD5755_H__
8
9enum ad5755_mode {
10 AD5755_MODE_VOLTAGE_0V_5V = 0,
11 AD5755_MODE_VOLTAGE_0V_10V = 1,
12 AD5755_MODE_VOLTAGE_PLUSMINUS_5V = 2,
13 AD5755_MODE_VOLTAGE_PLUSMINUS_10V = 3,
14 AD5755_MODE_CURRENT_4mA_20mA = 4,
15 AD5755_MODE_CURRENT_0mA_20mA = 5,
16 AD5755_MODE_CURRENT_0mA_24mA = 6,
17};
18
19enum ad5755_dc_dc_phase {
20 AD5755_DC_DC_PHASE_ALL_SAME_EDGE = 0,
21 AD5755_DC_DC_PHASE_A_B_SAME_EDGE_C_D_OPP_EDGE = 1,
22 AD5755_DC_DC_PHASE_A_C_SAME_EDGE_B_D_OPP_EDGE = 2,
23 AD5755_DC_DC_PHASE_90_DEGREE = 3,
24};
25
26enum ad5755_dc_dc_freq {
27 AD5755_DC_DC_FREQ_250kHZ = 0,
28 AD5755_DC_DC_FREQ_410kHZ = 1,
29 AD5755_DC_DC_FREQ_650kHZ = 2,
30};
31
32enum ad5755_dc_dc_maxv {
33 AD5755_DC_DC_MAXV_23V = 0,
34 AD5755_DC_DC_MAXV_24V5 = 1,
35 AD5755_DC_DC_MAXV_27V = 2,
36 AD5755_DC_DC_MAXV_29V5 = 3,
37};
38
39enum ad5755_slew_rate {
40 AD5755_SLEW_RATE_64k = 0,
41 AD5755_SLEW_RATE_32k = 1,
42 AD5755_SLEW_RATE_16k = 2,
43 AD5755_SLEW_RATE_8k = 3,
44 AD5755_SLEW_RATE_4k = 4,
45 AD5755_SLEW_RATE_2k = 5,
46 AD5755_SLEW_RATE_1k = 6,
47 AD5755_SLEW_RATE_500 = 7,
48 AD5755_SLEW_RATE_250 = 8,
49 AD5755_SLEW_RATE_125 = 9,
50 AD5755_SLEW_RATE_64 = 10,
51 AD5755_SLEW_RATE_32 = 11,
52 AD5755_SLEW_RATE_16 = 12,
53 AD5755_SLEW_RATE_8 = 13,
54 AD5755_SLEW_RATE_4 = 14,
55 AD5755_SLEW_RATE_0_5 = 15,
56};
57
58enum ad5755_slew_step_size {
59 AD5755_SLEW_STEP_SIZE_1 = 0,
60 AD5755_SLEW_STEP_SIZE_2 = 1,
61 AD5755_SLEW_STEP_SIZE_4 = 2,
62 AD5755_SLEW_STEP_SIZE_8 = 3,
63 AD5755_SLEW_STEP_SIZE_16 = 4,
64 AD5755_SLEW_STEP_SIZE_32 = 5,
65 AD5755_SLEW_STEP_SIZE_64 = 6,
66 AD5755_SLEW_STEP_SIZE_128 = 7,
67 AD5755_SLEW_STEP_SIZE_256 = 8,
68};
69
70/**
71 * struct ad5755_platform_data - AD5755 DAC driver platform data
72 * @ext_dc_dc_compenstation_resistor: Whether an external DC-DC converter
73 * compensation register is used.
74 * @dc_dc_phase: DC-DC converter phase.
75 * @dc_dc_freq: DC-DC converter frequency.
76 * @dc_dc_maxv: DC-DC maximum allowed boost voltage.
77 * @dac.mode: The mode to be used for the DAC output.
78 * @dac.ext_current_sense_resistor: Whether an external current sense resistor
79 * is used.
80 * @dac.enable_voltage_overrange: Whether to enable 20% voltage output overrange.
81 * @dac.slew.enable: Whether to enable digital slew.
82 * @dac.slew.rate: Slew rate of the digital slew.
83 * @dac.slew.step_size: Slew step size of the digital slew.
84 **/
85struct ad5755_platform_data {
86 bool ext_dc_dc_compenstation_resistor;
87 enum ad5755_dc_dc_phase dc_dc_phase;
88 enum ad5755_dc_dc_freq dc_dc_freq;
89 enum ad5755_dc_dc_maxv dc_dc_maxv;
90
91 struct {
92 enum ad5755_mode mode;
93 bool ext_current_sense_resistor;
94 bool enable_voltage_overrange;
95 struct {
96 bool enable;
97 enum ad5755_slew_rate rate;
98 enum ad5755_slew_step_size step_size;
99 } slew;
100 } dac[4];
101};
102
103#endif
diff --git a/include/linux/platform_data/ad7791.h b/include/linux/platform_data/ad7791.h
new file mode 100644
index 000000000000..f9e4db1b82ae
--- /dev/null
+++ b/include/linux/platform_data/ad7791.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_PLATFORM_DATA_AD7791__
2#define __LINUX_PLATFORM_DATA_AD7791__
3
4/**
5 * struct ad7791_platform_data - AD7791 device platform data
6 * @buffered: If set to true configure the device for buffered input mode.
7 * @burnout_current: If set to true the 100mA burnout current is enabled.
8 * @unipolar: If set to true sample in unipolar mode, if set to false sample in
9 * bipolar mode.
10 */
11struct ad7791_platform_data {
12 bool buffered;
13 bool burnout_current;
14 bool unipolar;
15};
16
17#endif
diff --git a/include/linux/platform_data/asoc-imx-ssi.h b/include/linux/platform_data/asoc-imx-ssi.h
new file mode 100644
index 000000000000..63f3c2804239
--- /dev/null
+++ b/include/linux/platform_data/asoc-imx-ssi.h
@@ -0,0 +1,21 @@
1#ifndef __MACH_SSI_H
2#define __MACH_SSI_H
3
4struct snd_ac97;
5
6extern unsigned char imx_ssi_fiq_start, imx_ssi_fiq_end;
7extern unsigned long imx_ssi_fiq_base, imx_ssi_fiq_tx_buffer, imx_ssi_fiq_rx_buffer;
8
9struct imx_ssi_platform_data {
10 unsigned int flags;
11#define IMX_SSI_DMA (1 << 0)
12#define IMX_SSI_USE_AC97 (1 << 1)
13#define IMX_SSI_NET (1 << 2)
14#define IMX_SSI_SYN (1 << 3)
15#define IMX_SSI_USE_I2S_SLAVE (1 << 4)
16 void (*ac97_reset) (struct snd_ac97 *ac97);
17 void (*ac97_warm_reset)(struct snd_ac97 *ac97);
18};
19
20#endif /* __MACH_SSI_H */
21
diff --git a/include/linux/platform_data/asoc-kirkwood.h b/include/linux/platform_data/asoc-kirkwood.h
new file mode 100644
index 000000000000..d6a55bd2e578
--- /dev/null
+++ b/include/linux/platform_data/asoc-kirkwood.h
@@ -0,0 +1,7 @@
1#ifndef __PLAT_AUDIO_H
2#define __PLAT_AUDIO_H
3
4struct kirkwood_asoc_platform_data {
5 int burst;
6};
7#endif
diff --git a/include/linux/platform_data/asoc-mx27vis.h b/include/linux/platform_data/asoc-mx27vis.h
new file mode 100644
index 000000000000..409adcd04d04
--- /dev/null
+++ b/include/linux/platform_data/asoc-mx27vis.h
@@ -0,0 +1,11 @@
1#ifndef __PLATFORM_DATA_ASOC_MX27VIS_H
2#define __PLATFORM_DATA_ASOC_MX27VIS_H
3
4struct snd_mx27vis_platform_data {
5 int amp_gain0_gpio;
6 int amp_gain1_gpio;
7 int amp_mutel_gpio;
8 int amp_muter_gpio;
9};
10
11#endif /* __PLATFORM_DATA_ASOC_MX27VIS_H */
diff --git a/include/linux/platform_data/asoc-palm27x.h b/include/linux/platform_data/asoc-palm27x.h
new file mode 100644
index 000000000000..58afb30d5298
--- /dev/null
+++ b/include/linux/platform_data/asoc-palm27x.h
@@ -0,0 +1,8 @@
1#ifndef _INCLUDE_PALMASOC_H_
2#define _INCLUDE_PALMASOC_H_
3
4struct palm27x_asoc_info {
5 int jack_gpio;
6};
7
8#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
new file mode 100644
index 000000000000..aa9875f77c40
--- /dev/null
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -0,0 +1,59 @@
1/* arch/arm/plat-samsung/include/plat/audio.h
2 *
3 * Copyright (c) 2009 Samsung Electronics Co. Ltd
4 * Author: Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11/* The machine init code calls s3c*_ac97_setup_gpio with
12 * one of these defines in order to select appropriate bank
13 * of GPIO for AC97 pins
14 */
15#define S3C64XX_AC97_GPD 0
16#define S3C64XX_AC97_GPE 1
17extern void s3c64xx_ac97_setup_gpio(int);
18
19/*
20 * The machine init code calls s5p*_spdif_setup_gpio with
21 * one of these defines in order to select appropriate bank
22 * of GPIO for S/PDIF pins
23 */
24#define S5PC100_SPDIF_GPD 0
25#define S5PC100_SPDIF_GPG3 1
26extern void s5pc100_spdif_setup_gpio(int);
27
28struct samsung_i2s {
29/* If the Primary DAI has 5.1 Channels */
30#define QUIRK_PRI_6CHAN (1 << 0)
31/* If the I2S block has a Stereo Overlay Channel */
32#define QUIRK_SEC_DAI (1 << 1)
33/*
34 * If the I2S block has no internal prescalar or MUX (I2SMOD[10] bit)
35 * The Machine driver must provide suitably set clock to the I2S block.
36 */
37#define QUIRK_NO_MUXPSR (1 << 2)
38#define QUIRK_NEED_RSTCLR (1 << 3)
39 /* Quirks of the I2S controller */
40 u32 quirks;
41
42 /*
43 * Array of clock names that can be used to generate I2S signals.
44 * Also corresponds to clocks of I2SMOD[10]
45 */
46 const char **src_clk;
47 dma_addr_t idma_addr;
48};
49
50/**
51 * struct s3c_audio_pdata - common platform data for audio device drivers
52 * @cfg_gpio: Callback function to setup mux'ed pins in I2S/PCM/AC97 mode
53 */
54struct s3c_audio_pdata {
55 int (*cfg_gpio)(struct platform_device *);
56 union {
57 struct samsung_i2s i2s;
58 } type;
59};
diff --git a/include/linux/platform_data/asoc-s3c24xx_simtec.h b/include/linux/platform_data/asoc-s3c24xx_simtec.h
new file mode 100644
index 000000000000..376af5286a3e
--- /dev/null
+++ b/include/linux/platform_data/asoc-s3c24xx_simtec.h
@@ -0,0 +1,34 @@
1/* arch/arm/plat-samsung/include/plat/audio-simtec.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
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 * Simtec Audio support.
12*/
13
14/**
15 * struct s3c24xx_audio_simtec_pdata - platform data for simtec audio
16 * @use_mpllin: Select codec clock from MPLLin
17 * @output_cdclk: Need to output CDCLK to the codec
18 * @have_mic: Set if we have a MIC socket
19 * @have_lout: Set if we have a LineOut socket
20 * @amp_gpio: GPIO pin to enable the AMP
21 * @amp_gain: Option GPIO to control AMP gain
22 */
23struct s3c24xx_audio_simtec_pdata {
24 unsigned int use_mpllin:1;
25 unsigned int output_cdclk:1;
26
27 unsigned int have_mic:1;
28 unsigned int have_lout:1;
29
30 int amp_gpio;
31 int amp_gain[2];
32
33 void (*startup)(void);
34};
diff --git a/include/linux/platform_data/asoc-ti-mcbsp.h b/include/linux/platform_data/asoc-ti-mcbsp.h
new file mode 100644
index 000000000000..c78d90b28b19
--- /dev/null
+++ b/include/linux/platform_data/asoc-ti-mcbsp.h
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/plat-omap/include/mach/mcbsp.h
3 *
4 * Defines for Multi-Channel Buffered Serial Port
5 *
6 * Copyright (C) 2002 RidgeRun, Inc.
7 * Author: Steve Johnson
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24#ifndef __ASM_ARCH_OMAP_MCBSP_H
25#define __ASM_ARCH_OMAP_MCBSP_H
26
27#include <linux/spinlock.h>
28#include <linux/clk.h>
29
30#define MCBSP_CONFIG_TYPE2 0x2
31#define MCBSP_CONFIG_TYPE3 0x3
32#define MCBSP_CONFIG_TYPE4 0x4
33
34/* Platform specific configuration */
35struct omap_mcbsp_ops {
36 void (*request)(unsigned int);
37 void (*free)(unsigned int);
38};
39
40struct omap_mcbsp_platform_data {
41 struct omap_mcbsp_ops *ops;
42 u16 buffer_size;
43 u8 reg_size;
44 u8 reg_step;
45
46 /* McBSP platform and instance specific features */
47 bool has_wakeup; /* Wakeup capability */
48 bool has_ccr; /* Transceiver has configuration control registers */
49 int (*enable_st_clock)(unsigned int, bool);
50};
51
52/**
53 * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod
54 * @sidetone: name of the sidetone device
55 */
56struct omap_mcbsp_dev_attr {
57 const char *sidetone;
58};
59
60#endif
diff --git a/include/linux/platform_data/ata-pxa.h b/include/linux/platform_data/ata-pxa.h
new file mode 100644
index 000000000000..6cf7df1d5830
--- /dev/null
+++ b/include/linux/platform_data/ata-pxa.h
@@ -0,0 +1,33 @@
1/*
2 * Generic PXA PATA driver
3 *
4 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * 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; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __MACH_PATA_PXA_H__
22#define __MACH_PATA_PXA_H__
23
24struct pata_pxa_pdata {
25 /* PXA DMA DREQ<0:2> pin */
26 uint32_t dma_dreq;
27 /* Register shift */
28 uint32_t reg_shift;
29 /* IRQ flags */
30 uint32_t irq_flags;
31};
32
33#endif /* __MACH_PATA_PXA_H__ */
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
new file mode 100644
index 000000000000..2a3855a8372a
--- /dev/null
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -0,0 +1,36 @@
1/* linux/arch/arm/plat-samsung/include/plat/ata.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung CF-ATA platform_device info
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 __ASM_PLAT_ATA_H
14#define __ASM_PLAT_ATA_H __FILE__
15
16/**
17 * struct s3c_ide_platdata - S3C IDE driver platform data.
18 * @setup_gpio: Setup the external GPIO pins to the right state for data
19 * transfer in true-ide mode.
20 */
21struct s3c_ide_platdata {
22 void (*setup_gpio)(void);
23};
24
25/*
26 * s3c_ide_set_platdata() - Setup the platform specifc data for IDE driver.
27 * @pdata: Platform data for IDE driver.
28 */
29extern void s3c_ide_set_platdata(struct s3c_ide_platdata *pdata);
30
31/* architecture-specific IDE configuration */
32extern void s3c64xx_ide_setup_gpio(void);
33extern void s5pc100_ide_setup_gpio(void);
34extern void s5pv210_ide_setup_gpio(void);
35
36#endif /*__ASM_PLAT_ATA_H */
diff --git a/include/linux/platform_data/atmel-aes.h b/include/linux/platform_data/atmel-aes.h
index e7a1949bad26..ab68082fbcb0 100644
--- a/include/linux/platform_data/atmel-aes.h
+++ b/include/linux/platform_data/atmel-aes.h
@@ -1,7 +1,7 @@
1#ifndef __LINUX_ATMEL_AES_H 1#ifndef __LINUX_ATMEL_AES_H
2#define __LINUX_ATMEL_AES_H 2#define __LINUX_ATMEL_AES_H
3 3
4#include <mach/at_hdmac.h> 4#include <linux/platform_data/dma-atmel.h>
5 5
6/** 6/**
7 * struct aes_dma_data - DMA data for AES 7 * struct aes_dma_data - DMA data for AES
diff --git a/include/linux/platform_data/camera-mx1.h b/include/linux/platform_data/camera-mx1.h
new file mode 100644
index 000000000000..4fd6c70314b4
--- /dev/null
+++ b/include/linux/platform_data/camera-mx1.h
@@ -0,0 +1,35 @@
1/*
2 * mx1_camera.h - i.MX1/i.MXL camera driver header file
3 *
4 * Copyright (c) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (C) 2009, Darius Augulis <augulis.darius@gmail.com>
6 *
7 * Based on PXA camera.h file:
8 * Copyright (C) 2003, Intel Corporation
9 * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#ifndef __ASM_ARCH_CAMERA_H_
17#define __ASM_ARCH_CAMERA_H_
18
19#define MX1_CAMERA_DATA_HIGH 1
20#define MX1_CAMERA_PCLK_RISING 2
21#define MX1_CAMERA_VSYNC_HIGH 4
22
23extern unsigned char mx1_camera_sof_fiq_start, mx1_camera_sof_fiq_end;
24
25/**
26 * struct mx1_camera_pdata - i.MX1/i.MXL camera platform data
27 * @mclk_10khz: master clock frequency in 10kHz units
28 * @flags: MX1 camera platform flags
29 */
30struct mx1_camera_pdata {
31 unsigned long mclk_10khz;
32 unsigned long flags;
33};
34
35#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/camera-mx2.h b/include/linux/platform_data/camera-mx2.h
new file mode 100644
index 000000000000..7ded6f1f74bc
--- /dev/null
+++ b/include/linux/platform_data/camera-mx2.h
@@ -0,0 +1,44 @@
1/*
2 * mx2-cam.h - i.MX27/i.MX25 camera driver header file
3 *
4 * Copyright (C) 2003, Intel Corporation
5 * Copyright (C) 2008, Sascha Hauer <s.hauer@pengutronix.de>
6 * Copyright (C) 2010, Baruch Siach <baruch@tkos.co.il>
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., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef __MACH_MX2_CAM_H_
24#define __MACH_MX2_CAM_H_
25
26#define MX2_CAMERA_EXT_VSYNC (1 << 1)
27#define MX2_CAMERA_CCIR (1 << 2)
28#define MX2_CAMERA_CCIR_INTERLACE (1 << 3)
29#define MX2_CAMERA_HSYNC_HIGH (1 << 4)
30#define MX2_CAMERA_GATED_CLOCK (1 << 5)
31#define MX2_CAMERA_INV_DATA (1 << 6)
32#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7)
33
34/**
35 * struct mx2_camera_platform_data - optional platform data for mx2_camera
36 * @flags: any combination of MX2_CAMERA_*
37 * @clk: clock rate of the csi block / 2
38 */
39struct mx2_camera_platform_data {
40 unsigned long flags;
41 unsigned long clk;
42};
43
44#endif /* __MACH_MX2_CAM_H_ */
diff --git a/include/linux/platform_data/camera-mx3.h b/include/linux/platform_data/camera-mx3.h
new file mode 100644
index 000000000000..f226ee3777e1
--- /dev/null
+++ b/include/linux/platform_data/camera-mx3.h
@@ -0,0 +1,48 @@
1/*
2 * mx3_camera.h - i.MX3x camera driver header file
3 *
4 * Copyright (C) 2008, Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.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
17#ifndef _MX3_CAMERA_H_
18#define _MX3_CAMERA_H_
19
20#include <linux/device.h>
21
22#define MX3_CAMERA_CLK_SRC 1
23#define MX3_CAMERA_EXT_VSYNC 2
24#define MX3_CAMERA_DP 4
25#define MX3_CAMERA_PCP 8
26#define MX3_CAMERA_HSP 0x10
27#define MX3_CAMERA_VSP 0x20
28#define MX3_CAMERA_DATAWIDTH_4 0x40
29#define MX3_CAMERA_DATAWIDTH_8 0x80
30#define MX3_CAMERA_DATAWIDTH_10 0x100
31#define MX3_CAMERA_DATAWIDTH_15 0x200
32
33#define MX3_CAMERA_DATAWIDTH_MASK (MX3_CAMERA_DATAWIDTH_4 | MX3_CAMERA_DATAWIDTH_8 | \
34 MX3_CAMERA_DATAWIDTH_10 | MX3_CAMERA_DATAWIDTH_15)
35
36/**
37 * struct mx3_camera_pdata - i.MX3x camera platform data
38 * @flags: MX3_CAMERA_* flags
39 * @mclk_10khz: master clock frequency in 10kHz units
40 * @dma_dev: IPU DMA device to match against in channel allocation
41 */
42struct mx3_camera_pdata {
43 unsigned long flags;
44 unsigned long mclk_10khz;
45 struct device *dma_dev;
46};
47
48#endif
diff --git a/include/linux/platform_data/camera-pxa.h b/include/linux/platform_data/camera-pxa.h
new file mode 100644
index 000000000000..6709b1cd7c77
--- /dev/null
+++ b/include/linux/platform_data/camera-pxa.h
@@ -0,0 +1,44 @@
1/*
2 camera.h - PXA camera driver header file
3
4 Copyright (C) 2003, Intel Corporation
5 Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de>
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., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __ASM_ARCH_CAMERA_H_
23#define __ASM_ARCH_CAMERA_H_
24
25#define PXA_CAMERA_MASTER 1
26#define PXA_CAMERA_DATAWIDTH_4 2
27#define PXA_CAMERA_DATAWIDTH_5 4
28#define PXA_CAMERA_DATAWIDTH_8 8
29#define PXA_CAMERA_DATAWIDTH_9 0x10
30#define PXA_CAMERA_DATAWIDTH_10 0x20
31#define PXA_CAMERA_PCLK_EN 0x40
32#define PXA_CAMERA_MCLK_EN 0x80
33#define PXA_CAMERA_PCP 0x100
34#define PXA_CAMERA_HSP 0x200
35#define PXA_CAMERA_VSP 0x400
36
37struct pxacamera_platform_data {
38 unsigned long flags;
39 unsigned long mclk_10khz;
40};
41
42extern void pxa_set_camera_info(struct pxacamera_platform_data *);
43
44#endif /* __ASM_ARCH_CAMERA_H_ */
diff --git a/include/linux/platform_data/clk-realview.h b/include/linux/platform_data/clk-realview.h
new file mode 100644
index 000000000000..2e426a7dbc51
--- /dev/null
+++ b/include/linux/platform_data/clk-realview.h
@@ -0,0 +1 @@
void realview_clk_init(void __iomem *sysbase, bool is_pb1176);
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
new file mode 100644
index 000000000000..3af0da1f3be5
--- /dev/null
+++ b/include/linux/platform_data/clk-ux500.h
@@ -0,0 +1,17 @@
1/*
2 * Clock definitions for ux500 platforms
3 *
4 * Copyright (C) 2012 ST-Ericsson SA
5 * Author: Ulf Hansson <ulf.hansson@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9
10#ifndef __CLK_UX500_H
11#define __CLK_UX500_H
12
13void u8500_clk_init(void);
14void u9540_clk_init(void);
15void u8540_clk_init(void);
16
17#endif /* __CLK_UX500_H */
diff --git a/include/linux/platform_data/crypto-ux500.h b/include/linux/platform_data/crypto-ux500.h
new file mode 100644
index 000000000000..5b2d0817e26a
--- /dev/null
+++ b/include/linux/platform_data/crypto-ux500.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Joakim Bech <joakim.xx.bech@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
6 */
7#ifndef _CRYPTO_UX500_H
8#define _CRYPTO_UX500_H
9#include <linux/dmaengine.h>
10#include <plat/ste_dma40.h>
11
12struct hash_platform_data {
13 void *mem_to_engine;
14 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
15};
16
17struct cryp_platform_data {
18 struct stedma40_chan_cfg mem_to_engine;
19 struct stedma40_chan_cfg engine_to_mem;
20};
21
22#endif
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
new file mode 100644
index 000000000000..d0c5825876f8
--- /dev/null
+++ b/include/linux/platform_data/davinci_asp.h
@@ -0,0 +1,105 @@
1/*
2 * TI DaVinci Audio Serial Port support
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DAVINCI_ASP_H
17#define __DAVINCI_ASP_H
18
19struct snd_platform_data {
20 u32 tx_dma_offset;
21 u32 rx_dma_offset;
22 int asp_chan_q; /* event queue number for ASP channel */
23 int ram_chan_q; /* event queue number for RAM channel */
24 unsigned int codec_fmt;
25 /*
26 * Allowing this is more efficient and eliminates left and right swaps
27 * caused by underruns, but will swap the left and right channels
28 * when compared to previous behavior.
29 */
30 unsigned enable_channel_combine:1;
31 unsigned sram_size_playback;
32 unsigned sram_size_capture;
33
34 /*
35 * If McBSP peripheral gets the clock from an external pin,
36 * there are three chooses, that are MCBSP_CLKX, MCBSP_CLKR
37 * and MCBSP_CLKS.
38 * Depending on different hardware connections it is possible
39 * to use this setting to change the behaviour of McBSP
40 * driver.
41 */
42 int clk_input_pin;
43
44 /*
45 * This flag works when both clock and FS are outputs for the cpu
46 * and makes clock more accurate (FS is not symmetrical and the
47 * clock is very fast.
48 * The clock becoming faster is named
49 * i2s continuous serial clock (I2S_SCK) and it is an externally
50 * visible bit clock.
51 *
52 * first line : WordSelect
53 * second line : ContinuousSerialClock
54 * third line: SerialData
55 *
56 * SYMMETRICAL APPROACH:
57 * _______________________ LEFT
58 * _| RIGHT |______________________|
59 * _ _ _ _ _ _ _ _
60 * _| |_| |_ x16 _| |_| |_| |_| |_ x16 _| |_| |_
61 * _ _ _ _ _ _ _ _
62 * _/ \_/ \_ ... _/ \_/ \_/ \_/ \_ ... _/ \_/ \_
63 * \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
64 *
65 * ACCURATE CLOCK APPROACH:
66 * ______________ LEFT
67 * _| RIGHT |_______________________________|
68 * _ _ _ _ _ _ _ _ _
69 * _| |_ x16 _| |_| |_ x16 _| |_| |_| |_| |_| |_| |
70 * _ _ _ _ dummy cycles
71 * _/ \_ ... _/ \_/ \_ ... _/ \__________________
72 * \_/ \_/ \_/ \_/
73 *
74 */
75 bool i2s_accurate_sck;
76
77 /* McASP specific fields */
78 int tdm_slots;
79 u8 op_mode;
80 u8 num_serializer;
81 u8 *serial_dir;
82 u8 version;
83 u8 txnumevt;
84 u8 rxnumevt;
85};
86
87enum {
88 MCASP_VERSION_1 = 0, /* DM646x */
89 MCASP_VERSION_2, /* DA8xx/OMAPL1x */
90 MCASP_VERSION_3, /* TI81xx/AM33xx */
91};
92
93enum mcbsp_clk_input_pin {
94 MCBSP_CLKR = 0, /* as in DM365 */
95 MCBSP_CLKS,
96};
97
98#define INACTIVE_MODE 0
99#define TX_MODE 1
100#define RX_MODE 2
101
102#define DAVINCI_MCASP_IIS_MODE 0
103#define DAVINCI_MCASP_DIT_MODE 1
104
105#endif
diff --git a/include/linux/platform_data/dma-atmel.h b/include/linux/platform_data/dma-atmel.h
new file mode 100644
index 000000000000..cab0997be3de
--- /dev/null
+++ b/include/linux/platform_data/dma-atmel.h
@@ -0,0 +1,61 @@
1/*
2 * Header file for the Atmel AHB DMA Controller driver
3 *
4 * Copyright (C) 2008 Atmel 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#ifndef AT_HDMAC_H
12#define AT_HDMAC_H
13
14#include <linux/dmaengine.h>
15
16/**
17 * struct at_dma_platform_data - Controller configuration parameters
18 * @nr_channels: Number of channels supported by hardware (max 8)
19 * @cap_mask: dma_capability flags supported by the platform
20 */
21struct at_dma_platform_data {
22 unsigned int nr_channels;
23 dma_cap_mask_t cap_mask;
24};
25
26/**
27 * struct at_dma_slave - Controller-specific information about a slave
28 * @dma_dev: required DMA master device
29 * @cfg: Platform-specific initializer for the CFG register
30 */
31struct at_dma_slave {
32 struct device *dma_dev;
33 u32 cfg;
34};
35
36
37/* Platform-configurable bits in CFG */
38#define ATC_SRC_PER(h) (0xFU & (h)) /* Channel src rq associated with periph handshaking ifc h */
39#define ATC_DST_PER(h) ((0xFU & (h)) << 4) /* Channel dst rq associated with periph handshaking ifc h */
40#define ATC_SRC_REP (0x1 << 8) /* Source Replay Mod */
41#define ATC_SRC_H2SEL (0x1 << 9) /* Source Handshaking Mod */
42#define ATC_SRC_H2SEL_SW (0x0 << 9)
43#define ATC_SRC_H2SEL_HW (0x1 << 9)
44#define ATC_DST_REP (0x1 << 12) /* Destination Replay Mod */
45#define ATC_DST_H2SEL (0x1 << 13) /* Destination Handshaking Mod */
46#define ATC_DST_H2SEL_SW (0x0 << 13)
47#define ATC_DST_H2SEL_HW (0x1 << 13)
48#define ATC_SOD (0x1 << 16) /* Stop On Done */
49#define ATC_LOCK_IF (0x1 << 20) /* Interface Lock */
50#define ATC_LOCK_B (0x1 << 21) /* AHB Bus Lock */
51#define ATC_LOCK_IF_L (0x1 << 22) /* Master Interface Arbiter Lock */
52#define ATC_LOCK_IF_L_CHUNK (0x0 << 22)
53#define ATC_LOCK_IF_L_BUFFER (0x1 << 22)
54#define ATC_AHB_PROT_MASK (0x7 << 24) /* AHB Protection */
55#define ATC_FIFOCFG_MASK (0x3 << 28) /* FIFO Request Configuration */
56#define ATC_FIFOCFG_LARGESTBURST (0x0 << 28)
57#define ATC_FIFOCFG_HALFFIFO (0x1 << 28)
58#define ATC_FIFOCFG_ENOUGHSPACE (0x2 << 28)
59
60
61#endif /* AT_HDMAC_H */
diff --git a/include/linux/platform_data/dma-ep93xx.h b/include/linux/platform_data/dma-ep93xx.h
new file mode 100644
index 000000000000..e82c642fa53c
--- /dev/null
+++ b/include/linux/platform_data/dma-ep93xx.h
@@ -0,0 +1,93 @@
1#ifndef __ASM_ARCH_DMA_H
2#define __ASM_ARCH_DMA_H
3
4#include <linux/types.h>
5#include <linux/dmaengine.h>
6#include <linux/dma-mapping.h>
7
8/*
9 * M2P channels.
10 *
11 * Note that these values are also directly used for setting the PPALLOC
12 * register.
13 */
14#define EP93XX_DMA_I2S1 0
15#define EP93XX_DMA_I2S2 1
16#define EP93XX_DMA_AAC1 2
17#define EP93XX_DMA_AAC2 3
18#define EP93XX_DMA_AAC3 4
19#define EP93XX_DMA_I2S3 5
20#define EP93XX_DMA_UART1 6
21#define EP93XX_DMA_UART2 7
22#define EP93XX_DMA_UART3 8
23#define EP93XX_DMA_IRDA 9
24/* M2M channels */
25#define EP93XX_DMA_SSP 10
26#define EP93XX_DMA_IDE 11
27
28/**
29 * struct ep93xx_dma_data - configuration data for the EP93xx dmaengine
30 * @port: peripheral which is requesting the channel
31 * @direction: TX/RX channel
32 * @name: optional name for the channel, this is displayed in /proc/interrupts
33 *
34 * This information is passed as private channel parameter in a filter
35 * function. Note that this is only needed for slave/cyclic channels. For
36 * memcpy channels %NULL data should be passed.
37 */
38struct ep93xx_dma_data {
39 int port;
40 enum dma_transfer_direction direction;
41 const char *name;
42};
43
44/**
45 * struct ep93xx_dma_chan_data - platform specific data for a DMA channel
46 * @name: name of the channel, used for getting the right clock for the channel
47 * @base: mapped registers
48 * @irq: interrupt number used by this channel
49 */
50struct ep93xx_dma_chan_data {
51 const char *name;
52 void __iomem *base;
53 int irq;
54};
55
56/**
57 * struct ep93xx_dma_platform_data - platform data for the dmaengine driver
58 * @channels: array of channels which are passed to the driver
59 * @num_channels: number of channels in the array
60 *
61 * This structure is passed to the DMA engine driver via platform data. For
62 * M2P channels, contract is that even channels are for TX and odd for RX.
63 * There is no requirement for the M2M channels.
64 */
65struct ep93xx_dma_platform_data {
66 struct ep93xx_dma_chan_data *channels;
67 size_t num_channels;
68};
69
70static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
71{
72 return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p");
73}
74
75/**
76 * ep93xx_dma_chan_direction - returns direction the channel can be used
77 * @chan: channel
78 *
79 * This function can be used in filter functions to find out whether the
80 * channel supports given DMA direction. Only M2P channels have such
81 * limitation, for M2M channels the direction is configurable.
82 */
83static inline enum dma_transfer_direction
84ep93xx_dma_chan_direction(struct dma_chan *chan)
85{
86 if (!ep93xx_dma_chan_is_m2p(chan))
87 return DMA_NONE;
88
89 /* even channels are for TX, odd for RX */
90 return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
91}
92
93#endif /* __ASM_ARCH_DMA_H */
diff --git a/include/linux/platform_data/dma-imx-sdma.h b/include/linux/platform_data/dma-imx-sdma.h
new file mode 100644
index 000000000000..3a3942823c20
--- /dev/null
+++ b/include/linux/platform_data/dma-imx-sdma.h
@@ -0,0 +1,59 @@
1#ifndef __MACH_MXC_SDMA_H__
2#define __MACH_MXC_SDMA_H__
3
4/**
5 * struct sdma_script_start_addrs - SDMA script start pointers
6 *
7 * start addresses of the different functions in the physical
8 * address space of the SDMA engine.
9 */
10struct sdma_script_start_addrs {
11 s32 ap_2_ap_addr;
12 s32 ap_2_bp_addr;
13 s32 ap_2_ap_fixed_addr;
14 s32 bp_2_ap_addr;
15 s32 loopback_on_dsp_side_addr;
16 s32 mcu_interrupt_only_addr;
17 s32 firi_2_per_addr;
18 s32 firi_2_mcu_addr;
19 s32 per_2_firi_addr;
20 s32 mcu_2_firi_addr;
21 s32 uart_2_per_addr;
22 s32 uart_2_mcu_addr;
23 s32 per_2_app_addr;
24 s32 mcu_2_app_addr;
25 s32 per_2_per_addr;
26 s32 uartsh_2_per_addr;
27 s32 uartsh_2_mcu_addr;
28 s32 per_2_shp_addr;
29 s32 mcu_2_shp_addr;
30 s32 ata_2_mcu_addr;
31 s32 mcu_2_ata_addr;
32 s32 app_2_per_addr;
33 s32 app_2_mcu_addr;
34 s32 shp_2_per_addr;
35 s32 shp_2_mcu_addr;
36 s32 mshc_2_mcu_addr;
37 s32 mcu_2_mshc_addr;
38 s32 spdif_2_mcu_addr;
39 s32 mcu_2_spdif_addr;
40 s32 asrc_2_mcu_addr;
41 s32 ext_mem_2_ipu_addr;
42 s32 descrambler_addr;
43 s32 dptc_dvfs_addr;
44 s32 utra_addr;
45 s32 ram_code_start_addr;
46};
47
48/**
49 * struct sdma_platform_data - platform specific data for SDMA engine
50 *
51 * @fw_name The firmware name
52 * @script_addrs SDMA scripts addresses in SDMA ROM
53 */
54struct sdma_platform_data {
55 char *fw_name;
56 struct sdma_script_start_addrs *script_addrs;
57};
58
59#endif /* __MACH_MXC_SDMA_H__ */
diff --git a/include/linux/platform_data/dma-imx.h b/include/linux/platform_data/dma-imx.h
new file mode 100644
index 000000000000..1b9080385b46
--- /dev/null
+++ b/include/linux/platform_data/dma-imx.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
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
9#ifndef __ASM_ARCH_MXC_DMA_H__
10#define __ASM_ARCH_MXC_DMA_H__
11
12#include <linux/scatterlist.h>
13#include <linux/device.h>
14#include <linux/dmaengine.h>
15
16/*
17 * This enumerates peripheral types. Used for SDMA.
18 */
19enum sdma_peripheral_type {
20 IMX_DMATYPE_SSI, /* MCU domain SSI */
21 IMX_DMATYPE_SSI_SP, /* Shared SSI */
22 IMX_DMATYPE_MMC, /* MMC */
23 IMX_DMATYPE_SDHC, /* SDHC */
24 IMX_DMATYPE_UART, /* MCU domain UART */
25 IMX_DMATYPE_UART_SP, /* Shared UART */
26 IMX_DMATYPE_FIRI, /* FIRI */
27 IMX_DMATYPE_CSPI, /* MCU domain CSPI */
28 IMX_DMATYPE_CSPI_SP, /* Shared CSPI */
29 IMX_DMATYPE_SIM, /* SIM */
30 IMX_DMATYPE_ATA, /* ATA */
31 IMX_DMATYPE_CCM, /* CCM */
32 IMX_DMATYPE_EXT, /* External peripheral */
33 IMX_DMATYPE_MSHC, /* Memory Stick Host Controller */
34 IMX_DMATYPE_MSHC_SP, /* Shared Memory Stick Host Controller */
35 IMX_DMATYPE_DSP, /* DSP */
36 IMX_DMATYPE_MEMORY, /* Memory */
37 IMX_DMATYPE_FIFO_MEMORY,/* FIFO type Memory */
38 IMX_DMATYPE_SPDIF, /* SPDIF */
39 IMX_DMATYPE_IPU_MEMORY, /* IPU Memory */
40 IMX_DMATYPE_ASRC, /* ASRC */
41 IMX_DMATYPE_ESAI, /* ESAI */
42};
43
44enum imx_dma_prio {
45 DMA_PRIO_HIGH = 0,
46 DMA_PRIO_MEDIUM = 1,
47 DMA_PRIO_LOW = 2
48};
49
50struct imx_dma_data {
51 int dma_request; /* DMA request line */
52 enum sdma_peripheral_type peripheral_type;
53 int priority;
54};
55
56static inline int imx_dma_is_ipu(struct dma_chan *chan)
57{
58 return !strcmp(dev_name(chan->device->dev), "ipu-core");
59}
60
61static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
62{
63 return strstr(dev_name(chan->device->dev), "sdma") ||
64 !strcmp(dev_name(chan->device->dev), "imx-dma");
65}
66
67#endif
diff --git a/include/linux/platform_data/dma-mmp_tdma.h b/include/linux/platform_data/dma-mmp_tdma.h
new file mode 100644
index 000000000000..239e0fc1bb1f
--- /dev/null
+++ b/include/linux/platform_data/dma-mmp_tdma.h
@@ -0,0 +1,35 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/sram.h
3 *
4 * SRAM Memory Management
5 *
6 * Copyright (c) 2011 Marvell Semiconductors Inc.
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
14#ifndef __ASM_ARCH_SRAM_H
15#define __ASM_ARCH_SRAM_H
16
17#include <linux/genalloc.h>
18
19/* ARBITRARY: SRAM allocations are multiples of this 2^N size */
20#define SRAM_GRANULARITY 512
21
22enum sram_type {
23 MMP_SRAM_UNDEFINED = 0,
24 MMP_ASRAM,
25 MMP_ISRAM,
26};
27
28struct sram_platdata {
29 char *pool_name;
30 int granularity;
31};
32
33extern struct gen_pool *sram_get_gpool(char *pool_name);
34
35#endif /* __ASM_ARCH_SRAM_H */
diff --git a/include/linux/platform_data/dma-mv_xor.h b/include/linux/platform_data/dma-mv_xor.h
new file mode 100644
index 000000000000..2ba1f7d76eef
--- /dev/null
+++ b/include/linux/platform_data/dma-mv_xor.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/plat-orion/include/plat/mv_xor.h
3 *
4 * Marvell XOR platform device data definition file.
5 */
6
7#ifndef __PLAT_MV_XOR_H
8#define __PLAT_MV_XOR_H
9
10#include <linux/dmaengine.h>
11#include <linux/mbus.h>
12
13#define MV_XOR_SHARED_NAME "mv_xor_shared"
14#define MV_XOR_NAME "mv_xor"
15
16struct mv_xor_platform_data {
17 struct platform_device *shared;
18 int hw_id;
19 dma_cap_mask_t cap_mask;
20 size_t pool_size;
21};
22
23
24#endif
diff --git a/include/linux/platform_data/dsp-omap.h b/include/linux/platform_data/dsp-omap.h
new file mode 100644
index 000000000000..5927709b1908
--- /dev/null
+++ b/include/linux/platform_data/dsp-omap.h
@@ -0,0 +1,34 @@
1#ifndef __OMAP_DSP_H__
2#define __OMAP_DSP_H__
3
4#include <linux/types.h>
5
6struct omap_dsp_platform_data {
7 void (*dsp_set_min_opp) (u8 opp_id);
8 u8 (*dsp_get_opp) (void);
9 void (*cpu_set_freq) (unsigned long f);
10 unsigned long (*cpu_get_freq) (void);
11 unsigned long mpu_speed[6];
12
13 /* functions to write and read PRCM registers */
14 void (*dsp_prm_write)(u32, s16 , u16);
15 u32 (*dsp_prm_read)(s16 , u16);
16 u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16);
17 void (*dsp_cm_write)(u32, s16 , u16);
18 u32 (*dsp_cm_read)(s16 , u16);
19 u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
20
21 void (*set_bootaddr)(u32);
22 void (*set_bootmode)(u8);
23
24 phys_addr_t phys_mempool_base;
25 phys_addr_t phys_mempool_size;
26};
27
28#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
29extern void omap_dsp_reserve_sdram_memblock(void);
30#else
31static inline void omap_dsp_reserve_sdram_memblock(void) { }
32#endif
33
34#endif
diff --git a/include/linux/platform_data/eth-netx.h b/include/linux/platform_data/eth-netx.h
new file mode 100644
index 000000000000..88af1ac28ead
--- /dev/null
+++ b/include/linux/platform_data/eth-netx.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-netx/include/mach/eth.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef ASMARM_ARCH_ETH_H
21#define ASMARM_ARCH_ETH_H
22
23struct netxeth_platform_data {
24 unsigned int xcno; /* number of xmac/xpec engine this eth uses */
25};
26
27#endif
diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h
new file mode 100644
index 000000000000..e8741c2678d5
--- /dev/null
+++ b/include/linux/platform_data/gpio-omap.h
@@ -0,0 +1,217 @@
1/*
2 * OMAP GPIO handling defines and functions
3 *
4 * Copyright (C) 2003-2005 Nokia Corporation
5 *
6 * Written by Juha Yrjölä <juha.yrjola@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 __ASM_ARCH_OMAP_GPIO_H
25#define __ASM_ARCH_OMAP_GPIO_H
26
27#include <linux/io.h>
28#include <linux/platform_device.h>
29#include <mach/irqs.h>
30
31#define OMAP1_MPUIO_BASE 0xfffb5000
32
33/*
34 * These are the omap15xx/16xx offsets. The omap7xx offset are
35 * OMAP_MPUIO_ / 2 offsets below.
36 */
37#define OMAP_MPUIO_INPUT_LATCH 0x00
38#define OMAP_MPUIO_OUTPUT 0x04
39#define OMAP_MPUIO_IO_CNTL 0x08
40#define OMAP_MPUIO_KBR_LATCH 0x10
41#define OMAP_MPUIO_KBC 0x14
42#define OMAP_MPUIO_GPIO_EVENT_MODE 0x18
43#define OMAP_MPUIO_GPIO_INT_EDGE 0x1c
44#define OMAP_MPUIO_KBD_INT 0x20
45#define OMAP_MPUIO_GPIO_INT 0x24
46#define OMAP_MPUIO_KBD_MASKIT 0x28
47#define OMAP_MPUIO_GPIO_MASKIT 0x2c
48#define OMAP_MPUIO_GPIO_DEBOUNCING 0x30
49#define OMAP_MPUIO_LATCH 0x34
50
51#define OMAP34XX_NR_GPIOS 6
52
53/*
54 * OMAP1510 GPIO registers
55 */
56#define OMAP1510_GPIO_DATA_INPUT 0x00
57#define OMAP1510_GPIO_DATA_OUTPUT 0x04
58#define OMAP1510_GPIO_DIR_CONTROL 0x08
59#define OMAP1510_GPIO_INT_CONTROL 0x0c
60#define OMAP1510_GPIO_INT_MASK 0x10
61#define OMAP1510_GPIO_INT_STATUS 0x14
62#define OMAP1510_GPIO_PIN_CONTROL 0x18
63
64#define OMAP1510_IH_GPIO_BASE 64
65
66/*
67 * OMAP1610 specific GPIO registers
68 */
69#define OMAP1610_GPIO_REVISION 0x0000
70#define OMAP1610_GPIO_SYSCONFIG 0x0010
71#define OMAP1610_GPIO_SYSSTATUS 0x0014
72#define OMAP1610_GPIO_IRQSTATUS1 0x0018
73#define OMAP1610_GPIO_IRQENABLE1 0x001c
74#define OMAP1610_GPIO_WAKEUPENABLE 0x0028
75#define OMAP1610_GPIO_DATAIN 0x002c
76#define OMAP1610_GPIO_DATAOUT 0x0030
77#define OMAP1610_GPIO_DIRECTION 0x0034
78#define OMAP1610_GPIO_EDGE_CTRL1 0x0038
79#define OMAP1610_GPIO_EDGE_CTRL2 0x003c
80#define OMAP1610_GPIO_CLEAR_IRQENABLE1 0x009c
81#define OMAP1610_GPIO_CLEAR_WAKEUPENA 0x00a8
82#define OMAP1610_GPIO_CLEAR_DATAOUT 0x00b0
83#define OMAP1610_GPIO_SET_IRQENABLE1 0x00dc
84#define OMAP1610_GPIO_SET_WAKEUPENA 0x00e8
85#define OMAP1610_GPIO_SET_DATAOUT 0x00f0
86
87/*
88 * OMAP7XX specific GPIO registers
89 */
90#define OMAP7XX_GPIO_DATA_INPUT 0x00
91#define OMAP7XX_GPIO_DATA_OUTPUT 0x04
92#define OMAP7XX_GPIO_DIR_CONTROL 0x08
93#define OMAP7XX_GPIO_INT_CONTROL 0x0c
94#define OMAP7XX_GPIO_INT_MASK 0x10
95#define OMAP7XX_GPIO_INT_STATUS 0x14
96
97/*
98 * omap2+ specific GPIO registers
99 */
100#define OMAP24XX_GPIO_REVISION 0x0000
101#define OMAP24XX_GPIO_IRQSTATUS1 0x0018
102#define OMAP24XX_GPIO_IRQSTATUS2 0x0028
103#define OMAP24XX_GPIO_IRQENABLE2 0x002c
104#define OMAP24XX_GPIO_IRQENABLE1 0x001c
105#define OMAP24XX_GPIO_WAKE_EN 0x0020
106#define OMAP24XX_GPIO_CTRL 0x0030
107#define OMAP24XX_GPIO_OE 0x0034
108#define OMAP24XX_GPIO_DATAIN 0x0038
109#define OMAP24XX_GPIO_DATAOUT 0x003c
110#define OMAP24XX_GPIO_LEVELDETECT0 0x0040
111#define OMAP24XX_GPIO_LEVELDETECT1 0x0044
112#define OMAP24XX_GPIO_RISINGDETECT 0x0048
113#define OMAP24XX_GPIO_FALLINGDETECT 0x004c
114#define OMAP24XX_GPIO_DEBOUNCE_EN 0x0050
115#define OMAP24XX_GPIO_DEBOUNCE_VAL 0x0054
116#define OMAP24XX_GPIO_CLEARIRQENABLE1 0x0060
117#define OMAP24XX_GPIO_SETIRQENABLE1 0x0064
118#define OMAP24XX_GPIO_CLEARWKUENA 0x0080
119#define OMAP24XX_GPIO_SETWKUENA 0x0084
120#define OMAP24XX_GPIO_CLEARDATAOUT 0x0090
121#define OMAP24XX_GPIO_SETDATAOUT 0x0094
122
123#define OMAP4_GPIO_REVISION 0x0000
124#define OMAP4_GPIO_EOI 0x0020
125#define OMAP4_GPIO_IRQSTATUSRAW0 0x0024
126#define OMAP4_GPIO_IRQSTATUSRAW1 0x0028
127#define OMAP4_GPIO_IRQSTATUS0 0x002c
128#define OMAP4_GPIO_IRQSTATUS1 0x0030
129#define OMAP4_GPIO_IRQSTATUSSET0 0x0034
130#define OMAP4_GPIO_IRQSTATUSSET1 0x0038
131#define OMAP4_GPIO_IRQSTATUSCLR0 0x003c
132#define OMAP4_GPIO_IRQSTATUSCLR1 0x0040
133#define OMAP4_GPIO_IRQWAKEN0 0x0044
134#define OMAP4_GPIO_IRQWAKEN1 0x0048
135#define OMAP4_GPIO_IRQENABLE1 0x011c
136#define OMAP4_GPIO_WAKE_EN 0x0120
137#define OMAP4_GPIO_IRQSTATUS2 0x0128
138#define OMAP4_GPIO_IRQENABLE2 0x012c
139#define OMAP4_GPIO_CTRL 0x0130
140#define OMAP4_GPIO_OE 0x0134
141#define OMAP4_GPIO_DATAIN 0x0138
142#define OMAP4_GPIO_DATAOUT 0x013c
143#define OMAP4_GPIO_LEVELDETECT0 0x0140
144#define OMAP4_GPIO_LEVELDETECT1 0x0144
145#define OMAP4_GPIO_RISINGDETECT 0x0148
146#define OMAP4_GPIO_FALLINGDETECT 0x014c
147#define OMAP4_GPIO_DEBOUNCENABLE 0x0150
148#define OMAP4_GPIO_DEBOUNCINGTIME 0x0154
149#define OMAP4_GPIO_CLEARIRQENABLE1 0x0160
150#define OMAP4_GPIO_SETIRQENABLE1 0x0164
151#define OMAP4_GPIO_CLEARWKUENA 0x0180
152#define OMAP4_GPIO_SETWKUENA 0x0184
153#define OMAP4_GPIO_CLEARDATAOUT 0x0190
154#define OMAP4_GPIO_SETDATAOUT 0x0194
155
156#define OMAP_MAX_GPIO_LINES 192
157
158#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
159#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
160
161struct omap_gpio_dev_attr {
162 int bank_width; /* GPIO bank width */
163 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
164};
165
166struct omap_gpio_reg_offs {
167 u16 revision;
168 u16 direction;
169 u16 datain;
170 u16 dataout;
171 u16 set_dataout;
172 u16 clr_dataout;
173 u16 irqstatus;
174 u16 irqstatus2;
175 u16 irqstatus_raw0;
176 u16 irqstatus_raw1;
177 u16 irqenable;
178 u16 irqenable2;
179 u16 set_irqenable;
180 u16 clr_irqenable;
181 u16 debounce;
182 u16 debounce_en;
183 u16 ctrl;
184 u16 wkup_en;
185 u16 leveldetect0;
186 u16 leveldetect1;
187 u16 risingdetect;
188 u16 fallingdetect;
189 u16 irqctrl;
190 u16 edgectrl1;
191 u16 edgectrl2;
192 u16 pinctrl;
193
194 bool irqenable_inv;
195};
196
197struct omap_gpio_platform_data {
198 int bank_type;
199 int bank_width; /* GPIO bank width */
200 int bank_stride; /* Only needed for omap1 MPUIO */
201 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
202 bool loses_context; /* whether the bank would ever lose context */
203 bool is_mpuio; /* whether the bank is of type MPUIO */
204 u32 non_wakeup_gpios;
205
206 struct omap_gpio_reg_offs *regs;
207
208 /* Return context loss count due to PM states changing */
209 int (*get_context_loss_count)(struct device *dev);
210};
211
212extern void omap2_gpio_prepare_for_idle(int off_mode);
213extern void omap2_gpio_resume_after_idle(void);
214extern void omap_set_gpio_debounce(int gpio, int enable);
215extern void omap_set_gpio_debounce_time(int gpio, int enable);
216
217#endif
diff --git a/include/linux/platform_data/hwmon-s3c.h b/include/linux/platform_data/hwmon-s3c.h
new file mode 100644
index 000000000000..c167e4429bc7
--- /dev/null
+++ b/include/linux/platform_data/hwmon-s3c.h
@@ -0,0 +1,51 @@
1/* linux/arch/arm/plat-s3c/include/plat/hwmon.h
2 *
3 * Copyright 2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/
6 *
7 * S3C - HWMon interface for ADC
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#ifndef __ASM_ARCH_ADC_HWMON_H
15#define __ASM_ARCH_ADC_HWMON_H __FILE__
16
17/**
18 * s3c_hwmon_chcfg - channel configuration
19 * @name: The name to give this channel.
20 * @mult: Multiply the ADC value read by this.
21 * @div: Divide the value from the ADC by this.
22 *
23 * The value read from the ADC is converted to a value that
24 * hwmon expects (mV) by result = (value_read * @mult) / @div.
25 */
26struct s3c_hwmon_chcfg {
27 const char *name;
28 unsigned int mult;
29 unsigned int div;
30};
31
32/**
33 * s3c_hwmon_pdata - HWMON platform data
34 * @in: One configuration for each possible channel used.
35 */
36struct s3c_hwmon_pdata {
37 struct s3c_hwmon_chcfg *in[8];
38};
39
40/**
41 * s3c_hwmon_set_platdata - Set platform data for S3C HWMON device
42 * @pd: Platform data to register to device.
43 *
44 * Register the given platform data for use with the S3C HWMON device.
45 * The call will copy the platform data, so the board definitions can
46 * make the structure itself __initdata.
47 */
48extern void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd);
49
50#endif /* __ASM_ARCH_ADC_HWMON_H */
51
diff --git a/include/linux/platform_data/i2c-davinci.h b/include/linux/platform_data/i2c-davinci.h
new file mode 100644
index 000000000000..2312d197dfb7
--- /dev/null
+++ b/include/linux/platform_data/i2c-davinci.h
@@ -0,0 +1,26 @@
1/*
2 * DaVinci I2C controller platform_device info
3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10*/
11
12#ifndef __ASM_ARCH_I2C_H
13#define __ASM_ARCH_I2C_H
14
15/* All frequencies are expressed in kHz */
16struct davinci_i2c_platform_data {
17 unsigned int bus_freq; /* standard bus frequency (kHz) */
18 unsigned int bus_delay; /* post-transaction delay (usec) */
19 unsigned int sda_pin; /* GPIO pin ID to use for SDA */
20 unsigned int scl_pin; /* GPIO pin ID to use for SCL */
21};
22
23/* for board setup code */
24void davinci_init_i2c(struct davinci_i2c_platform_data *);
25
26#endif /* __ASM_ARCH_I2C_H */
diff --git a/include/linux/platform_data/i2c-imx.h b/include/linux/platform_data/i2c-imx.h
new file mode 100644
index 000000000000..8289d915e615
--- /dev/null
+++ b/include/linux/platform_data/i2c-imx.h
@@ -0,0 +1,21 @@
1/*
2 * i2c.h - i.MX I2C driver header file
3 *
4 * Copyright (c) 2008, Darius Augulis <augulis.darius@gmail.com>
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __ASM_ARCH_I2C_H_
10#define __ASM_ARCH_I2C_H_
11
12/**
13 * struct imxi2c_platform_data - structure of platform data for MXC I2C driver
14 * @bitrate: Bus speed measured in Hz
15 *
16 **/
17struct imxi2c_platform_data {
18 u32 bitrate;
19};
20
21#endif /* __ASM_ARCH_I2C_H_ */
diff --git a/include/linux/platform_data/i2c-nuc900.h b/include/linux/platform_data/i2c-nuc900.h
new file mode 100644
index 000000000000..9ffb12d06e91
--- /dev/null
+++ b/include/linux/platform_data/i2c-nuc900.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_ARCH_NUC900_I2C_H
2#define __ASM_ARCH_NUC900_I2C_H
3
4struct nuc900_platform_i2c {
5 int bus_num;
6 unsigned long bus_freq;
7};
8
9#endif /* __ASM_ARCH_NUC900_I2C_H */
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
new file mode 100644
index 000000000000..51d52e767a19
--- /dev/null
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -0,0 +1,77 @@
1/* arch/arm/plat-s3c/include/plat/iic.h
2 *
3 * Copyright 2004-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C - I2C Controller platform_device info
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 __ASM_ARCH_IIC_H
14#define __ASM_ARCH_IIC_H __FILE__
15
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17
18/**
19 * struct s3c2410_platform_i2c - Platform data for s3c I2C.
20 * @bus_num: The bus number to use (if possible).
21 * @flags: Any flags for the I2C bus (E.g. S3C_IICFLK_FILTER).
22 * @slave_addr: The I2C address for the slave device (if enabled).
23 * @frequency: The desired frequency in Hz of the bus. This is
24 * guaranteed to not be exceeded. If the caller does
25 * not care, use zero and the driver will select a
26 * useful default.
27 * @sda_delay: The delay (in ns) applied to SDA edges.
28 * @cfg_gpio: A callback to configure the pins for I2C operation.
29 */
30struct s3c2410_platform_i2c {
31 int bus_num;
32 unsigned int flags;
33 unsigned int slave_addr;
34 unsigned long frequency;
35 unsigned int sda_delay;
36
37 void (*cfg_gpio)(struct platform_device *dev);
38};
39
40/**
41 * s3c_i2c0_set_platdata - set platform data for i2c0 device
42 * @i2c: The platform data to set, or NULL for default data.
43 *
44 * Register the given platform data for use with the i2c0 device. This
45 * call copies the platform data, so the caller can use __initdata for
46 * their copy.
47 *
48 * This call will set cfg_gpio if is null to the default platform
49 * implementation.
50 *
51 * Any user of s3c_device_i2c0 should call this, even if it is with
52 * NULL to ensure that the device is given the default platform data
53 * as the driver will no longer carry defaults.
54 */
55extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
56extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
57extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c);
58extern void s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *i2c);
59extern void s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *i2c);
60extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c);
61extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c);
62extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c);
63extern void s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *i2c);
64
65/* defined by architecture to configure gpio */
66extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
67extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
68extern void s3c_i2c2_cfg_gpio(struct platform_device *dev);
69extern void s3c_i2c3_cfg_gpio(struct platform_device *dev);
70extern void s3c_i2c4_cfg_gpio(struct platform_device *dev);
71extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
72extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
73extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
74
75extern struct s3c2410_platform_i2c default_i2c_data;
76
77#endif /* __ASM_ARCH_IIC_H */
diff --git a/include/linux/platform_data/irda-pxaficp.h b/include/linux/platform_data/irda-pxaficp.h
new file mode 100644
index 000000000000..3cd41f77dda4
--- /dev/null
+++ b/include/linux/platform_data/irda-pxaficp.h
@@ -0,0 +1,25 @@
1#ifndef ASMARM_ARCH_IRDA_H
2#define ASMARM_ARCH_IRDA_H
3
4/* board specific transceiver capabilities */
5
6#define IR_OFF 1
7#define IR_SIRMODE 2
8#define IR_FIRMODE 4
9
10struct pxaficp_platform_data {
11 int transceiver_cap;
12 void (*transceiver_mode)(struct device *dev, int mode);
13 int (*startup)(struct device *dev);
14 void (*shutdown)(struct device *dev);
15 int gpio_pwdown; /* powerdown GPIO for the IrDA chip */
16 bool gpio_pwdown_inverted; /* gpio_pwdown is inverted */
17};
18
19extern void pxa_set_ficp_info(struct pxaficp_platform_data *info);
20
21#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
22void pxa2xx_transceiver_mode(struct device *dev, int mode);
23#endif
24
25#endif
diff --git a/include/linux/platform_data/keyboard-pxa930_rotary.h b/include/linux/platform_data/keyboard-pxa930_rotary.h
new file mode 100644
index 000000000000..053587caffdd
--- /dev/null
+++ b/include/linux/platform_data/keyboard-pxa930_rotary.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_ARCH_PXA930_ROTARY_H
2#define __ASM_ARCH_PXA930_ROTARY_H
3
4/* NOTE:
5 *
6 * rotary can be either interpreted as a ralative input event (e.g.
7 * REL_WHEEL or REL_HWHEEL) or a specific key event (e.g. UP/DOWN
8 * or LEFT/RIGHT), depending on if up_key & down_key are assigned
9 * or rel_code is assigned a non-zero value. When all are non-zero,
10 * up_key and down_key will be preferred.
11 */
12struct pxa930_rotary_platform_data {
13 int up_key;
14 int down_key;
15 int rel_code;
16};
17
18void __init pxa930_set_rotarykey_info(struct pxa930_rotary_platform_data *info);
19
20#endif /* __ASM_ARCH_PXA930_ROTARY_H */
diff --git a/include/linux/platform_data/keyboard-spear.h b/include/linux/platform_data/keyboard-spear.h
new file mode 100644
index 000000000000..9248e3a7e333
--- /dev/null
+++ b/include/linux/platform_data/keyboard-spear.h
@@ -0,0 +1,164 @@
1/*
2 * Copyright (C) 2010 ST Microelectronics
3 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
4 *
5 * This file is licensed under the terms of the GNU General Public
6 * License version 2. This program is licensed "as is" without any
7 * warranty of any kind, whether express or implied.
8 */
9
10#ifndef __PLAT_KEYBOARD_H
11#define __PLAT_KEYBOARD_H
12
13#include <linux/bitops.h>
14#include <linux/input.h>
15#include <linux/input/matrix_keypad.h>
16#include <linux/types.h>
17
18#define DECLARE_9x9_KEYMAP(_name) \
19int _name[] = { \
20 KEY(0, 0, KEY_ESC), \
21 KEY(0, 1, KEY_1), \
22 KEY(0, 2, KEY_2), \
23 KEY(0, 3, KEY_3), \
24 KEY(0, 4, KEY_4), \
25 KEY(0, 5, KEY_5), \
26 KEY(0, 6, KEY_6), \
27 KEY(0, 7, KEY_7), \
28 KEY(0, 8, KEY_8), \
29 KEY(1, 0, KEY_9), \
30 KEY(1, 1, KEY_MINUS), \
31 KEY(1, 2, KEY_EQUAL), \
32 KEY(1, 3, KEY_BACKSPACE), \
33 KEY(1, 4, KEY_TAB), \
34 KEY(1, 5, KEY_Q), \
35 KEY(1, 6, KEY_W), \
36 KEY(1, 7, KEY_E), \
37 KEY(1, 8, KEY_R), \
38 KEY(2, 0, KEY_T), \
39 KEY(2, 1, KEY_Y), \
40 KEY(2, 2, KEY_U), \
41 KEY(2, 3, KEY_I), \
42 KEY(2, 4, KEY_O), \
43 KEY(2, 5, KEY_P), \
44 KEY(2, 6, KEY_LEFTBRACE), \
45 KEY(2, 7, KEY_RIGHTBRACE), \
46 KEY(2, 8, KEY_ENTER), \
47 KEY(3, 0, KEY_LEFTCTRL), \
48 KEY(3, 1, KEY_A), \
49 KEY(3, 2, KEY_S), \
50 KEY(3, 3, KEY_D), \
51 KEY(3, 4, KEY_F), \
52 KEY(3, 5, KEY_G), \
53 KEY(3, 6, KEY_H), \
54 KEY(3, 7, KEY_J), \
55 KEY(3, 8, KEY_K), \
56 KEY(4, 0, KEY_L), \
57 KEY(4, 1, KEY_SEMICOLON), \
58 KEY(4, 2, KEY_APOSTROPHE), \
59 KEY(4, 3, KEY_GRAVE), \
60 KEY(4, 4, KEY_LEFTSHIFT), \
61 KEY(4, 5, KEY_BACKSLASH), \
62 KEY(4, 6, KEY_Z), \
63 KEY(4, 7, KEY_X), \
64 KEY(4, 8, KEY_C), \
65 KEY(5, 0, KEY_V), \
66 KEY(5, 1, KEY_B), \
67 KEY(5, 2, KEY_N), \
68 KEY(5, 3, KEY_M), \
69 KEY(5, 4, KEY_COMMA), \
70 KEY(5, 5, KEY_DOT), \
71 KEY(5, 6, KEY_SLASH), \
72 KEY(5, 7, KEY_RIGHTSHIFT), \
73 KEY(5, 8, KEY_KPASTERISK), \
74 KEY(6, 0, KEY_LEFTALT), \
75 KEY(6, 1, KEY_SPACE), \
76 KEY(6, 2, KEY_CAPSLOCK), \
77 KEY(6, 3, KEY_F1), \
78 KEY(6, 4, KEY_F2), \
79 KEY(6, 5, KEY_F3), \
80 KEY(6, 6, KEY_F4), \
81 KEY(6, 7, KEY_F5), \
82 KEY(6, 8, KEY_F6), \
83 KEY(7, 0, KEY_F7), \
84 KEY(7, 1, KEY_F8), \
85 KEY(7, 2, KEY_F9), \
86 KEY(7, 3, KEY_F10), \
87 KEY(7, 4, KEY_NUMLOCK), \
88 KEY(7, 5, KEY_SCROLLLOCK), \
89 KEY(7, 6, KEY_KP7), \
90 KEY(7, 7, KEY_KP8), \
91 KEY(7, 8, KEY_KP9), \
92 KEY(8, 0, KEY_KPMINUS), \
93 KEY(8, 1, KEY_KP4), \
94 KEY(8, 2, KEY_KP5), \
95 KEY(8, 3, KEY_KP6), \
96 KEY(8, 4, KEY_KPPLUS), \
97 KEY(8, 5, KEY_KP1), \
98 KEY(8, 6, KEY_KP2), \
99 KEY(8, 7, KEY_KP3), \
100 KEY(8, 8, KEY_KP0), \
101}
102
103#define DECLARE_6x6_KEYMAP(_name) \
104int _name[] = { \
105 KEY(0, 0, KEY_RESERVED), \
106 KEY(0, 1, KEY_1), \
107 KEY(0, 2, KEY_2), \
108 KEY(0, 3, KEY_3), \
109 KEY(0, 4, KEY_4), \
110 KEY(0, 5, KEY_5), \
111 KEY(1, 0, KEY_Q), \
112 KEY(1, 1, KEY_W), \
113 KEY(1, 2, KEY_E), \
114 KEY(1, 3, KEY_R), \
115 KEY(1, 4, KEY_T), \
116 KEY(1, 5, KEY_Y), \
117 KEY(2, 0, KEY_D), \
118 KEY(2, 1, KEY_F), \
119 KEY(2, 2, KEY_G), \
120 KEY(2, 3, KEY_H), \
121 KEY(2, 4, KEY_J), \
122 KEY(2, 5, KEY_K), \
123 KEY(3, 0, KEY_B), \
124 KEY(3, 1, KEY_N), \
125 KEY(3, 2, KEY_M), \
126 KEY(3, 3, KEY_COMMA), \
127 KEY(3, 4, KEY_DOT), \
128 KEY(3, 5, KEY_SLASH), \
129 KEY(4, 0, KEY_F6), \
130 KEY(4, 1, KEY_F7), \
131 KEY(4, 2, KEY_F8), \
132 KEY(4, 3, KEY_F9), \
133 KEY(4, 4, KEY_F10), \
134 KEY(4, 5, KEY_NUMLOCK), \
135 KEY(5, 0, KEY_KP2), \
136 KEY(5, 1, KEY_KP3), \
137 KEY(5, 2, KEY_KP0), \
138 KEY(5, 3, KEY_KPDOT), \
139 KEY(5, 4, KEY_RO), \
140 KEY(5, 5, KEY_ZENKAKUHANKAKU), \
141}
142
143#define KEYPAD_9x9 0
144#define KEYPAD_6x6 1
145#define KEYPAD_2x2 2
146
147/**
148 * struct kbd_platform_data - spear keyboard platform data
149 * keymap: pointer to keymap data (table and size)
150 * rep: enables key autorepeat
151 * mode: choose keyboard support(9x9, 6x6, 2x2)
152 * suspended_rate: rate at which keyboard would operate in suspended mode
153 *
154 * This structure is supposed to be used by platform code to supply
155 * keymaps to drivers that implement keyboards.
156 */
157struct kbd_platform_data {
158 const struct matrix_keymap_data *keymap;
159 bool rep;
160 unsigned int mode;
161 unsigned int suspended_rate;
162};
163
164#endif /* __PLAT_KEYBOARD_H */
diff --git a/include/linux/platform_data/keypad-ep93xx.h b/include/linux/platform_data/keypad-ep93xx.h
new file mode 100644
index 000000000000..1e2f4e97f428
--- /dev/null
+++ b/include/linux/platform_data/keypad-ep93xx.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/ep93xx_keypad.h
3 */
4
5#ifndef __ASM_ARCH_EP93XX_KEYPAD_H
6#define __ASM_ARCH_EP93XX_KEYPAD_H
7
8struct matrix_keymap_data;
9
10/* flags for the ep93xx_keypad driver */
11#define EP93XX_KEYPAD_DISABLE_3_KEY (1<<0) /* disable 3-key reset */
12#define EP93XX_KEYPAD_DIAG_MODE (1<<1) /* diagnostic mode */
13#define EP93XX_KEYPAD_BACK_DRIVE (1<<2) /* back driving mode */
14#define EP93XX_KEYPAD_TEST_MODE (1<<3) /* scan only column 0 */
15#define EP93XX_KEYPAD_KDIV (1<<4) /* 1/4 clock or 1/16 clock */
16#define EP93XX_KEYPAD_AUTOREPEAT (1<<5) /* enable key autorepeat */
17
18/**
19 * struct ep93xx_keypad_platform_data - platform specific device structure
20 * @keymap_data: pointer to &matrix_keymap_data
21 * @debounce: debounce start count; terminal count is 0xff
22 * @prescale: row/column counter pre-scaler load value
23 * @flags: see above
24 */
25struct ep93xx_keypad_platform_data {
26 struct matrix_keymap_data *keymap_data;
27 unsigned int debounce;
28 unsigned int prescale;
29 unsigned int flags;
30};
31
32#define EP93XX_MATRIX_ROWS (8)
33#define EP93XX_MATRIX_COLS (8)
34
35#endif /* __ASM_ARCH_EP93XX_KEYPAD_H */
diff --git a/include/linux/platform_data/keypad-nomadik-ske.h b/include/linux/platform_data/keypad-nomadik-ske.h
new file mode 100644
index 000000000000..31382fbc07dc
--- /dev/null
+++ b/include/linux/platform_data/keypad-nomadik-ske.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License v2
5 * Author: Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
6 *
7 * ux500 Scroll key and Keypad Encoder (SKE) header
8 */
9
10#ifndef __SKE_H
11#define __SKE_H
12
13#include <linux/input/matrix_keypad.h>
14
15/* register definitions for SKE peripheral */
16#define SKE_CR 0x00
17#define SKE_VAL0 0x04
18#define SKE_VAL1 0x08
19#define SKE_DBCR 0x0C
20#define SKE_IMSC 0x10
21#define SKE_RIS 0x14
22#define SKE_MIS 0x18
23#define SKE_ICR 0x1C
24
25/*
26 * Keypad module
27 */
28
29/**
30 * struct keypad_platform_data - structure for platform specific data
31 * @init: pointer to keypad init function
32 * @exit: pointer to keypad deinitialisation function
33 * @keymap_data: matrix scan code table for keycodes
34 * @krow: maximum number of rows
35 * @kcol: maximum number of columns
36 * @debounce_ms: platform specific debounce time
37 * @no_autorepeat: flag for auto repetition
38 * @wakeup_enable: allow waking up the system
39 */
40struct ske_keypad_platform_data {
41 int (*init)(void);
42 int (*exit)(void);
43 const struct matrix_keymap_data *keymap_data;
44 u8 krow;
45 u8 kcol;
46 u8 debounce_ms;
47 bool no_autorepeat;
48 bool wakeup_enable;
49};
50#endif /*__SKE_KPD_H*/
diff --git a/include/linux/platform_data/keypad-omap.h b/include/linux/platform_data/keypad-omap.h
new file mode 100644
index 000000000000..a6b21eddb212
--- /dev/null
+++ b/include/linux/platform_data/keypad-omap.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/plat-omap/include/mach/keypad.h
3 *
4 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASMARM_ARCH_KEYPAD_H
11#define ASMARM_ARCH_KEYPAD_H
12
13#ifndef CONFIG_ARCH_OMAP1
14#warning Please update the board to use matrix-keypad driver
15#define omap_readw(reg) 0
16#define omap_writew(val, reg) do {} while (0)
17#endif
18#include <linux/input/matrix_keypad.h>
19
20struct omap_kp_platform_data {
21 int rows;
22 int cols;
23 const struct matrix_keymap_data *keymap_data;
24 bool rep;
25 unsigned long delay;
26 bool dbounce;
27 /* specific to OMAP242x*/
28 unsigned int *row_gpios;
29 unsigned int *col_gpios;
30};
31
32/* Group (0..3) -- when multiple keys are pressed, only the
33 * keys pressed in the same group are considered as pressed. This is
34 * in order to workaround certain crappy HW designs that produce ghost
35 * keypresses. Two free bits, not used by neither row/col nor keynum,
36 * must be available for use as group bits. The below GROUP_SHIFT
37 * macro definition is based on some prior knowledge of the
38 * matrix_keypad defined KEY() macro internals.
39 */
40#define GROUP_SHIFT 14
41#define GROUP_0 (0 << GROUP_SHIFT)
42#define GROUP_1 (1 << GROUP_SHIFT)
43#define GROUP_2 (2 << GROUP_SHIFT)
44#define GROUP_3 (3 << GROUP_SHIFT)
45#define GROUP_MASK GROUP_3
46#if KEY_MAX & GROUP_MASK
47#error Group bits in conflict with keynum bits
48#endif
49
50
51#endif
52
diff --git a/include/linux/platform_data/keypad-pxa27x.h b/include/linux/platform_data/keypad-pxa27x.h
new file mode 100644
index 000000000000..5ce8d5e6ea51
--- /dev/null
+++ b/include/linux/platform_data/keypad-pxa27x.h
@@ -0,0 +1,73 @@
1#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
2#define __ASM_ARCH_PXA27x_KEYPAD_H
3
4#include <linux/input.h>
5#include <linux/input/matrix_keypad.h>
6
7#define MAX_MATRIX_KEY_ROWS (8)
8#define MAX_MATRIX_KEY_COLS (8)
9#define MATRIX_ROW_SHIFT (3)
10#define MAX_DIRECT_KEY_NUM (8)
11
12/* pxa3xx keypad platform specific parameters
13 *
14 * NOTE:
15 * 1. direct_key_num indicates the number of keys in the direct keypad
16 * _plus_ the number of rotary-encoder sensor inputs, this can be
17 * left as 0 if only rotary encoders are enabled, the driver will
18 * automatically calculate this
19 *
20 * 2. direct_key_map is the key code map for the direct keys, if rotary
21 * encoder(s) are enabled, direct key 0/1(2/3) will be ignored
22 *
23 * 3. rotary can be either interpreted as a relative input event (e.g.
24 * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
25 *
26 * 4. matrix key and direct key will use the same debounce_interval by
27 * default, which should be sufficient in most cases
28 *
29 * pxa168 keypad platform specific parameter
30 *
31 * NOTE:
32 * clear_wakeup_event callback is a workaround required to clear the
33 * keypad interrupt. The keypad wake must be cleared in addition to
34 * reading the MI/DI bits in the KPC register.
35 */
36struct pxa27x_keypad_platform_data {
37
38 /* code map for the matrix keys */
39 unsigned int matrix_key_rows;
40 unsigned int matrix_key_cols;
41 unsigned int *matrix_key_map;
42 int matrix_key_map_size;
43
44 /* direct keys */
45 int direct_key_num;
46 unsigned int direct_key_map[MAX_DIRECT_KEY_NUM];
47 /* the key output may be low active */
48 int direct_key_low_active;
49 /* give board a chance to choose the start direct key */
50 unsigned int direct_key_mask;
51
52 /* rotary encoders 0 */
53 int enable_rotary0;
54 int rotary0_rel_code;
55 int rotary0_up_key;
56 int rotary0_down_key;
57
58 /* rotary encoders 1 */
59 int enable_rotary1;
60 int rotary1_rel_code;
61 int rotary1_up_key;
62 int rotary1_down_key;
63
64 /* key debounce interval */
65 unsigned int debounce_interval;
66
67 /* clear wakeup event requirement for pxa168 */
68 void (*clear_wakeup_event)(void);
69};
70
71extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
72
73#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
diff --git a/include/linux/platform_data/keypad-w90p910.h b/include/linux/platform_data/keypad-w90p910.h
new file mode 100644
index 000000000000..556778e8ddaa
--- /dev/null
+++ b/include/linux/platform_data/keypad-w90p910.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_ARCH_W90P910_KEYPAD_H
2#define __ASM_ARCH_W90P910_KEYPAD_H
3
4#include <linux/input/matrix_keypad.h>
5
6extern void mfp_set_groupi(struct device *dev);
7
8struct w90p910_keypad_platform_data {
9 const struct matrix_keymap_data *keymap_data;
10
11 unsigned int prescale;
12 unsigned int debounce;
13};
14
15#endif /* __ASM_ARCH_W90P910_KEYPAD_H */
diff --git a/include/linux/platform_data/keyscan-davinci.h b/include/linux/platform_data/keyscan-davinci.h
new file mode 100644
index 000000000000..7a560e05bda8
--- /dev/null
+++ b/include/linux/platform_data/keyscan-davinci.h
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 2009 Texas Instruments, Inc
3 *
4 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef DAVINCI_KEYSCAN_H
22#define DAVINCI_KEYSCAN_H
23
24#include <linux/io.h>
25
26enum davinci_matrix_types {
27 DAVINCI_KEYSCAN_MATRIX_4X4,
28 DAVINCI_KEYSCAN_MATRIX_5X3,
29};
30
31struct davinci_ks_platform_data {
32 int (*device_enable)(struct device *dev);
33 unsigned short *keymap;
34 u32 keymapsize;
35 u8 rep:1;
36 u8 strobe;
37 u8 interval;
38 u8 matrix_type;
39};
40
41#endif
42
diff --git a/include/linux/platform_data/lcd-mipid.h b/include/linux/platform_data/lcd-mipid.h
new file mode 100644
index 000000000000..8e52c6572281
--- /dev/null
+++ b/include/linux/platform_data/lcd-mipid.h
@@ -0,0 +1,29 @@
1#ifndef __LCD_MIPID_H
2#define __LCD_MIPID_H
3
4enum mipid_test_num {
5 MIPID_TEST_RGB_LINES,
6};
7
8enum mipid_test_result {
9 MIPID_TEST_SUCCESS,
10 MIPID_TEST_INVALID,
11 MIPID_TEST_FAILED,
12};
13
14#ifdef __KERNEL__
15
16struct mipid_platform_data {
17 int nreset_gpio;
18 int data_lines;
19
20 void (*shutdown)(struct mipid_platform_data *pdata);
21 void (*set_bklight_level)(struct mipid_platform_data *pdata,
22 int level);
23 int (*get_bklight_level)(struct mipid_platform_data *pdata);
24 int (*get_bklight_max)(struct mipid_platform_data *pdata);
25};
26
27#endif
28
29#endif
diff --git a/include/linux/platform_data/leds-kirkwood-netxbig.h b/include/linux/platform_data/leds-kirkwood-netxbig.h
new file mode 100644
index 000000000000..24b536ebdf13
--- /dev/null
+++ b/include/linux/platform_data/leds-kirkwood-netxbig.h
@@ -0,0 +1,55 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/leds-netxbig.h
3 *
4 * Platform data structure for netxbig LED driver
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MACH_LEDS_NETXBIG_H
12#define __MACH_LEDS_NETXBIG_H
13
14struct netxbig_gpio_ext {
15 unsigned *addr;
16 int num_addr;
17 unsigned *data;
18 int num_data;
19 unsigned enable;
20};
21
22enum netxbig_led_mode {
23 NETXBIG_LED_OFF,
24 NETXBIG_LED_ON,
25 NETXBIG_LED_SATA,
26 NETXBIG_LED_TIMER1,
27 NETXBIG_LED_TIMER2,
28 NETXBIG_LED_MODE_NUM,
29};
30
31#define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM
32
33struct netxbig_led_timer {
34 unsigned long delay_on;
35 unsigned long delay_off;
36 enum netxbig_led_mode mode;
37};
38
39struct netxbig_led {
40 const char *name;
41 const char *default_trigger;
42 int mode_addr;
43 int *mode_val;
44 int bright_addr;
45};
46
47struct netxbig_led_platform_data {
48 struct netxbig_gpio_ext *gpio_ext;
49 struct netxbig_led_timer *timer;
50 int num_timer;
51 struct netxbig_led *leds;
52 int num_leds;
53};
54
55#endif /* __MACH_LEDS_NETXBIG_H */
diff --git a/include/linux/platform_data/leds-kirkwood-ns2.h b/include/linux/platform_data/leds-kirkwood-ns2.h
new file mode 100644
index 000000000000..e21272e5f668
--- /dev/null
+++ b/include/linux/platform_data/leds-kirkwood-ns2.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/leds-ns2.h
3 *
4 * Platform data structure for Network Space v2 LED driver
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MACH_LEDS_NS2_H
12#define __MACH_LEDS_NS2_H
13
14struct ns2_led {
15 const char *name;
16 const char *default_trigger;
17 unsigned cmd;
18 unsigned slow;
19};
20
21struct ns2_led_platform_data {
22 int num_leds;
23 struct ns2_led *leds;
24};
25
26#endif /* __MACH_LEDS_NS2_H */
diff --git a/include/linux/platform_data/leds-s3c24xx.h b/include/linux/platform_data/leds-s3c24xx.h
new file mode 100644
index 000000000000..d8a7672519b6
--- /dev/null
+++ b/include/linux/platform_data/leds-s3c24xx.h
@@ -0,0 +1,28 @@
1/* arch/arm/mach-s3c2410/include/mach/leds-gpio.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C24XX - LEDs GPIO connector
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#ifndef __ASM_ARCH_LEDSGPIO_H
15#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h"
16
17#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
18#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
19
20struct s3c24xx_led_platdata {
21 unsigned int gpio;
22 unsigned int flags;
23
24 char *name;
25 char *def_trigger;
26};
27
28#endif /* __ASM_ARCH_LEDSGPIO_H */
diff --git a/include/linux/platform_data/lm3630_bl.h b/include/linux/platform_data/lm3630_bl.h
new file mode 100644
index 000000000000..9176dd3f2d63
--- /dev/null
+++ b/include/linux/platform_data/lm3630_bl.h
@@ -0,0 +1,57 @@
1/*
2* Simple driver for Texas Instruments LM3630 LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3630_H
12#define __LINUX_LM3630_H
13
14#define LM3630_NAME "lm3630_bl"
15
16enum lm3630_pwm_ctrl {
17 PWM_CTRL_DISABLE = 0,
18 PWM_CTRL_BANK_A,
19 PWM_CTRL_BANK_B,
20 PWM_CTRL_BANK_ALL,
21};
22
23enum lm3630_pwm_active {
24 PWM_ACTIVE_HIGH = 0,
25 PWM_ACTIVE_LOW,
26};
27
28enum lm3630_bank_a_ctrl {
29 BANK_A_CTRL_DISABLE = 0x0,
30 BANK_A_CTRL_LED1 = 0x4,
31 BANK_A_CTRL_LED2 = 0x1,
32 BANK_A_CTRL_ALL = 0x5,
33};
34
35enum lm3630_bank_b_ctrl {
36 BANK_B_CTRL_DISABLE = 0,
37 BANK_B_CTRL_LED2,
38};
39
40struct lm3630_platform_data {
41
42 /* maximum brightness */
43 int max_brt_led1;
44 int max_brt_led2;
45
46 /* initial on brightness */
47 int init_brt_led1;
48 int init_brt_led2;
49 enum lm3630_pwm_ctrl pwm_ctrl;
50 enum lm3630_pwm_active pwm_active;
51 enum lm3630_bank_a_ctrl bank_a_ctrl;
52 enum lm3630_bank_b_ctrl bank_b_ctrl;
53 unsigned int pwm_period;
54 void (*pwm_set_intensity) (int brightness, int max_brightness);
55};
56
57#endif /* __LINUX_LM3630_H */
diff --git a/include/linux/platform_data/lm3639_bl.h b/include/linux/platform_data/lm3639_bl.h
new file mode 100644
index 000000000000..5234cd5ed166
--- /dev/null
+++ b/include/linux/platform_data/lm3639_bl.h
@@ -0,0 +1,69 @@
1/*
2* Simple driver for Texas Instruments LM3630 LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3639_H
12#define __LINUX_LM3639_H
13
14#define LM3639_NAME "lm3639_bl"
15
16enum lm3639_pwm {
17 LM3639_PWM_DISABLE = 0x00,
18 LM3639_PWM_EN_ACTLOW = 0x48,
19 LM3639_PWM_EN_ACTHIGH = 0x40,
20};
21
22enum lm3639_strobe {
23 LM3639_STROBE_DISABLE = 0x00,
24 LM3639_STROBE_EN_ACTLOW = 0x10,
25 LM3639_STROBE_EN_ACTHIGH = 0x30,
26};
27
28enum lm3639_txpin {
29 LM3639_TXPIN_DISABLE = 0x00,
30 LM3639_TXPIN_EN_ACTLOW = 0x04,
31 LM3639_TXPIN_EN_ACTHIGH = 0x0C,
32};
33
34enum lm3639_fleds {
35 LM3639_FLED_DIASBLE_ALL = 0x00,
36 LM3639_FLED_EN_1 = 0x40,
37 LM3639_FLED_EN_2 = 0x20,
38 LM3639_FLED_EN_ALL = 0x60,
39};
40
41enum lm3639_bleds {
42 LM3639_BLED_DIASBLE_ALL = 0x00,
43 LM3639_BLED_EN_1 = 0x10,
44 LM3639_BLED_EN_2 = 0x08,
45 LM3639_BLED_EN_ALL = 0x18,
46};
47enum lm3639_bled_mode {
48 LM3639_BLED_MODE_EXPONETIAL = 0x00,
49 LM3639_BLED_MODE_LINEAR = 0x10,
50};
51
52struct lm3639_platform_data {
53 unsigned int max_brt_led;
54 unsigned int init_brt_led;
55
56 /* input pins */
57 enum lm3639_pwm pin_pwm;
58 enum lm3639_strobe pin_strobe;
59 enum lm3639_txpin pin_tx;
60
61 /* output pins */
62 enum lm3639_fleds fled_pins;
63 enum lm3639_bleds bled_pins;
64 enum lm3639_bled_mode bled_mode;
65
66 void (*pwm_set_intensity) (int brightness, int max_brightness);
67 int (*pwm_get_intensity) (void);
68};
69#endif /* __LINUX_LM3639_H */
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index cc76f1f18f18..761f31752367 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -46,6 +46,8 @@
46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ 46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
47 (LP8556_I2C_ONLY << BRT_MODE_SHFT)) 47 (LP8556_I2C_ONLY << BRT_MODE_SHFT))
48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) 48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT)
49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained
50 when exiting the low power mode */
49 51
50enum lp855x_chip_id { 52enum lp855x_chip_id {
51 LP8550, 53 LP8550,
diff --git a/include/linux/platform_data/lp8727.h b/include/linux/platform_data/lp8727.h
index ea98c6133d32..47128a50e04e 100644
--- a/include/linux/platform_data/lp8727.h
+++ b/include/linux/platform_data/lp8727.h
@@ -13,32 +13,32 @@
13#define _LP8727_H 13#define _LP8727_H
14 14
15enum lp8727_eoc_level { 15enum lp8727_eoc_level {
16 EOC_5P, 16 LP8727_EOC_5P,
17 EOC_10P, 17 LP8727_EOC_10P,
18 EOC_16P, 18 LP8727_EOC_16P,
19 EOC_20P, 19 LP8727_EOC_20P,
20 EOC_25P, 20 LP8727_EOC_25P,
21 EOC_33P, 21 LP8727_EOC_33P,
22 EOC_50P, 22 LP8727_EOC_50P,
23}; 23};
24 24
25enum lp8727_ichg { 25enum lp8727_ichg {
26 ICHG_90mA, 26 LP8727_ICHG_90mA,
27 ICHG_100mA, 27 LP8727_ICHG_100mA,
28 ICHG_400mA, 28 LP8727_ICHG_400mA,
29 ICHG_450mA, 29 LP8727_ICHG_450mA,
30 ICHG_500mA, 30 LP8727_ICHG_500mA,
31 ICHG_600mA, 31 LP8727_ICHG_600mA,
32 ICHG_700mA, 32 LP8727_ICHG_700mA,
33 ICHG_800mA, 33 LP8727_ICHG_800mA,
34 ICHG_900mA, 34 LP8727_ICHG_900mA,
35 ICHG_1000mA, 35 LP8727_ICHG_1000mA,
36}; 36};
37 37
38/** 38/**
39 * struct lp8727_chg_param 39 * struct lp8727_chg_param
40 * @eoc_level : end of charge level setting 40 * @eoc_level : end of charge level setting
41 * @ichg : charging current 41 * @ichg : charging current
42 */ 42 */
43struct lp8727_chg_param { 43struct lp8727_chg_param {
44 enum lp8727_eoc_level eoc_level; 44 enum lp8727_eoc_level eoc_level;
@@ -47,19 +47,22 @@ struct lp8727_chg_param {
47 47
48/** 48/**
49 * struct lp8727_platform_data 49 * struct lp8727_platform_data
50 * @get_batt_present : check battery status - exists or not 50 * @get_batt_present : check battery status - exists or not
51 * @get_batt_level : get battery voltage (mV) 51 * @get_batt_level : get battery voltage (mV)
52 * @get_batt_capacity : get battery capacity (%) 52 * @get_batt_capacity : get battery capacity (%)
53 * @get_batt_temp : get battery temperature 53 * @get_batt_temp : get battery temperature
54 * @ac, @usb : charging parameters each charger type 54 * @ac : charging parameters for AC type charger
55 * @usb : charging parameters for USB type charger
56 * @debounce_msec : interrupt debounce time
55 */ 57 */
56struct lp8727_platform_data { 58struct lp8727_platform_data {
57 u8 (*get_batt_present)(void); 59 u8 (*get_batt_present)(void);
58 u16 (*get_batt_level)(void); 60 u16 (*get_batt_level)(void);
59 u8 (*get_batt_capacity)(void); 61 u8 (*get_batt_capacity)(void);
60 u8 (*get_batt_temp)(void); 62 u8 (*get_batt_temp)(void);
61 struct lp8727_chg_param ac; 63 struct lp8727_chg_param *ac;
62 struct lp8727_chg_param usb; 64 struct lp8727_chg_param *usb;
65 unsigned int debounce_msec;
63}; 66};
64 67
65#endif 68#endif
diff --git a/include/linux/platform_data/max197.h b/include/linux/platform_data/max197.h
new file mode 100644
index 000000000000..e2a41dd7690c
--- /dev/null
+++ b/include/linux/platform_data/max197.h
@@ -0,0 +1,21 @@
1/*
2 * Maxim MAX197 A/D Converter Driver
3 *
4 * Copyright (c) 2012 Savoir-faire Linux Inc.
5 * Vivien Didelot <vivien.didelot@savoirfairelinux.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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * For further information, see the Documentation/hwmon/max197 file.
12 */
13
14/**
15 * struct max197_platform_data - MAX197 connectivity info
16 * @convert: Function used to start a conversion with control byte ctrl.
17 * It must return the raw data, or a negative error code.
18 */
19struct max197_platform_data {
20 int (*convert)(u8 ctrl);
21};
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
new file mode 100644
index 000000000000..91648bf5fc5c
--- /dev/null
+++ b/include/linux/platform_data/max310x.h
@@ -0,0 +1,67 @@
1/*
2 * Maxim (Dallas) MAX3107/8 serial driver
3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * Based on max3100.c, by Christian Pellegrin <chripell@evolware.org>
7 * Based on max3110.c, by Feng Tang <feng.tang@intel.com>
8 * Based on max3107.c, by Aavamobile
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
16#ifndef _MAX310X_H_
17#define _MAX310X_H_
18
19/*
20 * Example board initialization data:
21 *
22 * static struct max310x_pdata max3107_pdata = {
23 * .driver_flags = MAX310X_EXT_CLK,
24 * .uart_flags[0] = MAX310X_ECHO_SUPRESS | MAX310X_AUTO_DIR_CTRL,
25 * .frequency = 3686400,
26 * .gpio_base = -1,
27 * };
28 *
29 * static struct spi_board_info spi_device_max3107[] = {
30 * {
31 * .modalias = "max3107",
32 * .irq = IRQ_EINT3,
33 * .bus_num = 1,
34 * .chip_select = 1,
35 * .platform_data = &max3107_pdata,
36 * },
37 * };
38 */
39
40#define MAX310X_MAX_UARTS 1
41
42/* MAX310X platform data structure */
43struct max310x_pdata {
44 /* Flags global to driver */
45 const u8 driver_flags:2;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47#define MAX310X_AUTOSLEEP (0x00000002) /* Enable AutoSleep mode */
48 /* Flags global to UART port */
49 const u8 uart_flags[MAX310X_MAX_UARTS];
50#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
51#define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */
52#define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction
53 * control (RS-485)
54 */
55 /* Frequency (extrenal clock or crystal) */
56 const int frequency;
57 /* GPIO base number (can be negative) */
58 const int gpio_base;
59 /* Called during startup */
60 void (*init)(void);
61 /* Called before finish */
62 void (*exit)(void);
63 /* Suspend callback */
64 void (*suspend)(int do_suspend);
65};
66
67#endif
diff --git a/include/linux/platform_data/mfd-mcp-sa11x0.h b/include/linux/platform_data/mfd-mcp-sa11x0.h
new file mode 100644
index 000000000000..4b2860ae3828
--- /dev/null
+++ b/include/linux/platform_data/mfd-mcp-sa11x0.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/mcp.h
3 *
4 * Copyright (C) 2005 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef __ASM_ARM_ARCH_MCP_H
11#define __ASM_ARM_ARCH_MCP_H
12
13#include <linux/types.h>
14
15struct mcp_plat_data {
16 u32 mccr0;
17 u32 mccr1;
18 unsigned int sclk_rate;
19 void *codec_pdata;
20};
21
22#endif
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
new file mode 100644
index 000000000000..c45b1e8d4c2e
--- /dev/null
+++ b/include/linux/platform_data/mipi-csis.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd.
3 *
4 * S5P series MIPI CSI slave device support
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 __PLAT_SAMSUNG_MIPI_CSIS_H_
12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
13
14struct platform_device;
15
16/**
17 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
18 * @clk_rate: bus clock frequency
19 * @lanes: number of data lanes used
20 * @alignment: data alignment in bits
21 * @hs_settle: HS-RX settle time
22 * @fixed_phy_vdd: false to enable external D-PHY regulator management in the
23 * driver or true in case this regulator has no enable function
24 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
25 */
26struct s5p_platform_mipi_csis {
27 unsigned long clk_rate;
28 u8 lanes;
29 u8 alignment;
30 u8 hs_settle;
31 bool fixed_phy_vdd;
32 int (*phy_enable)(struct platform_device *pdev, bool on);
33};
34
35/**
36 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
37 * @pdev: MIPI-CSIS platform device
38 * @on: true to enable D-PHY and deassert its reset
39 * false to disable D-PHY
40 */
41int s5p_csis_phy_enable(struct platform_device *pdev, bool on);
42
43#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h
new file mode 100644
index 000000000000..5ba6b22ce338
--- /dev/null
+++ b/include/linux/platform_data/mmc-davinci.h
@@ -0,0 +1,39 @@
1/*
2 * Board-specific MMC configuration
3 */
4
5#ifndef _DAVINCI_MMC_H
6#define _DAVINCI_MMC_H
7
8#include <linux/types.h>
9#include <linux/mmc/host.h>
10
11struct davinci_mmc_config {
12 /* get_cd()/get_wp() may sleep */
13 int (*get_cd)(int module);
14 int (*get_ro)(int module);
15
16 void (*set_power)(int module, bool on);
17
18 /* wires == 0 is equivalent to wires == 4 (4-bit parallel) */
19 u8 wires;
20
21 u32 max_freq;
22
23 /* any additional host capabilities: OR'd in to mmc->f_caps */
24 u32 caps;
25
26 /* Version of the MMC/SD controller */
27 u8 version;
28
29 /* Number of sg segments */
30 u8 nr_sg;
31};
32void davinci_setup_mmc(int module, struct davinci_mmc_config *config);
33
34enum {
35 MMC_CTLR_VERSION_1 = 0, /* DM644x and DM355 */
36 MMC_CTLR_VERSION_2, /* DA830 */
37};
38
39#endif
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
new file mode 100644
index 000000000000..aaf97481f413
--- /dev/null
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright 2010 Wolfram Sang <w.sang@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; version 2
7 * of the License.
8 */
9
10#ifndef __ASM_ARCH_IMX_ESDHC_H
11#define __ASM_ARCH_IMX_ESDHC_H
12
13enum wp_types {
14 ESDHC_WP_NONE, /* no WP, neither controller nor gpio */
15 ESDHC_WP_CONTROLLER, /* mmc controller internal WP */
16 ESDHC_WP_GPIO, /* external gpio pin for WP */
17};
18
19enum cd_types {
20 ESDHC_CD_NONE, /* no CD, neither controller nor gpio */
21 ESDHC_CD_CONTROLLER, /* mmc controller internal CD */
22 ESDHC_CD_GPIO, /* external gpio pin for CD */
23 ESDHC_CD_PERMANENT, /* no CD, card permanently wired to host */
24};
25
26/**
27 * struct esdhc_platform_data - platform data for esdhc on i.MX
28 *
29 * ESDHC_WP(CD)_CONTROLLER type is not available on i.MX25/35.
30 *
31 * @wp_gpio: gpio for write_protect
32 * @cd_gpio: gpio for card_detect interrupt
33 * @wp_type: type of write_protect method (see wp_types enum above)
34 * @cd_type: type of card_detect method (see cd_types enum above)
35 */
36
37struct esdhc_platform_data {
38 unsigned int wp_gpio;
39 unsigned int cd_gpio;
40 enum wp_types wp_type;
41 enum cd_types cd_type;
42};
43#endif /* __ASM_ARCH_IMX_ESDHC_H */
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
new file mode 100644
index 000000000000..ffcd9e3a6a7e
--- /dev/null
+++ b/include/linux/platform_data/mmc-msm_sdcc.h
@@ -0,0 +1,30 @@
1/*
2 * arch/arm/include/asm/mach/mmc.h
3 */
4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H
6
7#include <linux/mmc/host.h>
8#include <linux/mmc/card.h>
9#include <linux/mmc/sdio_func.h>
10
11struct msm_mmc_gpio {
12 unsigned no;
13 const char *name;
14};
15
16struct msm_mmc_gpio_data {
17 struct msm_mmc_gpio *gpio;
18 u8 size;
19};
20
21struct msm_mmc_platform_data {
22 unsigned int ocr_mask; /* available voltages */
23 u32 (*translate_vdd)(struct device *, unsigned int);
24 unsigned int (*status)(struct device *);
25 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
26 struct msm_mmc_gpio_data *gpio_data;
27 void (*init_card)(struct mmc_card *card);
28};
29
30#endif
diff --git a/include/linux/platform_data/mmc-mvsdio.h b/include/linux/platform_data/mmc-mvsdio.h
new file mode 100644
index 000000000000..1190efedcb94
--- /dev/null
+++ b/include/linux/platform_data/mmc-mvsdio.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/plat-orion/include/plat/mvsdio.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __MACH_MVSDIO_H
10#define __MACH_MVSDIO_H
11
12#include <linux/mbus.h>
13
14struct mvsdio_platform_data {
15 unsigned int clock;
16 int gpio_card_detect;
17 int gpio_write_protect;
18};
19
20#endif
diff --git a/include/linux/platform_data/mmc-mxcmmc.h b/include/linux/platform_data/mmc-mxcmmc.h
new file mode 100644
index 000000000000..29115f405af9
--- /dev/null
+++ b/include/linux/platform_data/mmc-mxcmmc.h
@@ -0,0 +1,39 @@
1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H
3
4#include <linux/mmc/host.h>
5
6struct device;
7
8/* board specific SDHC data, optional.
9 * If not present, a writable card with 3,3V is assumed.
10 */
11struct imxmmc_platform_data {
12 /* Return values for the get_ro callback should be:
13 * 0 for a read/write card
14 * 1 for a read-only card
15 * -ENOSYS when not supported (equal to NULL callback)
16 * or a negative errno value when something bad happened
17 */
18 int (*get_ro)(struct device *);
19
20 /* board specific hook to (de)initialize the SD slot.
21 * The board code can call 'handler' on a card detection
22 * change giving data as argument.
23 */
24 int (*init)(struct device *dev, irq_handler_t handler, void *data);
25 void (*exit)(struct device *dev, void *data);
26
27 /* available voltages. If not given, assume
28 * MMC_VDD_32_33 | MMC_VDD_33_34
29 */
30 unsigned int ocr_avail;
31
32 /* adjust slot voltage */
33 void (*setpower)(struct device *, unsigned int vdd);
34
35 /* enable card detect using DAT3 */
36 int dat3_card_detect;
37};
38
39#endif
diff --git a/include/linux/platform_data/mmc-pxamci.h b/include/linux/platform_data/mmc-pxamci.h
new file mode 100644
index 000000000000..9eb515bb799d
--- /dev/null
+++ b/include/linux/platform_data/mmc-pxamci.h
@@ -0,0 +1,28 @@
1#ifndef ASMARM_ARCH_MMC_H
2#define ASMARM_ARCH_MMC_H
3
4#include <linux/mmc/host.h>
5#include <linux/interrupt.h>
6
7struct device;
8struct mmc_host;
9
10struct pxamci_platform_data {
11 unsigned int ocr_mask; /* available voltages */
12 unsigned long detect_delay_ms; /* delay in millisecond before detecting cards after interrupt */
13 int (*init)(struct device *, irq_handler_t , void *);
14 int (*get_ro)(struct device *);
15 void (*setpower)(struct device *, unsigned int);
16 void (*exit)(struct device *, void *);
17 int gpio_card_detect; /* gpio detecting card insertion */
18 int gpio_card_ro; /* gpio detecting read only toggle */
19 bool gpio_card_ro_invert; /* gpio ro is inverted */
20 int gpio_power; /* gpio powering up MMC bus */
21 bool gpio_power_invert; /* gpio power is inverted */
22};
23
24extern void pxa_set_mci_info(struct pxamci_platform_data *info);
25extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info);
26extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);
27
28#endif
diff --git a/include/linux/platform_data/mmc-s3cmci.h b/include/linux/platform_data/mmc-s3cmci.h
new file mode 100644
index 000000000000..c42d31711944
--- /dev/null
+++ b/include/linux/platform_data/mmc-s3cmci.h
@@ -0,0 +1,52 @@
1#ifndef _ARCH_MCI_H
2#define _ARCH_MCI_H
3
4/**
5 * struct s3c24xx_mci_pdata - sd/mmc controller platform data
6 * @no_wprotect: Set this to indicate there is no write-protect switch.
7 * @no_detect: Set this if there is no detect switch.
8 * @wprotect_invert: Invert the default sense of the write protect switch.
9 * @detect_invert: Invert the default sense of the write protect switch.
10 * @use_dma: Set to allow the use of DMA.
11 * @gpio_detect: GPIO number for the card detect line.
12 * @gpio_wprotect: GPIO number for the write protect line.
13 * @ocr_avail: The mask of the available power states, non-zero to use.
14 * @set_power: Callback to control the power mode.
15 *
16 * The @gpio_detect is used for card detection when @no_wprotect is unset,
17 * and the default sense is that 0 returned from gpio_get_value() means
18 * that a card is inserted. If @detect_invert is set, then the value from
19 * gpio_get_value() is inverted, which makes 1 mean card inserted.
20 *
21 * The driver will use @gpio_wprotect to signal whether the card is write
22 * protected if @no_wprotect is not set. A 0 returned from gpio_get_value()
23 * means the card is read/write, and 1 means read-only. The @wprotect_invert
24 * will invert the value returned from gpio_get_value().
25 *
26 * Card power is set by @ocr_availa, using MCC_VDD_ constants if it is set
27 * to a non-zero value, otherwise the default of 3.2-3.4V is used.
28 */
29struct s3c24xx_mci_pdata {
30 unsigned int no_wprotect:1;
31 unsigned int no_detect:1;
32 unsigned int wprotect_invert:1;
33 unsigned int detect_invert:1; /* set => detect active high */
34 unsigned int use_dma:1;
35
36 unsigned int gpio_detect;
37 unsigned int gpio_wprotect;
38 unsigned long ocr_avail;
39 void (*set_power)(unsigned char power_mode,
40 unsigned short vdd);
41};
42
43/**
44 * s3c24xx_mci_set_platdata - set platform data for mmc/sdi device
45 * @pdata: The platform data
46 *
47 * Copy the platform data supplied by @pdata so that this can be marked
48 * __initdata.
49 */
50extern void s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata);
51
52#endif /* _ARCH_NCI_H */
diff --git a/include/linux/platform_data/mmc-sdhci-tegra.h b/include/linux/platform_data/mmc-sdhci-tegra.h
new file mode 100644
index 000000000000..8f8430697686
--- /dev/null
+++ b/include/linux/platform_data/mmc-sdhci-tegra.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2009 Palm, Inc.
3 * Author: Yvonne Yip <y@palm.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 __PLATFORM_DATA_TEGRA_SDHCI_H
16#define __PLATFORM_DATA_TEGRA_SDHCI_H
17
18#include <linux/mmc/host.h>
19
20struct tegra_sdhci_platform_data {
21 int cd_gpio;
22 int wp_gpio;
23 int power_gpio;
24 int is_8bit;
25 int pm_flags;
26};
27
28#endif
diff --git a/include/linux/platform_data/mouse-pxa930_trkball.h b/include/linux/platform_data/mouse-pxa930_trkball.h
new file mode 100644
index 000000000000..5e0789bc4729
--- /dev/null
+++ b/include/linux/platform_data/mouse-pxa930_trkball.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_ARCH_PXA930_TRKBALL_H
2#define __ASM_ARCH_PXA930_TRKBALL_H
3
4struct pxa930_trkball_platform_data {
5 int x_filter;
6 int y_filter;
7};
8
9#endif /* __ASM_ARCH_PXA930_TRKBALL_H */
10
diff --git a/include/linux/platform_data/mtd-davinci-aemif.h b/include/linux/platform_data/mtd-davinci-aemif.h
new file mode 100644
index 000000000000..05b293443097
--- /dev/null
+++ b/include/linux/platform_data/mtd-davinci-aemif.h
@@ -0,0 +1,36 @@
1/*
2 * TI DaVinci AEMIF support
3 *
4 * Copyright 2010 (C) Texas Instruments, Inc. http://www.ti.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 _MACH_DAVINCI_AEMIF_H
11#define _MACH_DAVINCI_AEMIF_H
12
13#define NRCSR_OFFSET 0x00
14#define AWCCR_OFFSET 0x04
15#define A1CR_OFFSET 0x10
16
17#define ACR_ASIZE_MASK 0x3
18#define ACR_EW_MASK BIT(30)
19#define ACR_SS_MASK BIT(31)
20
21/* All timings in nanoseconds */
22struct davinci_aemif_timing {
23 u8 wsetup;
24 u8 wstrobe;
25 u8 whold;
26
27 u8 rsetup;
28 u8 rstrobe;
29 u8 rhold;
30
31 u8 ta;
32};
33
34int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
35 void __iomem *base, unsigned cs);
36#endif
diff --git a/include/linux/platform_data/mtd-davinci.h b/include/linux/platform_data/mtd-davinci.h
new file mode 100644
index 000000000000..1cf555aef896
--- /dev/null
+++ b/include/linux/platform_data/mtd-davinci.h
@@ -0,0 +1,90 @@
1/*
2 * mach-davinci/nand.h
3 *
4 * Copyright © 2006 Texas Instruments.
5 *
6 * Ported to 2.6.23 Copyright © 2008 by
7 * Sander Huijsen <Shuijsen@optelecom-nkf.com>
8 * Troy Kisky <troy.kisky@boundarydevices.com>
9 * Dirk Behme <Dirk.Behme@gmail.com>
10 *
11 * --------------------------------------------------------------------------
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __ARCH_ARM_DAVINCI_NAND_H
29#define __ARCH_ARM_DAVINCI_NAND_H
30
31#include <linux/mtd/nand.h>
32
33#define NANDFCR_OFFSET 0x60
34#define NANDFSR_OFFSET 0x64
35#define NANDF1ECC_OFFSET 0x70
36
37/* 4-bit ECC syndrome registers */
38#define NAND_4BIT_ECC_LOAD_OFFSET 0xbc
39#define NAND_4BIT_ECC1_OFFSET 0xc0
40#define NAND_4BIT_ECC2_OFFSET 0xc4
41#define NAND_4BIT_ECC3_OFFSET 0xc8
42#define NAND_4BIT_ECC4_OFFSET 0xcc
43#define NAND_ERR_ADD1_OFFSET 0xd0
44#define NAND_ERR_ADD2_OFFSET 0xd4
45#define NAND_ERR_ERRVAL1_OFFSET 0xd8
46#define NAND_ERR_ERRVAL2_OFFSET 0xdc
47
48/* NOTE: boards don't need to use these address bits
49 * for ALE/CLE unless they support booting from NAND.
50 * They're used unless platform data overrides them.
51 */
52#define MASK_ALE 0x08
53#define MASK_CLE 0x10
54
55struct davinci_nand_pdata { /* platform_data */
56 uint32_t mask_ale;
57 uint32_t mask_cle;
58
59 /* for packages using two chipselects */
60 uint32_t mask_chipsel;
61
62 /* board's default static partition info */
63 struct mtd_partition *parts;
64 unsigned nr_parts;
65
66 /* none == NAND_ECC_NONE (strongly *not* advised!!)
67 * soft == NAND_ECC_SOFT
68 * else == NAND_ECC_HW, according to ecc_bits
69 *
70 * All DaVinci-family chips support 1-bit hardware ECC.
71 * Newer ones also support 4-bit ECC, but are awkward
72 * using it with large page chips.
73 */
74 nand_ecc_modes_t ecc_mode;
75 u8 ecc_bits;
76
77 /* e.g. NAND_BUSWIDTH_16 */
78 unsigned options;
79 /* e.g. NAND_BBT_USE_FLASH */
80 unsigned bbt_options;
81
82 /* Main and mirror bbt descriptor overrides */
83 struct nand_bbt_descr *bbt_td;
84 struct nand_bbt_descr *bbt_md;
85
86 /* Access timings */
87 struct davinci_aemif_timing *timing;
88};
89
90#endif /* __ARCH_ARM_DAVINCI_NAND_H */
diff --git a/include/linux/platform_data/mtd-mxc_nand.h b/include/linux/platform_data/mtd-mxc_nand.h
new file mode 100644
index 000000000000..6bb96ef1600b
--- /dev/null
+++ b/include/linux/platform_data/mtd-mxc_nand.h
@@ -0,0 +1,32 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#ifndef __ASM_ARCH_NAND_H
21#define __ASM_ARCH_NAND_H
22
23#include <linux/mtd/partitions.h>
24
25struct mxc_nand_platform_data {
26 unsigned int width; /* data bus width in bytes */
27 unsigned int hw_ecc:1; /* 0 if suppress hardware ECC */
28 unsigned int flash_bbt:1; /* set to 1 to use a flash based bbt */
29 struct mtd_partition *parts; /* partition table */
30 int nr_parts; /* size of parts */
31};
32#endif /* __ASM_ARCH_NAND_H */
diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
new file mode 100644
index 000000000000..1a68c1e5fe53
--- /dev/null
+++ b/include/linux/platform_data/mtd-nand-omap2.h
@@ -0,0 +1,43 @@
1/*
2 * arch/arm/plat-omap/include/mach/nand.h
3 *
4 * Copyright (C) 2006 Micron Technology 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#include <plat/gpmc.h>
12#include <linux/mtd/partitions.h>
13
14enum nand_io {
15 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
16 NAND_OMAP_POLLED, /* polled mode, without prefetch */
17 NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */
18 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
19};
20
21struct omap_nand_platform_data {
22 int cs;
23 struct mtd_partition *parts;
24 struct gpmc_timings *gpmc_t;
25 int nr_parts;
26 bool dev_ready;
27 enum nand_io xfer_type;
28 int devsize;
29 enum omap_ecc ecc_opt;
30 struct gpmc_nand_regs reg;
31};
32
33/* minimum size for IO mapping */
34#define NAND_IO_SIZE 4
35
36#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
37extern int gpmc_nand_init(struct omap_nand_platform_data *d);
38#else
39static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
40{
41 return 0;
42}
43#endif
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
new file mode 100644
index 000000000000..c42f39f20195
--- /dev/null
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -0,0 +1,79 @@
1#ifndef __ASM_ARCH_PXA3XX_NAND_H
2#define __ASM_ARCH_PXA3XX_NAND_H
3
4#include <linux/mtd/mtd.h>
5#include <linux/mtd/partitions.h>
6
7struct pxa3xx_nand_timing {
8 unsigned int tCH; /* Enable signal hold time */
9 unsigned int tCS; /* Enable signal setup time */
10 unsigned int tWH; /* ND_nWE high duration */
11 unsigned int tWP; /* ND_nWE pulse time */
12 unsigned int tRH; /* ND_nRE high duration */
13 unsigned int tRP; /* ND_nRE pulse width */
14 unsigned int tR; /* ND_nWE high to ND_nRE low for read */
15 unsigned int tWHR; /* ND_nWE high to ND_nRE low for status read */
16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */
17};
18
19struct pxa3xx_nand_cmdset {
20 uint16_t read1;
21 uint16_t read2;
22 uint16_t program;
23 uint16_t read_status;
24 uint16_t read_id;
25 uint16_t erase;
26 uint16_t reset;
27 uint16_t lock;
28 uint16_t unlock;
29 uint16_t lock_status;
30};
31
32struct pxa3xx_nand_flash {
33 char *name;
34 uint32_t chip_id;
35 unsigned int page_per_block; /* Pages per block (PG_PER_BLK) */
36 unsigned int page_size; /* Page size in bytes (PAGE_SZ) */
37 unsigned int flash_width; /* Width of Flash memory (DWIDTH_M) */
38 unsigned int dfc_width; /* Width of flash controller(DWIDTH_C) */
39 unsigned int num_blocks; /* Number of physical blocks in Flash */
40
41 struct pxa3xx_nand_timing *timing; /* NAND Flash timing */
42};
43
44/*
45 * Current pxa3xx_nand controller has two chip select which
46 * both be workable.
47 *
48 * Notice should be taken that:
49 * When you want to use this feature, you should not enable the
50 * keep configuration feature, for two chip select could be
51 * attached with different nand chip. The different page size
52 * and timing requirement make the keep configuration impossible.
53 */
54
55/* The max num of chip select current support */
56#define NUM_CHIP_SELECT (2)
57struct pxa3xx_nand_platform_data {
58
59 /* the data flash bus is shared between the Static Memory
60 * Controller and the Data Flash Controller, the arbiter
61 * controls the ownership of the bus
62 */
63 int enable_arbiter;
64
65 /* allow platform code to keep OBM/bootloader defined NFC config */
66 int keep_config;
67
68 /* indicate how many chip selects will be used */
69 int num_cs;
70
71 const struct mtd_partition *parts[NUM_CHIP_SELECT];
72 unsigned int nr_parts[NUM_CHIP_SELECT];
73
74 const struct pxa3xx_nand_flash * flash;
75 size_t num_flash;
76};
77
78extern void pxa3xx_set_nand_info(struct pxa3xx_nand_platform_data *info);
79#endif /* __ASM_ARCH_PXA3XX_NAND_H */
diff --git a/include/linux/platform_data/mtd-nand-s3c2410.h b/include/linux/platform_data/mtd-nand-s3c2410.h
new file mode 100644
index 000000000000..b64115fa93a4
--- /dev/null
+++ b/include/linux/platform_data/mtd-nand-s3c2410.h
@@ -0,0 +1,67 @@
1/* arch/arm/mach-s3c2410/include/mach/nand.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 - NAND device controller platform_device info
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/**
14 * struct s3c2410_nand_set - define a set of one or more nand chips
15 * @disable_ecc: Entirely disable ECC - Dangerous
16 * @flash_bbt: Openmoko u-boot can create a Bad Block Table
17 * Setting this flag will allow the kernel to
18 * look for it at boot time and also skip the NAND
19 * scan.
20 * @options: Default value to set into 'struct nand_chip' options.
21 * @nr_chips: Number of chips in this set
22 * @nr_partitions: Number of partitions pointed to by @partitions
23 * @name: Name of set (optional)
24 * @nr_map: Map for low-layer logical to physical chip numbers (option)
25 * @partitions: The mtd partition list
26 *
27 * define a set of one or more nand chips registered with an unique mtd. Also
28 * allows to pass flag to the underlying NAND layer. 'disable_ecc' will trigger
29 * a warning at boot time.
30 */
31struct s3c2410_nand_set {
32 unsigned int disable_ecc:1;
33 unsigned int flash_bbt:1;
34
35 unsigned int options;
36 int nr_chips;
37 int nr_partitions;
38 char *name;
39 int *nr_map;
40 struct mtd_partition *partitions;
41 struct nand_ecclayout *ecc_layout;
42};
43
44struct s3c2410_platform_nand {
45 /* timing information for controller, all times in nanoseconds */
46
47 int tacls; /* time for active CLE/ALE to nWE/nOE */
48 int twrph0; /* active time for nWE/nOE */
49 int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */
50
51 unsigned int ignore_unset_ecc:1;
52
53 int nr_sets;
54 struct s3c2410_nand_set *sets;
55
56 void (*select_chip)(struct s3c2410_nand_set *,
57 int chip);
58};
59
60/**
61 * s3c_nand_set_platdata() - register NAND platform data.
62 * @nand: The NAND platform data to register with s3c_device_nand.
63 *
64 * This function copies the given NAND platform data, @nand and registers
65 * it with the s3c_device_nand. This allows @nand to be __initdata.
66*/
67extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
diff --git a/include/linux/platform_data/mtd-nomadik-nand.h b/include/linux/platform_data/mtd-nomadik-nand.h
new file mode 100644
index 000000000000..c3c8254c22a5
--- /dev/null
+++ b/include/linux/platform_data/mtd-nomadik-nand.h
@@ -0,0 +1,16 @@
1#ifndef __ASM_ARCH_NAND_H
2#define __ASM_ARCH_NAND_H
3
4struct nomadik_nand_platform_data {
5 struct mtd_partition *parts;
6 int nparts;
7 int options;
8 int (*init) (void);
9 int (*exit) (void);
10};
11
12#define NAND_IO_DATA 0x40000000
13#define NAND_IO_CMD 0x40800000
14#define NAND_IO_ADDR 0x41000000
15
16#endif /* __ASM_ARCH_NAND_H */
diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h
new file mode 100644
index 000000000000..2858667d2e4f
--- /dev/null
+++ b/include/linux/platform_data/mtd-onenand-omap2.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/plat-omap/include/mach/onenand.h
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 * Author: Juha Yrjola
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#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h>
14
15#define ONENAND_SYNC_READ (1 << 0)
16#define ONENAND_SYNC_READWRITE (1 << 1)
17
18struct onenand_freq_info {
19 u16 maf_id;
20 u16 dev_id;
21 u16 ver_id;
22};
23
24struct omap_onenand_platform_data {
25 int cs;
26 int gpio_irq;
27 struct mtd_partition *parts;
28 int nr_parts;
29 int (*onenand_setup)(void __iomem *, int *freq_ptr);
30 int (*get_freq)(const struct onenand_freq_info *freq_info,
31 bool *clk_dep);
32 int dma_channel;
33 u8 flags;
34 u8 regulator_can_sleep;
35 u8 skip_initial_unlocking;
36};
37
38#define ONENAND_MAX_PARTITIONS 8
39
40#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
41 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
42
43extern void gpmc_onenand_init(struct omap_onenand_platform_data *d);
44
45#else
46
47#define board_onenand_data NULL
48
49static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d)
50{
51}
52
53#endif
diff --git a/include/linux/platform_data/mtd-orion_nand.h b/include/linux/platform_data/mtd-orion_nand.h
new file mode 100644
index 000000000000..9f3c180834d1
--- /dev/null
+++ b/include/linux/platform_data/mtd-orion_nand.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/plat-orion/include/plat/orion_nand.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __PLAT_ORION_NAND_H
10#define __PLAT_ORION_NAND_H
11
12/*
13 * Device bus NAND private data
14 */
15struct orion_nand_data {
16 struct mtd_partition *parts;
17 int (*dev_ready)(struct mtd_info *mtd);
18 u32 nr_parts;
19 u8 ale; /* address line number connected to ALE */
20 u8 cle; /* address line number connected to CLE */
21 u8 width; /* buswidth */
22 u8 chip_delay;
23};
24
25
26#endif
diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h
new file mode 100644
index 000000000000..c7bef788daab
--- /dev/null
+++ b/include/linux/platform_data/omap-twl4030.h
@@ -0,0 +1,32 @@
1/**
2 * omap-twl4030.h - ASoC machine driver for TI SoC based boards with twl4030
3 * codec, header.
4 *
5 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
6 * All rights reserved.
7 *
8 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef _OMAP_TWL4030_H_
26#define _OMAP_TWL4030_H_
27
28struct omap_tw4030_pdata {
29 const char *card_name;
30};
31
32#endif /* _OMAP_TWL4030_H_ */
diff --git a/include/linux/platform_data/omap1_bl.h b/include/linux/platform_data/omap1_bl.h
new file mode 100644
index 000000000000..881a8e92d605
--- /dev/null
+++ b/include/linux/platform_data/omap1_bl.h
@@ -0,0 +1,11 @@
1#ifndef __OMAP1_BL_H__
2#define __OMAP1_BL_H__
3
4#include <linux/device.h>
5
6struct omap_backlight_config {
7 int default_intensity;
8 int (*set_power)(struct device *dev, int state);
9};
10
11#endif
diff --git a/include/linux/platform_data/pcmcia-pxa2xx_viper.h b/include/linux/platform_data/pcmcia-pxa2xx_viper.h
new file mode 100644
index 000000000000..d428be4db44c
--- /dev/null
+++ b/include/linux/platform_data/pcmcia-pxa2xx_viper.h
@@ -0,0 +1,11 @@
1#ifndef __ARCOM_PCMCIA_H
2#define __ARCOM_PCMCIA_H
3
4struct arcom_pcmcia_pdata {
5 int cd_gpio;
6 int rdy_gpio;
7 int pwr_gpio;
8 void (*reset)(int state);
9};
10
11#endif
diff --git a/include/linux/platform_data/pinctrl-coh901.h b/include/linux/platform_data/pinctrl-coh901.h
new file mode 100644
index 000000000000..30dea251b835
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-coh901.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2007-2012 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3
6 * Author: Linus Walleij <linus.walleij@stericsson.com>
7 */
8
9#ifndef __MACH_U300_GPIO_U300_H
10#define __MACH_U300_GPIO_U300_H
11
12/**
13 * struct u300_gpio_platform - U300 GPIO platform data
14 * @ports: number of GPIO block ports
15 * @gpio_base: first GPIO number for this block (use a free range)
16 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
17 * @pinctrl_device: pin control device to spawn as child
18 */
19struct u300_gpio_platform {
20 u8 ports;
21 int gpio_base;
22 int gpio_irq_base;
23 struct platform_device *pinctrl_device;
24};
25
26#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/include/linux/platform_data/remoteproc-omap.h b/include/linux/platform_data/remoteproc-omap.h
new file mode 100644
index 000000000000..3c1c6444ec4b
--- /dev/null
+++ b/include/linux/platform_data/remoteproc-omap.h
@@ -0,0 +1,59 @@
1/*
2 * Remote Processor - omap-specific bits
3 *
4 * Copyright (C) 2011 Texas Instruments, Inc.
5 * Copyright (C) 2011 Google, Inc.
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,
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 _PLAT_REMOTEPROC_H
18#define _PLAT_REMOTEPROC_H
19
20struct rproc_ops;
21struct platform_device;
22
23/*
24 * struct omap_rproc_pdata - omap remoteproc's platform data
25 * @name: the remoteproc's name
26 * @oh_name: omap hwmod device
27 * @oh_name_opt: optional, secondary omap hwmod device
28 * @firmware: name of firmware file to load
29 * @mbox_name: name of omap mailbox device to use with this rproc
30 * @ops: start/stop rproc handlers
31 * @device_enable: omap-specific handler for enabling a device
32 * @device_shutdown: omap-specific handler for shutting down a device
33 * @set_bootaddr: omap-specific handler for setting the rproc boot address
34 */
35struct omap_rproc_pdata {
36 const char *name;
37 const char *oh_name;
38 const char *oh_name_opt;
39 const char *firmware;
40 const char *mbox_name;
41 const struct rproc_ops *ops;
42 int (*device_enable) (struct platform_device *pdev);
43 int (*device_shutdown) (struct platform_device *pdev);
44 void(*set_bootaddr)(u32);
45};
46
47#if defined(CONFIG_OMAP_REMOTEPROC) || defined(CONFIG_OMAP_REMOTEPROC_MODULE)
48
49void __init omap_rproc_reserve_cma(void);
50
51#else
52
53void __init omap_rproc_reserve_cma(void)
54{
55}
56
57#endif
58
59#endif /* _PLAT_REMOTEPROC_H */
diff --git a/include/linux/platform_data/sc18is602.h b/include/linux/platform_data/sc18is602.h
new file mode 100644
index 000000000000..997b06634152
--- /dev/null
+++ b/include/linux/platform_data/sc18is602.h
@@ -0,0 +1,19 @@
1/*
2 * Platform data for NXP SC18IS602/603
3 *
4 * Copyright (C) 2012 Guenter Roeck <linux@roeck-us.net>
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 * For further information, see the Documentation/spi/sc18is602 file.
11 */
12
13/**
14 * struct sc18is602_platform_data - sc18is602 info
15 * @clock_frequency SC18IS603 oscillator frequency
16 */
17struct sc18is602_platform_data {
18 u32 clock_frequency;
19};
diff --git a/include/linux/platform_data/sccnxp.h b/include/linux/platform_data/sccnxp.h
new file mode 100644
index 000000000000..7311ccd3217f
--- /dev/null
+++ b/include/linux/platform_data/sccnxp.h
@@ -0,0 +1,93 @@
1/*
2 * NXP (Philips) SCC+++(SCN+++) serial driver
3 *
4 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru>
5 *
6 * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de)
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
14#ifndef __SCCNXP_H
15#define __SCCNXP_H
16
17#define SCCNXP_MAX_UARTS 2
18
19/* Output lines */
20#define LINE_OP0 1
21#define LINE_OP1 2
22#define LINE_OP2 3
23#define LINE_OP3 4
24#define LINE_OP4 5
25#define LINE_OP5 6
26#define LINE_OP6 7
27#define LINE_OP7 8
28
29/* Input lines */
30#define LINE_IP0 9
31#define LINE_IP1 10
32#define LINE_IP2 11
33#define LINE_IP3 12
34#define LINE_IP4 13
35#define LINE_IP5 14
36#define LINE_IP6 15
37
38/* Signals */
39#define DTR_OP 0 /* DTR */
40#define RTS_OP 4 /* RTS */
41#define DSR_IP 8 /* DSR */
42#define CTS_IP 12 /* CTS */
43#define DCD_IP 16 /* DCD */
44#define RNG_IP 20 /* RNG */
45
46#define DIR_OP 24 /* Special signal for control RS-485.
47 * Goes high when transmit,
48 * then goes low.
49 */
50
51/* Routing control signal 'sig' to line 'line' */
52#define MCTRL_SIG(sig, line) ((line) << (sig))
53
54/*
55 * Example board initialization data:
56 *
57 * static struct resource sc2892_resources[] = {
58 * DEFINE_RES_MEM(UART_PHYS_START, 0x10),
59 * DEFINE_RES_IRQ(IRQ_EXT2),
60 * };
61 *
62 * static struct sccnxp_pdata sc2892_info = {
63 * .frequency = 3686400,
64 * .mctrl_cfg[0] = MCTRL_SIG(DIR_OP, LINE_OP0),
65 * .mctrl_cfg[1] = MCTRL_SIG(DIR_OP, LINE_OP1),
66 * };
67 *
68 * static struct platform_device sc2892 = {
69 * .name = "sc2892",
70 * .id = -1,
71 * .resource = sc2892_resources,
72 * .num_resources = ARRAY_SIZE(sc2892_resources),
73 * .dev = {
74 * .platform_data = &sc2892_info,
75 * },
76 * };
77 */
78
79/* SCCNXP platform data structure */
80struct sccnxp_pdata {
81 /* Frequency (extrenal clock or crystal) */
82 int frequency;
83 /* Shift for A0 line */
84 const u8 reg_shift;
85 /* Modem control lines configuration */
86 const u32 mctrl_cfg[SCCNXP_MAX_UARTS];
87 /* Called during startup */
88 void (*init)(void);
89 /* Called before finish */
90 void (*exit)(void);
91};
92
93#endif
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h
new file mode 100644
index 000000000000..4adec9b154dd
--- /dev/null
+++ b/include/linux/platform_data/serial-imx.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2008 by Sascha Hauer <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
17 */
18
19#ifndef ASMARM_ARCH_UART_H
20#define ASMARM_ARCH_UART_H
21
22#define IMXUART_HAVE_RTSCTS (1<<0)
23#define IMXUART_IRDA (1<<1)
24
25struct imxuart_platform_data {
26 int (*init)(struct platform_device *pdev);
27 void (*exit)(struct platform_device *pdev);
28 unsigned int flags;
29 void (*irda_enable)(int enable);
30 unsigned int irda_inv_rx:1;
31 unsigned int irda_inv_tx:1;
32 unsigned short transceiver_delay;
33};
34
35#endif
diff --git a/include/linux/platform_data/shmob_drm.h b/include/linux/platform_data/shmob_drm.h
new file mode 100644
index 000000000000..7c686d335c12
--- /dev/null
+++ b/include/linux/platform_data/shmob_drm.h
@@ -0,0 +1,99 @@
1/*
2 * shmob_drm.h -- SH Mobile DRM driver
3 *
4 * Copyright (C) 2012 Renesas Corporation
5 *
6 * Laurent Pinchart (laurent.pinchart@ideasonboard.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
14#ifndef __SHMOB_DRM_H__
15#define __SHMOB_DRM_H__
16
17#include <linux/kernel.h>
18
19#include <drm/drm_mode.h>
20
21struct sh_mobile_meram_cfg;
22struct sh_mobile_meram_info;
23
24enum shmob_drm_clk_source {
25 SHMOB_DRM_CLK_BUS,
26 SHMOB_DRM_CLK_PERIPHERAL,
27 SHMOB_DRM_CLK_EXTERNAL,
28};
29
30enum shmob_drm_interface {
31 SHMOB_DRM_IFACE_RGB8, /* 24bpp, 8:8:8 */
32 SHMOB_DRM_IFACE_RGB9, /* 18bpp, 9:9 */
33 SHMOB_DRM_IFACE_RGB12A, /* 24bpp, 12:12 */
34 SHMOB_DRM_IFACE_RGB12B, /* 12bpp */
35 SHMOB_DRM_IFACE_RGB16, /* 16bpp */
36 SHMOB_DRM_IFACE_RGB18, /* 18bpp */
37 SHMOB_DRM_IFACE_RGB24, /* 24bpp */
38 SHMOB_DRM_IFACE_YUV422, /* 16bpp */
39 SHMOB_DRM_IFACE_SYS8A, /* 24bpp, 8:8:8 */
40 SHMOB_DRM_IFACE_SYS8B, /* 18bpp, 8:8:2 */
41 SHMOB_DRM_IFACE_SYS8C, /* 18bpp, 2:8:8 */
42 SHMOB_DRM_IFACE_SYS8D, /* 16bpp, 8:8 */
43 SHMOB_DRM_IFACE_SYS9, /* 18bpp, 9:9 */
44 SHMOB_DRM_IFACE_SYS12, /* 24bpp, 12:12 */
45 SHMOB_DRM_IFACE_SYS16A, /* 16bpp */
46 SHMOB_DRM_IFACE_SYS16B, /* 18bpp, 16:2 */
47 SHMOB_DRM_IFACE_SYS16C, /* 18bpp, 2:16 */
48 SHMOB_DRM_IFACE_SYS18, /* 18bpp */
49 SHMOB_DRM_IFACE_SYS24, /* 24bpp */
50};
51
52struct shmob_drm_backlight_data {
53 const char *name;
54 int max_brightness;
55 int (*get_brightness)(void);
56 int (*set_brightness)(int brightness);
57};
58
59struct shmob_drm_panel_data {
60 unsigned int width_mm; /* Panel width in mm */
61 unsigned int height_mm; /* Panel height in mm */
62 struct drm_mode_modeinfo mode;
63};
64
65struct shmob_drm_sys_interface_data {
66 unsigned int read_latch:6;
67 unsigned int read_setup:8;
68 unsigned int read_cycle:8;
69 unsigned int read_strobe:8;
70 unsigned int write_setup:8;
71 unsigned int write_cycle:8;
72 unsigned int write_strobe:8;
73 unsigned int cs_setup:3;
74 unsigned int vsync_active_high:1;
75 unsigned int vsync_dir_input:1;
76};
77
78#define SHMOB_DRM_IFACE_FL_DWPOL (1 << 0) /* Rising edge dot clock data latch */
79#define SHMOB_DRM_IFACE_FL_DIPOL (1 << 1) /* Active low display enable */
80#define SHMOB_DRM_IFACE_FL_DAPOL (1 << 2) /* Active low display data */
81#define SHMOB_DRM_IFACE_FL_HSCNT (1 << 3) /* Disable HSYNC during VBLANK */
82#define SHMOB_DRM_IFACE_FL_DWCNT (1 << 4) /* Disable dotclock during blanking */
83
84struct shmob_drm_interface_data {
85 enum shmob_drm_interface interface;
86 struct shmob_drm_sys_interface_data sys;
87 unsigned int clk_div;
88 unsigned int flags;
89};
90
91struct shmob_drm_platform_data {
92 enum shmob_drm_clk_source clk_source;
93 struct shmob_drm_interface_data iface;
94 struct shmob_drm_panel_data panel;
95 struct shmob_drm_backlight_data backlight;
96 const struct sh_mobile_meram_cfg *meram;
97};
98
99#endif /* __SHMOB_DRM_H__ */
diff --git a/include/linux/sht15.h b/include/linux/platform_data/sht15.h
index f85c7c523da0..33e0fd27225e 100644
--- a/include/linux/sht15.h
+++ b/include/linux/platform_data/sht15.h
@@ -31,4 +31,3 @@ struct sht15_platform_data {
31 bool no_otp_reload; 31 bool no_otp_reload;
32 bool low_resolution; 32 bool low_resolution;
33}; 33};
34
diff --git a/include/linux/platform_data/spi-davinci.h b/include/linux/platform_data/spi-davinci.h
new file mode 100644
index 000000000000..7af305b37868
--- /dev/null
+++ b/include/linux/platform_data/spi-davinci.h
@@ -0,0 +1,89 @@
1/*
2 * Copyright 2009 Texas Instruments.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __ARCH_ARM_DAVINCI_SPI_H
20#define __ARCH_ARM_DAVINCI_SPI_H
21
22#include <mach/edma.h>
23
24#define SPI_INTERN_CS 0xFF
25
26enum {
27 SPI_VERSION_1, /* For DM355/DM365/DM6467 */
28 SPI_VERSION_2, /* For DA8xx */
29};
30
31/**
32 * davinci_spi_platform_data - Platform data for SPI master device on DaVinci
33 *
34 * @version: version of the SPI IP. Different DaVinci devices have slightly
35 * varying versions of the same IP.
36 * @num_chipselect: number of chipselects supported by this SPI master
37 * @intr_line: interrupt line used to connect the SPI IP to the ARM interrupt
38 * controller withn the SoC. Possible values are 0 and 1.
39 * @chip_sel: list of GPIOs which can act as chip-selects for the SPI.
40 * SPI_INTERN_CS denotes internal SPI chip-select. Not necessary
41 * to populate if all chip-selects are internal.
42 * @cshold_bug: set this to true if the SPI controller on your chip requires
43 * a write to CSHOLD bit in between transfers (like in DM355).
44 * @dma_event_q: DMA event queue to use if SPI_IO_TYPE_DMA is used for any
45 * device on the bus.
46 */
47struct davinci_spi_platform_data {
48 u8 version;
49 u8 num_chipselect;
50 u8 intr_line;
51 u8 *chip_sel;
52 bool cshold_bug;
53 enum dma_event_q dma_event_q;
54};
55
56/**
57 * davinci_spi_config - Per-chip-select configuration for SPI slave devices
58 *
59 * @wdelay: amount of delay between transmissions. Measured in number of
60 * SPI module clocks.
61 * @odd_parity: polarity of parity flag at the end of transmit data stream.
62 * 0 - odd parity, 1 - even parity.
63 * @parity_enable: enable transmission of parity at end of each transmit
64 * data stream.
65 * @io_type: type of IO transfer. Choose between polled, interrupt and DMA.
66 * @timer_disable: disable chip-select timers (setup and hold)
67 * @c2tdelay: chip-select setup time. Measured in number of SPI module clocks.
68 * @t2cdelay: chip-select hold time. Measured in number of SPI module clocks.
69 * @t2edelay: transmit data finished to SPI ENAn pin inactive time. Measured
70 * in number of SPI clocks.
71 * @c2edelay: chip-select active to SPI ENAn signal active time. Measured in
72 * number of SPI clocks.
73 */
74struct davinci_spi_config {
75 u8 wdelay;
76 u8 odd_parity;
77 u8 parity_enable;
78#define SPI_IO_TYPE_INTR 0
79#define SPI_IO_TYPE_POLL 1
80#define SPI_IO_TYPE_DMA 2
81 u8 io_type;
82 u8 timer_disable;
83 u8 c2tdelay;
84 u8 t2cdelay;
85 u8 t2edelay;
86 u8 c2edelay;
87};
88
89#endif /* __ARCH_ARM_DAVINCI_SPI_H */
diff --git a/include/linux/platform_data/spi-ep93xx.h b/include/linux/platform_data/spi-ep93xx.h
new file mode 100644
index 000000000000..9bb63ac13f04
--- /dev/null
+++ b/include/linux/platform_data/spi-ep93xx.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_MACH_EP93XX_SPI_H
2#define __ASM_MACH_EP93XX_SPI_H
3
4struct spi_device;
5
6/**
7 * struct ep93xx_spi_info - EP93xx specific SPI descriptor
8 * @num_chipselect: number of chip selects on this board, must be
9 * at least one
10 * @use_dma: use DMA for the transfers
11 */
12struct ep93xx_spi_info {
13 int num_chipselect;
14 bool use_dma;
15};
16
17/**
18 * struct ep93xx_spi_chip_ops - operation callbacks for SPI slave device
19 * @setup: setup the chip select mechanism
20 * @cleanup: cleanup the chip select mechanism
21 * @cs_control: control the device chip select
22 */
23struct ep93xx_spi_chip_ops {
24 int (*setup)(struct spi_device *spi);
25 void (*cleanup)(struct spi_device *spi);
26 void (*cs_control)(struct spi_device *spi, int value);
27};
28
29#endif /* __ASM_MACH_EP93XX_SPI_H */
diff --git a/include/linux/platform_data/spi-imx.h b/include/linux/platform_data/spi-imx.h
new file mode 100644
index 000000000000..08be445e8eb8
--- /dev/null
+++ b/include/linux/platform_data/spi-imx.h
@@ -0,0 +1,27 @@
1
2#ifndef __MACH_SPI_H_
3#define __MACH_SPI_H_
4
5/*
6 * struct spi_imx_master - device.platform_data for SPI controller devices.
7 * @chipselect: Array of chipselects for this master. Numbers >= 0 mean gpio
8 * pins, numbers < 0 mean internal CSPI chipselects according
9 * to MXC_SPI_CS(). Normally you want to use gpio based chip
10 * selects as the CSPI module tries to be intelligent about
11 * when to assert the chipselect: The CSPI module deasserts the
12 * chipselect once it runs out of input data. The other problem
13 * is that it is not possible to mix between high active and low
14 * active chipselects on one single bus using the internal
15 * chipselects. Unfortunately Freescale decided to put some
16 * chipselects on dedicated pins which are not usable as gpios,
17 * so we have to support the internal chipselects.
18 * @num_chipselect: ARRAY_SIZE(chipselect)
19 */
20struct spi_imx_master {
21 int *chipselect;
22 int num_chipselect;
23};
24
25#define MXC_SPI_CS(no) ((no) - 32)
26
27#endif /* __MACH_SPI_H_*/
diff --git a/include/linux/platform_data/spi-nuc900.h b/include/linux/platform_data/spi-nuc900.h
new file mode 100644
index 000000000000..2c4e0c128501
--- /dev/null
+++ b/include/linux/platform_data/spi-nuc900.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/nuc900_spi.h
3 *
4 * Copyright (c) 2009 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.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;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_SPI_H
15#define __ASM_ARCH_SPI_H
16
17extern void mfp_set_groupg(struct device *dev, const char *subname);
18
19struct nuc900_spi_info {
20 unsigned int num_cs;
21 unsigned int lsb;
22 unsigned int txneg;
23 unsigned int rxneg;
24 unsigned int divider;
25 unsigned int sleep;
26 unsigned int txnum;
27 unsigned int txbitlen;
28 int bus_num;
29};
30
31struct nuc900_spi_chip {
32 unsigned char bits_per_word;
33};
34
35#endif /* __ASM_ARCH_SPI_H */
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
new file mode 100644
index 000000000000..a357eb26bd25
--- /dev/null
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -0,0 +1,23 @@
1#ifndef _OMAP2_MCSPI_H
2#define _OMAP2_MCSPI_H
3
4#define OMAP2_MCSPI_REV 0
5#define OMAP3_MCSPI_REV 1
6#define OMAP4_MCSPI_REV 2
7
8#define OMAP4_MCSPI_REG_OFFSET 0x100
9
10struct omap2_mcspi_platform_config {
11 unsigned short num_cs;
12 unsigned int regs_offset;
13};
14
15struct omap2_mcspi_dev_attr {
16 unsigned short num_chipselect;
17};
18
19struct omap2_mcspi_device_config {
20 unsigned turbo_mode:1;
21};
22
23#endif
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
new file mode 100644
index 000000000000..ceba18d23a5a
--- /dev/null
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
2 *
3 * Copyright (C) 2009 Samsung Electronics Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __S3C64XX_PLAT_SPI_H
12#define __S3C64XX_PLAT_SPI_H
13
14struct platform_device;
15
16/**
17 * struct s3c64xx_spi_csinfo - ChipSelect description
18 * @fb_delay: Slave specific feedback delay.
19 * Refer to FB_CLK_SEL register definition in SPI chapter.
20 * @line: Custom 'identity' of the CS line.
21 *
22 * This is per SPI-Slave Chipselect information.
23 * Allocate and initialize one in machine init code and make the
24 * spi_board_info.controller_data point to it.
25 */
26struct s3c64xx_spi_csinfo {
27 u8 fb_delay;
28 unsigned line;
29};
30
31/**
32 * struct s3c64xx_spi_info - SPI Controller defining structure
33 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
34 * @num_cs: Number of CS this controller emulates.
35 * @cfg_gpio: Configure pins for this SPI controller.
36 */
37struct s3c64xx_spi_info {
38 int src_clk_nr;
39 int num_cs;
40 int (*cfg_gpio)(void);
41};
42
43/**
44 * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board
45 * initialization code.
46 * @cfg_gpio: Pointer to gpio setup function.
47 * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
48 * @num_cs: Number of elements in the 'cs' array.
49 *
50 * Call this from machine init code for each SPI Controller that
51 * has some chips attached to it.
52 */
53extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
54 int num_cs);
55extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
56 int num_cs);
57extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr,
58 int num_cs);
59
60/* defined by architecture to configure gpio */
61extern int s3c64xx_spi0_cfg_gpio(void);
62extern int s3c64xx_spi1_cfg_gpio(void);
63extern int s3c64xx_spi2_cfg_gpio(void);
64
65extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
66extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
67extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
68#endif /* __S3C64XX_PLAT_SPI_H */
diff --git a/include/linux/platform_data/touchscreen-s3c2410.h b/include/linux/platform_data/touchscreen-s3c2410.h
new file mode 100644
index 000000000000..26fdb22e0fc2
--- /dev/null
+++ b/include/linux/platform_data/touchscreen-s3c2410.h
@@ -0,0 +1,25 @@
1/* arch/arm/plat-samsung/include/plat/ts.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8*/
9
10#ifndef __ASM_ARM_TS_H
11#define __ASM_ARM_TS_H
12
13struct s3c2410_ts_mach_info {
14 int delay;
15 int presc;
16 int oversampling_shift;
17 void (*cfg_gpio)(struct platform_device *dev);
18};
19
20extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
21
22/* defined by architecture to configure gpio */
23extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev);
24
25#endif /* __ASM_ARM_TS_H */
diff --git a/include/linux/platform_data/usb-davinci.h b/include/linux/platform_data/usb-davinci.h
new file mode 100644
index 000000000000..e0bc4abe69c2
--- /dev/null
+++ b/include/linux/platform_data/usb-davinci.h
@@ -0,0 +1,59 @@
1/*
2 * USB related definitions
3 *
4 * Copyright (C) 2009 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
11#ifndef __ASM_ARCH_USB_H
12#define __ASM_ARCH_USB_H
13
14/* DA8xx CFGCHIP2 (USB 2.0 PHY Control) register bits */
15#define CFGCHIP2_PHYCLKGD (1 << 17)
16#define CFGCHIP2_VBUSSENSE (1 << 16)
17#define CFGCHIP2_RESET (1 << 15)
18#define CFGCHIP2_OTGMODE (3 << 13)
19#define CFGCHIP2_NO_OVERRIDE (0 << 13)
20#define CFGCHIP2_FORCE_HOST (1 << 13)
21#define CFGCHIP2_FORCE_DEVICE (2 << 13)
22#define CFGCHIP2_FORCE_HOST_VBUS_LOW (3 << 13)
23#define CFGCHIP2_USB1PHYCLKMUX (1 << 12)
24#define CFGCHIP2_USB2PHYCLKMUX (1 << 11)
25#define CFGCHIP2_PHYPWRDN (1 << 10)
26#define CFGCHIP2_OTGPWRDN (1 << 9)
27#define CFGCHIP2_DATPOL (1 << 8)
28#define CFGCHIP2_USB1SUSPENDM (1 << 7)
29#define CFGCHIP2_PHY_PLLON (1 << 6) /* override PLL suspend */
30#define CFGCHIP2_SESENDEN (1 << 5) /* Vsess_end comparator */
31#define CFGCHIP2_VBDTCTEN (1 << 4) /* Vbus comparator */
32#define CFGCHIP2_REFFREQ (0xf << 0)
33#define CFGCHIP2_REFFREQ_12MHZ (1 << 0)
34#define CFGCHIP2_REFFREQ_24MHZ (2 << 0)
35#define CFGCHIP2_REFFREQ_48MHZ (3 << 0)
36
37struct da8xx_ohci_root_hub;
38
39typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub,
40 unsigned port);
41
42/* Passed as the platform data to the OHCI driver */
43struct da8xx_ohci_root_hub {
44 /* Switch the port power on/off */
45 int (*set_power)(unsigned port, int on);
46 /* Read the port power status */
47 int (*get_power)(unsigned port);
48 /* Read the port over-current indicator */
49 int (*get_oci)(unsigned port);
50 /* Over-current indicator change notification (pass NULL to disable) */
51 int (*ocic_notify)(da8xx_ocic_handler_t handler);
52
53 /* Time from power on to power good (in 2 ms units) */
54 u8 potpgt;
55};
56
57void davinci_setup_usb(unsigned mA, unsigned potpgt_ms);
58
59#endif /* ifndef __ASM_ARCH_USB_H */
diff --git a/include/linux/platform_data/usb-ehci-mxc.h b/include/linux/platform_data/usb-ehci-mxc.h
new file mode 100644
index 000000000000..7eb9d1329671
--- /dev/null
+++ b/include/linux/platform_data/usb-ehci-mxc.h
@@ -0,0 +1,59 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
24#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
25#define MXC_EHCI_TTL_ENABLED (1 << 8)
26
27#define MXC_EHCI_INTERNAL_PHY (1 << 9)
28#define MXC_EHCI_IPPUE_DOWN (1 << 10)
29#define MXC_EHCI_IPPUE_UP (1 << 11)
30#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
31#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
32
33#define MXC_USBCTRL_OFFSET 0
34#define MXC_USB_PHY_CTR_FUNC_OFFSET 0x8
35#define MXC_USB_PHY_CTR_FUNC2_OFFSET 0xc
36#define MXC_USBH2CTRL_OFFSET 0x14
37
38#define MX5_USBOTHER_REGS_OFFSET 0x800
39
40/* USB_PHY_CTRL_FUNC2*/
41#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK 0x3
42#define MX5_USB_UTMI_PHYCTRL1_PLLDIV_SHIFT 0
43
44struct mxc_usbh_platform_data {
45 int (*init)(struct platform_device *pdev);
46 int (*exit)(struct platform_device *pdev);
47
48 unsigned int portsc;
49 struct usb_phy *otg;
50};
51
52int mx51_initialize_usb_hw(int port, unsigned int flags);
53int mx25_initialize_usb_hw(int port, unsigned int flags);
54int mx31_initialize_usb_hw(int port, unsigned int flags);
55int mx35_initialize_usb_hw(int port, unsigned int flags);
56int mx27_initialize_usb_hw(int port, unsigned int flags);
57
58#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
59
diff --git a/include/linux/platform_data/usb-ehci-orion.h b/include/linux/platform_data/usb-ehci-orion.h
new file mode 100644
index 000000000000..6fc78e430420
--- /dev/null
+++ b/include/linux/platform_data/usb-ehci-orion.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/plat-orion/include/plat/ehci-orion.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __PLAT_EHCI_ORION_H
10#define __PLAT_EHCI_ORION_H
11
12#include <linux/mbus.h>
13
14enum orion_ehci_phy_ver {
15 EHCI_PHY_ORION,
16 EHCI_PHY_DD,
17 EHCI_PHY_KW,
18 EHCI_PHY_NA,
19};
20
21struct orion_ehci_data {
22 enum orion_ehci_phy_ver phy_version;
23};
24
25
26#endif
diff --git a/include/linux/platform_data/usb-ehci-s5p.h b/include/linux/platform_data/usb-ehci-s5p.h
new file mode 100644
index 000000000000..5f28cae18582
--- /dev/null
+++ b/include/linux/platform_data/usb-ehci-s5p.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __PLAT_SAMSUNG_EHCI_H
12#define __PLAT_SAMSUNG_EHCI_H __FILE__
13
14struct s5p_ehci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
20
21#endif /* __PLAT_SAMSUNG_EHCI_H */
diff --git a/include/linux/platform_data/usb-exynos.h b/include/linux/platform_data/usb-exynos.h
new file mode 100644
index 000000000000..c256c595be5e
--- /dev/null
+++ b/include/linux/platform_data/usb-exynos.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MACH_EXYNOS_OHCI_H
12#define __MACH_EXYNOS_OHCI_H
13
14struct exynos4_ohci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
20
21#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/include/linux/platform_data/usb-imx_udc.h b/include/linux/platform_data/usb-imx_udc.h
new file mode 100644
index 000000000000..be273371f34a
--- /dev/null
+++ b/include/linux/platform_data/usb-imx_udc.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MXC_USB
16#define __ASM_ARCH_MXC_USB
17
18struct imxusb_platform_data {
19 int (*init)(struct device *);
20 void (*exit)(struct device *);
21};
22
23#endif /* __ASM_ARCH_MXC_USB */
diff --git a/include/linux/platform_data/usb-musb-ux500.h b/include/linux/platform_data/usb-musb-ux500.h
new file mode 100644
index 000000000000..4c1cc50a595a
--- /dev/null
+++ b/include/linux/platform_data/usb-musb-ux500.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2011
3 *
4 * Author: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7#ifndef __ASM_ARCH_USB_H
8#define __ASM_ARCH_USB_H
9
10#include <linux/dmaengine.h>
11
12#define UX500_MUSB_DMA_NUM_RX_CHANNELS 8
13#define UX500_MUSB_DMA_NUM_TX_CHANNELS 8
14
15struct ux500_musb_board_data {
16 void **dma_rx_param_array;
17 void **dma_tx_param_array;
18 u32 num_rx_channels;
19 u32 num_tx_channels;
20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
21};
22
23void ux500_add_usb(struct device *parent, resource_size_t base,
24 int irq, int *dma_rx_cfg, int *dma_tx_cfg);
25#endif
diff --git a/include/linux/platform_data/usb-mx2.h b/include/linux/platform_data/usb-mx2.h
new file mode 100644
index 000000000000..22d0b596262c
--- /dev/null
+++ b/include/linux/platform_data/usb-mx2.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2009 Martin Fuzzey <mfuzzey@gmail.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 as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __ASM_ARCH_MX21_USBH
16#define __ASM_ARCH_MX21_USBH
17
18enum mx21_usbh_xcvr {
19 /* Values below as used by hardware (HWMODE register) */
20 MX21_USBXCVR_TXDIF_RXDIF = 0,
21 MX21_USBXCVR_TXDIF_RXSE = 1,
22 MX21_USBXCVR_TXSE_RXDIF = 2,
23 MX21_USBXCVR_TXSE_RXSE = 3,
24};
25
26struct mx21_usbh_platform_data {
27 enum mx21_usbh_xcvr host_xcvr; /* tranceiver mode host 1,2 ports */
28 enum mx21_usbh_xcvr otg_xcvr; /* tranceiver mode otg (as host) port */
29 u16 enable_host1:1,
30 enable_host2:1,
31 enable_otg_host:1, /* enable "OTG" port (as host) */
32 host1_xcverless:1, /* traceiverless host1 port */
33 host1_txenoe:1, /* output enable host1 transmit enable */
34 otg_ext_xcvr:1, /* external tranceiver for OTG port */
35 unused:10;
36};
37
38#endif /* __ASM_ARCH_MX21_USBH */
diff --git a/include/linux/platform_data/usb-ohci-pxa27x.h b/include/linux/platform_data/usb-ohci-pxa27x.h
new file mode 100644
index 000000000000..95b6e2a6e514
--- /dev/null
+++ b/include/linux/platform_data/usb-ohci-pxa27x.h
@@ -0,0 +1,36 @@
1#ifndef ASMARM_ARCH_OHCI_H
2#define ASMARM_ARCH_OHCI_H
3
4struct device;
5
6struct pxaohci_platform_data {
7 int (*init)(struct device *);
8 void (*exit)(struct device *);
9
10 unsigned long flags;
11#define ENABLE_PORT1 (1 << 0)
12#define ENABLE_PORT2 (1 << 1)
13#define ENABLE_PORT3 (1 << 2)
14#define ENABLE_PORT_ALL (ENABLE_PORT1 | ENABLE_PORT2 | ENABLE_PORT3)
15
16#define POWER_SENSE_LOW (1 << 3)
17#define POWER_CONTROL_LOW (1 << 4)
18#define NO_OC_PROTECTION (1 << 5)
19#define OC_MODE_GLOBAL (0 << 6)
20#define OC_MODE_PERPORT (1 << 6)
21
22 int power_on_delay; /* Power On to Power Good time - in ms
23 * HCD must wait for this duration before
24 * accessing a powered on port
25 */
26 int port_mode;
27#define PMM_NPS_MODE 1
28#define PMM_GLOBAL_MODE 2
29#define PMM_PERPORT_MODE 3
30
31 int power_budget;
32};
33
34extern void pxa_set_ohci_info(struct pxaohci_platform_data *info);
35
36#endif
diff --git a/include/linux/platform_data/usb-ohci-s3c2410.h b/include/linux/platform_data/usb-ohci-s3c2410.h
new file mode 100644
index 000000000000..7fa1fbefc3f2
--- /dev/null
+++ b/include/linux/platform_data/usb-ohci-s3c2410.h
@@ -0,0 +1,43 @@
1/* arch/arm/plat-samsung/include/plat/usb-control.h
2 *
3 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C - USB host port information
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 __ASM_ARCH_USBCONTROL_H
14#define __ASM_ARCH_USBCONTROL_H
15
16#define S3C_HCDFLG_USED (1)
17
18struct s3c2410_hcd_port {
19 unsigned char flags;
20 unsigned char power;
21 unsigned char oc_status;
22 unsigned char oc_changed;
23};
24
25struct s3c2410_hcd_info {
26 struct usb_hcd *hcd;
27 struct s3c2410_hcd_port port[2];
28
29 void (*power_control)(int port, int to);
30 void (*enable_oc)(struct s3c2410_hcd_info *, int on);
31 void (*report_oc)(struct s3c2410_hcd_info *, int ports);
32};
33
34static void inline s3c2410_usb_report_oc(struct s3c2410_hcd_info *info, int ports)
35{
36 if (info->report_oc != NULL) {
37 (info->report_oc)(info, ports);
38 }
39}
40
41extern void s3c_ohci_set_platdata(struct s3c2410_hcd_info *info);
42
43#endif /*__ASM_ARCH_USBCONTROL_H */
diff --git a/include/linux/platform_data/usb-pxa3xx-ulpi.h b/include/linux/platform_data/usb-pxa3xx-ulpi.h
new file mode 100644
index 000000000000..9d82cb65ea56
--- /dev/null
+++ b/include/linux/platform_data/usb-pxa3xx-ulpi.h
@@ -0,0 +1,35 @@
1/*
2 * PXA3xx U2D header
3 *
4 * Copyright (C) 2010 CompuLab Ltd.
5 *
6 * Igor Grinberg <grinberg@compulab.co.il>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#ifndef __PXA310_U2D__
13#define __PXA310_U2D__
14
15#include <linux/usb/ulpi.h>
16
17struct pxa3xx_u2d_platform_data {
18
19#define ULPI_SER_6PIN (1 << 0)
20#define ULPI_SER_3PIN (1 << 1)
21 unsigned int ulpi_mode;
22
23 int (*init)(struct device *);
24 void (*exit)(struct device *);
25};
26
27
28/* Start PXA3xx U2D host */
29int pxa3xx_u2d_start_hc(struct usb_bus *host);
30/* Stop PXA3xx U2D host */
31void pxa3xx_u2d_stop_hc(struct usb_bus *host);
32
33extern void pxa3xx_set_u2d_info(struct pxa3xx_u2d_platform_data *info);
34
35#endif /* __PXA310_U2D__ */
diff --git a/include/linux/platform_data/usb-s3c2410_udc.h b/include/linux/platform_data/usb-s3c2410_udc.h
new file mode 100644
index 000000000000..de8e2288a509
--- /dev/null
+++ b/include/linux/platform_data/usb-s3c2410_udc.h
@@ -0,0 +1,44 @@
1/* arch/arm/plat-samsung/include/plat/udc.h
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 *
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 * Changelog:
12 * 14-Mar-2005 RTP Created file
13 * 02-Aug-2005 RTP File rename
14 * 07-Sep-2005 BJD Minor cleanups, changed cmd to enum
15 * 18-Jan-2007 HMW Add per-platform vbus_draw function
16*/
17
18#ifndef __ASM_ARM_ARCH_UDC_H
19#define __ASM_ARM_ARCH_UDC_H
20
21enum s3c2410_udc_cmd_e {
22 S3C2410_UDC_P_ENABLE = 1, /* Pull-up enable */
23 S3C2410_UDC_P_DISABLE = 2, /* Pull-up disable */
24 S3C2410_UDC_P_RESET = 3, /* UDC reset, in case of */
25};
26
27struct s3c2410_udc_mach_info {
28 void (*udc_command)(enum s3c2410_udc_cmd_e);
29 void (*vbus_draw)(unsigned int ma);
30
31 unsigned int pullup_pin;
32 unsigned int pullup_pin_inverted;
33
34 unsigned int vbus_pin;
35 unsigned char vbus_pin_inverted;
36};
37
38extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
39
40struct s3c24xx_hsudc_platdata;
41
42extern void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd);
43
44#endif /* __ASM_ARM_ARCH_UDC_H */
diff --git a/include/linux/platform_data/video-ep93xx.h b/include/linux/platform_data/video-ep93xx.h
new file mode 100644
index 000000000000..d5ae11d7c453
--- /dev/null
+++ b/include/linux/platform_data/video-ep93xx.h
@@ -0,0 +1,56 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/fb.h
3 */
4
5#ifndef __ASM_ARCH_EP93XXFB_H
6#define __ASM_ARCH_EP93XXFB_H
7
8struct platform_device;
9struct fb_videomode;
10struct fb_info;
11
12#define EP93XXFB_USE_MODEDB 0
13
14/* VideoAttributes flags */
15#define EP93XXFB_STATE_MACHINE_ENABLE (1 << 0)
16#define EP93XXFB_PIXEL_CLOCK_ENABLE (1 << 1)
17#define EP93XXFB_VSYNC_ENABLE (1 << 2)
18#define EP93XXFB_PIXEL_DATA_ENABLE (1 << 3)
19#define EP93XXFB_COMPOSITE_SYNC (1 << 4)
20#define EP93XXFB_SYNC_VERT_HIGH (1 << 5)
21#define EP93XXFB_SYNC_HORIZ_HIGH (1 << 6)
22#define EP93XXFB_SYNC_BLANK_HIGH (1 << 7)
23#define EP93XXFB_PCLK_FALLING (1 << 8)
24#define EP93XXFB_ENABLE_AC (1 << 9)
25#define EP93XXFB_ENABLE_LCD (1 << 10)
26#define EP93XXFB_ENABLE_CCIR (1 << 12)
27#define EP93XXFB_USE_PARALLEL_INTERFACE (1 << 13)
28#define EP93XXFB_ENABLE_INTERRUPT (1 << 14)
29#define EP93XXFB_USB_INTERLACE (1 << 16)
30#define EP93XXFB_USE_EQUALIZATION (1 << 17)
31#define EP93XXFB_USE_DOUBLE_HORZ (1 << 18)
32#define EP93XXFB_USE_DOUBLE_VERT (1 << 19)
33#define EP93XXFB_USE_BLANK_PIXEL (1 << 20)
34#define EP93XXFB_USE_SDCSN0 (0 << 21)
35#define EP93XXFB_USE_SDCSN1 (1 << 21)
36#define EP93XXFB_USE_SDCSN2 (2 << 21)
37#define EP93XXFB_USE_SDCSN3 (3 << 21)
38
39#define EP93XXFB_ENABLE (EP93XXFB_STATE_MACHINE_ENABLE | \
40 EP93XXFB_PIXEL_CLOCK_ENABLE | \
41 EP93XXFB_VSYNC_ENABLE | \
42 EP93XXFB_PIXEL_DATA_ENABLE)
43
44struct ep93xxfb_mach_info {
45 unsigned int num_modes;
46 const struct fb_videomode *modes;
47 const struct fb_videomode *default_mode;
48 int bpp;
49 unsigned int flags;
50
51 int (*setup)(struct platform_device *pdev);
52 void (*teardown)(struct platform_device *pdev);
53 void (*blank)(int blank_mode, struct fb_info *info);
54};
55
56#endif /* __ASM_ARCH_EP93XXFB_H */
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
new file mode 100644
index 000000000000..9de8f062ad5d
--- /dev/null
+++ b/include/linux/platform_data/video-imxfb.h
@@ -0,0 +1,84 @@
1/*
2 * This structure describes the machine which we are running on.
3 */
4#ifndef __MACH_IMXFB_H__
5#define __MACH_IMXFB_H__
6
7#include <linux/fb.h>
8
9#define PCR_TFT (1 << 31)
10#define PCR_COLOR (1 << 30)
11#define PCR_PBSIZ_1 (0 << 28)
12#define PCR_PBSIZ_2 (1 << 28)
13#define PCR_PBSIZ_4 (2 << 28)
14#define PCR_PBSIZ_8 (3 << 28)
15#define PCR_BPIX_1 (0 << 25)
16#define PCR_BPIX_2 (1 << 25)
17#define PCR_BPIX_4 (2 << 25)
18#define PCR_BPIX_8 (3 << 25)
19#define PCR_BPIX_12 (4 << 25)
20#define PCR_BPIX_16 (5 << 25)
21#define PCR_BPIX_18 (6 << 25)
22#define PCR_PIXPOL (1 << 24)
23#define PCR_FLMPOL (1 << 23)
24#define PCR_LPPOL (1 << 22)
25#define PCR_CLKPOL (1 << 21)
26#define PCR_OEPOL (1 << 20)
27#define PCR_SCLKIDLE (1 << 19)
28#define PCR_END_SEL (1 << 18)
29#define PCR_END_BYTE_SWAP (1 << 17)
30#define PCR_REV_VS (1 << 16)
31#define PCR_ACD_SEL (1 << 15)
32#define PCR_ACD(x) (((x) & 0x7f) << 8)
33#define PCR_SCLK_SEL (1 << 7)
34#define PCR_SHARP (1 << 6)
35#define PCR_PCD(x) ((x) & 0x3f)
36
37#define PWMR_CLS(x) (((x) & 0x1ff) << 16)
38#define PWMR_LDMSK (1 << 15)
39#define PWMR_SCR1 (1 << 10)
40#define PWMR_SCR0 (1 << 9)
41#define PWMR_CC_EN (1 << 8)
42#define PWMR_PW(x) ((x) & 0xff)
43
44#define LSCR1_PS_RISE_DELAY(x) (((x) & 0x7f) << 26)
45#define LSCR1_CLS_RISE_DELAY(x) (((x) & 0x3f) << 16)
46#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
47#define LSCR1_GRAY2(x) (((x) & 0xf) << 4)
48#define LSCR1_GRAY1(x) (((x) & 0xf))
49
50#define DMACR_BURST (1 << 31)
51#define DMACR_HM(x) (((x) & 0xf) << 16)
52#define DMACR_TM(x) ((x) & 0xf)
53
54struct imx_fb_videomode {
55 struct fb_videomode mode;
56 u32 pcr;
57 unsigned char bpp;
58};
59
60struct imx_fb_platform_data {
61 struct imx_fb_videomode *mode;
62 int num_modes;
63
64 u_int cmap_greyscale:1,
65 cmap_inverse:1,
66 cmap_static:1,
67 unused:29;
68
69 u_int pwmr;
70 u_int lscr1;
71 u_int dmacr;
72
73 u_char * fixed_screen_cpu;
74 dma_addr_t fixed_screen_dma;
75
76 int (*init)(struct platform_device *);
77 void (*exit)(struct platform_device *);
78
79 void (*lcd_power)(int);
80 void (*backlight_power)(int);
81};
82
83void set_imx_fb_info(struct imx_fb_platform_data *);
84#endif /* ifndef __MACH_IMXFB_H__ */
diff --git a/include/linux/platform_data/video-msm_fb.h b/include/linux/platform_data/video-msm_fb.h
new file mode 100644
index 000000000000..1f4fc81b3d8f
--- /dev/null
+++ b/include/linux/platform_data/video-msm_fb.h
@@ -0,0 +1,147 @@
1/* arch/arm/mach-msm/include/mach/msm_fb.h
2 *
3 * Internal shared definitions for various MSM framebuffer parts.
4 *
5 * Copyright (C) 2007 Google Incorporated
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#ifndef _MSM_FB_H_
18#define _MSM_FB_H_
19
20#include <linux/device.h>
21
22struct mddi_info;
23
24struct msm_fb_data {
25 int xres; /* x resolution in pixels */
26 int yres; /* y resolution in pixels */
27 int width; /* disply width in mm */
28 int height; /* display height in mm */
29 unsigned output_format;
30};
31
32struct msmfb_callback {
33 void (*func)(struct msmfb_callback *);
34};
35
36enum {
37 MSM_MDDI_PMDH_INTERFACE,
38 MSM_MDDI_EMDH_INTERFACE,
39 MSM_EBI2_INTERFACE,
40};
41
42#define MSMFB_CAP_PARTIAL_UPDATES (1 << 0)
43
44struct msm_panel_data {
45 /* turns off the fb memory */
46 int (*suspend)(struct msm_panel_data *);
47 /* turns on the fb memory */
48 int (*resume)(struct msm_panel_data *);
49 /* turns off the panel */
50 int (*blank)(struct msm_panel_data *);
51 /* turns on the panel */
52 int (*unblank)(struct msm_panel_data *);
53 void (*wait_vsync)(struct msm_panel_data *);
54 void (*request_vsync)(struct msm_panel_data *, struct msmfb_callback *);
55 void (*clear_vsync)(struct msm_panel_data *);
56 /* from the enum above */
57 unsigned interface_type;
58 /* data to be passed to the fb driver */
59 struct msm_fb_data *fb_data;
60
61 /* capabilities supported by the panel */
62 uint32_t caps;
63};
64
65struct msm_mddi_client_data {
66 void (*suspend)(struct msm_mddi_client_data *);
67 void (*resume)(struct msm_mddi_client_data *);
68 void (*activate_link)(struct msm_mddi_client_data *);
69 void (*remote_write)(struct msm_mddi_client_data *, uint32_t val,
70 uint32_t reg);
71 uint32_t (*remote_read)(struct msm_mddi_client_data *, uint32_t reg);
72 void (*auto_hibernate)(struct msm_mddi_client_data *, int);
73 /* custom data that needs to be passed from the board file to a
74 * particular client */
75 void *private_client_data;
76 struct resource *fb_resource;
77 /* from the list above */
78 unsigned interface_type;
79};
80
81struct msm_mddi_platform_data {
82 unsigned int clk_rate;
83 void (*power_client)(struct msm_mddi_client_data *, int on);
84
85 /* fixup the mfr name, product id */
86 void (*fixup)(uint16_t *mfr_name, uint16_t *product_id);
87
88 struct resource *fb_resource; /*optional*/
89 /* number of clients in the list that follows */
90 int num_clients;
91 /* array of client information of clients */
92 struct {
93 unsigned product_id; /* mfr id in top 16 bits, product id
94 * in lower 16 bits
95 */
96 char *name; /* the device name will be the platform
97 * device name registered for the client,
98 * it should match the name of the associated
99 * driver
100 */
101 unsigned id; /* id for mddi client device node, will also
102 * be used as device id of panel devices, if
103 * the client device will have multiple panels
104 * space must be left here for them
105 */
106 void *client_data; /* required private client data */
107 unsigned int clk_rate; /* optional: if the client requires a
108 * different mddi clk rate
109 */
110 } client_platform_data[];
111};
112
113struct mdp_blit_req;
114struct fb_info;
115struct mdp_device {
116 struct device dev;
117 void (*dma)(struct mdp_device *mpd, uint32_t addr,
118 uint32_t stride, uint32_t w, uint32_t h, uint32_t x,
119 uint32_t y, struct msmfb_callback *callback, int interface);
120 void (*dma_wait)(struct mdp_device *mdp);
121 int (*blit)(struct mdp_device *mdp, struct fb_info *fb,
122 struct mdp_blit_req *req);
123 void (*set_grp_disp)(struct mdp_device *mdp, uint32_t disp_id);
124};
125
126struct class_interface;
127int register_mdp_client(struct class_interface *class_intf);
128
129/**** private client data structs go below this line ***/
130
131struct msm_mddi_bridge_platform_data {
132 /* from board file */
133 int (*init)(struct msm_mddi_bridge_platform_data *,
134 struct msm_mddi_client_data *);
135 int (*uninit)(struct msm_mddi_bridge_platform_data *,
136 struct msm_mddi_client_data *);
137 /* passed to panel for use by the fb driver */
138 int (*blank)(struct msm_mddi_bridge_platform_data *,
139 struct msm_mddi_client_data *);
140 int (*unblank)(struct msm_mddi_bridge_platform_data *,
141 struct msm_mddi_client_data *);
142 struct msm_fb_data fb_data;
143};
144
145
146
147#endif
diff --git a/include/linux/platform_data/video-mx3fb.h b/include/linux/platform_data/video-mx3fb.h
new file mode 100644
index 000000000000..fdbe60001542
--- /dev/null
+++ b/include/linux/platform_data/video-mx3fb.h
@@ -0,0 +1,53 @@
1/*
2 * Copyright (C) 2008
3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __ASM_ARCH_MX3FB_H__
11#define __ASM_ARCH_MX3FB_H__
12
13#include <linux/device.h>
14#include <linux/fb.h>
15
16/* Proprietary FB_SYNC_ flags */
17#define FB_SYNC_OE_ACT_HIGH 0x80000000
18#define FB_SYNC_CLK_INVERT 0x40000000
19#define FB_SYNC_DATA_INVERT 0x20000000
20#define FB_SYNC_CLK_IDLE_EN 0x10000000
21#define FB_SYNC_SHARP_MODE 0x08000000
22#define FB_SYNC_SWAP_RGB 0x04000000
23#define FB_SYNC_CLK_SEL_EN 0x02000000
24
25/*
26 * Specify the way your display is connected. The IPU can arbitrarily
27 * map the internal colors to the external data lines. We only support
28 * the following mappings at the moment.
29 */
30enum disp_data_mapping {
31 /* blue -> d[0..5], green -> d[6..11], red -> d[12..17] */
32 IPU_DISP_DATA_MAPPING_RGB666,
33 /* blue -> d[0..4], green -> d[5..10], red -> d[11..15] */
34 IPU_DISP_DATA_MAPPING_RGB565,
35 /* blue -> d[0..7], green -> d[8..15], red -> d[16..23] */
36 IPU_DISP_DATA_MAPPING_RGB888,
37};
38
39/**
40 * struct mx3fb_platform_data - mx3fb platform data
41 *
42 * @dma_dev: pointer to the dma-device, used for dma-slave connection
43 * @mode: pointer to a platform-provided per mxc_register_fb() videomode
44 */
45struct mx3fb_platform_data {
46 struct device *dma_dev;
47 const char *name;
48 const struct fb_videomode *mode;
49 int num_modes;
50 enum disp_data_mapping disp_data_fmt;
51};
52
53#endif
diff --git a/include/linux/platform_data/video-nuc900fb.h b/include/linux/platform_data/video-nuc900fb.h
new file mode 100644
index 000000000000..cec5ece765ed
--- /dev/null
+++ b/include/linux/platform_data/video-nuc900fb.h
@@ -0,0 +1,83 @@
1/* linux/include/asm/arch-nuc900/fb.h
2 *
3 * Copyright (c) 2008 Nuvoton technology corporation
4 * All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * Changelog:
12 *
13 * 2008/08/26 vincen.zswan modify this file for LCD.
14 */
15
16#ifndef __ASM_ARM_FB_H
17#define __ASM_ARM_FB_H
18
19
20
21/* LCD Controller Hardware Desc */
22struct nuc900fb_hw {
23 unsigned int lcd_dccs;
24 unsigned int lcd_device_ctrl;
25 unsigned int lcd_mpulcd_cmd;
26 unsigned int lcd_int_cs;
27 unsigned int lcd_crtc_size;
28 unsigned int lcd_crtc_dend;
29 unsigned int lcd_crtc_hr;
30 unsigned int lcd_crtc_hsync;
31 unsigned int lcd_crtc_vr;
32 unsigned int lcd_va_baddr0;
33 unsigned int lcd_va_baddr1;
34 unsigned int lcd_va_fbctrl;
35 unsigned int lcd_va_scale;
36 unsigned int lcd_va_test;
37 unsigned int lcd_va_win;
38 unsigned int lcd_va_stuff;
39};
40
41/* LCD Display Description */
42struct nuc900fb_display {
43 /* LCD Image type */
44 unsigned type;
45
46 /* LCD Screen Size */
47 unsigned short width;
48 unsigned short height;
49
50 /* LCD Screen Info */
51 unsigned short xres;
52 unsigned short yres;
53 unsigned short bpp;
54
55 unsigned long pixclock;
56 unsigned short left_margin;
57 unsigned short right_margin;
58 unsigned short hsync_len;
59 unsigned short upper_margin;
60 unsigned short lower_margin;
61 unsigned short vsync_len;
62
63 /* hardware special register value */
64 unsigned int dccs;
65 unsigned int devctl;
66 unsigned int fbctrl;
67 unsigned int scale;
68};
69
70struct nuc900fb_mach_info {
71 struct nuc900fb_display *displays;
72 unsigned num_displays;
73 unsigned default_display;
74 /* GPIO Setting Info */
75 unsigned gpio_dir;
76 unsigned gpio_dir_mask;
77 unsigned gpio_data;
78 unsigned gpio_data_mask;
79};
80
81extern void __init nuc900_fb_set_platdata(struct nuc900fb_mach_info *);
82
83#endif /* __ASM_ARM_FB_H */
diff --git a/include/linux/platform_data/video-pxafb.h b/include/linux/platform_data/video-pxafb.h
new file mode 100644
index 000000000000..486b4c519ae2
--- /dev/null
+++ b/include/linux/platform_data/video-pxafb.h
@@ -0,0 +1,175 @@
1/*
2 * arch/arm/mach-pxa/include/mach/pxafb.h
3 *
4 * Support for the xscale frame buffer.
5 *
6 * Author: Jean-Frederic Clere
7 * Created: Sep 22, 2003
8 * Copyright: jfclere@sinix.net
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 version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/fb.h>
16#include <mach/regs-lcd.h>
17
18/*
19 * Supported LCD connections
20 *
21 * bits 0 - 3: for LCD panel type:
22 *
23 * STN - for passive matrix
24 * DSTN - for dual scan passive matrix
25 * TFT - for active matrix
26 *
27 * bits 4 - 9 : for bus width
28 * bits 10-17 : for AC Bias Pin Frequency
29 * bit 18 : for output enable polarity
30 * bit 19 : for pixel clock edge
31 * bit 20 : for output pixel format when base is RGBT16
32 */
33#define LCD_CONN_TYPE(_x) ((_x) & 0x0f)
34#define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f)
35
36#define LCD_TYPE_MASK 0xf
37#define LCD_TYPE_UNKNOWN 0
38#define LCD_TYPE_MONO_STN 1
39#define LCD_TYPE_MONO_DSTN 2
40#define LCD_TYPE_COLOR_STN 3
41#define LCD_TYPE_COLOR_DSTN 4
42#define LCD_TYPE_COLOR_TFT 5
43#define LCD_TYPE_SMART_PANEL 6
44#define LCD_TYPE_MAX 7
45
46#define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN)
47#define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN)
48#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
49#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
50#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
51#define LCD_COLOR_TFT_8BPP ((8 << 4) | LCD_TYPE_COLOR_TFT)
52#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
53#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
54#define LCD_SMART_PANEL_8BPP ((8 << 4) | LCD_TYPE_SMART_PANEL)
55#define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL)
56#define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL)
57
58#define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10)
59#define LCD_BIAS_ACTIVE_HIGH (0 << 18)
60#define LCD_BIAS_ACTIVE_LOW (1 << 18)
61#define LCD_PCLK_EDGE_RISE (0 << 19)
62#define LCD_PCLK_EDGE_FALL (1 << 19)
63#define LCD_ALTERNATE_MAPPING (1 << 20)
64
65/*
66 * This structure describes the machine which we are running on.
67 * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
68 * of linux/drivers/video/pxafb.c
69 */
70struct pxafb_mode_info {
71 u_long pixclock;
72
73 u_short xres;
74 u_short yres;
75
76 u_char bpp;
77 u_int cmap_greyscale:1,
78 depth:8,
79 transparency:1,
80 unused:22;
81
82 /* Parallel Mode Timing */
83 u_char hsync_len;
84 u_char left_margin;
85 u_char right_margin;
86
87 u_char vsync_len;
88 u_char upper_margin;
89 u_char lower_margin;
90 u_char sync;
91
92 /* Smart Panel Mode Timing - see PXA27x DM 7.4.15.0.3 for details
93 * Note:
94 * 1. all parameters in nanosecond (ns)
95 * 2. a0cs{rd,wr}_set_hld are controlled by the same register bits
96 * in pxa27x and pxa3xx, initialize them to the same value or
97 * the larger one will be used
98 * 3. same to {rd,wr}_pulse_width
99 *
100 * 4. LCD_PCLK_EDGE_{RISE,FALL} controls the L_PCLK_WR polarity
101 * 5. sync & FB_SYNC_HOR_HIGH_ACT controls the L_LCLK_A0
102 * 6. sync & FB_SYNC_VERT_HIGH_ACT controls the L_LCLK_RD
103 */
104 unsigned a0csrd_set_hld; /* A0 and CS Setup/Hold Time before/after L_FCLK_RD */
105 unsigned a0cswr_set_hld; /* A0 and CS Setup/Hold Time before/after L_PCLK_WR */
106 unsigned wr_pulse_width; /* L_PCLK_WR pulse width */
107 unsigned rd_pulse_width; /* L_FCLK_RD pulse width */
108 unsigned cmd_inh_time; /* Command Inhibit time between two writes */
109 unsigned op_hold_time; /* Output Hold time from L_FCLK_RD negation */
110};
111
112struct pxafb_mach_info {
113 struct pxafb_mode_info *modes;
114 unsigned int num_modes;
115
116 unsigned int lcd_conn;
117 unsigned long video_mem_size;
118
119 u_int fixed_modes:1,
120 cmap_inverse:1,
121 cmap_static:1,
122 acceleration_enabled:1,
123 unused:28;
124
125 /* The following should be defined in LCCR0
126 * LCCR0_Act or LCCR0_Pas Active or Passive
127 * LCCR0_Sngl or LCCR0_Dual Single/Dual panel
128 * LCCR0_Mono or LCCR0_Color Mono/Color
129 * LCCR0_4PixMono or LCCR0_8PixMono (in mono single mode)
130 * LCCR0_DMADel(Tcpu) (optional) DMA request delay
131 *
132 * The following should not be defined in LCCR0:
133 * LCCR0_OUM, LCCR0_BM, LCCR0_QDM, LCCR0_DIS, LCCR0_EFM
134 * LCCR0_IUM, LCCR0_SFM, LCCR0_LDM, LCCR0_ENB
135 */
136 u_int lccr0;
137 /* The following should be defined in LCCR3
138 * LCCR3_OutEnH or LCCR3_OutEnL Output enable polarity
139 * LCCR3_PixRsEdg or LCCR3_PixFlEdg Pixel clock edge type
140 * LCCR3_Acb(X) AB Bias pin frequency
141 * LCCR3_DPC (optional) Double Pixel Clock mode (untested)
142 *
143 * The following should not be defined in LCCR3
144 * LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp
145 */
146 u_int lccr3;
147 /* The following should be defined in LCCR4
148 * LCCR4_PAL_FOR_0 or LCCR4_PAL_FOR_1 or LCCR4_PAL_FOR_2
149 *
150 * All other bits in LCCR4 should be left alone.
151 */
152 u_int lccr4;
153 void (*pxafb_backlight_power)(int);
154 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
155 void (*smart_update)(struct fb_info *);
156};
157
158void pxa_set_fb_info(struct device *, struct pxafb_mach_info *);
159unsigned long pxafb_get_hsync_time(struct device *dev);
160
161#ifdef CONFIG_FB_PXA_SMARTPANEL
162extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
163extern int pxafb_smart_flush(struct fb_info *info);
164#else
165static inline int pxafb_smart_queue(struct fb_info *info,
166 uint16_t *cmds, int n)
167{
168 return 0;
169}
170
171static inline int pxafb_smart_flush(struct fb_info *info)
172{
173 return 0;
174}
175#endif
diff --git a/include/linux/platform_data/video-vt8500lcdfb.h b/include/linux/platform_data/video-vt8500lcdfb.h
new file mode 100644
index 000000000000..7f399c370fe0
--- /dev/null
+++ b/include/linux/platform_data/video-vt8500lcdfb.h
@@ -0,0 +1,31 @@
1/*
2 * VT8500/WM8505 Frame Buffer platform data definitions
3 *
4 * Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _VT8500FB_H
17#define _VT8500FB_H
18
19#include <linux/fb.h>
20
21struct vt8500fb_platform_data {
22 struct fb_videomode mode;
23 u32 xres_virtual;
24 u32 yres_virtual;
25 u32 bpp;
26 unsigned long video_mem_phys;
27 void *video_mem_virt;
28 unsigned long video_mem_len;
29};
30
31#endif /* _VT8500FB_H */
diff --git a/include/linux/platform_data/voltage-omap.h b/include/linux/platform_data/voltage-omap.h
new file mode 100644
index 000000000000..5be4d5def427
--- /dev/null
+++ b/include/linux/platform_data/voltage-omap.h
@@ -0,0 +1,39 @@
1/*
2 * OMAP Voltage Management Routines
3 *
4 * Copyright (C) 2011, Texas Instruments, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ARCH_ARM_OMAP_VOLTAGE_H
12#define __ARCH_ARM_OMAP_VOLTAGE_H
13
14/**
15 * struct omap_volt_data - Omap voltage specific data.
16 * @voltage_nominal: The possible voltage value in uV
17 * @sr_efuse_offs: The offset of the efuse register(from system
18 * control module base address) from where to read
19 * the n-target value for the smartreflex module.
20 * @sr_errminlimit: Error min limit value for smartreflex. This value
21 * differs at differnet opp and thus is linked
22 * with voltage.
23 * @vp_errorgain: Error gain value for the voltage processor. This
24 * field also differs according to the voltage/opp.
25 */
26struct omap_volt_data {
27 u32 volt_nominal;
28 u32 sr_efuse_offs;
29 u8 sr_errminlimit;
30 u8 vp_errgain;
31};
32struct voltagedomain;
33
34struct voltagedomain *voltdm_lookup(const char *name);
35int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt);
36unsigned long voltdm_get_voltage(struct voltagedomain *voltdm);
37struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
38 unsigned long volt);
39#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 60e9994ef405..5711e9525a2a 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -14,11 +14,15 @@
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/mod_devicetable.h> 15#include <linux/mod_devicetable.h>
16 16
17#define PLATFORM_DEVID_NONE (-1)
18#define PLATFORM_DEVID_AUTO (-2)
19
17struct mfd_cell; 20struct mfd_cell;
18 21
19struct platform_device { 22struct platform_device {
20 const char * name; 23 const char * name;
21 int id; 24 int id;
25 bool id_auto;
22 struct device dev; 26 struct device dev;
23 u32 num_resources; 27 u32 num_resources;
24 struct resource * resource; 28 struct resource * resource;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index f067e60a3832..007e687c4f69 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -510,12 +510,14 @@ struct dev_pm_info {
510 bool is_prepared:1; /* Owned by the PM core */ 510 bool is_prepared:1; /* Owned by the PM core */
511 bool is_suspended:1; /* Ditto */ 511 bool is_suspended:1; /* Ditto */
512 bool ignore_children:1; 512 bool ignore_children:1;
513 bool early_init:1; /* Owned by the PM core */
513 spinlock_t lock; 514 spinlock_t lock;
514#ifdef CONFIG_PM_SLEEP 515#ifdef CONFIG_PM_SLEEP
515 struct list_head entry; 516 struct list_head entry;
516 struct completion completion; 517 struct completion completion;
517 struct wakeup_source *wakeup; 518 struct wakeup_source *wakeup;
518 bool wakeup_path:1; 519 bool wakeup_path:1;
520 bool syscore:1;
519#else 521#else
520 unsigned int should_wakeup:1; 522 unsigned int should_wakeup:1;
521#endif 523#endif
@@ -638,6 +640,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
638 } while (0) 640 } while (0)
639 641
640extern int device_pm_wait_for_dev(struct device *sub, struct device *dev); 642extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
643extern void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *));
641 644
642extern int pm_generic_prepare(struct device *dev); 645extern int pm_generic_prepare(struct device *dev);
643extern int pm_generic_suspend_late(struct device *dev); 646extern int pm_generic_suspend_late(struct device *dev);
@@ -677,6 +680,10 @@ static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
677 return 0; 680 return 0;
678} 681}
679 682
683static inline void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *))
684{
685}
686
680#define pm_generic_prepare NULL 687#define pm_generic_prepare NULL
681#define pm_generic_suspend NULL 688#define pm_generic_suspend NULL
682#define pm_generic_resume NULL 689#define pm_generic_resume NULL
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index a7d6172922d4..7c1d252b20c0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -114,7 +114,6 @@ struct generic_pm_domain_data {
114 struct mutex lock; 114 struct mutex lock;
115 unsigned int refcount; 115 unsigned int refcount;
116 bool need_restore; 116 bool need_restore;
117 bool always_on;
118}; 117};
119 118
120#ifdef CONFIG_PM_GENERIC_DOMAINS 119#ifdef CONFIG_PM_GENERIC_DOMAINS
@@ -139,36 +138,32 @@ extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
139 struct device *dev, 138 struct device *dev,
140 struct gpd_timing_data *td); 139 struct gpd_timing_data *td);
141 140
142static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 141extern int __pm_genpd_name_add_device(const char *domain_name,
143 struct device *dev) 142 struct device *dev,
144{ 143 struct gpd_timing_data *td);
145 return __pm_genpd_add_device(genpd, dev, NULL);
146}
147
148static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
149 struct device *dev)
150{
151 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
152}
153 144
154extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 145extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
155 struct device *dev); 146 struct device *dev);
156extern void pm_genpd_dev_always_on(struct device *dev, bool val);
157extern void pm_genpd_dev_need_restore(struct device *dev, bool val); 147extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
158extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 148extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
159 struct generic_pm_domain *new_subdomain); 149 struct generic_pm_domain *new_subdomain);
150extern int pm_genpd_add_subdomain_names(const char *master_name,
151 const char *subdomain_name);
160extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
161 struct generic_pm_domain *target); 153 struct generic_pm_domain *target);
162extern int pm_genpd_add_callbacks(struct device *dev, 154extern int pm_genpd_add_callbacks(struct device *dev,
163 struct gpd_dev_ops *ops, 155 struct gpd_dev_ops *ops,
164 struct gpd_timing_data *td); 156 struct gpd_timing_data *td);
165extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td); 157extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
166extern int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state); 158extern int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state);
167extern int genpd_detach_cpuidle(struct generic_pm_domain *genpd); 159extern int pm_genpd_name_attach_cpuidle(const char *name, int state);
160extern int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd);
161extern int pm_genpd_name_detach_cpuidle(const char *name);
168extern void pm_genpd_init(struct generic_pm_domain *genpd, 162extern void pm_genpd_init(struct generic_pm_domain *genpd,
169 struct dev_power_governor *gov, bool is_off); 163 struct dev_power_governor *gov, bool is_off);
170 164
171extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 165extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
166extern int pm_genpd_name_poweron(const char *domain_name);
172 167
173extern bool default_stop_ok(struct device *dev); 168extern bool default_stop_ok(struct device *dev);
174 169
@@ -189,8 +184,15 @@ static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
189{ 184{
190 return -ENOSYS; 185 return -ENOSYS;
191} 186}
192static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 187static inline int __pm_genpd_of_add_device(struct device_node *genpd_node,
193 struct device *dev) 188 struct device *dev,
189 struct gpd_timing_data *td)
190{
191 return -ENOSYS;
192}
193static inline int __pm_genpd_name_add_device(const char *domain_name,
194 struct device *dev,
195 struct gpd_timing_data *td)
194{ 196{
195 return -ENOSYS; 197 return -ENOSYS;
196} 198}
@@ -199,13 +201,17 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
199{ 201{
200 return -ENOSYS; 202 return -ENOSYS;
201} 203}
202static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
203static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {} 204static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
204static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 205static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
205 struct generic_pm_domain *new_sd) 206 struct generic_pm_domain *new_sd)
206{ 207{
207 return -ENOSYS; 208 return -ENOSYS;
208} 209}
210static inline int pm_genpd_add_subdomain_names(const char *master_name,
211 const char *subdomain_name)
212{
213 return -ENOSYS;
214}
209static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 215static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
210 struct generic_pm_domain *target) 216 struct generic_pm_domain *target)
211{ 217{
@@ -221,11 +227,19 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
221{ 227{
222 return -ENOSYS; 228 return -ENOSYS;
223} 229}
224static inline int genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st) 230static inline int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int st)
225{ 231{
226 return -ENOSYS; 232 return -ENOSYS;
227} 233}
228static inline int genpd_detach_cpuidle(struct generic_pm_domain *genpd) 234static inline int pm_genpd_name_attach_cpuidle(const char *name, int state)
235{
236 return -ENOSYS;
237}
238static inline int pm_genpd_detach_cpuidle(struct generic_pm_domain *genpd)
239{
240 return -ENOSYS;
241}
242static inline int pm_genpd_name_detach_cpuidle(const char *name)
229{ 243{
230 return -ENOSYS; 244 return -ENOSYS;
231} 245}
@@ -237,6 +251,10 @@ static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
237{ 251{
238 return -ENOSYS; 252 return -ENOSYS;
239} 253}
254static inline int pm_genpd_name_poweron(const char *domain_name)
255{
256 return -ENOSYS;
257}
240static inline bool default_stop_ok(struct device *dev) 258static inline bool default_stop_ok(struct device *dev)
241{ 259{
242 return false; 260 return false;
@@ -245,6 +263,24 @@ static inline bool default_stop_ok(struct device *dev)
245#define pm_domain_always_on_gov NULL 263#define pm_domain_always_on_gov NULL
246#endif 264#endif
247 265
266static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
267 struct device *dev)
268{
269 return __pm_genpd_add_device(genpd, dev, NULL);
270}
271
272static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
273 struct device *dev)
274{
275 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
276}
277
278static inline int pm_genpd_name_add_device(const char *domain_name,
279 struct device *dev)
280{
281 return __pm_genpd_name_add_device(domain_name, dev, NULL);
282}
283
248static inline int pm_genpd_remove_callbacks(struct device *dev) 284static inline int pm_genpd_remove_callbacks(struct device *dev)
249{ 285{
250 return __pm_genpd_remove_callbacks(dev, true); 286 return __pm_genpd_remove_callbacks(dev, true);
@@ -258,4 +294,20 @@ static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
258static inline void pm_genpd_poweroff_unused(void) {} 294static inline void pm_genpd_poweroff_unused(void) {}
259#endif 295#endif
260 296
297#ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
298extern void pm_genpd_syscore_switch(struct device *dev, bool suspend);
299#else
300static inline void pm_genpd_syscore_switch(struct device *dev, bool suspend) {}
301#endif
302
303static inline void pm_genpd_syscore_poweroff(struct device *dev)
304{
305 pm_genpd_syscore_switch(dev, true);
306}
307
308static inline void pm_genpd_syscore_poweron(struct device *dev)
309{
310 pm_genpd_syscore_switch(dev, false);
311}
312
261#endif /* _LINUX_PM_DOMAIN_H */ 313#endif /* _LINUX_PM_DOMAIN_H */
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index 435dd5fa7453..fe25876c1a5d 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -40,7 +40,6 @@
40#define __PNFS_OSD_XDR_H__ 40#define __PNFS_OSD_XDR_H__
41 41
42#include <linux/nfs_fs.h> 42#include <linux/nfs_fs.h>
43#include <linux/nfs_page.h>
44 43
45/* 44/*
46 * draft-ietf-nfsv4-minorversion-22 45 * draft-ietf-nfsv4-minorversion-22
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
index 11bad91c4433..7931efe71175 100644
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -36,7 +36,13 @@
36struct posix_acl_entry { 36struct posix_acl_entry {
37 short e_tag; 37 short e_tag;
38 unsigned short e_perm; 38 unsigned short e_perm;
39 unsigned int e_id; 39 union {
40 kuid_t e_uid;
41 kgid_t e_gid;
42#ifndef CONFIG_UIDGID_STRICT_TYPE_CHECKS
43 unsigned int e_id;
44#endif
45 };
40}; 46};
41 47
42struct posix_acl { 48struct posix_acl {
diff --git a/include/linux/posix_acl_xattr.h b/include/linux/posix_acl_xattr.h
index 6e53c34035cd..ad93ad0f1db0 100644
--- a/include/linux/posix_acl_xattr.h
+++ b/include/linux/posix_acl_xattr.h
@@ -52,7 +52,21 @@ posix_acl_xattr_count(size_t size)
52 return size / sizeof(posix_acl_xattr_entry); 52 return size / sizeof(posix_acl_xattr_entry);
53} 53}
54 54
55struct posix_acl *posix_acl_from_xattr(const void *value, size_t size); 55#ifdef CONFIG_FS_POSIX_ACL
56int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size); 56void posix_acl_fix_xattr_from_user(void *value, size_t size);
57void posix_acl_fix_xattr_to_user(void *value, size_t size);
58#else
59static inline void posix_acl_fix_xattr_from_user(void *value, size_t size)
60{
61}
62static inline void posix_acl_fix_xattr_to_user(void *value, size_t size)
63{
64}
65#endif
66
67struct posix_acl *posix_acl_from_xattr(struct user_namespace *user_ns,
68 const void *value, size_t size);
69int posix_acl_to_xattr(struct user_namespace *user_ns,
70 const struct posix_acl *acl, void *buffer, size_t size);
57 71
58#endif /* _POSIX_ACL_XATTR_H */ 72#endif /* _POSIX_ACL_XATTR_H */
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index cd22029e32aa..0e86840eb603 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -109,24 +109,43 @@ struct charger_cable {
109 * struct charger_regulator 109 * struct charger_regulator
110 * @regulator_name: the name of regulator for using charger. 110 * @regulator_name: the name of regulator for using charger.
111 * @consumer: the regulator consumer for the charger. 111 * @consumer: the regulator consumer for the charger.
112 * @externally_control:
113 * Set if the charger-manager cannot control charger,
114 * the charger will be maintained with disabled state.
112 * @cables: 115 * @cables:
113 * the array of charger cables to enable/disable charger 116 * the array of charger cables to enable/disable charger
114 * and set current limit according to constratint data of 117 * and set current limit according to constratint data of
115 * struct charger_cable if only charger cable included 118 * struct charger_cable if only charger cable included
116 * in the array of charger cables is attached/detached. 119 * in the array of charger cables is attached/detached.
117 * @num_cables: the number of charger cables. 120 * @num_cables: the number of charger cables.
121 * @attr_g: Attribute group for the charger(regulator)
122 * @attr_name: "name" sysfs entry
123 * @attr_state: "state" sysfs entry
124 * @attr_externally_control: "externally_control" sysfs entry
125 * @attrs: Arrays pointing to attr_name/state/externally_control for attr_g
118 */ 126 */
119struct charger_regulator { 127struct charger_regulator {
120 /* The name of regulator for charging */ 128 /* The name of regulator for charging */
121 const char *regulator_name; 129 const char *regulator_name;
122 struct regulator *consumer; 130 struct regulator *consumer;
123 131
132 /* charger never on when system is on */
133 int externally_control;
134
124 /* 135 /*
125 * Store constraint information related to current limit, 136 * Store constraint information related to current limit,
126 * each cable have different condition for charging. 137 * each cable have different condition for charging.
127 */ 138 */
128 struct charger_cable *cables; 139 struct charger_cable *cables;
129 int num_cables; 140 int num_cables;
141
142 struct attribute_group attr_g;
143 struct device_attribute attr_name;
144 struct device_attribute attr_state;
145 struct device_attribute attr_externally_control;
146 struct attribute *attrs[4];
147
148 struct charger_manager *cm;
130}; 149};
131 150
132/** 151/**
@@ -140,7 +159,11 @@ struct charger_regulator {
140 * If it has dropped more than fullbatt_vchkdrop_uV after 159 * If it has dropped more than fullbatt_vchkdrop_uV after
141 * fullbatt_vchkdrop_ms, CM will restart charging. 160 * fullbatt_vchkdrop_ms, CM will restart charging.
142 * @fullbatt_uV: voltage in microvolt 161 * @fullbatt_uV: voltage in microvolt
143 * If it is not being charged and VBATT >= fullbatt_uV, 162 * If VBATT >= fullbatt_uV, it is assumed to be full.
163 * @fullbatt_soc: state of Charge in %
164 * If state of Charge >= fullbatt_soc, it is assumed to be full.
165 * @fullbatt_full_capacity: full capacity measure
166 * If full capacity of battery >= fullbatt_full_capacity,
144 * it is assumed to be full. 167 * it is assumed to be full.
145 * @polling_interval_ms: interval in millisecond at which 168 * @polling_interval_ms: interval in millisecond at which
146 * charger manager will monitor battery health 169 * charger manager will monitor battery health
@@ -148,7 +171,7 @@ struct charger_regulator {
148 * Specify where information for existance of battery can be obtained 171 * Specify where information for existance of battery can be obtained
149 * @psy_charger_stat: the names of power-supply for chargers 172 * @psy_charger_stat: the names of power-supply for chargers
150 * @num_charger_regulator: the number of entries in charger_regulators 173 * @num_charger_regulator: the number of entries in charger_regulators
151 * @charger_regulators: array of regulator_bulk_data for chargers 174 * @charger_regulators: array of charger regulators
152 * @psy_fuel_gauge: the name of power-supply for fuel gauge 175 * @psy_fuel_gauge: the name of power-supply for fuel gauge
153 * @temperature_out_of_range: 176 * @temperature_out_of_range:
154 * Determine whether the status is overheat or cold or normal. 177 * Determine whether the status is overheat or cold or normal.
@@ -158,6 +181,13 @@ struct charger_regulator {
158 * @measure_battery_temp: 181 * @measure_battery_temp:
159 * true: measure battery temperature 182 * true: measure battery temperature
160 * false: measure ambient temperature 183 * false: measure ambient temperature
184 * @charging_max_duration_ms: Maximum possible duration for charging
185 * If whole charging duration exceed 'charging_max_duration_ms',
186 * cm stop charging.
187 * @discharging_max_duration_ms:
188 * Maximum possible duration for discharging with charger cable
189 * after full-batt. If discharging duration exceed 'discharging
190 * max_duration_ms', cm start charging.
161 */ 191 */
162struct charger_desc { 192struct charger_desc {
163 char *psy_name; 193 char *psy_name;
@@ -168,6 +198,8 @@ struct charger_desc {
168 unsigned int fullbatt_vchkdrop_ms; 198 unsigned int fullbatt_vchkdrop_ms;
169 unsigned int fullbatt_vchkdrop_uV; 199 unsigned int fullbatt_vchkdrop_uV;
170 unsigned int fullbatt_uV; 200 unsigned int fullbatt_uV;
201 unsigned int fullbatt_soc;
202 unsigned int fullbatt_full_capacity;
171 203
172 enum data_source battery_present; 204 enum data_source battery_present;
173 205
@@ -180,6 +212,9 @@ struct charger_desc {
180 212
181 int (*temperature_out_of_range)(int *mC); 213 int (*temperature_out_of_range)(int *mC);
182 bool measure_battery_temp; 214 bool measure_battery_temp;
215
216 u64 charging_max_duration_ms;
217 u64 discharging_max_duration_ms;
183}; 218};
184 219
185#define PSY_NAME_MAX 30 220#define PSY_NAME_MAX 30
@@ -194,8 +229,6 @@ struct charger_desc {
194 * @charger_enabled: the state of charger 229 * @charger_enabled: the state of charger
195 * @fullbatt_vchk_jiffies_at: 230 * @fullbatt_vchk_jiffies_at:
196 * jiffies at the time full battery check will occur. 231 * jiffies at the time full battery check will occur.
197 * @fullbatt_vchk_uV: voltage in microvolt
198 * criteria for full battery
199 * @fullbatt_vchk_work: work queue for full battery check 232 * @fullbatt_vchk_work: work queue for full battery check
200 * @emergency_stop: 233 * @emergency_stop:
201 * When setting true, stop charging 234 * When setting true, stop charging
@@ -206,6 +239,8 @@ struct charger_desc {
206 * saved status of external power before entering suspend-to-RAM 239 * saved status of external power before entering suspend-to-RAM
207 * @status_save_batt: 240 * @status_save_batt:
208 * saved status of battery before entering suspend-to-RAM 241 * saved status of battery before entering suspend-to-RAM
242 * @charging_start_time: saved start time of enabling charging
243 * @charging_end_time: saved end time of disabling charging
209 */ 244 */
210struct charger_manager { 245struct charger_manager {
211 struct list_head entry; 246 struct list_head entry;
@@ -218,7 +253,6 @@ struct charger_manager {
218 bool charger_enabled; 253 bool charger_enabled;
219 254
220 unsigned long fullbatt_vchk_jiffies_at; 255 unsigned long fullbatt_vchk_jiffies_at;
221 unsigned int fullbatt_vchk_uV;
222 struct delayed_work fullbatt_vchk_work; 256 struct delayed_work fullbatt_vchk_work;
223 257
224 int emergency_stop; 258 int emergency_stop;
@@ -229,6 +263,9 @@ struct charger_manager {
229 263
230 bool status_save_ext_pwr_inserted; 264 bool status_save_ext_pwr_inserted;
231 bool status_save_batt; 265 bool status_save_batt;
266
267 u64 charging_start_time;
268 u64 charging_end_time;
232}; 269};
233 270
234#ifdef CONFIG_CHARGER_MANAGER 271#ifdef CONFIG_CHARGER_MANAGER
diff --git a/include/linux/power/generic-adc-battery.h b/include/linux/power/generic-adc-battery.h
new file mode 100644
index 000000000000..b1ebe08533b6
--- /dev/null
+++ b/include/linux/power/generic-adc-battery.h
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2012, Anish Kumar <anish198519851985@gmail.com>
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 as
5 * published by the Free Software Foundation.
6 */
7
8#ifndef GENERIC_ADC_BATTERY_H
9#define GENERIC_ADC_BATTERY_H
10
11/**
12 * struct gab_platform_data - platform_data for generic adc iio battery driver.
13 * @battery_info: recommended structure to specify static power supply
14 * parameters
15 * @cal_charge: calculate charge level.
16 * @gpio_charge_finished: gpio for the charger.
17 * @gpio_inverted: Should be 1 if the GPIO is active low otherwise 0
18 * @jitter_delay: delay required after the interrupt to check battery
19 * status.Default set is 10ms.
20 */
21struct gab_platform_data {
22 struct power_supply_info battery_info;
23 int (*cal_charge)(long value);
24 int gpio_charge_finished;
25 bool gpio_inverted;
26 int jitter_delay;
27};
28
29#endif /* GENERIC_ADC_BATTERY_H */
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index 3101e62a1213..4a496ebc7d73 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -23,7 +23,7 @@
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <plat/voltage.h> 26#include <linux/platform_data/voltage-omap.h>
27 27
28/* 28/*
29 * Different Smartreflex IPs version. The v1 is the 65nm version used in 29 * Different Smartreflex IPs version. The v1 is the 65nm version used in
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 0bafbb15f29c..e5ef45834c3c 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -88,6 +88,7 @@ enum power_supply_property {
88 POWER_SUPPLY_PROP_HEALTH, 88 POWER_SUPPLY_PROP_HEALTH,
89 POWER_SUPPLY_PROP_PRESENT, 89 POWER_SUPPLY_PROP_PRESENT,
90 POWER_SUPPLY_PROP_ONLINE, 90 POWER_SUPPLY_PROP_ONLINE,
91 POWER_SUPPLY_PROP_AUTHENTIC,
91 POWER_SUPPLY_PROP_TECHNOLOGY, 92 POWER_SUPPLY_PROP_TECHNOLOGY,
92 POWER_SUPPLY_PROP_CYCLE_COUNT, 93 POWER_SUPPLY_PROP_CYCLE_COUNT,
93 POWER_SUPPLY_PROP_VOLTAGE_MAX, 94 POWER_SUPPLY_PROP_VOLTAGE_MAX,
@@ -110,7 +111,9 @@ enum power_supply_property {
110 POWER_SUPPLY_PROP_CHARGE_AVG, 111 POWER_SUPPLY_PROP_CHARGE_AVG,
111 POWER_SUPPLY_PROP_CHARGE_COUNTER, 112 POWER_SUPPLY_PROP_CHARGE_COUNTER,
112 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, 113 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
113 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
114 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 117 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
115 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 118 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
116 POWER_SUPPLY_PROP_ENERGY_FULL, 119 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -248,6 +251,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
248 case POWER_SUPPLY_PROP_CHARGE_AVG: 251 case POWER_SUPPLY_PROP_CHARGE_AVG:
249 case POWER_SUPPLY_PROP_CHARGE_COUNTER: 252 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
250 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: 253 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
254 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
251 case POWER_SUPPLY_PROP_CURRENT_MAX: 255 case POWER_SUPPLY_PROP_CURRENT_MAX:
252 case POWER_SUPPLY_PROP_CURRENT_NOW: 256 case POWER_SUPPLY_PROP_CURRENT_NOW:
253 case POWER_SUPPLY_PROP_CURRENT_AVG: 257 case POWER_SUPPLY_PROP_CURRENT_AVG:
@@ -276,6 +280,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
276 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 280 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
277 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 281 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
278 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 282 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
283 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
279 case POWER_SUPPLY_PROP_POWER_NOW: 284 case POWER_SUPPLY_PROP_POWER_NOW:
280 return 1; 285 return 1;
281 default: 286 default:
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 94048547f29a..0cc45ae1afd5 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -116,5 +116,14 @@ static inline void pps_get_ts(struct pps_event_time *ts)
116 116
117#endif /* CONFIG_NTP_PPS */ 117#endif /* CONFIG_NTP_PPS */
118 118
119/* Subtract known time delay from PPS event time(s) */
120static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec delta)
121{
122 ts->ts_real = timespec_sub(ts->ts_real, delta);
123#ifdef CONFIG_NTP_PPS
124 ts->ts_raw = timespec_sub(ts->ts_raw, delta);
125#endif
126}
127
119#endif /* LINUX_PPS_KERNEL_H */ 128#endif /* LINUX_PPS_KERNEL_H */
120 129
diff --git a/include/linux/prio_tree.h b/include/linux/prio_tree.h
deleted file mode 100644
index db04abb557e0..000000000000
--- a/include/linux/prio_tree.h
+++ /dev/null
@@ -1,120 +0,0 @@
1#ifndef _LINUX_PRIO_TREE_H
2#define _LINUX_PRIO_TREE_H
3
4/*
5 * K&R 2nd ed. A8.3 somewhat obliquely hints that initial sequences of struct
6 * fields with identical types should end up at the same location. We'll use
7 * this until we can scrap struct raw_prio_tree_node.
8 *
9 * Note: all this could be done more elegantly by using unnamed union/struct
10 * fields. However, gcc 2.95.3 and apparently also gcc 3.0.4 don't support this
11 * language extension.
12 */
13
14struct raw_prio_tree_node {
15 struct prio_tree_node *left;
16 struct prio_tree_node *right;
17 struct prio_tree_node *parent;
18};
19
20struct prio_tree_node {
21 struct prio_tree_node *left;
22 struct prio_tree_node *right;
23 struct prio_tree_node *parent;
24 unsigned long start;
25 unsigned long last; /* last location _in_ interval */
26};
27
28struct prio_tree_root {
29 struct prio_tree_node *prio_tree_node;
30 unsigned short index_bits;
31 unsigned short raw;
32 /*
33 * 0: nodes are of type struct prio_tree_node
34 * 1: nodes are of type raw_prio_tree_node
35 */
36};
37
38struct prio_tree_iter {
39 struct prio_tree_node *cur;
40 unsigned long mask;
41 unsigned long value;
42 int size_level;
43
44 struct prio_tree_root *root;
45 pgoff_t r_index;
46 pgoff_t h_index;
47};
48
49static inline void prio_tree_iter_init(struct prio_tree_iter *iter,
50 struct prio_tree_root *root, pgoff_t r_index, pgoff_t h_index)
51{
52 iter->root = root;
53 iter->r_index = r_index;
54 iter->h_index = h_index;
55 iter->cur = NULL;
56}
57
58#define __INIT_PRIO_TREE_ROOT(ptr, _raw) \
59do { \
60 (ptr)->prio_tree_node = NULL; \
61 (ptr)->index_bits = 1; \
62 (ptr)->raw = (_raw); \
63} while (0)
64
65#define INIT_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 0)
66#define INIT_RAW_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 1)
67
68#define INIT_PRIO_TREE_NODE(ptr) \
69do { \
70 (ptr)->left = (ptr)->right = (ptr)->parent = (ptr); \
71} while (0)
72
73#define INIT_PRIO_TREE_ITER(ptr) \
74do { \
75 (ptr)->cur = NULL; \
76 (ptr)->mask = 0UL; \
77 (ptr)->value = 0UL; \
78 (ptr)->size_level = 0; \
79} while (0)
80
81#define prio_tree_entry(ptr, type, member) \
82 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
83
84static inline int prio_tree_empty(const struct prio_tree_root *root)
85{
86 return root->prio_tree_node == NULL;
87}
88
89static inline int prio_tree_root(const struct prio_tree_node *node)
90{
91 return node->parent == node;
92}
93
94static inline int prio_tree_left_empty(const struct prio_tree_node *node)
95{
96 return node->left == node;
97}
98
99static inline int prio_tree_right_empty(const struct prio_tree_node *node)
100{
101 return node->right == node;
102}
103
104
105struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root,
106 struct prio_tree_node *old, struct prio_tree_node *node);
107struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root,
108 struct prio_tree_node *node);
109void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node);
110struct prio_tree_node *prio_tree_next(struct prio_tree_iter *iter);
111
112#define raw_prio_tree_replace(root, old, node) \
113 prio_tree_replace(root, (struct prio_tree_node *) (old), \
114 (struct prio_tree_node *) (node))
115#define raw_prio_tree_insert(root, node) \
116 prio_tree_insert(root, (struct prio_tree_node *) (node))
117#define raw_prio_tree_remove(root, node) \
118 prio_tree_remove(root, (struct prio_tree_node *) (node))
119
120#endif /* _LINUX_PRIO_TREE_H */
diff --git a/include/linux/projid.h b/include/linux/projid.h
new file mode 100644
index 000000000000..36517b95be5c
--- /dev/null
+++ b/include/linux/projid.h
@@ -0,0 +1,104 @@
1#ifndef _LINUX_PROJID_H
2#define _LINUX_PROJID_H
3
4/*
5 * A set of types for the internal kernel types representing project ids.
6 *
7 * The types defined in this header allow distinguishing which project ids in
8 * the kernel are values used by userspace and which project id values are
9 * the internal kernel values. With the addition of user namespaces the values
10 * can be different. Using the type system makes it possible for the compiler
11 * to detect when we overlook these differences.
12 *
13 */
14#include <linux/types.h>
15
16struct user_namespace;
17extern struct user_namespace init_user_ns;
18
19typedef __kernel_uid32_t projid_t;
20
21#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
22
23typedef struct {
24 projid_t val;
25} kprojid_t;
26
27static inline projid_t __kprojid_val(kprojid_t projid)
28{
29 return projid.val;
30}
31
32#define KPROJIDT_INIT(value) (kprojid_t){ value }
33
34#else
35
36typedef projid_t kprojid_t;
37
38static inline projid_t __kprojid_val(kprojid_t projid)
39{
40 return projid;
41}
42
43#define KPROJIDT_INIT(value) ((kprojid_t) value )
44
45#endif
46
47#define INVALID_PROJID KPROJIDT_INIT(-1)
48#define OVERFLOW_PROJID 65534
49
50static inline bool projid_eq(kprojid_t left, kprojid_t right)
51{
52 return __kprojid_val(left) == __kprojid_val(right);
53}
54
55static inline bool projid_lt(kprojid_t left, kprojid_t right)
56{
57 return __kprojid_val(left) < __kprojid_val(right);
58}
59
60static inline bool projid_valid(kprojid_t projid)
61{
62 return !projid_eq(projid, INVALID_PROJID);
63}
64
65#ifdef CONFIG_USER_NS
66
67extern kprojid_t make_kprojid(struct user_namespace *from, projid_t projid);
68
69extern projid_t from_kprojid(struct user_namespace *to, kprojid_t projid);
70extern projid_t from_kprojid_munged(struct user_namespace *to, kprojid_t projid);
71
72static inline bool kprojid_has_mapping(struct user_namespace *ns, kprojid_t projid)
73{
74 return from_kprojid(ns, projid) != (projid_t)-1;
75}
76
77#else
78
79static inline kprojid_t make_kprojid(struct user_namespace *from, projid_t projid)
80{
81 return KPROJIDT_INIT(projid);
82}
83
84static inline projid_t from_kprojid(struct user_namespace *to, kprojid_t kprojid)
85{
86 return __kprojid_val(kprojid);
87}
88
89static inline projid_t from_kprojid_munged(struct user_namespace *to, kprojid_t kprojid)
90{
91 projid_t projid = from_kprojid(to, kprojid);
92 if (projid == (projid_t)-1)
93 projid = OVERFLOW_PROJID;
94 return projid;
95}
96
97static inline bool kprojid_has_mapping(struct user_namespace *ns, kprojid_t projid)
98{
99 return true;
100}
101
102#endif /* CONFIG_USER_NS */
103
104#endif /* _LINUX_PROJID_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index c892587d9b81..ee3034a40884 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -64,14 +64,6 @@ struct pstore_info {
64 void *data; 64 void *data;
65}; 65};
66 66
67
68#ifdef CONFIG_PSTORE_FTRACE
69extern void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip);
70#else
71static inline void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
72{ }
73#endif
74
75#ifdef CONFIG_PSTORE 67#ifdef CONFIG_PSTORE
76extern int pstore_register(struct pstore_info *); 68extern int pstore_register(struct pstore_info *);
77#else 69#else
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 945704c2ed65..f2dc6d8fc680 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -21,6 +21,8 @@
21#ifndef _PTP_CLOCK_KERNEL_H_ 21#ifndef _PTP_CLOCK_KERNEL_H_
22#define _PTP_CLOCK_KERNEL_H_ 22#define _PTP_CLOCK_KERNEL_H_
23 23
24#include <linux/device.h>
25#include <linux/pps_kernel.h>
24#include <linux/ptp_clock.h> 26#include <linux/ptp_clock.h>
25 27
26 28
@@ -40,7 +42,9 @@ struct ptp_clock_request {
40 * struct ptp_clock_info - decribes a PTP hardware clock 42 * struct ptp_clock_info - decribes a PTP hardware clock
41 * 43 *
42 * @owner: The clock driver should set to THIS_MODULE. 44 * @owner: The clock driver should set to THIS_MODULE.
43 * @name: A short name to identify the clock. 45 * @name: A short "friendly name" to identify the clock and to
46 * help distinguish PHY based devices from MAC based ones.
47 * The string is not meant to be a unique id.
44 * @max_adj: The maximum possible frequency adjustment, in parts per billon. 48 * @max_adj: The maximum possible frequency adjustment, in parts per billon.
45 * @n_alarm: The number of programmable alarms. 49 * @n_alarm: The number of programmable alarms.
46 * @n_ext_ts: The number of external time stamp channels. 50 * @n_ext_ts: The number of external time stamp channels.
@@ -92,10 +96,12 @@ struct ptp_clock;
92/** 96/**
93 * ptp_clock_register() - register a PTP hardware clock driver 97 * ptp_clock_register() - register a PTP hardware clock driver
94 * 98 *
95 * @info: Structure describing the new clock. 99 * @info: Structure describing the new clock.
100 * @parent: Pointer to the parent device of the new clock.
96 */ 101 */
97 102
98extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info); 103extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
104 struct device *parent);
99 105
100/** 106/**
101 * ptp_clock_unregister() - unregister a PTP hardware clock driver 107 * ptp_clock_unregister() - unregister a PTP hardware clock driver
@@ -110,6 +116,7 @@ enum ptp_clock_events {
110 PTP_CLOCK_ALARM, 116 PTP_CLOCK_ALARM,
111 PTP_CLOCK_EXTTS, 117 PTP_CLOCK_EXTTS,
112 PTP_CLOCK_PPS, 118 PTP_CLOCK_PPS,
119 PTP_CLOCK_PPSUSR,
113}; 120};
114 121
115/** 122/**
@@ -117,13 +124,17 @@ enum ptp_clock_events {
117 * 124 *
118 * @type: One of the ptp_clock_events enumeration values. 125 * @type: One of the ptp_clock_events enumeration values.
119 * @index: Identifies the source of the event. 126 * @index: Identifies the source of the event.
120 * @timestamp: When the event occured. 127 * @timestamp: When the event occurred (%PTP_CLOCK_EXTTS only).
128 * @pps_times: When the event occurred (%PTP_CLOCK_PPSUSR only).
121 */ 129 */
122 130
123struct ptp_clock_event { 131struct ptp_clock_event {
124 int type; 132 int type;
125 int index; 133 int index;
126 u64 timestamp; 134 union {
135 u64 timestamp;
136 struct pps_event_time pps_times;
137 };
127}; 138};
128 139
129/** 140/**
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 597e4fdb97fe..3db698aee34c 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -130,8 +130,6 @@ extern void exit_ptrace(struct task_struct *tracer);
130#define PTRACE_MODE_READ 0x01 130#define PTRACE_MODE_READ 0x01
131#define PTRACE_MODE_ATTACH 0x02 131#define PTRACE_MODE_ATTACH 0x02
132#define PTRACE_MODE_NOAUDIT 0x04 132#define PTRACE_MODE_NOAUDIT 0x04
133/* Returns 0 on success, -errno on denial. */
134extern int __ptrace_may_access(struct task_struct *task, unsigned int mode);
135/* Returns true on success, false on denial. */ 133/* Returns true on success, false on denial. */
136extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); 134extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
137 135
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 524ede8a160a..dcd5721e626d 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -181,10 +181,135 @@ enum {
181#include <linux/dqblk_v2.h> 181#include <linux/dqblk_v2.h>
182 182
183#include <linux/atomic.h> 183#include <linux/atomic.h>
184#include <linux/uidgid.h>
185#include <linux/projid.h>
186
187#undef USRQUOTA
188#undef GRPQUOTA
189enum quota_type {
190 USRQUOTA = 0, /* element used for user quotas */
191 GRPQUOTA = 1, /* element used for group quotas */
192 PRJQUOTA = 2, /* element used for project quotas */
193};
184 194
185typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 195typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
186typedef long long qsize_t; /* Type in which we store sizes */ 196typedef long long qsize_t; /* Type in which we store sizes */
187 197
198struct kqid { /* Type in which we store the quota identifier */
199 union {
200 kuid_t uid;
201 kgid_t gid;
202 kprojid_t projid;
203 };
204 enum quota_type type; /* USRQUOTA (uid) or GRPQUOTA (gid) or PRJQUOTA (projid) */
205};
206
207extern bool qid_eq(struct kqid left, struct kqid right);
208extern bool qid_lt(struct kqid left, struct kqid right);
209extern qid_t from_kqid(struct user_namespace *to, struct kqid qid);
210extern qid_t from_kqid_munged(struct user_namespace *to, struct kqid qid);
211extern bool qid_valid(struct kqid qid);
212
213/**
214 * make_kqid - Map a user-namespace, type, qid tuple into a kqid.
215 * @from: User namespace that the qid is in
216 * @type: The type of quota
217 * @qid: Quota identifier
218 *
219 * Maps a user-namespace, type qid tuple into a kernel internal
220 * kqid, and returns that kqid.
221 *
222 * When there is no mapping defined for the user-namespace, type,
223 * qid tuple an invalid kqid is returned. Callers are expected to
224 * test for and handle handle invalid kqids being returned.
225 * Invalid kqids may be tested for using qid_valid().
226 */
227static inline struct kqid make_kqid(struct user_namespace *from,
228 enum quota_type type, qid_t qid)
229{
230 struct kqid kqid;
231
232 kqid.type = type;
233 switch (type) {
234 case USRQUOTA:
235 kqid.uid = make_kuid(from, qid);
236 break;
237 case GRPQUOTA:
238 kqid.gid = make_kgid(from, qid);
239 break;
240 case PRJQUOTA:
241 kqid.projid = make_kprojid(from, qid);
242 break;
243 default:
244 BUG();
245 }
246 return kqid;
247}
248
249/**
250 * make_kqid_invalid - Explicitly make an invalid kqid
251 * @type: The type of quota identifier
252 *
253 * Returns an invalid kqid with the specified type.
254 */
255static inline struct kqid make_kqid_invalid(enum quota_type type)
256{
257 struct kqid kqid;
258
259 kqid.type = type;
260 switch (type) {
261 case USRQUOTA:
262 kqid.uid = INVALID_UID;
263 break;
264 case GRPQUOTA:
265 kqid.gid = INVALID_GID;
266 break;
267 case PRJQUOTA:
268 kqid.projid = INVALID_PROJID;
269 break;
270 default:
271 BUG();
272 }
273 return kqid;
274}
275
276/**
277 * make_kqid_uid - Make a kqid from a kuid
278 * @uid: The kuid to make the quota identifier from
279 */
280static inline struct kqid make_kqid_uid(kuid_t uid)
281{
282 struct kqid kqid;
283 kqid.type = USRQUOTA;
284 kqid.uid = uid;
285 return kqid;
286}
287
288/**
289 * make_kqid_gid - Make a kqid from a kgid
290 * @gid: The kgid to make the quota identifier from
291 */
292static inline struct kqid make_kqid_gid(kgid_t gid)
293{
294 struct kqid kqid;
295 kqid.type = GRPQUOTA;
296 kqid.gid = gid;
297 return kqid;
298}
299
300/**
301 * make_kqid_projid - Make a kqid from a projid
302 * @projid: The kprojid to make the quota identifier from
303 */
304static inline struct kqid make_kqid_projid(kprojid_t projid)
305{
306 struct kqid kqid;
307 kqid.type = PRJQUOTA;
308 kqid.projid = projid;
309 return kqid;
310}
311
312
188extern spinlock_t dq_data_lock; 313extern spinlock_t dq_data_lock;
189 314
190/* Maximal numbers of writes for quota operation (insert/delete/update) 315/* Maximal numbers of writes for quota operation (insert/delete/update)
@@ -294,10 +419,9 @@ struct dquot {
294 atomic_t dq_count; /* Use count */ 419 atomic_t dq_count; /* Use count */
295 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */ 420 wait_queue_head_t dq_wait_unused; /* Wait queue for dquot to become unused */
296 struct super_block *dq_sb; /* superblock this applies to */ 421 struct super_block *dq_sb; /* superblock this applies to */
297 unsigned int dq_id; /* ID this applies to (uid, gid) */ 422 struct kqid dq_id; /* ID this applies to (uid, gid, projid) */
298 loff_t dq_off; /* Offset of dquot on disk */ 423 loff_t dq_off; /* Offset of dquot on disk */
299 unsigned long dq_flags; /* See DQ_* */ 424 unsigned long dq_flags; /* See DQ_* */
300 short dq_type; /* Type of quota */
301 struct mem_dqblk dq_dqb; /* Diskquota usage */ 425 struct mem_dqblk dq_dqb; /* Diskquota usage */
302}; 426};
303 427
@@ -336,8 +460,8 @@ struct quotactl_ops {
336 int (*quota_sync)(struct super_block *, int); 460 int (*quota_sync)(struct super_block *, int);
337 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 461 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
338 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 462 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
339 int (*get_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *); 463 int (*get_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
340 int (*set_dqblk)(struct super_block *, int, qid_t, struct fs_disk_quota *); 464 int (*set_dqblk)(struct super_block *, struct kqid, struct fs_disk_quota *);
341 int (*get_xstate)(struct super_block *, struct fs_quota_stat *); 465 int (*get_xstate)(struct super_block *, struct fs_quota_stat *);
342 int (*set_xstate)(struct super_block *, unsigned int, int); 466 int (*set_xstate)(struct super_block *, unsigned int, int);
343}; 467};
@@ -386,10 +510,10 @@ static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
386} 510}
387 511
388#ifdef CONFIG_QUOTA_NETLINK_INTERFACE 512#ifdef CONFIG_QUOTA_NETLINK_INTERFACE
389extern void quota_send_warning(short type, unsigned int id, dev_t dev, 513extern void quota_send_warning(struct kqid qid, dev_t dev,
390 const char warntype); 514 const char warntype);
391#else 515#else
392static inline void quota_send_warning(short type, unsigned int id, dev_t dev, 516static inline void quota_send_warning(struct kqid qid, dev_t dev,
393 const char warntype) 517 const char warntype)
394{ 518{
395 return; 519 return;
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index ec6b65feaaba..1c50093ae656 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -44,7 +44,7 @@ void inode_sub_rsv_space(struct inode *inode, qsize_t number);
44 44
45void dquot_initialize(struct inode *inode); 45void dquot_initialize(struct inode *inode);
46void dquot_drop(struct inode *inode); 46void dquot_drop(struct inode *inode);
47struct dquot *dqget(struct super_block *sb, unsigned int id, int type); 47struct dquot *dqget(struct super_block *sb, struct kqid qid);
48void dqput(struct dquot *dquot); 48void dqput(struct dquot *dquot);
49int dquot_scan_active(struct super_block *sb, 49int dquot_scan_active(struct super_block *sb,
50 int (*fn)(struct dquot *dquot, unsigned long priv), 50 int (*fn)(struct dquot *dquot, unsigned long priv),
@@ -87,9 +87,9 @@ int dquot_writeback_dquots(struct super_block *sb, int type);
87int dquot_quota_sync(struct super_block *sb, int type); 87int dquot_quota_sync(struct super_block *sb, int type);
88int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 88int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
89int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 89int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
90int dquot_get_dqblk(struct super_block *sb, int type, qid_t id, 90int dquot_get_dqblk(struct super_block *sb, struct kqid id,
91 struct fs_disk_quota *di); 91 struct fs_disk_quota *di);
92int dquot_set_dqblk(struct super_block *sb, int type, qid_t id, 92int dquot_set_dqblk(struct super_block *sb, struct kqid id,
93 struct fs_disk_quota *di); 93 struct fs_disk_quota *di);
94 94
95int __dquot_transfer(struct inode *inode, struct dquot **transfer_to); 95int __dquot_transfer(struct inode *inode, struct dquot **transfer_to);
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 033b507b33b1..0022c1bb1e26 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -23,72 +23,7 @@
23 I know it's not the cleaner way, but in C (not in C++) to get 23 I know it's not the cleaner way, but in C (not in C++) to get
24 performances and genericity... 24 performances and genericity...
25 25
26 Some example of insert and search follows here. The search is a plain 26 See Documentation/rbtree.txt for documentation and samples.
27 normal search over an ordered tree. The insert instead must be implemented
28 in two steps: First, the code must insert the element in order as a red leaf
29 in the tree, and then the support library function rb_insert_color() must
30 be called. Such function will do the not trivial work to rebalance the
31 rbtree, if necessary.
32
33-----------------------------------------------------------------------
34static inline struct page * rb_search_page_cache(struct inode * inode,
35 unsigned long offset)
36{
37 struct rb_node * n = inode->i_rb_page_cache.rb_node;
38 struct page * page;
39
40 while (n)
41 {
42 page = rb_entry(n, struct page, rb_page_cache);
43
44 if (offset < page->offset)
45 n = n->rb_left;
46 else if (offset > page->offset)
47 n = n->rb_right;
48 else
49 return page;
50 }
51 return NULL;
52}
53
54static inline struct page * __rb_insert_page_cache(struct inode * inode,
55 unsigned long offset,
56 struct rb_node * node)
57{
58 struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
59 struct rb_node * parent = NULL;
60 struct page * page;
61
62 while (*p)
63 {
64 parent = *p;
65 page = rb_entry(parent, struct page, rb_page_cache);
66
67 if (offset < page->offset)
68 p = &(*p)->rb_left;
69 else if (offset > page->offset)
70 p = &(*p)->rb_right;
71 else
72 return page;
73 }
74
75 rb_link_node(node, parent, p);
76
77 return NULL;
78}
79
80static inline struct page * rb_insert_page_cache(struct inode * inode,
81 unsigned long offset,
82 struct rb_node * node)
83{
84 struct page * ret;
85 if ((ret = __rb_insert_page_cache(inode, offset, node)))
86 goto out;
87 rb_insert_color(node, &inode->i_rb_page_cache);
88 out:
89 return ret;
90}
91-----------------------------------------------------------------------
92*/ 27*/
93 28
94#ifndef _LINUX_RBTREE_H 29#ifndef _LINUX_RBTREE_H
@@ -97,63 +32,35 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
97#include <linux/kernel.h> 32#include <linux/kernel.h>
98#include <linux/stddef.h> 33#include <linux/stddef.h>
99 34
100struct rb_node 35struct rb_node {
101{ 36 unsigned long __rb_parent_color;
102 unsigned long rb_parent_color;
103#define RB_RED 0
104#define RB_BLACK 1
105 struct rb_node *rb_right; 37 struct rb_node *rb_right;
106 struct rb_node *rb_left; 38 struct rb_node *rb_left;
107} __attribute__((aligned(sizeof(long)))); 39} __attribute__((aligned(sizeof(long))));
108 /* The alignment might seem pointless, but allegedly CRIS needs it */ 40 /* The alignment might seem pointless, but allegedly CRIS needs it */
109 41
110struct rb_root 42struct rb_root {
111{
112 struct rb_node *rb_node; 43 struct rb_node *rb_node;
113}; 44};
114 45
115 46
116#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) 47#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
117#define rb_color(r) ((r)->rb_parent_color & 1)
118#define rb_is_red(r) (!rb_color(r))
119#define rb_is_black(r) rb_color(r)
120#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
121#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
122
123static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
124{
125 rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
126}
127static inline void rb_set_color(struct rb_node *rb, int color)
128{
129 rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
130}
131 48
132#define RB_ROOT (struct rb_root) { NULL, } 49#define RB_ROOT (struct rb_root) { NULL, }
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 50#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 51
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) 52#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
136#define RB_EMPTY_NODE(node) (rb_parent(node) == node) 53
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) 54/* 'empty' nodes are nodes that are known not to be inserted in an rbree */
55#define RB_EMPTY_NODE(node) \
56 ((node)->__rb_parent_color == (unsigned long)(node))
57#define RB_CLEAR_NODE(node) \
58 ((node)->__rb_parent_color = (unsigned long)(node))
138 59
139static inline void rb_init_node(struct rb_node *rb)
140{
141 rb->rb_parent_color = 0;
142 rb->rb_right = NULL;
143 rb->rb_left = NULL;
144 RB_CLEAR_NODE(rb);
145}
146 60
147extern void rb_insert_color(struct rb_node *, struct rb_root *); 61extern void rb_insert_color(struct rb_node *, struct rb_root *);
148extern void rb_erase(struct rb_node *, struct rb_root *); 62extern void rb_erase(struct rb_node *, struct rb_root *);
149 63
150typedef void (*rb_augment_f)(struct rb_node *node, void *data);
151
152extern void rb_augment_insert(struct rb_node *node,
153 rb_augment_f func, void *data);
154extern struct rb_node *rb_augment_erase_begin(struct rb_node *node);
155extern void rb_augment_erase_end(struct rb_node *node,
156 rb_augment_f func, void *data);
157 64
158/* Find logical next and previous nodes in a tree */ 65/* Find logical next and previous nodes in a tree */
159extern struct rb_node *rb_next(const struct rb_node *); 66extern struct rb_node *rb_next(const struct rb_node *);
@@ -168,7 +75,7 @@ extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
168static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, 75static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
169 struct rb_node ** rb_link) 76 struct rb_node ** rb_link)
170{ 77{
171 node->rb_parent_color = (unsigned long )parent; 78 node->__rb_parent_color = (unsigned long)parent;
172 node->rb_left = node->rb_right = NULL; 79 node->rb_left = node->rb_right = NULL;
173 80
174 *rb_link = node; 81 *rb_link = node;
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
new file mode 100644
index 000000000000..214caa33433b
--- /dev/null
+++ b/include/linux/rbtree_augmented.h
@@ -0,0 +1,223 @@
1/*
2 Red Black Trees
3 (C) 1999 Andrea Arcangeli <andrea@suse.de>
4 (C) 2002 David Woodhouse <dwmw2@infradead.org>
5 (C) 2012 Michel Lespinasse <walken@google.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 linux/include/linux/rbtree_augmented.h
22*/
23
24#ifndef _LINUX_RBTREE_AUGMENTED_H
25#define _LINUX_RBTREE_AUGMENTED_H
26
27#include <linux/rbtree.h>
28
29/*
30 * Please note - only struct rb_augment_callbacks and the prototypes for
31 * rb_insert_augmented() and rb_erase_augmented() are intended to be public.
32 * The rest are implementation details you are not expected to depend on.
33 *
34 * See Documentation/rbtree.txt for documentation and samples.
35 */
36
37struct rb_augment_callbacks {
38 void (*propagate)(struct rb_node *node, struct rb_node *stop);
39 void (*copy)(struct rb_node *old, struct rb_node *new);
40 void (*rotate)(struct rb_node *old, struct rb_node *new);
41};
42
43extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
44 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
45static inline void
46rb_insert_augmented(struct rb_node *node, struct rb_root *root,
47 const struct rb_augment_callbacks *augment)
48{
49 __rb_insert_augmented(node, root, augment->rotate);
50}
51
52#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \
53 rbtype, rbaugmented, rbcompute) \
54static inline void \
55rbname ## _propagate(struct rb_node *rb, struct rb_node *stop) \
56{ \
57 while (rb != stop) { \
58 rbstruct *node = rb_entry(rb, rbstruct, rbfield); \
59 rbtype augmented = rbcompute(node); \
60 if (node->rbaugmented == augmented) \
61 break; \
62 node->rbaugmented = augmented; \
63 rb = rb_parent(&node->rbfield); \
64 } \
65} \
66static inline void \
67rbname ## _copy(struct rb_node *rb_old, struct rb_node *rb_new) \
68{ \
69 rbstruct *old = rb_entry(rb_old, rbstruct, rbfield); \
70 rbstruct *new = rb_entry(rb_new, rbstruct, rbfield); \
71 new->rbaugmented = old->rbaugmented; \
72} \
73static void \
74rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \
75{ \
76 rbstruct *old = rb_entry(rb_old, rbstruct, rbfield); \
77 rbstruct *new = rb_entry(rb_new, rbstruct, rbfield); \
78 new->rbaugmented = old->rbaugmented; \
79 old->rbaugmented = rbcompute(old); \
80} \
81rbstatic const struct rb_augment_callbacks rbname = { \
82 rbname ## _propagate, rbname ## _copy, rbname ## _rotate \
83};
84
85
86#define RB_RED 0
87#define RB_BLACK 1
88
89#define __rb_parent(pc) ((struct rb_node *)(pc & ~3))
90
91#define __rb_color(pc) ((pc) & 1)
92#define __rb_is_black(pc) __rb_color(pc)
93#define __rb_is_red(pc) (!__rb_color(pc))
94#define rb_color(rb) __rb_color((rb)->__rb_parent_color)
95#define rb_is_red(rb) __rb_is_red((rb)->__rb_parent_color)
96#define rb_is_black(rb) __rb_is_black((rb)->__rb_parent_color)
97
98static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
99{
100 rb->__rb_parent_color = rb_color(rb) | (unsigned long)p;
101}
102
103static inline void rb_set_parent_color(struct rb_node *rb,
104 struct rb_node *p, int color)
105{
106 rb->__rb_parent_color = (unsigned long)p | color;
107}
108
109static inline void
110__rb_change_child(struct rb_node *old, struct rb_node *new,
111 struct rb_node *parent, struct rb_root *root)
112{
113 if (parent) {
114 if (parent->rb_left == old)
115 parent->rb_left = new;
116 else
117 parent->rb_right = new;
118 } else
119 root->rb_node = new;
120}
121
122extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
123 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
124
125static __always_inline void
126rb_erase_augmented(struct rb_node *node, struct rb_root *root,
127 const struct rb_augment_callbacks *augment)
128{
129 struct rb_node *child = node->rb_right, *tmp = node->rb_left;
130 struct rb_node *parent, *rebalance;
131 unsigned long pc;
132
133 if (!tmp) {
134 /*
135 * Case 1: node to erase has no more than 1 child (easy!)
136 *
137 * Note that if there is one child it must be red due to 5)
138 * and node must be black due to 4). We adjust colors locally
139 * so as to bypass __rb_erase_color() later on.
140 */
141 pc = node->__rb_parent_color;
142 parent = __rb_parent(pc);
143 __rb_change_child(node, child, parent, root);
144 if (child) {
145 child->__rb_parent_color = pc;
146 rebalance = NULL;
147 } else
148 rebalance = __rb_is_black(pc) ? parent : NULL;
149 tmp = parent;
150 } else if (!child) {
151 /* Still case 1, but this time the child is node->rb_left */
152 tmp->__rb_parent_color = pc = node->__rb_parent_color;
153 parent = __rb_parent(pc);
154 __rb_change_child(node, tmp, parent, root);
155 rebalance = NULL;
156 tmp = parent;
157 } else {
158 struct rb_node *successor = child, *child2;
159 tmp = child->rb_left;
160 if (!tmp) {
161 /*
162 * Case 2: node's successor is its right child
163 *
164 * (n) (s)
165 * / \ / \
166 * (x) (s) -> (x) (c)
167 * \
168 * (c)
169 */
170 parent = successor;
171 child2 = successor->rb_right;
172 augment->copy(node, successor);
173 } else {
174 /*
175 * Case 3: node's successor is leftmost under
176 * node's right child subtree
177 *
178 * (n) (s)
179 * / \ / \
180 * (x) (y) -> (x) (y)
181 * / /
182 * (p) (p)
183 * / /
184 * (s) (c)
185 * \
186 * (c)
187 */
188 do {
189 parent = successor;
190 successor = tmp;
191 tmp = tmp->rb_left;
192 } while (tmp);
193 parent->rb_left = child2 = successor->rb_right;
194 successor->rb_right = child;
195 rb_set_parent(child, successor);
196 augment->copy(node, successor);
197 augment->propagate(parent, successor);
198 }
199
200 successor->rb_left = tmp = node->rb_left;
201 rb_set_parent(tmp, successor);
202
203 pc = node->__rb_parent_color;
204 tmp = __rb_parent(pc);
205 __rb_change_child(node, successor, tmp, root);
206 if (child2) {
207 successor->__rb_parent_color = pc;
208 rb_set_parent_color(child2, parent, RB_BLACK);
209 rebalance = NULL;
210 } else {
211 unsigned long pc2 = successor->__rb_parent_color;
212 successor->__rb_parent_color = pc;
213 rebalance = __rb_is_black(pc2) ? parent : NULL;
214 }
215 tmp = successor;
216 }
217
218 augment->propagate(tmp, NULL);
219 if (rebalance)
220 __rb_erase_color(rebalance, root, augment->rotate);
221}
222
223#endif /* _LINUX_RBTREE_AUGMENTED_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 115ead2b5155..7c968e4f929e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -191,6 +191,21 @@ extern void rcu_idle_enter(void);
191extern void rcu_idle_exit(void); 191extern void rcu_idle_exit(void);
192extern void rcu_irq_enter(void); 192extern void rcu_irq_enter(void);
193extern void rcu_irq_exit(void); 193extern void rcu_irq_exit(void);
194
195#ifdef CONFIG_RCU_USER_QS
196extern void rcu_user_enter(void);
197extern void rcu_user_exit(void);
198extern void rcu_user_enter_after_irq(void);
199extern void rcu_user_exit_after_irq(void);
200extern void rcu_user_hooks_switch(struct task_struct *prev,
201 struct task_struct *next);
202#else
203static inline void rcu_user_enter(void) { }
204static inline void rcu_user_exit(void) { }
205static inline void rcu_user_enter_after_irq(void) { }
206static inline void rcu_user_exit_after_irq(void) { }
207#endif /* CONFIG_RCU_USER_QS */
208
194extern void exit_rcu(void); 209extern void exit_rcu(void);
195 210
196/** 211/**
@@ -210,14 +225,12 @@ extern void exit_rcu(void);
210 * to nest RCU_NONIDLE() wrappers, but the nesting level is currently 225 * to nest RCU_NONIDLE() wrappers, but the nesting level is currently
211 * quite limited. If deeper nesting is required, it will be necessary 226 * quite limited. If deeper nesting is required, it will be necessary
212 * to adjust DYNTICK_TASK_NESTING_VALUE accordingly. 227 * to adjust DYNTICK_TASK_NESTING_VALUE accordingly.
213 *
214 * This macro may be used from process-level code only.
215 */ 228 */
216#define RCU_NONIDLE(a) \ 229#define RCU_NONIDLE(a) \
217 do { \ 230 do { \
218 rcu_idle_exit(); \ 231 rcu_irq_enter(); \
219 do { a; } while (0); \ 232 do { a; } while (0); \
220 rcu_idle_enter(); \ 233 rcu_irq_exit(); \
221 } while (0) 234 } while (0)
222 235
223/* 236/*
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 7f7e00df3adf..e3bcc3f4dcb8 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -285,6 +285,7 @@ struct regmap_irq {
285 * @ack_base: Base ack address. If zero then the chip is clear on read. 285 * @ack_base: Base ack address. If zero then the chip is clear on read.
286 * @wake_base: Base address for wake enables. If zero unsupported. 286 * @wake_base: Base address for wake enables. If zero unsupported.
287 * @irq_reg_stride: Stride to use for chips where registers are not contiguous. 287 * @irq_reg_stride: Stride to use for chips where registers are not contiguous.
288 * @runtime_pm: Hold a runtime PM lock on the device when accessing it.
288 * 289 *
289 * @num_regs: Number of registers in each control bank. 290 * @num_regs: Number of registers in each control bank.
290 * @irqs: Descriptors for individual IRQs. Interrupt numbers are 291 * @irqs: Descriptors for individual IRQs. Interrupt numbers are
@@ -299,6 +300,8 @@ struct regmap_irq_chip {
299 unsigned int ack_base; 300 unsigned int ack_base;
300 unsigned int wake_base; 301 unsigned int wake_base;
301 unsigned int irq_reg_stride; 302 unsigned int irq_reg_stride;
303 unsigned int mask_invert;
304 bool runtime_pm;
302 305
303 int num_regs; 306 int num_regs;
304 307
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index da339fd8c755..c43cd3556b1f 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -177,6 +177,8 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode);
177unsigned int regulator_get_mode(struct regulator *regulator); 177unsigned int regulator_get_mode(struct regulator *regulator);
178int regulator_set_optimum_mode(struct regulator *regulator, int load_uA); 178int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
179 179
180int regulator_allow_bypass(struct regulator *regulator, bool allow);
181
180/* regulator notifier block */ 182/* regulator notifier block */
181int regulator_register_notifier(struct regulator *regulator, 183int regulator_register_notifier(struct regulator *regulator,
182 struct notifier_block *nb); 184 struct notifier_block *nb);
@@ -328,6 +330,12 @@ static inline int regulator_set_optimum_mode(struct regulator *regulator,
328 return REGULATOR_MODE_NORMAL; 330 return REGULATOR_MODE_NORMAL;
329} 331}
330 332
333static inline int regulator_allow_bypass(struct regulator *regulator,
334 bool allow)
335{
336 return 0;
337}
338
331static inline int regulator_register_notifier(struct regulator *regulator, 339static inline int regulator_register_notifier(struct regulator *regulator,
332 struct notifier_block *nb) 340 struct notifier_block *nb)
333{ 341{
@@ -352,4 +360,11 @@ static inline void regulator_set_drvdata(struct regulator *regulator,
352 360
353#endif 361#endif
354 362
363static inline int regulator_set_voltage_tol(struct regulator *regulator,
364 int new_uV, int tol_uV)
365{
366 return regulator_set_voltage(regulator,
367 new_uV - tol_uV, new_uV + tol_uV);
368}
369
355#endif 370#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index bac4c871f3bd..7932a3bf21bd 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -32,6 +32,8 @@ enum regulator_status {
32 REGULATOR_STATUS_NORMAL, 32 REGULATOR_STATUS_NORMAL,
33 REGULATOR_STATUS_IDLE, 33 REGULATOR_STATUS_IDLE,
34 REGULATOR_STATUS_STANDBY, 34 REGULATOR_STATUS_STANDBY,
35 /* The regulator is enabled but not regulating */
36 REGULATOR_STATUS_BYPASS,
35 /* in case that any other status doesn't apply */ 37 /* in case that any other status doesn't apply */
36 REGULATOR_STATUS_UNDEFINED, 38 REGULATOR_STATUS_UNDEFINED,
37}; 39};
@@ -58,6 +60,7 @@ enum regulator_status {
58 * regulator_desc.n_voltages. Voltages may be reported in any order. 60 * regulator_desc.n_voltages. Voltages may be reported in any order.
59 * 61 *
60 * @set_current_limit: Configure a limit for a current-limited regulator. 62 * @set_current_limit: Configure a limit for a current-limited regulator.
63 * The driver should select the current closest to max_uA.
61 * @get_current_limit: Get the configured limit for a current-limited regulator. 64 * @get_current_limit: Get the configured limit for a current-limited regulator.
62 * 65 *
63 * @set_mode: Set the configured operating mode for the regulator. 66 * @set_mode: Set the configured operating mode for the regulator.
@@ -67,6 +70,9 @@ enum regulator_status {
67 * @get_optimum_mode: Get the most efficient operating mode for the regulator 70 * @get_optimum_mode: Get the most efficient operating mode for the regulator
68 * when running with the specified parameters. 71 * when running with the specified parameters.
69 * 72 *
73 * @set_bypass: Set the regulator in bypass mode.
74 * @get_bypass: Get the regulator bypass mode state.
75 *
70 * @enable_time: Time taken for the regulator voltage output voltage to 76 * @enable_time: Time taken for the regulator voltage output voltage to
71 * stabilise after being enabled, in microseconds. 77 * stabilise after being enabled, in microseconds.
72 * @set_ramp_delay: Set the ramp delay for the regulator. The driver should 78 * @set_ramp_delay: Set the ramp delay for the regulator. The driver should
@@ -133,6 +139,10 @@ struct regulator_ops {
133 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV, 139 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
134 int output_uV, int load_uA); 140 int output_uV, int load_uA);
135 141
142 /* control and report on bypass mode */
143 int (*set_bypass)(struct regulator_dev *dev, bool enable);
144 int (*get_bypass)(struct regulator_dev *dev, bool *enable);
145
136 /* the operations below are for configuration of regulator state when 146 /* the operations below are for configuration of regulator state when
137 * its parent PMIC enters a global STANDBY/HIBERNATE state */ 147 * its parent PMIC enters a global STANDBY/HIBERNATE state */
138 148
@@ -205,6 +215,8 @@ struct regulator_desc {
205 unsigned int vsel_mask; 215 unsigned int vsel_mask;
206 unsigned int enable_reg; 216 unsigned int enable_reg;
207 unsigned int enable_mask; 217 unsigned int enable_mask;
218 unsigned int bypass_reg;
219 unsigned int bypass_mask;
208 220
209 unsigned int enable_time; 221 unsigned int enable_time;
210}; 222};
@@ -221,7 +233,8 @@ struct regulator_desc {
221 * @driver_data: private regulator data 233 * @driver_data: private regulator data
222 * @of_node: OpenFirmware node to parse for device tree bindings (may be 234 * @of_node: OpenFirmware node to parse for device tree bindings (may be
223 * NULL). 235 * NULL).
224 * @regmap: regmap to use for core regmap helpers 236 * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is
237 * insufficient.
225 * @ena_gpio: GPIO controlling regulator enable. 238 * @ena_gpio: GPIO controlling regulator enable.
226 * @ena_gpio_invert: Sense for GPIO enable control. 239 * @ena_gpio_invert: Sense for GPIO enable control.
227 * @ena_gpio_flags: Flags to use when calling gpio_request_one() 240 * @ena_gpio_flags: Flags to use when calling gpio_request_one()
@@ -253,6 +266,7 @@ struct regulator_dev {
253 int exclusive; 266 int exclusive;
254 u32 use_count; 267 u32 use_count;
255 u32 open_count; 268 u32 open_count;
269 u32 bypass_count;
256 270
257 /* lists we belong to */ 271 /* lists we belong to */
258 struct list_head list; /* list of all regulators */ 272 struct list_head list; /* list of all regulators */
@@ -310,6 +324,8 @@ int regulator_disable_regmap(struct regulator_dev *rdev);
310int regulator_set_voltage_time_sel(struct regulator_dev *rdev, 324int regulator_set_voltage_time_sel(struct regulator_dev *rdev,
311 unsigned int old_selector, 325 unsigned int old_selector,
312 unsigned int new_selector); 326 unsigned int new_selector);
327int regulator_set_bypass_regmap(struct regulator_dev *rdev, bool enable);
328int regulator_get_bypass_regmap(struct regulator_dev *rdev, bool *enable);
313 329
314void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data); 330void *regulator_get_init_drvdata(struct regulator_init_data *reg_init_data);
315 331
diff --git a/include/linux/regulator/fan53555.h b/include/linux/regulator/fan53555.h
new file mode 100644
index 000000000000..5c45c85d52ca
--- /dev/null
+++ b/include/linux/regulator/fan53555.h
@@ -0,0 +1,60 @@
1/*
2 * fan53555.h - Fairchild Regulator FAN53555 Driver
3 *
4 * Copyright (C) 2012 Marvell Technology Ltd.
5 * Yunfan Zhang <yfzhang@marvell.com>
6 *
7 * This package 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
13#ifndef __FAN53555_H__
14
15/* VSEL ID */
16enum {
17 FAN53555_VSEL_ID_0 = 0,
18 FAN53555_VSEL_ID_1,
19};
20
21/* Transition slew rate limiting from a low to high voltage.
22 * -----------------------
23 * Bin |Slew Rate(mV/uS)
24 * ------|----------------
25 * 000 | 64.00
26 * ------|----------------
27 * 001 | 32.00
28 * ------|----------------
29 * 010 | 16.00
30 * ------|----------------
31 * 011 | 8.00
32 * ------|----------------
33 * 100 | 4.00
34 * ------|----------------
35 * 101 | 2.00
36 * ------|----------------
37 * 110 | 1.00
38 * ------|----------------
39 * 111 | 0.50
40 * -----------------------
41 */
42enum {
43 FAN53555_SLEW_RATE_64MV = 0,
44 FAN53555_SLEW_RATE_32MV,
45 FAN53555_SLEW_RATE_16MV,
46 FAN53555_SLEW_RATE_8MV,
47 FAN53555_SLEW_RATE_4MV,
48 FAN53555_SLEW_RATE_2MV,
49 FAN53555_SLEW_RATE_1MV,
50 FAN53555_SLEW_RATE_0_5MV,
51};
52
53struct fan53555_platform_data {
54 struct regulator_init_data *regulator;
55 unsigned int slew_rate;
56 /* Sleep VSEL ID */
57 unsigned int sleep_vsel_id;
58};
59
60#endif /* __FAN53555_H__ */
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 40dd0a394cfa..36adbc82de6a 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -32,6 +32,7 @@ struct regulator;
32 * board/machine. 32 * board/machine.
33 * STATUS: Regulator can be enabled and disabled. 33 * STATUS: Regulator can be enabled and disabled.
34 * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator. 34 * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator.
35 * BYPASS: Regulator can be put into bypass mode
35 */ 36 */
36 37
37#define REGULATOR_CHANGE_VOLTAGE 0x1 38#define REGULATOR_CHANGE_VOLTAGE 0x1
@@ -39,6 +40,7 @@ struct regulator;
39#define REGULATOR_CHANGE_MODE 0x4 40#define REGULATOR_CHANGE_MODE 0x4
40#define REGULATOR_CHANGE_STATUS 0x8 41#define REGULATOR_CHANGE_STATUS 0x8
41#define REGULATOR_CHANGE_DRMS 0x10 42#define REGULATOR_CHANGE_DRMS 0x10
43#define REGULATOR_CHANGE_BYPASS 0x20
42 44
43/** 45/**
44 * struct regulator_state - regulator state during low power system states 46 * struct regulator_state - regulator state during low power system states
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 131b53957b9f..faf33324c78f 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -361,6 +361,19 @@ enum rproc_state {
361}; 361};
362 362
363/** 363/**
364 * enum rproc_crash_type - remote processor crash types
365 * @RPROC_MMUFAULT: iommu fault
366 *
367 * Each element of the enum is used as an array index. So that, the value of
368 * the elements should be always something sane.
369 *
370 * Feel free to add more types when needed.
371 */
372enum rproc_crash_type {
373 RPROC_MMUFAULT,
374};
375
376/**
364 * struct rproc - represents a physical remote processor device 377 * struct rproc - represents a physical remote processor device
365 * @node: klist node of this rproc object 378 * @node: klist node of this rproc object
366 * @domain: iommu domain 379 * @domain: iommu domain
@@ -383,6 +396,11 @@ enum rproc_state {
383 * @rvdevs: list of remote virtio devices 396 * @rvdevs: list of remote virtio devices
384 * @notifyids: idr for dynamically assigning rproc-wide unique notify ids 397 * @notifyids: idr for dynamically assigning rproc-wide unique notify ids
385 * @index: index of this rproc device 398 * @index: index of this rproc device
399 * @crash_handler: workqueue for handling a crash
400 * @crash_cnt: crash counter
401 * @crash_comp: completion used to sync crash handler and the rproc reload
402 * @recovery_disabled: flag that state if recovery was disabled
403 * @max_notifyid: largest allocated notify id.
386 */ 404 */
387struct rproc { 405struct rproc {
388 struct klist_node node; 406 struct klist_node node;
@@ -406,6 +424,11 @@ struct rproc {
406 struct list_head rvdevs; 424 struct list_head rvdevs;
407 struct idr notifyids; 425 struct idr notifyids;
408 int index; 426 int index;
427 struct work_struct crash_handler;
428 unsigned crash_cnt;
429 struct completion crash_comp;
430 bool recovery_disabled;
431 int max_notifyid;
409}; 432};
410 433
411/* we currently support only two vrings per rvdev */ 434/* we currently support only two vrings per rvdev */
@@ -460,6 +483,7 @@ int rproc_del(struct rproc *rproc);
460 483
461int rproc_boot(struct rproc *rproc); 484int rproc_boot(struct rproc *rproc);
462void rproc_shutdown(struct rproc *rproc); 485void rproc_shutdown(struct rproc *rproc);
486void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
463 487
464static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev) 488static inline struct rproc_vdev *vdev_to_rvdev(struct virtio_device *vdev)
465{ 489{
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 6fdf02737e9d..0ec590bb3611 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -354,6 +354,37 @@ static inline bool rfkill_blocked(struct rfkill *rfkill)
354} 354}
355#endif /* RFKILL || RFKILL_MODULE */ 355#endif /* RFKILL || RFKILL_MODULE */
356 356
357
358#ifdef CONFIG_RFKILL_LEDS
359/**
360 * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
361 * This function might return a NULL pointer if registering of the
362 * LED trigger failed. Use this as "default_trigger" for the LED.
363 */
364const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
365
366/**
367 * rfkill_set_led_trigger_name -- set the LED trigger name
368 * @rfkill: rfkill struct
369 * @name: LED trigger name
370 *
371 * This function sets the LED trigger name of the radio LED
372 * trigger that rfkill creates. It is optional, but if called
373 * must be called before rfkill_register() to be effective.
374 */
375void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
376#else
377static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
378{
379 return NULL;
380}
381
382static inline void
383rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
384{
385}
386#endif
387
357#endif /* __KERNEL__ */ 388#endif /* __KERNEL__ */
358 389
359#endif /* RFKILL_H */ 390#endif /* RFKILL_H */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index a90ebadd9da0..d2dff22cf681 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -30,6 +30,7 @@
30#define RIO_MAX_MPORTS 8 30#define RIO_MAX_MPORTS 8
31#define RIO_MAX_MPORT_RESOURCES 16 31#define RIO_MAX_MPORT_RESOURCES 16
32#define RIO_MAX_DEV_RESOURCES 16 32#define RIO_MAX_DEV_RESOURCES 16
33#define RIO_MAX_MPORT_NAME 40
33 34
34#define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's 35#define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's
35 global routing table if it 36 global routing table if it
@@ -235,6 +236,7 @@ enum rio_phy_type {
235 * @phys_efptr: RIO port extended features pointer 236 * @phys_efptr: RIO port extended features pointer
236 * @name: Port name string 237 * @name: Port name string
237 * @priv: Master port private data 238 * @priv: Master port private data
239 * @dma: DMA device associated with mport
238 */ 240 */
239struct rio_mport { 241struct rio_mport {
240 struct list_head dbells; /* list of doorbell events */ 242 struct list_head dbells; /* list of doorbell events */
@@ -255,13 +257,21 @@ struct rio_mport {
255 */ 257 */
256 enum rio_phy_type phy_type; /* RapidIO phy type */ 258 enum rio_phy_type phy_type; /* RapidIO phy type */
257 u32 phys_efptr; 259 u32 phys_efptr;
258 unsigned char name[40]; 260 unsigned char name[RIO_MAX_MPORT_NAME];
259 void *priv; /* Master port private data */ 261 void *priv; /* Master port private data */
260#ifdef CONFIG_RAPIDIO_DMA_ENGINE 262#ifdef CONFIG_RAPIDIO_DMA_ENGINE
261 struct dma_device dma; 263 struct dma_device dma;
262#endif 264#endif
263}; 265};
264 266
267struct rio_id_table {
268 u16 start; /* logical minimal id */
269 u16 next; /* hint for find */
270 u32 max; /* max number of IDs in table */
271 spinlock_t lock;
272 unsigned long *table;
273};
274
265/** 275/**
266 * struct rio_net - RIO network info 276 * struct rio_net - RIO network info
267 * @node: Node in global list of RIO networks 277 * @node: Node in global list of RIO networks
@@ -273,9 +283,11 @@ struct rio_mport {
273struct rio_net { 283struct rio_net {
274 struct list_head node; /* node in list of networks */ 284 struct list_head node; /* node in list of networks */
275 struct list_head devices; /* list of devices in this net */ 285 struct list_head devices; /* list of devices in this net */
286 struct list_head switches; /* list of switches in this net */
276 struct list_head mports; /* list of ports accessing net */ 287 struct list_head mports; /* list of ports accessing net */
277 struct rio_mport *hport; /* primary port for accessing net */ 288 struct rio_mport *hport; /* primary port for accessing net */
278 unsigned char id; /* RIO network ID */ 289 unsigned char id; /* RIO network ID */
290 struct rio_id_table destid_table; /* destID allocation table */
279}; 291};
280 292
281/* Definitions used by switch sysfs initialization callback */ 293/* Definitions used by switch sysfs initialization callback */
@@ -299,6 +311,8 @@ struct rio_net {
299 * @add_outb_message: Callback to add a message to an outbound mailbox queue. 311 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
300 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue. 312 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
301 * @get_inb_message: Callback to get a message from an inbound mailbox queue. 313 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
314 * @map_inb: Callback to map RapidIO address region into local memory space.
315 * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
302 */ 316 */
303struct rio_ops { 317struct rio_ops {
304 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 318 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -321,6 +335,9 @@ struct rio_ops {
321 int mbox, void *buffer, size_t len); 335 int mbox, void *buffer, size_t len);
322 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf); 336 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
323 void *(*get_inb_message)(struct rio_mport *mport, int mbox); 337 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
338 int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
339 u64 rstart, u32 size, u32 flags);
340 void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
324}; 341};
325 342
326#define RIO_RESOURCE_MEM 0x00000100 343#define RIO_RESOURCE_MEM 0x00000100
@@ -403,7 +420,7 @@ union rio_pw_msg {
403 420
404#ifdef CONFIG_RAPIDIO_DMA_ENGINE 421#ifdef CONFIG_RAPIDIO_DMA_ENGINE
405 422
406/** 423/*
407 * enum rio_write_type - RIO write transaction types used in DMA transfers 424 * enum rio_write_type - RIO write transaction types used in DMA transfers
408 * 425 *
409 * Note: RapidIO specification defines write (NWRITE) and 426 * Note: RapidIO specification defines write (NWRITE) and
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 31ad146be316..b75c05920ab5 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -365,6 +365,11 @@ void rio_release_regions(struct rio_dev *);
365int rio_request_region(struct rio_dev *, int, char *); 365int rio_request_region(struct rio_dev *, int, char *);
366void rio_release_region(struct rio_dev *, int); 366void rio_release_region(struct rio_dev *, int);
367 367
368/* Memory mapping functions */
369extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
370 u64 rbase, u32 size, u32 rflags);
371extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart);
372
368/* Port-Write management */ 373/* Port-Write management */
369extern int rio_request_inb_pwrite(struct rio_dev *, 374extern int rio_request_inb_pwrite(struct rio_dev *,
370 int (*)(struct rio_dev *, union rio_pw_msg*, int)); 375 int (*)(struct rio_dev *, union rio_pw_msg*, int));
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 3fce545df394..bfe1f4780644 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -37,14 +37,14 @@ struct anon_vma {
37 atomic_t refcount; 37 atomic_t refcount;
38 38
39 /* 39 /*
40 * NOTE: the LSB of the head.next is set by 40 * NOTE: the LSB of the rb_root.rb_node is set by
41 * mm_take_all_locks() _after_ taking the above lock. So the 41 * mm_take_all_locks() _after_ taking the above lock. So the
42 * head must only be read/written after taking the above lock 42 * rb_root must only be read/written after taking the above lock
43 * to be sure to see a valid next pointer. The LSB bit itself 43 * to be sure to see a valid next pointer. The LSB bit itself
44 * is serialized by a system wide lock only visible to 44 * is serialized by a system wide lock only visible to
45 * mm_take_all_locks() (mm_all_locks_mutex). 45 * mm_take_all_locks() (mm_all_locks_mutex).
46 */ 46 */
47 struct list_head head; /* Chain of private "related" vmas */ 47 struct rb_root rb_root; /* Interval tree of private "related" vmas */
48}; 48};
49 49
50/* 50/*
@@ -57,14 +57,29 @@ struct anon_vma {
57 * with a VMA, or the VMAs associated with an anon_vma. 57 * with a VMA, or the VMAs associated with an anon_vma.
58 * The "same_vma" list contains the anon_vma_chains linking 58 * The "same_vma" list contains the anon_vma_chains linking
59 * all the anon_vmas associated with this VMA. 59 * all the anon_vmas associated with this VMA.
60 * The "same_anon_vma" list contains the anon_vma_chains 60 * The "rb" field indexes on an interval tree the anon_vma_chains
61 * which link all the VMAs associated with this anon_vma. 61 * which link all the VMAs associated with this anon_vma.
62 */ 62 */
63struct anon_vma_chain { 63struct anon_vma_chain {
64 struct vm_area_struct *vma; 64 struct vm_area_struct *vma;
65 struct anon_vma *anon_vma; 65 struct anon_vma *anon_vma;
66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ 66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
67 struct list_head same_anon_vma; /* locked by anon_vma->mutex */ 67 struct rb_node rb; /* locked by anon_vma->mutex */
68 unsigned long rb_subtree_last;
69#ifdef CONFIG_DEBUG_VM_RB
70 unsigned long cached_vma_start, cached_vma_last;
71#endif
72};
73
74enum ttu_flags {
75 TTU_UNMAP = 0, /* unmap mode */
76 TTU_MIGRATION = 1, /* migration mode */
77 TTU_MUNLOCK = 2, /* munlock mode */
78 TTU_ACTION_MASK = 0xff,
79
80 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
81 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
82 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
68}; 83};
69 84
70#ifdef CONFIG_MMU 85#ifdef CONFIG_MMU
@@ -120,7 +135,6 @@ void anon_vma_init(void); /* create anon_vma_cachep */
120int anon_vma_prepare(struct vm_area_struct *); 135int anon_vma_prepare(struct vm_area_struct *);
121void unlink_anon_vmas(struct vm_area_struct *); 136void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 137int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *);
124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 138int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
125 139
126static inline void anon_vma_merge(struct vm_area_struct *vma, 140static inline void anon_vma_merge(struct vm_area_struct *vma,
@@ -161,16 +175,6 @@ int page_referenced(struct page *, int is_locked,
161int page_referenced_one(struct page *, struct vm_area_struct *, 175int page_referenced_one(struct page *, struct vm_area_struct *,
162 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); 176 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
163 177
164enum ttu_flags {
165 TTU_UNMAP = 0, /* unmap mode */
166 TTU_MIGRATION = 1, /* migration mode */
167 TTU_MUNLOCK = 2, /* munlock mode */
168 TTU_ACTION_MASK = 0xff,
169
170 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
171 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
172 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
173};
174#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 178#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
175 179
176int try_to_unmap(struct page *, enum ttu_flags flags); 180int try_to_unmap(struct page *, enum ttu_flags flags);
diff --git a/include/linux/rtc-ds2404.h b/include/linux/rtc-ds2404.h
new file mode 100644
index 000000000000..22c53825528f
--- /dev/null
+++ b/include/linux/rtc-ds2404.h
@@ -0,0 +1,20 @@
1/*
2 * ds2404.h - platform data structure for the DS2404 RTC.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2012 Sven Schnelle <svens@stackframe.org>
9 */
10
11#ifndef __LINUX_DS2404_H
12#define __LINUX_DS2404_H
13
14struct ds2404_platform_data {
15
16 unsigned int gpio_rst;
17 unsigned int gpio_clk;
18 unsigned int gpio_dq;
19};
20#endif
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index f071b3922c67..20ec4d3bed73 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -276,7 +276,7 @@ static inline bool is_leap_year(unsigned int year)
276 return (!(year % 4) && (year % 100)) || !(year % 400); 276 return (!(year % 4) && (year % 100)) || !(year % 400);
277} 277}
278 278
279#ifdef CONFIG_RTC_HCTOSYS 279#ifdef CONFIG_RTC_HCTOSYS_DEVICE
280extern int rtc_hctosys_ret; 280extern int rtc_hctosys_ret;
281#else 281#else
282#define rtc_hctosys_ret -ENODEV 282#define rtc_hctosys_ret -ENODEV
diff --git a/include/linux/sc26198.h b/include/linux/sc26198.h
deleted file mode 100644
index 7ca35abad387..000000000000
--- a/include/linux/sc26198.h
+++ /dev/null
@@ -1,533 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * sc26198.h -- SC26198 UART hardware info.
5 *
6 * Copyright (C) 1995-1998 Stallion Technologies
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/*****************************************************************************/
24#ifndef _SC26198_H
25#define _SC26198_H
26/*****************************************************************************/
27
28/*
29 * Define the number of async ports per sc26198 uart device.
30 */
31#define SC26198_PORTS 8
32
33/*
34 * Baud rate timing clocks. All derived from a master 14.7456 MHz clock.
35 */
36#define SC26198_MASTERCLOCK 14745600L
37#define SC26198_DCLK (SC26198_MASTERCLOCK)
38#define SC26198_CCLK (SC26198_MASTERCLOCK / 2)
39#define SC26198_BCLK (SC26198_MASTERCLOCK / 4)
40
41/*
42 * Define internal FIFO sizes for the 26198 ports.
43 */
44#define SC26198_TXFIFOSIZE 16
45#define SC26198_RXFIFOSIZE 16
46
47/*****************************************************************************/
48
49/*
50 * Global register definitions. These registers are global to each 26198
51 * device, not specific ports on it.
52 */
53#define TSTR 0x0d
54#define GCCR 0x0f
55#define ICR 0x1b
56#define WDTRCR 0x1d
57#define IVR 0x1f
58#define BRGTRUA 0x84
59#define GPOSR 0x87
60#define GPOC 0x8b
61#define UCIR 0x8c
62#define CIR 0x8c
63#define BRGTRUB 0x8d
64#define GRXFIFO 0x8e
65#define GTXFIFO 0x8e
66#define GCCR2 0x8f
67#define BRGTRLA 0x94
68#define GPOR 0x97
69#define GPOD 0x9b
70#define BRGTCR 0x9c
71#define GICR 0x9c
72#define BRGTRLB 0x9d
73#define GIBCR 0x9d
74#define GITR 0x9f
75
76/*
77 * Per port channel registers. These are the register offsets within
78 * the port address space, so need to have the port address (0 to 7)
79 * inserted in bit positions 4:6.
80 */
81#define MR0 0x00
82#define MR1 0x01
83#define IOPCR 0x02
84#define BCRBRK 0x03
85#define BCRCOS 0x04
86#define BCRX 0x06
87#define BCRA 0x07
88#define XONCR 0x08
89#define XOFFCR 0x09
90#define ARCR 0x0a
91#define RXCSR 0x0c
92#define TXCSR 0x0e
93#define MR2 0x80
94#define SR 0x81
95#define SCCR 0x81
96#define ISR 0x82
97#define IMR 0x82
98#define TXFIFO 0x83
99#define RXFIFO 0x83
100#define IPR 0x84
101#define IOPIOR 0x85
102#define XISR 0x86
103
104/*
105 * For any given port calculate the address to use to access a specified
106 * register. This is only used for unusual access, mostly this is done
107 * through the assembler access routines.
108 */
109#define SC26198_PORTREG(port,reg) ((((port) & 0x07) << 4) | (reg))
110
111/*****************************************************************************/
112
113/*
114 * Global configuration control register bit definitions.
115 */
116#define GCCR_NOACK 0x00
117#define GCCR_IVRACK 0x02
118#define GCCR_IVRCHANACK 0x04
119#define GCCR_IVRTYPCHANACK 0x06
120#define GCCR_ASYNCCYCLE 0x00
121#define GCCR_SYNCCYCLE 0x40
122
123/*****************************************************************************/
124
125/*
126 * Mode register 0 bit definitions.
127 */
128#define MR0_ADDRNONE 0x00
129#define MR0_AUTOWAKE 0x01
130#define MR0_AUTODOZE 0x02
131#define MR0_AUTOWAKEDOZE 0x03
132#define MR0_SWFNONE 0x00
133#define MR0_SWFTX 0x04
134#define MR0_SWFRX 0x08
135#define MR0_SWFRXTX 0x0c
136#define MR0_TXMASK 0x30
137#define MR0_TXEMPTY 0x00
138#define MR0_TXHIGH 0x10
139#define MR0_TXHALF 0x20
140#define MR0_TXRDY 0x00
141#define MR0_ADDRNT 0x00
142#define MR0_ADDRT 0x40
143#define MR0_SWFNT 0x00
144#define MR0_SWFT 0x80
145
146/*
147 * Mode register 1 bit definitions.
148 */
149#define MR1_CS5 0x00
150#define MR1_CS6 0x01
151#define MR1_CS7 0x02
152#define MR1_CS8 0x03
153#define MR1_PAREVEN 0x00
154#define MR1_PARODD 0x04
155#define MR1_PARENB 0x00
156#define MR1_PARFORCE 0x08
157#define MR1_PARNONE 0x10
158#define MR1_PARSPECIAL 0x18
159#define MR1_ERRCHAR 0x00
160#define MR1_ERRBLOCK 0x20
161#define MR1_ISRUNMASKED 0x00
162#define MR1_ISRMASKED 0x40
163#define MR1_AUTORTS 0x80
164
165/*
166 * Mode register 2 bit definitions.
167 */
168#define MR2_STOP1 0x00
169#define MR2_STOP15 0x01
170#define MR2_STOP2 0x02
171#define MR2_STOP916 0x03
172#define MR2_RXFIFORDY 0x00
173#define MR2_RXFIFOHALF 0x04
174#define MR2_RXFIFOHIGH 0x08
175#define MR2_RXFIFOFULL 0x0c
176#define MR2_AUTOCTS 0x10
177#define MR2_TXRTS 0x20
178#define MR2_MODENORM 0x00
179#define MR2_MODEAUTOECHO 0x40
180#define MR2_MODELOOP 0x80
181#define MR2_MODEREMECHO 0xc0
182
183/*****************************************************************************/
184
185/*
186 * Baud Rate Generator (BRG) selector values.
187 */
188#define BRG_50 0x00
189#define BRG_75 0x01
190#define BRG_150 0x02
191#define BRG_200 0x03
192#define BRG_300 0x04
193#define BRG_450 0x05
194#define BRG_600 0x06
195#define BRG_900 0x07
196#define BRG_1200 0x08
197#define BRG_1800 0x09
198#define BRG_2400 0x0a
199#define BRG_3600 0x0b
200#define BRG_4800 0x0c
201#define BRG_7200 0x0d
202#define BRG_9600 0x0e
203#define BRG_14400 0x0f
204#define BRG_19200 0x10
205#define BRG_28200 0x11
206#define BRG_38400 0x12
207#define BRG_57600 0x13
208#define BRG_115200 0x14
209#define BRG_230400 0x15
210#define BRG_GIN0 0x16
211#define BRG_GIN1 0x17
212#define BRG_CT0 0x18
213#define BRG_CT1 0x19
214#define BRG_RX2TX316 0x1b
215#define BRG_RX2TX31 0x1c
216
217#define SC26198_MAXBAUD 921600
218
219/*****************************************************************************/
220
221/*
222 * Command register command definitions.
223 */
224#define CR_NULL 0x04
225#define CR_ADDRNORMAL 0x0c
226#define CR_RXRESET 0x14
227#define CR_TXRESET 0x1c
228#define CR_CLEARRXERR 0x24
229#define CR_BREAKRESET 0x2c
230#define CR_TXSTARTBREAK 0x34
231#define CR_TXSTOPBREAK 0x3c
232#define CR_RTSON 0x44
233#define CR_RTSOFF 0x4c
234#define CR_ADDRINIT 0x5c
235#define CR_RXERRBLOCK 0x6c
236#define CR_TXSENDXON 0x84
237#define CR_TXSENDXOFF 0x8c
238#define CR_GANGXONSET 0x94
239#define CR_GANGXOFFSET 0x9c
240#define CR_GANGXONINIT 0xa4
241#define CR_GANGXOFFINIT 0xac
242#define CR_HOSTXON 0xb4
243#define CR_HOSTXOFF 0xbc
244#define CR_CANCELXOFF 0xc4
245#define CR_ADDRRESET 0xdc
246#define CR_RESETALLPORTS 0xf4
247#define CR_RESETALL 0xfc
248
249#define CR_RXENABLE 0x01
250#define CR_TXENABLE 0x02
251
252/*****************************************************************************/
253
254/*
255 * Channel status register.
256 */
257#define SR_RXRDY 0x01
258#define SR_RXFULL 0x02
259#define SR_TXRDY 0x04
260#define SR_TXEMPTY 0x08
261#define SR_RXOVERRUN 0x10
262#define SR_RXPARITY 0x20
263#define SR_RXFRAMING 0x40
264#define SR_RXBREAK 0x80
265
266#define SR_RXERRS (SR_RXPARITY | SR_RXFRAMING | SR_RXOVERRUN)
267
268/*****************************************************************************/
269
270/*
271 * Interrupt status register and interrupt mask register bit definitions.
272 */
273#define IR_TXRDY 0x01
274#define IR_RXRDY 0x02
275#define IR_RXBREAK 0x04
276#define IR_XONXOFF 0x10
277#define IR_ADDRRECOG 0x20
278#define IR_RXWATCHDOG 0x40
279#define IR_IOPORT 0x80
280
281/*****************************************************************************/
282
283/*
284 * Interrupt vector register field definitions.
285 */
286#define IVR_CHANMASK 0x07
287#define IVR_TYPEMASK 0x18
288#define IVR_CONSTMASK 0xc0
289
290#define IVR_RXDATA 0x10
291#define IVR_RXBADDATA 0x18
292#define IVR_TXDATA 0x08
293#define IVR_OTHER 0x00
294
295/*****************************************************************************/
296
297/*
298 * BRG timer control register bit definitions.
299 */
300#define BRGCTCR_DISABCLK0 0x00
301#define BRGCTCR_ENABCLK0 0x08
302#define BRGCTCR_DISABCLK1 0x00
303#define BRGCTCR_ENABCLK1 0x80
304
305#define BRGCTCR_0SCLK16 0x00
306#define BRGCTCR_0SCLK32 0x01
307#define BRGCTCR_0SCLK64 0x02
308#define BRGCTCR_0SCLK128 0x03
309#define BRGCTCR_0X1 0x04
310#define BRGCTCR_0X12 0x05
311#define BRGCTCR_0IO1A 0x06
312#define BRGCTCR_0GIN0 0x07
313
314#define BRGCTCR_1SCLK16 0x00
315#define BRGCTCR_1SCLK32 0x10
316#define BRGCTCR_1SCLK64 0x20
317#define BRGCTCR_1SCLK128 0x30
318#define BRGCTCR_1X1 0x40
319#define BRGCTCR_1X12 0x50
320#define BRGCTCR_1IO1B 0x60
321#define BRGCTCR_1GIN1 0x70
322
323/*****************************************************************************/
324
325/*
326 * Watch dog timer enable register.
327 */
328#define WDTRCR_ENABALL 0xff
329
330/*****************************************************************************/
331
332/*
333 * XON/XOFF interrupt status register.
334 */
335#define XISR_TXCHARMASK 0x03
336#define XISR_TXCHARNORMAL 0x00
337#define XISR_TXWAIT 0x01
338#define XISR_TXXOFFPEND 0x02
339#define XISR_TXXONPEND 0x03
340
341#define XISR_TXFLOWMASK 0x0c
342#define XISR_TXNORMAL 0x00
343#define XISR_TXSTOPPEND 0x04
344#define XISR_TXSTARTED 0x08
345#define XISR_TXSTOPPED 0x0c
346
347#define XISR_RXFLOWMASK 0x30
348#define XISR_RXFLOWNONE 0x00
349#define XISR_RXXONSENT 0x10
350#define XISR_RXXOFFSENT 0x20
351
352#define XISR_RXXONGOT 0x40
353#define XISR_RXXOFFGOT 0x80
354
355/*****************************************************************************/
356
357/*
358 * Current interrupt register.
359 */
360#define CIR_TYPEMASK 0xc0
361#define CIR_TYPEOTHER 0x00
362#define CIR_TYPETX 0x40
363#define CIR_TYPERXGOOD 0x80
364#define CIR_TYPERXBAD 0xc0
365
366#define CIR_RXDATA 0x80
367#define CIR_RXBADDATA 0x40
368#define CIR_TXDATA 0x40
369
370#define CIR_CHANMASK 0x07
371#define CIR_CNTMASK 0x38
372
373#define CIR_SUBTYPEMASK 0x38
374#define CIR_SUBNONE 0x00
375#define CIR_SUBCOS 0x08
376#define CIR_SUBADDR 0x10
377#define CIR_SUBXONXOFF 0x18
378#define CIR_SUBBREAK 0x28
379
380/*****************************************************************************/
381
382/*
383 * Global interrupting channel register.
384 */
385#define GICR_CHANMASK 0x07
386
387/*****************************************************************************/
388
389/*
390 * Global interrupting byte count register.
391 */
392#define GICR_COUNTMASK 0x0f
393
394/*****************************************************************************/
395
396/*
397 * Global interrupting type register.
398 */
399#define GITR_RXMASK 0xc0
400#define GITR_RXNONE 0x00
401#define GITR_RXBADDATA 0x80
402#define GITR_RXGOODDATA 0xc0
403#define GITR_TXDATA 0x20
404
405#define GITR_SUBTYPEMASK 0x07
406#define GITR_SUBNONE 0x00
407#define GITR_SUBCOS 0x01
408#define GITR_SUBADDR 0x02
409#define GITR_SUBXONXOFF 0x03
410#define GITR_SUBBREAK 0x05
411
412/*****************************************************************************/
413
414/*
415 * Input port change register.
416 */
417#define IPR_CTS 0x01
418#define IPR_DTR 0x02
419#define IPR_RTS 0x04
420#define IPR_DCD 0x08
421#define IPR_CTSCHANGE 0x10
422#define IPR_DTRCHANGE 0x20
423#define IPR_RTSCHANGE 0x40
424#define IPR_DCDCHANGE 0x80
425
426#define IPR_CHANGEMASK 0xf0
427
428/*****************************************************************************/
429
430/*
431 * IO port interrupt and output register.
432 */
433#define IOPR_CTS 0x01
434#define IOPR_DTR 0x02
435#define IOPR_RTS 0x04
436#define IOPR_DCD 0x08
437#define IOPR_CTSCOS 0x10
438#define IOPR_DTRCOS 0x20
439#define IOPR_RTSCOS 0x40
440#define IOPR_DCDCOS 0x80
441
442/*****************************************************************************/
443
444/*
445 * IO port configuration register.
446 */
447#define IOPCR_SETCTS 0x00
448#define IOPCR_SETDTR 0x04
449#define IOPCR_SETRTS 0x10
450#define IOPCR_SETDCD 0x00
451
452#define IOPCR_SETSIGS (IOPCR_SETRTS | IOPCR_SETRTS | IOPCR_SETDTR | IOPCR_SETDCD)
453
454/*****************************************************************************/
455
456/*
457 * General purpose output select register.
458 */
459#define GPORS_TXC1XA 0x08
460#define GPORS_TXC16XA 0x09
461#define GPORS_RXC16XA 0x0a
462#define GPORS_TXC16XB 0x0b
463#define GPORS_GPOR3 0x0c
464#define GPORS_GPOR2 0x0d
465#define GPORS_GPOR1 0x0e
466#define GPORS_GPOR0 0x0f
467
468/*****************************************************************************/
469
470/*
471 * General purpose output register.
472 */
473#define GPOR_0 0x01
474#define GPOR_1 0x02
475#define GPOR_2 0x04
476#define GPOR_3 0x08
477
478/*****************************************************************************/
479
480/*
481 * General purpose output clock register.
482 */
483#define GPORC_0NONE 0x00
484#define GPORC_0GIN0 0x01
485#define GPORC_0GIN1 0x02
486#define GPORC_0IO3A 0x02
487
488#define GPORC_1NONE 0x00
489#define GPORC_1GIN0 0x04
490#define GPORC_1GIN1 0x08
491#define GPORC_1IO3C 0x0c
492
493#define GPORC_2NONE 0x00
494#define GPORC_2GIN0 0x10
495#define GPORC_2GIN1 0x20
496#define GPORC_2IO3E 0x20
497
498#define GPORC_3NONE 0x00
499#define GPORC_3GIN0 0x40
500#define GPORC_3GIN1 0x80
501#define GPORC_3IO3G 0xc0
502
503/*****************************************************************************/
504
505/*
506 * General purpose output data register.
507 */
508#define GPOD_0MASK 0x03
509#define GPOD_0SET1 0x00
510#define GPOD_0SET0 0x01
511#define GPOD_0SETR0 0x02
512#define GPOD_0SETIO3B 0x03
513
514#define GPOD_1MASK 0x0c
515#define GPOD_1SET1 0x00
516#define GPOD_1SET0 0x04
517#define GPOD_1SETR0 0x08
518#define GPOD_1SETIO3D 0x0c
519
520#define GPOD_2MASK 0x30
521#define GPOD_2SET1 0x00
522#define GPOD_2SET0 0x10
523#define GPOD_2SETR0 0x20
524#define GPOD_2SETIO3F 0x30
525
526#define GPOD_3MASK 0xc0
527#define GPOD_3SET1 0x00
528#define GPOD_3SET0 0x40
529#define GPOD_3SETR0 0x80
530#define GPOD_3SETIO3H 0xc0
531
532/*****************************************************************************/
533#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b8c86648a2f9..c2070e92a9d6 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -273,11 +273,11 @@ extern void init_idle_bootup_task(struct task_struct *idle);
273extern int runqueue_is_locked(int cpu); 273extern int runqueue_is_locked(int cpu);
274 274
275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 275#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
276extern void select_nohz_load_balancer(int stop_tick); 276extern void nohz_balance_enter_idle(int cpu);
277extern void set_cpu_sd_state_idle(void); 277extern void set_cpu_sd_state_idle(void);
278extern int get_nohz_timer_target(void); 278extern int get_nohz_timer_target(void);
279#else 279#else
280static inline void select_nohz_load_balancer(int stop_tick) { } 280static inline void nohz_balance_enter_idle(int cpu) { }
281static inline void set_cpu_sd_state_idle(void) { } 281static inline void set_cpu_sd_state_idle(void) { }
282#endif 282#endif
283 283
@@ -446,6 +446,9 @@ extern int get_dumpable(struct mm_struct *mm);
446#define MMF_VM_HUGEPAGE 17 /* set when VM_HUGEPAGE is set on vma */ 446#define MMF_VM_HUGEPAGE 17 /* set when VM_HUGEPAGE is set on vma */
447#define MMF_EXE_FILE_CHANGED 18 /* see prctl_set_mm_exe_file() */ 447#define MMF_EXE_FILE_CHANGED 18 /* see prctl_set_mm_exe_file() */
448 448
449#define MMF_HAS_UPROBES 19 /* has uprobes */
450#define MMF_RECALC_UPROBES 20 /* MMF_HAS_UPROBES can be wrong */
451
449#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK) 452#define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
450 453
451struct sighand_struct { 454struct sighand_struct {
@@ -668,7 +671,6 @@ struct signal_struct {
668 struct rw_semaphore group_rwsem; 671 struct rw_semaphore group_rwsem;
669#endif 672#endif
670 673
671 int oom_adj; /* OOM kill score adjustment (bit shift) */
672 int oom_score_adj; /* OOM kill score adjustment */ 674 int oom_score_adj; /* OOM kill score adjustment */
673 int oom_score_adj_min; /* OOM kill score adjustment minimum value. 675 int oom_score_adj_min; /* OOM kill score adjustment minimum value.
674 * Only settable by CAP_SYS_RESOURCE. */ 676 * Only settable by CAP_SYS_RESOURCE. */
@@ -678,11 +680,6 @@ struct signal_struct {
678 * (notably. ptrace) */ 680 * (notably. ptrace) */
679}; 681};
680 682
681/* Context switch must be unlocked if interrupts are to be enabled */
682#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
683# define __ARCH_WANT_UNLOCKED_CTXSW
684#endif
685
686/* 683/*
687 * Bits in flags field of signal_struct. 684 * Bits in flags field of signal_struct.
688 */ 685 */
@@ -860,7 +857,6 @@ enum cpu_idle_type {
860#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */ 857#define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
861#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */ 858#define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
862#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */ 859#define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
863#define SD_PREFER_LOCAL 0x0040 /* Prefer to keep tasks local to this domain */
864#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */ 860#define SD_SHARE_CPUPOWER 0x0080 /* Domain members share cpu power */
865#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */ 861#define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
866#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */ 862#define SD_SERIALIZE 0x0400 /* Only a single load balancing instance */
@@ -954,7 +950,6 @@ struct sched_domain {
954 unsigned int smt_gain; 950 unsigned int smt_gain;
955 int flags; /* See SD_* */ 951 int flags; /* See SD_* */
956 int level; 952 int level;
957 int idle_buddy; /* cpu assigned to select_idle_sibling() */
958 953
959 /* Runtime fields. */ 954 /* Runtime fields. */
960 unsigned long last_balance; /* init to jiffies. units in jiffies */ 955 unsigned long last_balance; /* init to jiffies. units in jiffies */
@@ -1418,7 +1413,7 @@ struct task_struct {
1418 1413
1419 struct audit_context *audit_context; 1414 struct audit_context *audit_context;
1420#ifdef CONFIG_AUDITSYSCALL 1415#ifdef CONFIG_AUDITSYSCALL
1421 uid_t loginuid; 1416 kuid_t loginuid;
1422 unsigned int sessionid; 1417 unsigned int sessionid;
1423#endif 1418#endif
1424 struct seccomp seccomp; 1419 struct seccomp seccomp;
@@ -1530,6 +1525,9 @@ struct task_struct {
1530 * cache last used pipe for splice 1525 * cache last used pipe for splice
1531 */ 1526 */
1532 struct pipe_inode_info *splice_pipe; 1527 struct pipe_inode_info *splice_pipe;
1528
1529 struct page_frag task_frag;
1530
1533#ifdef CONFIG_TASK_DELAY_ACCT 1531#ifdef CONFIG_TASK_DELAY_ACCT
1534 struct task_delay_info *delays; 1532 struct task_delay_info *delays;
1535#endif 1533#endif
@@ -1886,6 +1884,14 @@ static inline void rcu_copy_process(struct task_struct *p)
1886 1884
1887#endif 1885#endif
1888 1886
1887static inline void rcu_switch(struct task_struct *prev,
1888 struct task_struct *next)
1889{
1890#ifdef CONFIG_RCU_USER_QS
1891 rcu_user_hooks_switch(prev, next);
1892#endif
1893}
1894
1889static inline void tsk_restore_flags(struct task_struct *task, 1895static inline void tsk_restore_flags(struct task_struct *task,
1890 unsigned long orig_flags, unsigned long flags) 1896 unsigned long orig_flags, unsigned long flags)
1891{ 1897{
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 899fbb487c94..fb3c5a8fef3d 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -68,6 +68,8 @@ struct screen_info {
68 68
69#define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */ 69#define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */
70 70
71#define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0)
72
71#ifdef __KERNEL__ 73#ifdef __KERNEL__
72extern struct screen_info screen_info; 74extern struct screen_info screen_info;
73 75
diff --git a/include/linux/security.h b/include/linux/security.h
index 3dea6a9d568f..5b50c4e1a7c2 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -118,6 +118,7 @@ void reset_security_ops(void);
118extern unsigned long mmap_min_addr; 118extern unsigned long mmap_min_addr;
119extern unsigned long dac_mmap_min_addr; 119extern unsigned long dac_mmap_min_addr;
120#else 120#else
121#define mmap_min_addr 0UL
121#define dac_mmap_min_addr 0UL 122#define dac_mmap_min_addr 0UL
122#endif 123#endif
123 124
@@ -1435,7 +1436,7 @@ struct security_operations {
1435 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry, 1436 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1436 struct path *new_dir, struct dentry *new_dentry); 1437 struct path *new_dir, struct dentry *new_dentry);
1437 int (*path_chmod) (struct path *path, umode_t mode); 1438 int (*path_chmod) (struct path *path, umode_t mode);
1438 int (*path_chown) (struct path *path, uid_t uid, gid_t gid); 1439 int (*path_chown) (struct path *path, kuid_t uid, kgid_t gid);
1439 int (*path_chroot) (struct path *path); 1440 int (*path_chroot) (struct path *path);
1440#endif 1441#endif
1441 1442
@@ -2830,7 +2831,7 @@ int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2830int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2831int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2831 struct path *new_dir, struct dentry *new_dentry); 2832 struct path *new_dir, struct dentry *new_dentry);
2832int security_path_chmod(struct path *path, umode_t mode); 2833int security_path_chmod(struct path *path, umode_t mode);
2833int security_path_chown(struct path *path, uid_t uid, gid_t gid); 2834int security_path_chown(struct path *path, kuid_t uid, kgid_t gid);
2834int security_path_chroot(struct path *path); 2835int security_path_chroot(struct path *path);
2835#else /* CONFIG_SECURITY_PATH */ 2836#else /* CONFIG_SECURITY_PATH */
2836static inline int security_path_unlink(struct path *dir, struct dentry *dentry) 2837static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
@@ -2886,7 +2887,7 @@ static inline int security_path_chmod(struct path *path, umode_t mode)
2886 return 0; 2887 return 0;
2887} 2888}
2888 2889
2889static inline int security_path_chown(struct path *path, uid_t uid, gid_t gid) 2890static inline int security_path_chown(struct path *path, kuid_t uid, kgid_t gid)
2890{ 2891{
2891 return 0; 2892 return 0;
2892} 2893}
@@ -3021,5 +3022,36 @@ static inline void free_secdata(void *secdata)
3021{ } 3022{ }
3022#endif /* CONFIG_SECURITY */ 3023#endif /* CONFIG_SECURITY */
3023 3024
3025#ifdef CONFIG_SECURITY_YAMA
3026extern int yama_ptrace_access_check(struct task_struct *child,
3027 unsigned int mode);
3028extern int yama_ptrace_traceme(struct task_struct *parent);
3029extern void yama_task_free(struct task_struct *task);
3030extern int yama_task_prctl(int option, unsigned long arg2, unsigned long arg3,
3031 unsigned long arg4, unsigned long arg5);
3032#else
3033static inline int yama_ptrace_access_check(struct task_struct *child,
3034 unsigned int mode)
3035{
3036 return 0;
3037}
3038
3039static inline int yama_ptrace_traceme(struct task_struct *parent)
3040{
3041 return 0;
3042}
3043
3044static inline void yama_task_free(struct task_struct *task)
3045{
3046}
3047
3048static inline int yama_task_prctl(int option, unsigned long arg2,
3049 unsigned long arg3, unsigned long arg4,
3050 unsigned long arg5)
3051{
3052 return -ENOSYS;
3053}
3054#endif /* CONFIG_SECURITY_YAMA */
3055
3024#endif /* ! __LINUX_SECURITY_H */ 3056#endif /* ! __LINUX_SECURITY_H */
3025 3057
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 83c44eefe698..68a04a343cad 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -13,6 +13,7 @@ struct file;
13struct path; 13struct path;
14struct inode; 14struct inode;
15struct dentry; 15struct dentry;
16struct user_namespace;
16 17
17struct seq_file { 18struct seq_file {
18 char *buf; 19 char *buf;
@@ -25,6 +26,9 @@ struct seq_file {
25 struct mutex lock; 26 struct mutex lock;
26 const struct seq_operations *op; 27 const struct seq_operations *op;
27 int poll_event; 28 int poll_event;
29#ifdef CONFIG_USER_NS
30 struct user_namespace *user_ns;
31#endif
28 void *private; 32 void *private;
29}; 33};
30 34
@@ -128,6 +132,16 @@ int seq_put_decimal_ull(struct seq_file *m, char delimiter,
128int seq_put_decimal_ll(struct seq_file *m, char delimiter, 132int seq_put_decimal_ll(struct seq_file *m, char delimiter,
129 long long num); 133 long long num);
130 134
135static inline struct user_namespace *seq_user_ns(struct seq_file *seq)
136{
137#ifdef CONFIG_USER_NS
138 return seq->user_ns;
139#else
140 extern struct user_namespace init_user_ns;
141 return &init_user_ns;
142#endif
143}
144
131#define SEQ_START_TOKEN ((void *)1) 145#define SEQ_START_TOKEN ((void *)1)
132/* 146/*
133 * Helpers for iteration over list_head-s in seq_files 147 * Helpers for iteration over list_head-s in seq_files
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 90e9f981358a..861e51de476b 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -12,9 +12,12 @@
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14 14
15#include <linux/tty_flags.h>
16
15#ifdef __KERNEL__ 17#ifdef __KERNEL__
16#include <asm/page.h> 18#include <asm/page.h>
17 19
20
18/* 21/*
19 * Counters of the input lines (CTS, DSR, RI, CD) interrupts 22 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
20 */ 23 */
@@ -83,89 +86,11 @@ struct serial_struct {
83#define SERIAL_IO_HUB6 1 86#define SERIAL_IO_HUB6 1
84#define SERIAL_IO_MEM 2 87#define SERIAL_IO_MEM 2
85 88
86struct serial_uart_config {
87 char *name;
88 int dfl_xmit_fifo_size;
89 int flags;
90};
91
92#define UART_CLEAR_FIFO 0x01 89#define UART_CLEAR_FIFO 0x01
93#define UART_USE_FIFO 0x02 90#define UART_USE_FIFO 0x02
94#define UART_STARTECH 0x04 91#define UART_STARTECH 0x04
95#define UART_NATSEMI 0x08 92#define UART_NATSEMI 0x08
96 93
97/*
98 * Definitions for async_struct (and serial_struct) flags field
99 *
100 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
101 */
102#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
103 * on the callout port */
104#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
105#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
106#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */
107#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
108#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
109#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
110#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
111 * autoconfiguration */
112#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */
113#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */
114#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */
115#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
116#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
117#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
118#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
119 * checks. Note: can be dangerous! */
120#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
121#define ASYNCB_LAST_USER 15
122
123/* Internal flags used only by kernel */
124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
125#define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
126#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
127#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
128#define ASYNCB_CLOSING 27 /* Serial port is closing */
129#define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */
130#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
131#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
132#define ASYNCB_CONS_FLOW 23 /* flow control for console */
133#define ASYNCB_FIRST_KERNEL 22
134
135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
136#define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED)
137#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
138#define ASYNC_SAK (1U << ASYNCB_SAK)
139#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
140#define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI)
141#define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI)
142#define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST)
143#define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ)
144#define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT)
145#define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT)
146#define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP)
147#define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD)
148#define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI)
149#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
150#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
151#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
152
153#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
154#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
155 ASYNC_LOW_LATENCY)
156#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
157#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
158#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
159
160#define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
161#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
162#define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF)
163#define ASYNC_CLOSING (1U << ASYNCB_CLOSING)
164#define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW)
165#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
166#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
167#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
168#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
169 94
170/* 95/*
171 * Multiport serial configuration structure --- external structure 96 * Multiport serial configuration structure --- external structure
diff --git a/include/linux/serial167.h b/include/linux/serial167.h
deleted file mode 100644
index 59c81b708562..000000000000
--- a/include/linux/serial167.h
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * serial167.h
3 *
4 * Richard Hirst [richard@sleepie.demon.co.uk]
5 *
6 * Based on cyclades.h
7 */
8
9struct cyclades_monitor {
10 unsigned long int_count;
11 unsigned long char_count;
12 unsigned long char_max;
13 unsigned long char_last;
14};
15
16/*
17 * This is our internal structure for each serial port's state.
18 *
19 * Many fields are paralleled by the structure used by the serial_struct
20 * structure.
21 *
22 * For definitions of the flags field, see tty.h
23 */
24
25struct cyclades_port {
26 int magic;
27 int type;
28 int card;
29 int line;
30 int flags; /* defined in tty.h */
31 struct tty_struct *tty;
32 int read_status_mask;
33 int timeout;
34 int xmit_fifo_size;
35 int cor1,cor2,cor3,cor4,cor5,cor6,cor7;
36 int tbpr,tco,rbpr,rco;
37 int ignore_status_mask;
38 int close_delay;
39 int IER; /* Interrupt Enable Register */
40 unsigned long last_active;
41 int count; /* # of fd on device */
42 int x_char; /* to be pushed out ASAP */
43 int x_break;
44 int blocked_open; /* # of blocked opens */
45 unsigned char *xmit_buf;
46 int xmit_head;
47 int xmit_tail;
48 int xmit_cnt;
49 int default_threshold;
50 int default_timeout;
51 wait_queue_head_t open_wait;
52 wait_queue_head_t close_wait;
53 struct cyclades_monitor mon;
54};
55
56#define CYCLADES_MAGIC 0x4359
57
58#define CYGETMON 0x435901
59#define CYGETTHRESH 0x435902
60#define CYSETTHRESH 0x435903
61#define CYGETDEFTHRESH 0x435904
62#define CYSETDEFTHRESH 0x435905
63#define CYGETTIMEOUT 0x435906
64#define CYSETTIMEOUT 0x435907
65#define CYGETDEFTIMEOUT 0x435908
66#define CYSETDEFTIMEOUT 0x435909
67
68#define CyMaxChipsPerCard 1
69
70/**** cd2401 registers ****/
71
72#define CyGFRCR (0x81)
73#define CyCCR (0x13)
74#define CyCLR_CHAN (0x40)
75#define CyINIT_CHAN (0x20)
76#define CyCHIP_RESET (0x10)
77#define CyENB_XMTR (0x08)
78#define CyDIS_XMTR (0x04)
79#define CyENB_RCVR (0x02)
80#define CyDIS_RCVR (0x01)
81#define CyCAR (0xee)
82#define CyIER (0x11)
83#define CyMdmCh (0x80)
84#define CyRxExc (0x20)
85#define CyRxData (0x08)
86#define CyTxMpty (0x02)
87#define CyTxRdy (0x01)
88#define CyLICR (0x26)
89#define CyRISR (0x89)
90#define CyTIMEOUT (0x80)
91#define CySPECHAR (0x70)
92#define CyOVERRUN (0x08)
93#define CyPARITY (0x04)
94#define CyFRAME (0x02)
95#define CyBREAK (0x01)
96#define CyREOIR (0x84)
97#define CyTEOIR (0x85)
98#define CyMEOIR (0x86)
99#define CyNOTRANS (0x08)
100#define CyRFOC (0x30)
101#define CyRDR (0xf8)
102#define CyTDR (0xf8)
103#define CyMISR (0x8b)
104#define CyRISR (0x89)
105#define CyTISR (0x8a)
106#define CyMSVR1 (0xde)
107#define CyMSVR2 (0xdf)
108#define CyDSR (0x80)
109#define CyDCD (0x40)
110#define CyCTS (0x20)
111#define CyDTR (0x02)
112#define CyRTS (0x01)
113#define CyRTPRL (0x25)
114#define CyRTPRH (0x24)
115#define CyCOR1 (0x10)
116#define CyPARITY_NONE (0x00)
117#define CyPARITY_E (0x40)
118#define CyPARITY_O (0xC0)
119#define Cy_5_BITS (0x04)
120#define Cy_6_BITS (0x05)
121#define Cy_7_BITS (0x06)
122#define Cy_8_BITS (0x07)
123#define CyCOR2 (0x17)
124#define CyETC (0x20)
125#define CyCtsAE (0x02)
126#define CyCOR3 (0x16)
127#define Cy_1_STOP (0x02)
128#define Cy_2_STOP (0x04)
129#define CyCOR4 (0x15)
130#define CyREC_FIFO (0x0F) /* Receive FIFO threshold */
131#define CyCOR5 (0x14)
132#define CyCOR6 (0x18)
133#define CyCOR7 (0x07)
134#define CyRBPR (0xcb)
135#define CyRCOR (0xc8)
136#define CyTBPR (0xc3)
137#define CyTCOR (0xc0)
138#define CySCHR1 (0x1f)
139#define CySCHR2 (0x1e)
140#define CyTPR (0xda)
141#define CyPILR1 (0xe3)
142#define CyPILR2 (0xe0)
143#define CyPILR3 (0xe1)
144#define CyCMR (0x1b)
145#define CyASYNC (0x02)
146#define CyLICR (0x26)
147#define CyLIVR (0x09)
148#define CySCRL (0x23)
149#define CySCRH (0x22)
150#define CyTFTC (0x80)
151
152
153/* max number of chars in the FIFO */
154
155#define CyMAX_CHAR_FIFO 12
156
157/***************************************************************************/
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index a416e92012ef..c174c90fb3fb 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -65,11 +65,38 @@ enum {
65 * platform device. Using these will make your driver 65 * platform device. Using these will make your driver
66 * dependent on the 8250 driver. 66 * dependent on the 8250 driver.
67 */ 67 */
68struct uart_port; 68
69struct uart_8250_port; 69struct uart_8250_port {
70 struct uart_port port;
71 struct timer_list timer; /* "no irq" timer */
72 struct list_head list; /* ports on this IRQ */
73 unsigned short capabilities; /* port capabilities */
74 unsigned short bugs; /* port bugs */
75 unsigned int tx_loadsz; /* transmit fifo load size */
76 unsigned char acr;
77 unsigned char ier;
78 unsigned char lcr;
79 unsigned char mcr;
80 unsigned char mcr_mask; /* mask of user bits */
81 unsigned char mcr_force; /* mask of forced bits */
82 unsigned char cur_iotype; /* Running I/O type */
83
84 /*
85 * Some bits in registers are cleared on a read, so they must
86 * be saved whenever the register is read but the bits will not
87 * be immediately processed.
88 */
89#define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS
90 unsigned char lsr_saved_flags;
91#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
92 unsigned char msr_saved_flags;
93
94 /* 8250 specific callbacks */
95 int (*dl_read)(struct uart_8250_port *);
96 void (*dl_write)(struct uart_8250_port *, int);
97};
70 98
71int serial8250_register_8250_port(struct uart_8250_port *); 99int serial8250_register_8250_port(struct uart_8250_port *);
72int serial8250_register_port(struct uart_port *);
73void serial8250_unregister_port(int line); 100void serial8250_unregister_port(int line);
74void serial8250_suspend_port(int line); 101void serial8250_suspend_port(int line);
75void serial8250_resume_port(int line); 102void serial8250_resume_port(int line);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 0253c2022e53..f9b22ec7a9f3 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -48,7 +48,8 @@
48#define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */ 48#define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */
49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */ 49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */ 50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_MAX_8250 22 /* max port ID */ 51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_MAX_8250 23 /* max port ID */
52 53
53/* 54/*
54 * ARM specific type numbers. These are not currently guaranteed 55 * ARM specific type numbers. These are not currently guaranteed
@@ -193,8 +194,8 @@
193/* SH-SCI */ 194/* SH-SCI */
194#define PORT_SCIFB 93 195#define PORT_SCIFB 93
195 196
196/* MAX3107 */ 197/* MAX310X */
197#define PORT_MAX3107 94 198#define PORT_MAX310X 94
198 199
199/* High Speed UART for Medfield */ 200/* High Speed UART for Medfield */
200#define PORT_MFD 95 201#define PORT_MFD 95
@@ -274,6 +275,7 @@ struct uart_ops {
274 int (*verify_port)(struct uart_port *, struct serial_struct *); 275 int (*verify_port)(struct uart_port *, struct serial_struct *);
275 int (*ioctl)(struct uart_port *, unsigned int, unsigned long); 276 int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
276#ifdef CONFIG_CONSOLE_POLL 277#ifdef CONFIG_CONSOLE_POLL
278 int (*poll_init)(struct uart_port *);
277 void (*poll_put_char)(struct uart_port *, unsigned char); 279 void (*poll_put_char)(struct uart_port *, unsigned char);
278 int (*poll_get_char)(struct uart_port *); 280 int (*poll_get_char)(struct uart_port *);
279#endif 281#endif
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 8ce70d76f836..5ed325e88a81 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -40,6 +40,10 @@
40 40
41#define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */ 41#define UART_IIR_BUSY 0x07 /* DesignWare APB Busy Detect */
42 42
43#define UART_IIR_RX_TIMEOUT 0x0c /* OMAP RX Timeout interrupt */
44#define UART_IIR_XOFF 0x10 /* OMAP XOFF/Special Character */
45#define UART_IIR_CTS_RTS_DSR 0x20 /* OMAP CTS/RTS/DSR Change */
46
43#define UART_FCR 2 /* Out: FIFO Control Register */ 47#define UART_FCR 2 /* Out: FIFO Control Register */
44#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */ 48#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the FIFO */
45#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ 49#define UART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index bef2cf00b3be..30aa0dc60d75 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -5,6 +5,7 @@
5#include <linux/mempolicy.h> 5#include <linux/mempolicy.h>
6#include <linux/pagemap.h> 6#include <linux/pagemap.h>
7#include <linux/percpu_counter.h> 7#include <linux/percpu_counter.h>
8#include <linux/xattr.h>
8 9
9/* inode in-kernel data */ 10/* inode in-kernel data */
10 11
@@ -18,7 +19,7 @@ struct shmem_inode_info {
18 }; 19 };
19 struct shared_policy policy; /* NUMA memory alloc policy */ 20 struct shared_policy policy; /* NUMA memory alloc policy */
20 struct list_head swaplist; /* chain of maybes on swap */ 21 struct list_head swaplist; /* chain of maybes on swap */
21 struct list_head xattr_list; /* list of shmem_xattr */ 22 struct simple_xattrs xattrs; /* list of xattrs */
22 struct inode vfs_inode; 23 struct inode vfs_inode;
23}; 24};
24 25
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7632c87da2c9..b33a3a1f205e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -846,13 +846,16 @@ static inline int skb_shared(const struct sk_buff *skb)
846 * 846 *
847 * NULL is returned on a memory allocation failure. 847 * NULL is returned on a memory allocation failure.
848 */ 848 */
849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, 849static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri)
850 gfp_t pri)
851{ 850{
852 might_sleep_if(pri & __GFP_WAIT); 851 might_sleep_if(pri & __GFP_WAIT);
853 if (skb_shared(skb)) { 852 if (skb_shared(skb)) {
854 struct sk_buff *nskb = skb_clone(skb, pri); 853 struct sk_buff *nskb = skb_clone(skb, pri);
855 kfree_skb(skb); 854
855 if (likely(nskb))
856 consume_skb(skb);
857 else
858 kfree_skb(skb);
856 skb = nskb; 859 skb = nskb;
857 } 860 }
858 return skb; 861 return skb;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0dd2dfa7beca..83d1a1454b7e 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -321,7 +321,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
321 * request comes from. 321 * request comes from.
322 */ 322 */
323#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 323#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
324 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 324 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
325 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
325extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 326extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
326#define kmalloc_track_caller(size, flags) \ 327#define kmalloc_track_caller(size, flags) \
327 __kmalloc_track_caller(size, flags, _RET_IP_) 328 __kmalloc_track_caller(size, flags, _RET_IP_)
@@ -340,7 +341,8 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
340 * allocation request comes from. 341 * allocation request comes from.
341 */ 342 */
342#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 343#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
343 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 344 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
345 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
344extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 346extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
345#define kmalloc_node_track_caller(size, flags, node) \ 347#define kmalloc_node_track_caller(size, flags, node) \
346 __kmalloc_node_track_caller(size, flags, node, \ 348 __kmalloc_node_track_caller(size, flags, node, \
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 0c634fa376c9..cc290f0bdb34 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -45,7 +45,6 @@ struct kmem_cache {
45 unsigned int colour_off; /* colour offset */ 45 unsigned int colour_off; /* colour offset */
46 struct kmem_cache *slabp_cache; 46 struct kmem_cache *slabp_cache;
47 unsigned int slab_size; 47 unsigned int slab_size;
48 unsigned int dflags; /* dynamic flags */
49 48
50 /* constructor func */ 49 /* constructor func */
51 void (*ctor)(void *obj); 50 void (*ctor)(void *obj);
@@ -112,19 +111,13 @@ void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
112void *__kmalloc(size_t size, gfp_t flags); 111void *__kmalloc(size_t size, gfp_t flags);
113 112
114#ifdef CONFIG_TRACING 113#ifdef CONFIG_TRACING
115extern void *kmem_cache_alloc_trace(size_t size, 114extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
116 struct kmem_cache *cachep, gfp_t flags);
117extern size_t slab_buffer_size(struct kmem_cache *cachep);
118#else 115#else
119static __always_inline void * 116static __always_inline void *
120kmem_cache_alloc_trace(size_t size, struct kmem_cache *cachep, gfp_t flags) 117kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
121{ 118{
122 return kmem_cache_alloc(cachep, flags); 119 return kmem_cache_alloc(cachep, flags);
123} 120}
124static inline size_t slab_buffer_size(struct kmem_cache *cachep)
125{
126 return 0;
127}
128#endif 121#endif
129 122
130static __always_inline void *kmalloc(size_t size, gfp_t flags) 123static __always_inline void *kmalloc(size_t size, gfp_t flags)
@@ -154,7 +147,7 @@ found:
154#endif 147#endif
155 cachep = malloc_sizes[i].cs_cachep; 148 cachep = malloc_sizes[i].cs_cachep;
156 149
157 ret = kmem_cache_alloc_trace(size, cachep, flags); 150 ret = kmem_cache_alloc_trace(cachep, flags, size);
158 151
159 return ret; 152 return ret;
160 } 153 }
@@ -166,16 +159,16 @@ extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
166extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 159extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
167 160
168#ifdef CONFIG_TRACING 161#ifdef CONFIG_TRACING
169extern void *kmem_cache_alloc_node_trace(size_t size, 162extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
170 struct kmem_cache *cachep,
171 gfp_t flags, 163 gfp_t flags,
172 int nodeid); 164 int nodeid,
165 size_t size);
173#else 166#else
174static __always_inline void * 167static __always_inline void *
175kmem_cache_alloc_node_trace(size_t size, 168kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
176 struct kmem_cache *cachep,
177 gfp_t flags, 169 gfp_t flags,
178 int nodeid) 170 int nodeid,
171 size_t size)
179{ 172{
180 return kmem_cache_alloc_node(cachep, flags, nodeid); 173 return kmem_cache_alloc_node(cachep, flags, nodeid);
181} 174}
@@ -207,7 +200,7 @@ found:
207#endif 200#endif
208 cachep = malloc_sizes[i].cs_cachep; 201 cachep = malloc_sizes[i].cs_cachep;
209 202
210 return kmem_cache_alloc_node_trace(size, cachep, flags, node); 203 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
211 } 204 }
212 return __kmalloc_node(size, flags, node); 205 return __kmalloc_node(size, flags, node);
213} 206}
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..f28e14a12e3f 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,12 +1,14 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#include <linux/numa.h>
5
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 6void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 7
6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 8static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
7 gfp_t flags) 9 gfp_t flags)
8{ 10{
9 return kmem_cache_alloc_node(cachep, flags, -1); 11 return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
10} 12}
11 13
12void *__kmalloc_node(size_t size, gfp_t flags, int node); 14void *__kmalloc_node(size_t size, gfp_t flags, int node);
@@ -26,7 +28,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
26 */ 28 */
27static __always_inline void *kmalloc(size_t size, gfp_t flags) 29static __always_inline void *kmalloc(size_t size, gfp_t flags)
28{ 30{
29 return __kmalloc_node(size, flags, -1); 31 return __kmalloc_node(size, flags, NUMA_NO_NODE);
30} 32}
31 33
32static __always_inline void *__kmalloc(size_t size, gfp_t flags) 34static __always_inline void *__kmalloc(size_t size, gfp_t flags)
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
new file mode 100644
index 000000000000..e0106d8581d3
--- /dev/null
+++ b/include/linux/smpboot.h
@@ -0,0 +1,43 @@
1#ifndef _LINUX_SMPBOOT_H
2#define _LINUX_SMPBOOT_H
3
4#include <linux/types.h>
5
6struct task_struct;
7/* Cookie handed to the thread_fn*/
8struct smpboot_thread_data;
9
10/**
11 * struct smp_hotplug_thread - CPU hotplug related thread descriptor
12 * @store: Pointer to per cpu storage for the task pointers
13 * @list: List head for core management
14 * @thread_should_run: Check whether the thread should run or not. Called with
15 * preemption disabled.
16 * @thread_fn: The associated thread function
17 * @setup: Optional setup function, called when the thread gets
18 * operational the first time
19 * @cleanup: Optional cleanup function, called when the thread
20 * should stop (module exit)
21 * @park: Optional park function, called when the thread is
22 * parked (cpu offline)
23 * @unpark: Optional unpark function, called when the thread is
24 * unparked (cpu online)
25 * @thread_comm: The base name of the thread
26 */
27struct smp_hotplug_thread {
28 struct task_struct __percpu **store;
29 struct list_head list;
30 int (*thread_should_run)(unsigned int cpu);
31 void (*thread_fn)(unsigned int cpu);
32 void (*setup)(unsigned int cpu);
33 void (*cleanup)(unsigned int cpu, bool online);
34 void (*park)(unsigned int cpu);
35 void (*unpark)(unsigned int cpu);
36 const char *thread_comm;
37};
38
39int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
40void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
41int smpboot_thread_schedule(void);
42
43#endif
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 00bc189cb395..fdfba235f9f1 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,14 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21/* frequently written fields in fast path, kept in same cache line */
21 IPSTATS_MIB_INPKTS, /* InReceives */ 22 IPSTATS_MIB_INPKTS, /* InReceives */
23 IPSTATS_MIB_INOCTETS, /* InOctets */
24 IPSTATS_MIB_INDELIVERS, /* InDelivers */
25 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
26 IPSTATS_MIB_OUTPKTS, /* OutRequests */
27 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
28/* other fields */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 29 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 30 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 31 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -26,9 +33,6 @@ enum
26 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */ 33 IPSTATS_MIB_INUNKNOWNPROTOS, /* InUnknownProtos */
27 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */ 34 IPSTATS_MIB_INTRUNCATEDPKTS, /* InTruncatedPkts */
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 35 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 36 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 37 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 38 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,8 +46,6 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 46 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 47 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 48 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */ 49 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */ 50 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */ 51 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
@@ -239,6 +241,10 @@ enum
239 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ 241 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */
240 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ 242 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */
241 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ 243 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */
244 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/
245 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
246 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
247 LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */
242 __LINUX_MIB_MAX 248 __LINUX_MIB_MAX
243}; 249};
244 250
diff --git a/include/linux/spi/mxs-spi.h b/include/linux/spi/mxs-spi.h
new file mode 100644
index 000000000000..61ae1306db23
--- /dev/null
+++ b/include/linux/spi/mxs-spi.h
@@ -0,0 +1,150 @@
1/*
2 * include/linux/spi/mxs-spi.h
3 *
4 * Freescale i.MX233/i.MX28 SPI controller register definition
5 *
6 * Copyright 2008 Embedded Alley Solutions, Inc.
7 * Copyright 2009-2011 Freescale Semiconductor, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24#ifndef __LINUX_SPI_MXS_SPI_H__
25#define __LINUX_SPI_MXS_SPI_H__
26
27#include <linux/fsl/mxs-dma.h>
28
29#define ssp_is_old(host) ((host)->devid == IMX23_SSP)
30
31/* SSP registers */
32#define HW_SSP_CTRL0 0x000
33#define BM_SSP_CTRL0_RUN (1 << 29)
34#define BM_SSP_CTRL0_SDIO_IRQ_CHECK (1 << 28)
35#define BM_SSP_CTRL0_LOCK_CS (1 << 27)
36#define BM_SSP_CTRL0_IGNORE_CRC (1 << 26)
37#define BM_SSP_CTRL0_READ (1 << 25)
38#define BM_SSP_CTRL0_DATA_XFER (1 << 24)
39#define BP_SSP_CTRL0_BUS_WIDTH 22
40#define BM_SSP_CTRL0_BUS_WIDTH (0x3 << 22)
41#define BM_SSP_CTRL0_WAIT_FOR_IRQ (1 << 21)
42#define BM_SSP_CTRL0_WAIT_FOR_CMD (1 << 20)
43#define BM_SSP_CTRL0_LONG_RESP (1 << 19)
44#define BM_SSP_CTRL0_GET_RESP (1 << 17)
45#define BM_SSP_CTRL0_ENABLE (1 << 16)
46#define BP_SSP_CTRL0_XFER_COUNT 0
47#define BM_SSP_CTRL0_XFER_COUNT 0xffff
48#define HW_SSP_CMD0 0x010
49#define BM_SSP_CMD0_DBL_DATA_RATE_EN (1 << 25)
50#define BM_SSP_CMD0_SLOW_CLKING_EN (1 << 22)
51#define BM_SSP_CMD0_CONT_CLKING_EN (1 << 21)
52#define BM_SSP_CMD0_APPEND_8CYC (1 << 20)
53#define BP_SSP_CMD0_BLOCK_SIZE 16
54#define BM_SSP_CMD0_BLOCK_SIZE (0xf << 16)
55#define BP_SSP_CMD0_BLOCK_COUNT 8
56#define BM_SSP_CMD0_BLOCK_COUNT (0xff << 8)
57#define BP_SSP_CMD0_CMD 0
58#define BM_SSP_CMD0_CMD 0xff
59#define HW_SSP_CMD1 0x020
60#define HW_SSP_XFER_SIZE 0x030
61#define HW_SSP_BLOCK_SIZE 0x040
62#define BP_SSP_BLOCK_SIZE_BLOCK_COUNT 4
63#define BM_SSP_BLOCK_SIZE_BLOCK_COUNT (0xffffff << 4)
64#define BP_SSP_BLOCK_SIZE_BLOCK_SIZE 0
65#define BM_SSP_BLOCK_SIZE_BLOCK_SIZE 0xf
66#define HW_SSP_TIMING(h) (ssp_is_old(h) ? 0x050 : 0x070)
67#define BP_SSP_TIMING_TIMEOUT 16
68#define BM_SSP_TIMING_TIMEOUT (0xffff << 16)
69#define BP_SSP_TIMING_CLOCK_DIVIDE 8
70#define BM_SSP_TIMING_CLOCK_DIVIDE (0xff << 8)
71#define BF_SSP_TIMING_CLOCK_DIVIDE(v) \
72 (((v) << 8) & BM_SSP_TIMING_CLOCK_DIVIDE)
73#define BP_SSP_TIMING_CLOCK_RATE 0
74#define BM_SSP_TIMING_CLOCK_RATE 0xff
75#define BF_SSP_TIMING_CLOCK_RATE(v) \
76 (((v) << 0) & BM_SSP_TIMING_CLOCK_RATE)
77#define HW_SSP_CTRL1(h) (ssp_is_old(h) ? 0x060 : 0x080)
78#define BM_SSP_CTRL1_SDIO_IRQ (1 << 31)
79#define BM_SSP_CTRL1_SDIO_IRQ_EN (1 << 30)
80#define BM_SSP_CTRL1_RESP_ERR_IRQ (1 << 29)
81#define BM_SSP_CTRL1_RESP_ERR_IRQ_EN (1 << 28)
82#define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ (1 << 27)
83#define BM_SSP_CTRL1_RESP_TIMEOUT_IRQ_EN (1 << 26)
84#define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ (1 << 25)
85#define BM_SSP_CTRL1_DATA_TIMEOUT_IRQ_EN (1 << 24)
86#define BM_SSP_CTRL1_DATA_CRC_IRQ (1 << 23)
87#define BM_SSP_CTRL1_DATA_CRC_IRQ_EN (1 << 22)
88#define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ (1 << 21)
89#define BM_SSP_CTRL1_FIFO_UNDERRUN_IRQ_EN (1 << 20)
90#define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ (1 << 17)
91#define BM_SSP_CTRL1_RECV_TIMEOUT_IRQ_EN (1 << 16)
92#define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ (1 << 15)
93#define BM_SSP_CTRL1_FIFO_OVERRUN_IRQ_EN (1 << 14)
94#define BM_SSP_CTRL1_DMA_ENABLE (1 << 13)
95#define BM_SSP_CTRL1_PHASE (1 << 10)
96#define BM_SSP_CTRL1_POLARITY (1 << 9)
97#define BP_SSP_CTRL1_WORD_LENGTH 4
98#define BM_SSP_CTRL1_WORD_LENGTH (0xf << 4)
99#define BF_SSP_CTRL1_WORD_LENGTH(v) \
100 (((v) << 4) & BM_SSP_CTRL1_WORD_LENGTH)
101#define BV_SSP_CTRL1_WORD_LENGTH__FOUR_BITS 0x3
102#define BV_SSP_CTRL1_WORD_LENGTH__EIGHT_BITS 0x7
103#define BV_SSP_CTRL1_WORD_LENGTH__SIXTEEN_BITS 0xF
104#define BP_SSP_CTRL1_SSP_MODE 0
105#define BM_SSP_CTRL1_SSP_MODE 0xf
106#define BF_SSP_CTRL1_SSP_MODE(v) \
107 (((v) << 0) & BM_SSP_CTRL1_SSP_MODE)
108#define BV_SSP_CTRL1_SSP_MODE__SPI 0x0
109#define BV_SSP_CTRL1_SSP_MODE__SSI 0x1
110#define BV_SSP_CTRL1_SSP_MODE__SD_MMC 0x3
111#define BV_SSP_CTRL1_SSP_MODE__MS 0x4
112
113#define HW_SSP_DATA(h) (ssp_is_old(h) ? 0x070 : 0x090)
114
115#define HW_SSP_SDRESP0(h) (ssp_is_old(h) ? 0x080 : 0x0a0)
116#define HW_SSP_SDRESP1(h) (ssp_is_old(h) ? 0x090 : 0x0b0)
117#define HW_SSP_SDRESP2(h) (ssp_is_old(h) ? 0x0a0 : 0x0c0)
118#define HW_SSP_SDRESP3(h) (ssp_is_old(h) ? 0x0b0 : 0x0d0)
119#define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100)
120#define BM_SSP_STATUS_CARD_DETECT (1 << 28)
121#define BM_SSP_STATUS_SDIO_IRQ (1 << 17)
122#define BM_SSP_STATUS_FIFO_EMPTY (1 << 5)
123
124#define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field)
125
126#define SSP_PIO_NUM 3
127
128enum mxs_ssp_id {
129 IMX23_SSP,
130 IMX28_SSP,
131};
132
133struct mxs_ssp {
134 struct device *dev;
135 void __iomem *base;
136 struct clk *clk;
137 unsigned int clk_rate;
138 enum mxs_ssp_id devid;
139
140 int dma_channel;
141 struct dma_chan *dmach;
142 struct mxs_dma_data dma_data;
143 unsigned int dma_dir;
144 enum dma_transfer_direction slave_dirn;
145 u32 ssp_pio_words[SSP_PIO_NUM];
146};
147
148void mxs_ssp_set_clk_rate(struct mxs_ssp *ssp, unsigned int rate);
149
150#endif /* __LINUX_SPI_MXS_SPI_H__ */
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
deleted file mode 100644
index 336af33c6ea4..000000000000
--- a/include/linux/stallion.h
+++ /dev/null
@@ -1,147 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * stallion.h -- stallion multiport serial driver.
5 *
6 * Copyright (C) 1996-1998 Stallion Technologies
7 * Copyright (C) 1994-1996 Greg Ungerer.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24/*****************************************************************************/
25#ifndef _STALLION_H
26#define _STALLION_H
27/*****************************************************************************/
28
29/*
30 * Define important driver constants here.
31 */
32#define STL_MAXBRDS 4
33#define STL_MAXPANELS 4
34#define STL_MAXBANKS 8
35#define STL_PORTSPERPANEL 16
36#define STL_MAXPORTS 64
37#define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS)
38
39
40/*
41 * Define a set of structures to hold all the board/panel/port info
42 * for our ports. These will be dynamically allocated as required.
43 */
44
45/*
46 * Define a ring queue structure for each port. This will hold the
47 * TX data waiting to be output. Characters are fed into this buffer
48 * from the line discipline (or even direct from user space!) and
49 * then fed into the UARTs during interrupts. Will use a classic ring
50 * queue here for this. The good thing about this type of ring queue
51 * is that the head and tail pointers can be updated without interrupt
52 * protection - since "write" code only needs to change the head, and
53 * interrupt code only needs to change the tail.
54 */
55struct stlrq {
56 char *buf;
57 char *head;
58 char *tail;
59};
60
61/*
62 * Port, panel and board structures to hold status info about each.
63 * The board structure contains pointers to structures for each panel
64 * connected to it, and in turn each panel structure contains pointers
65 * for each port structure for each port on that panel. Note that
66 * the port structure also contains the board and panel number that it
67 * is associated with, this makes it (fairly) easy to get back to the
68 * board/panel info for a port.
69 */
70struct stlport {
71 unsigned long magic;
72 struct tty_port port;
73 unsigned int portnr;
74 unsigned int panelnr;
75 unsigned int brdnr;
76 int ioaddr;
77 int uartaddr;
78 unsigned int pagenr;
79 unsigned long istate;
80 int baud_base;
81 int custom_divisor;
82 int close_delay;
83 int closing_wait;
84 int openwaitcnt;
85 int brklen;
86 unsigned int sigs;
87 unsigned int rxignoremsk;
88 unsigned int rxmarkmsk;
89 unsigned int imr;
90 unsigned int crenable;
91 unsigned long clk;
92 unsigned long hwid;
93 void *uartp;
94 comstats_t stats;
95 struct stlrq tx;
96};
97
98struct stlpanel {
99 unsigned long magic;
100 unsigned int panelnr;
101 unsigned int brdnr;
102 unsigned int pagenr;
103 unsigned int nrports;
104 int iobase;
105 void *uartp;
106 void (*isr)(struct stlpanel *panelp, unsigned int iobase);
107 unsigned int hwid;
108 unsigned int ackmask;
109 struct stlport *ports[STL_PORTSPERPANEL];
110};
111
112struct stlbrd {
113 unsigned long magic;
114 unsigned int brdnr;
115 unsigned int brdtype;
116 unsigned int state;
117 unsigned int nrpanels;
118 unsigned int nrports;
119 unsigned int nrbnks;
120 int irq;
121 int irqtype;
122 int (*isr)(struct stlbrd *brdp);
123 unsigned int ioaddr1;
124 unsigned int ioaddr2;
125 unsigned int iosize1;
126 unsigned int iosize2;
127 unsigned int iostatus;
128 unsigned int ioctrl;
129 unsigned int ioctrlval;
130 unsigned int hwid;
131 unsigned long clk;
132 unsigned int bnkpageaddr[STL_MAXBANKS];
133 unsigned int bnkstataddr[STL_MAXBANKS];
134 struct stlpanel *bnk2panel[STL_MAXBANKS];
135 struct stlpanel *panels[STL_MAXPANELS];
136};
137
138
139/*
140 * Define MAGIC numbers used for above structures.
141 */
142#define STL_PORTMAGIC 0x5a7182c9
143#define STL_PANELMAGIC 0x7ef621a1
144#define STL_BOARDMAGIC 0xa2267f52
145
146/*****************************************************************************/
147#endif
diff --git a/include/linux/ste_modem_shm.h b/include/linux/ste_modem_shm.h
new file mode 100644
index 000000000000..8444a4eff1bb
--- /dev/null
+++ b/include/linux/ste_modem_shm.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) ST-Ericsson AB 2012
3 * Author: Sjur Brendeland / sjur.brandeland@stericsson.com
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __INC_MODEM_DEV_H
9#define __INC_MODEM_DEV_H
10#include <linux/types.h>
11#include <linux/platform_device.h>
12
13struct ste_modem_device;
14
15/**
16 * struct ste_modem_dev_cb - Callbacks for modem initiated events.
17 * @kick: Called when the modem kicks the host.
18 *
19 * This structure contains callbacks for actions triggered by the modem.
20 */
21struct ste_modem_dev_cb {
22 void (*kick)(struct ste_modem_device *mdev, int notify_id);
23};
24
25/**
26 * struct ste_modem_dev_ops - Functions to control modem and modem interface.
27 *
28 * @power: Main power switch, used for cold-start or complete power off.
29 * @kick: Kick the modem.
30 * @kick_subscribe: Subscribe for notifications from the modem.
31 * @setup: Provide callback functions to modem device.
32 *
33 * This structure contains functions used by the ste remoteproc driver
34 * to manage the modem.
35 */
36struct ste_modem_dev_ops {
37 int (*power)(struct ste_modem_device *mdev, bool on);
38 int (*kick)(struct ste_modem_device *mdev, int notify_id);
39 int (*kick_subscribe)(struct ste_modem_device *mdev, int notify_id);
40 int (*setup)(struct ste_modem_device *mdev,
41 struct ste_modem_dev_cb *cfg);
42};
43
44/**
45 * struct ste_modem_device - represent the STE modem device
46 * @pdev: Reference to platform device
47 * @ops: Operations used to manage the modem.
48 * @drv_data: Driver private data.
49 */
50struct ste_modem_device {
51 struct platform_device pdev;
52 struct ste_modem_dev_ops ops;
53 void *drv_data;
54};
55
56#endif /*INC_MODEM_DEV_H*/
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index b69bdb1e08b6..a1547ea3920d 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -76,7 +76,6 @@
76/* Platfrom data for platform device structure's platform_data field */ 76/* Platfrom data for platform device structure's platform_data field */
77 77
78struct stmmac_mdio_bus_data { 78struct stmmac_mdio_bus_data {
79 int bus_id;
80 int (*phy_reset)(void *priv); 79 int (*phy_reset)(void *priv);
81 unsigned int phy_mask; 80 unsigned int phy_mask;
82 int *irqs; 81 int *irqs;
diff --git a/include/linux/string.h b/include/linux/string.h
index ffe0442e18d2..b9178812d9df 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -144,8 +144,8 @@ static inline bool strstarts(const char *str, const char *prefix)
144{ 144{
145 return strncmp(str, prefix, strlen(prefix)) == 0; 145 return strncmp(str, prefix, strlen(prefix)) == 0;
146} 146}
147#endif
148 147
149extern size_t memweight(const void *ptr, size_t bytes); 148extern size_t memweight(const void *ptr, size_t bytes);
150 149
150#endif /* __KERNEL__ */
151#endif /* _LINUX_STRING_H_ */ 151#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cff40aa7db62..bf8c49ff7530 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -114,6 +114,7 @@ struct rpc_xprt_ops {
114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); 114 void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
115 int (*reserve_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 115 int (*reserve_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
116 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); 116 void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
117 void (*alloc_slot)(struct rpc_xprt *xprt, struct rpc_task *task);
117 void (*rpcbind)(struct rpc_task *task); 118 void (*rpcbind)(struct rpc_task *task);
118 void (*set_port)(struct rpc_xprt *xprt, unsigned short port); 119 void (*set_port)(struct rpc_xprt *xprt, unsigned short port);
119 void (*connect)(struct rpc_task *task); 120 void (*connect)(struct rpc_task *task);
@@ -281,6 +282,8 @@ void xprt_connect(struct rpc_task *task);
281void xprt_reserve(struct rpc_task *task); 282void xprt_reserve(struct rpc_task *task);
282int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 283int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
283int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 284int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
285void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
286void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
284int xprt_prepare_transmit(struct rpc_task *task); 287int xprt_prepare_transmit(struct rpc_task *task);
285void xprt_transmit(struct rpc_task *task); 288void xprt_transmit(struct rpc_task *task);
286void xprt_end_transmit(struct rpc_task *task); 289void xprt_end_transmit(struct rpc_task *task);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 388e70601413..68df9c17fbbb 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -281,7 +281,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
281} 281}
282#endif 282#endif
283 283
284extern int page_evictable(struct page *page, struct vm_area_struct *vma); 284extern int page_evictable(struct page *page);
285extern void check_move_unevictable_pages(struct page **, int nr_pages); 285extern void check_move_unevictable_pages(struct page **, int nr_pages);
286 286
287extern unsigned long scan_unevictable_pages; 287extern unsigned long scan_unevictable_pages;
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index e872526fdc5f..8d08b3ed406d 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -25,6 +25,7 @@ extern int swiotlb_force;
25extern void swiotlb_init(int verbose); 25extern void swiotlb_init(int verbose);
26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose); 26extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);
27extern unsigned long swiotlb_nr_tbl(void); 27extern unsigned long swiotlb_nr_tbl(void);
28extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
28 29
29/* 30/*
30 * Enumeration for sync targets 31 * Enumeration for sync targets
diff --git a/include/linux/task_work.h b/include/linux/task_work.h
index fb46b03b1852..ca5a1cf27dae 100644
--- a/include/linux/task_work.h
+++ b/include/linux/task_work.h
@@ -18,8 +18,7 @@ void task_work_run(void);
18 18
19static inline void exit_task_work(struct task_struct *task) 19static inline void exit_task_work(struct task_struct *task)
20{ 20{
21 if (unlikely(task->task_works)) 21 task_work_run();
22 task_work_run();
23} 22}
24 23
25#endif /* _LINUX_TASK_WORK_H */ 24#endif /* _LINUX_TASK_WORK_H */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index eb125a4c30b3..67c789ae719c 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -110,6 +110,7 @@ enum {
110#define TCP_REPAIR_QUEUE 20 110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21 111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22 112#define TCP_REPAIR_OPTIONS 22
113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
113 114
114struct tcp_repair_opt { 115struct tcp_repair_opt {
115 __u32 opt_code; 116 __u32 opt_code;
@@ -246,6 +247,7 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
246/* TCP Fast Open */ 247/* TCP Fast Open */
247#define TCP_FASTOPEN_COOKIE_MIN 4 /* Min Fast Open Cookie size in bytes */ 248#define TCP_FASTOPEN_COOKIE_MIN 4 /* Min Fast Open Cookie size in bytes */
248#define TCP_FASTOPEN_COOKIE_MAX 16 /* Max Fast Open Cookie size in bytes */ 249#define TCP_FASTOPEN_COOKIE_MAX 16 /* Max Fast Open Cookie size in bytes */
250#define TCP_FASTOPEN_COOKIE_SIZE 8 /* the size employed by this impl. */
249 251
250/* TCP Fast Open Cookie as stored in memory */ 252/* TCP Fast Open Cookie as stored in memory */
251struct tcp_fastopen_cookie { 253struct tcp_fastopen_cookie {
@@ -312,9 +314,14 @@ struct tcp_request_sock {
312 /* Only used by TCP MD5 Signature so far. */ 314 /* Only used by TCP MD5 Signature so far. */
313 const struct tcp_request_sock_ops *af_specific; 315 const struct tcp_request_sock_ops *af_specific;
314#endif 316#endif
317 struct sock *listener; /* needed for TFO */
315 u32 rcv_isn; 318 u32 rcv_isn;
316 u32 snt_isn; 319 u32 snt_isn;
317 u32 snt_synack; /* synack sent time */ 320 u32 snt_synack; /* synack sent time */
321 u32 rcv_nxt; /* the ack # by SYNACK. For
322 * FastOpen it's the seq#
323 * after data-in-SYN.
324 */
318}; 325};
319 326
320static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) 327static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
@@ -505,14 +512,18 @@ struct tcp_sock {
505 struct tcp_md5sig_info __rcu *md5sig_info; 512 struct tcp_md5sig_info __rcu *md5sig_info;
506#endif 513#endif
507 514
508/* TCP fastopen related information */
509 struct tcp_fastopen_request *fastopen_req;
510
511 /* When the cookie options are generated and exchanged, then this 515 /* When the cookie options are generated and exchanged, then this
512 * object holds a reference to them (cookie_values->kref). Also 516 * object holds a reference to them (cookie_values->kref). Also
513 * contains related tcp_cookie_transactions fields. 517 * contains related tcp_cookie_transactions fields.
514 */ 518 */
515 struct tcp_cookie_values *cookie_values; 519 struct tcp_cookie_values *cookie_values;
520
521/* TCP fastopen related information */
522 struct tcp_fastopen_request *fastopen_req;
523 /* fastopen_rsk points to request_sock that resulted in this big
524 * socket. Used to retransmit SYNACKs etc.
525 */
526 struct request_sock *fastopen_rsk;
516}; 527};
517 528
518enum tsq_flags { 529enum tsq_flags {
@@ -552,6 +563,38 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk)
552 return (struct tcp_timewait_sock *)sk; 563 return (struct tcp_timewait_sock *)sk;
553} 564}
554 565
566static inline bool tcp_passive_fastopen(const struct sock *sk)
567{
568 return (sk->sk_state == TCP_SYN_RECV &&
569 tcp_sk(sk)->fastopen_rsk != NULL);
570}
571
572static inline bool fastopen_cookie_present(struct tcp_fastopen_cookie *foc)
573{
574 return foc->len != -1;
575}
576
577extern void tcp_sock_destruct(struct sock *sk);
578
579static inline int fastopen_init_queue(struct sock *sk, int backlog)
580{
581 struct request_sock_queue *queue =
582 &inet_csk(sk)->icsk_accept_queue;
583
584 if (queue->fastopenq == NULL) {
585 queue->fastopenq = kzalloc(
586 sizeof(struct fastopen_queue),
587 sk->sk_allocation);
588 if (queue->fastopenq == NULL)
589 return -ENOMEM;
590
591 sk->sk_destruct = tcp_sock_destruct;
592 spin_lock_init(&queue->fastopenq->lock);
593 }
594 queue->fastopenq->max_qlen = backlog;
595 return 0;
596}
597
555#endif /* __KERNEL__ */ 598#endif /* __KERNEL__ */
556 599
557#endif /* _LINUX_TCP_H */ 600#endif /* _LINUX_TCP_H */
diff --git a/include/linux/tcp_metrics.h b/include/linux/tcp_metrics.h
new file mode 100644
index 000000000000..cb5157b55f32
--- /dev/null
+++ b/include/linux/tcp_metrics.h
@@ -0,0 +1,54 @@
1/* tcp_metrics.h - TCP Metrics Interface */
2
3#ifndef _LINUX_TCP_METRICS_H
4#define _LINUX_TCP_METRICS_H
5
6#include <linux/types.h>
7
8/* NETLINK_GENERIC related info
9 */
10#define TCP_METRICS_GENL_NAME "tcp_metrics"
11#define TCP_METRICS_GENL_VERSION 0x1
12
13enum tcp_metric_index {
14 TCP_METRIC_RTT,
15 TCP_METRIC_RTTVAR,
16 TCP_METRIC_SSTHRESH,
17 TCP_METRIC_CWND,
18 TCP_METRIC_REORDERING,
19
20 /* Always last. */
21 __TCP_METRIC_MAX,
22};
23
24#define TCP_METRIC_MAX (__TCP_METRIC_MAX - 1)
25
26enum {
27 TCP_METRICS_ATTR_UNSPEC,
28 TCP_METRICS_ATTR_ADDR_IPV4, /* u32 */
29 TCP_METRICS_ATTR_ADDR_IPV6, /* binary */
30 TCP_METRICS_ATTR_AGE, /* msecs */
31 TCP_METRICS_ATTR_TW_TSVAL, /* u32, raw, rcv tsval */
32 TCP_METRICS_ATTR_TW_TS_STAMP, /* s32, sec age */
33 TCP_METRICS_ATTR_VALS, /* nested +1, u32 */
34 TCP_METRICS_ATTR_FOPEN_MSS, /* u16 */
35 TCP_METRICS_ATTR_FOPEN_SYN_DROPS, /* u16, count of drops */
36 TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS, /* msecs age */
37 TCP_METRICS_ATTR_FOPEN_COOKIE, /* binary */
38
39 __TCP_METRICS_ATTR_MAX,
40};
41
42#define TCP_METRICS_ATTR_MAX (__TCP_METRICS_ATTR_MAX - 1)
43
44enum {
45 TCP_METRICS_CMD_UNSPEC,
46 TCP_METRICS_CMD_GET,
47 TCP_METRICS_CMD_DEL,
48
49 __TCP_METRICS_CMD_MAX,
50};
51
52#define TCP_METRICS_CMD_MAX (__TCP_METRICS_CMD_MAX - 1)
53
54#endif /* _LINUX_TCP_METRICS_H */
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h
index 3ca0269dd0b5..932b76392248 100644
--- a/include/linux/ti_wilink_st.h
+++ b/include/linux/ti_wilink_st.h
@@ -281,9 +281,10 @@ struct kim_data_s {
281long st_kim_start(void *); 281long st_kim_start(void *);
282long st_kim_stop(void *); 282long st_kim_stop(void *);
283 283
284void st_kim_recv(void *, const unsigned char *, long count);
285void st_kim_complete(void *); 284void st_kim_complete(void *);
286void kim_st_list_protocols(struct st_data_s *, void *); 285void kim_st_list_protocols(struct st_data_s *, void *);
286void st_kim_recv(void *, const unsigned char *, long);
287
287 288
288/* 289/*
289 * BTS headers 290 * BTS headers
diff --git a/include/linux/time.h b/include/linux/time.h
index c81c5e40fcb5..b51e664c83e7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -107,11 +107,36 @@ static inline struct timespec timespec_sub(struct timespec lhs,
107 return ts_delta; 107 return ts_delta;
108} 108}
109 109
110#define KTIME_MAX ((s64)~((u64)1 << 63))
111#if (BITS_PER_LONG == 64)
112# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC)
113#else
114# define KTIME_SEC_MAX LONG_MAX
115#endif
116
110/* 117/*
111 * Returns true if the timespec is norm, false if denorm: 118 * Returns true if the timespec is norm, false if denorm:
112 */ 119 */
113#define timespec_valid(ts) \ 120static inline bool timespec_valid(const struct timespec *ts)
114 (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) 121{
122 /* Dates before 1970 are bogus */
123 if (ts->tv_sec < 0)
124 return false;
125 /* Can't have more nanoseconds then a second */
126 if ((unsigned long)ts->tv_nsec >= NSEC_PER_SEC)
127 return false;
128 return true;
129}
130
131static inline bool timespec_valid_strict(const struct timespec *ts)
132{
133 if (!timespec_valid(ts))
134 return false;
135 /* Disallow values that could overflow ktime_t */
136 if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
137 return false;
138 return true;
139}
115 140
116extern void read_persistent_clock(struct timespec *ts); 141extern void read_persistent_clock(struct timespec *ts);
117extern void read_boot_clock(struct timespec *ts); 142extern void read_boot_clock(struct timespec *ts);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6abd9138beda..8c5a197e1587 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -49,147 +49,112 @@ extern struct tvec_base boot_tvec_bases;
49#endif 49#endif
50 50
51/* 51/*
52 * Note that all tvec_bases are 2 byte aligned and lower bit of 52 * Note that all tvec_bases are at least 4 byte aligned and lower two bits
53 * base in timer_list is guaranteed to be zero. Use the LSB to 53 * of base in timer_list is guaranteed to be zero. Use them for flags.
54 * indicate whether the timer is deferrable.
55 * 54 *
56 * A deferrable timer will work normally when the system is busy, but 55 * A deferrable timer will work normally when the system is busy, but
57 * will not cause a CPU to come out of idle just to service it; instead, 56 * will not cause a CPU to come out of idle just to service it; instead,
58 * the timer will be serviced when the CPU eventually wakes up with a 57 * the timer will be serviced when the CPU eventually wakes up with a
59 * subsequent non-deferrable timer. 58 * subsequent non-deferrable timer.
59 *
60 * An irqsafe timer is executed with IRQ disabled and it's safe to wait for
61 * the completion of the running instance from IRQ handlers, for example,
62 * by calling del_timer_sync().
63 *
64 * Note: The irq disabled callback execution is a special case for
65 * workqueue locking issues. It's not meant for executing random crap
66 * with interrupts disabled. Abuse is monitored!
60 */ 67 */
61#define TBASE_DEFERRABLE_FLAG (0x1) 68#define TIMER_DEFERRABLE 0x1LU
69#define TIMER_IRQSAFE 0x2LU
62 70
63#define TIMER_INITIALIZER(_function, _expires, _data) { \ 71#define TIMER_FLAG_MASK 0x3LU
72
73#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
64 .entry = { .prev = TIMER_ENTRY_STATIC }, \ 74 .entry = { .prev = TIMER_ENTRY_STATIC }, \
65 .function = (_function), \ 75 .function = (_function), \
66 .expires = (_expires), \ 76 .expires = (_expires), \
67 .data = (_data), \ 77 .data = (_data), \
68 .base = &boot_tvec_bases, \ 78 .base = (void *)((unsigned long)&boot_tvec_bases + (_flags)), \
69 .slack = -1, \ 79 .slack = -1, \
70 __TIMER_LOCKDEP_MAP_INITIALIZER( \ 80 __TIMER_LOCKDEP_MAP_INITIALIZER( \
71 __FILE__ ":" __stringify(__LINE__)) \ 81 __FILE__ ":" __stringify(__LINE__)) \
72 } 82 }
73 83
74#define TBASE_MAKE_DEFERRED(ptr) ((struct tvec_base *) \ 84#define TIMER_INITIALIZER(_function, _expires, _data) \
75 ((unsigned char *)(ptr) + TBASE_DEFERRABLE_FLAG)) 85 __TIMER_INITIALIZER((_function), (_expires), (_data), 0)
76 86
77#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) {\ 87#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) \
78 .entry = { .prev = TIMER_ENTRY_STATIC }, \ 88 __TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
79 .function = (_function), \
80 .expires = (_expires), \
81 .data = (_data), \
82 .base = TBASE_MAKE_DEFERRED(&boot_tvec_bases), \
83 __TIMER_LOCKDEP_MAP_INITIALIZER( \
84 __FILE__ ":" __stringify(__LINE__)) \
85 }
86 89
87#define DEFINE_TIMER(_name, _function, _expires, _data) \ 90#define DEFINE_TIMER(_name, _function, _expires, _data) \
88 struct timer_list _name = \ 91 struct timer_list _name = \
89 TIMER_INITIALIZER(_function, _expires, _data) 92 TIMER_INITIALIZER(_function, _expires, _data)
90 93
91void init_timer_key(struct timer_list *timer, 94void init_timer_key(struct timer_list *timer, unsigned int flags,
92 const char *name, 95 const char *name, struct lock_class_key *key);
93 struct lock_class_key *key); 96
94void init_timer_deferrable_key(struct timer_list *timer, 97#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
95 const char *name, 98extern void init_timer_on_stack_key(struct timer_list *timer,
96 struct lock_class_key *key); 99 unsigned int flags, const char *name,
100 struct lock_class_key *key);
101extern void destroy_timer_on_stack(struct timer_list *timer);
102#else
103static inline void destroy_timer_on_stack(struct timer_list *timer) { }
104static inline void init_timer_on_stack_key(struct timer_list *timer,
105 unsigned int flags, const char *name,
106 struct lock_class_key *key)
107{
108 init_timer_key(timer, flags, name, key);
109}
110#endif
97 111
98#ifdef CONFIG_LOCKDEP 112#ifdef CONFIG_LOCKDEP
99#define init_timer(timer) \ 113#define __init_timer(_timer, _flags) \
100 do { \ 114 do { \
101 static struct lock_class_key __key; \ 115 static struct lock_class_key __key; \
102 init_timer_key((timer), #timer, &__key); \ 116 init_timer_key((_timer), (_flags), #_timer, &__key); \
103 } while (0) 117 } while (0)
104 118
105#define init_timer_deferrable(timer) \ 119#define __init_timer_on_stack(_timer, _flags) \
106 do { \ 120 do { \
107 static struct lock_class_key __key; \ 121 static struct lock_class_key __key; \
108 init_timer_deferrable_key((timer), #timer, &__key); \ 122 init_timer_on_stack_key((_timer), (_flags), #_timer, &__key); \
109 } while (0) 123 } while (0)
124#else
125#define __init_timer(_timer, _flags) \
126 init_timer_key((_timer), (_flags), NULL, NULL)
127#define __init_timer_on_stack(_timer, _flags) \
128 init_timer_on_stack_key((_timer), (_flags), NULL, NULL)
129#endif
110 130
131#define init_timer(timer) \
132 __init_timer((timer), 0)
133#define init_timer_deferrable(timer) \
134 __init_timer((timer), TIMER_DEFERRABLE)
111#define init_timer_on_stack(timer) \ 135#define init_timer_on_stack(timer) \
136 __init_timer_on_stack((timer), 0)
137
138#define __setup_timer(_timer, _fn, _data, _flags) \
112 do { \ 139 do { \
113 static struct lock_class_key __key; \ 140 __init_timer((_timer), (_flags)); \
114 init_timer_on_stack_key((timer), #timer, &__key); \ 141 (_timer)->function = (_fn); \
142 (_timer)->data = (_data); \
115 } while (0) 143 } while (0)
116 144
117#define setup_timer(timer, fn, data) \ 145#define __setup_timer_on_stack(_timer, _fn, _data, _flags) \
118 do { \ 146 do { \
119 static struct lock_class_key __key; \ 147 __init_timer_on_stack((_timer), (_flags)); \
120 setup_timer_key((timer), #timer, &__key, (fn), (data));\ 148 (_timer)->function = (_fn); \
149 (_timer)->data = (_data); \
121 } while (0) 150 } while (0)
122 151
152#define setup_timer(timer, fn, data) \
153 __setup_timer((timer), (fn), (data), 0)
123#define setup_timer_on_stack(timer, fn, data) \ 154#define setup_timer_on_stack(timer, fn, data) \
124 do { \ 155 __setup_timer_on_stack((timer), (fn), (data), 0)
125 static struct lock_class_key __key; \
126 setup_timer_on_stack_key((timer), #timer, &__key, \
127 (fn), (data)); \
128 } while (0)
129#define setup_deferrable_timer_on_stack(timer, fn, data) \ 156#define setup_deferrable_timer_on_stack(timer, fn, data) \
130 do { \ 157 __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE)
131 static struct lock_class_key __key; \
132 setup_deferrable_timer_on_stack_key((timer), #timer, \
133 &__key, (fn), \
134 (data)); \
135 } while (0)
136#else
137#define init_timer(timer)\
138 init_timer_key((timer), NULL, NULL)
139#define init_timer_deferrable(timer)\
140 init_timer_deferrable_key((timer), NULL, NULL)
141#define init_timer_on_stack(timer)\
142 init_timer_on_stack_key((timer), NULL, NULL)
143#define setup_timer(timer, fn, data)\
144 setup_timer_key((timer), NULL, NULL, (fn), (data))
145#define setup_timer_on_stack(timer, fn, data)\
146 setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
147#define setup_deferrable_timer_on_stack(timer, fn, data)\
148 setup_deferrable_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
149#endif
150
151#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
152extern void init_timer_on_stack_key(struct timer_list *timer,
153 const char *name,
154 struct lock_class_key *key);
155extern void destroy_timer_on_stack(struct timer_list *timer);
156#else
157static inline void destroy_timer_on_stack(struct timer_list *timer) { }
158static inline void init_timer_on_stack_key(struct timer_list *timer,
159 const char *name,
160 struct lock_class_key *key)
161{
162 init_timer_key(timer, name, key);
163}
164#endif
165
166static inline void setup_timer_key(struct timer_list * timer,
167 const char *name,
168 struct lock_class_key *key,
169 void (*function)(unsigned long),
170 unsigned long data)
171{
172 timer->function = function;
173 timer->data = data;
174 init_timer_key(timer, name, key);
175}
176
177static inline void setup_timer_on_stack_key(struct timer_list *timer,
178 const char *name,
179 struct lock_class_key *key,
180 void (*function)(unsigned long),
181 unsigned long data)
182{
183 timer->function = function;
184 timer->data = data;
185 init_timer_on_stack_key(timer, name, key);
186}
187
188extern void setup_deferrable_timer_on_stack_key(struct timer_list *timer,
189 const char *name,
190 struct lock_class_key *key,
191 void (*function)(unsigned long),
192 unsigned long data);
193 158
194/** 159/**
195 * timer_pending - is a timer pending? 160 * timer_pending - is a timer pending?
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h
index 5088727478fd..a520fd70a59f 100644
--- a/include/linux/timerqueue.h
+++ b/include/linux/timerqueue.h
@@ -39,7 +39,7 @@ struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head)
39 39
40static inline void timerqueue_init(struct timerqueue_node *node) 40static inline void timerqueue_init(struct timerqueue_node *node)
41{ 41{
42 rb_init_node(&node->node); 42 RB_CLEAR_NODE(&node->node);
43} 43}
44 44
45static inline void timerqueue_init_head(struct timerqueue_head *head) 45static inline void timerqueue_init_head(struct timerqueue_head *head)
diff --git a/include/linux/tipc_config.h b/include/linux/tipc_config.h
index c98928420100..0b1e3f218a36 100644
--- a/include/linux/tipc_config.h
+++ b/include/linux/tipc_config.h
@@ -89,8 +89,8 @@
89 89
90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */ 90#define TIPC_CMD_GET_REMOTE_MNG 0x4003 /* tx none, rx unsigned */
91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */ 91#define TIPC_CMD_GET_MAX_PORTS 0x4004 /* tx none, rx unsigned */
92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* tx none, rx unsigned */ 92#define TIPC_CMD_GET_MAX_PUBL 0x4005 /* obsoleted */
93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* tx none, rx unsigned */ 93#define TIPC_CMD_GET_MAX_SUBSCR 0x4006 /* obsoleted */
94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */ 94#define TIPC_CMD_GET_MAX_ZONES 0x4007 /* obsoleted */
95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */ 95#define TIPC_CMD_GET_MAX_CLUSTERS 0x4008 /* obsoleted */
96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */ 96#define TIPC_CMD_GET_MAX_NODES 0x4009 /* obsoleted */
@@ -115,8 +115,8 @@
115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */ 115#define TIPC_CMD_SET_NODE_ADDR 0x8001 /* tx net_addr, rx none */
116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */ 116#define TIPC_CMD_SET_REMOTE_MNG 0x8003 /* tx unsigned, rx none */
117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */ 117#define TIPC_CMD_SET_MAX_PORTS 0x8004 /* tx unsigned, rx none */
118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* tx unsigned, rx none */ 118#define TIPC_CMD_SET_MAX_PUBL 0x8005 /* obsoleted */
119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* tx unsigned, rx none */ 119#define TIPC_CMD_SET_MAX_SUBSCR 0x8006 /* obsoleted */
120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */ 120#define TIPC_CMD_SET_MAX_ZONES 0x8007 /* obsoleted */
121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */ 121#define TIPC_CMD_SET_MAX_CLUSTERS 0x8008 /* obsoleted */
122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */ 122#define TIPC_CMD_SET_MAX_NODES 0x8009 /* obsoleted */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index fec12d667211..d3cf0d6e7712 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -129,7 +129,6 @@ int arch_update_cpu_topology(void);
129 | 1*SD_BALANCE_FORK \ 129 | 1*SD_BALANCE_FORK \
130 | 0*SD_BALANCE_WAKE \ 130 | 0*SD_BALANCE_WAKE \
131 | 1*SD_WAKE_AFFINE \ 131 | 1*SD_WAKE_AFFINE \
132 | 0*SD_PREFER_LOCAL \
133 | 0*SD_SHARE_CPUPOWER \ 132 | 0*SD_SHARE_CPUPOWER \
134 | 1*SD_SHARE_PKG_RESOURCES \ 133 | 1*SD_SHARE_PKG_RESOURCES \
135 | 0*SD_SERIALIZE \ 134 | 0*SD_SERIALIZE \
@@ -160,7 +159,6 @@ int arch_update_cpu_topology(void);
160 | 1*SD_BALANCE_FORK \ 159 | 1*SD_BALANCE_FORK \
161 | 0*SD_BALANCE_WAKE \ 160 | 0*SD_BALANCE_WAKE \
162 | 1*SD_WAKE_AFFINE \ 161 | 1*SD_WAKE_AFFINE \
163 | 0*SD_PREFER_LOCAL \
164 | 0*SD_SHARE_CPUPOWER \ 162 | 0*SD_SHARE_CPUPOWER \
165 | 0*SD_SHARE_PKG_RESOURCES \ 163 | 0*SD_SHARE_PKG_RESOURCES \
166 | 0*SD_SERIALIZE \ 164 | 0*SD_SERIALIZE \
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index fdc718abf83b..fcb627ff8d3e 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -32,6 +32,7 @@
32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); 32extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf);
33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash); 33extern int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash);
34extern int tpm_send(u32 chip_num, void *cmd, size_t buflen); 34extern int tpm_send(u32 chip_num, void *cmd, size_t buflen);
35extern int tpm_get_random(u32 chip_num, u8 *data, size_t max);
35#else 36#else
36static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) { 37static inline int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) {
37 return -ENODEV; 38 return -ENODEV;
@@ -42,5 +43,8 @@ static inline int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) {
42static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) { 43static inline int tpm_send(u32 chip_num, void *cmd, size_t buflen) {
43 return -ENODEV; 44 return -ENODEV;
44} 45}
46static inline int tpm_get_random(u32 chip_num, u8 *data, size_t max) {
47 return -ENODEV;
48}
45#endif 49#endif
46#endif 50#endif
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 802de56c41e8..2f322c38bd4d 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -136,6 +136,22 @@ static inline void tracepoint_synchronize_unregister(void)
136 postrcu; \ 136 postrcu; \
137 } while (0) 137 } while (0)
138 138
139#ifndef MODULE
140#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args) \
141 static inline void trace_##name##_rcuidle(proto) \
142 { \
143 if (static_key_false(&__tracepoint_##name.key)) \
144 __DO_TRACE(&__tracepoint_##name, \
145 TP_PROTO(data_proto), \
146 TP_ARGS(data_args), \
147 TP_CONDITION(cond), \
148 rcu_idle_exit(), \
149 rcu_idle_enter()); \
150 }
151#else
152#define __DECLARE_TRACE_RCU(name, proto, args, cond, data_proto, data_args)
153#endif
154
139/* 155/*
140 * Make sure the alignment of the structure in the __tracepoints section will 156 * Make sure the alignment of the structure in the __tracepoints section will
141 * not add unwanted padding between the beginning of the section and the 157 * not add unwanted padding between the beginning of the section and the
@@ -151,16 +167,8 @@ static inline void tracepoint_synchronize_unregister(void)
151 TP_ARGS(data_args), \ 167 TP_ARGS(data_args), \
152 TP_CONDITION(cond),,); \ 168 TP_CONDITION(cond),,); \
153 } \ 169 } \
154 static inline void trace_##name##_rcuidle(proto) \ 170 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
155 { \ 171 PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
156 if (static_key_false(&__tracepoint_##name.key)) \
157 __DO_TRACE(&__tracepoint_##name, \
158 TP_PROTO(data_proto), \
159 TP_ARGS(data_args), \
160 TP_CONDITION(cond), \
161 rcu_idle_exit(), \
162 rcu_idle_enter()); \
163 } \
164 static inline int \ 172 static inline int \
165 register_trace_##name(void (*probe)(data_proto), void *data) \ 173 register_trace_##name(void (*probe)(data_proto), void *data) \
166 { \ 174 { \
diff --git a/include/linux/tsacct_kern.h b/include/linux/tsacct_kern.h
index 7e50ac795b0b..44893e5ec8f7 100644
--- a/include/linux/tsacct_kern.h
+++ b/include/linux/tsacct_kern.h
@@ -10,9 +10,13 @@
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11 11
12#ifdef CONFIG_TASKSTATS 12#ifdef CONFIG_TASKSTATS
13extern void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk); 13extern void bacct_add_tsk(struct user_namespace *user_ns,
14 struct pid_namespace *pid_ns,
15 struct taskstats *stats, struct task_struct *tsk);
14#else 16#else
15static inline void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk) 17static inline void bacct_add_tsk(struct user_namespace *user_ns,
18 struct pid_namespace *pid_ns,
19 struct taskstats *stats, struct task_struct *tsk)
16{} 20{}
17#endif /* CONFIG_TASKSTATS */ 21#endif /* CONFIG_TASKSTATS */
18 22
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 9f47ab540f65..4f6c59a5fb79 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -43,6 +43,7 @@
43#include <linux/tty_driver.h> 43#include <linux/tty_driver.h>
44#include <linux/tty_ldisc.h> 44#include <linux/tty_ldisc.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/tty_flags.h>
46 47
47 48
48 49
@@ -103,28 +104,28 @@ struct tty_bufhead {
103#define TTY_PARITY 3 104#define TTY_PARITY 3
104#define TTY_OVERRUN 4 105#define TTY_OVERRUN 4
105 106
106#define INTR_CHAR(tty) ((tty)->termios->c_cc[VINTR]) 107#define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
107#define QUIT_CHAR(tty) ((tty)->termios->c_cc[VQUIT]) 108#define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
108#define ERASE_CHAR(tty) ((tty)->termios->c_cc[VERASE]) 109#define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
109#define KILL_CHAR(tty) ((tty)->termios->c_cc[VKILL]) 110#define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
110#define EOF_CHAR(tty) ((tty)->termios->c_cc[VEOF]) 111#define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
111#define TIME_CHAR(tty) ((tty)->termios->c_cc[VTIME]) 112#define TIME_CHAR(tty) ((tty)->termios.c_cc[VTIME])
112#define MIN_CHAR(tty) ((tty)->termios->c_cc[VMIN]) 113#define MIN_CHAR(tty) ((tty)->termios.c_cc[VMIN])
113#define SWTC_CHAR(tty) ((tty)->termios->c_cc[VSWTC]) 114#define SWTC_CHAR(tty) ((tty)->termios.c_cc[VSWTC])
114#define START_CHAR(tty) ((tty)->termios->c_cc[VSTART]) 115#define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
115#define STOP_CHAR(tty) ((tty)->termios->c_cc[VSTOP]) 116#define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
116#define SUSP_CHAR(tty) ((tty)->termios->c_cc[VSUSP]) 117#define SUSP_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
117#define EOL_CHAR(tty) ((tty)->termios->c_cc[VEOL]) 118#define EOL_CHAR(tty) ((tty)->termios.c_cc[VEOL])
118#define REPRINT_CHAR(tty) ((tty)->termios->c_cc[VREPRINT]) 119#define REPRINT_CHAR(tty) ((tty)->termios.c_cc[VREPRINT])
119#define DISCARD_CHAR(tty) ((tty)->termios->c_cc[VDISCARD]) 120#define DISCARD_CHAR(tty) ((tty)->termios.c_cc[VDISCARD])
120#define WERASE_CHAR(tty) ((tty)->termios->c_cc[VWERASE]) 121#define WERASE_CHAR(tty) ((tty)->termios.c_cc[VWERASE])
121#define LNEXT_CHAR(tty) ((tty)->termios->c_cc[VLNEXT]) 122#define LNEXT_CHAR(tty) ((tty)->termios.c_cc[VLNEXT])
122#define EOL2_CHAR(tty) ((tty)->termios->c_cc[VEOL2]) 123#define EOL2_CHAR(tty) ((tty)->termios.c_cc[VEOL2])
123 124
124#define _I_FLAG(tty, f) ((tty)->termios->c_iflag & (f)) 125#define _I_FLAG(tty, f) ((tty)->termios.c_iflag & (f))
125#define _O_FLAG(tty, f) ((tty)->termios->c_oflag & (f)) 126#define _O_FLAG(tty, f) ((tty)->termios.c_oflag & (f))
126#define _C_FLAG(tty, f) ((tty)->termios->c_cflag & (f)) 127#define _C_FLAG(tty, f) ((tty)->termios.c_cflag & (f))
127#define _L_FLAG(tty, f) ((tty)->termios->c_lflag & (f)) 128#define _L_FLAG(tty, f) ((tty)->termios.c_lflag & (f))
128 129
129#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK) 130#define I_IGNBRK(tty) _I_FLAG((tty), IGNBRK)
130#define I_BRKINT(tty) _I_FLAG((tty), BRKINT) 131#define I_BRKINT(tty) _I_FLAG((tty), BRKINT)
@@ -268,10 +269,11 @@ struct tty_struct {
268 struct mutex ldisc_mutex; 269 struct mutex ldisc_mutex;
269 struct tty_ldisc *ldisc; 270 struct tty_ldisc *ldisc;
270 271
272 struct mutex legacy_mutex;
271 struct mutex termios_mutex; 273 struct mutex termios_mutex;
272 spinlock_t ctrl_lock; 274 spinlock_t ctrl_lock;
273 /* Termios values are protected by the termios mutex */ 275 /* Termios values are protected by the termios mutex */
274 struct ktermios *termios, *termios_locked; 276 struct ktermios termios, termios_locked;
275 struct termiox *termiox; /* May be NULL for unsupported */ 277 struct termiox *termiox; /* May be NULL for unsupported */
276 char name[64]; 278 char name[64];
277 struct pid *pgrp; /* Protected by ctrl lock */ 279 struct pid *pgrp; /* Protected by ctrl lock */
@@ -410,6 +412,10 @@ extern int tty_register_driver(struct tty_driver *driver);
410extern int tty_unregister_driver(struct tty_driver *driver); 412extern int tty_unregister_driver(struct tty_driver *driver);
411extern struct device *tty_register_device(struct tty_driver *driver, 413extern struct device *tty_register_device(struct tty_driver *driver,
412 unsigned index, struct device *dev); 414 unsigned index, struct device *dev);
415extern struct device *tty_register_device_attr(struct tty_driver *driver,
416 unsigned index, struct device *device,
417 void *drvdata,
418 const struct attribute_group **attr_grp);
413extern void tty_unregister_device(struct tty_driver *driver, unsigned index); 419extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
414extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp, 420extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
415 int buflen); 421 int buflen);
@@ -423,7 +429,6 @@ extern void tty_unthrottle(struct tty_struct *tty);
423extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws); 429extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
424extern void tty_driver_remove_tty(struct tty_driver *driver, 430extern void tty_driver_remove_tty(struct tty_driver *driver,
425 struct tty_struct *tty); 431 struct tty_struct *tty);
426extern void tty_shutdown(struct tty_struct *tty);
427extern void tty_free_termios(struct tty_struct *tty); 432extern void tty_free_termios(struct tty_struct *tty);
428extern int is_current_pgrp_orphaned(void); 433extern int is_current_pgrp_orphaned(void);
429extern struct pid *tty_get_pgrp(struct tty_struct *tty); 434extern struct pid *tty_get_pgrp(struct tty_struct *tty);
@@ -497,6 +502,15 @@ extern int tty_write_lock(struct tty_struct *tty, int ndelay);
497#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) 502#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock))
498 503
499extern void tty_port_init(struct tty_port *port); 504extern void tty_port_init(struct tty_port *port);
505extern void tty_port_link_device(struct tty_port *port,
506 struct tty_driver *driver, unsigned index);
507extern struct device *tty_port_register_device(struct tty_port *port,
508 struct tty_driver *driver, unsigned index,
509 struct device *device);
510extern struct device *tty_port_register_device_attr(struct tty_port *port,
511 struct tty_driver *driver, unsigned index,
512 struct device *device, void *drvdata,
513 const struct attribute_group **attr_grp);
500extern int tty_port_alloc_xmit_buf(struct tty_port *port); 514extern int tty_port_alloc_xmit_buf(struct tty_port *port);
501extern void tty_port_free_xmit_buf(struct tty_port *port); 515extern void tty_port_free_xmit_buf(struct tty_port *port);
502extern void tty_port_put(struct tty_port *port); 516extern void tty_port_put(struct tty_port *port);
@@ -508,6 +522,12 @@ static inline struct tty_port *tty_port_get(struct tty_port *port)
508 return port; 522 return port;
509} 523}
510 524
525/* If the cts flow control is enabled, return true. */
526static inline bool tty_port_cts_enabled(struct tty_port *port)
527{
528 return port->flags & ASYNC_CTS_FLOW;
529}
530
511extern struct tty_struct *tty_port_tty_get(struct tty_port *port); 531extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
512extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); 532extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
513extern int tty_port_carrier_raised(struct tty_port *port); 533extern int tty_port_carrier_raised(struct tty_port *port);
@@ -521,6 +541,8 @@ extern int tty_port_close_start(struct tty_port *port,
521extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty); 541extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
522extern void tty_port_close(struct tty_port *port, 542extern void tty_port_close(struct tty_port *port,
523 struct tty_struct *tty, struct file *filp); 543 struct tty_struct *tty, struct file *filp);
544extern int tty_port_install(struct tty_port *port, struct tty_driver *driver,
545 struct tty_struct *tty);
524extern int tty_port_open(struct tty_port *port, 546extern int tty_port_open(struct tty_port *port,
525 struct tty_struct *tty, struct file *filp); 547 struct tty_struct *tty, struct file *filp);
526static inline int tty_port_users(struct tty_port *port) 548static inline int tty_port_users(struct tty_port *port)
@@ -553,7 +575,7 @@ extern void tty_audit_fork(struct signal_struct *sig);
553extern void tty_audit_tiocsti(struct tty_struct *tty, char ch); 575extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
554extern void tty_audit_push(struct tty_struct *tty); 576extern void tty_audit_push(struct tty_struct *tty);
555extern int tty_audit_push_task(struct task_struct *tsk, 577extern int tty_audit_push_task(struct task_struct *tsk,
556 uid_t loginuid, u32 sessionid); 578 kuid_t loginuid, u32 sessionid);
557#else 579#else
558static inline void tty_audit_add_data(struct tty_struct *tty, 580static inline void tty_audit_add_data(struct tty_struct *tty,
559 unsigned char *data, size_t size) 581 unsigned char *data, size_t size)
@@ -572,7 +594,7 @@ static inline void tty_audit_push(struct tty_struct *tty)
572{ 594{
573} 595}
574static inline int tty_audit_push_task(struct task_struct *tsk, 596static inline int tty_audit_push_task(struct task_struct *tsk,
575 uid_t loginuid, u32 sessionid) 597 kuid_t loginuid, u32 sessionid)
576{ 598{
577 return 0; 599 return 0;
578} 600}
@@ -605,8 +627,12 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
605 627
606/* tty_mutex.c */ 628/* tty_mutex.c */
607/* functions for preparation of BKL removal */ 629/* functions for preparation of BKL removal */
608extern void __lockfunc tty_lock(void) __acquires(tty_lock); 630extern void __lockfunc tty_lock(struct tty_struct *tty);
609extern void __lockfunc tty_unlock(void) __releases(tty_lock); 631extern void __lockfunc tty_unlock(struct tty_struct *tty);
632extern void __lockfunc tty_lock_pair(struct tty_struct *tty,
633 struct tty_struct *tty2);
634extern void __lockfunc tty_unlock_pair(struct tty_struct *tty,
635 struct tty_struct *tty2);
610 636
611/* 637/*
612 * this shall be called only from where BTM is held (like close) 638 * this shall be called only from where BTM is held (like close)
@@ -621,9 +647,9 @@ extern void __lockfunc tty_unlock(void) __releases(tty_lock);
621static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, 647static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
622 long timeout) 648 long timeout)
623{ 649{
624 tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ 650 tty_unlock(tty); /* tty->ops->close holds the BTM, drop it while waiting */
625 tty_wait_until_sent(tty, timeout); 651 tty_wait_until_sent(tty, timeout);
626 tty_lock(); 652 tty_lock(tty);
627} 653}
628 654
629/* 655/*
@@ -638,16 +664,16 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
638 * 664 *
639 * Do not use in new code. 665 * Do not use in new code.
640 */ 666 */
641#define wait_event_interruptible_tty(wq, condition) \ 667#define wait_event_interruptible_tty(tty, wq, condition) \
642({ \ 668({ \
643 int __ret = 0; \ 669 int __ret = 0; \
644 if (!(condition)) { \ 670 if (!(condition)) { \
645 __wait_event_interruptible_tty(wq, condition, __ret); \ 671 __wait_event_interruptible_tty(tty, wq, condition, __ret); \
646 } \ 672 } \
647 __ret; \ 673 __ret; \
648}) 674})
649 675
650#define __wait_event_interruptible_tty(wq, condition, ret) \ 676#define __wait_event_interruptible_tty(tty, wq, condition, ret) \
651do { \ 677do { \
652 DEFINE_WAIT(__wait); \ 678 DEFINE_WAIT(__wait); \
653 \ 679 \
@@ -656,9 +682,9 @@ do { \
656 if (condition) \ 682 if (condition) \
657 break; \ 683 break; \
658 if (!signal_pending(current)) { \ 684 if (!signal_pending(current)) { \
659 tty_unlock(); \ 685 tty_unlock(tty); \
660 schedule(); \ 686 schedule(); \
661 tty_lock(); \ 687 tty_lock(tty); \
662 continue; \ 688 continue; \
663 } \ 689 } \
664 ret = -ERESTARTSYS; \ 690 ret = -ERESTARTSYS; \
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 6e6dbb7447b6..dd976cfb6131 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -45,14 +45,9 @@
45 * 45 *
46 * void (*shutdown)(struct tty_struct * tty); 46 * void (*shutdown)(struct tty_struct * tty);
47 * 47 *
48 * This routine is called synchronously when a particular tty device 48 * This routine is called under the tty lock when a particular tty device
49 * is closed for the last time freeing up the resources. 49 * is closed for the last time. It executes before the tty resources
50 * Note that tty_shutdown() is not called if ops->shutdown is defined. 50 * are freed so may execute while another function holds a tty kref.
51 * This means one is responsible to take care of calling ops->remove (e.g.
52 * via tty_driver_remove_tty) and releasing tty->termios.
53 * Note that this hook may be called from *all* the contexts where one
54 * uses tty refcounting (e.g. tty_port_tty_get).
55 *
56 * 51 *
57 * void (*cleanup)(struct tty_struct * tty); 52 * void (*cleanup)(struct tty_struct * tty);
58 * 53 *
@@ -294,18 +289,18 @@ struct tty_operations {
294struct tty_driver { 289struct tty_driver {
295 int magic; /* magic number for this structure */ 290 int magic; /* magic number for this structure */
296 struct kref kref; /* Reference management */ 291 struct kref kref; /* Reference management */
297 struct cdev cdev; 292 struct cdev *cdevs;
298 struct module *owner; 293 struct module *owner;
299 const char *driver_name; 294 const char *driver_name;
300 const char *name; 295 const char *name;
301 int name_base; /* offset of printed name */ 296 int name_base; /* offset of printed name */
302 int major; /* major device number */ 297 int major; /* major device number */
303 int minor_start; /* start of minor device number */ 298 int minor_start; /* start of minor device number */
304 int num; /* number of devices allocated */ 299 unsigned int num; /* number of devices allocated */
305 short type; /* type of tty driver */ 300 short type; /* type of tty driver */
306 short subtype; /* subtype of tty driver */ 301 short subtype; /* subtype of tty driver */
307 struct ktermios init_termios; /* Initial termios */ 302 struct ktermios init_termios; /* Initial termios */
308 int flags; /* tty driver flags */ 303 unsigned long flags; /* tty driver flags */
309 struct proc_dir_entry *proc_entry; /* /proc fs entry */ 304 struct proc_dir_entry *proc_entry; /* /proc fs entry */
310 struct tty_driver *other; /* only used for the PTY driver */ 305 struct tty_driver *other; /* only used for the PTY driver */
311 306
@@ -313,6 +308,7 @@ struct tty_driver {
313 * Pointer to the tty data structures 308 * Pointer to the tty data structures
314 */ 309 */
315 struct tty_struct **ttys; 310 struct tty_struct **ttys;
311 struct tty_port **ports;
316 struct ktermios **termios; 312 struct ktermios **termios;
317 void *driver_state; 313 void *driver_state;
318 314
@@ -326,7 +322,8 @@ struct tty_driver {
326 322
327extern struct list_head tty_drivers; 323extern struct list_head tty_drivers;
328 324
329extern struct tty_driver *__alloc_tty_driver(int lines, struct module *owner); 325extern struct tty_driver *__tty_alloc_driver(unsigned int lines,
326 struct module *owner, unsigned long flags);
330extern void put_tty_driver(struct tty_driver *driver); 327extern void put_tty_driver(struct tty_driver *driver);
331extern void tty_set_operations(struct tty_driver *driver, 328extern void tty_set_operations(struct tty_driver *driver,
332 const struct tty_operations *op); 329 const struct tty_operations *op);
@@ -334,7 +331,21 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
334 331
335extern void tty_driver_kref_put(struct tty_driver *driver); 332extern void tty_driver_kref_put(struct tty_driver *driver);
336 333
337#define alloc_tty_driver(lines) __alloc_tty_driver(lines, THIS_MODULE) 334/* Use TTY_DRIVER_* flags below */
335#define tty_alloc_driver(lines, flags) \
336 __tty_alloc_driver(lines, THIS_MODULE, flags)
337
338/*
339 * DEPRECATED Do not use this in new code, use tty_alloc_driver instead.
340 * (And change the return value checks.)
341 */
342static inline struct tty_driver *alloc_tty_driver(unsigned int lines)
343{
344 struct tty_driver *ret = tty_alloc_driver(lines, 0);
345 if (IS_ERR(ret))
346 return NULL;
347 return ret;
348}
338 349
339static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d) 350static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
340{ 351{
@@ -380,6 +391,14 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
380 * the requested timeout to the caller instead of using a simple 391 * the requested timeout to the caller instead of using a simple
381 * on/off interface. 392 * on/off interface.
382 * 393 *
394 * TTY_DRIVER_DYNAMIC_ALLOC -- do not allocate structures which are
395 * needed per line for this driver as it would waste memory.
396 * The driver will take care.
397 *
398 * TTY_DRIVER_UNNUMBERED_NODE -- do not create numbered /dev nodes. In
399 * other words create /dev/ttyprintk and not /dev/ttyprintk0.
400 * Applicable only when a driver for a single tty device is
401 * being allocated.
383 */ 402 */
384#define TTY_DRIVER_INSTALLED 0x0001 403#define TTY_DRIVER_INSTALLED 0x0001
385#define TTY_DRIVER_RESET_TERMIOS 0x0002 404#define TTY_DRIVER_RESET_TERMIOS 0x0002
@@ -387,6 +406,8 @@ static inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
387#define TTY_DRIVER_DYNAMIC_DEV 0x0008 406#define TTY_DRIVER_DYNAMIC_DEV 0x0008
388#define TTY_DRIVER_DEVPTS_MEM 0x0010 407#define TTY_DRIVER_DEVPTS_MEM 0x0010
389#define TTY_DRIVER_HARDWARE_BREAK 0x0020 408#define TTY_DRIVER_HARDWARE_BREAK 0x0020
409#define TTY_DRIVER_DYNAMIC_ALLOC 0x0040
410#define TTY_DRIVER_UNNUMBERED_NODE 0x0080
390 411
391/* tty driver types */ 412/* tty driver types */
392#define TTY_DRIVER_TYPE_SYSTEM 0x0001 413#define TTY_DRIVER_TYPE_SYSTEM 0x0001
diff --git a/include/linux/tty_flags.h b/include/linux/tty_flags.h
new file mode 100644
index 000000000000..eefcb483a2c0
--- /dev/null
+++ b/include/linux/tty_flags.h
@@ -0,0 +1,78 @@
1#ifndef _LINUX_TTY_FLAGS_H
2#define _LINUX_TTY_FLAGS_H
3
4/*
5 * Definitions for async_struct (and serial_struct) flags field also
6 * shared by the tty_port flags structures.
7 *
8 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
9 */
10#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
11 * on the callout port */
12#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
13#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
14#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */
15#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
16#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
17#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
18#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
19 * autoconfiguration */
20#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */
21#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */
22#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */
23#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
24#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
25#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
26#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
27 * checks. Note: can be dangerous! */
28#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
29#define ASYNCB_LAST_USER 15
30
31/* Internal flags used only by kernel */
32#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
33#define ASYNCB_SUSPENDED 30 /* Serial port is suspended */
34#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
35#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
36#define ASYNCB_CLOSING 27 /* Serial port is closing */
37#define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */
38#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
39#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
40#define ASYNCB_CONS_FLOW 23 /* flow control for console */
41#define ASYNCB_FIRST_KERNEL 22
42
43#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
44#define ASYNC_SUSPENDED (1U << ASYNCB_SUSPENDED)
45#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
46#define ASYNC_SAK (1U << ASYNCB_SAK)
47#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
48#define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI)
49#define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI)
50#define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST)
51#define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ)
52#define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT)
53#define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT)
54#define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP)
55#define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD)
56#define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI)
57#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
58#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
59#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
60
61#define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1)
62#define ASYNC_USR_MASK (ASYNC_SPD_MASK|ASYNC_CALLOUT_NOHUP| \
63 ASYNC_LOW_LATENCY)
64#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
65#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
66#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
67
68#define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
69#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
70#define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF)
71#define ASYNC_CLOSING (1U << ASYNCB_CLOSING)
72#define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW)
73#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
74#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
75#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
76#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
77
78#endif
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 2aa2881b0df9..c454bbe39ee7 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -32,6 +32,7 @@
32 * - first public version 32 * - first public version
33 */ 33 */
34 34
35#include <linux/types.h>
35#include <linux/input.h> 36#include <linux/input.h>
36 37
37#define UINPUT_VERSION 3 38#define UINPUT_VERSION 3
@@ -44,14 +45,14 @@
44enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED }; 45enum uinput_state { UIST_NEW_DEVICE, UIST_SETUP_COMPLETE, UIST_CREATED };
45 46
46struct uinput_request { 47struct uinput_request {
47 int id; 48 unsigned int id;
48 int code; /* UI_FF_UPLOAD, UI_FF_ERASE */ 49 unsigned int code; /* UI_FF_UPLOAD, UI_FF_ERASE */
49 50
50 int retval; 51 int retval;
51 struct completion done; 52 struct completion done;
52 53
53 union { 54 union {
54 int effect_id; 55 unsigned int effect_id;
55 struct { 56 struct {
56 struct ff_effect *effect; 57 struct ff_effect *effect;
57 struct ff_effect *old; 58 struct ff_effect *old;
@@ -77,16 +78,16 @@ struct uinput_device {
77#endif /* __KERNEL__ */ 78#endif /* __KERNEL__ */
78 79
79struct uinput_ff_upload { 80struct uinput_ff_upload {
80 int request_id; 81 __u32 request_id;
81 int retval; 82 __s32 retval;
82 struct ff_effect effect; 83 struct ff_effect effect;
83 struct ff_effect old; 84 struct ff_effect old;
84}; 85};
85 86
86struct uinput_ff_erase { 87struct uinput_ff_erase {
87 int request_id; 88 __u32 request_id;
88 int retval; 89 __s32 retval;
89 int effect_id; 90 __u32 effect_id;
90}; 91};
91 92
92/* ioctl */ 93/* ioctl */
@@ -166,11 +167,11 @@ struct uinput_ff_erase {
166struct uinput_user_dev { 167struct uinput_user_dev {
167 char name[UINPUT_MAX_NAME_SIZE]; 168 char name[UINPUT_MAX_NAME_SIZE];
168 struct input_id id; 169 struct input_id id;
169 int ff_effects_max; 170 __u32 ff_effects_max;
170 int absmax[ABS_CNT]; 171 __s32 absmax[ABS_CNT];
171 int absmin[ABS_CNT]; 172 __s32 absmin[ABS_CNT];
172 int absfuzz[ABS_CNT]; 173 __s32 absfuzz[ABS_CNT];
173 int absflat[ABS_CNT]; 174 __s32 absflat[ABS_CNT];
174}; 175};
175#endif /* __UINPUT_H_ */ 176#endif /* __UINPUT_H_ */
176 177
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index efe4b3308c74..e6f0331e3d45 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -99,25 +99,27 @@ struct xol_area {
99 99
100struct uprobes_state { 100struct uprobes_state {
101 struct xol_area *xol_area; 101 struct xol_area *xol_area;
102 atomic_t count;
103}; 102};
103
104extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 104extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
105extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr, bool verify); 105extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
106extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 106extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 107extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
108extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 108extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
109extern int uprobe_mmap(struct vm_area_struct *vma); 109extern int uprobe_mmap(struct vm_area_struct *vma);
110extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end); 110extern void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end);
111extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
111extern void uprobe_free_utask(struct task_struct *t); 112extern void uprobe_free_utask(struct task_struct *t);
112extern void uprobe_copy_process(struct task_struct *t); 113extern void uprobe_copy_process(struct task_struct *t);
113extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 114extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
115extern void __weak arch_uprobe_enable_step(struct arch_uprobe *arch);
116extern void __weak arch_uprobe_disable_step(struct arch_uprobe *arch);
114extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 117extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
115extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 118extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
116extern void uprobe_notify_resume(struct pt_regs *regs); 119extern void uprobe_notify_resume(struct pt_regs *regs);
117extern bool uprobe_deny_signal(void); 120extern bool uprobe_deny_signal(void);
118extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs); 121extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
119extern void uprobe_clear_state(struct mm_struct *mm); 122extern void uprobe_clear_state(struct mm_struct *mm);
120extern void uprobe_reset_state(struct mm_struct *mm);
121#else /* !CONFIG_UPROBES */ 123#else /* !CONFIG_UPROBES */
122struct uprobes_state { 124struct uprobes_state {
123}; 125};
@@ -138,6 +140,10 @@ static inline void
138uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end) 140uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned long end)
139{ 141{
140} 142}
143static inline void
144uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
145{
146}
141static inline void uprobe_notify_resume(struct pt_regs *regs) 147static inline void uprobe_notify_resume(struct pt_regs *regs)
142{ 148{
143} 149}
@@ -158,8 +164,5 @@ static inline void uprobe_copy_process(struct task_struct *t)
158static inline void uprobe_clear_state(struct mm_struct *mm) 164static inline void uprobe_clear_state(struct mm_struct *mm)
159{ 165{
160} 166}
161static inline void uprobe_reset_state(struct mm_struct *mm)
162{
163}
164#endif /* !CONFIG_UPROBES */ 167#endif /* !CONFIG_UPROBES */
165#endif /* _LINUX_UPROBES_H */ 168#endif /* _LINUX_UPROBES_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 30d1ae38eab1..07915a32fb9d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -384,6 +384,13 @@ enum usb_device_removable {
384 USB_DEVICE_FIXED, 384 USB_DEVICE_FIXED,
385}; 385};
386 386
387enum usb_port_connect_type {
388 USB_PORT_CONNECT_TYPE_UNKNOWN = 0,
389 USB_PORT_CONNECT_TYPE_HOT_PLUG,
390 USB_PORT_CONNECT_TYPE_HARD_WIRED,
391 USB_PORT_NOT_USED,
392};
393
387/* 394/*
388 * USB 3.0 Link Power Management (LPM) parameters. 395 * USB 3.0 Link Power Management (LPM) parameters.
389 * 396 *
@@ -469,7 +476,6 @@ struct usb3_lpm_parameters {
469 * access from userspace 476 * access from userspace
470 * @usbfs_dentry: usbfs dentry entry for the device 477 * @usbfs_dentry: usbfs dentry entry for the device
471 * @maxchild: number of ports if hub 478 * @maxchild: number of ports if hub
472 * @children: child devices - USB devices that are attached to this hub
473 * @quirks: quirks of the whole device 479 * @quirks: quirks of the whole device
474 * @urbnum: number of URBs submitted for the whole device 480 * @urbnum: number of URBs submitted for the whole device
475 * @active_duration: total time device is not suspended 481 * @active_duration: total time device is not suspended
@@ -543,7 +549,6 @@ struct usb_device {
543 struct list_head filelist; 549 struct list_head filelist;
544 550
545 int maxchild; 551 int maxchild;
546 struct usb_device **children;
547 552
548 u32 quirks; 553 u32 quirks;
549 atomic_t urbnum; 554 atomic_t urbnum;
@@ -572,6 +577,19 @@ static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
572 577
573extern struct usb_device *usb_get_dev(struct usb_device *dev); 578extern struct usb_device *usb_get_dev(struct usb_device *dev);
574extern void usb_put_dev(struct usb_device *dev); 579extern void usb_put_dev(struct usb_device *dev);
580extern struct usb_device *usb_hub_find_child(struct usb_device *hdev,
581 int port1);
582
583/**
584 * usb_hub_for_each_child - iterate over all child devices on the hub
585 * @hdev: USB device belonging to the usb hub
586 * @port1: portnum associated with child device
587 * @child: child device pointer
588 */
589#define usb_hub_for_each_child(hdev, port1, child) \
590 for (port1 = 1, child = usb_hub_find_child(hdev, port1); \
591 port1 <= hdev->maxchild; \
592 child = usb_hub_find_child(hdev, ++port1))
575 593
576/* USB device locking */ 594/* USB device locking */
577#define usb_lock_device(udev) device_lock(&(udev)->dev) 595#define usb_lock_device(udev) device_lock(&(udev)->dev)
@@ -584,6 +602,16 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
584extern int usb_reset_device(struct usb_device *dev); 602extern int usb_reset_device(struct usb_device *dev);
585extern void usb_queue_reset_device(struct usb_interface *dev); 603extern void usb_queue_reset_device(struct usb_interface *dev);
586 604
605#ifdef CONFIG_ACPI
606extern int usb_acpi_set_power_state(struct usb_device *hdev, int index,
607 bool enable);
608extern bool usb_acpi_power_manageable(struct usb_device *hdev, int index);
609#else
610static inline int usb_acpi_set_power_state(struct usb_device *hdev, int index,
611 bool enable) { return 0; }
612static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
613 { return true; }
614#endif
587 615
588/* USB autosuspend and autoresume */ 616/* USB autosuspend and autoresume */
589#ifdef CONFIG_USB_SUSPEND 617#ifdef CONFIG_USB_SUSPEND
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index b6c2863b2c94..7692dc69ccf7 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -236,8 +236,8 @@ struct usb_hub_descriptor {
236 236
237 struct { 237 struct {
238 __u8 bHubHdrDecLat; 238 __u8 bHubHdrDecLat;
239 __u16 wHubDelay; 239 __le16 wHubDelay;
240 __u16 DeviceRemovable; 240 __le16 DeviceRemovable;
241 } __attribute__ ((packed)) ss; 241 } __attribute__ ((packed)) ss;
242 } u; 242 } u;
243} __attribute__ ((packed)); 243} __attribute__ ((packed));
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 9d8c3b634493..f8dda0621800 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -34,6 +34,8 @@
34 * the composite model the host can use both functions at the same time. 34 * the composite model the host can use both functions at the same time.
35 */ 35 */
36 36
37#include <linux/bcd.h>
38#include <linux/version.h>
37#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
39 41
@@ -46,6 +48,9 @@
46 */ 48 */
47#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ 49#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
48 50
51/* big enough to hold our biggest descriptor */
52#define USB_COMP_EP0_BUFSIZ 1024
53
49struct usb_configuration; 54struct usb_configuration;
50 55
51/** 56/**
@@ -245,24 +250,31 @@ int usb_add_config(struct usb_composite_dev *,
245void usb_remove_config(struct usb_composite_dev *, 250void usb_remove_config(struct usb_composite_dev *,
246 struct usb_configuration *); 251 struct usb_configuration *);
247 252
253/* predefined index for usb_composite_driver */
254enum {
255 USB_GADGET_MANUFACTURER_IDX = 0,
256 USB_GADGET_PRODUCT_IDX,
257 USB_GADGET_SERIAL_IDX,
258 USB_GADGET_FIRST_AVAIL_IDX,
259};
260
248/** 261/**
249 * struct usb_composite_driver - groups configurations into a gadget 262 * struct usb_composite_driver - groups configurations into a gadget
250 * @name: For diagnostics, identifies the driver. 263 * @name: For diagnostics, identifies the driver.
251 * @iProduct: Used as iProduct override if @dev->iProduct is not set.
252 * If NULL value of @name is taken.
253 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
254 * not set. If NULL a default "<system> <release> with <udc>" value
255 * will be used.
256 * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is
257 * not set.
258 * @dev: Template descriptor for the device, including default device 264 * @dev: Template descriptor for the device, including default device
259 * identifiers. 265 * identifiers.
260 * @strings: tables of strings, keyed by identifiers assigned during bind() 266 * @strings: tables of strings, keyed by identifiers assigned during @bind
261 * and language IDs provided in control requests 267 * and language IDs provided in control requests. Note: The first entries
268 * are predefined. The first entry that may be used is
269 * USB_GADGET_FIRST_AVAIL_IDX
262 * @max_speed: Highest speed the driver supports. 270 * @max_speed: Highest speed the driver supports.
263 * @needs_serial: set to 1 if the gadget needs userspace to provide 271 * @needs_serial: set to 1 if the gadget needs userspace to provide
264 * a serial number. If one is not provided, warning will be printed. 272 * a serial number. If one is not provided, warning will be printed.
265 * @unbind: Reverses bind; called as a side effect of unregistering 273 * @bind: (REQUIRED) Used to allocate resources that are shared across the
274 * whole device, such as string IDs, and add its configurations using
275 * @usb_add_config(). This may fail by returning a negative errno
276 * value; it should return zero on successful initialization.
277 * @unbind: Reverses @bind; called as a side effect of unregistering
266 * this driver. 278 * this driver.
267 * @disconnect: optional driver disconnect method 279 * @disconnect: optional driver disconnect method
268 * @suspend: Notifies when the host stops sending USB traffic, 280 * @suspend: Notifies when the host stops sending USB traffic,
@@ -271,9 +283,9 @@ void usb_remove_config(struct usb_composite_dev *,
271 * before function notifications 283 * before function notifications
272 * 284 *
273 * Devices default to reporting self powered operation. Devices which rely 285 * Devices default to reporting self powered operation. Devices which rely
274 * on bus powered operation should report this in their @bind() method. 286 * on bus powered operation should report this in their @bind method.
275 * 287 *
276 * Before returning from bind, various fields in the template descriptor 288 * Before returning from @bind, various fields in the template descriptor
277 * may be overridden. These include the idVendor/idProduct/bcdDevice values 289 * may be overridden. These include the idVendor/idProduct/bcdDevice values
278 * normally to bind the appropriate host side driver, and the three strings 290 * normally to bind the appropriate host side driver, and the three strings
279 * (iManufacturer, iProduct, iSerialNumber) normally used to provide user 291 * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
@@ -283,14 +295,12 @@ void usb_remove_config(struct usb_composite_dev *,
283 */ 295 */
284struct usb_composite_driver { 296struct usb_composite_driver {
285 const char *name; 297 const char *name;
286 const char *iProduct;
287 const char *iManufacturer;
288 const char *iSerialNumber;
289 const struct usb_device_descriptor *dev; 298 const struct usb_device_descriptor *dev;
290 struct usb_gadget_strings **strings; 299 struct usb_gadget_strings **strings;
291 enum usb_device_speed max_speed; 300 enum usb_device_speed max_speed;
292 unsigned needs_serial:1; 301 unsigned needs_serial:1;
293 302
303 int (*bind)(struct usb_composite_dev *cdev);
294 int (*unbind)(struct usb_composite_dev *); 304 int (*unbind)(struct usb_composite_dev *);
295 305
296 void (*disconnect)(struct usb_composite_dev *); 306 void (*disconnect)(struct usb_composite_dev *);
@@ -298,10 +308,10 @@ struct usb_composite_driver {
298 /* global suspend hooks */ 308 /* global suspend hooks */
299 void (*suspend)(struct usb_composite_dev *); 309 void (*suspend)(struct usb_composite_dev *);
300 void (*resume)(struct usb_composite_dev *); 310 void (*resume)(struct usb_composite_dev *);
311 struct usb_gadget_driver gadget_driver;
301}; 312};
302 313
303extern int usb_composite_probe(struct usb_composite_driver *driver, 314extern int usb_composite_probe(struct usb_composite_driver *driver);
304 int (*bind)(struct usb_composite_dev *cdev));
305extern void usb_composite_unregister(struct usb_composite_driver *driver); 315extern void usb_composite_unregister(struct usb_composite_driver *driver);
306extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); 316extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
307 317
@@ -310,7 +320,6 @@ extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
310 * struct usb_composite_device - represents one composite usb gadget 320 * struct usb_composite_device - represents one composite usb gadget
311 * @gadget: read-only, abstracts the gadget's usb peripheral controller 321 * @gadget: read-only, abstracts the gadget's usb peripheral controller
312 * @req: used for control responses; buffer is pre-allocated 322 * @req: used for control responses; buffer is pre-allocated
313 * @bufsiz: size of buffer pre-allocated in @req
314 * @config: the currently active configuration 323 * @config: the currently active configuration
315 * 324 *
316 * One of these devices is allocated and initialized before the 325 * One of these devices is allocated and initialized before the
@@ -341,7 +350,6 @@ extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
341struct usb_composite_dev { 350struct usb_composite_dev {
342 struct usb_gadget *gadget; 351 struct usb_gadget *gadget;
343 struct usb_request *req; 352 struct usb_request *req;
344 unsigned bufsiz;
345 353
346 struct usb_configuration *config; 354 struct usb_configuration *config;
347 355
@@ -352,9 +360,7 @@ struct usb_composite_dev {
352 struct list_head configs; 360 struct list_head configs;
353 struct usb_composite_driver *driver; 361 struct usb_composite_driver *driver;
354 u8 next_string_id; 362 u8 next_string_id;
355 u8 manufacturer_override; 363 char *def_manufacturer;
356 u8 product_override;
357 u8 serial_override;
358 364
359 /* the gadget driver won't enable the data pullup 365 /* the gadget driver won't enable the data pullup
360 * while the deactivation count is nonzero. 366 * while the deactivation count is nonzero.
@@ -375,6 +381,53 @@ extern int usb_string_ids_tab(struct usb_composite_dev *c,
375 struct usb_string *str); 381 struct usb_string *str);
376extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); 382extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
377 383
384/*
385 * Some systems will need runtime overrides for the product identifiers
386 * published in the device descriptor, either numbers or strings or both.
387 * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
388 */
389struct usb_composite_overwrite {
390 u16 idVendor;
391 u16 idProduct;
392 u16 bcdDevice;
393 char *serial_number;
394 char *manufacturer;
395 char *product;
396};
397#define USB_GADGET_COMPOSITE_OPTIONS() \
398 static struct usb_composite_overwrite coverwrite; \
399 \
400 module_param_named(idVendor, coverwrite.idVendor, ushort, S_IRUGO); \
401 MODULE_PARM_DESC(idVendor, "USB Vendor ID"); \
402 \
403 module_param_named(idProduct, coverwrite.idProduct, ushort, S_IRUGO); \
404 MODULE_PARM_DESC(idProduct, "USB Product ID"); \
405 \
406 module_param_named(bcdDevice, coverwrite.bcdDevice, ushort, S_IRUGO); \
407 MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); \
408 \
409 module_param_named(iSerialNumber, coverwrite.serial_number, charp, \
410 S_IRUGO); \
411 MODULE_PARM_DESC(iSerialNumber, "SerialNumber string"); \
412 \
413 module_param_named(iManufacturer, coverwrite.manufacturer, charp, \
414 S_IRUGO); \
415 MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); \
416 \
417 module_param_named(iProduct, coverwrite.product, charp, S_IRUGO); \
418 MODULE_PARM_DESC(iProduct, "USB Product string")
419
420void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
421 struct usb_composite_overwrite *covr);
422
423static inline u16 get_default_bcdDevice(void)
424{
425 u16 bcdDevice;
426
427 bcdDevice = bin2bcd((LINUX_VERSION_CODE >> 16 & 0xff)) << 8;
428 bcdDevice |= bin2bcd((LINUX_VERSION_CODE >> 8 & 0xff));
429 return bcdDevice;
430}
378 431
379/* messaging utils */ 432/* messaging utils */
380#define DBG(d, fmt, args...) \ 433#define DBG(d, fmt, args...) \
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index de4b9ed5d5dd..daec99af5d54 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -171,18 +171,18 @@ struct ehci_regs {
171#define USBMODE_CM_HC (3<<0) /* host controller mode */ 171#define USBMODE_CM_HC (3<<0) /* host controller mode */
172#define USBMODE_CM_IDLE (0<<0) /* idle state */ 172#define USBMODE_CM_IDLE (0<<0) /* idle state */
173 173
174 u32 reserved4[7]; 174 u32 reserved4[6];
175 175
176/* Moorestown has some non-standard registers, partially due to the fact that 176/* Moorestown has some non-standard registers, partially due to the fact that
177 * its EHCI controller has both TT and LPM support. HOSTPCx are extensions to 177 * its EHCI controller has both TT and LPM support. HOSTPCx are extensions to
178 * PORTSCx 178 * PORTSCx
179 */ 179 */
180 /* HOSTPC: offset 0x84 */ 180 /* HOSTPC: offset 0x84 */
181 u32 hostpc[0]; /* HOSTPC extension */ 181 u32 hostpc[1]; /* HOSTPC extension */
182#define HOSTPC_PHCD (1<<22) /* Phy clock disable */ 182#define HOSTPC_PHCD (1<<22) /* Phy clock disable */
183#define HOSTPC_PSPD (3<<25) /* Port speed detection */ 183#define HOSTPC_PSPD (3<<25) /* Port speed detection */
184 184
185 u32 reserved5[17]; 185 u32 reserved5[16];
186 186
187 /* USBMODE_EX: offset 0xc8 */ 187 /* USBMODE_EX: offset 0xc8 */
188 u32 usbmode_ex; /* USB Device mode extension */ 188 u32 usbmode_ex; /* USB Device mode extension */
@@ -221,18 +221,35 @@ extern int __init early_dbgp_init(char *s);
221extern struct console early_dbgp_console; 221extern struct console early_dbgp_console;
222#endif /* CONFIG_EARLY_PRINTK_DBGP */ 222#endif /* CONFIG_EARLY_PRINTK_DBGP */
223 223
224struct usb_hcd;
225
226#ifdef CONFIG_XEN_DOM0
227extern int xen_dbgp_reset_prep(struct usb_hcd *);
228extern int xen_dbgp_external_startup(struct usb_hcd *);
229#else
230static inline int xen_dbgp_reset_prep(struct usb_hcd *hcd)
231{
232 return 1; /* Shouldn't this be 0? */
233}
234
235static inline int xen_dbgp_external_startup(struct usb_hcd *hcd)
236{
237 return -1;
238}
239#endif
240
224#ifdef CONFIG_EARLY_PRINTK_DBGP 241#ifdef CONFIG_EARLY_PRINTK_DBGP
225/* Call backs from ehci host driver to ehci debug driver */ 242/* Call backs from ehci host driver to ehci debug driver */
226extern int dbgp_external_startup(void); 243extern int dbgp_external_startup(struct usb_hcd *);
227extern int dbgp_reset_prep(void); 244extern int dbgp_reset_prep(struct usb_hcd *hcd);
228#else 245#else
229static inline int dbgp_reset_prep(void) 246static inline int dbgp_reset_prep(struct usb_hcd *hcd)
230{ 247{
231 return 1; 248 return xen_dbgp_reset_prep(hcd);
232} 249}
233static inline int dbgp_external_startup(void) 250static inline int dbgp_external_startup(struct usb_hcd *hcd)
234{ 251{
235 return -1; 252 return xen_dbgp_external_startup(hcd);
236} 253}
237#endif 254#endif
238 255
diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h
index 1894f42fe3f7..c9d09f8b7ff2 100644
--- a/include/linux/usb/ehci_pdriver.h
+++ b/include/linux/usb/ehci_pdriver.h
@@ -41,6 +41,14 @@ struct usb_ehci_pdata {
41 unsigned big_endian_mmio:1; 41 unsigned big_endian_mmio:1;
42 unsigned port_power_on:1; 42 unsigned port_power_on:1;
43 unsigned port_power_off:1; 43 unsigned port_power_off:1;
44
45 /* Turn on all power and clocks */
46 int (*power_on)(struct platform_device *pdev);
47 /* Turn off all power and clocks */
48 void (*power_off)(struct platform_device *pdev);
49 /* Turn on only VBUS suspend power and hotplug detection,
50 * turn off everything else */
51 void (*power_suspend)(struct platform_device *pdev);
44}; 52};
45 53
46#endif /* __USB_CORE_EHCI_PDRIVER_H */ 54#endif /* __USB_CORE_EHCI_PDRIVER_H */
diff --git a/include/linux/usb/ezusb.h b/include/linux/usb/ezusb.h
new file mode 100644
index 000000000000..fc618d8d1e92
--- /dev/null
+++ b/include/linux/usb/ezusb.h
@@ -0,0 +1,16 @@
1#ifndef __EZUSB_H
2#define __EZUSB_H
3
4
5extern int ezusb_writememory(struct usb_device *dev, int address,
6 unsigned char *data, int length, __u8 bRequest);
7
8extern int ezusb_fx1_set_reset(struct usb_device *dev, unsigned char reset_bit);
9extern int ezusb_fx2_set_reset(struct usb_device *dev, unsigned char reset_bit);
10
11extern int ezusb_fx1_ihex_firmware_download(struct usb_device *dev,
12 const char *firmware_path);
13extern int ezusb_fx2_ihex_firmware_download(struct usb_device *dev,
14 const char *firmware_path);
15
16#endif /* __EZUSB_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 9517466ababb..5b6e50888248 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -474,7 +474,8 @@ struct usb_gadget_ops {
474 474
475 /* Those two are deprecated */ 475 /* Those two are deprecated */
476 int (*start)(struct usb_gadget_driver *, 476 int (*start)(struct usb_gadget_driver *,
477 int (*bind)(struct usb_gadget *)); 477 int (*bind)(struct usb_gadget *,
478 struct usb_gadget_driver *driver));
478 int (*stop)(struct usb_gadget_driver *); 479 int (*stop)(struct usb_gadget_driver *);
479}; 480};
480 481
@@ -502,6 +503,8 @@ struct usb_gadget_ops {
502 * @name: Identifies the controller hardware type. Used in diagnostics 503 * @name: Identifies the controller hardware type. Used in diagnostics
503 * and sometimes configuration. 504 * and sometimes configuration.
504 * @dev: Driver model state for this abstract device. 505 * @dev: Driver model state for this abstract device.
506 * @out_epnum: last used out ep number
507 * @in_epnum: last used in ep number
505 * 508 *
506 * Gadgets have a mostly-portable "gadget driver" implementing device 509 * Gadgets have a mostly-portable "gadget driver" implementing device
507 * functions, handling all usb configurations and interfaces. Gadget 510 * functions, handling all usb configurations and interfaces. Gadget
@@ -536,6 +539,8 @@ struct usb_gadget {
536 unsigned a_alt_hnp_support:1; 539 unsigned a_alt_hnp_support:1;
537 const char *name; 540 const char *name;
538 struct device dev; 541 struct device dev;
542 unsigned out_epnum;
543 unsigned in_epnum;
539}; 544};
540 545
541static inline void set_gadget_data(struct usb_gadget *gadget, void *data) 546static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
@@ -558,14 +563,7 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
558 */ 563 */
559static inline int gadget_is_dualspeed(struct usb_gadget *g) 564static inline int gadget_is_dualspeed(struct usb_gadget *g)
560{ 565{
561#ifdef CONFIG_USB_GADGET_DUALSPEED 566 return g->max_speed >= USB_SPEED_HIGH;
562 /* runtime test would check "g->max_speed" ... that might be
563 * useful to work around hardware bugs, but is mostly pointless
564 */
565 return 1;
566#else
567 return 0;
568#endif
569} 567}
570 568
571/** 569/**
@@ -575,15 +573,7 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
575 */ 573 */
576static inline int gadget_is_superspeed(struct usb_gadget *g) 574static inline int gadget_is_superspeed(struct usb_gadget *g)
577{ 575{
578#ifdef CONFIG_USB_GADGET_SUPERSPEED 576 return g->max_speed >= USB_SPEED_SUPER;
579 /*
580 * runtime test would check "g->max_speed" ... that might be
581 * useful to work around hardware bugs, but is mostly pointless
582 */
583 return 1;
584#else
585 return 0;
586#endif
587} 577}
588 578
589/** 579/**
@@ -781,6 +771,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
781 * when the host is disconnected. May be called in_interrupt; this 771 * when the host is disconnected. May be called in_interrupt; this
782 * may not sleep. Some devices can't detect disconnect, so this might 772 * may not sleep. Some devices can't detect disconnect, so this might
783 * not be called except as part of controller shutdown. 773 * not be called except as part of controller shutdown.
774 * @bind: the driver's bind callback
784 * @unbind: Invoked when the driver is unbound from a gadget, 775 * @unbind: Invoked when the driver is unbound from a gadget,
785 * usually from rmmod (after a disconnect is reported). 776 * usually from rmmod (after a disconnect is reported).
786 * Called in a context that permits sleeping. 777 * Called in a context that permits sleeping.
@@ -835,6 +826,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
835struct usb_gadget_driver { 826struct usb_gadget_driver {
836 char *function; 827 char *function;
837 enum usb_device_speed max_speed; 828 enum usb_device_speed max_speed;
829 int (*bind)(struct usb_gadget *gadget,
830 struct usb_gadget_driver *driver);
838 void (*unbind)(struct usb_gadget *); 831 void (*unbind)(struct usb_gadget *);
839 int (*setup)(struct usb_gadget *, 832 int (*setup)(struct usb_gadget *,
840 const struct usb_ctrlrequest *); 833 const struct usb_ctrlrequest *);
@@ -860,7 +853,6 @@ struct usb_gadget_driver {
860/** 853/**
861 * usb_gadget_probe_driver - probe a gadget driver 854 * usb_gadget_probe_driver - probe a gadget driver
862 * @driver: the driver being registered 855 * @driver: the driver being registered
863 * @bind: the driver's bind callback
864 * Context: can sleep 856 * Context: can sleep
865 * 857 *
866 * Call this in your gadget driver's module initialization function, 858 * Call this in your gadget driver's module initialization function,
@@ -869,8 +861,7 @@ struct usb_gadget_driver {
869 * registration call returns. It's expected that the @bind() function will 861 * registration call returns. It's expected that the @bind() function will
870 * be in init sections. 862 * be in init sections.
871 */ 863 */
872int usb_gadget_probe_driver(struct usb_gadget_driver *driver, 864int usb_gadget_probe_driver(struct usb_gadget_driver *driver);
873 int (*bind)(struct usb_gadget *));
874 865
875/** 866/**
876 * usb_gadget_unregister_driver - unregister a gadget driver 867 * usb_gadget_unregister_driver - unregister a gadget driver
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index c5fdb148fc02..608050b2545f 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -135,8 +135,8 @@ struct usb_hcd {
135 135
136 unsigned int irq; /* irq allocated */ 136 unsigned int irq; /* irq allocated */
137 void __iomem *regs; /* device memory/io */ 137 void __iomem *regs; /* device memory/io */
138 u64 rsrc_start; /* memory/io resource start */ 138 resource_size_t rsrc_start; /* memory/io resource start */
139 u64 rsrc_len; /* memory/io resource length */ 139 resource_size_t rsrc_len; /* memory/io resource length */
140 unsigned power_budget; /* in mA, 0 = no limit */ 140 unsigned power_budget; /* in mA, 0 = no limit */
141 141
142 /* bandwidth_mutex should be taken before adding or removing 142 /* bandwidth_mutex should be taken before adding or removing
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h
new file mode 100644
index 000000000000..28884c717411
--- /dev/null
+++ b/include/linux/usb/nop-usb-xceiv.h
@@ -0,0 +1,24 @@
1#ifndef __LINUX_USB_NOP_XCEIV_H
2#define __LINUX_USB_NOP_XCEIV_H
3
4#include <linux/usb/otg.h>
5
6struct nop_usb_xceiv_platform_data {
7 enum usb_phy_type type;
8};
9
10#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
11/* sometimes transceivers are accessed only through e.g. ULPI */
12extern void usb_nop_xceiv_register(void);
13extern void usb_nop_xceiv_unregister(void);
14#else
15static inline void usb_nop_xceiv_register(void)
16{
17}
18
19static inline void usb_nop_xceiv_unregister(void)
20{
21}
22#endif
23
24#endif /* __LINUX_USB_NOP_XCEIV_H */
diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h
index 2808f2a9cce8..74e7755168b7 100644
--- a/include/linux/usb/ohci_pdriver.h
+++ b/include/linux/usb/ohci_pdriver.h
@@ -33,6 +33,14 @@ struct usb_ohci_pdata {
33 unsigned big_endian_desc:1; 33 unsigned big_endian_desc:1;
34 unsigned big_endian_mmio:1; 34 unsigned big_endian_mmio:1;
35 unsigned no_big_frame_no:1; 35 unsigned no_big_frame_no:1;
36
37 /* Turn on all power and clocks */
38 int (*power_on)(struct platform_device *pdev);
39 /* Turn off all power and clocks */
40 void (*power_off)(struct platform_device *pdev);
41 /* Turn on only VBUS suspend power and hotplug detection,
42 * turn off everything else */
43 void (*power_suspend)(struct platform_device *pdev);
36}; 44};
37 45
38#endif /* __USB_CORE_OHCI_PDRIVER_H */ 46#endif /* __USB_CORE_OHCI_PDRIVER_H */
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
new file mode 100644
index 000000000000..0ea17f8ae820
--- /dev/null
+++ b/include/linux/usb/omap_usb.h
@@ -0,0 +1,46 @@
1/*
2 * omap_usb.h -- omap usb2 phy header file
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
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
19#ifndef __DRIVERS_OMAP_USB2_H
20#define __DRIVERS_OMAP_USB2_H
21
22#include <linux/usb/otg.h>
23
24struct omap_usb {
25 struct usb_phy phy;
26 struct phy_companion *comparator;
27 struct device *dev;
28 u32 __iomem *control_dev;
29 struct clk *wkupclk;
30 u8 is_suspended:1;
31};
32
33#define PHY_PD 0x1
34
35#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
36
37#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
38extern int omap_usb2_set_comparator(struct phy_companion *comparator);
39#else
40static inline int omap_usb2_set_comparator(struct phy_companion *comparator)
41{
42 return -ENODEV;
43}
44#endif
45
46#endif /* __DRIVERS_OMAP_USB_H */
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 45824be0a2f9..e8a5fe87c6bd 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -9,56 +9,7 @@
9#ifndef __LINUX_USB_OTG_H 9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H 10#define __LINUX_USB_OTG_H
11 11
12#include <linux/notifier.h> 12#include <linux/usb/phy.h>
13
14/* OTG defines lots of enumeration states before device reset */
15enum usb_otg_state {
16 OTG_STATE_UNDEFINED = 0,
17
18 /* single-role peripheral, and dual-role default-b */
19 OTG_STATE_B_IDLE,
20 OTG_STATE_B_SRP_INIT,
21 OTG_STATE_B_PERIPHERAL,
22
23 /* extra dual-role default-b states */
24 OTG_STATE_B_WAIT_ACON,
25 OTG_STATE_B_HOST,
26
27 /* dual-role default-a */
28 OTG_STATE_A_IDLE,
29 OTG_STATE_A_WAIT_VRISE,
30 OTG_STATE_A_WAIT_BCON,
31 OTG_STATE_A_HOST,
32 OTG_STATE_A_SUSPEND,
33 OTG_STATE_A_PERIPHERAL,
34 OTG_STATE_A_WAIT_VFALL,
35 OTG_STATE_A_VBUS_ERR,
36};
37
38enum usb_phy_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */
42 USB_EVENT_CHARGER, /* usb dedicated charger */
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44};
45
46/* associate a type with PHY */
47enum usb_phy_type {
48 USB_PHY_TYPE_UNDEFINED,
49 USB_PHY_TYPE_USB2,
50 USB_PHY_TYPE_USB3,
51};
52
53struct usb_phy;
54
55/* for transceivers connected thru an ULPI interface, the user must
56 * provide access ops
57 */
58struct usb_phy_io_ops {
59 int (*read)(struct usb_phy *x, u32 reg);
60 int (*write)(struct usb_phy *x, u32 val, u32 reg);
61};
62 13
63struct usb_otg { 14struct usb_otg {
64 u8 default_a; 15 u8 default_a;
@@ -85,134 +36,9 @@ struct usb_otg {
85 36
86}; 37};
87 38
88/*
89 * the otg driver needs to interact with both device side and host side
90 * usb controllers. it decides which controller is active at a given
91 * moment, using the transceiver, ID signal, HNP and sometimes static
92 * configuration information (including "board isn't wired for otg").
93 */
94struct usb_phy {
95 struct device *dev;
96 const char *label;
97 unsigned int flags;
98
99 enum usb_phy_type type;
100 enum usb_otg_state state;
101 enum usb_phy_events last_event;
102
103 struct usb_otg *otg;
104
105 struct device *io_dev;
106 struct usb_phy_io_ops *io_ops;
107 void __iomem *io_priv;
108
109 /* for notification of usb_phy_events */
110 struct atomic_notifier_head notifier;
111
112 /* to pass extra port status to the root hub */
113 u16 port_status;
114 u16 port_change;
115
116 /* to support controllers that have multiple transceivers */
117 struct list_head head;
118
119 /* initialize/shutdown the OTG controller */
120 int (*init)(struct usb_phy *x);
121 void (*shutdown)(struct usb_phy *x);
122
123 /* effective for B devices, ignored for A-peripheral */
124 int (*set_power)(struct usb_phy *x,
125 unsigned mA);
126
127 /* for non-OTG B devices: set transceiver into suspend mode */
128 int (*set_suspend)(struct usb_phy *x,
129 int suspend);
130
131 /* notify phy connect status change */
132 int (*notify_connect)(struct usb_phy *x, int port);
133 int (*notify_disconnect)(struct usb_phy *x, int port);
134};
135
136
137/* for board-specific init logic */
138extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
139extern void usb_remove_phy(struct usb_phy *);
140
141#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
142/* sometimes transceivers are accessed only through e.g. ULPI */
143extern void usb_nop_xceiv_register(void);
144extern void usb_nop_xceiv_unregister(void);
145#else
146static inline void usb_nop_xceiv_register(void)
147{
148}
149
150static inline void usb_nop_xceiv_unregister(void)
151{
152}
153#endif
154
155/* helpers for direct access thru low-level io interface */
156static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
157{
158 if (x->io_ops && x->io_ops->read)
159 return x->io_ops->read(x, reg);
160
161 return -EINVAL;
162}
163
164static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
165{
166 if (x->io_ops && x->io_ops->write)
167 return x->io_ops->write(x, val, reg);
168
169 return -EINVAL;
170}
171
172static inline int
173usb_phy_init(struct usb_phy *x)
174{
175 if (x->init)
176 return x->init(x);
177
178 return 0;
179}
180
181static inline void
182usb_phy_shutdown(struct usb_phy *x)
183{
184 if (x->shutdown)
185 x->shutdown(x);
186}
187
188/* for usb host and peripheral controller drivers */
189#ifdef CONFIG_USB_OTG_UTILS 39#ifdef CONFIG_USB_OTG_UTILS
190extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
191extern struct usb_phy *devm_usb_get_phy(struct device *dev,
192 enum usb_phy_type type);
193extern void usb_put_phy(struct usb_phy *);
194extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
195extern const char *otg_state_string(enum usb_otg_state state); 40extern const char *otg_state_string(enum usb_otg_state state);
196#else 41#else
197static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
198{
199 return NULL;
200}
201
202static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
203 enum usb_phy_type type)
204{
205 return NULL;
206}
207
208static inline void usb_put_phy(struct usb_phy *x)
209{
210}
211
212static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x)
213{
214}
215
216static inline const char *otg_state_string(enum usb_otg_state state) 42static inline const char *otg_state_string(enum usb_otg_state state)
217{ 43{
218 return NULL; 44 return NULL;
@@ -262,42 +88,6 @@ otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph)
262} 88}
263 89
264static inline int 90static inline int
265usb_phy_set_power(struct usb_phy *x, unsigned mA)
266{
267 if (x && x->set_power)
268 return x->set_power(x, mA);
269 return 0;
270}
271
272/* Context: can sleep */
273static inline int
274usb_phy_set_suspend(struct usb_phy *x, int suspend)
275{
276 if (x->set_suspend != NULL)
277 return x->set_suspend(x, suspend);
278 else
279 return 0;
280}
281
282static inline int
283usb_phy_notify_connect(struct usb_phy *x, int port)
284{
285 if (x->notify_connect)
286 return x->notify_connect(x, port);
287 else
288 return 0;
289}
290
291static inline int
292usb_phy_notify_disconnect(struct usb_phy *x, int port)
293{
294 if (x->notify_disconnect)
295 return x->notify_disconnect(x, port);
296 else
297 return 0;
298}
299
300static inline int
301otg_start_srp(struct usb_otg *otg) 91otg_start_srp(struct usb_otg *otg)
302{ 92{
303 if (otg && otg->start_srp) 93 if (otg && otg->start_srp)
@@ -306,31 +96,7 @@ otg_start_srp(struct usb_otg *otg)
306 return -ENOTSUPP; 96 return -ENOTSUPP;
307} 97}
308 98
309/* notifiers */
310static inline int
311usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
312{
313 return atomic_notifier_chain_register(&x->notifier, nb);
314}
315
316static inline void
317usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
318{
319 atomic_notifier_chain_unregister(&x->notifier, nb);
320}
321
322/* for OTG controller drivers (and maybe other stuff) */ 99/* for OTG controller drivers (and maybe other stuff) */
323extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 100extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
324 101
325static inline const char *usb_phy_type_string(enum usb_phy_type type)
326{
327 switch (type) {
328 case USB_PHY_TYPE_USB2:
329 return "USB2 PHY";
330 case USB_PHY_TYPE_USB3:
331 return "USB3 PHY";
332 default:
333 return "UNKNOWN PHY TYPE";
334 }
335}
336#endif /* __LINUX_USB_OTG_H */ 102#endif /* __LINUX_USB_OTG_H */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
new file mode 100644
index 000000000000..06b5bae35b29
--- /dev/null
+++ b/include/linux/usb/phy.h
@@ -0,0 +1,233 @@
1/* USB OTG (On The Go) defines */
2/*
3 *
4 * These APIs may be used between USB controllers. USB device drivers
5 * (for either host or peripheral roles) don't use these calls; they
6 * continue to use just usb_device and usb_gadget.
7 */
8
9#ifndef __LINUX_USB_PHY_H
10#define __LINUX_USB_PHY_H
11
12#include <linux/notifier.h>
13
14enum usb_phy_events {
15 USB_EVENT_NONE, /* no events or cable disconnected */
16 USB_EVENT_VBUS, /* vbus valid event */
17 USB_EVENT_ID, /* id was grounded */
18 USB_EVENT_CHARGER, /* usb dedicated charger */
19 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
20};
21
22/* associate a type with PHY */
23enum usb_phy_type {
24 USB_PHY_TYPE_UNDEFINED,
25 USB_PHY_TYPE_USB2,
26 USB_PHY_TYPE_USB3,
27};
28
29/* OTG defines lots of enumeration states before device reset */
30enum usb_otg_state {
31 OTG_STATE_UNDEFINED = 0,
32
33 /* single-role peripheral, and dual-role default-b */
34 OTG_STATE_B_IDLE,
35 OTG_STATE_B_SRP_INIT,
36 OTG_STATE_B_PERIPHERAL,
37
38 /* extra dual-role default-b states */
39 OTG_STATE_B_WAIT_ACON,
40 OTG_STATE_B_HOST,
41
42 /* dual-role default-a */
43 OTG_STATE_A_IDLE,
44 OTG_STATE_A_WAIT_VRISE,
45 OTG_STATE_A_WAIT_BCON,
46 OTG_STATE_A_HOST,
47 OTG_STATE_A_SUSPEND,
48 OTG_STATE_A_PERIPHERAL,
49 OTG_STATE_A_WAIT_VFALL,
50 OTG_STATE_A_VBUS_ERR,
51};
52
53struct usb_phy;
54struct usb_otg;
55
56/* for transceivers connected thru an ULPI interface, the user must
57 * provide access ops
58 */
59struct usb_phy_io_ops {
60 int (*read)(struct usb_phy *x, u32 reg);
61 int (*write)(struct usb_phy *x, u32 val, u32 reg);
62};
63
64struct usb_phy {
65 struct device *dev;
66 const char *label;
67 unsigned int flags;
68
69 enum usb_phy_type type;
70 enum usb_otg_state state;
71 enum usb_phy_events last_event;
72
73 struct usb_otg *otg;
74
75 struct device *io_dev;
76 struct usb_phy_io_ops *io_ops;
77 void __iomem *io_priv;
78
79 /* for notification of usb_phy_events */
80 struct atomic_notifier_head notifier;
81
82 /* to pass extra port status to the root hub */
83 u16 port_status;
84 u16 port_change;
85
86 /* to support controllers that have multiple transceivers */
87 struct list_head head;
88
89 /* initialize/shutdown the OTG controller */
90 int (*init)(struct usb_phy *x);
91 void (*shutdown)(struct usb_phy *x);
92
93 /* effective for B devices, ignored for A-peripheral */
94 int (*set_power)(struct usb_phy *x,
95 unsigned mA);
96
97 /* for non-OTG B devices: set transceiver into suspend mode */
98 int (*set_suspend)(struct usb_phy *x,
99 int suspend);
100
101 /* notify phy connect status change */
102 int (*notify_connect)(struct usb_phy *x, int port);
103 int (*notify_disconnect)(struct usb_phy *x, int port);
104};
105
106
107/* for board-specific init logic */
108extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
109extern void usb_remove_phy(struct usb_phy *);
110
111/* helpers for direct access thru low-level io interface */
112static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
113{
114 if (x->io_ops && x->io_ops->read)
115 return x->io_ops->read(x, reg);
116
117 return -EINVAL;
118}
119
120static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
121{
122 if (x->io_ops && x->io_ops->write)
123 return x->io_ops->write(x, val, reg);
124
125 return -EINVAL;
126}
127
128static inline int
129usb_phy_init(struct usb_phy *x)
130{
131 if (x->init)
132 return x->init(x);
133
134 return 0;
135}
136
137static inline void
138usb_phy_shutdown(struct usb_phy *x)
139{
140 if (x->shutdown)
141 x->shutdown(x);
142}
143
144/* for usb host and peripheral controller drivers */
145#ifdef CONFIG_USB_OTG_UTILS
146extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
147extern struct usb_phy *devm_usb_get_phy(struct device *dev,
148 enum usb_phy_type type);
149extern void usb_put_phy(struct usb_phy *);
150extern void devm_usb_put_phy(struct device *dev, struct usb_phy *x);
151#else
152static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
153{
154 return NULL;
155}
156
157static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
158 enum usb_phy_type type)
159{
160 return NULL;
161}
162
163static inline void usb_put_phy(struct usb_phy *x)
164{
165}
166
167static inline void devm_usb_put_phy(struct device *dev, struct usb_phy *x)
168{
169}
170
171#endif
172
173static inline int
174usb_phy_set_power(struct usb_phy *x, unsigned mA)
175{
176 if (x && x->set_power)
177 return x->set_power(x, mA);
178 return 0;
179}
180
181/* Context: can sleep */
182static inline int
183usb_phy_set_suspend(struct usb_phy *x, int suspend)
184{
185 if (x->set_suspend != NULL)
186 return x->set_suspend(x, suspend);
187 else
188 return 0;
189}
190
191static inline int
192usb_phy_notify_connect(struct usb_phy *x, int port)
193{
194 if (x->notify_connect)
195 return x->notify_connect(x, port);
196 else
197 return 0;
198}
199
200static inline int
201usb_phy_notify_disconnect(struct usb_phy *x, int port)
202{
203 if (x->notify_disconnect)
204 return x->notify_disconnect(x, port);
205 else
206 return 0;
207}
208
209/* notifiers */
210static inline int
211usb_register_notifier(struct usb_phy *x, struct notifier_block *nb)
212{
213 return atomic_notifier_chain_register(&x->notifier, nb);
214}
215
216static inline void
217usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
218{
219 atomic_notifier_chain_unregister(&x->notifier, nb);
220}
221
222static inline const char *usb_phy_type_string(enum usb_phy_type type)
223{
224 switch (type) {
225 case USB_PHY_TYPE_USB2:
226 return "USB2 PHY";
227 case USB_PHY_TYPE_USB3:
228 return "USB3 PHY";
229 default:
230 return "UNKNOWN PHY TYPE";
231 }
232}
233#endif /* __LINUX_USB_PHY_H */
diff --git a/include/linux/usb/phy_companion.h b/include/linux/usb/phy_companion.h
new file mode 100644
index 000000000000..edd2ec23d282
--- /dev/null
+++ b/include/linux/usb/phy_companion.h
@@ -0,0 +1,34 @@
1/*
2 * phy-companion.h -- phy companion to indicate the comparator part of PHY
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * Author: Kishon Vijay Abraham I <kishon@ti.com>
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
19#ifndef __DRIVERS_PHY_COMPANION_H
20#define __DRIVERS_PHY_COMPANION_H
21
22#include <linux/usb/otg.h>
23
24/* phy_companion to take care of VBUS, ID and srp capabilities */
25struct phy_companion {
26
27 /* effective for A-peripheral, ignored for B devices */
28 int (*set_vbus)(struct phy_companion *x, bool enabled);
29
30 /* for B devices only: start session with A-Host */
31 int (*start_srp)(struct phy_companion *x);
32};
33
34#endif /* __DRIVERS_PHY_COMPANION_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 3e93de7ecbc3..52f944dfe2fd 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -19,8 +19,8 @@
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21 21
22/*device will morph if reset, don't use reset for handling errors */ 22/* device can't be reset(e.g morph devices), don't use reset */
23#define USB_QUIRK_RESET_MORPHS 0x00000010 23#define USB_QUIRK_RESET 0x00000010
24 24
25/* device has more interface descriptions than the bNumInterfaces count, 25/* device has more interface descriptions than the bNumInterfaces count,
26 and can't handle talking to these interfaces */ 26 and can't handle talking to these interfaces */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 86c0b451745d..ef9be7e1e190 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -301,17 +301,13 @@ extern void usb_serial_port_softint(struct usb_serial_port *port);
301extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 301extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
302extern int usb_serial_resume(struct usb_interface *intf); 302extern int usb_serial_resume(struct usb_interface *intf);
303 303
304extern int ezusb_writememory(struct usb_serial *serial, int address,
305 unsigned char *data, int length, __u8 bRequest);
306extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
307
308/* USB Serial console functions */ 304/* USB Serial console functions */
309#ifdef CONFIG_USB_SERIAL_CONSOLE 305#ifdef CONFIG_USB_SERIAL_CONSOLE
310extern void usb_serial_console_init(int debug, int minor); 306extern void usb_serial_console_init(int minor);
311extern void usb_serial_console_exit(void); 307extern void usb_serial_console_exit(void);
312extern void usb_serial_console_disconnect(struct usb_serial *serial); 308extern void usb_serial_console_disconnect(struct usb_serial *serial);
313#else 309#else
314static inline void usb_serial_console_init(int debug, int minor) { } 310static inline void usb_serial_console_init(int minor) { }
315static inline void usb_serial_console_exit(void) { } 311static inline void usb_serial_console_exit(void) { }
316static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} 312static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
317#endif 313#endif
@@ -333,7 +329,7 @@ extern void usb_serial_generic_throttle(struct tty_struct *tty);
333extern void usb_serial_generic_unthrottle(struct tty_struct *tty); 329extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
334extern void usb_serial_generic_disconnect(struct usb_serial *serial); 330extern void usb_serial_generic_disconnect(struct usb_serial *serial);
335extern void usb_serial_generic_release(struct usb_serial *serial); 331extern void usb_serial_generic_release(struct usb_serial *serial);
336extern int usb_serial_generic_register(int debug); 332extern int usb_serial_generic_register(void);
337extern void usb_serial_generic_deregister(void); 333extern void usb_serial_generic_deregister(void);
338extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, 334extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port,
339 gfp_t mem_flags); 335 gfp_t mem_flags);
@@ -355,30 +351,14 @@ extern struct usb_serial_driver usb_serial_generic_device;
355extern struct bus_type usb_serial_bus_type; 351extern struct bus_type usb_serial_bus_type;
356extern struct tty_driver *usb_serial_tty_driver; 352extern struct tty_driver *usb_serial_tty_driver;
357 353
358static inline void usb_serial_debug_data(int debug, 354static inline void usb_serial_debug_data(struct device *dev,
359 struct device *dev,
360 const char *function, int size, 355 const char *function, int size,
361 const unsigned char *data) 356 const unsigned char *data)
362{ 357{
363 int i; 358 dev_dbg(dev, "%s - length = %d, data = %*ph\n",
364 359 function, size, size, data);
365 if (debug) {
366 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
367 function, size);
368 for (i = 0; i < size; ++i)
369 printk("%.2x ", data[i]);
370 printk("\n");
371 }
372} 360}
373 361
374/* Use our own dbg macro */
375#undef dbg
376#define dbg(format, arg...) \
377do { \
378 if (debug) \
379 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
380} while (0)
381
382/* 362/*
383 * Macro for reporting errors in write path to avoid inifinite loop 363 * Macro for reporting errors in write path to avoid inifinite loop
384 * when port is used as a console. 364 * when port is used as a console.
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
new file mode 100644
index 000000000000..176b1ca06ae4
--- /dev/null
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -0,0 +1,80 @@
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_PHY_H
16#define __TEGRA_USB_PHY_H
17
18#include <linux/clk.h>
19#include <linux/usb/otg.h>
20
21struct tegra_utmip_config {
22 u8 hssync_start_delay;
23 u8 elastic_limit;
24 u8 idle_wait_delay;
25 u8 term_range_adj;
26 u8 xcvr_setup;
27 u8 xcvr_lsfslew;
28 u8 xcvr_lsrslew;
29};
30
31struct tegra_ulpi_config {
32 int reset_gpio;
33 const char *clk;
34};
35
36enum tegra_usb_phy_port_speed {
37 TEGRA_USB_PHY_PORT_SPEED_FULL = 0,
38 TEGRA_USB_PHY_PORT_SPEED_LOW,
39 TEGRA_USB_PHY_PORT_SPEED_HIGH,
40};
41
42enum tegra_usb_phy_mode {
43 TEGRA_USB_PHY_MODE_DEVICE,
44 TEGRA_USB_PHY_MODE_HOST,
45};
46
47struct tegra_xtal_freq;
48
49struct tegra_usb_phy {
50 int instance;
51 const struct tegra_xtal_freq *freq;
52 void __iomem *regs;
53 void __iomem *pad_regs;
54 struct clk *clk;
55 struct clk *pll_u;
56 struct clk *pad_clk;
57 enum tegra_usb_phy_mode mode;
58 void *config;
59 struct usb_phy *ulpi;
60 struct usb_phy u_phy;
61 struct device *dev;
62};
63
64struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
65 void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode);
66
67void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy);
68
69void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy);
70
71void tegra_usb_phy_preresume(struct tegra_usb_phy *phy);
72
73void tegra_usb_phy_postresume(struct tegra_usb_phy *phy);
74
75void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
76 enum tegra_usb_phy_port_speed port_speed);
77
78void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy);
79
80#endif /* __TEGRA_USB_PHY_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index e84e769aaddc..bf99cd01be20 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -72,33 +72,9 @@
72enum { US_DO_ALL_FLAGS }; 72enum { US_DO_ALL_FLAGS };
73#undef US_FLAG 73#undef US_FLAG
74 74
75/*
76 * The bias field for libusual and friends.
77 */
78#define USB_US_TYPE_NONE 0
79#define USB_US_TYPE_STOR 1 /* usb-storage */
80#define USB_US_TYPE_UB 2 /* ub */
81
82#define USB_US_TYPE(flags) (((flags) >> 24) & 0xFF)
83#define USB_US_ORIG_FLAGS(flags) ((flags) & 0x00FFFFFF)
84
85#include <linux/usb/storage.h> 75#include <linux/usb/storage.h>
86 76
87/*
88 */
89extern int usb_usual_ignore_device(struct usb_interface *intf); 77extern int usb_usual_ignore_device(struct usb_interface *intf);
90extern struct usb_device_id usb_storage_usb_ids[]; 78extern struct usb_device_id usb_storage_usb_ids[];
91 79
92#ifdef CONFIG_USB_LIBUSUAL
93
94extern void usb_usual_set_present(int type);
95extern void usb_usual_clear_present(int type);
96extern int usb_usual_check_type(const struct usb_device_id *, int type);
97#else
98
99#define usb_usual_set_present(t) do { } while(0)
100#define usb_usual_clear_present(t) do { } while(0)
101#define usb_usual_check_type(id, t) (0)
102#endif /* CONFIG_USB_LIBUSUAL */
103
104#endif /* __LINUX_USB_USUAL_H */ 80#endif /* __LINUX_USB_USUAL_H */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 3b74666be027..4abe28e41cbc 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -131,6 +131,19 @@ struct usbdevfs_hub_portinfo {
131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
132#define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 132#define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
133 133
134/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
135
136/* disconnect-and-claim if the driver matches the driver field */
137#define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
138/* disconnect-and-claim except when the driver matches the driver field */
139#define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
140
141struct usbdevfs_disconnect_claim {
142 unsigned int interface;
143 unsigned int flags;
144 char driver[USBDEVFS_MAXDRIVERNAME + 1];
145};
146
134#ifdef __KERNEL__ 147#ifdef __KERNEL__
135#ifdef CONFIG_COMPAT 148#ifdef CONFIG_COMPAT
136#include <linux/compat.h> 149#include <linux/compat.h>
@@ -211,5 +224,6 @@ struct usbdevfs_ioctl32 {
211#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) 224#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
212#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) 225#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
213#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32) 226#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
227#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
214 228
215#endif /* _LINUX_USBDEVICE_FS_H */ 229#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4e72922e5a75..95142cae446a 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -20,6 +20,7 @@ struct uid_gid_map { /* 64 bytes -- 1 cache line */
20struct user_namespace { 20struct user_namespace {
21 struct uid_gid_map uid_map; 21 struct uid_gid_map uid_map;
22 struct uid_gid_map gid_map; 22 struct uid_gid_map gid_map;
23 struct uid_gid_map projid_map;
23 struct kref kref; 24 struct kref kref;
24 struct user_namespace *parent; 25 struct user_namespace *parent;
25 kuid_t owner; 26 kuid_t owner;
@@ -49,8 +50,10 @@ static inline void put_user_ns(struct user_namespace *ns)
49struct seq_operations; 50struct seq_operations;
50extern struct seq_operations proc_uid_seq_operations; 51extern struct seq_operations proc_uid_seq_operations;
51extern struct seq_operations proc_gid_seq_operations; 52extern struct seq_operations proc_gid_seq_operations;
53extern struct seq_operations proc_projid_seq_operations;
52extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *); 54extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
53extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *); 55extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
56extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
54#else 57#else
55 58
56static inline struct user_namespace *get_user_ns(struct user_namespace *ns) 59static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
index 0fa8b64c3cdb..4f0667e010dd 100644
--- a/include/linux/v4l2-common.h
+++ b/include/linux/v4l2-common.h
@@ -53,10 +53,10 @@
53/* Backward compatibility target definitions --- to be removed. */ 53/* Backward compatibility target definitions --- to be removed. */
54#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP 54#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
55#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE 55#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
56#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \ 56#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP
57 V4L2_SEL_TGT_CROP 57#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
58#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \ 58#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS
59 V4L2_SEL_TGT_COMPOSE 59#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
60 60
61/* Selection flags */ 61/* Selection flags */
62#define V4L2_SEL_FLAG_GE (1 << 0) 62#define V4L2_SEL_FLAG_GE (1 << 0)
diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
new file mode 100644
index 000000000000..421d24c7f686
--- /dev/null
+++ b/include/linux/v4l2-controls.h
@@ -0,0 +1,761 @@
1/*
2 * Video for Linux Two controls header file
3 *
4 * Copyright (C) 1999-2012 the contributors
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 * Alternatively you can redistribute this file under the terms of the
17 * BSD license as stated below:
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in
26 * the documentation and/or other materials provided with the
27 * distribution.
28 * 3. The names of its contributors may not be used to endorse or promote
29 * products derived from this software without specific prior written
30 * permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 *
44 * The contents of this header was split off from videodev2.h. All control
45 * definitions should be added to this header, which is included by
46 * videodev2.h.
47 */
48
49#ifndef __LINUX_V4L2_CONTROLS_H
50#define __LINUX_V4L2_CONTROLS_H
51
52/* Control classes */
53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62
63/* User-class control IDs */
64
65#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
66#define V4L2_CID_USER_BASE V4L2_CID_BASE
67#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
68#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
69#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
70#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
71#define V4L2_CID_HUE (V4L2_CID_BASE+3)
72#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
73#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
74#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
75#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
76#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
77#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
78#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
79#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
80#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
81#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
82#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
83#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
84#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
85#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
86#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
87#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
88#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
89#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
90
91/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
92#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
93#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
94
95#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
96enum v4l2_power_line_frequency {
97 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
98 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
99 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
100 V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
101};
102#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
103#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
104#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
105#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
106#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
107#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
108#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
109enum v4l2_colorfx {
110 V4L2_COLORFX_NONE = 0,
111 V4L2_COLORFX_BW = 1,
112 V4L2_COLORFX_SEPIA = 2,
113 V4L2_COLORFX_NEGATIVE = 3,
114 V4L2_COLORFX_EMBOSS = 4,
115 V4L2_COLORFX_SKETCH = 5,
116 V4L2_COLORFX_SKY_BLUE = 6,
117 V4L2_COLORFX_GRASS_GREEN = 7,
118 V4L2_COLORFX_SKIN_WHITEN = 8,
119 V4L2_COLORFX_VIVID = 9,
120 V4L2_COLORFX_AQUA = 10,
121 V4L2_COLORFX_ART_FREEZE = 11,
122 V4L2_COLORFX_SILHOUETTE = 12,
123 V4L2_COLORFX_SOLARIZATION = 13,
124 V4L2_COLORFX_ANTIQUE = 14,
125 V4L2_COLORFX_SET_CBCR = 15,
126};
127#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
128#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
129
130#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
131#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
132
133#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
134
135#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
136#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
137
138#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
139#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
140
141#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
142#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
143
144/* last CID + 1 */
145#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
146
147
148/* MPEG-class control IDs */
149
150#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
151#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
152
153/* MPEG streams, specific to multiplexed streams */
154#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
155enum v4l2_mpeg_stream_type {
156 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
157 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
158 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
159 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
160 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
161 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
162};
163#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
164#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
165#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
166#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
167#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
168#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
169#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
170enum v4l2_mpeg_stream_vbi_fmt {
171 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
172 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
173};
174
175/* MPEG audio controls specific to multiplexed streams */
176#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
177enum v4l2_mpeg_audio_sampling_freq {
178 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
179 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
180 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
181};
182#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
183enum v4l2_mpeg_audio_encoding {
184 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
185 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
186 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
187 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
188 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
189};
190#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
191enum v4l2_mpeg_audio_l1_bitrate {
192 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
193 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
194 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
195 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
196 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
197 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
198 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
199 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
200 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
201 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
202 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
203 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
204 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
205 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
206};
207#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
208enum v4l2_mpeg_audio_l2_bitrate {
209 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
210 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
211 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
212 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
213 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
214 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
215 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
216 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
217 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
218 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
219 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
220 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
221 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
222 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
223};
224#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
225enum v4l2_mpeg_audio_l3_bitrate {
226 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
227 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
228 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
229 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
230 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
231 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
232 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
233 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
234 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
235 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
236 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
237 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
238 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
239 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
240};
241#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
242enum v4l2_mpeg_audio_mode {
243 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
244 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
245 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
246 V4L2_MPEG_AUDIO_MODE_MONO = 3,
247};
248#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
249enum v4l2_mpeg_audio_mode_extension {
250 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
251 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
252 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
253 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
254};
255#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
256enum v4l2_mpeg_audio_emphasis {
257 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
258 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
259 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
260};
261#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
262enum v4l2_mpeg_audio_crc {
263 V4L2_MPEG_AUDIO_CRC_NONE = 0,
264 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
265};
266#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
267#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
268#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
269enum v4l2_mpeg_audio_ac3_bitrate {
270 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
271 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
272 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
273 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
274 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
275 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
276 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
277 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
278 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
279 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
280 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
281 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
282 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
283 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
284 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
285 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
286 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
287 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
288 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
289};
290#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
291enum v4l2_mpeg_audio_dec_playback {
292 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
293 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
294 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
295 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
296 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
297 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
298};
299#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
300
301/* MPEG video controls specific to multiplexed streams */
302#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
303enum v4l2_mpeg_video_encoding {
304 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
305 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
306 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
307};
308#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
309enum v4l2_mpeg_video_aspect {
310 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
311 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
312 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
313 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
314};
315#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
316#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
317#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
318#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
319#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
320enum v4l2_mpeg_video_bitrate_mode {
321 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
322 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
323};
324#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
325#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
326#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
327#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
328#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
329#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
330#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
331#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
332#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
333#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
334enum v4l2_mpeg_video_header_mode {
335 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
336 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
337
338};
339#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
340#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
341#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
342#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
343#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
344enum v4l2_mpeg_video_multi_slice_mode {
345 V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
346 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
347 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
348};
349#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
350#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
351#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
352
353#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
354#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
355#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
356#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
357#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
358#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
359#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
360#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
361#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
362#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
363#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
364#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
365#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
366enum v4l2_mpeg_video_h264_entropy_mode {
367 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
368 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
369};
370#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
371#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
372enum v4l2_mpeg_video_h264_level {
373 V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
374 V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
375 V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
376 V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
377 V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
378 V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
379 V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
380 V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
381 V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
382 V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
383 V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
384 V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
385 V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
386 V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
387 V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
388 V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
389};
390#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
391#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
392#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
393enum v4l2_mpeg_video_h264_loop_filter_mode {
394 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
395 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
396 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
397};
398#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
399enum v4l2_mpeg_video_h264_profile {
400 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
401 V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
402 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
403 V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
404 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
405 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
406 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
407 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
408 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
409 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
410 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
411 V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
412 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
413 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
414 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
415 V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
416 V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
417};
418#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
419#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
420#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
421#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
422enum v4l2_mpeg_video_h264_vui_sar_idc {
423 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
424 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
425 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
426 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
427 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
428 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
429 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
430 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
431 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
432 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
433 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
434 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
435 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
436 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
437 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
438 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
439 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
440 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
441};
442#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
443#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
444#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
445#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
446#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
447#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
448enum v4l2_mpeg_video_mpeg4_level {
449 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
450 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
451 V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
452 V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
453 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
454 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
455 V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
456 V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
457};
458#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
459enum v4l2_mpeg_video_mpeg4_profile {
460 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
461 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
462 V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
463 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
464 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
465};
466#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
467
468/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
469#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
470#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
471enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
472 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
473 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
474};
475#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
476#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
477enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
478 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
479 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
480 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
481 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
482 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
483};
484#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
485enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
486 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
487 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
488};
489#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
490enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
491 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
492 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
493};
494#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
495#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
496enum v4l2_mpeg_cx2341x_video_median_filter_type {
497 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
498 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
499 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
500 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
501 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
502};
503#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
504#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
505#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
506#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
507#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
508
509/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
510#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
511
512#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
513#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
514#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
515enum v4l2_mpeg_mfc51_video_frame_skip_mode {
516 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
517 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
518 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
519};
520#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
521enum v4l2_mpeg_mfc51_video_force_frame_type {
522 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
523 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
524 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
525};
526#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
527#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
528#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
529#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
530#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
531#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
532#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
533#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
534#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
535
536
537/* Camera class control IDs */
538
539#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
540#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
541
542#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
543enum v4l2_exposure_auto_type {
544 V4L2_EXPOSURE_AUTO = 0,
545 V4L2_EXPOSURE_MANUAL = 1,
546 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
547 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
548};
549#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
550#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
551
552#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
553#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
554#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
555#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
556
557#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
558#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
559
560#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
561#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
562#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
563
564#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
565#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
566#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
567
568#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
569
570#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
571#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
572
573#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
574
575#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
576enum v4l2_auto_n_preset_white_balance {
577 V4L2_WHITE_BALANCE_MANUAL = 0,
578 V4L2_WHITE_BALANCE_AUTO = 1,
579 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
580 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
581 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
582 V4L2_WHITE_BALANCE_HORIZON = 5,
583 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
584 V4L2_WHITE_BALANCE_FLASH = 7,
585 V4L2_WHITE_BALANCE_CLOUDY = 8,
586 V4L2_WHITE_BALANCE_SHADE = 9,
587};
588
589#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
590#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
591
592#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
593#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
594enum v4l2_iso_sensitivity_auto_type {
595 V4L2_ISO_SENSITIVITY_MANUAL = 0,
596 V4L2_ISO_SENSITIVITY_AUTO = 1,
597};
598
599#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
600enum v4l2_exposure_metering {
601 V4L2_EXPOSURE_METERING_AVERAGE = 0,
602 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
603 V4L2_EXPOSURE_METERING_SPOT = 2,
604};
605
606#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
607enum v4l2_scene_mode {
608 V4L2_SCENE_MODE_NONE = 0,
609 V4L2_SCENE_MODE_BACKLIGHT = 1,
610 V4L2_SCENE_MODE_BEACH_SNOW = 2,
611 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
612 V4L2_SCENE_MODE_DAWN_DUSK = 4,
613 V4L2_SCENE_MODE_FALL_COLORS = 5,
614 V4L2_SCENE_MODE_FIREWORKS = 6,
615 V4L2_SCENE_MODE_LANDSCAPE = 7,
616 V4L2_SCENE_MODE_NIGHT = 8,
617 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
618 V4L2_SCENE_MODE_PORTRAIT = 10,
619 V4L2_SCENE_MODE_SPORTS = 11,
620 V4L2_SCENE_MODE_SUNSET = 12,
621 V4L2_SCENE_MODE_TEXT = 13,
622};
623
624#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
625#define V4L2_LOCK_EXPOSURE (1 << 0)
626#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
627#define V4L2_LOCK_FOCUS (1 << 2)
628
629#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
630#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
631#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
632#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
633#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
634#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
635#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
636
637#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
638enum v4l2_auto_focus_range {
639 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
640 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
641 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
642 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
643};
644
645
646/* FM Modulator class control IDs */
647
648#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
649#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
650
651#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
652#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
653#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
654#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
655#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
656
657#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
658#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
659#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
660
661#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
662#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
663#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
664#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
665#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
666
667#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
668#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
669#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
670
671#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
672enum v4l2_preemphasis {
673 V4L2_PREEMPHASIS_DISABLED = 0,
674 V4L2_PREEMPHASIS_50_uS = 1,
675 V4L2_PREEMPHASIS_75_uS = 2,
676};
677#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
678#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
679
680
681/* Flash and privacy (indicator) light controls */
682
683#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
684#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
685
686#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
687enum v4l2_flash_led_mode {
688 V4L2_FLASH_LED_MODE_NONE,
689 V4L2_FLASH_LED_MODE_FLASH,
690 V4L2_FLASH_LED_MODE_TORCH,
691};
692
693#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
694enum v4l2_flash_strobe_source {
695 V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
696 V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
697};
698
699#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
700#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
701#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
702
703#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
704#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
705#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
706#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
707
708#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
709#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
710#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
711#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
712#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
713#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
714#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
715
716#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
717#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
718
719
720/* JPEG-class control IDs */
721
722#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
723#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
724
725#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
726enum v4l2_jpeg_chroma_subsampling {
727 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
728 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
729 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
730 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
731 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
732 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
733};
734#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
735#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
736
737#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
738#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
739#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
740#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
741#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
742#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
743
744/* Image source controls */
745#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
746#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
747
748#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
749#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
750#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
751
752
753/* Image processing controls */
754
755#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
756#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
757
758#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
759#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
760
761#endif
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 8c57ee9872bb..a33c4daadce3 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -148,6 +148,14 @@ struct v4l2_subdev_selection {
148 __u32 reserved[8]; 148 __u32 reserved[8];
149}; 149};
150 150
151struct v4l2_subdev_edid {
152 __u32 pad;
153 __u32 start_block;
154 __u32 blocks;
155 __u32 reserved[5];
156 __u8 __user *edid;
157};
158
151#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 159#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
152#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 160#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
153#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 161#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -166,5 +174,7 @@ struct v4l2_subdev_selection {
166 _IOWR('V', 61, struct v4l2_subdev_selection) 174 _IOWR('V', 61, struct v4l2_subdev_selection)
167#define VIDIOC_SUBDEV_S_SELECTION \ 175#define VIDIOC_SUBDEV_S_SELECTION \
168 _IOWR('V', 62, struct v4l2_subdev_selection) 176 _IOWR('V', 62, struct v4l2_subdev_selection)
177#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_subdev_edid)
178#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_subdev_edid)
169 179
170#endif 180#endif
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 7a147c8299ab..61395ef85a00 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Video for Linux Two header file 2 * Video for Linux Two header file
3 * 3 *
4 * Copyright (C) 1999-2007 the contributors 4 * Copyright (C) 1999-2012 the contributors
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -65,6 +65,7 @@
65#include <linux/ioctl.h> 65#include <linux/ioctl.h>
66#include <linux/types.h> 66#include <linux/types.h>
67#include <linux/v4l2-common.h> 67#include <linux/v4l2-common.h>
68#include <linux/v4l2-controls.h>
68 69
69/* 70/*
70 * Common stuff for both V4L1 and V4L2 71 * Common stuff for both V4L1 and V4L2
@@ -161,6 +162,7 @@ enum v4l2_buf_type {
161#endif 162#endif
162 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, 163 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
163 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, 164 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
165 /* Deprecated, do not use */
164 V4L2_BUF_TYPE_PRIVATE = 0x80, 166 V4L2_BUF_TYPE_PRIVATE = 0x80,
165}; 167};
166 168
@@ -368,6 +370,7 @@ struct v4l2_pix_format {
368 370
369/* three non contiguous planes - Y, Cb, Cr */ 371/* three non contiguous planes - Y, Cb, Cr */
370#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ 372#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
373#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1') /* 12 YVU420 planar */
371 374
372/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 375/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
373#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 376#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
@@ -1188,7 +1191,8 @@ struct v4l2_input {
1188 1191
1189/* capabilities flags */ 1192/* capabilities flags */
1190#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ 1193#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1191#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1194#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1195#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
1192#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ 1196#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
1193 1197
1194/* 1198/*
@@ -1211,7 +1215,8 @@ struct v4l2_output {
1211 1215
1212/* capabilities flags */ 1216/* capabilities flags */
1213#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ 1217#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1214#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ 1218#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1219#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
1215#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ 1220#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
1216 1221
1217/* 1222/*
@@ -1241,16 +1246,6 @@ struct v4l2_ext_controls {
1241 struct v4l2_ext_control *controls; 1246 struct v4l2_ext_control *controls;
1242}; 1247};
1243 1248
1244/* Values for ctrl_class field */
1245#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
1246#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
1247#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1248#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1249#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1250#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1251#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
1252#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
1253
1254#define V4L2_CTRL_ID_MASK (0x0fffffff) 1249#define V4L2_CTRL_ID_MASK (0x0fffffff)
1255#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1250#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
1256#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 1251#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
@@ -1306,692 +1301,31 @@ struct v4l2_querymenu {
1306 1301
1307/* User-class control IDs defined by V4L2 */ 1302/* User-class control IDs defined by V4L2 */
1308#define V4L2_CID_MAX_CTRLS 1024 1303#define V4L2_CID_MAX_CTRLS 1024
1309#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
1310#define V4L2_CID_USER_BASE V4L2_CID_BASE
1311/* IDs reserved for driver specific controls */ 1304/* IDs reserved for driver specific controls */
1312#define V4L2_CID_PRIVATE_BASE 0x08000000 1305#define V4L2_CID_PRIVATE_BASE 0x08000000
1313 1306
1314#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) 1307
1315#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) 1308/* DV-class control IDs defined by V4L2 */
1316#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) 1309#define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
1317#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) 1310#define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1)
1318#define V4L2_CID_HUE (V4L2_CID_BASE+3) 1311
1319#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) 1312#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1)
1320#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) 1313#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2)
1321#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) 1314#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3)
1322#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) 1315#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4)
1323#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) 1316enum v4l2_dv_tx_mode {
1324#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) 1317 V4L2_DV_TX_MODE_DVI_D = 0,
1325#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ 1318 V4L2_DV_TX_MODE_HDMI = 1,
1326#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) 1319};
1327#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) 1320#define V4L2_CID_DV_TX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 5)
1328#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) 1321enum v4l2_dv_rgb_range {
1329#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) 1322 V4L2_DV_RGB_RANGE_AUTO = 0,
1330#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) 1323 V4L2_DV_RGB_RANGE_LIMITED = 1,
1331#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ 1324 V4L2_DV_RGB_RANGE_FULL = 2,
1332#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) 1325};
1333#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) 1326
1334#define V4L2_CID_GAIN (V4L2_CID_BASE+19) 1327#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
1335#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) 1328#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)
1336#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
1337
1338/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
1339#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
1340#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
1341
1342#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
1343enum v4l2_power_line_frequency {
1344 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
1345 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
1346 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
1347 V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
1348};
1349#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
1350#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
1351#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
1352#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
1353#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
1354#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
1355#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
1356enum v4l2_colorfx {
1357 V4L2_COLORFX_NONE = 0,
1358 V4L2_COLORFX_BW = 1,
1359 V4L2_COLORFX_SEPIA = 2,
1360 V4L2_COLORFX_NEGATIVE = 3,
1361 V4L2_COLORFX_EMBOSS = 4,
1362 V4L2_COLORFX_SKETCH = 5,
1363 V4L2_COLORFX_SKY_BLUE = 6,
1364 V4L2_COLORFX_GRASS_GREEN = 7,
1365 V4L2_COLORFX_SKIN_WHITEN = 8,
1366 V4L2_COLORFX_VIVID = 9,
1367 V4L2_COLORFX_AQUA = 10,
1368 V4L2_COLORFX_ART_FREEZE = 11,
1369 V4L2_COLORFX_SILHOUETTE = 12,
1370 V4L2_COLORFX_SOLARIZATION = 13,
1371 V4L2_COLORFX_ANTIQUE = 14,
1372 V4L2_COLORFX_SET_CBCR = 15,
1373};
1374#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1375#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1376
1377#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1378#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1379
1380#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1381
1382#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
1383#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
1384
1385#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
1386#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1387
1388#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
1389#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
1390
1391/* last CID + 1 */
1392#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
1393
1394/* MPEG-class control IDs defined by V4L2 */
1395#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
1396#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
1397
1398/* MPEG streams, specific to multiplexed streams */
1399#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
1400enum v4l2_mpeg_stream_type {
1401 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
1402 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
1403 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
1404 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
1405 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
1406 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
1407};
1408#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
1409#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
1410#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
1411#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
1412#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
1413#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
1414#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
1415enum v4l2_mpeg_stream_vbi_fmt {
1416 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
1417 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
1418};
1419
1420/* MPEG audio controls specific to multiplexed streams */
1421#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
1422enum v4l2_mpeg_audio_sampling_freq {
1423 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
1424 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
1425 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
1426};
1427#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
1428enum v4l2_mpeg_audio_encoding {
1429 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
1430 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
1431 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
1432 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
1433 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
1434};
1435#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
1436enum v4l2_mpeg_audio_l1_bitrate {
1437 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
1438 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
1439 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
1440 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
1441 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
1442 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
1443 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
1444 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
1445 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
1446 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
1447 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
1448 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
1449 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
1450 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
1451};
1452#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
1453enum v4l2_mpeg_audio_l2_bitrate {
1454 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
1455 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
1456 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
1457 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
1458 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
1459 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
1460 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
1461 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
1462 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
1463 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
1464 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
1465 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
1466 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
1467 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
1468};
1469#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
1470enum v4l2_mpeg_audio_l3_bitrate {
1471 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
1472 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
1473 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
1474 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
1475 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
1476 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
1477 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
1478 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
1479 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
1480 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
1481 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
1482 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
1483 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
1484 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
1485};
1486#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
1487enum v4l2_mpeg_audio_mode {
1488 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
1489 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
1490 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
1491 V4L2_MPEG_AUDIO_MODE_MONO = 3,
1492};
1493#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
1494enum v4l2_mpeg_audio_mode_extension {
1495 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
1496 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
1497 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
1498 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
1499};
1500#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
1501enum v4l2_mpeg_audio_emphasis {
1502 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
1503 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
1504 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
1505};
1506#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
1507enum v4l2_mpeg_audio_crc {
1508 V4L2_MPEG_AUDIO_CRC_NONE = 0,
1509 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
1510};
1511#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
1512#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
1513#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
1514enum v4l2_mpeg_audio_ac3_bitrate {
1515 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
1516 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
1517 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
1518 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
1519 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
1520 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
1521 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
1522 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
1523 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
1524 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
1525 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
1526 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
1527 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
1528 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
1529 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
1530 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
1531 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
1532 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1533 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1534};
1535#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1536enum v4l2_mpeg_audio_dec_playback {
1537 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1538 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1539 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1540 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1541 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1542 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1543};
1544#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1545
1546/* MPEG video controls specific to multiplexed streams */
1547#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
1548enum v4l2_mpeg_video_encoding {
1549 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
1550 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
1551 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
1552};
1553#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
1554enum v4l2_mpeg_video_aspect {
1555 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
1556 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
1557 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
1558 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
1559};
1560#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
1561#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
1562#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
1563#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
1564#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
1565enum v4l2_mpeg_video_bitrate_mode {
1566 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
1567 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
1568};
1569#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
1570#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
1571#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1572#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1573#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1574#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
1575#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
1576#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
1577#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
1578#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
1579enum v4l2_mpeg_video_header_mode {
1580 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
1581 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
1582
1583};
1584#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
1585#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
1586#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
1587#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
1588#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
1589enum v4l2_mpeg_video_multi_slice_mode {
1590 V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
1591 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
1592 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1593};
1594#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1595#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1596#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1597
1598#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1599#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1600#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
1601#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
1602#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
1603#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
1604#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
1605#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
1606#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
1607#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
1608#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
1609#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
1610#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
1611enum v4l2_mpeg_video_h264_entropy_mode {
1612 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
1613 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
1614};
1615#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
1616#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
1617enum v4l2_mpeg_video_h264_level {
1618 V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
1619 V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
1620 V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
1621 V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
1622 V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
1623 V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
1624 V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
1625 V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
1626 V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
1627 V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
1628 V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
1629 V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
1630 V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
1631 V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
1632 V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
1633 V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
1634};
1635#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
1636#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
1637#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
1638enum v4l2_mpeg_video_h264_loop_filter_mode {
1639 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
1640 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
1641 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
1642};
1643#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
1644enum v4l2_mpeg_video_h264_profile {
1645 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
1646 V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
1647 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
1648 V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
1649 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
1650 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
1651 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
1652 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
1653 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
1654 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
1655 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
1656 V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
1657 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
1658 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
1659 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
1660 V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
1661 V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
1662};
1663#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
1664#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
1665#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
1666#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
1667enum v4l2_mpeg_video_h264_vui_sar_idc {
1668 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
1669 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
1670 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
1671 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
1672 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
1673 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
1674 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
1675 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
1676 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
1677 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
1678 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
1679 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
1680 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
1681 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
1682 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
1683 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
1684 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
1685 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
1686};
1687#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
1688#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
1689#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
1690#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
1691#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
1692#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
1693enum v4l2_mpeg_video_mpeg4_level {
1694 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
1695 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
1696 V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
1697 V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
1698 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
1699 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
1700 V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
1701 V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
1702};
1703#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
1704enum v4l2_mpeg_video_mpeg4_profile {
1705 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
1706 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
1707 V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
1708 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
1709 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
1710};
1711#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
1712
1713/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
1714#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
1715#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
1716enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
1717 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
1718 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
1719};
1720#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
1721#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
1722enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
1723 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
1724 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
1725 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
1726 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
1727 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
1728};
1729#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
1730enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
1731 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
1732 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
1733};
1734#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
1735enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
1736 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
1737 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
1738};
1739#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
1740#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
1741enum v4l2_mpeg_cx2341x_video_median_filter_type {
1742 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
1743 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
1744 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
1745 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
1746 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
1747};
1748#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
1749#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
1750#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
1751#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1752#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1753
1754/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
1755#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
1756
1757#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
1758#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
1759#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
1760enum v4l2_mpeg_mfc51_video_frame_skip_mode {
1761 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
1762 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
1763 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
1764};
1765#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
1766enum v4l2_mpeg_mfc51_video_force_frame_type {
1767 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
1768 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
1769 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
1770};
1771#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
1772#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
1773#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
1774#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
1775#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
1776#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
1777#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
1778#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
1779#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
1780
1781/* Camera class control IDs */
1782#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
1783#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
1784
1785#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
1786enum v4l2_exposure_auto_type {
1787 V4L2_EXPOSURE_AUTO = 0,
1788 V4L2_EXPOSURE_MANUAL = 1,
1789 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
1790 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
1791};
1792#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
1793#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
1794
1795#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
1796#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
1797#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
1798#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
1799
1800#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
1801#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
1802
1803#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
1804#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
1805#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
1806
1807#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
1808#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
1809#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
1810
1811#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1812
1813#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1814#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1815
1816#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
1817
1818#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
1819enum v4l2_auto_n_preset_white_balance {
1820 V4L2_WHITE_BALANCE_MANUAL = 0,
1821 V4L2_WHITE_BALANCE_AUTO = 1,
1822 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
1823 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
1824 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
1825 V4L2_WHITE_BALANCE_HORIZON = 5,
1826 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
1827 V4L2_WHITE_BALANCE_FLASH = 7,
1828 V4L2_WHITE_BALANCE_CLOUDY = 8,
1829 V4L2_WHITE_BALANCE_SHADE = 9,
1830};
1831
1832#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
1833#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
1834
1835#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
1836#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
1837enum v4l2_iso_sensitivity_auto_type {
1838 V4L2_ISO_SENSITIVITY_MANUAL = 0,
1839 V4L2_ISO_SENSITIVITY_AUTO = 1,
1840};
1841
1842#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
1843enum v4l2_exposure_metering {
1844 V4L2_EXPOSURE_METERING_AVERAGE = 0,
1845 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
1846 V4L2_EXPOSURE_METERING_SPOT = 2,
1847};
1848
1849#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
1850enum v4l2_scene_mode {
1851 V4L2_SCENE_MODE_NONE = 0,
1852 V4L2_SCENE_MODE_BACKLIGHT = 1,
1853 V4L2_SCENE_MODE_BEACH_SNOW = 2,
1854 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
1855 V4L2_SCENE_MODE_DAWN_DUSK = 4,
1856 V4L2_SCENE_MODE_FALL_COLORS = 5,
1857 V4L2_SCENE_MODE_FIREWORKS = 6,
1858 V4L2_SCENE_MODE_LANDSCAPE = 7,
1859 V4L2_SCENE_MODE_NIGHT = 8,
1860 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
1861 V4L2_SCENE_MODE_PORTRAIT = 10,
1862 V4L2_SCENE_MODE_SPORTS = 11,
1863 V4L2_SCENE_MODE_SUNSET = 12,
1864 V4L2_SCENE_MODE_TEXT = 13,
1865};
1866
1867#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
1868#define V4L2_LOCK_EXPOSURE (1 << 0)
1869#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
1870#define V4L2_LOCK_FOCUS (1 << 2)
1871
1872#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
1873#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
1874#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
1875#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
1876#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
1877#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
1878#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
1879
1880#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
1881enum v4l2_auto_focus_range {
1882 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
1883 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
1884 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
1885 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
1886};
1887
1888/* FM Modulator class control IDs */
1889#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1890#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
1891
1892#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
1893#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
1894#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
1895#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
1896#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
1897
1898#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
1899#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
1900#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
1901
1902#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
1903#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
1904#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
1905#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
1906#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
1907
1908#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
1909#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
1910#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
1911
1912#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
1913enum v4l2_preemphasis {
1914 V4L2_PREEMPHASIS_DISABLED = 0,
1915 V4L2_PREEMPHASIS_50_uS = 1,
1916 V4L2_PREEMPHASIS_75_uS = 2,
1917};
1918#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
1919#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
1920
1921/* Flash and privacy (indicator) light controls */
1922#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
1923#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
1924
1925#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
1926enum v4l2_flash_led_mode {
1927 V4L2_FLASH_LED_MODE_NONE,
1928 V4L2_FLASH_LED_MODE_FLASH,
1929 V4L2_FLASH_LED_MODE_TORCH,
1930};
1931
1932#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
1933enum v4l2_flash_strobe_source {
1934 V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
1935 V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
1936};
1937
1938#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
1939#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
1940#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
1941
1942#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
1943#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
1944#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
1945#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
1946
1947#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
1948#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
1949#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
1950#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
1951#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
1952#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
1953#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
1954
1955#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1956#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1957
1958/* JPEG-class control IDs defined by V4L2 */
1959#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1960#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
1961
1962#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1963enum v4l2_jpeg_chroma_subsampling {
1964 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1965 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
1966 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
1967 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
1968 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1969 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1970};
1971#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1972#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
1973
1974#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1975#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1976#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1977#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1978#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1979#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1980
1981/* Image source controls */
1982#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
1983#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
1984
1985#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
1986#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
1987#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
1988
1989/* Image processing controls */
1990#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
1991#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
1992
1993#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
1994#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
1995 1329
1996/* 1330/*
1997 * T U N I N G 1331 * T U N I N G
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index a1ba8bbd9fbe..533b1157f22e 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -50,6 +50,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 50
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 51unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 52
53int virtqueue_get_queue_index(struct virtqueue *vq);
54
53/** 55/**
54 * virtio_device - representation of a device using virtio 56 * virtio_device - representation of a device using virtio
55 * @index: unique position on the virtio bus 57 * @index: unique position on the virtio bus
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index fc457f452f64..e2850a7ea276 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -84,7 +84,9 @@
84 * nvqs: the number of virtqueues to find 84 * nvqs: the number of virtqueues to find
85 * vqs: on success, includes new virtqueues 85 * vqs: on success, includes new virtqueues
86 * callbacks: array of callbacks, for each virtqueue 86 * callbacks: array of callbacks, for each virtqueue
87 * include a NULL entry for vqs that do not need a callback
87 * names: array of virtqueue names (mainly for debugging) 88 * names: array of virtqueue names (mainly for debugging)
89 * include a NULL entry for vqs unused by driver
88 * Returns 0 on success or error status 90 * Returns 0 on success or error status
89 * @del_vqs: free virtqueues found by find_vqs(). 91 * @del_vqs: free virtqueues found by find_vqs().
90 * @get_features: get the array of feature bits for this device. 92 * @get_features: get the array of feature bits for this device.
@@ -98,6 +100,7 @@
98 * vdev: the virtio_device 100 * vdev: the virtio_device
99 * This returns a pointer to the bus name a la pci_name from which 101 * This returns a pointer to the bus name a la pci_name from which
100 * the caller can then copy. 102 * the caller can then copy.
103 * @set_vq_affinity: set the affinity for a virtqueue.
101 */ 104 */
102typedef void vq_callback_t(struct virtqueue *); 105typedef void vq_callback_t(struct virtqueue *);
103struct virtio_config_ops { 106struct virtio_config_ops {
@@ -116,6 +119,7 @@ struct virtio_config_ops {
116 u32 (*get_features)(struct virtio_device *vdev); 119 u32 (*get_features)(struct virtio_device *vdev);
117 void (*finalize_features)(struct virtio_device *vdev); 120 void (*finalize_features)(struct virtio_device *vdev);
118 const char *(*bus_name)(struct virtio_device *vdev); 121 const char *(*bus_name)(struct virtio_device *vdev);
122 int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
119}; 123};
120 124
121/* If driver didn't advertise the feature, it will never appear. */ 125/* If driver didn't advertise the feature, it will never appear. */
@@ -190,5 +194,24 @@ const char *virtio_bus_name(struct virtio_device *vdev)
190 return vdev->config->bus_name(vdev); 194 return vdev->config->bus_name(vdev);
191} 195}
192 196
197/**
198 * virtqueue_set_affinity - setting affinity for a virtqueue
199 * @vq: the virtqueue
200 * @cpu: the cpu no.
201 *
202 * Pay attention the function are best-effort: the affinity hint may not be set
203 * due to config support, irq type and sharing.
204 *
205 */
206static inline
207int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
208{
209 struct virtio_device *vdev = vq->vdev;
210 if (vdev->config->set_vq_affinity)
211 return vdev->config->set_vq_affinity(vq, cpu);
212 return 0;
213}
214
215
193#endif /* __KERNEL__ */ 216#endif /* __KERNEL__ */
194#endif /* _LINUX_VIRTIO_CONFIG_H */ 217#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e338730c2660..c2d793a06ad7 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -165,7 +165,8 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
165struct virtio_device; 165struct virtio_device;
166struct virtqueue; 166struct virtqueue;
167 167
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int index,
169 unsigned int num,
169 unsigned int vring_align, 170 unsigned int vring_align,
170 struct virtio_device *vdev, 171 struct virtio_device *vdev,
171 bool weak_barriers, 172 bool weak_barriers,
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 57f7b1091511..3d3114594370 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -52,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
52 UNEVICTABLE_PGMUNLOCKED, 52 UNEVICTABLE_PGMUNLOCKED,
53 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 53 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
54 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 54 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
55 UNEVICTABLE_MLOCKFREED,
56#ifdef CONFIG_TRANSPARENT_HUGEPAGE 55#ifdef CONFIG_TRANSPARENT_HUGEPAGE
57 THP_FAULT_ALLOC, 56 THP_FAULT_ALLOC,
58 THP_FAULT_FALLBACK, 57 THP_FAULT_FALLBACK,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index ad2cfd53dadc..92a86b2cce33 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -198,6 +198,8 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item);
198void refresh_cpu_vm_stats(int); 198void refresh_cpu_vm_stats(int);
199void refresh_zone_stat_thresholds(void); 199void refresh_zone_stat_thresholds(void);
200 200
201void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
202
201int calculate_pressure_threshold(struct zone *zone); 203int calculate_pressure_threshold(struct zone *zone);
202int calculate_normal_threshold(struct zone *zone); 204int calculate_normal_threshold(struct zone *zone);
203void set_pgdat_percpu_threshold(pg_data_t *pgdat, 205void set_pgdat_percpu_threshold(pg_data_t *pgdat,
@@ -251,8 +253,18 @@ static inline void __dec_zone_page_state(struct page *page,
251static inline void refresh_cpu_vm_stats(int cpu) { } 253static inline void refresh_cpu_vm_stats(int cpu) { }
252static inline void refresh_zone_stat_thresholds(void) { } 254static inline void refresh_zone_stat_thresholds(void) { }
253 255
256static inline void drain_zonestat(struct zone *zone,
257 struct per_cpu_pageset *pset) { }
254#endif /* CONFIG_SMP */ 258#endif /* CONFIG_SMP */
255 259
260static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,
261 int migratetype)
262{
263 __mod_zone_page_state(zone, NR_FREE_PAGES, nr_pages);
264 if (is_migrate_cma(migratetype))
265 __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, nr_pages);
266}
267
256extern const char * const vmstat_text[]; 268extern const char * const vmstat_text[];
257 269
258#endif /* _LINUX_VMSTAT_H */ 270#endif /* _LINUX_VMSTAT_H */
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
index 3adeff82212f..065e3ae79ab0 100644
--- a/include/linux/w1-gpio.h
+++ b/include/linux/w1-gpio.h
@@ -19,6 +19,7 @@ struct w1_gpio_platform_data {
19 unsigned int pin; 19 unsigned int pin;
20 unsigned int is_open_drain:1; 20 unsigned int is_open_drain:1;
21 void (*enable_external_pullup)(int enable); 21 void (*enable_external_pullup)(int enable);
22 unsigned int ext_pullup_enable_pin;
22}; 23};
23 24
24#endif /* _LINUX_W1_GPIO_H */ 25#endif /* _LINUX_W1_GPIO_H */
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index af155450cabb..2b58905d3504 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -16,6 +16,7 @@ struct workqueue_struct;
16 16
17struct work_struct; 17struct work_struct;
18typedef void (*work_func_t)(struct work_struct *work); 18typedef void (*work_func_t)(struct work_struct *work);
19void delayed_work_timer_fn(unsigned long __data);
19 20
20/* 21/*
21 * The first word is the work queue pointer and the flags rolled into 22 * The first word is the work queue pointer and the flags rolled into
@@ -67,9 +68,18 @@ enum {
67 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT + 68 WORK_STRUCT_FLAG_BITS = WORK_STRUCT_COLOR_SHIFT +
68 WORK_STRUCT_COLOR_BITS, 69 WORK_STRUCT_COLOR_BITS,
69 70
71 /* data contains off-queue information when !WORK_STRUCT_CWQ */
72 WORK_OFFQ_FLAG_BASE = WORK_STRUCT_FLAG_BITS,
73
74 WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE),
75
76 WORK_OFFQ_FLAG_BITS = 1,
77 WORK_OFFQ_CPU_SHIFT = WORK_OFFQ_FLAG_BASE + WORK_OFFQ_FLAG_BITS,
78
79 /* convenience constants */
70 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1, 80 WORK_STRUCT_FLAG_MASK = (1UL << WORK_STRUCT_FLAG_BITS) - 1,
71 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK, 81 WORK_STRUCT_WQ_DATA_MASK = ~WORK_STRUCT_FLAG_MASK,
72 WORK_STRUCT_NO_CPU = WORK_CPU_NONE << WORK_STRUCT_FLAG_BITS, 82 WORK_STRUCT_NO_CPU = (unsigned long)WORK_CPU_NONE << WORK_OFFQ_CPU_SHIFT,
73 83
74 /* bit mask for work_busy() return values */ 84 /* bit mask for work_busy() return values */
75 WORK_BUSY_PENDING = 1 << 0, 85 WORK_BUSY_PENDING = 1 << 0,
@@ -92,6 +102,7 @@ struct work_struct {
92struct delayed_work { 102struct delayed_work {
93 struct work_struct work; 103 struct work_struct work;
94 struct timer_list timer; 104 struct timer_list timer;
105 int cpu;
95}; 106};
96 107
97static inline struct delayed_work *to_delayed_work(struct work_struct *work) 108static inline struct delayed_work *to_delayed_work(struct work_struct *work)
@@ -115,41 +126,38 @@ struct execute_work {
115#define __WORK_INIT_LOCKDEP_MAP(n, k) 126#define __WORK_INIT_LOCKDEP_MAP(n, k)
116#endif 127#endif
117 128
118#define __WORK_INITIALIZER(n, f) { \ 129#define __WORK_INITIALIZER(n, f) { \
119 .data = WORK_DATA_STATIC_INIT(), \ 130 .data = WORK_DATA_STATIC_INIT(), \
120 .entry = { &(n).entry, &(n).entry }, \ 131 .entry = { &(n).entry, &(n).entry }, \
121 .func = (f), \ 132 .func = (f), \
122 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \ 133 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \
123 } 134 }
124 135
125#define __DELAYED_WORK_INITIALIZER(n, f) { \ 136#define __DELAYED_WORK_INITIALIZER(n, f, tflags) { \
126 .work = __WORK_INITIALIZER((n).work, (f)), \ 137 .work = __WORK_INITIALIZER((n).work, (f)), \
127 .timer = TIMER_INITIALIZER(NULL, 0, 0), \ 138 .timer = __TIMER_INITIALIZER(delayed_work_timer_fn, \
139 0, (unsigned long)&(n), \
140 (tflags) | TIMER_IRQSAFE), \
128 } 141 }
129 142
130#define __DEFERRED_WORK_INITIALIZER(n, f) { \ 143#define DECLARE_WORK(n, f) \
131 .work = __WORK_INITIALIZER((n).work, (f)), \
132 .timer = TIMER_DEFERRED_INITIALIZER(NULL, 0, 0), \
133 }
134
135#define DECLARE_WORK(n, f) \
136 struct work_struct n = __WORK_INITIALIZER(n, f) 144 struct work_struct n = __WORK_INITIALIZER(n, f)
137 145
138#define DECLARE_DELAYED_WORK(n, f) \ 146#define DECLARE_DELAYED_WORK(n, f) \
139 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f) 147 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, 0)
140 148
141#define DECLARE_DEFERRED_WORK(n, f) \ 149#define DECLARE_DEFERRABLE_WORK(n, f) \
142 struct delayed_work n = __DEFERRED_WORK_INITIALIZER(n, f) 150 struct delayed_work n = __DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
143 151
144/* 152/*
145 * initialize a work item's function pointer 153 * initialize a work item's function pointer
146 */ 154 */
147#define PREPARE_WORK(_work, _func) \ 155#define PREPARE_WORK(_work, _func) \
148 do { \ 156 do { \
149 (_work)->func = (_func); \ 157 (_work)->func = (_func); \
150 } while (0) 158 } while (0)
151 159
152#define PREPARE_DELAYED_WORK(_work, _func) \ 160#define PREPARE_DELAYED_WORK(_work, _func) \
153 PREPARE_WORK(&(_work)->work, (_func)) 161 PREPARE_WORK(&(_work)->work, (_func))
154 162
155#ifdef CONFIG_DEBUG_OBJECTS_WORK 163#ifdef CONFIG_DEBUG_OBJECTS_WORK
@@ -179,7 +187,7 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
179 \ 187 \
180 __init_work((_work), _onstack); \ 188 __init_work((_work), _onstack); \
181 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 189 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
182 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\ 190 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0); \
183 INIT_LIST_HEAD(&(_work)->entry); \ 191 INIT_LIST_HEAD(&(_work)->entry); \
184 PREPARE_WORK((_work), (_func)); \ 192 PREPARE_WORK((_work), (_func)); \
185 } while (0) 193 } while (0)
@@ -193,33 +201,44 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
193 } while (0) 201 } while (0)
194#endif 202#endif
195 203
196#define INIT_WORK(_work, _func) \ 204#define INIT_WORK(_work, _func) \
197 do { \ 205 do { \
198 __INIT_WORK((_work), (_func), 0); \ 206 __INIT_WORK((_work), (_func), 0); \
199 } while (0) 207 } while (0)
200 208
201#define INIT_WORK_ONSTACK(_work, _func) \ 209#define INIT_WORK_ONSTACK(_work, _func) \
202 do { \ 210 do { \
203 __INIT_WORK((_work), (_func), 1); \ 211 __INIT_WORK((_work), (_func), 1); \
204 } while (0) 212 } while (0)
205 213
206#define INIT_DELAYED_WORK(_work, _func) \ 214#define __INIT_DELAYED_WORK(_work, _func, _tflags) \
207 do { \ 215 do { \
208 INIT_WORK(&(_work)->work, (_func)); \ 216 INIT_WORK(&(_work)->work, (_func)); \
209 init_timer(&(_work)->timer); \ 217 __setup_timer(&(_work)->timer, delayed_work_timer_fn, \
218 (unsigned long)(_work), \
219 (_tflags) | TIMER_IRQSAFE); \
210 } while (0) 220 } while (0)
211 221
212#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \ 222#define __INIT_DELAYED_WORK_ONSTACK(_work, _func, _tflags) \
213 do { \ 223 do { \
214 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ 224 INIT_WORK_ONSTACK(&(_work)->work, (_func)); \
215 init_timer_on_stack(&(_work)->timer); \ 225 __setup_timer_on_stack(&(_work)->timer, \
226 delayed_work_timer_fn, \
227 (unsigned long)(_work), \
228 (_tflags) | TIMER_IRQSAFE); \
216 } while (0) 229 } while (0)
217 230
218#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ 231#define INIT_DELAYED_WORK(_work, _func) \
219 do { \ 232 __INIT_DELAYED_WORK(_work, _func, 0)
220 INIT_WORK(&(_work)->work, (_func)); \ 233
221 init_timer_deferrable(&(_work)->timer); \ 234#define INIT_DELAYED_WORK_ONSTACK(_work, _func) \
222 } while (0) 235 __INIT_DELAYED_WORK_ONSTACK(_work, _func, 0)
236
237#define INIT_DEFERRABLE_WORK(_work, _func) \
238 __INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE)
239
240#define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \
241 __INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)
223 242
224/** 243/**
225 * work_pending - Find out whether a work item is currently pending 244 * work_pending - Find out whether a work item is currently pending
@@ -278,10 +297,6 @@ enum {
278 * system_long_wq is similar to system_wq but may host long running 297 * system_long_wq is similar to system_wq but may host long running
279 * works. Queue flushing might take relatively long. 298 * works. Queue flushing might take relatively long.
280 * 299 *
281 * system_nrt_wq is non-reentrant and guarantees that any given work
282 * item is never executed in parallel by multiple CPUs. Queue
283 * flushing might take relatively long.
284 *
285 * system_unbound_wq is unbound workqueue. Workers are not bound to 300 * system_unbound_wq is unbound workqueue. Workers are not bound to
286 * any specific CPU, not concurrency managed, and all queued works are 301 * any specific CPU, not concurrency managed, and all queued works are
287 * executed immediately as long as max_active limit is not reached and 302 * executed immediately as long as max_active limit is not reached and
@@ -289,16 +304,25 @@ enum {
289 * 304 *
290 * system_freezable_wq is equivalent to system_wq except that it's 305 * system_freezable_wq is equivalent to system_wq except that it's
291 * freezable. 306 * freezable.
292 *
293 * system_nrt_freezable_wq is equivalent to system_nrt_wq except that
294 * it's freezable.
295 */ 307 */
296extern struct workqueue_struct *system_wq; 308extern struct workqueue_struct *system_wq;
297extern struct workqueue_struct *system_long_wq; 309extern struct workqueue_struct *system_long_wq;
298extern struct workqueue_struct *system_nrt_wq;
299extern struct workqueue_struct *system_unbound_wq; 310extern struct workqueue_struct *system_unbound_wq;
300extern struct workqueue_struct *system_freezable_wq; 311extern struct workqueue_struct *system_freezable_wq;
301extern struct workqueue_struct *system_nrt_freezable_wq; 312
313static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
314{
315 return system_wq;
316}
317
318static inline struct workqueue_struct * __deprecated __system_nrt_freezable_wq(void)
319{
320 return system_freezable_wq;
321}
322
323/* equivlalent to system_wq and system_freezable_wq, deprecated */
324#define system_nrt_wq __system_nrt_wq()
325#define system_nrt_freezable_wq __system_nrt_freezable_wq()
302 326
303extern struct workqueue_struct * 327extern struct workqueue_struct *
304__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active, 328__alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
@@ -321,22 +345,22 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
321 * Pointer to the allocated workqueue on success, %NULL on failure. 345 * Pointer to the allocated workqueue on success, %NULL on failure.
322 */ 346 */
323#ifdef CONFIG_LOCKDEP 347#ifdef CONFIG_LOCKDEP
324#define alloc_workqueue(fmt, flags, max_active, args...) \ 348#define alloc_workqueue(fmt, flags, max_active, args...) \
325({ \ 349({ \
326 static struct lock_class_key __key; \ 350 static struct lock_class_key __key; \
327 const char *__lock_name; \ 351 const char *__lock_name; \
328 \ 352 \
329 if (__builtin_constant_p(fmt)) \ 353 if (__builtin_constant_p(fmt)) \
330 __lock_name = (fmt); \ 354 __lock_name = (fmt); \
331 else \ 355 else \
332 __lock_name = #fmt; \ 356 __lock_name = #fmt; \
333 \ 357 \
334 __alloc_workqueue_key((fmt), (flags), (max_active), \ 358 __alloc_workqueue_key((fmt), (flags), (max_active), \
335 &__key, __lock_name, ##args); \ 359 &__key, __lock_name, ##args); \
336}) 360})
337#else 361#else
338#define alloc_workqueue(fmt, flags, max_active, args...) \ 362#define alloc_workqueue(fmt, flags, max_active, args...) \
339 __alloc_workqueue_key((fmt), (flags), (max_active), \ 363 __alloc_workqueue_key((fmt), (flags), (max_active), \
340 NULL, NULL, ##args) 364 NULL, NULL, ##args)
341#endif 365#endif
342 366
@@ -353,46 +377,50 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
353 * RETURNS: 377 * RETURNS:
354 * Pointer to the allocated workqueue on success, %NULL on failure. 378 * Pointer to the allocated workqueue on success, %NULL on failure.
355 */ 379 */
356#define alloc_ordered_workqueue(fmt, flags, args...) \ 380#define alloc_ordered_workqueue(fmt, flags, args...) \
357 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) 381 alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args)
358 382
359#define create_workqueue(name) \ 383#define create_workqueue(name) \
360 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 384 alloc_workqueue((name), WQ_MEM_RECLAIM, 1)
361#define create_freezable_workqueue(name) \ 385#define create_freezable_workqueue(name) \
362 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 386 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
363#define create_singlethread_workqueue(name) \ 387#define create_singlethread_workqueue(name) \
364 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 388 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1)
365 389
366extern void destroy_workqueue(struct workqueue_struct *wq); 390extern void destroy_workqueue(struct workqueue_struct *wq);
367 391
368extern int queue_work(struct workqueue_struct *wq, struct work_struct *work); 392extern bool queue_work_on(int cpu, struct workqueue_struct *wq,
369extern int queue_work_on(int cpu, struct workqueue_struct *wq,
370 struct work_struct *work); 393 struct work_struct *work);
371extern int queue_delayed_work(struct workqueue_struct *wq, 394extern bool queue_work(struct workqueue_struct *wq, struct work_struct *work);
395extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
372 struct delayed_work *work, unsigned long delay); 396 struct delayed_work *work, unsigned long delay);
373extern int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, 397extern bool queue_delayed_work(struct workqueue_struct *wq,
374 struct delayed_work *work, unsigned long delay); 398 struct delayed_work *work, unsigned long delay);
399extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
400 struct delayed_work *dwork, unsigned long delay);
401extern bool mod_delayed_work(struct workqueue_struct *wq,
402 struct delayed_work *dwork, unsigned long delay);
375 403
376extern void flush_workqueue(struct workqueue_struct *wq); 404extern void flush_workqueue(struct workqueue_struct *wq);
377extern void drain_workqueue(struct workqueue_struct *wq); 405extern void drain_workqueue(struct workqueue_struct *wq);
378extern void flush_scheduled_work(void); 406extern void flush_scheduled_work(void);
379 407
380extern int schedule_work(struct work_struct *work); 408extern bool schedule_work_on(int cpu, struct work_struct *work);
381extern int schedule_work_on(int cpu, struct work_struct *work); 409extern bool schedule_work(struct work_struct *work);
382extern int schedule_delayed_work(struct delayed_work *work, unsigned long delay); 410extern bool schedule_delayed_work_on(int cpu, struct delayed_work *work,
383extern int schedule_delayed_work_on(int cpu, struct delayed_work *work, 411 unsigned long delay);
384 unsigned long delay); 412extern bool schedule_delayed_work(struct delayed_work *work,
413 unsigned long delay);
385extern int schedule_on_each_cpu(work_func_t func); 414extern int schedule_on_each_cpu(work_func_t func);
386extern int keventd_up(void); 415extern int keventd_up(void);
387 416
388int execute_in_process_context(work_func_t fn, struct execute_work *); 417int execute_in_process_context(work_func_t fn, struct execute_work *);
389 418
390extern bool flush_work(struct work_struct *work); 419extern bool flush_work(struct work_struct *work);
391extern bool flush_work_sync(struct work_struct *work);
392extern bool cancel_work_sync(struct work_struct *work); 420extern bool cancel_work_sync(struct work_struct *work);
393 421
394extern bool flush_delayed_work(struct delayed_work *dwork); 422extern bool flush_delayed_work(struct delayed_work *dwork);
395extern bool flush_delayed_work_sync(struct delayed_work *work); 423extern bool cancel_delayed_work(struct delayed_work *dwork);
396extern bool cancel_delayed_work_sync(struct delayed_work *dwork); 424extern bool cancel_delayed_work_sync(struct delayed_work *dwork);
397 425
398extern void workqueue_set_max_active(struct workqueue_struct *wq, 426extern void workqueue_set_max_active(struct workqueue_struct *wq,
@@ -402,27 +430,11 @@ extern unsigned int work_cpu(struct work_struct *work);
402extern unsigned int work_busy(struct work_struct *work); 430extern unsigned int work_busy(struct work_struct *work);
403 431
404/* 432/*
405 * Kill off a pending schedule_delayed_work(). Note that the work callback
406 * function may still be running on return from cancel_delayed_work(), unless
407 * it returns 1 and the work doesn't re-arm itself. Run flush_workqueue() or
408 * cancel_work_sync() to wait on it.
409 */
410static inline bool cancel_delayed_work(struct delayed_work *work)
411{
412 bool ret;
413
414 ret = del_timer_sync(&work->timer);
415 if (ret)
416 work_clear_pending(&work->work);
417 return ret;
418}
419
420/*
421 * Like above, but uses del_timer() instead of del_timer_sync(). This means, 433 * Like above, but uses del_timer() instead of del_timer_sync(). This means,
422 * if it returns 0 the timer function may be running and the queueing is in 434 * if it returns 0 the timer function may be running and the queueing is in
423 * progress. 435 * progress.
424 */ 436 */
425static inline bool __cancel_delayed_work(struct delayed_work *work) 437static inline bool __deprecated __cancel_delayed_work(struct delayed_work *work)
426{ 438{
427 bool ret; 439 bool ret;
428 440
@@ -432,6 +444,18 @@ static inline bool __cancel_delayed_work(struct delayed_work *work)
432 return ret; 444 return ret;
433} 445}
434 446
447/* used to be different but now identical to flush_work(), deprecated */
448static inline bool __deprecated flush_work_sync(struct work_struct *work)
449{
450 return flush_work(work);
451}
452
453/* used to be different but now identical to flush_delayed_work(), deprecated */
454static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwork)
455{
456 return flush_delayed_work(dwork);
457}
458
435#ifndef CONFIG_SMP 459#ifndef CONFIG_SMP
436static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) 460static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
437{ 461{
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index e5d122031542..cc13e1115970 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -33,6 +33,9 @@
33#define XATTR_EVM_SUFFIX "evm" 33#define XATTR_EVM_SUFFIX "evm"
34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX 34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX
35 35
36#define XATTR_IMA_SUFFIX "ima"
37#define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX
38
36#define XATTR_SELINUX_SUFFIX "selinux" 39#define XATTR_SELINUX_SUFFIX "selinux"
37#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX 40#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
38 41
@@ -59,7 +62,9 @@
59 62
60#ifdef __KERNEL__ 63#ifdef __KERNEL__
61 64
65#include <linux/slab.h>
62#include <linux/types.h> 66#include <linux/types.h>
67#include <linux/spinlock.h>
63 68
64struct inode; 69struct inode;
65struct dentry; 70struct dentry;
@@ -96,6 +101,52 @@ ssize_t vfs_getxattr_alloc(struct dentry *dentry, const char *name,
96 char **xattr_value, size_t size, gfp_t flags); 101 char **xattr_value, size_t size, gfp_t flags);
97int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name, 102int vfs_xattr_cmp(struct dentry *dentry, const char *xattr_name,
98 const char *value, size_t size, gfp_t flags); 103 const char *value, size_t size, gfp_t flags);
104
105struct simple_xattrs {
106 struct list_head head;
107 spinlock_t lock;
108};
109
110struct simple_xattr {
111 struct list_head list;
112 char *name;
113 size_t size;
114 char value[0];
115};
116
117/*
118 * initialize the simple_xattrs structure
119 */
120static inline void simple_xattrs_init(struct simple_xattrs *xattrs)
121{
122 INIT_LIST_HEAD(&xattrs->head);
123 spin_lock_init(&xattrs->lock);
124}
125
126/*
127 * free all the xattrs
128 */
129static inline void simple_xattrs_free(struct simple_xattrs *xattrs)
130{
131 struct simple_xattr *xattr, *node;
132
133 list_for_each_entry_safe(xattr, node, &xattrs->head, list) {
134 kfree(xattr->name);
135 kfree(xattr);
136 }
137}
138
139struct simple_xattr *simple_xattr_alloc(const void *value, size_t size);
140int simple_xattr_get(struct simple_xattrs *xattrs, const char *name,
141 void *buffer, size_t size);
142int simple_xattr_set(struct simple_xattrs *xattrs, const char *name,
143 const void *value, size_t size, int flags);
144int simple_xattr_remove(struct simple_xattrs *xattrs, const char *name);
145ssize_t simple_xattr_list(struct simple_xattrs *xattrs, char *buffer,
146 size_t size);
147void simple_xattr_list_add(struct simple_xattrs *xattrs,
148 struct simple_xattr *new_xattr);
149
99#endif /* __KERNEL__ */ 150#endif /* __KERNEL__ */
100 151
101#endif /* _LINUX_XATTR_H */ 152#endif /* _LINUX_XATTR_H */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 22e61fdf75a2..28e493b5b94c 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -84,6 +84,8 @@ struct xfrm_replay_state {
84 __u32 bitmap; 84 __u32 bitmap;
85}; 85};
86 86
87#define XFRMA_REPLAY_ESN_MAX 4096
88
87struct xfrm_replay_state_esn { 89struct xfrm_replay_state_esn {
88 unsigned int bmp_len; 90 unsigned int bmp_len;
89 __u32 oseq; 91 __u32 oseq;
diff --git a/include/media/ad9389b.h b/include/media/ad9389b.h
new file mode 100644
index 000000000000..5ba9af869b8b
--- /dev/null
+++ b/include/media/ad9389b.h
@@ -0,0 +1,49 @@
1/*
2 * Analog Devices AD9389B/AD9889B video encoder driver header
3 *
4 * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 */
19
20#ifndef AD9389B_H
21#define AD9389B_H
22
23enum ad9389b_tmds_pll_gear {
24 AD9389B_TMDS_PLL_GEAR_AUTOMATIC,
25 AD9389B_TMDS_PLL_GEAR_SEMI_AUTOMATIC,
26};
27
28/* Platform dependent definitions */
29struct ad9389b_platform_data {
30 enum ad9389b_tmds_pll_gear tmds_pll_gear ;
31 /* Differential Data/Clock Output Drive Strength (reg. 0xa2/0xa3) */
32 u8 diff_data_drive_strength;
33 u8 diff_clk_drive_strength;
34};
35
36/* notify events */
37#define AD9389B_MONITOR_DETECT 0
38#define AD9389B_EDID_DETECT 1
39
40struct ad9389b_monitor_detect {
41 int present;
42};
43
44struct ad9389b_edid_detect {
45 int present;
46 int segment;
47};
48
49#endif
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
new file mode 100644
index 000000000000..171b957db743
--- /dev/null
+++ b/include/media/adv7604.h
@@ -0,0 +1,153 @@
1/*
2 * adv7604 - Analog Devices ADV7604 video decoder driver
3 *
4 * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 *
19 */
20
21#ifndef _ADV7604_
22#define _ADV7604_
23
24/* Analog input muxing modes (AFE register 0x02, [2:0]) */
25enum adv7604_ain_sel {
26 ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
27 ADV7604_AIN4_5_6_NC_SYNC_2_1 = 1,
28 ADV7604_AIN7_8_9_NC_SYNC_3_1 = 2,
29 ADV7604_AIN10_11_12_NC_SYNC_4_1 = 3,
30 ADV7604_AIN9_4_5_6_SYNC_2_1 = 4,
31};
32
33/* Bus rotation and reordering (IO register 0x04, [7:5]) */
34enum adv7604_op_ch_sel {
35 ADV7604_OP_CH_SEL_GBR = 0,
36 ADV7604_OP_CH_SEL_GRB = 1,
37 ADV7604_OP_CH_SEL_BGR = 2,
38 ADV7604_OP_CH_SEL_RGB = 3,
39 ADV7604_OP_CH_SEL_BRG = 4,
40 ADV7604_OP_CH_SEL_RBG = 5,
41};
42
43/* Primary mode (IO register 0x01, [3:0]) */
44enum adv7604_prim_mode {
45 ADV7604_PRIM_MODE_COMP = 1,
46 ADV7604_PRIM_MODE_RGB = 2,
47 ADV7604_PRIM_MODE_HDMI_COMP = 5,
48 ADV7604_PRIM_MODE_HDMI_GR = 6,
49};
50
51/* Input Color Space (IO register 0x02, [7:4]) */
52enum adv7604_inp_color_space {
53 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
54 ADV7604_INP_COLOR_SPACE_FULL_RGB = 1,
55 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
56 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
57 ADV7604_INP_COLOR_SPACE_XVYCC_601 = 4,
58 ADV7604_INP_COLOR_SPACE_XVYCC_709 = 5,
59 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
60 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
61 ADV7604_INP_COLOR_SPACE_AUTO = 0xf,
62};
63
64/* Select output format (IO register 0x03, [7:0]) */
65enum adv7604_op_format_sel {
66 ADV7604_OP_FORMAT_SEL_SDR_ITU656_8 = 0x00,
67 ADV7604_OP_FORMAT_SEL_SDR_ITU656_10 = 0x01,
68 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE0 = 0x02,
69 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE1 = 0x06,
70 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE2 = 0x0a,
71 ADV7604_OP_FORMAT_SEL_DDR_422_8 = 0x20,
72 ADV7604_OP_FORMAT_SEL_DDR_422_10 = 0x21,
73 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE0 = 0x22,
74 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE1 = 0x23,
75 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE2 = 0x24,
76 ADV7604_OP_FORMAT_SEL_SDR_444_24 = 0x40,
77 ADV7604_OP_FORMAT_SEL_SDR_444_30 = 0x41,
78 ADV7604_OP_FORMAT_SEL_SDR_444_36_MODE0 = 0x42,
79 ADV7604_OP_FORMAT_SEL_DDR_444_24 = 0x60,
80 ADV7604_OP_FORMAT_SEL_DDR_444_30 = 0x61,
81 ADV7604_OP_FORMAT_SEL_DDR_444_36 = 0x62,
82 ADV7604_OP_FORMAT_SEL_SDR_ITU656_16 = 0x80,
83 ADV7604_OP_FORMAT_SEL_SDR_ITU656_20 = 0x81,
84 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE0 = 0x82,
85 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE1 = 0x86,
86 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE2 = 0x8a,
87};
88
89/* Platform dependent definition */
90struct adv7604_platform_data {
91 /* connector - HDMI or DVI? */
92 unsigned connector_hdmi:1;
93
94 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
95 unsigned disable_pwrdnb:1;
96
97 /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
98 unsigned disable_cable_det_rst:1;
99
100 /* Analog input muxing mode */
101 enum adv7604_ain_sel ain_sel;
102
103 /* Bus rotation and reordering */
104 enum adv7604_op_ch_sel op_ch_sel;
105
106 /* Primary mode */
107 enum adv7604_prim_mode prim_mode;
108
109 /* Select output format */
110 enum adv7604_op_format_sel op_format_sel;
111
112 /* IO register 0x02 */
113 unsigned alt_gamma:1;
114 unsigned op_656_range:1;
115 unsigned rgb_out:1;
116 unsigned alt_data_sat:1;
117
118 /* IO register 0x05 */
119 unsigned blank_data:1;
120 unsigned insert_av_codes:1;
121 unsigned replicate_av_codes:1;
122 unsigned invert_cbcr:1;
123
124 /* IO register 0x30 */
125 unsigned output_bus_lsb_to_msb:1;
126
127 /* Free run */
128 unsigned hdmi_free_run_mode;
129
130 /* i2c addresses: 0 == use default */
131 u8 i2c_avlink;
132 u8 i2c_cec;
133 u8 i2c_infoframe;
134 u8 i2c_esdp;
135 u8 i2c_dpp;
136 u8 i2c_afe;
137 u8 i2c_repeater;
138 u8 i2c_edid;
139 u8 i2c_hdmi;
140 u8 i2c_test;
141 u8 i2c_cp;
142 u8 i2c_vdp;
143};
144
145#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
147#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
148
149/* notify events */
150#define ADV7604_HOTPLUG 1
151#define ADV7604_FMT_CHANGE 2
152
153#endif
diff --git a/include/media/ir-rx51.h b/include/media/ir-rx51.h
new file mode 100644
index 000000000000..104aa892f31b
--- /dev/null
+++ b/include/media/ir-rx51.h
@@ -0,0 +1,10 @@
1#ifndef _LIRC_RX51_H
2#define _LIRC_RX51_H
3
4struct lirc_rx51_platform_data {
5 int pwm_timer;
6
7 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
8};
9
10#endif
diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
index 5e27f9be6b95..78fd39eac219 100644
--- a/include/media/mt9v032.h
+++ b/include/media/mt9v032.h
@@ -7,6 +7,9 @@ struct mt9v032_platform_data {
7 unsigned int clk_pol:1; 7 unsigned int clk_pol:1;
8 8
9 void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate); 9 void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
10
11 const s64 *link_freqs;
12 s64 link_def_freq;
10}; 13};
11 14
12#endif 15#endif
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 4d94be5226af..95842696857f 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -42,12 +42,6 @@ enum isp_interface_type {
42}; 42};
43 43
44enum { 44enum {
45 ISP_BRIDGE_DISABLE = 0,
46 ISP_BRIDGE_LITTLE_ENDIAN = 2,
47 ISP_BRIDGE_BIG_ENDIAN = 3,
48};
49
50enum {
51 ISP_LANE_SHIFT_0 = 0, 45 ISP_LANE_SHIFT_0 = 0,
52 ISP_LANE_SHIFT_2 = 1, 46 ISP_LANE_SHIFT_2 = 1,
53 ISP_LANE_SHIFT_4 = 2, 47 ISP_LANE_SHIFT_4 = 2,
@@ -67,17 +61,15 @@ enum {
67 * 0 - Active high, 1 - Active low 61 * 0 - Active high, 1 - Active low
68 * @vs_pol: Vertical synchronization polarity 62 * @vs_pol: Vertical synchronization polarity
69 * 0 - Active high, 1 - Active low 63 * 0 - Active high, 1 - Active low
70 * @bridge: CCDC Bridge input control 64 * @data_pol: Data polarity
71 * ISP_BRIDGE_DISABLE - Disable 65 * 0 - Normal, 1 - One's complement
72 * ISP_BRIDGE_LITTLE_ENDIAN - Little endian
73 * ISP_BRIDGE_BIG_ENDIAN - Big endian
74 */ 66 */
75struct isp_parallel_platform_data { 67struct isp_parallel_platform_data {
76 unsigned int data_lane_shift:2; 68 unsigned int data_lane_shift:2;
77 unsigned int clk_pol:1; 69 unsigned int clk_pol:1;
78 unsigned int hs_pol:1; 70 unsigned int hs_pol:1;
79 unsigned int vs_pol:1; 71 unsigned int vs_pol:1;
80 unsigned int bridge:2; 72 unsigned int data_pol:1;
81}; 73};
82 74
83enum { 75enum {
diff --git a/include/media/s5k4ecgx.h b/include/media/s5k4ecgx.h
new file mode 100644
index 000000000000..90c1be792ffe
--- /dev/null
+++ b/include/media/s5k4ecgx.h
@@ -0,0 +1,37 @@
1/*
2 * S5K4ECGX image sensor header file
3 *
4 * Copyright (C) 2012, Linaro
5 * Copyright (C) 2012, Samsung Electronics Co., Ltd.
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 S5K4ECGX_H
14#define S5K4ECGX_H
15
16/**
17 * struct s5k4ecgx_gpio - data structure describing a GPIO
18 * @gpio : GPIO number
19 * @level: indicates active state of the @gpio
20 */
21struct s5k4ecgx_gpio {
22 int gpio;
23 int level;
24};
25
26/**
27 * struct ss5k4ecgx_platform_data- s5k4ecgx driver platform data
28 * @gpio_reset: GPIO driving RESET pin
29 * @gpio_stby : GPIO driving STBY pin
30 */
31
32struct s5k4ecgx_platform_data {
33 struct s5k4ecgx_gpio gpio_reset;
34 struct s5k4ecgx_gpio gpio_stby;
35};
36
37#endif /* S5K4ECGX_H */
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 8587aaf73646..09421a611d73 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -12,6 +12,8 @@
12#ifndef S5P_FIMC_H_ 12#ifndef S5P_FIMC_H_
13#define S5P_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15#include <media/media-entity.h>
16
15enum cam_bus_type { 17enum cam_bus_type {
16 FIMC_ITU_601 = 1, 18 FIMC_ITU_601 = 1,
17 FIMC_ITU_656, 19 FIMC_ITU_656,
@@ -80,4 +82,20 @@ struct fimc_pipeline {
80 struct media_pipeline *m_pipeline; 82 struct media_pipeline *m_pipeline;
81}; 83};
82 84
85/*
86 * Media pipeline operations to be called from within the fimc(-lite)
87 * video node when it is the last entity of the pipeline. Implemented
88 * by corresponding media device driver.
89 */
90struct fimc_pipeline_ops {
91 int (*open)(struct fimc_pipeline *p, struct media_entity *me,
92 bool resume);
93 int (*close)(struct fimc_pipeline *p);
94 int (*set_stream)(struct fimc_pipeline *p, bool state);
95};
96
97#define fimc_pipeline_call(f, op, p, args...) \
98 (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \
99 (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD))
100
83#endif /* S5P_FIMC_H_ */ 101#endif /* S5P_FIMC_H_ */
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
index 361a751f73af..181642b8d0a5 100644
--- a/include/media/s5p_hdmi.h
+++ b/include/media/s5p_hdmi.h
@@ -20,6 +20,7 @@ struct i2c_board_info;
20 * @hdmiphy_info: template for HDMIPHY I2C device 20 * @hdmiphy_info: template for HDMIPHY I2C device
21 * @mhl_bus: controller id for MHL control bus 21 * @mhl_bus: controller id for MHL control bus
22 * @mhl_info: template for MHL I2C device 22 * @mhl_info: template for MHL I2C device
23 * @hpd_gpio: GPIO for Hot-Plug-Detect pin
23 * 24 *
24 * NULL pointer for *_info fields indicates that 25 * NULL pointer for *_info fields indicates that
25 * the corresponding chip is not present 26 * the corresponding chip is not present
@@ -29,6 +30,7 @@ struct s5p_hdmi_platform_data {
29 struct i2c_board_info *hdmiphy_info; 30 struct i2c_board_info *hdmiphy_info;
30 int mhl_bus; 31 int mhl_bus;
31 struct i2c_board_info *mhl_info; 32 struct i2c_board_info *mhl_info;
33 int hpd_gpio;
32}; 34};
33 35
34#endif /* S5P_HDMI_H */ 36#endif /* S5P_HDMI_H */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 773e527deabe..96058a5a4acc 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -117,8 +117,6 @@ struct saa7146_dev
117{ 117{
118 struct module *module; 118 struct module *module;
119 119
120 struct list_head item;
121
122 struct v4l2_device v4l2_dev; 120 struct v4l2_device v4l2_dev;
123 struct v4l2_ctrl_handler ctrl_handler; 121 struct v4l2_ctrl_handler ctrl_handler;
124 122
@@ -166,8 +164,6 @@ static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
166int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 164int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
167 165
168/* from saa7146_core.c */ 166/* from saa7146_core.c */
169extern struct list_head saa7146_devices;
170extern struct mutex saa7146_devices_lock;
171int saa7146_register_extension(struct saa7146_extension*); 167int saa7146_register_extension(struct saa7146_extension*);
172int saa7146_unregister_extension(struct saa7146_extension*); 168int saa7146_unregister_extension(struct saa7146_extension*);
173struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc); 169struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc);
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index d865dcf9879f..6442edc2a151 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -85,12 +85,14 @@ struct soc_camera_host_ops {
85 void (*put_formats)(struct soc_camera_device *); 85 void (*put_formats)(struct soc_camera_device *);
86 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *); 86 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
87 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *); 87 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *);
88 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *); 88 int (*set_crop)(struct soc_camera_device *, const struct v4l2_crop *);
89 int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *);
90 int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *);
89 /* 91 /*
90 * The difference to .set_crop() is, that .set_livecrop is not allowed 92 * The difference to .set_crop() is, that .set_livecrop is not allowed
91 * to change the output sizes 93 * to change the output sizes
92 */ 94 */
93 int (*set_livecrop)(struct soc_camera_device *, struct v4l2_crop *); 95 int (*set_livecrop)(struct soc_camera_device *, const struct v4l2_crop *);
94 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); 96 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
95 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 97 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
96 void (*init_videobuf)(struct videobuf_queue *, 98 void (*init_videobuf)(struct videobuf_queue *,
@@ -254,6 +256,16 @@ unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
254unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, 256unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
255 const struct v4l2_mbus_config *cfg); 257 const struct v4l2_mbus_config *cfg);
256 258
259int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl);
260int soc_camera_power_off(struct device *dev, struct soc_camera_link *icl);
261
262static inline int soc_camera_set_power(struct device *dev,
263 struct soc_camera_link *icl, bool on)
264{
265 return on ? soc_camera_power_on(dev, icl)
266 : soc_camera_power_off(dev, icl);
267}
268
257/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 269/* This is only temporary here - until v4l2-subdev begins to link to video_device */
258#include <linux/i2c.h> 270#include <linux/i2c.h>
259static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) 271static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 58f914a40b20..4ee125bae719 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -183,6 +183,9 @@ enum {
183 /* module adv7393: just ident 7393 */ 183 /* module adv7393: just ident 7393 */
184 V4L2_IDENT_ADV7393 = 7393, 184 V4L2_IDENT_ADV7393 = 7393,
185 185
186 /* module adv7604: just ident 7604 */
187 V4L2_IDENT_ADV7604 = 7604,
188
186 /* module saa7706h: just ident 7706 */ 189 /* module saa7706h: just ident 7706 */
187 V4L2_IDENT_SAA7706H = 7706, 190 V4L2_IDENT_SAA7706H = 7706,
188 191
@@ -212,6 +215,9 @@ enum {
212 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ 215 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
213 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ 216 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
214 217
218 /* module ad9389b: just ident 9389 */
219 V4L2_IDENT_AD9389B = 9389,
220
215 /* module tda9840: just ident 9840 */ 221 /* module tda9840: just ident 9840 */
216 V4L2_IDENT_TDA9840 = 9840, 222 V4L2_IDENT_TDA9840 = 9840,
217 223
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a298ec49ddc4..1a0b2db4c5d3 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -133,7 +133,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
133 struct i2c_adapter *adapter, struct i2c_board_info *info, 133 struct i2c_adapter *adapter, struct i2c_board_info *info,
134 const unsigned short *probe_addrs); 134 const unsigned short *probe_addrs);
135 135
136/* Initialize an v4l2_subdev with data from an i2c_client struct */ 136/* Initialize a v4l2_subdev with data from an i2c_client struct */
137void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 137void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
138 const struct v4l2_subdev_ops *ops); 138 const struct v4l2_subdev_ops *ops);
139/* Return i2c client address of v4l2_subdev. */ 139/* Return i2c client address of v4l2_subdev. */
@@ -166,7 +166,7 @@ struct spi_device;
166struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, 166struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
167 struct spi_master *master, struct spi_board_info *info); 167 struct spi_master *master, struct spi_board_info *info);
168 168
169/* Initialize an v4l2_subdev with data from an spi_device struct */ 169/* Initialize a v4l2_subdev with data from an spi_device struct */
170void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, 170void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
171 const struct v4l2_subdev_ops *ops); 171 const struct v4l2_subdev_ops *ops);
172#endif 172#endif
@@ -212,4 +212,17 @@ const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
212 const struct v4l2_discrete_probe *probe, 212 const struct v4l2_discrete_probe *probe,
213 s32 width, s32 height); 213 s32 width, s32 height);
214 214
215bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
216 const struct v4l2_dv_timings *t2,
217 unsigned pclock_delta);
218
219bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
220 u32 polarities, struct v4l2_dv_timings *fmt);
221
222bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync,
223 u32 polarities, struct v4l2_fract aspect,
224 struct v4l2_dv_timings *fmt);
225
226struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait);
227
215#endif /* V4L2_COMMON_H_ */ 228#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 776605f1cbe2..801adb466bd2 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -384,14 +384,28 @@ struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
384 * @hdl: The control handler. 384 * @hdl: The control handler.
385 * @add: The control handler whose controls you want to add to 385 * @add: The control handler whose controls you want to add to
386 * the @hdl control handler. 386 * the @hdl control handler.
387 * @filter: This function will filter which controls should be added.
387 * 388 *
388 * Does nothing if either of the two is a NULL pointer. 389 * Does nothing if either of the two handlers is a NULL pointer.
390 * If @filter is NULL, then all controls are added. Otherwise only those
391 * controls for which @filter returns true will be added.
389 * In case of an error @hdl->error will be set to the error code (if it 392 * In case of an error @hdl->error will be set to the error code (if it
390 * wasn't set already). 393 * wasn't set already).
391 */ 394 */
392int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, 395int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
393 struct v4l2_ctrl_handler *add); 396 struct v4l2_ctrl_handler *add,
397 bool (*filter)(const struct v4l2_ctrl *ctrl));
394 398
399/** v4l2_ctrl_radio_filter() - Standard filter for radio controls.
400 * @ctrl: The control that is filtered.
401 *
402 * This will return true for any controls that are valid for radio device
403 * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
404 * transmitter class controls.
405 *
406 * This function is to be used with v4l2_ctrl_add_handler().
407 */
408bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
395 409
396/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. 410/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
397 * @ncontrols: The number of controls in this cluster. 411 * @ncontrols: The number of controls in this cluster.
@@ -511,6 +525,29 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
511 */ 525 */
512int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 526int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
513 527
528/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver.
529 * @ctrl: The control.
530 *
531 * This returns the control's value safely by going through the control
532 * framework. This function will lock the control's handler, so it cannot be
533 * used from within the &v4l2_ctrl_ops functions.
534 *
535 * This function is for 64-bit integer type controls only.
536 */
537s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
538
539/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver.
540 * @ctrl: The control.
541 * @val: The new value.
542 *
543 * This set the control's new value safely by going through the control
544 * framework. This function will lock the control's handler, so it cannot be
545 * used from within the &v4l2_ctrl_ops functions.
546 *
547 * This function is for 64-bit integer type controls only.
548 */
549int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
550
514/* Internal helper functions that deal with control events. */ 551/* Internal helper functions that deal with control events. */
515extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; 552extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
516void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); 553void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
@@ -523,7 +560,7 @@ int v4l2_ctrl_log_status(struct file *file, void *fh);
523/* Can be used as a vidioc_subscribe_event function that just subscribes 560/* Can be used as a vidioc_subscribe_event function that just subscribes
524 control events. */ 561 control events. */
525int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh, 562int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
526 struct v4l2_event_subscription *sub); 563 const struct v4l2_event_subscription *sub);
527 564
528/* Can be used as a poll function that just polls for control events. */ 565/* Can be used as a poll function that just polls for control events. */
529unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait); 566unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 5c416cdc88d5..95d1c91770f4 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -26,6 +26,12 @@
26#define VFL_TYPE_SUBDEV 3 26#define VFL_TYPE_SUBDEV 3
27#define VFL_TYPE_MAX 4 27#define VFL_TYPE_MAX 4
28 28
29/* Is this a receiver, transmitter or mem-to-mem? */
30/* Ignored for VFL_TYPE_SUBDEV. */
31#define VFL_DIR_RX 0
32#define VFL_DIR_TX 1
33#define VFL_DIR_M2M 2
34
29struct v4l2_ioctl_callbacks; 35struct v4l2_ioctl_callbacks;
30struct video_device; 36struct video_device;
31struct v4l2_device; 37struct v4l2_device;
@@ -39,9 +45,6 @@ struct v4l2_ctrl_handler;
39#define V4L2_FL_USES_V4L2_FH (1) 45#define V4L2_FL_USES_V4L2_FH (1)
40/* Use the prio field of v4l2_fh for core priority checking */ 46/* Use the prio field of v4l2_fh for core priority checking */
41#define V4L2_FL_USE_FH_PRIO (2) 47#define V4L2_FL_USE_FH_PRIO (2)
42/* If ioctl core locking is in use, then apply that also to all
43 file operations. Don't use this flag in new drivers! */
44#define V4L2_FL_LOCK_ALL_FOPS (3)
45 48
46/* Priority helper functions */ 49/* Priority helper functions */
47 50
@@ -108,7 +111,8 @@ struct video_device
108 111
109 /* device info */ 112 /* device info */
110 char name[32]; 113 char name[32];
111 int vfl_type; 114 int vfl_type; /* device type */
115 int vfl_dir; /* receiver, transmitter or m2m */
112 /* 'minor' is set to -1 if the registration failed */ 116 /* 'minor' is set to -1 if the registration failed */
113 int minor; 117 int minor;
114 u16 num; 118 u16 num;
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 2885a810a128..e7c5d170a9cd 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -124,10 +124,10 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
124void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); 124void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev);
125int v4l2_event_pending(struct v4l2_fh *fh); 125int v4l2_event_pending(struct v4l2_fh *fh);
126int v4l2_event_subscribe(struct v4l2_fh *fh, 126int v4l2_event_subscribe(struct v4l2_fh *fh,
127 struct v4l2_event_subscription *sub, unsigned elems, 127 const struct v4l2_event_subscription *sub, unsigned elems,
128 const struct v4l2_subscribed_event_ops *ops); 128 const struct v4l2_subscribed_event_ops *ops);
129int v4l2_event_unsubscribe(struct v4l2_fh *fh, 129int v4l2_event_unsubscribe(struct v4l2_fh *fh,
130 struct v4l2_event_subscription *sub); 130 const struct v4l2_event_subscription *sub);
131void v4l2_event_unsubscribe_all(struct v4l2_fh *fh); 131void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
132 132
133#endif /* V4L2_EVENT_H */ 133#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e614c9c15e56..e48b571ca37d 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -40,8 +40,6 @@ struct v4l2_ioctl_ops {
40 struct v4l2_fmtdesc *f); 40 struct v4l2_fmtdesc *f);
41 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, 41 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
42 struct v4l2_fmtdesc *f); 42 struct v4l2_fmtdesc *f);
43 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
44 struct v4l2_fmtdesc *f);
45 43
46 /* VIDIOC_G_FMT handlers */ 44 /* VIDIOC_G_FMT handlers */
47 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, 45 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
@@ -64,8 +62,6 @@ struct v4l2_ioctl_ops {
64 struct v4l2_format *f); 62 struct v4l2_format *f);
65 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, 63 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
66 struct v4l2_format *f); 64 struct v4l2_format *f);
67 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
68 struct v4l2_format *f);
69 65
70 /* VIDIOC_S_FMT handlers */ 66 /* VIDIOC_S_FMT handlers */
71 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, 67 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
@@ -88,8 +84,6 @@ struct v4l2_ioctl_ops {
88 struct v4l2_format *f); 84 struct v4l2_format *f);
89 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, 85 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
90 struct v4l2_format *f); 86 struct v4l2_format *f);
91 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
92 struct v4l2_format *f);
93 87
94 /* VIDIOC_TRY_FMT handlers */ 88 /* VIDIOC_TRY_FMT handlers */
95 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, 89 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
@@ -112,8 +106,6 @@ struct v4l2_ioctl_ops {
112 struct v4l2_format *f); 106 struct v4l2_format *f);
113 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, 107 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
114 struct v4l2_format *f); 108 struct v4l2_format *f);
115 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
116 struct v4l2_format *f);
117 109
118 /* Buffer handlers */ 110 /* Buffer handlers */
119 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); 111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
@@ -128,7 +120,7 @@ struct v4l2_ioctl_ops {
128 int (*vidioc_g_fbuf) (struct file *file, void *fh, 120 int (*vidioc_g_fbuf) (struct file *file, void *fh,
129 struct v4l2_framebuffer *a); 121 struct v4l2_framebuffer *a);
130 int (*vidioc_s_fbuf) (struct file *file, void *fh, 122 int (*vidioc_s_fbuf) (struct file *file, void *fh,
131 struct v4l2_framebuffer *a); 123 const struct v4l2_framebuffer *a);
132 124
133 /* Stream on/off */ 125 /* Stream on/off */
134 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i); 126 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
@@ -175,7 +167,7 @@ struct v4l2_ioctl_ops {
175 int (*vidioc_g_audio) (struct file *file, void *fh, 167 int (*vidioc_g_audio) (struct file *file, void *fh,
176 struct v4l2_audio *a); 168 struct v4l2_audio *a);
177 int (*vidioc_s_audio) (struct file *file, void *fh, 169 int (*vidioc_s_audio) (struct file *file, void *fh,
178 struct v4l2_audio *a); 170 const struct v4l2_audio *a);
179 171
180 /* Audio out ioctls */ 172 /* Audio out ioctls */
181 int (*vidioc_enumaudout) (struct file *file, void *fh, 173 int (*vidioc_enumaudout) (struct file *file, void *fh,
@@ -183,18 +175,18 @@ struct v4l2_ioctl_ops {
183 int (*vidioc_g_audout) (struct file *file, void *fh, 175 int (*vidioc_g_audout) (struct file *file, void *fh,
184 struct v4l2_audioout *a); 176 struct v4l2_audioout *a);
185 int (*vidioc_s_audout) (struct file *file, void *fh, 177 int (*vidioc_s_audout) (struct file *file, void *fh,
186 struct v4l2_audioout *a); 178 const struct v4l2_audioout *a);
187 int (*vidioc_g_modulator) (struct file *file, void *fh, 179 int (*vidioc_g_modulator) (struct file *file, void *fh,
188 struct v4l2_modulator *a); 180 struct v4l2_modulator *a);
189 int (*vidioc_s_modulator) (struct file *file, void *fh, 181 int (*vidioc_s_modulator) (struct file *file, void *fh,
190 struct v4l2_modulator *a); 182 const struct v4l2_modulator *a);
191 /* Crop ioctls */ 183 /* Crop ioctls */
192 int (*vidioc_cropcap) (struct file *file, void *fh, 184 int (*vidioc_cropcap) (struct file *file, void *fh,
193 struct v4l2_cropcap *a); 185 struct v4l2_cropcap *a);
194 int (*vidioc_g_crop) (struct file *file, void *fh, 186 int (*vidioc_g_crop) (struct file *file, void *fh,
195 struct v4l2_crop *a); 187 struct v4l2_crop *a);
196 int (*vidioc_s_crop) (struct file *file, void *fh, 188 int (*vidioc_s_crop) (struct file *file, void *fh,
197 struct v4l2_crop *a); 189 const struct v4l2_crop *a);
198 int (*vidioc_g_selection) (struct file *file, void *fh, 190 int (*vidioc_g_selection) (struct file *file, void *fh,
199 struct v4l2_selection *s); 191 struct v4l2_selection *s);
200 int (*vidioc_s_selection) (struct file *file, void *fh, 192 int (*vidioc_s_selection) (struct file *file, void *fh,
@@ -203,7 +195,7 @@ struct v4l2_ioctl_ops {
203 int (*vidioc_g_jpegcomp) (struct file *file, void *fh, 195 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
204 struct v4l2_jpegcompression *a); 196 struct v4l2_jpegcompression *a);
205 int (*vidioc_s_jpegcomp) (struct file *file, void *fh, 197 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
206 struct v4l2_jpegcompression *a); 198 const struct v4l2_jpegcompression *a);
207 int (*vidioc_g_enc_index) (struct file *file, void *fh, 199 int (*vidioc_g_enc_index) (struct file *file, void *fh,
208 struct v4l2_enc_idx *a); 200 struct v4l2_enc_idx *a);
209 int (*vidioc_encoder_cmd) (struct file *file, void *fh, 201 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
@@ -241,7 +233,7 @@ struct v4l2_ioctl_ops {
241 int (*vidioc_log_status) (struct file *file, void *fh); 233 int (*vidioc_log_status) (struct file *file, void *fh);
242 234
243 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, 235 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
244 struct v4l2_hw_freq_seek *a); 236 const struct v4l2_hw_freq_seek *a);
245 237
246 /* Debugging ioctls */ 238 /* Debugging ioctls */
247#ifdef CONFIG_VIDEO_ADV_DEBUG 239#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -281,9 +273,9 @@ struct v4l2_ioctl_ops {
281 struct v4l2_dv_timings_cap *cap); 273 struct v4l2_dv_timings_cap *cap);
282 274
283 int (*vidioc_subscribe_event) (struct v4l2_fh *fh, 275 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
284 struct v4l2_event_subscription *sub); 276 const struct v4l2_event_subscription *sub);
285 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, 277 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
286 struct v4l2_event_subscription *sub); 278 const struct v4l2_event_subscription *sub);
287 279
288 /* For other private ioctls */ 280 /* For other private ioctls */
289 long (*vidioc_default) (struct file *file, void *fh, 281 long (*vidioc_default) (struct file *file, void *fh,
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 16ac4733e80d..131cc4a53675 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -140,7 +140,7 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);
140static inline 140static inline
141unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 141unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
142{ 142{
143 return m2m_ctx->cap_q_ctx.num_rdy; 143 return m2m_ctx->out_q_ctx.num_rdy;
144} 144}
145 145
146/** 146/**
@@ -150,7 +150,7 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
150static inline 150static inline
151unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 151unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
152{ 152{
153 return m2m_ctx->out_q_ctx.num_rdy; 153 return m2m_ctx->cap_q_ctx.num_rdy;
154} 154}
155 155
156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); 156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index c35a3545e273..2ecd7377153b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -120,7 +120,7 @@ struct v4l2_subdev_io_pin_config {
120 each pin being configured. This function could be called at times 120 each pin being configured. This function could be called at times
121 other than just subdevice initialization. 121 other than just subdevice initialization.
122 122
123 init: initialize the sensor registors to some sort of reasonable default 123 init: initialize the sensor registers to some sort of reasonable default
124 values. Do not use for new drivers and should be removed in existing 124 values. Do not use for new drivers and should be removed in existing
125 drivers. 125 drivers.
126 126
@@ -194,7 +194,7 @@ struct v4l2_subdev_tuner_ops {
194 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 194 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
195 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 195 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
196 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 196 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
197 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 197 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
198 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 198 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
199 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 199 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
200}; 200};
@@ -286,7 +286,7 @@ struct v4l2_subdev_video_ops {
286 int (*s_stream)(struct v4l2_subdev *sd, int enable); 286 int (*s_stream)(struct v4l2_subdev *sd, int enable);
287 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); 287 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
288 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 288 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
289 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 289 int (*s_crop)(struct v4l2_subdev *sd, const struct v4l2_crop *crop);
290 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 290 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
291 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 291 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
292 int (*g_frame_interval)(struct v4l2_subdev *sd, 292 int (*g_frame_interval)(struct v4l2_subdev *sd,
@@ -476,6 +476,8 @@ struct v4l2_subdev_pad_ops {
476 struct v4l2_subdev_selection *sel); 476 struct v4l2_subdev_selection *sel);
477 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 477 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
478 struct v4l2_subdev_selection *sel); 478 struct v4l2_subdev_selection *sel);
479 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
480 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
479#ifdef CONFIG_MEDIA_CONTROLLER 481#ifdef CONFIG_MEDIA_CONTROLLER
480 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, 482 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
481 struct v4l2_subdev_format *source_fmt, 483 struct v4l2_subdev_format *source_fmt,
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index bf365721d6b0..d63965a1faaf 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -45,9 +45,7 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
45 void *adapter_priv, 45 void *adapter_priv,
46 struct device *device, 46 struct device *device,
47 short *adapter_nr, 47 short *adapter_nr,
48 int mfe_shared, 48 int mfe_shared);
49 int (*fe_ioctl_override)(struct dvb_frontend *,
50 unsigned int, void *, unsigned int));
51 49
52void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); 50void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);
53 51
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 8dd9b6cc296b..e04252a9fea6 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -324,7 +324,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
324int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); 324int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
325int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); 325int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
326 326
327int vb2_queue_init(struct vb2_queue *q); 327int __must_check vb2_queue_init(struct vb2_queue *q);
328 328
329void vb2_queue_release(struct vb2_queue *q); 329void vb2_queue_release(struct vb2_queue *q);
330 330
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index 192f8fb7d546..e69de29bb2d1 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -1,5 +0,0 @@
1header-y += inftl-user.h
2header-y += mtd-abi.h
3header-y += mtd-user.h
4header-y += nftl-user.h
5header-y += ubi-user.h
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 089a09d001d1..9e63e76b20e7 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -78,7 +78,7 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
78 int strict); 78 int strict);
79 79
80extern int ipv6_dev_get_saddr(struct net *net, 80extern int ipv6_dev_get_saddr(struct net *net,
81 struct net_device *dev, 81 const struct net_device *dev,
82 const struct in6_addr *daddr, 82 const struct in6_addr *daddr,
83 unsigned int srcprefs, 83 unsigned int srcprefs,
84 struct in6_addr *saddr); 84 struct in6_addr *saddr);
diff --git a/include/net/arp.h b/include/net/arp.h
index 7f7df93f37cd..b630dae03411 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -3,6 +3,7 @@
3#define _ARP_H 3#define _ARP_H
4 4
5#include <linux/if_arp.h> 5#include <linux/if_arp.h>
6#include <linux/hash.h>
6#include <net/neighbour.h> 7#include <net/neighbour.h>
7 8
8 9
@@ -10,7 +11,7 @@ extern struct neigh_table arp_tbl;
10 11
11static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd) 12static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
12{ 13{
13 u32 val = key ^ dev->ifindex; 14 u32 val = key ^ hash32_ptr(dev);
14 15
15 return val * hash_rnd; 16 return val * hash_rnd;
16} 17}
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 5d2352154cf6..53539acbd81a 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -157,7 +157,7 @@ enum {
157typedef struct ax25_uid_assoc { 157typedef struct ax25_uid_assoc {
158 struct hlist_node uid_node; 158 struct hlist_node uid_node;
159 atomic_t refcount; 159 atomic_t refcount;
160 uid_t uid; 160 kuid_t uid;
161 ax25_address call; 161 ax25_address call;
162} ax25_uid_assoc; 162} ax25_uid_assoc;
163 163
@@ -434,7 +434,7 @@ extern unsigned long ax25_display_timer(struct timer_list *);
434 434
435/* ax25_uid.c */ 435/* ax25_uid.c */
436extern int ax25_uid_policy; 436extern int ax25_uid_policy;
437extern ax25_uid_assoc *ax25_findbyuid(uid_t); 437extern ax25_uid_assoc *ax25_findbyuid(kuid_t);
438extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *); 438extern int __must_check ax25_uid_ioctl(int, struct sockaddr_ax25 *);
439extern const struct file_operations ax25_uid_fops; 439extern const struct file_operations ax25_uid_fops;
440extern void ax25_uid_free(void); 440extern void ax25_uid_free(void);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 23cf413e2acf..76b2b6bdcf36 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -302,8 +302,11 @@ enum {
302 302
303/* ---- HCI Error Codes ---- */ 303/* ---- HCI Error Codes ---- */
304#define HCI_ERROR_AUTH_FAILURE 0x05 304#define HCI_ERROR_AUTH_FAILURE 0x05
305#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
305#define HCI_ERROR_REJ_BAD_ADDR 0x0f 306#define HCI_ERROR_REJ_BAD_ADDR 0x0f
306#define HCI_ERROR_REMOTE_USER_TERM 0x13 307#define HCI_ERROR_REMOTE_USER_TERM 0x13
308#define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14
309#define HCI_ERROR_REMOTE_POWER_OFF 0x15
307#define HCI_ERROR_LOCAL_HOST_TERM 0x16 310#define HCI_ERROR_LOCAL_HOST_TERM 0x16
308#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18 311#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
309 312
@@ -1246,6 +1249,24 @@ struct hci_ev_simple_pair_complete {
1246 bdaddr_t bdaddr; 1249 bdaddr_t bdaddr;
1247} __packed; 1250} __packed;
1248 1251
1252#define HCI_EV_USER_PASSKEY_NOTIFY 0x3b
1253struct hci_ev_user_passkey_notify {
1254 bdaddr_t bdaddr;
1255 __le32 passkey;
1256} __packed;
1257
1258#define HCI_KEYPRESS_STARTED 0
1259#define HCI_KEYPRESS_ENTERED 1
1260#define HCI_KEYPRESS_ERASED 2
1261#define HCI_KEYPRESS_CLEARED 3
1262#define HCI_KEYPRESS_COMPLETED 4
1263
1264#define HCI_EV_KEYPRESS_NOTIFY 0x3c
1265struct hci_ev_keypress_notify {
1266 bdaddr_t bdaddr;
1267 __u8 type;
1268} __packed;
1269
1249#define HCI_EV_REMOTE_HOST_FEATURES 0x3d 1270#define HCI_EV_REMOTE_HOST_FEATURES 0x3d
1250struct hci_ev_remote_host_features { 1271struct hci_ev_remote_host_features {
1251 bdaddr_t bdaddr; 1272 bdaddr_t bdaddr;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 41d943926d2c..e7d454609881 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -303,6 +303,8 @@ struct hci_conn {
303 __u8 pin_length; 303 __u8 pin_length;
304 __u8 enc_key_size; 304 __u8 enc_key_size;
305 __u8 io_capability; 305 __u8 io_capability;
306 __u32 passkey_notify;
307 __u8 passkey_entered;
306 __u16 disc_timeout; 308 __u16 disc_timeout;
307 unsigned long flags; 309 unsigned long flags;
308 310
@@ -428,15 +430,6 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
428 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 430 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
429} 431}
430 432
431static inline void hci_conn_hash_init(struct hci_dev *hdev)
432{
433 struct hci_conn_hash *h = &hdev->conn_hash;
434 INIT_LIST_HEAD(&h->list);
435 h->acl_num = 0;
436 h->sco_num = 0;
437 h->le_num = 0;
438}
439
440static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) 433static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
441{ 434{
442 struct hci_conn_hash *h = &hdev->conn_hash; 435 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -551,9 +544,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
551 return NULL; 544 return NULL;
552} 545}
553 546
554void hci_acl_connect(struct hci_conn *conn);
555void hci_acl_disconn(struct hci_conn *conn, __u8 reason); 547void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
556void hci_add_sco(struct hci_conn *conn, __u16 handle);
557void hci_setup_sync(struct hci_conn *conn, __u16 handle); 548void hci_setup_sync(struct hci_conn *conn, __u16 handle);
558void hci_sco_setup(struct hci_conn *conn, __u8 status); 549void hci_sco_setup(struct hci_conn *conn, __u8 status);
559 550
@@ -563,7 +554,7 @@ void hci_conn_hash_flush(struct hci_dev *hdev);
563void hci_conn_check_pending(struct hci_dev *hdev); 554void hci_conn_check_pending(struct hci_dev *hdev);
564 555
565struct hci_chan *hci_chan_create(struct hci_conn *conn); 556struct hci_chan *hci_chan_create(struct hci_conn *conn);
566int hci_chan_del(struct hci_chan *chan); 557void hci_chan_del(struct hci_chan *chan);
567void hci_chan_list_flush(struct hci_conn *conn); 558void hci_chan_list_flush(struct hci_conn *conn);
568 559
569struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 560struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
@@ -614,11 +605,17 @@ static inline void hci_conn_put(struct hci_conn *conn)
614/* ----- HCI Devices ----- */ 605/* ----- HCI Devices ----- */
615static inline void hci_dev_put(struct hci_dev *d) 606static inline void hci_dev_put(struct hci_dev *d)
616{ 607{
608 BT_DBG("%s orig refcnt %d", d->name,
609 atomic_read(&d->dev.kobj.kref.refcount));
610
617 put_device(&d->dev); 611 put_device(&d->dev);
618} 612}
619 613
620static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) 614static inline struct hci_dev *hci_dev_hold(struct hci_dev *d)
621{ 615{
616 BT_DBG("%s orig refcnt %d", d->name,
617 atomic_read(&d->dev.kobj.kref.refcount));
618
622 get_device(&d->dev); 619 get_device(&d->dev);
623 return d; 620 return d;
624} 621}
@@ -1004,7 +1001,7 @@ int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1004 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1001 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1005 u8 *dev_class); 1002 u8 *dev_class);
1006int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1003int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1007 u8 link_type, u8 addr_type); 1004 u8 link_type, u8 addr_type, u8 reason);
1008int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1005int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1009 u8 link_type, u8 addr_type, u8 status); 1006 u8 link_type, u8 addr_type, u8 status);
1010int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1007int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1027,6 +1024,9 @@ int mgmt_user_passkey_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1027 u8 link_type, u8 addr_type, u8 status); 1024 u8 link_type, u8 addr_type, u8 status);
1028int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1025int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1029 u8 link_type, u8 addr_type, u8 status); 1026 u8 link_type, u8 addr_type, u8 status);
1027int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1028 u8 link_type, u8 addr_type, u32 passkey,
1029 u8 entered);
1030int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1030int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1031 u8 addr_type, u8 status); 1031 u8 addr_type, u8 status);
1032int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1032int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d206296137e2..7ed8e356425a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -433,11 +433,10 @@ struct l2cap_chan {
433 struct sock *sk; 433 struct sock *sk;
434 434
435 struct l2cap_conn *conn; 435 struct l2cap_conn *conn;
436 struct kref kref;
436 437
437 __u8 state; 438 __u8 state;
438 439
439 atomic_t refcnt;
440
441 __le16 psm; 440 __le16 psm;
442 __u16 dcid; 441 __u16 dcid;
443 __u16 scid; 442 __u16 scid;
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 4348ee8bda69..22980a7c3873 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -405,7 +405,16 @@ struct mgmt_ev_device_connected {
405 __u8 eir[0]; 405 __u8 eir[0];
406} __packed; 406} __packed;
407 407
408#define MGMT_DEV_DISCONN_UNKNOWN 0x00
409#define MGMT_DEV_DISCONN_TIMEOUT 0x01
410#define MGMT_DEV_DISCONN_LOCAL_HOST 0x02
411#define MGMT_DEV_DISCONN_REMOTE 0x03
412
408#define MGMT_EV_DEVICE_DISCONNECTED 0x000C 413#define MGMT_EV_DEVICE_DISCONNECTED 0x000C
414struct mgmt_ev_device_disconnected {
415 struct mgmt_addr_info addr;
416 __u8 reason;
417} __packed;
409 418
410#define MGMT_EV_CONNECT_FAILED 0x000D 419#define MGMT_EV_CONNECT_FAILED 0x000D
411struct mgmt_ev_connect_failed { 420struct mgmt_ev_connect_failed {
@@ -469,3 +478,10 @@ struct mgmt_ev_device_unblocked {
469struct mgmt_ev_device_unpaired { 478struct mgmt_ev_device_unpaired {
470 struct mgmt_addr_info addr; 479 struct mgmt_addr_info addr;
471} __packed; 480} __packed;
481
482#define MGMT_EV_PASSKEY_NOTIFY 0x0017
483struct mgmt_ev_passkey_notify {
484 struct mgmt_addr_info addr;
485 __le32 passkey;
486 __u8 entered;
487} __packed;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 50993a531d45..f8ba07f3e5fa 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -136,7 +136,7 @@ struct smp_chan {
136}; 136};
137 137
138/* SMP Commands */ 138/* SMP Commands */
139int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level); 139int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb); 140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force); 141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey); 142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index ba2e6160fad1..1b4989082244 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -245,6 +245,7 @@ struct ieee80211_sta_vht_cap {
245 * rates" IE, i.e. CCK rates first, then OFDM. 245 * rates" IE, i.e. CCK rates first, then OFDM.
246 * @n_bitrates: Number of bitrates in @bitrates 246 * @n_bitrates: Number of bitrates in @bitrates
247 * @ht_cap: HT capabilities in this band 247 * @ht_cap: HT capabilities in this band
248 * @vht_cap: VHT capabilities in this band
248 */ 249 */
249struct ieee80211_supported_band { 250struct ieee80211_supported_band {
250 struct ieee80211_channel *channels; 251 struct ieee80211_channel *channels;
@@ -1579,9 +1580,7 @@ struct cfg80211_gtk_rekey_data {
1579 * @set_cqm_txe_config: Configure connection quality monitor TX error 1580 * @set_cqm_txe_config: Configure connection quality monitor TX error
1580 * thresholds. 1581 * thresholds.
1581 * @sched_scan_start: Tell the driver to start a scheduled scan. 1582 * @sched_scan_start: Tell the driver to start a scheduled scan.
1582 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled 1583 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan.
1583 * scan. The driver_initiated flag specifies whether the driver
1584 * itself has informed that the scan has stopped.
1585 * 1584 *
1586 * @mgmt_frame_register: Notify driver that a management frame type was 1585 * @mgmt_frame_register: Notify driver that a management frame type was
1587 * registered. Note that this callback may not sleep, and cannot run 1586 * registered. Note that this callback may not sleep, and cannot run
@@ -1629,7 +1628,7 @@ struct cfg80211_ops {
1629 void (*set_wakeup)(struct wiphy *wiphy, bool enabled); 1628 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
1630 1629
1631 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy, 1630 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
1632 char *name, 1631 const char *name,
1633 enum nl80211_iftype type, 1632 enum nl80211_iftype type,
1634 u32 *flags, 1633 u32 *flags,
1635 struct vif_params *params); 1634 struct vif_params *params);
@@ -2458,7 +2457,7 @@ struct wireless_dev {
2458 2457
2459 int beacon_interval; 2458 int beacon_interval;
2460 2459
2461 u32 ap_unexpected_nlpid; 2460 u32 ap_unexpected_nlportid;
2462 2461
2463#ifdef CONFIG_CFG80211_WEXT 2462#ifdef CONFIG_CFG80211_WEXT
2464 /* wext data */ 2463 /* wext data */
@@ -3362,6 +3361,25 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
3362void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); 3361void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3363 3362
3364/** 3363/**
3364 * cfg80211_conn_failed - connection request failed notification
3365 *
3366 * @dev: the netdev
3367 * @mac_addr: the station's address
3368 * @reason: the reason for connection failure
3369 * @gfp: allocation flags
3370 *
3371 * Whenever a station tries to connect to an AP and if the station
3372 * could not connect to the AP as the AP has rejected the connection
3373 * for some reasons, this function is called.
3374 *
3375 * The reason for connection failure can be any of the value from
3376 * nl80211_connect_failed_reason enum
3377 */
3378void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
3379 enum nl80211_connect_failed_reason reason,
3380 gfp_t gfp);
3381
3382/**
3365 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3383 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3366 * @wdev: wireless device receiving the frame 3384 * @wdev: wireless device receiving the frame
3367 * @freq: Frequency on which the frame was received in MHz 3385 * @freq: Frequency on which the frame was received in MHz
diff --git a/include/net/checksum.h b/include/net/checksum.h
index ba55d8b8c87c..600d1d705bb8 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -109,6 +109,9 @@ static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
109struct sk_buff; 109struct sk_buff;
110extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, 110extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
111 __be32 from, __be32 to, int pseudohdr); 111 __be32 from, __be32 to, int pseudohdr);
112extern void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
113 const __be32 *from, const __be32 *to,
114 int pseudohdr);
112 115
113static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, 116static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
114 __be16 from, __be16 to, 117 __be16 from, __be16 to,
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index a4dc5b027bd9..b6a6eeb3905f 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -17,14 +17,16 @@
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20#ifdef CONFIG_CGROUPS 20#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
21struct cgroup_cls_state 21struct cgroup_cls_state
22{ 22{
23 struct cgroup_subsys_state css; 23 struct cgroup_subsys_state css;
24 u32 classid; 24 u32 classid;
25}; 25};
26 26
27#ifdef CONFIG_NET_CLS_CGROUP 27extern void sock_update_classid(struct sock *sk);
28
29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
28static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
29{ 31{
30 int classid; 32 int classid;
@@ -39,32 +41,33 @@ static inline u32 task_cls_classid(struct task_struct *p)
39 41
40 return classid; 42 return classid;
41} 43}
42#else 44#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
43extern int net_cls_subsys_id;
44
45static inline u32 task_cls_classid(struct task_struct *p) 45static inline u32 task_cls_classid(struct task_struct *p)
46{ 46{
47 int id; 47 struct cgroup_subsys_state *css;
48 u32 classid = 0; 48 u32 classid = 0;
49 49
50 if (in_interrupt()) 50 if (in_interrupt())
51 return 0; 51 return 0;
52 52
53 rcu_read_lock(); 53 rcu_read_lock();
54 id = rcu_dereference_index_check(net_cls_subsys_id, 54 css = task_subsys_state(p, net_cls_subsys_id);
55 rcu_read_lock_held()); 55 if (css)
56 if (id >= 0) 56 classid = container_of(css,
57 classid = container_of(task_subsys_state(p, id),
58 struct cgroup_cls_state, css)->classid; 57 struct cgroup_cls_state, css)->classid;
59 rcu_read_unlock(); 58 rcu_read_unlock();
60 59
61 return classid; 60 return classid;
62} 61}
63#endif 62#endif
64#else 63#else /* !CGROUP_NET_CLS_CGROUP */
64static inline void sock_update_classid(struct sock *sk)
65{
66}
67
65static inline u32 task_cls_classid(struct task_struct *p) 68static inline u32 task_cls_classid(struct task_struct *p)
66{ 69{
67 return 0; 70 return 0;
68} 71}
69#endif 72#endif /* CGROUP_NET_CLS_CGROUP */
70#endif /* _NET_CLS_CGROUP_H */ 73#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 621e3513ef5e..9a7881066fb3 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -396,11 +396,15 @@ static inline void dst_confirm(struct dst_entry *dst)
396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n, 396static inline int dst_neigh_output(struct dst_entry *dst, struct neighbour *n,
397 struct sk_buff *skb) 397 struct sk_buff *skb)
398{ 398{
399 struct hh_cache *hh; 399 const struct hh_cache *hh;
400
401 if (dst->pending_confirm) {
402 unsigned long now = jiffies;
400 403
401 if (unlikely(dst->pending_confirm)) {
402 n->confirmed = jiffies;
403 dst->pending_confirm = 0; 404 dst->pending_confirm = 0;
405 /* avoid dirtying neighbour */
406 if (n->confirmed != now)
407 n->confirmed = now;
404 } 408 }
405 409
406 hh = &n->hh; 410 hh = &n->hh;
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 48905cd3884c..bdfbe68c1c3b 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -65,7 +65,7 @@ struct genl_family {
65/** 65/**
66 * struct genl_info - receiving information 66 * struct genl_info - receiving information
67 * @snd_seq: sending sequence number 67 * @snd_seq: sending sequence number
68 * @snd_pid: netlink pid of sender 68 * @snd_portid: netlink portid of sender
69 * @nlhdr: netlink message header 69 * @nlhdr: netlink message header
70 * @genlhdr: generic netlink message header 70 * @genlhdr: generic netlink message header
71 * @userhdr: user specific header 71 * @userhdr: user specific header
@@ -75,7 +75,7 @@ struct genl_family {
75 */ 75 */
76struct genl_info { 76struct genl_info {
77 u32 snd_seq; 77 u32 snd_seq;
78 u32 snd_pid; 78 u32 snd_portid;
79 struct nlmsghdr * nlhdr; 79 struct nlmsghdr * nlhdr;
80 struct genlmsghdr * genlhdr; 80 struct genlmsghdr * genlhdr;
81 void * userhdr; 81 void * userhdr;
@@ -130,10 +130,10 @@ extern int genl_register_mc_group(struct genl_family *family,
130 struct genl_multicast_group *grp); 130 struct genl_multicast_group *grp);
131extern void genl_unregister_mc_group(struct genl_family *family, 131extern void genl_unregister_mc_group(struct genl_family *family,
132 struct genl_multicast_group *grp); 132 struct genl_multicast_group *grp);
133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 pid, 133extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
134 u32 group, struct nlmsghdr *nlh, gfp_t flags); 134 u32 group, struct nlmsghdr *nlh, gfp_t flags);
135 135
136void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 136void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
137 struct genl_family *family, int flags, u8 cmd); 137 struct genl_family *family, int flags, u8 cmd);
138 138
139/** 139/**
@@ -183,7 +183,7 @@ static inline void *genlmsg_put_reply(struct sk_buff *skb,
183 struct genl_family *family, 183 struct genl_family *family,
184 int flags, u8 cmd) 184 int flags, u8 cmd)
185{ 185{
186 return genlmsg_put(skb, info->snd_pid, info->snd_seq, family, 186 return genlmsg_put(skb, info->snd_portid, info->snd_seq, family,
187 flags, cmd); 187 flags, cmd);
188} 188}
189 189
@@ -212,49 +212,49 @@ static inline void genlmsg_cancel(struct sk_buff *skb, void *hdr)
212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns 212 * genlmsg_multicast_netns - multicast a netlink message to a specific netns
213 * @net: the net namespace 213 * @net: the net namespace
214 * @skb: netlink message as socket buffer 214 * @skb: netlink message as socket buffer
215 * @pid: own netlink pid to avoid sending to yourself 215 * @portid: own netlink portid to avoid sending to yourself
216 * @group: multicast group id 216 * @group: multicast group id
217 * @flags: allocation flags 217 * @flags: allocation flags
218 */ 218 */
219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb, 219static inline int genlmsg_multicast_netns(struct net *net, struct sk_buff *skb,
220 u32 pid, unsigned int group, gfp_t flags) 220 u32 portid, unsigned int group, gfp_t flags)
221{ 221{
222 return nlmsg_multicast(net->genl_sock, skb, pid, group, flags); 222 return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
223} 223}
224 224
225/** 225/**
226 * genlmsg_multicast - multicast a netlink message to the default netns 226 * genlmsg_multicast - multicast a netlink message to the default netns
227 * @skb: netlink message as socket buffer 227 * @skb: netlink message as socket buffer
228 * @pid: own netlink pid to avoid sending to yourself 228 * @portid: own netlink portid to avoid sending to yourself
229 * @group: multicast group id 229 * @group: multicast group id
230 * @flags: allocation flags 230 * @flags: allocation flags
231 */ 231 */
232static inline int genlmsg_multicast(struct sk_buff *skb, u32 pid, 232static inline int genlmsg_multicast(struct sk_buff *skb, u32 portid,
233 unsigned int group, gfp_t flags) 233 unsigned int group, gfp_t flags)
234{ 234{
235 return genlmsg_multicast_netns(&init_net, skb, pid, group, flags); 235 return genlmsg_multicast_netns(&init_net, skb, portid, group, flags);
236} 236}
237 237
238/** 238/**
239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces 239 * genlmsg_multicast_allns - multicast a netlink message to all net namespaces
240 * @skb: netlink message as socket buffer 240 * @skb: netlink message as socket buffer
241 * @pid: own netlink pid to avoid sending to yourself 241 * @portid: own netlink portid to avoid sending to yourself
242 * @group: multicast group id 242 * @group: multicast group id
243 * @flags: allocation flags 243 * @flags: allocation flags
244 * 244 *
245 * This function must hold the RTNL or rcu_read_lock(). 245 * This function must hold the RTNL or rcu_read_lock().
246 */ 246 */
247int genlmsg_multicast_allns(struct sk_buff *skb, u32 pid, 247int genlmsg_multicast_allns(struct sk_buff *skb, u32 portid,
248 unsigned int group, gfp_t flags); 248 unsigned int group, gfp_t flags);
249 249
250/** 250/**
251 * genlmsg_unicast - unicast a netlink message 251 * genlmsg_unicast - unicast a netlink message
252 * @skb: netlink message as socket buffer 252 * @skb: netlink message as socket buffer
253 * @pid: netlink pid of the destination socket 253 * @portid: netlink portid of the destination socket
254 */ 254 */
255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid) 255static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid)
256{ 256{
257 return nlmsg_unicast(net->genl_sock, skb, pid); 257 return nlmsg_unicast(net->genl_sock, skb, portid);
258} 258}
259 259
260/** 260/**
@@ -264,7 +264,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 pid)
264 */ 264 */
265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info) 265static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
266{ 266{
267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_pid); 267 return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid);
268} 268}
269 269
270/** 270/**
diff --git a/include/net/gro_cells.h b/include/net/gro_cells.h
new file mode 100644
index 000000000000..4fd8a4b4b7ee
--- /dev/null
+++ b/include/net/gro_cells.h
@@ -0,0 +1,103 @@
1#ifndef _NET_GRO_CELLS_H
2#define _NET_GRO_CELLS_H
3
4#include <linux/skbuff.h>
5#include <linux/slab.h>
6#include <linux/netdevice.h>
7
8struct gro_cell {
9 struct sk_buff_head napi_skbs;
10 struct napi_struct napi;
11} ____cacheline_aligned_in_smp;
12
13struct gro_cells {
14 unsigned int gro_cells_mask;
15 struct gro_cell *cells;
16};
17
18static inline void gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
19{
20 unsigned long flags;
21 struct gro_cell *cell = gcells->cells;
22 struct net_device *dev = skb->dev;
23
24 if (!cell || skb_cloned(skb) || !(dev->features & NETIF_F_GRO)) {
25 netif_rx(skb);
26 return;
27 }
28
29 if (skb_rx_queue_recorded(skb))
30 cell += skb_get_rx_queue(skb) & gcells->gro_cells_mask;
31
32 if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) {
33 atomic_long_inc(&dev->rx_dropped);
34 kfree_skb(skb);
35 return;
36 }
37
38 spin_lock_irqsave(&cell->napi_skbs.lock, flags);
39
40 __skb_queue_tail(&cell->napi_skbs, skb);
41 if (skb_queue_len(&cell->napi_skbs) == 1)
42 napi_schedule(&cell->napi);
43
44 spin_unlock_irqrestore(&cell->napi_skbs.lock, flags);
45}
46
47static inline int gro_cell_poll(struct napi_struct *napi, int budget)
48{
49 struct gro_cell *cell = container_of(napi, struct gro_cell, napi);
50 struct sk_buff *skb;
51 int work_done = 0;
52
53 while (work_done < budget) {
54 skb = skb_dequeue(&cell->napi_skbs);
55 if (!skb)
56 break;
57
58 napi_gro_receive(napi, skb);
59 work_done++;
60 }
61
62 if (work_done < budget)
63 napi_complete(napi);
64 return work_done;
65}
66
67static inline int gro_cells_init(struct gro_cells *gcells, struct net_device *dev)
68{
69 int i;
70
71 gcells->gro_cells_mask = roundup_pow_of_two(netif_get_num_default_rss_queues()) - 1;
72 gcells->cells = kcalloc(sizeof(struct gro_cell),
73 gcells->gro_cells_mask + 1,
74 GFP_KERNEL);
75 if (!gcells->cells)
76 return -ENOMEM;
77
78 for (i = 0; i <= gcells->gro_cells_mask; i++) {
79 struct gro_cell *cell = gcells->cells + i;
80
81 skb_queue_head_init(&cell->napi_skbs);
82 netif_napi_add(dev, &cell->napi, gro_cell_poll, 64);
83 napi_enable(&cell->napi);
84 }
85 return 0;
86}
87
88static inline void gro_cells_destroy(struct gro_cells *gcells)
89{
90 struct gro_cell *cell = gcells->cells;
91 int i;
92
93 if (!cell)
94 return;
95 for (i = 0; i <= gcells->gro_cells_mask; i++,cell++) {
96 netif_napi_del(&cell->napi);
97 skb_queue_purge(&cell->napi_skbs);
98 }
99 kfree(gcells->cells);
100 gcells->cells = NULL;
101}
102
103#endif
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 2fa14691869c..aab73757bc4d 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -15,6 +15,8 @@ enum {
15 INET_ECN_MASK = 3, 15 INET_ECN_MASK = 3,
16}; 16};
17 17
18extern int sysctl_tunnel_ecn_log;
19
18static inline int INET_ECN_is_ce(__u8 dsfield) 20static inline int INET_ECN_is_ce(__u8 dsfield)
19{ 21{
20 return (dsfield & INET_ECN_MASK) == INET_ECN_CE; 22 return (dsfield & INET_ECN_MASK) == INET_ECN_CE;
@@ -145,4 +147,78 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
145 return 0; 147 return 0;
146} 148}
147 149
150/*
151 * RFC 6080 4.2
152 * To decapsulate the inner header at the tunnel egress, a compliant
153 * tunnel egress MUST set the outgoing ECN field to the codepoint at the
154 * intersection of the appropriate arriving inner header (row) and outer
155 * header (column) in Figure 4
156 *
157 * +---------+------------------------------------------------+
158 * |Arriving | Arriving Outer Header |
159 * | Inner +---------+------------+------------+------------+
160 * | Header | Not-ECT | ECT(0) | ECT(1) | CE |
161 * +---------+---------+------------+------------+------------+
162 * | Not-ECT | Not-ECT |Not-ECT(!!!)|Not-ECT(!!!)| <drop>(!!!)|
163 * | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE |
164 * | ECT(1) | ECT(1) | ECT(1) (!) | ECT(1) | CE |
165 * | CE | CE | CE | CE(!!!)| CE |
166 * +---------+---------+------------+------------+------------+
167 *
168 * Figure 4: New IP in IP Decapsulation Behaviour
169 *
170 * returns 0 on success
171 * 1 if something is broken and should be logged (!!! above)
172 * 2 if packet should be dropped
173 */
174static inline int INET_ECN_decapsulate(struct sk_buff *skb,
175 __u8 outer, __u8 inner)
176{
177 if (INET_ECN_is_not_ect(inner)) {
178 switch (outer & INET_ECN_MASK) {
179 case INET_ECN_NOT_ECT:
180 return 0;
181 case INET_ECN_ECT_0:
182 case INET_ECN_ECT_1:
183 return 1;
184 case INET_ECN_CE:
185 return 2;
186 }
187 }
188
189 if (INET_ECN_is_ce(outer))
190 INET_ECN_set_ce(skb);
191
192 return 0;
193}
194
195static inline int IP_ECN_decapsulate(const struct iphdr *oiph,
196 struct sk_buff *skb)
197{
198 __u8 inner;
199
200 if (skb->protocol == htons(ETH_P_IP))
201 inner = ip_hdr(skb)->tos;
202 else if (skb->protocol == htons(ETH_P_IPV6))
203 inner = ipv6_get_dsfield(ipv6_hdr(skb));
204 else
205 return 0;
206
207 return INET_ECN_decapsulate(skb, oiph->tos, inner);
208}
209
210static inline int IP6_ECN_decapsulate(const struct ipv6hdr *oipv6h,
211 struct sk_buff *skb)
212{
213 __u8 inner;
214
215 if (skb->protocol == htons(ETH_P_IP))
216 inner = ip_hdr(skb)->tos;
217 else if (skb->protocol == htons(ETH_P_IPV6))
218 inner = ipv6_get_dsfield(ipv6_hdr(skb));
219 else
220 return 0;
221
222 return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner);
223}
148#endif 224#endif
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 2431cf83aeca..32786a044718 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -29,6 +29,8 @@ struct inet_frag_queue {
29#define INET_FRAG_COMPLETE 4 29#define INET_FRAG_COMPLETE 4
30#define INET_FRAG_FIRST_IN 2 30#define INET_FRAG_FIRST_IN 2
31#define INET_FRAG_LAST_IN 1 31#define INET_FRAG_LAST_IN 1
32
33 u16 max_size;
32}; 34};
33 35
34#define INETFRAGS_HASHSZ 64 36#define INETFRAGS_HASHSZ 64
@@ -59,7 +61,7 @@ void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
59void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); 61void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
60void inet_frag_destroy(struct inet_frag_queue *q, 62void inet_frag_destroy(struct inet_frag_queue *q,
61 struct inet_frags *f, int *work); 63 struct inet_frags *f, int *work);
62int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); 64int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f, bool force);
63struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, 65struct inet_frag_queue *inet_frag_find(struct netns_frags *nf,
64 struct inet_frags *f, void *key, unsigned int hash) 66 struct inet_frags *f, void *key, unsigned int hash)
65 __releases(&f->lock); 67 __releases(&f->lock);
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 613cfa401672..256c1ed2d69a 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -101,10 +101,8 @@ struct inet_cork {
101 __be32 addr; 101 __be32 addr;
102 struct ip_options *opt; 102 struct ip_options *opt;
103 unsigned int fragsize; 103 unsigned int fragsize;
104 struct dst_entry *dst;
105 int length; /* Total length of all frames */ 104 int length; /* Total length of all frames */
106 struct page *page; 105 struct dst_entry *dst;
107 u32 off;
108 u8 tx_flags; 106 u8 tx_flags;
109}; 107};
110 108
diff --git a/include/net/ip.h b/include/net/ip.h
index 5a5d84d3d2c6..0707fb9551aa 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -42,6 +42,8 @@ struct inet_skb_parm {
42#define IPSKB_XFRM_TRANSFORMED 4 42#define IPSKB_XFRM_TRANSFORMED 4
43#define IPSKB_FRAG_COMPLETE 8 43#define IPSKB_FRAG_COMPLETE 8
44#define IPSKB_REROUTED 16 44#define IPSKB_REROUTED 16
45
46 u16 frag_max_size;
45}; 47};
46 48
47static inline unsigned int ip_hdrlen(const struct sk_buff *skb) 49static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 0fedbd8d747a..8a2a203eb15d 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -37,6 +37,7 @@ struct fib6_config {
37 int fc_ifindex; 37 int fc_ifindex;
38 u32 fc_flags; 38 u32 fc_flags;
39 u32 fc_protocol; 39 u32 fc_protocol;
40 u32 fc_type; /* only 8 bits are used */
40 41
41 struct in6_addr fc_dst; 42 struct in6_addr fc_dst;
42 struct in6_addr fc_src; 43 struct in6_addr fc_src;
@@ -111,9 +112,8 @@ struct rt6_info {
111 struct inet6_dev *rt6i_idev; 112 struct inet6_dev *rt6i_idev;
112 unsigned long _rt6i_peer; 113 unsigned long _rt6i_peer;
113 114
114#ifdef CONFIG_XFRM 115 u32 rt6i_genid;
115 u32 rt6i_flow_cache_genid; 116
116#endif
117 /* more non-fragment space at head required */ 117 /* more non-fragment space at head required */
118 unsigned short rt6i_nfheader_len; 118 unsigned short rt6i_nfheader_len;
119 119
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 358fb86f57eb..e03047f7090b 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -5,6 +5,8 @@
5#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <linux/ip6_tunnel.h> 6#include <linux/ip6_tunnel.h>
7 7
8#define IP6TUNNEL_ERR_TIMEO (30*HZ)
9
8/* capable of sending packets */ 10/* capable of sending packets */
9#define IP6_TNL_F_CAP_XMIT 0x10000 11#define IP6_TNL_F_CAP_XMIT 0x10000
10/* capable of receiving packets */ 12/* capable of receiving packets */
@@ -12,15 +14,40 @@
12/* determine capability on a per-packet basis */ 14/* determine capability on a per-packet basis */
13#define IP6_TNL_F_CAP_PER_PACKET 0x40000 15#define IP6_TNL_F_CAP_PER_PACKET 0x40000
14 16
15/* IPv6 tunnel */ 17struct __ip6_tnl_parm {
18 char name[IFNAMSIZ]; /* name of tunnel device */
19 int link; /* ifindex of underlying L2 interface */
20 __u8 proto; /* tunnel protocol */
21 __u8 encap_limit; /* encapsulation limit for tunnel */
22 __u8 hop_limit; /* hop limit for tunnel */
23 __be32 flowinfo; /* traffic class and flowlabel for tunnel */
24 __u32 flags; /* tunnel flags */
25 struct in6_addr laddr; /* local tunnel end-point address */
26 struct in6_addr raddr; /* remote tunnel end-point address */
27
28 __be16 i_flags;
29 __be16 o_flags;
30 __be32 i_key;
31 __be32 o_key;
32};
16 33
34/* IPv6 tunnel */
17struct ip6_tnl { 35struct ip6_tnl {
18 struct ip6_tnl __rcu *next; /* next tunnel in list */ 36 struct ip6_tnl __rcu *next; /* next tunnel in list */
19 struct net_device *dev; /* virtual device associated with tunnel */ 37 struct net_device *dev; /* virtual device associated with tunnel */
20 struct ip6_tnl_parm parms; /* tunnel configuration parameters */ 38 struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
21 struct flowi fl; /* flowi template for xmit */ 39 struct flowi fl; /* flowi template for xmit */
22 struct dst_entry *dst_cache; /* cached dst */ 40 struct dst_entry *dst_cache; /* cached dst */
23 u32 dst_cookie; 41 u32 dst_cookie;
42
43 int err_count;
44 unsigned long err_time;
45
46 /* These fields used only by GRE */
47 __u32 i_seqno; /* The last seen seqno */
48 __u32 o_seqno; /* The last output seqno */
49 int hlen; /* Precalculated GRE header length */
50 int mlink;
24}; 51};
25 52
26/* Tunnel encapsulation limit destination sub-option */ 53/* Tunnel encapsulation limit destination sub-option */
@@ -31,4 +58,14 @@ struct ipv6_tlv_tnl_enc_lim {
31 __u8 encap_limit; /* tunnel encapsulation limit */ 58 __u8 encap_limit; /* tunnel encapsulation limit */
32} __packed; 59} __packed;
33 60
61struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t);
62void ip6_tnl_dst_reset(struct ip6_tnl *t);
63void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst);
64int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
65 const struct in6_addr *raddr);
66int ip6_tnl_xmit_ctl(struct ip6_tnl *t);
67__u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
68__u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
69 const struct in6_addr *raddr);
70
34#endif 71#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 926142ed8d7a..9497be1ad4c0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -102,6 +102,7 @@ struct fib_info {
102 unsigned char fib_dead; 102 unsigned char fib_dead;
103 unsigned char fib_protocol; 103 unsigned char fib_protocol;
104 unsigned char fib_scope; 104 unsigned char fib_scope;
105 unsigned char fib_type;
105 __be32 fib_prefsrc; 106 __be32 fib_prefsrc;
106 u32 fib_priority; 107 u32 fib_priority;
107 u32 *fib_metrics; 108 u32 *fib_metrics;
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 95374d1696a1..ee75ccdf5188 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -808,8 +808,6 @@ struct netns_ipvs {
808 struct list_head rs_table[IP_VS_RTAB_SIZE]; 808 struct list_head rs_table[IP_VS_RTAB_SIZE];
809 /* ip_vs_app */ 809 /* ip_vs_app */
810 struct list_head app_list; 810 struct list_head app_list;
811 /* ip_vs_ftp */
812 struct ip_vs_app *ftp_app;
813 /* ip_vs_proto */ 811 /* ip_vs_proto */
814 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ 812 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
815 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE]; 813 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
@@ -890,6 +888,7 @@ struct netns_ipvs {
890 unsigned int sysctl_sync_refresh_period; 888 unsigned int sysctl_sync_refresh_period;
891 int sysctl_sync_retries; 889 int sysctl_sync_retries;
892 int sysctl_nat_icmp_send; 890 int sysctl_nat_icmp_send;
891 int sysctl_pmtu_disc;
893 892
894 /* ip_vs_lblc */ 893 /* ip_vs_lblc */
895 int sysctl_lblc_expiration; 894 int sysctl_lblc_expiration;
@@ -976,6 +975,11 @@ static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
976 return ipvs->sysctl_sync_sock_size; 975 return ipvs->sysctl_sync_sock_size;
977} 976}
978 977
978static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs)
979{
980 return ipvs->sysctl_pmtu_disc;
981}
982
979#else 983#else
980 984
981static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs) 985static inline int sysctl_sync_threshold(struct netns_ipvs *ipvs)
@@ -1018,6 +1022,11 @@ static inline int sysctl_sync_sock_size(struct netns_ipvs *ipvs)
1018 return 0; 1022 return 0;
1019} 1023}
1020 1024
1025static inline int sysctl_pmtu_disc(struct netns_ipvs *ipvs)
1026{
1027 return 1;
1028}
1029
1021#endif 1030#endif
1022 1031
1023/* 1032/*
@@ -1179,7 +1188,8 @@ extern void ip_vs_service_net_cleanup(struct net *net);
1179 * (from ip_vs_app.c) 1188 * (from ip_vs_app.c)
1180 */ 1189 */
1181#define IP_VS_APP_MAX_PORTS 8 1190#define IP_VS_APP_MAX_PORTS 8
1182extern int register_ip_vs_app(struct net *net, struct ip_vs_app *app); 1191extern struct ip_vs_app *register_ip_vs_app(struct net *net,
1192 struct ip_vs_app *app);
1183extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); 1193extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1184extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1194extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1185extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1195extern void ip_vs_unbind_app(struct ip_vs_conn *cp);
diff --git a/include/net/ipip.h b/include/net/ipip.h
index a93cf6d7e94b..ddc077c51f32 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -2,6 +2,7 @@
2#define __NET_IPIP_H 1 2#define __NET_IPIP_H 1
3 3
4#include <linux/if_tunnel.h> 4#include <linux/if_tunnel.h>
5#include <net/gro_cells.h>
5#include <net/ip.h> 6#include <net/ip.h>
6 7
7/* Keep error state on tunnel for 30 sec */ 8/* Keep error state on tunnel for 30 sec */
@@ -36,6 +37,8 @@ struct ip_tunnel {
36#endif 37#endif
37 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ 38 struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
38 unsigned int prl_count; /* # of entries in PRL */ 39 unsigned int prl_count; /* # of entries in PRL */
40
41 struct gro_cells gro_cells;
39}; 42};
40 43
41struct ip_tunnel_prl_entry { 44struct ip_tunnel_prl_entry {
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 01c34b363a34..979bf6c13141 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -34,6 +34,7 @@
34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */ 34#define NEXTHDR_IPV6 41 /* IPv6 in IPv6 */
35#define NEXTHDR_ROUTING 43 /* Routing header. */ 35#define NEXTHDR_ROUTING 43 /* Routing header. */
36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */ 36#define NEXTHDR_FRAGMENT 44 /* Fragmentation/reassembly header. */
37#define NEXTHDR_GRE 47 /* GRE header. */
37#define NEXTHDR_ESP 50 /* Encapsulating security payload. */ 38#define NEXTHDR_ESP 50 /* Encapsulating security payload. */
38#define NEXTHDR_AUTH 51 /* Authentication header. */ 39#define NEXTHDR_AUTH 51 /* Authentication header. */
39#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */ 40#define NEXTHDR_ICMP 58 /* ICMP for IPv6. */
@@ -222,7 +223,10 @@ struct ip6_flowlabel {
222 struct ipv6_txoptions *opt; 223 struct ipv6_txoptions *opt;
223 unsigned long linger; 224 unsigned long linger;
224 u8 share; 225 u8 share;
225 u32 owner; 226 union {
227 struct pid *pid;
228 kuid_t uid;
229 } owner;
226 unsigned long lastuse; 230 unsigned long lastuse;
227 unsigned long expires; 231 unsigned long expires;
228 struct net *fl_net; 232 struct net *fl_net;
@@ -267,8 +271,17 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
267 271
268extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 272extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
269 273
270int ip6_frag_nqueues(struct net *net); 274#if IS_ENABLED(CONFIG_IPV6)
271int ip6_frag_mem(struct net *net); 275static inline int ip6_frag_nqueues(struct net *net)
276{
277 return net->ipv6.frags.nqueues;
278}
279
280static inline int ip6_frag_mem(struct net *net)
281{
282 return atomic_read(&net->ipv6.frags.mem);
283}
284#endif
272 285
273#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */ 286#define IPV6_FRAG_HIGH_THRESH (256 * 1024) /* 262144 */
274#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */ 287#define IPV6_FRAG_LOW_THRESH (192 * 1024) /* 196608 */
@@ -407,6 +420,25 @@ struct ip6_create_arg {
407void ip6_frag_init(struct inet_frag_queue *q, void *a); 420void ip6_frag_init(struct inet_frag_queue *q, void *a);
408bool ip6_frag_match(struct inet_frag_queue *q, void *a); 421bool ip6_frag_match(struct inet_frag_queue *q, void *a);
409 422
423/*
424 * Equivalent of ipv4 struct ip
425 */
426struct frag_queue {
427 struct inet_frag_queue q;
428
429 __be32 id; /* fragment id */
430 u32 user;
431 struct in6_addr saddr;
432 struct in6_addr daddr;
433
434 int iif;
435 unsigned int csum;
436 __u16 nhoffset;
437};
438
439void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
440 struct inet_frags *frags);
441
410static inline bool ipv6_addr_any(const struct in6_addr *a) 442static inline bool ipv6_addr_any(const struct in6_addr *a)
411{ 443{
412#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 444#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index 59ba38bc400f..80ffde3bb164 100644
--- a/include/net/irda/ircomm_tty.h
+++ b/include/net/irda/ircomm_tty.h
@@ -52,21 +52,16 @@
52/* Same for payload size. See qos.c for the smallest max data size */ 52/* Same for payload size. See qos.c for the smallest max data size */
53#define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED) 53#define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED)
54 54
55/* Those are really defined in include/linux/serial.h - Jean II */
56#define ASYNC_B_INITIALIZED 31 /* Serial port was initialized */
57#define ASYNC_B_NORMAL_ACTIVE 29 /* Normal device is active */
58#define ASYNC_B_CLOSING 27 /* Serial port is closing */
59
60/* 55/*
61 * IrCOMM TTY driver state 56 * IrCOMM TTY driver state
62 */ 57 */
63struct ircomm_tty_cb { 58struct ircomm_tty_cb {
64 irda_queue_t queue; /* Must be first */ 59 irda_queue_t queue; /* Must be first */
60 struct tty_port port;
65 magic_t magic; 61 magic_t magic;
66 62
67 int state; /* Connect state */ 63 int state; /* Connect state */
68 64
69 struct tty_struct *tty;
70 struct ircomm_cb *ircomm; /* IrCOMM layer instance */ 65 struct ircomm_cb *ircomm; /* IrCOMM layer instance */
71 66
72 struct sk_buff *tx_skb; /* Transmit buffer */ 67 struct sk_buff *tx_skb; /* Transmit buffer */
@@ -80,7 +75,6 @@ struct ircomm_tty_cb {
80 LOCAL_FLOW flow; /* IrTTP flow status */ 75 LOCAL_FLOW flow; /* IrTTP flow status */
81 76
82 int line; 77 int line;
83 unsigned long flags;
84 78
85 __u8 dlsap_sel; 79 __u8 dlsap_sel;
86 __u8 slsap_sel; 80 __u8 slsap_sel;
@@ -97,19 +91,10 @@ struct ircomm_tty_cb {
97 void *skey; 91 void *skey;
98 void *ckey; 92 void *ckey;
99 93
100 wait_queue_head_t open_wait;
101 wait_queue_head_t close_wait;
102 struct timer_list watchdog_timer; 94 struct timer_list watchdog_timer;
103 struct work_struct tqueue; 95 struct work_struct tqueue;
104 96
105 unsigned short close_delay;
106 unsigned short closing_wait; /* time to wait before closing */
107
108 int open_count;
109 int blocked_open; /* # of blocked opens */
110
111 /* Protect concurent access to : 97 /* Protect concurent access to :
112 * o self->open_count
113 * o self->ctrl_skb 98 * o self->ctrl_skb
114 * o self->tx_skb 99 * o self->tx_skb
115 * Maybe other things may gain to be protected as well... 100 * Maybe other things may gain to be protected as well...
diff --git a/include/net/llc.h b/include/net/llc.h
index 226c846cab08..9e7d7f08ef77 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -133,7 +133,7 @@ extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
133extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); 133extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
134extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); 134extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
135 135
136extern int llc_station_init(void); 136extern void llc_station_init(void);
137extern void llc_station_exit(void); 137extern void llc_station_exit(void);
138 138
139#ifdef CONFIG_PROC_FS 139#ifdef CONFIG_PROC_FS
@@ -151,7 +151,6 @@ extern int sysctl_llc2_ack_timeout;
151extern int sysctl_llc2_busy_timeout; 151extern int sysctl_llc2_busy_timeout;
152extern int sysctl_llc2_p_timeout; 152extern int sysctl_llc2_p_timeout;
153extern int sysctl_llc2_rej_timeout; 153extern int sysctl_llc2_rej_timeout;
154extern int sysctl_llc_station_ack_timeout;
155#else 154#else
156#define llc_sysctl_init() (0) 155#define llc_sysctl_init() (0)
157#define llc_sysctl_exit() do { } while(0) 156#define llc_sysctl_exit() do { } while(0)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 71f8262fc1df..82558c8decf8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -973,21 +973,29 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
973 * generation in software. 973 * generation in software.
974 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates 974 * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
975 * that the key is pairwise rather then a shared key. 975 * that the key is pairwise rather then a shared key.
976 * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a 976 * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
977 * CCMP key if it requires CCMP encryption of management frames (MFP) to 977 * CCMP key if it requires CCMP encryption of management frames (MFP) to
978 * be done in software. 978 * be done in software.
979 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 979 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
980 * if space should be prepared for the IV, but the IV 980 * if space should be prepared for the IV, but the IV
981 * itself should not be generated. Do not set together with 981 * itself should not be generated. Do not set together with
982 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. 982 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
983 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
984 * management frames. The flag can help drivers that have a hardware
985 * crypto implementation that doesn't deal with management frames
986 * properly by allowing them to not upload the keys to hardware and
987 * fall back to software crypto. Note that this flag deals only with
988 * RX, if your crypto engine can't deal with TX you can also set the
989 * %IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
983 */ 990 */
984enum ieee80211_key_flags { 991enum ieee80211_key_flags {
985 IEEE80211_KEY_FLAG_WMM_STA = 1<<0, 992 IEEE80211_KEY_FLAG_WMM_STA = 1<<0,
986 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, 993 IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1,
987 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, 994 IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
988 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, 995 IEEE80211_KEY_FLAG_PAIRWISE = 1<<3,
989 IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, 996 IEEE80211_KEY_FLAG_SW_MGMT_TX = 1<<4,
990 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, 997 IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5,
998 IEEE80211_KEY_FLAG_RX_MGMT = 1<<6,
991}; 999};
992 1000
993/** 1001/**
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 96a3b5c03e37..980d263765cf 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -49,6 +49,7 @@ enum {
49#include <linux/types.h> 49#include <linux/types.h>
50#include <linux/if_arp.h> 50#include <linux/if_arp.h>
51#include <linux/netdevice.h> 51#include <linux/netdevice.h>
52#include <linux/hash.h>
52 53
53#include <net/neighbour.h> 54#include <net/neighbour.h>
54 55
@@ -134,7 +135,7 @@ static inline u32 ndisc_hashfn(const void *pkey, const struct net_device *dev, _
134{ 135{
135 const u32 *p32 = pkey; 136 const u32 *p32 = pkey;
136 137
137 return (((p32[0] ^ dev->ifindex) * hash_rnd[0]) + 138 return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
138 (p32[1] * hash_rnd[1]) + 139 (p32[1] * hash_rnd[1]) +
139 (p32[2] * hash_rnd[2]) + 140 (p32[2] * hash_rnd[2]) +
140 (p32[3] * hash_rnd[3])); 141 (p32[3] * hash_rnd[3]));
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 344d8988842a..0dab173e27da 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -334,18 +334,22 @@ static inline int neigh_hh_bridge(struct hh_cache *hh, struct sk_buff *skb)
334} 334}
335#endif 335#endif
336 336
337static inline int neigh_hh_output(struct hh_cache *hh, struct sk_buff *skb) 337static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb)
338{ 338{
339 unsigned int seq; 339 unsigned int seq;
340 int hh_len; 340 int hh_len;
341 341
342 do { 342 do {
343 int hh_alen;
344
345 seq = read_seqbegin(&hh->hh_lock); 343 seq = read_seqbegin(&hh->hh_lock);
346 hh_len = hh->hh_len; 344 hh_len = hh->hh_len;
347 hh_alen = HH_DATA_ALIGN(hh_len); 345 if (likely(hh_len <= HH_DATA_MOD)) {
348 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen); 346 /* this is inlined by gcc */
347 memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
348 } else {
349 int hh_alen = HH_DATA_ALIGN(hh_len);
350
351 memcpy(skb->data - hh_alen, hh->hh_data, hh_alen);
352 }
349 } while (read_seqretry(&hh->hh_lock, seq)); 353 } while (read_seqretry(&hh->hh_lock, seq));
350 354
351 skb_push(skb, hh_len); 355 skb_push(skb, hh_len);
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index ae1cd6c9ba52..95e646641184 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -15,6 +15,7 @@
15#include <net/netns/packet.h> 15#include <net/netns/packet.h>
16#include <net/netns/ipv4.h> 16#include <net/netns/ipv4.h>
17#include <net/netns/ipv6.h> 17#include <net/netns/ipv6.h>
18#include <net/netns/sctp.h>
18#include <net/netns/dccp.h> 19#include <net/netns/dccp.h>
19#include <net/netns/x_tables.h> 20#include <net/netns/x_tables.h>
20#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 21#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -66,6 +67,7 @@ struct net {
66 struct hlist_head *dev_name_head; 67 struct hlist_head *dev_name_head;
67 struct hlist_head *dev_index_head; 68 struct hlist_head *dev_index_head;
68 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 69 unsigned int dev_base_seq; /* protected by rtnl_mutex */
70 int ifindex;
69 71
70 /* core fib_rules */ 72 /* core fib_rules */
71 struct list_head rules_ops; 73 struct list_head rules_ops;
@@ -80,6 +82,9 @@ struct net {
80#if IS_ENABLED(CONFIG_IPV6) 82#if IS_ENABLED(CONFIG_IPV6)
81 struct netns_ipv6 ipv6; 83 struct netns_ipv6 ipv6;
82#endif 84#endif
85#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
86 struct netns_sctp sctp;
87#endif
83#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) 88#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
84 struct netns_dccp dccp; 89 struct netns_dccp dccp;
85#endif 90#endif
@@ -88,6 +93,9 @@ struct net {
88#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 93#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
89 struct netns_ct ct; 94 struct netns_ct ct;
90#endif 95#endif
96#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
97 struct netns_nf_frag nf_frag;
98#endif
91 struct sock *nfnl; 99 struct sock *nfnl;
92 struct sock *nfnl_stash; 100 struct sock *nfnl_stash;
93#endif 101#endif
@@ -102,8 +110,16 @@ struct net {
102#endif 110#endif
103 struct netns_ipvs *ipvs; 111 struct netns_ipvs *ipvs;
104 struct sock *diag_nlsk; 112 struct sock *diag_nlsk;
113 atomic_t rt_genid;
105}; 114};
106 115
116/*
117 * ifindex generation is per-net namespace, and loopback is
118 * always the 1st device in ns (see net_dev_init), thus any
119 * loopback device should get ifindex 1
120 */
121
122#define LOOPBACK_IFINDEX 1
107 123
108#include <linux/seq_file_net.h> 124#include <linux/seq_file_net.h>
109 125
@@ -241,10 +257,12 @@ static inline struct net *read_pnet(struct net * const *pnet)
241#define __net_init 257#define __net_init
242#define __net_exit 258#define __net_exit
243#define __net_initdata 259#define __net_initdata
260#define __net_initconst
244#else 261#else
245#define __net_init __init 262#define __net_init __init
246#define __net_exit __exit_refok 263#define __net_exit __exit_refok
247#define __net_initdata __initdata 264#define __net_initdata __initdata
265#define __net_initconst __initconst
248#endif 266#endif
249 267
250struct pernet_operations { 268struct pernet_operations {
@@ -300,5 +318,14 @@ static inline void unregister_net_sysctl_table(struct ctl_table_header *header)
300} 318}
301#endif 319#endif
302 320
321static inline int rt_genid(struct net *net)
322{
323 return atomic_read(&net->rt_genid);
324}
325
326static inline void rt_genid_bump(struct net *net)
327{
328 atomic_inc(&net->rt_genid);
329}
303 330
304#endif /* __NET_NET_NAMESPACE_H */ 331#endif /* __NET_NET_NAMESPACE_H */
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index e1ce1048fe5f..5654d292efd4 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -17,7 +17,8 @@ struct nf_conntrack_ecache {
17 unsigned long missed; /* missed events */ 17 unsigned long missed; /* missed events */
18 u16 ctmask; /* bitmask of ct events to be delivered */ 18 u16 ctmask; /* bitmask of ct events to be delivered */
19 u16 expmask; /* bitmask of expect events to be delivered */ 19 u16 expmask; /* bitmask of expect events to be delivered */
20 u32 pid; /* netlink pid of destroyer */ 20 u32 portid; /* netlink portid of destroyer */
21 struct timer_list timeout;
21}; 22};
22 23
23static inline struct nf_conntrack_ecache * 24static inline struct nf_conntrack_ecache *
@@ -59,7 +60,7 @@ nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp)
59/* This structure is passed to event handler */ 60/* This structure is passed to event handler */
60struct nf_ct_event { 61struct nf_ct_event {
61 struct nf_conn *ct; 62 struct nf_conn *ct;
62 u32 pid; 63 u32 portid;
63 int report; 64 int report;
64}; 65};
65 66
@@ -91,7 +92,7 @@ nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
91static inline int 92static inline int
92nf_conntrack_eventmask_report(unsigned int eventmask, 93nf_conntrack_eventmask_report(unsigned int eventmask,
93 struct nf_conn *ct, 94 struct nf_conn *ct,
94 u32 pid, 95 u32 portid,
95 int report) 96 int report)
96{ 97{
97 int ret = 0; 98 int ret = 0;
@@ -111,11 +112,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
111 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) { 112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
112 struct nf_ct_event item = { 113 struct nf_ct_event item = {
113 .ct = ct, 114 .ct = ct,
114 .pid = e->pid ? e->pid : pid, 115 .portid = e->portid ? e->portid : portid,
115 .report = report 116 .report = report
116 }; 117 };
117 /* This is a resent of a destroy event? If so, skip missed */ 118 /* This is a resent of a destroy event? If so, skip missed */
118 unsigned long missed = e->pid ? 0 : e->missed; 119 unsigned long missed = e->portid ? 0 : e->missed;
119 120
120 if (!((eventmask | missed) & e->ctmask)) 121 if (!((eventmask | missed) & e->ctmask))
121 goto out_unlock; 122 goto out_unlock;
@@ -125,11 +126,11 @@ nf_conntrack_eventmask_report(unsigned int eventmask,
125 spin_lock_bh(&ct->lock); 126 spin_lock_bh(&ct->lock);
126 if (ret < 0) { 127 if (ret < 0) {
127 /* This is a destroy event that has been 128 /* This is a destroy event that has been
128 * triggered by a process, we store the PID 129 * triggered by a process, we store the PORTID
129 * to include it in the retransmission. */ 130 * to include it in the retransmission. */
130 if (eventmask & (1 << IPCT_DESTROY) && 131 if (eventmask & (1 << IPCT_DESTROY) &&
131 e->pid == 0 && pid != 0) 132 e->portid == 0 && portid != 0)
132 e->pid = pid; 133 e->portid = portid;
133 else 134 else
134 e->missed |= eventmask; 135 e->missed |= eventmask;
135 } else 136 } else
@@ -144,9 +145,9 @@ out_unlock:
144 145
145static inline int 146static inline int
146nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, 147nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
147 u32 pid, int report) 148 u32 portid, int report)
148{ 149{
149 return nf_conntrack_eventmask_report(1 << event, ct, pid, report); 150 return nf_conntrack_eventmask_report(1 << event, ct, portid, report);
150} 151}
151 152
152static inline int 153static inline int
@@ -157,7 +158,7 @@ nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
157 158
158struct nf_exp_event { 159struct nf_exp_event {
159 struct nf_conntrack_expect *exp; 160 struct nf_conntrack_expect *exp;
160 u32 pid; 161 u32 portid;
161 int report; 162 int report;
162}; 163};
163 164
@@ -171,7 +172,7 @@ extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_even
171static inline void 172static inline void
172nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 173nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
173 struct nf_conntrack_expect *exp, 174 struct nf_conntrack_expect *exp,
174 u32 pid, 175 u32 portid,
175 int report) 176 int report)
176{ 177{
177 struct net *net = nf_ct_exp_net(exp); 178 struct net *net = nf_ct_exp_net(exp);
@@ -190,7 +191,7 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
190 if (e->expmask & (1 << event)) { 191 if (e->expmask & (1 << event)) {
191 struct nf_exp_event item = { 192 struct nf_exp_event item = {
192 .exp = exp, 193 .exp = exp,
193 .pid = pid, 194 .portid = portid,
194 .report = report 195 .report = report
195 }; 196 };
196 notify->fcn(1 << event, &item); 197 notify->fcn(1 << event, &item);
@@ -215,20 +216,20 @@ static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
215 struct nf_conn *ct) {} 216 struct nf_conn *ct) {}
216static inline int nf_conntrack_eventmask_report(unsigned int eventmask, 217static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
217 struct nf_conn *ct, 218 struct nf_conn *ct,
218 u32 pid, 219 u32 portid,
219 int report) { return 0; } 220 int report) { return 0; }
220static inline int nf_conntrack_event(enum ip_conntrack_events event, 221static inline int nf_conntrack_event(enum ip_conntrack_events event,
221 struct nf_conn *ct) { return 0; } 222 struct nf_conn *ct) { return 0; }
222static inline int nf_conntrack_event_report(enum ip_conntrack_events event, 223static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
223 struct nf_conn *ct, 224 struct nf_conn *ct,
224 u32 pid, 225 u32 portid,
225 int report) { return 0; } 226 int report) { return 0; }
226static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 227static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
227static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 228static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
228 struct nf_conntrack_expect *exp) {} 229 struct nf_conntrack_expect *exp) {}
229static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, 230static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
230 struct nf_conntrack_expect *exp, 231 struct nf_conntrack_expect *exp,
231 u32 pid, 232 u32 portid,
232 int report) {} 233 int report) {}
233 234
234static inline int nf_conntrack_ecache_init(struct net *net) 235static inline int nf_conntrack_ecache_init(struct net *net)
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index 983f00263243..cc13f377a705 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -43,7 +43,7 @@ struct nf_conntrack_expect {
43 unsigned int class; 43 unsigned int class;
44 44
45#ifdef CONFIG_NF_NAT_NEEDED 45#ifdef CONFIG_NF_NAT_NEEDED
46 __be32 saved_ip; 46 union nf_inet_addr saved_addr;
47 /* This is the original per-proto part, used to map the 47 /* This is the original per-proto part, used to map the
48 * expected connection the way the recipient expects. */ 48 * expected connection the way the recipient expects. */
49 union nf_conntrack_man_proto saved_proto; 49 union nf_conntrack_man_proto saved_proto;
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index 34ec89f8dbf9..e41e472d08f2 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -55,6 +55,26 @@ struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
55#endif 55#endif
56}; 56};
57 57
58static inline unsigned int *
59nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
60 struct nf_conntrack_l4proto *l4proto)
61{
62#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
63 struct nf_conn_timeout *timeout_ext;
64 unsigned int *timeouts;
65
66 timeout_ext = nf_ct_timeout_find(ct);
67 if (timeout_ext)
68 timeouts = NF_CT_TIMEOUT_EXT_DATA(timeout_ext);
69 else
70 timeouts = l4proto->get_timeouts(net);
71
72 return timeouts;
73#else
74 return l4proto->get_timeouts(net);
75#endif
76}
77
58#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
59extern int nf_conntrack_timeout_init(struct net *net); 79extern int nf_conntrack_timeout_init(struct net *net);
60extern void nf_conntrack_timeout_fini(struct net *net); 80extern void nf_conntrack_timeout_fini(struct net *net);
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index b4de990b55f1..bd8eea720f2e 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -43,14 +43,16 @@ struct nf_conn_nat {
43 struct nf_conn *ct; 43 struct nf_conn *ct;
44 union nf_conntrack_nat_help help; 44 union nf_conntrack_nat_help help;
45#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \ 45#if defined(CONFIG_IP_NF_TARGET_MASQUERADE) || \
46 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) 46 defined(CONFIG_IP_NF_TARGET_MASQUERADE_MODULE) || \
47 defined(CONFIG_IP6_NF_TARGET_MASQUERADE) || \
48 defined(CONFIG_IP6_NF_TARGET_MASQUERADE_MODULE)
47 int masq_index; 49 int masq_index;
48#endif 50#endif
49}; 51};
50 52
51/* Set up the info structure to map into this range. */ 53/* Set up the info structure to map into this range. */
52extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 54extern unsigned int nf_nat_setup_info(struct nf_conn *ct,
53 const struct nf_nat_ipv4_range *range, 55 const struct nf_nat_range *range,
54 enum nf_nat_manip_type maniptype); 56 enum nf_nat_manip_type maniptype);
55 57
56/* Is this tuple already taken? (not by us)*/ 58/* Is this tuple already taken? (not by us)*/
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index b13d8d18d595..972e1e47ec79 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -12,10 +12,7 @@ extern unsigned int nf_nat_packet(struct nf_conn *ct,
12 unsigned int hooknum, 12 unsigned int hooknum,
13 struct sk_buff *skb); 13 struct sk_buff *skb);
14 14
15extern int nf_nat_icmp_reply_translation(struct nf_conn *ct, 15extern int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family);
16 enum ip_conntrack_info ctinfo,
17 unsigned int hooknum,
18 struct sk_buff *skb);
19 16
20static inline int nf_nat_initialized(struct nf_conn *ct, 17static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 18 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 7d8fb7b46c44..b4d6bfc2af03 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -10,6 +10,7 @@ struct sk_buff;
10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int protoff,
13 unsigned int match_offset, 14 unsigned int match_offset,
14 unsigned int match_len, 15 unsigned int match_len,
15 const char *rep_buffer, 16 const char *rep_buffer,
@@ -18,12 +19,13 @@ extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
18static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 19static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
19 struct nf_conn *ct, 20 struct nf_conn *ct,
20 enum ip_conntrack_info ctinfo, 21 enum ip_conntrack_info ctinfo,
22 unsigned int protoff,
21 unsigned int match_offset, 23 unsigned int match_offset,
22 unsigned int match_len, 24 unsigned int match_len,
23 const char *rep_buffer, 25 const char *rep_buffer,
24 unsigned int rep_len) 26 unsigned int rep_len)
25{ 27{
26 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, 28 return __nf_nat_mangle_tcp_packet(skb, ct, ctinfo, protoff,
27 match_offset, match_len, 29 match_offset, match_len,
28 rep_buffer, rep_len, true); 30 rep_buffer, rep_len, true);
29} 31}
@@ -31,6 +33,7 @@ static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
31extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 33extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
32 struct nf_conn *ct, 34 struct nf_conn *ct,
33 enum ip_conntrack_info ctinfo, 35 enum ip_conntrack_info ctinfo,
36 unsigned int protoff,
34 unsigned int match_offset, 37 unsigned int match_offset,
35 unsigned int match_len, 38 unsigned int match_len,
36 const char *rep_buffer, 39 const char *rep_buffer,
@@ -41,10 +44,12 @@ extern void nf_nat_set_seq_adjust(struct nf_conn *ct,
41 __be32 seq, s16 off); 44 __be32 seq, s16 off);
42extern int nf_nat_seq_adjust(struct sk_buff *skb, 45extern int nf_nat_seq_adjust(struct sk_buff *skb,
43 struct nf_conn *ct, 46 struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo); 47 enum ip_conntrack_info ctinfo,
48 unsigned int protoff);
45extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb, 49extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
46 struct nf_conn *ct, 50 struct nf_conn *ct,
47 enum ip_conntrack_info ctinfo); 51 enum ip_conntrack_info ctinfo,
52 unsigned int protoff);
48 53
49/* Setup NAT on this expected conntrack so it follows master, but goes 54/* Setup NAT on this expected conntrack so it follows master, but goes
50 * to port ct->master->saved_proto. */ 55 * to port ct->master->saved_proto. */
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
new file mode 100644
index 000000000000..bd3b97e02c82
--- /dev/null
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -0,0 +1,52 @@
1#ifndef _NF_NAT_L3PROTO_H
2#define _NF_NAT_L3PROTO_H
3
4struct nf_nat_l4proto;
5struct nf_nat_l3proto {
6 u8 l3proto;
7
8 bool (*in_range)(const struct nf_conntrack_tuple *t,
9 const struct nf_nat_range *range);
10
11 u32 (*secure_port)(const struct nf_conntrack_tuple *t, __be16);
12
13 bool (*manip_pkt)(struct sk_buff *skb,
14 unsigned int iphdroff,
15 const struct nf_nat_l4proto *l4proto,
16 const struct nf_conntrack_tuple *target,
17 enum nf_nat_manip_type maniptype);
18
19 void (*csum_update)(struct sk_buff *skb, unsigned int iphdroff,
20 __sum16 *check,
21 const struct nf_conntrack_tuple *t,
22 enum nf_nat_manip_type maniptype);
23
24 void (*csum_recalc)(struct sk_buff *skb, u8 proto,
25 void *data, __sum16 *check,
26 int datalen, int oldlen);
27
28 void (*decode_session)(struct sk_buff *skb,
29 const struct nf_conn *ct,
30 enum ip_conntrack_dir dir,
31 unsigned long statusbit,
32 struct flowi *fl);
33
34 int (*nlattr_to_range)(struct nlattr *tb[],
35 struct nf_nat_range *range);
36};
37
38extern int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39extern void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40extern const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
41
42extern int nf_nat_icmp_reply_translation(struct sk_buff *skb,
43 struct nf_conn *ct,
44 enum ip_conntrack_info ctinfo,
45 unsigned int hooknum);
46extern int nf_nat_icmpv6_reply_translation(struct sk_buff *skb,
47 struct nf_conn *ct,
48 enum ip_conntrack_info ctinfo,
49 unsigned int hooknum,
50 unsigned int hdrlen);
51
52#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
new file mode 100644
index 000000000000..24feb68d1bcc
--- /dev/null
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -0,0 +1,72 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_L4PROTO_H
3#define _NF_NAT_L4PROTO_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_range;
8struct nf_nat_l3proto;
9
10struct nf_nat_l4proto {
11 /* Protocol number. */
12 u8 l4proto;
13
14 /* Translate a packet to the target according to manip type.
15 * Return true if succeeded.
16 */
17 bool (*manip_pkt)(struct sk_buff *skb,
18 const struct nf_nat_l3proto *l3proto,
19 unsigned int iphdroff, unsigned int hdroff,
20 const struct nf_conntrack_tuple *tuple,
21 enum nf_nat_manip_type maniptype);
22
23 /* Is the manipable part of the tuple between min and max incl? */
24 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
25 enum nf_nat_manip_type maniptype,
26 const union nf_conntrack_man_proto *min,
27 const union nf_conntrack_man_proto *max);
28
29 /* Alter the per-proto part of the tuple (depending on
30 * maniptype), to give a unique tuple in the given range if
31 * possible. Per-protocol part of tuple is initialized to the
32 * incoming packet.
33 */
34 void (*unique_tuple)(const struct nf_nat_l3proto *l3proto,
35 struct nf_conntrack_tuple *tuple,
36 const struct nf_nat_range *range,
37 enum nf_nat_manip_type maniptype,
38 const struct nf_conn *ct);
39
40 int (*nlattr_to_range)(struct nlattr *tb[],
41 struct nf_nat_range *range);
42};
43
44/* Protocol registration. */
45extern int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
46extern void nf_nat_l4proto_unregister(u8 l3proto, const struct nf_nat_l4proto *l4proto);
47
48extern const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
49
50/* Built-in protocols. */
51extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
52extern const struct nf_nat_l4proto nf_nat_l4proto_udp;
53extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
55extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
56
57extern bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype,
59 const union nf_conntrack_man_proto *min,
60 const union nf_conntrack_man_proto *max);
61
62extern void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
63 struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range,
65 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct,
67 u16 *rover);
68
69extern int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
70 struct nf_nat_range *range);
71
72#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
deleted file mode 100644
index 7b0b51165f70..000000000000
--- a/include/net/netfilter/nf_nat_protocol.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/* Header for use in defining a given protocol. */
2#ifndef _NF_NAT_PROTOCOL_H
3#define _NF_NAT_PROTOCOL_H
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter/nfnetlink_conntrack.h>
6
7struct nf_nat_ipv4_range;
8
9struct nf_nat_protocol {
10 /* Protocol number. */
11 unsigned int protonum;
12
13 /* Translate a packet to the target according to manip type.
14 Return true if succeeded. */
15 bool (*manip_pkt)(struct sk_buff *skb,
16 unsigned int iphdroff,
17 const struct nf_conntrack_tuple *tuple,
18 enum nf_nat_manip_type maniptype);
19
20 /* Is the manipable part of the tuple between min and max incl? */
21 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
22 enum nf_nat_manip_type maniptype,
23 const union nf_conntrack_man_proto *min,
24 const union nf_conntrack_man_proto *max);
25
26 /* Alter the per-proto part of the tuple (depending on
27 maniptype), to give a unique tuple in the given range if
28 possible. Per-protocol part of tuple is initialized to the
29 incoming packet. */
30 void (*unique_tuple)(struct nf_conntrack_tuple *tuple,
31 const struct nf_nat_ipv4_range *range,
32 enum nf_nat_manip_type maniptype,
33 const struct nf_conn *ct);
34
35 int (*nlattr_to_range)(struct nlattr *tb[],
36 struct nf_nat_ipv4_range *range);
37};
38
39/* Protocol registration. */
40extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto);
41extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto);
42
43/* Built-in protocols. */
44extern const struct nf_nat_protocol nf_nat_protocol_tcp;
45extern const struct nf_nat_protocol nf_nat_protocol_udp;
46extern const struct nf_nat_protocol nf_nat_protocol_icmp;
47extern const struct nf_nat_protocol nf_nat_unknown_protocol;
48
49extern int init_protocols(void) __init;
50extern void cleanup_protocols(void);
51extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
52
53extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
54 enum nf_nat_manip_type maniptype,
55 const union nf_conntrack_man_proto *min,
56 const union nf_conntrack_man_proto *max);
57
58extern void nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
59 const struct nf_nat_ipv4_range *range,
60 enum nf_nat_manip_type maniptype,
61 const struct nf_conn *ct,
62 u_int16_t *rover);
63
64extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
65 struct nf_nat_ipv4_range *range);
66
67#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
deleted file mode 100644
index 2890bdc4cd92..000000000000
--- a/include/net/netfilter/nf_nat_rule.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _NF_NAT_RULE_H
2#define _NF_NAT_RULE_H
3#include <net/netfilter/nf_conntrack.h>
4#include <net/netfilter/nf_nat.h>
5#include <linux/netfilter_ipv4/ip_tables.h>
6
7extern int nf_nat_rule_init(void) __init;
8extern void nf_nat_rule_cleanup(void);
9extern int nf_nat_rule_find(struct sk_buff *skb,
10 unsigned int hooknum,
11 const struct net_device *in,
12 const struct net_device *out,
13 struct nf_conn *ct);
14
15#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index f67440970d7e..2c95d55f7914 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -110,7 +110,7 @@ struct cipso_v4_doi;
110/* NetLabel audit information */ 110/* NetLabel audit information */
111struct netlbl_audit { 111struct netlbl_audit {
112 u32 secid; 112 u32 secid;
113 uid_t loginuid; 113 kuid_t loginuid;
114 u32 sessionid; 114 u32 sessionid;
115}; 115};
116 116
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 785f37a3b44e..9690b0f6698a 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -98,6 +98,10 @@
98 * nla_put_u16(skb, type, value) add u16 attribute to skb 98 * nla_put_u16(skb, type, value) add u16 attribute to skb
99 * nla_put_u32(skb, type, value) add u32 attribute to skb 99 * nla_put_u32(skb, type, value) add u32 attribute to skb
100 * nla_put_u64(skb, type, value) add u64 attribute to skb 100 * nla_put_u64(skb, type, value) add u64 attribute to skb
101 * nla_put_s8(skb, type, value) add s8 attribute to skb
102 * nla_put_s16(skb, type, value) add s16 attribute to skb
103 * nla_put_s32(skb, type, value) add s32 attribute to skb
104 * nla_put_s64(skb, type, value) add s64 attribute to skb
101 * nla_put_string(skb, type, str) add string attribute to skb 105 * nla_put_string(skb, type, str) add string attribute to skb
102 * nla_put_flag(skb, type) add flag attribute to skb 106 * nla_put_flag(skb, type) add flag attribute to skb
103 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb 107 * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb
@@ -121,6 +125,10 @@
121 * nla_get_u16(nla) get payload for a u16 attribute 125 * nla_get_u16(nla) get payload for a u16 attribute
122 * nla_get_u32(nla) get payload for a u32 attribute 126 * nla_get_u32(nla) get payload for a u32 attribute
123 * nla_get_u64(nla) get payload for a u64 attribute 127 * nla_get_u64(nla) get payload for a u64 attribute
128 * nla_get_s8(nla) get payload for a s8 attribute
129 * nla_get_s16(nla) get payload for a s16 attribute
130 * nla_get_s32(nla) get payload for a s32 attribute
131 * nla_get_s64(nla) get payload for a s64 attribute
124 * nla_get_flag(nla) return 1 if flag is true 132 * nla_get_flag(nla) return 1 if flag is true
125 * nla_get_msecs(nla) get payload for a msecs attribute 133 * nla_get_msecs(nla) get payload for a msecs attribute
126 * 134 *
@@ -160,6 +168,10 @@ enum {
160 NLA_NESTED_COMPAT, 168 NLA_NESTED_COMPAT,
161 NLA_NUL_STRING, 169 NLA_NUL_STRING,
162 NLA_BINARY, 170 NLA_BINARY,
171 NLA_S8,
172 NLA_S16,
173 NLA_S32,
174 NLA_S64,
163 __NLA_TYPE_MAX, 175 __NLA_TYPE_MAX,
164}; 176};
165 177
@@ -183,6 +195,8 @@ enum {
183 * NLA_NESTED_COMPAT Minimum length of structure payload 195 * NLA_NESTED_COMPAT Minimum length of structure payload
184 * NLA_U8, NLA_U16, 196 * NLA_U8, NLA_U16,
185 * NLA_U32, NLA_U64, 197 * NLA_U32, NLA_U64,
198 * NLA_S8, NLA_S16,
199 * NLA_S32, NLA_S64,
186 * NLA_MSECS Leaving the length field zero will verify the 200 * NLA_MSECS Leaving the length field zero will verify the
187 * given type fits, using it verifies minimum length 201 * given type fits, using it verifies minimum length
188 * just like "All other" 202 * just like "All other"
@@ -203,19 +217,19 @@ struct nla_policy {
203/** 217/**
204 * struct nl_info - netlink source information 218 * struct nl_info - netlink source information
205 * @nlh: Netlink message header of original request 219 * @nlh: Netlink message header of original request
206 * @pid: Netlink PID of requesting application 220 * @portid: Netlink PORTID of requesting application
207 */ 221 */
208struct nl_info { 222struct nl_info {
209 struct nlmsghdr *nlh; 223 struct nlmsghdr *nlh;
210 struct net *nl_net; 224 struct net *nl_net;
211 u32 pid; 225 u32 portid;
212}; 226};
213 227
214extern int netlink_rcv_skb(struct sk_buff *skb, 228extern int netlink_rcv_skb(struct sk_buff *skb,
215 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *,
216 struct nlmsghdr *)); 230 struct nlmsghdr *));
217extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
218 u32 pid, unsigned int group, int report, 232 u32 portid, unsigned int group, int report,
219 gfp_t flags); 233 gfp_t flags);
220 234
221extern int nla_validate(const struct nlattr *head, 235extern int nla_validate(const struct nlattr *head,
@@ -430,7 +444,7 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
430/** 444/**
431 * nlmsg_put - Add a new netlink message to an skb 445 * nlmsg_put - Add a new netlink message to an skb
432 * @skb: socket buffer to store message in 446 * @skb: socket buffer to store message in
433 * @pid: netlink process id 447 * @portid: netlink process id
434 * @seq: sequence number of message 448 * @seq: sequence number of message
435 * @type: message type 449 * @type: message type
436 * @payload: length of message payload 450 * @payload: length of message payload
@@ -439,13 +453,13 @@ static inline int nlmsg_report(const struct nlmsghdr *nlh)
439 * Returns NULL if the tailroom of the skb is insufficient to store 453 * Returns NULL if the tailroom of the skb is insufficient to store
440 * the message header and payload. 454 * the message header and payload.
441 */ 455 */
442static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, 456static inline struct nlmsghdr *nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
443 int type, int payload, int flags) 457 int type, int payload, int flags)
444{ 458{
445 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload))) 459 if (unlikely(skb_tailroom(skb) < nlmsg_total_size(payload)))
446 return NULL; 460 return NULL;
447 461
448 return __nlmsg_put(skb, pid, seq, type, payload, flags); 462 return __nlmsg_put(skb, portid, seq, type, payload, flags);
449} 463}
450 464
451/** 465/**
@@ -464,7 +478,7 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
464 int type, int payload, 478 int type, int payload,
465 int flags) 479 int flags)
466{ 480{
467 return nlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, 481 return nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
468 type, payload, flags); 482 type, payload, flags);
469} 483}
470 484
@@ -549,18 +563,18 @@ static inline void nlmsg_free(struct sk_buff *skb)
549 * nlmsg_multicast - multicast a netlink message 563 * nlmsg_multicast - multicast a netlink message
550 * @sk: netlink socket to spread messages to 564 * @sk: netlink socket to spread messages to
551 * @skb: netlink message as socket buffer 565 * @skb: netlink message as socket buffer
552 * @pid: own netlink pid to avoid sending to yourself 566 * @portid: own netlink portid to avoid sending to yourself
553 * @group: multicast group id 567 * @group: multicast group id
554 * @flags: allocation flags 568 * @flags: allocation flags
555 */ 569 */
556static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb, 570static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
557 u32 pid, unsigned int group, gfp_t flags) 571 u32 portid, unsigned int group, gfp_t flags)
558{ 572{
559 int err; 573 int err;
560 574
561 NETLINK_CB(skb).dst_group = group; 575 NETLINK_CB(skb).dst_group = group;
562 576
563 err = netlink_broadcast(sk, skb, pid, group, flags); 577 err = netlink_broadcast(sk, skb, portid, group, flags);
564 if (err > 0) 578 if (err > 0)
565 err = 0; 579 err = 0;
566 580
@@ -571,13 +585,13 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
571 * nlmsg_unicast - unicast a netlink message 585 * nlmsg_unicast - unicast a netlink message
572 * @sk: netlink socket to spread message to 586 * @sk: netlink socket to spread message to
573 * @skb: netlink message as socket buffer 587 * @skb: netlink message as socket buffer
574 * @pid: netlink pid of the destination socket 588 * @portid: netlink portid of the destination socket
575 */ 589 */
576static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid) 590static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid)
577{ 591{
578 int err; 592 int err;
579 593
580 err = netlink_unicast(sk, skb, pid, MSG_DONTWAIT); 594 err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT);
581 if (err > 0) 595 if (err > 0)
582 err = 0; 596 err = 0;
583 597
@@ -879,6 +893,50 @@ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value)
879} 893}
880 894
881/** 895/**
896 * nla_put_s8 - Add a s8 netlink attribute to a socket buffer
897 * @skb: socket buffer to add attribute to
898 * @attrtype: attribute type
899 * @value: numeric value
900 */
901static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value)
902{
903 return nla_put(skb, attrtype, sizeof(s8), &value);
904}
905
906/**
907 * nla_put_s16 - Add a s16 netlink attribute to a socket buffer
908 * @skb: socket buffer to add attribute to
909 * @attrtype: attribute type
910 * @value: numeric value
911 */
912static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value)
913{
914 return nla_put(skb, attrtype, sizeof(s16), &value);
915}
916
917/**
918 * nla_put_s32 - Add a s32 netlink attribute to a socket buffer
919 * @skb: socket buffer to add attribute to
920 * @attrtype: attribute type
921 * @value: numeric value
922 */
923static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value)
924{
925 return nla_put(skb, attrtype, sizeof(s32), &value);
926}
927
928/**
929 * nla_put_s64 - Add a s64 netlink attribute to a socket buffer
930 * @skb: socket buffer to add attribute to
931 * @attrtype: attribute type
932 * @value: numeric value
933 */
934static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value)
935{
936 return nla_put(skb, attrtype, sizeof(s64), &value);
937}
938
939/**
882 * nla_put_string - Add a string netlink attribute to a socket buffer 940 * nla_put_string - Add a string netlink attribute to a socket buffer
883 * @skb: socket buffer to add attribute to 941 * @skb: socket buffer to add attribute to
884 * @attrtype: attribute type 942 * @attrtype: attribute type
@@ -994,6 +1052,46 @@ static inline __be64 nla_get_be64(const struct nlattr *nla)
994} 1052}
995 1053
996/** 1054/**
1055 * nla_get_s32 - return payload of s32 attribute
1056 * @nla: s32 netlink attribute
1057 */
1058static inline s32 nla_get_s32(const struct nlattr *nla)
1059{
1060 return *(s32 *) nla_data(nla);
1061}
1062
1063/**
1064 * nla_get_s16 - return payload of s16 attribute
1065 * @nla: s16 netlink attribute
1066 */
1067static inline s16 nla_get_s16(const struct nlattr *nla)
1068{
1069 return *(s16 *) nla_data(nla);
1070}
1071
1072/**
1073 * nla_get_s8 - return payload of s8 attribute
1074 * @nla: s8 netlink attribute
1075 */
1076static inline s8 nla_get_s8(const struct nlattr *nla)
1077{
1078 return *(s8 *) nla_data(nla);
1079}
1080
1081/**
1082 * nla_get_s64 - return payload of s64 attribute
1083 * @nla: s64 netlink attribute
1084 */
1085static inline s64 nla_get_s64(const struct nlattr *nla)
1086{
1087 s64 tmp;
1088
1089 nla_memcpy(&tmp, nla, sizeof(tmp));
1090
1091 return tmp;
1092}
1093
1094/**
997 * nla_get_flag - return payload of flag attribute 1095 * nla_get_flag - return payload of flag attribute
998 * @nla: flag netlink attribute 1096 * @nla: flag netlink attribute
999 */ 1097 */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 3aecdc7a84fb..a1d83cc8bf85 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -83,6 +83,10 @@ struct netns_ct {
83 int sysctl_auto_assign_helper; 83 int sysctl_auto_assign_helper;
84 bool auto_assign_helper_warned; 84 bool auto_assign_helper_warned;
85 struct nf_ip_net nf_ct_proto; 85 struct nf_ip_net nf_ct_proto;
86#ifdef CONFIG_NF_NAT_NEEDED
87 struct hlist_head *nat_bysource;
88 unsigned int nat_htable_size;
89#endif
86#ifdef CONFIG_SYSCTL 90#ifdef CONFIG_SYSCTL
87 struct ctl_table_header *sysctl_header; 91 struct ctl_table_header *sysctl_header;
88 struct ctl_table_header *acct_sysctl_header; 92 struct ctl_table_header *acct_sysctl_header;
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 1474dd65c66f..2ae2b8372cfd 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -5,6 +5,7 @@
5#ifndef __NETNS_IPV4_H__ 5#ifndef __NETNS_IPV4_H__
6#define __NETNS_IPV4_H__ 6#define __NETNS_IPV4_H__
7 7
8#include <linux/uidgid.h>
8#include <net/inet_frag.h> 9#include <net/inet_frag.h>
9 10
10struct tcpm_hash_bucket; 11struct tcpm_hash_bucket;
@@ -51,8 +52,6 @@ struct netns_ipv4 {
51 struct xt_table *iptable_security; 52 struct xt_table *iptable_security;
52#endif 53#endif
53 struct xt_table *nat_table; 54 struct xt_table *nat_table;
54 struct hlist_head *nat_bysource;
55 unsigned int nat_htable_size;
56#endif 55#endif
57 56
58 int sysctl_icmp_echo_ignore_all; 57 int sysctl_icmp_echo_ignore_all;
@@ -62,10 +61,9 @@ struct netns_ipv4 {
62 int sysctl_icmp_ratemask; 61 int sysctl_icmp_ratemask;
63 int sysctl_icmp_errors_use_inbound_ifaddr; 62 int sysctl_icmp_errors_use_inbound_ifaddr;
64 63
65 unsigned int sysctl_ping_group_range[2]; 64 kgid_t sysctl_ping_group_range[2];
66 long sysctl_tcp_mem[3]; 65 long sysctl_tcp_mem[3];
67 66
68 atomic_t rt_genid;
69 atomic_t dev_addr_genid; 67 atomic_t dev_addr_genid;
70 68
71#ifdef CONFIG_IP_MROUTE 69#ifdef CONFIG_IP_MROUTE
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index df0a5456a3fd..214cb0a53359 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -42,6 +42,7 @@ struct netns_ipv6 {
42#ifdef CONFIG_SECURITY 42#ifdef CONFIG_SECURITY
43 struct xt_table *ip6table_security; 43 struct xt_table *ip6table_security;
44#endif 44#endif
45 struct xt_table *ip6table_nat;
45#endif 46#endif
46 struct rt6_info *ip6_null_entry; 47 struct rt6_info *ip6_null_entry;
47 struct rt6_statistics *rt6_stats; 48 struct rt6_statistics *rt6_stats;
@@ -70,4 +71,12 @@ struct netns_ipv6 {
70#endif 71#endif
71#endif 72#endif
72}; 73};
74
75#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
76struct netns_nf_frag {
77 struct netns_sysctl_ipv6 sysctl;
78 struct netns_frags frags;
79};
80#endif
81
73#endif 82#endif
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h
index cb4e894c0f8d..17ec2b95c062 100644
--- a/include/net/netns/packet.h
+++ b/include/net/netns/packet.h
@@ -5,10 +5,10 @@
5#define __NETNS_PACKET_H__ 5#define __NETNS_PACKET_H__
6 6
7#include <linux/rculist.h> 7#include <linux/rculist.h>
8#include <linux/spinlock.h> 8#include <linux/mutex.h>
9 9
10struct netns_packet { 10struct netns_packet {
11 spinlock_t sklist_lock; 11 struct mutex sklist_lock;
12 struct hlist_head sklist; 12 struct hlist_head sklist;
13}; 13};
14 14
diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h
new file mode 100644
index 000000000000..5e5eb1f9f14b
--- /dev/null
+++ b/include/net/netns/sctp.h
@@ -0,0 +1,131 @@
1#ifndef __NETNS_SCTP_H__
2#define __NETNS_SCTP_H__
3
4struct sock;
5struct proc_dir_entry;
6struct sctp_mib;
7struct ctl_table_header;
8
9struct netns_sctp {
10 DEFINE_SNMP_STAT(struct sctp_mib, sctp_statistics);
11
12#ifdef CONFIG_PROC_FS
13 struct proc_dir_entry *proc_net_sctp;
14#endif
15#ifdef CONFIG_SYSCTL
16 struct ctl_table_header *sysctl_header;
17#endif
18 /* This is the global socket data structure used for responding to
19 * the Out-of-the-blue (OOTB) packets. A control sock will be created
20 * for this socket at the initialization time.
21 */
22 struct sock *ctl_sock;
23
24 /* This is the global local address list.
25 * We actively maintain this complete list of addresses on
26 * the system by catching address add/delete events.
27 *
28 * It is a list of sctp_sockaddr_entry.
29 */
30 struct list_head local_addr_list;
31 struct list_head addr_waitq;
32 struct timer_list addr_wq_timer;
33 struct list_head auto_asconf_splist;
34 spinlock_t addr_wq_lock;
35
36 /* Lock that protects the local_addr_list writers */
37 spinlock_t local_addr_lock;
38
39 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
40 *
41 * The following protocol parameters are RECOMMENDED:
42 *
43 * RTO.Initial - 3 seconds
44 * RTO.Min - 1 second
45 * RTO.Max - 60 seconds
46 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
47 * RTO.Beta - 1/4 (2 when converted to right shifts.)
48 */
49 unsigned int rto_initial;
50 unsigned int rto_min;
51 unsigned int rto_max;
52
53 /* Note: rto_alpha and rto_beta are really defined as inverse
54 * powers of two to facilitate integer operations.
55 */
56 int rto_alpha;
57 int rto_beta;
58
59 /* Max.Burst - 4 */
60 int max_burst;
61
62 /* Whether Cookie Preservative is enabled(1) or not(0) */
63 int cookie_preserve_enable;
64
65 /* Valid.Cookie.Life - 60 seconds */
66 unsigned int valid_cookie_life;
67
68 /* Delayed SACK timeout 200ms default*/
69 unsigned int sack_timeout;
70
71 /* HB.interval - 30 seconds */
72 unsigned int hb_interval;
73
74 /* Association.Max.Retrans - 10 attempts
75 * Path.Max.Retrans - 5 attempts (per destination address)
76 * Max.Init.Retransmits - 8 attempts
77 */
78 int max_retrans_association;
79 int max_retrans_path;
80 int max_retrans_init;
81 /* Potentially-Failed.Max.Retrans sysctl value
82 * taken from:
83 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
84 */
85 int pf_retrans;
86
87 /*
88 * Policy for preforming sctp/socket accounting
89 * 0 - do socket level accounting, all assocs share sk_sndbuf
90 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
91 */
92 int sndbuf_policy;
93
94 /*
95 * Policy for preforming sctp/socket accounting
96 * 0 - do socket level accounting, all assocs share sk_rcvbuf
97 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
98 */
99 int rcvbuf_policy;
100
101 int default_auto_asconf;
102
103 /* Flag to indicate if addip is enabled. */
104 int addip_enable;
105 int addip_noauth;
106
107 /* Flag to indicate if PR-SCTP is enabled. */
108 int prsctp_enable;
109
110 /* Flag to idicate if SCTP-AUTH is enabled */
111 int auth_enable;
112
113 /*
114 * Policy to control SCTP IPv4 address scoping
115 * 0 - Disable IPv4 address scoping
116 * 1 - Enable IPv4 address scoping
117 * 2 - Selectively allow only IPv4 private addresses
118 * 3 - Selectively allow only IPv4 link local address
119 */
120 int scope_policy;
121
122 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
123 * bits is an indicator of when to send and window update SACK.
124 */
125 int rwnd_upd_shift;
126
127 /* Threshold for autoclose timeout, in seconds. */
128 unsigned long max_autoclose;
129};
130
131#endif /* __NETNS_SCTP_H__ */
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 2719dec6b5a8..2760f4f4ae9b 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -18,23 +18,18 @@
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20 20
21#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
21struct netprio_map { 22struct netprio_map {
22 struct rcu_head rcu; 23 struct rcu_head rcu;
23 u32 priomap_len; 24 u32 priomap_len;
24 u32 priomap[]; 25 u32 priomap[];
25}; 26};
26 27
27#ifdef CONFIG_CGROUPS
28
29struct cgroup_netprio_state { 28struct cgroup_netprio_state {
30 struct cgroup_subsys_state css; 29 struct cgroup_subsys_state css;
31 u32 prioidx; 30 u32 prioidx;
32}; 31};
33 32
34#ifndef CONFIG_NETPRIO_CGROUP
35extern int net_prio_subsys_id;
36#endif
37
38extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); 33extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task);
39 34
40#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) 35#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
@@ -56,33 +51,28 @@ static inline u32 task_netprioidx(struct task_struct *p)
56 51
57static inline u32 task_netprioidx(struct task_struct *p) 52static inline u32 task_netprioidx(struct task_struct *p)
58{ 53{
59 struct cgroup_netprio_state *state; 54 struct cgroup_subsys_state *css;
60 int subsys_id;
61 u32 idx = 0; 55 u32 idx = 0;
62 56
63 rcu_read_lock(); 57 rcu_read_lock();
64 subsys_id = rcu_dereference_index_check(net_prio_subsys_id, 58 css = task_subsys_state(p, net_prio_subsys_id);
65 rcu_read_lock_held()); 59 if (css)
66 if (subsys_id >= 0) { 60 idx = container_of(css,
67 state = container_of(task_subsys_state(p, subsys_id), 61 struct cgroup_netprio_state, css)->prioidx;
68 struct cgroup_netprio_state, css);
69 idx = state->prioidx;
70 }
71 rcu_read_unlock(); 62 rcu_read_unlock();
72 return idx; 63 return idx;
73} 64}
65#endif
74 66
75#else 67#else /* !CONFIG_NETPRIO_CGROUP */
76 68
77static inline u32 task_netprioidx(struct task_struct *p) 69static inline u32 task_netprioidx(struct task_struct *p)
78{ 70{
79 return 0; 71 return 0;
80} 72}
81 73
82#endif /* CONFIG_NETPRIO_CGROUP */
83
84#else
85#define sock_update_netprioidx(sk, task) 74#define sock_update_netprioidx(sk, task)
86#endif 75
76#endif /* CONFIG_NETPRIO_CGROUP */
87 77
88#endif /* _NET_CLS_CGROUP_H */ 78#endif /* _NET_CLS_CGROUP_H */
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index f5169b04f082..e900072950cb 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -30,6 +30,11 @@ struct nfc_hci_ops {
30 int (*open) (struct nfc_hci_dev *hdev); 30 int (*open) (struct nfc_hci_dev *hdev);
31 void (*close) (struct nfc_hci_dev *hdev); 31 void (*close) (struct nfc_hci_dev *hdev);
32 int (*hci_ready) (struct nfc_hci_dev *hdev); 32 int (*hci_ready) (struct nfc_hci_dev *hdev);
33 /*
34 * xmit must always send the complete buffer before
35 * returning. Returned result must be 0 for success
36 * or negative for failure.
37 */
33 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb); 38 int (*xmit) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
34 int (*start_poll) (struct nfc_hci_dev *hdev, 39 int (*start_poll) (struct nfc_hci_dev *hdev,
35 u32 im_protocols, u32 tm_protocols); 40 u32 im_protocols, u32 tm_protocols);
@@ -38,8 +43,8 @@ struct nfc_hci_ops {
38 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate, 43 int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
39 struct nfc_target *target); 44 struct nfc_target *target);
40 int (*data_exchange) (struct nfc_hci_dev *hdev, 45 int (*data_exchange) (struct nfc_hci_dev *hdev,
41 struct nfc_target *target, 46 struct nfc_target *target, struct sk_buff *skb,
42 struct sk_buff *skb, struct sk_buff **res_skb); 47 data_exchange_cb_t cb, void *cb_context);
43 int (*check_presence)(struct nfc_hci_dev *hdev, 48 int (*check_presence)(struct nfc_hci_dev *hdev,
44 struct nfc_target *target); 49 struct nfc_target *target);
45}; 50};
@@ -74,7 +79,6 @@ struct nfc_hci_dev {
74 79
75 struct list_head msg_tx_queue; 80 struct list_head msg_tx_queue;
76 81
77 struct workqueue_struct *msg_tx_wq;
78 struct work_struct msg_tx_work; 82 struct work_struct msg_tx_work;
79 83
80 struct timer_list cmd_timer; 84 struct timer_list cmd_timer;
@@ -82,13 +86,14 @@ struct nfc_hci_dev {
82 86
83 struct sk_buff_head rx_hcp_frags; 87 struct sk_buff_head rx_hcp_frags;
84 88
85 struct workqueue_struct *msg_rx_wq;
86 struct work_struct msg_rx_work; 89 struct work_struct msg_rx_work;
87 90
88 struct sk_buff_head msg_rx_queue; 91 struct sk_buff_head msg_rx_queue;
89 92
90 struct nfc_hci_ops *ops; 93 struct nfc_hci_ops *ops;
91 94
95 struct nfc_llc *llc;
96
92 struct nfc_hci_init_data init_data; 97 struct nfc_hci_init_data init_data;
93 98
94 void *clientdata; 99 void *clientdata;
@@ -105,12 +110,17 @@ struct nfc_hci_dev {
105 u8 hw_mpw; 110 u8 hw_mpw;
106 u8 hw_software; 111 u8 hw_software;
107 u8 hw_bsid; 112 u8 hw_bsid;
113
114 int async_cb_type;
115 data_exchange_cb_t async_cb;
116 void *async_cb_context;
108}; 117};
109 118
110/* hci device allocation */ 119/* hci device allocation */
111struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops, 120struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
112 struct nfc_hci_init_data *init_data, 121 struct nfc_hci_init_data *init_data,
113 u32 protocols, 122 u32 protocols,
123 const char *llc_name,
114 int tx_headroom, 124 int tx_headroom,
115 int tx_tailroom, 125 int tx_tailroom,
116 int max_link_payload); 126 int max_link_payload);
@@ -202,6 +212,9 @@ int nfc_hci_set_param(struct nfc_hci_dev *hdev, u8 gate, u8 idx,
202 const u8 *param, size_t param_len); 212 const u8 *param, size_t param_len);
203int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd, 213int nfc_hci_send_cmd(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
204 const u8 *param, size_t param_len, struct sk_buff **skb); 214 const u8 *param, size_t param_len, struct sk_buff **skb);
215int nfc_hci_send_cmd_async(struct nfc_hci_dev *hdev, u8 gate, u8 cmd,
216 const u8 *param, size_t param_len,
217 data_exchange_cb_t cb, void *cb_context);
205int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response, 218int nfc_hci_send_response(struct nfc_hci_dev *hdev, u8 gate, u8 response,
206 const u8 *param, size_t param_len); 219 const u8 *param, size_t param_len);
207int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event, 220int nfc_hci_send_event(struct nfc_hci_dev *hdev, u8 gate, u8 event,
diff --git a/include/net/nfc/llc.h b/include/net/nfc/llc.h
new file mode 100644
index 000000000000..400ab7ae749d
--- /dev/null
+++ b/include/net/nfc/llc.h
@@ -0,0 +1,54 @@
1/*
2 * Link Layer Control manager public interface
3 *
4 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __NFC_LLC_H_
22#define __NFC_LLC_H_
23
24#include <net/nfc/hci.h>
25#include <linux/skbuff.h>
26
27#define LLC_NOP_NAME "nop"
28#define LLC_SHDLC_NAME "shdlc"
29
30typedef void (*rcv_to_hci_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
31typedef int (*xmit_to_drv_t) (struct nfc_hci_dev *hdev, struct sk_buff *skb);
32typedef void (*llc_failure_t) (struct nfc_hci_dev *hdev, int err);
33
34struct nfc_llc;
35
36struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev,
37 xmit_to_drv_t xmit_to_drv,
38 rcv_to_hci_t rcv_to_hci, int tx_headroom,
39 int tx_tailroom, llc_failure_t llc_failure);
40void nfc_llc_free(struct nfc_llc *llc);
41
42void nfc_llc_get_rx_head_tail_room(struct nfc_llc *llc, int *rx_headroom,
43 int *rx_tailroom);
44
45
46int nfc_llc_start(struct nfc_llc *llc);
47int nfc_llc_stop(struct nfc_llc *llc);
48void nfc_llc_rcv_from_drv(struct nfc_llc *llc, struct sk_buff *skb);
49int nfc_llc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb);
50
51int nfc_llc_init(void);
52void nfc_llc_exit(void);
53
54#endif /* __NFC_LLC_H_ */
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 276094b91d7c..88785e5c6b2c 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -32,6 +32,7 @@
32#define NCI_MAX_NUM_MAPPING_CONFIGS 10 32#define NCI_MAX_NUM_MAPPING_CONFIGS 10
33#define NCI_MAX_NUM_RF_CONFIGS 10 33#define NCI_MAX_NUM_RF_CONFIGS 10
34#define NCI_MAX_NUM_CONN 10 34#define NCI_MAX_NUM_CONN 10
35#define NCI_MAX_PARAM_LEN 251
35 36
36/* NCI Status Codes */ 37/* NCI Status Codes */
37#define NCI_STATUS_OK 0x00 38#define NCI_STATUS_OK 0x00
@@ -102,6 +103,9 @@
102#define NCI_RF_INTERFACE_ISO_DEP 0x02 103#define NCI_RF_INTERFACE_ISO_DEP 0x02
103#define NCI_RF_INTERFACE_NFC_DEP 0x03 104#define NCI_RF_INTERFACE_NFC_DEP 0x03
104 105
106/* NCI Configuration Parameter Tags */
107#define NCI_PN_ATR_REQ_GEN_BYTES 0x29
108
105/* NCI Reset types */ 109/* NCI Reset types */
106#define NCI_RESET_TYPE_KEEP_CONFIG 0x00 110#define NCI_RESET_TYPE_KEEP_CONFIG 0x00
107#define NCI_RESET_TYPE_RESET_CONFIG 0x01 111#define NCI_RESET_TYPE_RESET_CONFIG 0x01
@@ -188,6 +192,18 @@ struct nci_core_reset_cmd {
188 192
189#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01) 193#define NCI_OP_CORE_INIT_CMD nci_opcode_pack(NCI_GID_CORE, 0x01)
190 194
195#define NCI_OP_CORE_SET_CONFIG_CMD nci_opcode_pack(NCI_GID_CORE, 0x02)
196struct set_config_param {
197 __u8 id;
198 __u8 len;
199 __u8 val[NCI_MAX_PARAM_LEN];
200} __packed;
201
202struct nci_core_set_config_cmd {
203 __u8 num_params;
204 struct set_config_param param; /* support 1 param per cmd is enough */
205} __packed;
206
191#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 207#define NCI_OP_RF_DISCOVER_MAP_CMD nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
192struct disc_map_config { 208struct disc_map_config {
193 __u8 rf_protocol; 209 __u8 rf_protocol;
@@ -252,6 +268,13 @@ struct nci_core_init_rsp_2 {
252 __le32 manufact_specific_info; 268 __le32 manufact_specific_info;
253} __packed; 269} __packed;
254 270
271#define NCI_OP_CORE_SET_CONFIG_RSP nci_opcode_pack(NCI_GID_CORE, 0x02)
272struct nci_core_set_config_rsp {
273 __u8 status;
274 __u8 num_params;
275 __u8 params_id[0]; /* variable size array */
276} __packed;
277
255#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00) 278#define NCI_OP_RF_DISCOVER_MAP_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x00)
256 279
257#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03) 280#define NCI_OP_RF_DISCOVER_RSP nci_opcode_pack(NCI_GID_RF_MGMT, 0x03)
@@ -328,6 +351,11 @@ struct activation_params_nfcb_poll_iso_dep {
328 __u8 attrib_res[50]; 351 __u8 attrib_res[50];
329}; 352};
330 353
354struct activation_params_poll_nfc_dep {
355 __u8 atr_res_len;
356 __u8 atr_res[63];
357};
358
331struct nci_rf_intf_activated_ntf { 359struct nci_rf_intf_activated_ntf {
332 __u8 rf_discovery_id; 360 __u8 rf_discovery_id;
333 __u8 rf_interface; 361 __u8 rf_interface;
@@ -351,6 +379,7 @@ struct nci_rf_intf_activated_ntf {
351 union { 379 union {
352 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep; 380 struct activation_params_nfca_poll_iso_dep nfca_poll_iso_dep;
353 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep; 381 struct activation_params_nfcb_poll_iso_dep nfcb_poll_iso_dep;
382 struct activation_params_poll_nfc_dep poll_nfc_dep;
354 } activation_params; 383 } activation_params;
355 384
356} __packed; 385} __packed;
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index feba74027ff8..d705d8674949 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -54,6 +54,7 @@ enum nci_state {
54/* NCI timeouts */ 54/* NCI timeouts */
55#define NCI_RESET_TIMEOUT 5000 55#define NCI_RESET_TIMEOUT 5000
56#define NCI_INIT_TIMEOUT 5000 56#define NCI_INIT_TIMEOUT 5000
57#define NCI_SET_CONFIG_TIMEOUT 5000
57#define NCI_RF_DISC_TIMEOUT 5000 58#define NCI_RF_DISC_TIMEOUT 5000
58#define NCI_RF_DISC_SELECT_TIMEOUT 5000 59#define NCI_RF_DISC_SELECT_TIMEOUT 5000
59#define NCI_RF_DEACTIVATE_TIMEOUT 30000 60#define NCI_RF_DEACTIVATE_TIMEOUT 30000
@@ -137,6 +138,10 @@ struct nci_dev {
137 data_exchange_cb_t data_exchange_cb; 138 data_exchange_cb_t data_exchange_cb;
138 void *data_exchange_cb_context; 139 void *data_exchange_cb_context;
139 struct sk_buff *rx_data_reassembly; 140 struct sk_buff *rx_data_reassembly;
141
142 /* stored during intf_activated_ntf */
143 __u8 remote_gb[NFC_MAX_GT_LEN];
144 __u8 remote_gb_len;
140}; 145};
141 146
142/* ----- NCI Devices ----- */ 147/* ----- NCI Devices ----- */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index 6431f5e39022..f05b10682c9d 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -72,6 +72,7 @@ struct nfc_ops {
72 72
73#define NFC_TARGET_IDX_ANY -1 73#define NFC_TARGET_IDX_ANY -1
74#define NFC_MAX_GT_LEN 48 74#define NFC_MAX_GT_LEN 48
75#define NFC_ATR_RES_GT_OFFSET 15
75 76
76struct nfc_target { 77struct nfc_target {
77 u32 idx; 78 u32 idx;
@@ -89,7 +90,7 @@ struct nfc_target {
89}; 90};
90 91
91struct nfc_genl_data { 92struct nfc_genl_data {
92 u32 poll_req_pid; 93 u32 poll_req_portid;
93 struct mutex genl_data_mutex; 94 struct mutex genl_data_mutex;
94}; 95};
95 96
@@ -112,7 +113,6 @@ struct nfc_dev {
112 int tx_tailroom; 113 int tx_tailroom;
113 114
114 struct timer_list check_pres_timer; 115 struct timer_list check_pres_timer;
115 struct workqueue_struct *check_pres_wq;
116 struct work_struct check_pres_work; 116 struct work_struct check_pres_work;
117 117
118 struct nfc_ops *ops; 118 struct nfc_ops *ops;
diff --git a/include/net/nfc/shdlc.h b/include/net/nfc/shdlc.h
deleted file mode 100644
index 35e930d2f638..000000000000
--- a/include/net/nfc/shdlc.h
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * Copyright (C) 2012 Intel Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef __NFC_SHDLC_H
21#define __NFC_SHDLC_H
22
23struct nfc_shdlc;
24
25struct nfc_shdlc_ops {
26 int (*open) (struct nfc_shdlc *shdlc);
27 void (*close) (struct nfc_shdlc *shdlc);
28 int (*hci_ready) (struct nfc_shdlc *shdlc);
29 int (*xmit) (struct nfc_shdlc *shdlc, struct sk_buff *skb);
30 int (*start_poll) (struct nfc_shdlc *shdlc,
31 u32 im_protocols, u32 tm_protocols);
32 int (*target_from_gate) (struct nfc_shdlc *shdlc, u8 gate,
33 struct nfc_target *target);
34 int (*complete_target_discovered) (struct nfc_shdlc *shdlc, u8 gate,
35 struct nfc_target *target);
36 int (*data_exchange) (struct nfc_shdlc *shdlc,
37 struct nfc_target *target,
38 struct sk_buff *skb, struct sk_buff **res_skb);
39 int (*check_presence)(struct nfc_shdlc *shdlc,
40 struct nfc_target *target);
41};
42
43enum shdlc_state {
44 SHDLC_DISCONNECTED = 0,
45 SHDLC_CONNECTING = 1,
46 SHDLC_NEGOCIATING = 2,
47 SHDLC_CONNECTED = 3
48};
49
50struct nfc_shdlc {
51 struct mutex state_mutex;
52 enum shdlc_state state;
53 int hard_fault;
54
55 struct nfc_hci_dev *hdev;
56
57 wait_queue_head_t *connect_wq;
58 int connect_tries;
59 int connect_result;
60 struct timer_list connect_timer;/* aka T3 in spec 10.6.1 */
61
62 u8 w; /* window size */
63 bool srej_support;
64
65 struct timer_list t1_timer; /* send ack timeout */
66 bool t1_active;
67
68 struct timer_list t2_timer; /* guard/retransmit timeout */
69 bool t2_active;
70
71 int ns; /* next seq num for send */
72 int nr; /* next expected seq num for receive */
73 int dnr; /* oldest sent unacked seq num */
74
75 struct sk_buff_head rcv_q;
76
77 struct sk_buff_head send_q;
78 bool rnr; /* other side is not ready to receive */
79
80 struct sk_buff_head ack_pending_q;
81
82 struct workqueue_struct *sm_wq;
83 struct work_struct sm_work;
84
85 struct nfc_shdlc_ops *ops;
86
87 int client_headroom;
88 int client_tailroom;
89
90 void *clientdata;
91};
92
93void nfc_shdlc_recv_frame(struct nfc_shdlc *shdlc, struct sk_buff *skb);
94
95struct nfc_shdlc *nfc_shdlc_allocate(struct nfc_shdlc_ops *ops,
96 struct nfc_hci_init_data *init_data,
97 u32 protocols,
98 int tx_headroom, int tx_tailroom,
99 int max_link_payload, const char *devname);
100
101void nfc_shdlc_free(struct nfc_shdlc *shdlc);
102
103void nfc_shdlc_set_clientdata(struct nfc_shdlc *shdlc, void *clientdata);
104void *nfc_shdlc_get_clientdata(struct nfc_shdlc *shdlc);
105struct nfc_hci_dev *nfc_shdlc_get_hci_dev(struct nfc_shdlc *shdlc);
106
107#endif /* __NFC_SHDLC_H */
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 4c0766e201e3..b01d8dd9ee7c 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -106,6 +106,34 @@ struct listen_sock {
106 struct request_sock *syn_table[0]; 106 struct request_sock *syn_table[0];
107}; 107};
108 108
109/*
110 * For a TCP Fast Open listener -
111 * lock - protects the access to all the reqsk, which is co-owned by
112 * the listener and the child socket.
113 * qlen - pending TFO requests (still in TCP_SYN_RECV).
114 * max_qlen - max TFO reqs allowed before TFO is disabled.
115 *
116 * XXX (TFO) - ideally these fields can be made as part of "listen_sock"
117 * structure above. But there is some implementation difficulty due to
118 * listen_sock being part of request_sock_queue hence will be freed when
119 * a listener is stopped. But TFO related fields may continue to be
120 * accessed even after a listener is closed, until its sk_refcnt drops
121 * to 0 implying no more outstanding TFO reqs. One solution is to keep
122 * listen_opt around until sk_refcnt drops to 0. But there is some other
123 * complexity that needs to be resolved. E.g., a listener can be disabled
124 * temporarily through shutdown()->tcp_disconnect(), and re-enabled later.
125 */
126struct fastopen_queue {
127 struct request_sock *rskq_rst_head; /* Keep track of past TFO */
128 struct request_sock *rskq_rst_tail; /* requests that caused RST.
129 * This is part of the defense
130 * against spoofing attack.
131 */
132 spinlock_t lock;
133 int qlen; /* # of pending (TCP_SYN_RECV) reqs */
134 int max_qlen; /* != 0 iff TFO is currently enabled */
135};
136
109/** struct request_sock_queue - queue of request_socks 137/** struct request_sock_queue - queue of request_socks
110 * 138 *
111 * @rskq_accept_head - FIFO head of established children 139 * @rskq_accept_head - FIFO head of established children
@@ -129,6 +157,12 @@ struct request_sock_queue {
129 u8 rskq_defer_accept; 157 u8 rskq_defer_accept;
130 /* 3 bytes hole, try to pack */ 158 /* 3 bytes hole, try to pack */
131 struct listen_sock *listen_opt; 159 struct listen_sock *listen_opt;
160 struct fastopen_queue *fastopenq; /* This is non-NULL iff TFO has been
161 * enabled on this listener. Check
162 * max_qlen != 0 in fastopen_queue
163 * to determine if TFO is enabled
164 * right at this moment.
165 */
132}; 166};
133 167
134extern int reqsk_queue_alloc(struct request_sock_queue *queue, 168extern int reqsk_queue_alloc(struct request_sock_queue *queue,
@@ -136,6 +170,8 @@ extern int reqsk_queue_alloc(struct request_sock_queue *queue,
136 170
137extern void __reqsk_queue_destroy(struct request_sock_queue *queue); 171extern void __reqsk_queue_destroy(struct request_sock_queue *queue);
138extern void reqsk_queue_destroy(struct request_sock_queue *queue); 172extern void reqsk_queue_destroy(struct request_sock_queue *queue);
173extern void reqsk_fastopen_remove(struct sock *sk,
174 struct request_sock *req, bool reset);
139 175
140static inline struct request_sock * 176static inline struct request_sock *
141 reqsk_queue_yank_acceptq(struct request_sock_queue *queue) 177 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
@@ -190,19 +226,6 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue
190 return req; 226 return req;
191} 227}
192 228
193static inline struct sock *reqsk_queue_get_child(struct request_sock_queue *queue,
194 struct sock *parent)
195{
196 struct request_sock *req = reqsk_queue_remove(queue);
197 struct sock *child = req->sk;
198
199 WARN_ON(child == NULL);
200
201 sk_acceptq_removed(parent);
202 __reqsk_free(req);
203 return child;
204}
205
206static inline int reqsk_queue_removed(struct request_sock_queue *queue, 229static inline int reqsk_queue_removed(struct request_sock_queue *queue,
207 struct request_sock *req) 230 struct request_sock *req)
208{ 231{
diff --git a/include/net/route.h b/include/net/route.h
index 776a27f1ab78..da22243d2760 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -108,7 +108,7 @@ extern struct ip_rt_acct __percpu *ip_rt_acct;
108 108
109struct in_device; 109struct in_device;
110extern int ip_rt_init(void); 110extern int ip_rt_init(void);
111extern void rt_cache_flush(struct net *net, int how); 111extern void rt_cache_flush(struct net *net);
112extern void rt_flush_dev(struct net_device *dev); 112extern void rt_flush_dev(struct net_device *dev);
113extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); 113extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
114extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, 114extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index d9611e032418..4616f468d599 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -188,7 +188,8 @@ struct tcf_proto_ops {
188 188
189 unsigned long (*get)(struct tcf_proto*, u32 handle); 189 unsigned long (*get)(struct tcf_proto*, u32 handle);
190 void (*put)(struct tcf_proto*, unsigned long); 190 void (*put)(struct tcf_proto*, unsigned long);
191 int (*change)(struct tcf_proto*, unsigned long, 191 int (*change)(struct sk_buff *,
192 struct tcf_proto*, unsigned long,
192 u32 handle, struct nlattr **, 193 u32 handle, struct nlattr **,
193 unsigned long *); 194 unsigned long *);
194 int (*delete)(struct tcf_proto*, unsigned long); 195 int (*delete)(struct tcf_proto*, unsigned long);
diff --git a/include/net/scm.h b/include/net/scm.h
index 079d7887dac1..975cca01048b 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -12,6 +12,12 @@
12 */ 12 */
13#define SCM_MAX_FD 253 13#define SCM_MAX_FD 253
14 14
15struct scm_creds {
16 u32 pid;
17 kuid_t uid;
18 kgid_t gid;
19};
20
15struct scm_fp_list { 21struct scm_fp_list {
16 short count; 22 short count;
17 short max; 23 short max;
@@ -22,7 +28,7 @@ struct scm_cookie {
22 struct pid *pid; /* Skb credentials */ 28 struct pid *pid; /* Skb credentials */
23 const struct cred *cred; 29 const struct cred *cred;
24 struct scm_fp_list *fp; /* Passed files */ 30 struct scm_fp_list *fp; /* Passed files */
25 struct ucred creds; /* Skb credentials */ 31 struct scm_creds creds; /* Skb credentials */
26#ifdef CONFIG_SECURITY_NETWORK 32#ifdef CONFIG_SECURITY_NETWORK
27 u32 secid; /* Passed security ID */ 33 u32 secid; /* Passed security ID */
28#endif 34#endif
@@ -49,7 +55,9 @@ static __inline__ void scm_set_cred(struct scm_cookie *scm,
49{ 55{
50 scm->pid = get_pid(pid); 56 scm->pid = get_pid(pid);
51 scm->cred = cred ? get_cred(cred) : NULL; 57 scm->cred = cred ? get_cred(cred) : NULL;
52 cred_to_ucred(pid, cred, &scm->creds); 58 scm->creds.pid = pid_vnr(pid);
59 scm->creds.uid = cred ? cred->euid : INVALID_UID;
60 scm->creds.gid = cred ? cred->egid : INVALID_GID;
53} 61}
54 62
55static __inline__ void scm_destroy_cred(struct scm_cookie *scm) 63static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
@@ -65,14 +73,16 @@ static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
65static __inline__ void scm_destroy(struct scm_cookie *scm) 73static __inline__ void scm_destroy(struct scm_cookie *scm)
66{ 74{
67 scm_destroy_cred(scm); 75 scm_destroy_cred(scm);
68 if (scm && scm->fp) 76 if (scm->fp)
69 __scm_destroy(scm); 77 __scm_destroy(scm);
70} 78}
71 79
72static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 80static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
73 struct scm_cookie *scm) 81 struct scm_cookie *scm, bool forcecreds)
74{ 82{
75 memset(scm, 0, sizeof(*scm)); 83 memset(scm, 0, sizeof(*scm));
84 if (forcecreds)
85 scm_set_cred(scm, task_tgid(current), current_cred());
76 unix_get_peersec_dgram(sock, scm); 86 unix_get_peersec_dgram(sock, scm);
77 if (msg->msg_controllen <= 0) 87 if (msg->msg_controllen <= 0)
78 return 0; 88 return 0;
@@ -110,8 +120,15 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
110 return; 120 return;
111 } 121 }
112 122
113 if (test_bit(SOCK_PASSCRED, &sock->flags)) 123 if (test_bit(SOCK_PASSCRED, &sock->flags)) {
114 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 124 struct user_namespace *current_ns = current_user_ns();
125 struct ucred ucreds = {
126 .pid = scm->creds.pid,
127 .uid = from_kuid_munged(current_ns, scm->creds.uid),
128 .gid = from_kgid_munged(current_ns, scm->creds.gid),
129 };
130 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(ucreds), &ucreds);
131 }
115 132
116 scm_destroy_cred(scm); 133 scm_destroy_cred(scm);
117 134
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ff499640528b..9c6414f553f9 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -114,13 +114,12 @@
114/* 114/*
115 * sctp/protocol.c 115 * sctp/protocol.c
116 */ 116 */
117extern struct sock *sctp_get_ctl_sock(void); 117extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
118extern int sctp_copy_local_addr_list(struct sctp_bind_addr *,
119 sctp_scope_t, gfp_t gfp, 118 sctp_scope_t, gfp_t gfp,
120 int flags); 119 int flags);
121extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 120extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
122extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 121extern int sctp_register_pf(struct sctp_pf *, sa_family_t);
123extern void sctp_addr_wq_mgmt(struct sctp_sockaddr_entry *, int); 122extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
124 123
125/* 124/*
126 * sctp/socket.c 125 * sctp/socket.c
@@ -140,12 +139,12 @@ extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
140/* 139/*
141 * sctp/primitive.c 140 * sctp/primitive.c
142 */ 141 */
143int sctp_primitive_ASSOCIATE(struct sctp_association *, void *arg); 142int sctp_primitive_ASSOCIATE(struct net *, struct sctp_association *, void *arg);
144int sctp_primitive_SHUTDOWN(struct sctp_association *, void *arg); 143int sctp_primitive_SHUTDOWN(struct net *, struct sctp_association *, void *arg);
145int sctp_primitive_ABORT(struct sctp_association *, void *arg); 144int sctp_primitive_ABORT(struct net *, struct sctp_association *, void *arg);
146int sctp_primitive_SEND(struct sctp_association *, void *arg); 145int sctp_primitive_SEND(struct net *, struct sctp_association *, void *arg);
147int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); 146int sctp_primitive_REQUESTHEARTBEAT(struct net *, struct sctp_association *, void *arg);
148int sctp_primitive_ASCONF(struct sctp_association *, void *arg); 147int sctp_primitive_ASCONF(struct net *, struct sctp_association *, void *arg);
149 148
150/* 149/*
151 * sctp/input.c 150 * sctp/input.c
@@ -156,7 +155,7 @@ void sctp_hash_established(struct sctp_association *);
156void sctp_unhash_established(struct sctp_association *); 155void sctp_unhash_established(struct sctp_association *);
157void sctp_hash_endpoint(struct sctp_endpoint *); 156void sctp_hash_endpoint(struct sctp_endpoint *);
158void sctp_unhash_endpoint(struct sctp_endpoint *); 157void sctp_unhash_endpoint(struct sctp_endpoint *);
159struct sock *sctp_err_lookup(int family, struct sk_buff *, 158struct sock *sctp_err_lookup(struct net *net, int family, struct sk_buff *,
160 struct sctphdr *, struct sctp_association **, 159 struct sctphdr *, struct sctp_association **,
161 struct sctp_transport **); 160 struct sctp_transport **);
162void sctp_err_finish(struct sock *, struct sctp_association *); 161void sctp_err_finish(struct sock *, struct sctp_association *);
@@ -173,14 +172,14 @@ void sctp_backlog_migrate(struct sctp_association *assoc,
173/* 172/*
174 * sctp/proc.c 173 * sctp/proc.c
175 */ 174 */
176int sctp_snmp_proc_init(void); 175int sctp_snmp_proc_init(struct net *net);
177void sctp_snmp_proc_exit(void); 176void sctp_snmp_proc_exit(struct net *net);
178int sctp_eps_proc_init(void); 177int sctp_eps_proc_init(struct net *net);
179void sctp_eps_proc_exit(void); 178void sctp_eps_proc_exit(struct net *net);
180int sctp_assocs_proc_init(void); 179int sctp_assocs_proc_init(struct net *net);
181void sctp_assocs_proc_exit(void); 180void sctp_assocs_proc_exit(struct net *net);
182int sctp_remaddr_proc_init(void); 181int sctp_remaddr_proc_init(struct net *net);
183void sctp_remaddr_proc_exit(void); 182void sctp_remaddr_proc_exit(struct net *net);
184 183
185 184
186/* 185/*
@@ -222,11 +221,10 @@ extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
222#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk) 221#define sctp_bh_unlock_sock(sk) bh_unlock_sock(sk)
223 222
224/* SCTP SNMP MIB stats handlers */ 223/* SCTP SNMP MIB stats handlers */
225DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics); 224#define SCTP_INC_STATS(net, field) SNMP_INC_STATS((net)->sctp.sctp_statistics, field)
226#define SCTP_INC_STATS(field) SNMP_INC_STATS(sctp_statistics, field) 225#define SCTP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->sctp.sctp_statistics, field)
227#define SCTP_INC_STATS_BH(field) SNMP_INC_STATS_BH(sctp_statistics, field) 226#define SCTP_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->sctp.sctp_statistics, field)
228#define SCTP_INC_STATS_USER(field) SNMP_INC_STATS_USER(sctp_statistics, field) 227#define SCTP_DEC_STATS(net, field) SNMP_DEC_STATS((net)->sctp.sctp_statistics, field)
229#define SCTP_DEC_STATS(field) SNMP_DEC_STATS(sctp_statistics, field)
230 228
231#endif /* !TEST_FRAME */ 229#endif /* !TEST_FRAME */
232 230
@@ -361,25 +359,29 @@ atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0)
361#define SCTP_DBG_OBJCNT_ENTRY(name) \ 359#define SCTP_DBG_OBJCNT_ENTRY(name) \
362{.label= #name, .counter= &sctp_dbg_objcnt_## name} 360{.label= #name, .counter= &sctp_dbg_objcnt_## name}
363 361
364void sctp_dbg_objcnt_init(void); 362void sctp_dbg_objcnt_init(struct net *);
365void sctp_dbg_objcnt_exit(void); 363void sctp_dbg_objcnt_exit(struct net *);
366 364
367#else 365#else
368 366
369#define SCTP_DBG_OBJCNT_INC(name) 367#define SCTP_DBG_OBJCNT_INC(name)
370#define SCTP_DBG_OBJCNT_DEC(name) 368#define SCTP_DBG_OBJCNT_DEC(name)
371 369
372static inline void sctp_dbg_objcnt_init(void) { return; } 370static inline void sctp_dbg_objcnt_init(struct net *net) { return; }
373static inline void sctp_dbg_objcnt_exit(void) { return; } 371static inline void sctp_dbg_objcnt_exit(struct net *net) { return; }
374 372
375#endif /* CONFIG_SCTP_DBG_OBJCOUNT */ 373#endif /* CONFIG_SCTP_DBG_OBJCOUNT */
376 374
377#if defined CONFIG_SYSCTL 375#if defined CONFIG_SYSCTL
378void sctp_sysctl_register(void); 376void sctp_sysctl_register(void);
379void sctp_sysctl_unregister(void); 377void sctp_sysctl_unregister(void);
378int sctp_sysctl_net_register(struct net *net);
379void sctp_sysctl_net_unregister(struct net *net);
380#else 380#else
381static inline void sctp_sysctl_register(void) { return; } 381static inline void sctp_sysctl_register(void) { return; }
382static inline void sctp_sysctl_unregister(void) { return; } 382static inline void sctp_sysctl_unregister(void) { return; }
383static inline int sctp_sysctl_net_register(struct net *net) { return 0; }
384static inline void sctp_sysctl_net_unregister(struct net *net) { return; }
383#endif 385#endif
384 386
385/* Size of Supported Address Parameter for 'x' address types. */ 387/* Size of Supported Address Parameter for 'x' address types. */
@@ -586,7 +588,6 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\
586 588
587extern struct proto sctp_prot; 589extern struct proto sctp_prot;
588extern struct proto sctpv6_prot; 590extern struct proto sctpv6_prot;
589extern struct proc_dir_entry *proc_net_sctp;
590void sctp_put_port(struct sock *sk); 591void sctp_put_port(struct sock *sk);
591 592
592extern struct idr sctp_assocs_id; 593extern struct idr sctp_assocs_id;
@@ -632,21 +633,21 @@ static inline int sctp_sanity_check(void)
632 633
633/* Warning: The following hash functions assume a power of two 'size'. */ 634/* Warning: The following hash functions assume a power of two 'size'. */
634/* This is the hash function for the SCTP port hash table. */ 635/* This is the hash function for the SCTP port hash table. */
635static inline int sctp_phashfn(__u16 lport) 636static inline int sctp_phashfn(struct net *net, __u16 lport)
636{ 637{
637 return lport & (sctp_port_hashsize - 1); 638 return (net_hash_mix(net) + lport) & (sctp_port_hashsize - 1);
638} 639}
639 640
640/* This is the hash function for the endpoint hash table. */ 641/* This is the hash function for the endpoint hash table. */
641static inline int sctp_ep_hashfn(__u16 lport) 642static inline int sctp_ep_hashfn(struct net *net, __u16 lport)
642{ 643{
643 return lport & (sctp_ep_hashsize - 1); 644 return (net_hash_mix(net) + lport) & (sctp_ep_hashsize - 1);
644} 645}
645 646
646/* This is the hash function for the association hash table. */ 647/* This is the hash function for the association hash table. */
647static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) 648static inline int sctp_assoc_hashfn(struct net *net, __u16 lport, __u16 rport)
648{ 649{
649 int h = (lport << 16) + rport; 650 int h = (lport << 16) + rport + net_hash_mix(net);
650 h ^= h>>8; 651 h ^= h>>8;
651 return h & (sctp_assoc_hashsize - 1); 652 return h & (sctp_assoc_hashsize - 1);
652} 653}
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 9148632b8204..b5887e1677e4 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -77,7 +77,8 @@ typedef struct {
77 int action; 77 int action;
78} sctp_sm_command_t; 78} sctp_sm_command_t;
79 79
80typedef sctp_disposition_t (sctp_state_fn_t) (const struct sctp_endpoint *, 80typedef sctp_disposition_t (sctp_state_fn_t) (struct net *,
81 const struct sctp_endpoint *,
81 const struct sctp_association *, 82 const struct sctp_association *,
82 const sctp_subtype_t type, 83 const sctp_subtype_t type,
83 void *arg, 84 void *arg,
@@ -178,7 +179,8 @@ sctp_state_fn_t sctp_sf_autoclose_timer_expire;
178 179
179/* Prototypes for utility support functions. */ 180/* Prototypes for utility support functions. */
180__u8 sctp_get_chunk_type(struct sctp_chunk *chunk); 181__u8 sctp_get_chunk_type(struct sctp_chunk *chunk);
181const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t, 182const sctp_sm_table_entry_t *sctp_sm_lookup_event(struct net *,
183 sctp_event_t,
182 sctp_state_t, 184 sctp_state_t,
183 sctp_subtype_t); 185 sctp_subtype_t);
184int sctp_chunk_iif(const struct sctp_chunk *); 186int sctp_chunk_iif(const struct sctp_chunk *);
@@ -268,7 +270,7 @@ void sctp_chunk_assign_ssn(struct sctp_chunk *);
268 270
269/* Prototypes for statetable processing. */ 271/* Prototypes for statetable processing. */
270 272
271int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 273int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype,
272 sctp_state_t state, 274 sctp_state_t state,
273 struct sctp_endpoint *, 275 struct sctp_endpoint *,
274 struct sctp_association *asoc, 276 struct sctp_association *asoc,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index fc5e60016e37..64158aa1bb5f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -102,6 +102,7 @@ struct sctp_bind_bucket {
102 unsigned short fastreuse; 102 unsigned short fastreuse;
103 struct hlist_node node; 103 struct hlist_node node;
104 struct hlist_head owner; 104 struct hlist_head owner;
105 struct net *net;
105}; 106};
106 107
107struct sctp_bind_hashbucket { 108struct sctp_bind_hashbucket {
@@ -118,69 +119,6 @@ struct sctp_hashbucket {
118 119
119/* The SCTP globals structure. */ 120/* The SCTP globals structure. */
120extern struct sctp_globals { 121extern struct sctp_globals {
121 /* RFC2960 Section 14. Suggested SCTP Protocol Parameter Values
122 *
123 * The following protocol parameters are RECOMMENDED:
124 *
125 * RTO.Initial - 3 seconds
126 * RTO.Min - 1 second
127 * RTO.Max - 60 seconds
128 * RTO.Alpha - 1/8 (3 when converted to right shifts.)
129 * RTO.Beta - 1/4 (2 when converted to right shifts.)
130 */
131 unsigned int rto_initial;
132 unsigned int rto_min;
133 unsigned int rto_max;
134
135 /* Note: rto_alpha and rto_beta are really defined as inverse
136 * powers of two to facilitate integer operations.
137 */
138 int rto_alpha;
139 int rto_beta;
140
141 /* Max.Burst - 4 */
142 int max_burst;
143
144 /* Whether Cookie Preservative is enabled(1) or not(0) */
145 int cookie_preserve_enable;
146
147 /* Valid.Cookie.Life - 60 seconds */
148 unsigned int valid_cookie_life;
149
150 /* Delayed SACK timeout 200ms default*/
151 unsigned int sack_timeout;
152
153 /* HB.interval - 30 seconds */
154 unsigned int hb_interval;
155
156 /* Association.Max.Retrans - 10 attempts
157 * Path.Max.Retrans - 5 attempts (per destination address)
158 * Max.Init.Retransmits - 8 attempts
159 */
160 int max_retrans_association;
161 int max_retrans_path;
162 int max_retrans_init;
163
164 /* Potentially-Failed.Max.Retrans sysctl value
165 * taken from:
166 * http://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05
167 */
168 int pf_retrans;
169
170 /*
171 * Policy for preforming sctp/socket accounting
172 * 0 - do socket level accounting, all assocs share sk_sndbuf
173 * 1 - do sctp accounting, each asoc may use sk_sndbuf bytes
174 */
175 int sndbuf_policy;
176
177 /*
178 * Policy for preforming sctp/socket accounting
179 * 0 - do socket level accounting, all assocs share sk_rcvbuf
180 * 1 - do sctp accounting, each asoc may use sk_rcvbuf bytes
181 */
182 int rcvbuf_policy;
183
184 /* The following variables are implementation specific. */ 122 /* The following variables are implementation specific. */
185 123
186 /* Default initialization values to be applied to new associations. */ 124 /* Default initialization values to be applied to new associations. */
@@ -204,70 +142,11 @@ extern struct sctp_globals {
204 int port_hashsize; 142 int port_hashsize;
205 struct sctp_bind_hashbucket *port_hashtable; 143 struct sctp_bind_hashbucket *port_hashtable;
206 144
207 /* This is the global local address list.
208 * We actively maintain this complete list of addresses on
209 * the system by catching address add/delete events.
210 *
211 * It is a list of sctp_sockaddr_entry.
212 */
213 struct list_head local_addr_list;
214 int default_auto_asconf;
215 struct list_head addr_waitq;
216 struct timer_list addr_wq_timer;
217 struct list_head auto_asconf_splist;
218 spinlock_t addr_wq_lock;
219
220 /* Lock that protects the local_addr_list writers */
221 spinlock_t addr_list_lock;
222
223 /* Flag to indicate if addip is enabled. */
224 int addip_enable;
225 int addip_noauth_enable;
226
227 /* Flag to indicate if PR-SCTP is enabled. */
228 int prsctp_enable;
229
230 /* Flag to idicate if SCTP-AUTH is enabled */
231 int auth_enable;
232
233 /*
234 * Policy to control SCTP IPv4 address scoping
235 * 0 - Disable IPv4 address scoping
236 * 1 - Enable IPv4 address scoping
237 * 2 - Selectively allow only IPv4 private addresses
238 * 3 - Selectively allow only IPv4 link local address
239 */
240 int ipv4_scope_policy;
241
242 /* Flag to indicate whether computing and verifying checksum 145 /* Flag to indicate whether computing and verifying checksum
243 * is disabled. */ 146 * is disabled. */
244 bool checksum_disable; 147 bool checksum_disable;
245
246 /* Threshold for rwnd update SACKS. Receive buffer shifted this many
247 * bits is an indicator of when to send and window update SACK.
248 */
249 int rwnd_update_shift;
250
251 /* Threshold for autoclose timeout, in seconds. */
252 unsigned long max_autoclose;
253} sctp_globals; 148} sctp_globals;
254 149
255#define sctp_rto_initial (sctp_globals.rto_initial)
256#define sctp_rto_min (sctp_globals.rto_min)
257#define sctp_rto_max (sctp_globals.rto_max)
258#define sctp_rto_alpha (sctp_globals.rto_alpha)
259#define sctp_rto_beta (sctp_globals.rto_beta)
260#define sctp_max_burst (sctp_globals.max_burst)
261#define sctp_valid_cookie_life (sctp_globals.valid_cookie_life)
262#define sctp_cookie_preserve_enable (sctp_globals.cookie_preserve_enable)
263#define sctp_max_retrans_association (sctp_globals.max_retrans_association)
264#define sctp_sndbuf_policy (sctp_globals.sndbuf_policy)
265#define sctp_rcvbuf_policy (sctp_globals.rcvbuf_policy)
266#define sctp_max_retrans_path (sctp_globals.max_retrans_path)
267#define sctp_pf_retrans (sctp_globals.pf_retrans)
268#define sctp_max_retrans_init (sctp_globals.max_retrans_init)
269#define sctp_sack_timeout (sctp_globals.sack_timeout)
270#define sctp_hb_interval (sctp_globals.hb_interval)
271#define sctp_max_instreams (sctp_globals.max_instreams) 150#define sctp_max_instreams (sctp_globals.max_instreams)
272#define sctp_max_outstreams (sctp_globals.max_outstreams) 151#define sctp_max_outstreams (sctp_globals.max_outstreams)
273#define sctp_address_families (sctp_globals.address_families) 152#define sctp_address_families (sctp_globals.address_families)
@@ -277,21 +156,7 @@ extern struct sctp_globals {
277#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable) 156#define sctp_assoc_hashtable (sctp_globals.assoc_hashtable)
278#define sctp_port_hashsize (sctp_globals.port_hashsize) 157#define sctp_port_hashsize (sctp_globals.port_hashsize)
279#define sctp_port_hashtable (sctp_globals.port_hashtable) 158#define sctp_port_hashtable (sctp_globals.port_hashtable)
280#define sctp_local_addr_list (sctp_globals.local_addr_list)
281#define sctp_local_addr_lock (sctp_globals.addr_list_lock)
282#define sctp_auto_asconf_splist (sctp_globals.auto_asconf_splist)
283#define sctp_addr_waitq (sctp_globals.addr_waitq)
284#define sctp_addr_wq_timer (sctp_globals.addr_wq_timer)
285#define sctp_addr_wq_lock (sctp_globals.addr_wq_lock)
286#define sctp_default_auto_asconf (sctp_globals.default_auto_asconf)
287#define sctp_scope_policy (sctp_globals.ipv4_scope_policy)
288#define sctp_addip_enable (sctp_globals.addip_enable)
289#define sctp_addip_noauth (sctp_globals.addip_noauth_enable)
290#define sctp_prsctp_enable (sctp_globals.prsctp_enable)
291#define sctp_auth_enable (sctp_globals.auth_enable)
292#define sctp_checksum_disable (sctp_globals.checksum_disable) 159#define sctp_checksum_disable (sctp_globals.checksum_disable)
293#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
294#define sctp_max_autoclose (sctp_globals.max_autoclose)
295 160
296/* SCTP Socket type: UDP or TCP style. */ 161/* SCTP Socket type: UDP or TCP style. */
297typedef enum { 162typedef enum {
@@ -1085,7 +950,7 @@ struct sctp_transport {
1085 __u64 hb_nonce; 950 __u64 hb_nonce;
1086}; 951};
1087 952
1088struct sctp_transport *sctp_transport_new(const union sctp_addr *, 953struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
1089 gfp_t); 954 gfp_t);
1090void sctp_transport_set_owner(struct sctp_transport *, 955void sctp_transport_set_owner(struct sctp_transport *,
1091 struct sctp_association *); 956 struct sctp_association *);
@@ -1203,7 +1068,7 @@ void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
1203void sctp_outq_teardown(struct sctp_outq *); 1068void sctp_outq_teardown(struct sctp_outq *);
1204void sctp_outq_free(struct sctp_outq*); 1069void sctp_outq_free(struct sctp_outq*);
1205int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk); 1070int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk);
1206int sctp_outq_sack(struct sctp_outq *, struct sctp_sackhdr *); 1071int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
1207int sctp_outq_is_empty(const struct sctp_outq *); 1072int sctp_outq_is_empty(const struct sctp_outq *);
1208void sctp_outq_restart(struct sctp_outq *); 1073void sctp_outq_restart(struct sctp_outq *);
1209 1074
@@ -1240,7 +1105,7 @@ struct sctp_bind_addr {
1240 1105
1241void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); 1106void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port);
1242void sctp_bind_addr_free(struct sctp_bind_addr *); 1107void sctp_bind_addr_free(struct sctp_bind_addr *);
1243int sctp_bind_addr_copy(struct sctp_bind_addr *dest, 1108int sctp_bind_addr_copy(struct net *net, struct sctp_bind_addr *dest,
1244 const struct sctp_bind_addr *src, 1109 const struct sctp_bind_addr *src,
1245 sctp_scope_t scope, gfp_t gfp, 1110 sctp_scope_t scope, gfp_t gfp,
1246 int flags); 1111 int flags);
@@ -1267,7 +1132,7 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw, int len,
1267 __u16 port, gfp_t gfp); 1132 __u16 port, gfp_t gfp);
1268 1133
1269sctp_scope_t sctp_scope(const union sctp_addr *); 1134sctp_scope_t sctp_scope(const union sctp_addr *);
1270int sctp_in_scope(const union sctp_addr *addr, const sctp_scope_t scope); 1135int sctp_in_scope(struct net *net, const union sctp_addr *addr, const sctp_scope_t scope);
1271int sctp_is_any(struct sock *sk, const union sctp_addr *addr); 1136int sctp_is_any(struct sock *sk, const union sctp_addr *addr);
1272int sctp_addr_is_valid(const union sctp_addr *addr); 1137int sctp_addr_is_valid(const union sctp_addr *addr);
1273int sctp_is_ep_boundall(struct sock *sk); 1138int sctp_is_ep_boundall(struct sock *sk);
@@ -1425,13 +1290,13 @@ struct sctp_association *sctp_endpoint_lookup_assoc(
1425int sctp_endpoint_is_peeled_off(struct sctp_endpoint *, 1290int sctp_endpoint_is_peeled_off(struct sctp_endpoint *,
1426 const union sctp_addr *); 1291 const union sctp_addr *);
1427struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, 1292struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *,
1428 const union sctp_addr *); 1293 struct net *, const union sctp_addr *);
1429int sctp_has_association(const union sctp_addr *laddr, 1294int sctp_has_association(struct net *net, const union sctp_addr *laddr,
1430 const union sctp_addr *paddr); 1295 const union sctp_addr *paddr);
1431 1296
1432int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, 1297int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
1433 sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, 1298 sctp_cid_t, sctp_init_chunk_t *peer_init,
1434 struct sctp_chunk **err_chunk); 1299 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
1435int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, 1300int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
1436 const union sctp_addr *peer, 1301 const union sctp_addr *peer,
1437 sctp_init_chunk_t *init, gfp_t gfp); 1302 sctp_init_chunk_t *init, gfp_t gfp);
@@ -2013,6 +1878,7 @@ void sctp_assoc_control_transport(struct sctp_association *,
2013 sctp_transport_cmd_t, sctp_sn_error_t); 1878 sctp_transport_cmd_t, sctp_sn_error_t);
2014struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32); 1879struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *, __u32);
2015struct sctp_transport *sctp_assoc_is_match(struct sctp_association *, 1880struct sctp_transport *sctp_assoc_is_match(struct sctp_association *,
1881 struct net *,
2016 const union sctp_addr *, 1882 const union sctp_addr *,
2017 const union sctp_addr *); 1883 const union sctp_addr *);
2018void sctp_assoc_migrate(struct sctp_association *, struct sock *); 1884void sctp_assoc_migrate(struct sctp_association *, struct sock *);
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 0147b901e79c..71596261fa99 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -154,13 +154,15 @@ struct linux_xfrm_mib {
154 */ 154 */
155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ 155#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
156 do { \ 156 do { \
157 this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 157 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
158 this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 158 this_cpu_inc(ptr[basefield##PKTS]); \
159 this_cpu_add(ptr[basefield##OCTETS], addend); \
159 } while (0) 160 } while (0)
160#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ 161#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
161 do { \ 162 do { \
162 __this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ 163 __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
163 __this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ 164 __this_cpu_inc(ptr[basefield##PKTS]); \
165 __this_cpu_add(ptr[basefield##OCTETS], addend); \
164 } while (0) 166 } while (0)
165 167
166 168
diff --git a/include/net/sock.h b/include/net/sock.h
index 72132aef53fc..c945fba4f543 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -247,8 +247,7 @@ struct cg_proto;
247 * @sk_stamp: time stamp of last packet received 247 * @sk_stamp: time stamp of last packet received
248 * @sk_socket: Identd and reporting IO signals 248 * @sk_socket: Identd and reporting IO signals
249 * @sk_user_data: RPC layer private data 249 * @sk_user_data: RPC layer private data
250 * @sk_sndmsg_page: cached page for sendmsg 250 * @sk_frag: cached page frag
251 * @sk_sndmsg_off: cached offset for sendmsg
252 * @sk_peek_off: current peek_offset value 251 * @sk_peek_off: current peek_offset value
253 * @sk_send_head: front of stuff to transmit 252 * @sk_send_head: front of stuff to transmit
254 * @sk_security: used by security modules 253 * @sk_security: used by security modules
@@ -362,9 +361,8 @@ struct sock {
362 ktime_t sk_stamp; 361 ktime_t sk_stamp;
363 struct socket *sk_socket; 362 struct socket *sk_socket;
364 void *sk_user_data; 363 void *sk_user_data;
365 struct page *sk_sndmsg_page; 364 struct page_frag sk_frag;
366 struct sk_buff *sk_send_head; 365 struct sk_buff *sk_send_head;
367 __u32 sk_sndmsg_off;
368 __s32 sk_peek_off; 366 __s32 sk_peek_off;
369 int sk_write_pending; 367 int sk_write_pending;
370#ifdef CONFIG_SECURITY 368#ifdef CONFIG_SECURITY
@@ -606,6 +604,15 @@ static inline void sk_add_bind_node(struct sock *sk,
606#define sk_for_each_bound(__sk, node, list) \ 604#define sk_for_each_bound(__sk, node, list) \
607 hlist_for_each_entry(__sk, node, list, sk_bind_node) 605 hlist_for_each_entry(__sk, node, list, sk_bind_node)
608 606
607static inline struct user_namespace *sk_user_ns(struct sock *sk)
608{
609 /* Careful only use this in a context where these parameters
610 * can not change and must all be valid, such as recvmsg from
611 * userspace.
612 */
613 return sk->sk_socket->file->f_cred->user_ns;
614}
615
609/* Sock flags */ 616/* Sock flags */
610enum sock_flags { 617enum sock_flags {
611 SOCK_DEAD, 618 SOCK_DEAD,
@@ -1332,7 +1339,7 @@ static inline bool sk_wmem_schedule(struct sock *sk, int size)
1332} 1339}
1333 1340
1334static inline bool 1341static inline bool
1335sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, unsigned int size) 1342sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size)
1336{ 1343{
1337 if (!sk_has_account(sk)) 1344 if (!sk_has_account(sk))
1338 return true; 1345 return true;
@@ -1486,14 +1493,6 @@ extern void *sock_kmalloc(struct sock *sk, int size,
1486extern void sock_kfree_s(struct sock *sk, void *mem, int size); 1493extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1487extern void sk_send_sigurg(struct sock *sk); 1494extern void sk_send_sigurg(struct sock *sk);
1488 1495
1489#ifdef CONFIG_CGROUPS
1490extern void sock_update_classid(struct sock *sk);
1491#else
1492static inline void sock_update_classid(struct sock *sk)
1493{
1494}
1495#endif
1496
1497/* 1496/*
1498 * Functions to fill in entries in struct proto_ops when a protocol 1497 * Functions to fill in entries in struct proto_ops when a protocol
1499 * does not implement a particular function. 1498 * does not implement a particular function.
@@ -1670,7 +1669,7 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1670 write_unlock_bh(&sk->sk_callback_lock); 1669 write_unlock_bh(&sk->sk_callback_lock);
1671} 1670}
1672 1671
1673extern int sock_i_uid(struct sock *sk); 1672extern kuid_t sock_i_uid(struct sock *sk);
1674extern unsigned long sock_i_ino(struct sock *sk); 1673extern unsigned long sock_i_ino(struct sock *sk);
1675 1674
1676static inline struct dst_entry * 1675static inline struct dst_entry *
@@ -2025,18 +2024,23 @@ static inline void sk_stream_moderate_sndbuf(struct sock *sk)
2025 2024
2026struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp); 2025struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp);
2027 2026
2028static inline struct page *sk_stream_alloc_page(struct sock *sk) 2027/**
2028 * sk_page_frag - return an appropriate page_frag
2029 * @sk: socket
2030 *
2031 * If socket allocation mode allows current thread to sleep, it means its
2032 * safe to use the per task page_frag instead of the per socket one.
2033 */
2034static inline struct page_frag *sk_page_frag(struct sock *sk)
2029{ 2035{
2030 struct page *page = NULL; 2036 if (sk->sk_allocation & __GFP_WAIT)
2037 return &current->task_frag;
2031 2038
2032 page = alloc_pages(sk->sk_allocation, 0); 2039 return &sk->sk_frag;
2033 if (!page) {
2034 sk_enter_memory_pressure(sk);
2035 sk_stream_moderate_sndbuf(sk);
2036 }
2037 return page;
2038} 2040}
2039 2041
2042extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2043
2040/* 2044/*
2041 * Default write policy as shown to user space via poll/select/SIGIO 2045 * Default write policy as shown to user space via poll/select/SIGIO
2042 */ 2046 */
@@ -2217,8 +2221,6 @@ extern int net_msg_warn;
2217extern __u32 sysctl_wmem_max; 2221extern __u32 sysctl_wmem_max;
2218extern __u32 sysctl_rmem_max; 2222extern __u32 sysctl_rmem_max;
2219 2223
2220extern void sk_init(void);
2221
2222extern int sysctl_optmem_max; 2224extern int sysctl_optmem_max;
2223 2225
2224extern __u32 sysctl_wmem_default; 2226extern __u32 sysctl_wmem_default;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 1f000ffe7075..6feeccd83dd7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -98,11 +98,21 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
98 * 15 is ~13-30min depending on RTO. 98 * 15 is ~13-30min depending on RTO.
99 */ 99 */
100 100
101#define TCP_SYN_RETRIES 5 /* number of times to retry active opening a 101#define TCP_SYN_RETRIES 6 /* This is how many retries are done
102 * connection: ~180sec is RFC minimum */ 102 * when active opening a connection.
103 * RFC1122 says the minimum retry MUST
104 * be at least 180secs. Nevertheless
105 * this value is corresponding to
106 * 63secs of retransmission with the
107 * current initial RTO.
108 */
103 109
104#define TCP_SYNACK_RETRIES 5 /* number of times to retry passive opening a 110#define TCP_SYNACK_RETRIES 5 /* This is how may retries are done
105 * connection: ~180sec is RFC minimum */ 111 * when passive opening a connection.
112 * This is corresponding to 31secs of
113 * retransmission with the current
114 * initial RTO.
115 */
106 116
107#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT 117#define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT
108 * state, about 60 seconds */ 118 * state, about 60 seconds */
@@ -214,8 +224,24 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
214 224
215/* Bit Flags for sysctl_tcp_fastopen */ 225/* Bit Flags for sysctl_tcp_fastopen */
216#define TFO_CLIENT_ENABLE 1 226#define TFO_CLIENT_ENABLE 1
227#define TFO_SERVER_ENABLE 2
217#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */ 228#define TFO_CLIENT_NO_COOKIE 4 /* Data in SYN w/o cookie option */
218 229
230/* Process SYN data but skip cookie validation */
231#define TFO_SERVER_COOKIE_NOT_CHKED 0x100
232/* Accept SYN data w/o any cookie option */
233#define TFO_SERVER_COOKIE_NOT_REQD 0x200
234
235/* Force enable TFO on all listeners, i.e., not requiring the
236 * TCP_FASTOPEN socket option. SOCKOPT1/2 determine how to set max_qlen.
237 */
238#define TFO_SERVER_WO_SOCKOPT1 0x400
239#define TFO_SERVER_WO_SOCKOPT2 0x800
240/* Always create TFO child sockets on a TFO listener even when
241 * cookie/data not present. (For testing purpose!)
242 */
243#define TFO_SERVER_ALWAYS 0x1000
244
219extern struct inet_timewait_death_row tcp_death_row; 245extern struct inet_timewait_death_row tcp_death_row;
220 246
221/* sysctl variables for tcp */ 247/* sysctl variables for tcp */
@@ -398,7 +424,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *
398 const struct tcphdr *th); 424 const struct tcphdr *th);
399extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 425extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
400 struct request_sock *req, 426 struct request_sock *req,
401 struct request_sock **prev); 427 struct request_sock **prev,
428 bool fastopen);
402extern int tcp_child_process(struct sock *parent, struct sock *child, 429extern int tcp_child_process(struct sock *parent, struct sock *child,
403 struct sk_buff *skb); 430 struct sk_buff *skb);
404extern bool tcp_use_frto(struct sock *sk); 431extern bool tcp_use_frto(struct sock *sk);
@@ -411,12 +438,6 @@ extern void tcp_metrics_init(void);
411extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 438extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check);
412extern bool tcp_remember_stamp(struct sock *sk); 439extern bool tcp_remember_stamp(struct sock *sk);
413extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 440extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
414extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
415 struct tcp_fastopen_cookie *cookie,
416 int *syn_loss, unsigned long *last_syn_loss);
417extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
418 struct tcp_fastopen_cookie *cookie,
419 bool syn_lost);
420extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 441extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
421extern void tcp_disable_fack(struct tcp_sock *tp); 442extern void tcp_disable_fack(struct tcp_sock *tp);
422extern void tcp_close(struct sock *sk, long timeout); 443extern void tcp_close(struct sock *sk, long timeout);
@@ -458,7 +479,8 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,
458extern int tcp_connect(struct sock *sk); 479extern int tcp_connect(struct sock *sk);
459extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 480extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
460 struct request_sock *req, 481 struct request_sock *req,
461 struct request_values *rvp); 482 struct request_values *rvp,
483 struct tcp_fastopen_cookie *foc);
462extern int tcp_disconnect(struct sock *sk, int flags); 484extern int tcp_disconnect(struct sock *sk, int flags);
463 485
464void tcp_connect_init(struct sock *sk); 486void tcp_connect_init(struct sock *sk);
@@ -527,6 +549,7 @@ extern void tcp_send_delayed_ack(struct sock *sk);
527extern void tcp_cwnd_application_limited(struct sock *sk); 549extern void tcp_cwnd_application_limited(struct sock *sk);
528extern void tcp_resume_early_retransmit(struct sock *sk); 550extern void tcp_resume_early_retransmit(struct sock *sk);
529extern void tcp_rearm_rto(struct sock *sk); 551extern void tcp_rearm_rto(struct sock *sk);
552extern void tcp_reset(struct sock *sk);
530 553
531/* tcp_timer.c */ 554/* tcp_timer.c */
532extern void tcp_init_xmit_timers(struct sock *); 555extern void tcp_init_xmit_timers(struct sock *);
@@ -576,6 +599,7 @@ extern int tcp_mtu_to_mss(struct sock *sk, int pmtu);
576extern int tcp_mss_to_mtu(struct sock *sk, int mss); 599extern int tcp_mss_to_mtu(struct sock *sk, int mss);
577extern void tcp_mtup_init(struct sock *sk); 600extern void tcp_mtup_init(struct sock *sk);
578extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt); 601extern void tcp_valid_rtt_meas(struct sock *sk, u32 seq_rtt);
602extern void tcp_init_buffer_space(struct sock *sk);
579 603
580static inline void tcp_bound_rto(const struct sock *sk) 604static inline void tcp_bound_rto(const struct sock *sk)
581{ 605{
@@ -889,15 +913,21 @@ static inline bool tcp_in_initial_slowstart(const struct tcp_sock *tp)
889 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH; 913 return tp->snd_ssthresh >= TCP_INFINITE_SSTHRESH;
890} 914}
891 915
916static inline bool tcp_in_cwnd_reduction(const struct sock *sk)
917{
918 return (TCPF_CA_CWR | TCPF_CA_Recovery) &
919 (1 << inet_csk(sk)->icsk_ca_state);
920}
921
892/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 922/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
893 * The exception is rate halving phase, when cwnd is decreasing towards 923 * The exception is cwnd reduction phase, when cwnd is decreasing towards
894 * ssthresh. 924 * ssthresh.
895 */ 925 */
896static inline __u32 tcp_current_ssthresh(const struct sock *sk) 926static inline __u32 tcp_current_ssthresh(const struct sock *sk)
897{ 927{
898 const struct tcp_sock *tp = tcp_sk(sk); 928 const struct tcp_sock *tp = tcp_sk(sk);
899 929
900 if ((1 << inet_csk(sk)->icsk_ca_state) & (TCPF_CA_CWR | TCPF_CA_Recovery)) 930 if (tcp_in_cwnd_reduction(sk))
901 return tp->snd_ssthresh; 931 return tp->snd_ssthresh;
902 else 932 else
903 return max(tp->snd_ssthresh, 933 return max(tp->snd_ssthresh,
@@ -1094,6 +1124,8 @@ static inline void tcp_openreq_init(struct request_sock *req,
1094 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 1124 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
1095 req->cookie_ts = 0; 1125 req->cookie_ts = 0;
1096 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 1126 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1127 tcp_rsk(req)->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
1128 tcp_rsk(req)->snt_synack = 0;
1097 req->mss = rx_opt->mss_clamp; 1129 req->mss = rx_opt->mss_clamp;
1098 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1130 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1099 ireq->tstamp_ok = rx_opt->tstamp_ok; 1131 ireq->tstamp_ok = rx_opt->tstamp_ok;
@@ -1106,6 +1138,15 @@ static inline void tcp_openreq_init(struct request_sock *req,
1106 ireq->loc_port = tcp_hdr(skb)->dest; 1138 ireq->loc_port = tcp_hdr(skb)->dest;
1107} 1139}
1108 1140
1141/* Compute time elapsed between SYNACK and the ACK completing 3WHS */
1142static inline void tcp_synack_rtt_meas(struct sock *sk,
1143 struct request_sock *req)
1144{
1145 if (tcp_rsk(req)->snt_synack)
1146 tcp_valid_rtt_meas(sk,
1147 tcp_time_stamp - tcp_rsk(req)->snt_synack);
1148}
1149
1109extern void tcp_enter_memory_pressure(struct sock *sk); 1150extern void tcp_enter_memory_pressure(struct sock *sk);
1110 1151
1111static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1152static inline int keepalive_intvl_when(const struct tcp_sock *tp)
@@ -1298,15 +1339,34 @@ extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff
1298extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1339extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1299 const struct tcp_md5sig_key *key); 1340 const struct tcp_md5sig_key *key);
1300 1341
1342/* From tcp_fastopen.c */
1343extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1344 struct tcp_fastopen_cookie *cookie,
1345 int *syn_loss, unsigned long *last_syn_loss);
1346extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1347 struct tcp_fastopen_cookie *cookie,
1348 bool syn_lost);
1301struct tcp_fastopen_request { 1349struct tcp_fastopen_request {
1302 /* Fast Open cookie. Size 0 means a cookie request */ 1350 /* Fast Open cookie. Size 0 means a cookie request */
1303 struct tcp_fastopen_cookie cookie; 1351 struct tcp_fastopen_cookie cookie;
1304 struct msghdr *data; /* data in MSG_FASTOPEN */ 1352 struct msghdr *data; /* data in MSG_FASTOPEN */
1305 u16 copied; /* queued in tcp_connect() */ 1353 u16 copied; /* queued in tcp_connect() */
1306}; 1354};
1307
1308void tcp_free_fastopen_req(struct tcp_sock *tp); 1355void tcp_free_fastopen_req(struct tcp_sock *tp);
1309 1356
1357extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1358int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1359void tcp_fastopen_cookie_gen(__be32 addr, struct tcp_fastopen_cookie *foc);
1360
1361#define TCP_FASTOPEN_KEY_LENGTH 16
1362
1363/* Fastopen key context */
1364struct tcp_fastopen_context {
1365 struct crypto_cipher __rcu *tfm;
1366 __u8 key[TCP_FASTOPEN_KEY_LENGTH];
1367 struct rcu_head rcu;
1368};
1369
1310/* write queue abstraction */ 1370/* write queue abstraction */
1311static inline void tcp_write_queue_purge(struct sock *sk) 1371static inline void tcp_write_queue_purge(struct sock *sk)
1312{ 1372{
@@ -1510,7 +1570,8 @@ struct tcp_iter_state {
1510 sa_family_t family; 1570 sa_family_t family;
1511 enum tcp_seq_states state; 1571 enum tcp_seq_states state;
1512 struct sock *syn_wait_sk; 1572 struct sock *syn_wait_sk;
1513 int bucket, offset, sbucket, num, uid; 1573 int bucket, offset, sbucket, num;
1574 kuid_t uid;
1514 loff_t last_pos; 1575 loff_t last_pos;
1515}; 1576};
1516 1577
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 62b619e82a90..6f0ba01afe73 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -263,7 +263,7 @@ struct km_event {
263 } data; 263 } data;
264 264
265 u32 seq; 265 u32 seq;
266 u32 pid; 266 u32 portid;
267 u32 event; 267 u32 event;
268 struct net *net; 268 struct net *net;
269}; 269};
@@ -273,6 +273,9 @@ struct xfrm_replay {
273 int (*check)(struct xfrm_state *x, 273 int (*check)(struct xfrm_state *x,
274 struct sk_buff *skb, 274 struct sk_buff *skb,
275 __be32 net_seq); 275 __be32 net_seq);
276 int (*recheck)(struct xfrm_state *x,
277 struct sk_buff *skb,
278 __be32 net_seq);
276 void (*notify)(struct xfrm_state *x, int event); 279 void (*notify)(struct xfrm_state *x, int event);
277 int (*overflow)(struct xfrm_state *x, struct sk_buff *skb); 280 int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
278}; 281};
@@ -292,6 +295,8 @@ struct xfrm_policy_afinfo {
292 struct flowi *fl, 295 struct flowi *fl,
293 int reverse); 296 int reverse);
294 int (*get_tos)(const struct flowi *fl); 297 int (*get_tos)(const struct flowi *fl);
298 void (*init_dst)(struct net *net,
299 struct xfrm_dst *dst);
295 int (*init_path)(struct xfrm_dst *path, 300 int (*init_path)(struct xfrm_dst *path,
296 struct dst_entry *dst, 301 struct dst_entry *dst,
297 int nfheader_len); 302 int nfheader_len);
@@ -308,7 +313,7 @@ extern void km_state_notify(struct xfrm_state *x, const struct km_event *c);
308 313
309struct xfrm_tmpl; 314struct xfrm_tmpl;
310extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 315extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
311extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid); 316extern void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
312extern int __xfrm_state_delete(struct xfrm_state *x); 317extern int __xfrm_state_delete(struct xfrm_state *x);
313 318
314struct xfrm_state_afinfo { 319struct xfrm_state_afinfo {
@@ -571,7 +576,7 @@ struct xfrm_mgr {
571 struct list_head list; 576 struct list_head list;
572 char *id; 577 char *id;
573 int (*notify)(struct xfrm_state *x, const struct km_event *c); 578 int (*notify)(struct xfrm_state *x, const struct km_event *c);
574 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 579 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp);
575 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 580 struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
576 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 581 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
577 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c); 582 int (*notify_policy)(struct xfrm_policy *x, int dir, const struct km_event *c);
@@ -666,7 +671,7 @@ struct xfrm_spi_skb_cb {
666/* Audit Information */ 671/* Audit Information */
667struct xfrm_audit { 672struct xfrm_audit {
668 u32 secid; 673 u32 secid;
669 uid_t loginuid; 674 kuid_t loginuid;
670 u32 sessionid; 675 u32 sessionid;
671}; 676};
672 677
@@ -685,13 +690,14 @@ static inline struct audit_buffer *xfrm_audit_start(const char *op)
685 return audit_buf; 690 return audit_buf;
686} 691}
687 692
688static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid, 693static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
689 struct audit_buffer *audit_buf) 694 struct audit_buffer *audit_buf)
690{ 695{
691 char *secctx; 696 char *secctx;
692 u32 secctx_len; 697 u32 secctx_len;
693 698
694 audit_log_format(audit_buf, " auid=%u ses=%u", auid, ses); 699 audit_log_format(audit_buf, " auid=%u ses=%u",
700 from_kuid(&init_user_ns, auid), ses);
695 if (secid != 0 && 701 if (secid != 0 &&
696 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { 702 security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) {
697 audit_log_format(audit_buf, " subj=%s", secctx); 703 audit_log_format(audit_buf, " subj=%s", secctx);
@@ -701,13 +707,13 @@ static inline void xfrm_audit_helper_usrinfo(uid_t auid, u32 ses, u32 secid,
701} 707}
702 708
703extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 709extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
704 u32 auid, u32 ses, u32 secid); 710 kuid_t auid, u32 ses, u32 secid);
705extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 711extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
706 u32 auid, u32 ses, u32 secid); 712 kuid_t auid, u32 ses, u32 secid);
707extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 713extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
708 u32 auid, u32 ses, u32 secid); 714 kuid_t auid, u32 ses, u32 secid);
709extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 715extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
710 u32 auid, u32 ses, u32 secid); 716 kuid_t auid, u32 ses, u32 secid);
711extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 717extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
712 struct sk_buff *skb); 718 struct sk_buff *skb);
713extern void xfrm_audit_state_replay(struct xfrm_state *x, 719extern void xfrm_audit_state_replay(struct xfrm_state *x,
@@ -720,22 +726,22 @@ extern void xfrm_audit_state_icvfail(struct xfrm_state *x,
720#else 726#else
721 727
722static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 728static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
723 u32 auid, u32 ses, u32 secid) 729 kuid_t auid, u32 ses, u32 secid)
724{ 730{
725} 731}
726 732
727static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 733static inline void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
728 u32 auid, u32 ses, u32 secid) 734 kuid_t auid, u32 ses, u32 secid)
729{ 735{
730} 736}
731 737
732static inline void xfrm_audit_state_add(struct xfrm_state *x, int result, 738static inline void xfrm_audit_state_add(struct xfrm_state *x, int result,
733 u32 auid, u32 ses, u32 secid) 739 kuid_t auid, u32 ses, u32 secid)
734{ 740{
735} 741}
736 742
737static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result, 743static inline void xfrm_audit_state_delete(struct xfrm_state *x, int result,
738 u32 auid, u32 ses, u32 secid) 744 kuid_t auid, u32 ses, u32 secid)
739{ 745{
740} 746}
741 747
@@ -1552,7 +1558,7 @@ extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1552#endif 1558#endif
1553 1559
1554extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1560extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1555extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid); 1561extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid);
1556extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1562extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
1557 1563
1558extern void xfrm_input_init(void); 1564extern void xfrm_input_init(void);
diff --git a/include/rdma/ib_cache.h b/include/rdma/ib_cache.h
index 00a2b8ec327f..ad9a3c280944 100644
--- a/include/rdma/ib_cache.h
+++ b/include/rdma/ib_cache.h
@@ -101,6 +101,22 @@ int ib_find_cached_pkey(struct ib_device *device,
101 u16 *index); 101 u16 *index);
102 102
103/** 103/**
104 * ib_find_exact_cached_pkey - Returns the PKey table index where a specified
105 * PKey value occurs. Comparison uses the FULL 16 bits (incl membership bit)
106 * @device: The device to query.
107 * @port_num: The port number of the device to search for the PKey.
108 * @pkey: The PKey value to search for.
109 * @index: The index into the cached PKey table where the PKey was found.
110 *
111 * ib_find_exact_cached_pkey() searches the specified PKey table in
112 * the local software cache.
113 */
114int ib_find_exact_cached_pkey(struct ib_device *device,
115 u8 port_num,
116 u16 pkey,
117 u16 *index);
118
119/**
104 * ib_get_cached_lmc - Returns a cached lmc table entry 120 * ib_get_cached_lmc - Returns a cached lmc table entry
105 * @device: The device to query. 121 * @device: The device to query.
106 * @port_num: The port number of the device to query. 122 * @port_num: The port number of the device to query.
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 07996af8265a..46bc045bbe15 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -614,6 +614,9 @@ enum ib_qp_type {
614enum ib_qp_create_flags { 614enum ib_qp_create_flags {
615 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0, 615 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0,
616 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, 616 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
617 /* reserve bits 26-31 for low level drivers' internal use */
618 IB_QP_CREATE_RESERVED_START = 1 << 26,
619 IB_QP_CREATE_RESERVED_END = 1 << 31,
617}; 620};
618 621
619struct ib_qp_init_attr { 622struct ib_qp_init_attr {
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index ae33706afeb0..ef937b56f9b5 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -79,7 +79,8 @@ enum phy_event {
79 PHYE_OOB_DONE = 1, 79 PHYE_OOB_DONE = 1,
80 PHYE_OOB_ERROR = 2, 80 PHYE_OOB_ERROR = 2,
81 PHYE_SPINUP_HOLD = 3, /* hot plug SATA, no COMWAKE sent */ 81 PHYE_SPINUP_HOLD = 3, /* hot plug SATA, no COMWAKE sent */
82 PHY_NUM_EVENTS = 4, 82 PHYE_RESUME_TIMEOUT = 4,
83 PHY_NUM_EVENTS = 5,
83}; 84};
84 85
85enum discover_event { 86enum discover_event {
@@ -87,8 +88,10 @@ enum discover_event {
87 DISCE_REVALIDATE_DOMAIN = 1, 88 DISCE_REVALIDATE_DOMAIN = 1,
88 DISCE_PORT_GONE = 2, 89 DISCE_PORT_GONE = 2,
89 DISCE_PROBE = 3, 90 DISCE_PROBE = 3,
90 DISCE_DESTRUCT = 4, 91 DISCE_SUSPEND = 4,
91 DISC_NUM_EVENTS = 5, 92 DISCE_RESUME = 5,
93 DISCE_DESTRUCT = 6,
94 DISC_NUM_EVENTS = 7,
92}; 95};
93 96
94/* ---------- Expander Devices ---------- */ 97/* ---------- Expander Devices ---------- */
@@ -128,7 +131,7 @@ struct ex_phy {
128 u8 attached_sas_addr[SAS_ADDR_SIZE]; 131 u8 attached_sas_addr[SAS_ADDR_SIZE];
129 u8 attached_phy_id; 132 u8 attached_phy_id;
130 133
131 u8 phy_change_count; 134 int phy_change_count;
132 enum routing_attribute routing_attr; 135 enum routing_attribute routing_attr;
133 u8 virtual:1; 136 u8 virtual:1;
134 137
@@ -141,7 +144,7 @@ struct ex_phy {
141struct expander_device { 144struct expander_device {
142 struct list_head children; 145 struct list_head children;
143 146
144 u16 ex_change_count; 147 int ex_change_count;
145 u16 max_route_indexes; 148 u16 max_route_indexes;
146 u8 num_phys; 149 u8 num_phys;
147 150
@@ -169,6 +172,7 @@ struct sata_device {
169 enum ata_command_set command_set; 172 enum ata_command_set command_set;
170 struct smp_resp rps_resp; /* report_phy_sata_resp */ 173 struct smp_resp rps_resp; /* report_phy_sata_resp */
171 u8 port_no; /* port number, if this is a PM (Port) */ 174 u8 port_no; /* port number, if this is a PM (Port) */
175 int pm_result;
172 176
173 struct ata_port *ap; 177 struct ata_port *ap;
174 struct ata_host ata_host; 178 struct ata_host ata_host;
@@ -182,6 +186,7 @@ struct ssp_device {
182 186
183enum { 187enum {
184 SAS_DEV_GONE, 188 SAS_DEV_GONE,
189 SAS_DEV_FOUND, /* device notified to lldd */
185 SAS_DEV_DESTROY, 190 SAS_DEV_DESTROY,
186 SAS_DEV_EH_PENDING, 191 SAS_DEV_EH_PENDING,
187 SAS_DEV_LU_RESET, 192 SAS_DEV_LU_RESET,
@@ -273,6 +278,7 @@ struct asd_sas_port {
273 enum sas_linkrate linkrate; 278 enum sas_linkrate linkrate;
274 279
275 struct sas_work work; 280 struct sas_work work;
281 int suspended;
276 282
277/* public: */ 283/* public: */
278 int id; 284 int id;
@@ -321,6 +327,7 @@ struct asd_sas_phy {
321 unsigned long phy_events_pending; 327 unsigned long phy_events_pending;
322 328
323 int error; 329 int error;
330 int suspended;
324 331
325 struct sas_phy *phy; 332 struct sas_phy *phy;
326 333
@@ -687,6 +694,9 @@ struct sas_domain_function_template {
687 694
688extern int sas_register_ha(struct sas_ha_struct *); 695extern int sas_register_ha(struct sas_ha_struct *);
689extern int sas_unregister_ha(struct sas_ha_struct *); 696extern int sas_unregister_ha(struct sas_ha_struct *);
697extern void sas_prep_resume_ha(struct sas_ha_struct *sas_ha);
698extern void sas_resume_ha(struct sas_ha_struct *sas_ha);
699extern void sas_suspend_ha(struct sas_ha_struct *sas_ha);
690 700
691int sas_set_phy_speed(struct sas_phy *phy, 701int sas_set_phy_speed(struct sas_phy *phy,
692 struct sas_phy_linkrates *rates); 702 struct sas_phy_linkrates *rates);
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
index 56e920ade326..303ba1118a4d 100644
--- a/include/scsi/osd_attributes.h
+++ b/include/scsi/osd_attributes.h
@@ -1,7 +1,7 @@
1#ifndef __OSD_ATTRIBUTES_H__ 1#ifndef __OSD_ATTRIBUTES_H__
2#define __OSD_ATTRIBUTES_H__ 2#define __OSD_ATTRIBUTES_H__
3 3
4#include "osd_protocol.h" 4#include <scsi/osd_protocol.h>
5 5
6/* 6/*
7 * Contains types and constants that define attribute pages and attribute 7 * Contains types and constants that define attribute pages and attribute
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index 572fb5493661..b2e85fdd2ae0 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -14,8 +14,8 @@
14#ifndef __OSD_INITIATOR_H__ 14#ifndef __OSD_INITIATOR_H__
15#define __OSD_INITIATOR_H__ 15#define __OSD_INITIATOR_H__
16 16
17#include "osd_protocol.h" 17#include <scsi/osd_protocol.h>
18#include "osd_types.h" 18#include <scsi/osd_types.h>
19 19
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <scsi/scsi_device.h> 21#include <scsi/scsi_device.h>
diff --git a/include/scsi/osd_sec.h b/include/scsi/osd_sec.h
index 4c09fee8ae1e..f96151c9c9e8 100644
--- a/include/scsi/osd_sec.h
+++ b/include/scsi/osd_sec.h
@@ -14,8 +14,8 @@
14#ifndef __OSD_SEC_H__ 14#ifndef __OSD_SEC_H__
15#define __OSD_SEC_H__ 15#define __OSD_SEC_H__
16 16
17#include "osd_protocol.h" 17#include <scsi/osd_protocol.h>
18#include "osd_types.h" 18#include <scsi/osd_types.h>
19 19
20/* 20/*
21 * Contains types and constants of osd capabilities and security 21 * Contains types and constants of osd capabilities and security
diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
index 2dfbdaa0b34a..ff71a5654684 100644
--- a/include/scsi/sas_ata.h
+++ b/include/scsi/sas_ata.h
@@ -45,6 +45,8 @@ void sas_ata_eh(struct Scsi_Host *shost, struct list_head *work_q,
45void sas_ata_schedule_reset(struct domain_device *dev); 45void sas_ata_schedule_reset(struct domain_device *dev);
46void sas_ata_wait_eh(struct domain_device *dev); 46void sas_ata_wait_eh(struct domain_device *dev);
47void sas_probe_sata(struct asd_sas_port *port); 47void sas_probe_sata(struct asd_sas_port *port);
48void sas_suspend_sata(struct asd_sas_port *port);
49void sas_resume_sata(struct asd_sas_port *port);
48void sas_ata_end_eh(struct ata_port *ap); 50void sas_ata_end_eh(struct ata_port *ap);
49#else 51#else
50 52
@@ -82,6 +84,14 @@ static inline void sas_probe_sata(struct asd_sas_port *port)
82{ 84{
83} 85}
84 86
87static inline void sas_suspend_sata(struct asd_sas_port *port)
88{
89}
90
91static inline void sas_resume_sata(struct asd_sas_port *port)
92{
93}
94
85static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) 95static inline int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
86{ 96{
87 return 0; 97 return 0;
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h
index 91a4e4ff9a9b..3031b900b087 100644
--- a/include/scsi/scsi_bsg_fc.h
+++ b/include/scsi/scsi_bsg_fc.h
@@ -26,8 +26,6 @@
26 * This file intended to be included by both kernel and user space 26 * This file intended to be included by both kernel and user space
27 */ 27 */
28 28
29#include <scsi/scsi.h>
30
31/* 29/*
32 * FC Transport SGIO v4 BSG Message Support 30 * FC Transport SGIO v4 BSG Message Support
33 */ 31 */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 9895f69294fc..88fae8d20154 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -156,6 +156,7 @@ struct scsi_device {
156 unsigned is_visible:1; /* is the device visible in sysfs */ 156 unsigned is_visible:1; /* is the device visible in sysfs */
157 unsigned can_power_off:1; /* Device supports runtime power off */ 157 unsigned can_power_off:1; /* Device supports runtime power off */
158 unsigned wce_default_on:1; /* Cache is ON by default */ 158 unsigned wce_default_on:1; /* Cache is ON by default */
159 unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
159 160
160 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */ 161 DECLARE_BITMAP(supported_events, SDEV_EVT_MAXBITS); /* supported events */
161 struct list_head event_list; /* asserted events */ 162 struct list_head event_list; /* asserted events */
@@ -476,6 +477,9 @@ static inline int scsi_device_enclosure(struct scsi_device *sdev)
476 477
477static inline int scsi_device_protection(struct scsi_device *sdev) 478static inline int scsi_device_protection(struct scsi_device *sdev)
478{ 479{
480 if (sdev->no_dif)
481 return 0;
482
479 return sdev->scsi_level > SCSI_2 && sdev->inquiry[5] & (1<<0); 483 return sdev->scsi_level > SCSI_2 && sdev->inquiry[5] & (1<<0);
480} 484}
481 485
diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
index b4ddd3b18b4c..cc1f3e786ad7 100644
--- a/include/scsi/scsi_devinfo.h
+++ b/include/scsi/scsi_devinfo.h
@@ -30,4 +30,5 @@
30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */ 30#define BLIST_RETRY_HWERROR 0x400000 /* retry HARDWARE_ERROR */
31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */ 31#define BLIST_MAX_512 0x800000 /* maximum 512 sector cdb length */
32#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */ 32#define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */
33#define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */
33#endif 34#endif
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 5f7d5b3b1c6e..49084807eb6b 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -873,6 +873,9 @@ static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsign
873 SHOST_DIF_TYPE2_PROTECTION, 873 SHOST_DIF_TYPE2_PROTECTION,
874 SHOST_DIF_TYPE3_PROTECTION }; 874 SHOST_DIF_TYPE3_PROTECTION };
875 875
876 if (target_type > SHOST_DIF_TYPE3_PROTECTION)
877 return 0;
878
876 return shost->prot_capabilities & cap[target_type] ? target_type : 0; 879 return shost->prot_capabilities & cap[target_type] ? target_type : 0;
877} 880}
878 881
@@ -884,6 +887,9 @@ static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsign
884 SHOST_DIX_TYPE2_PROTECTION, 887 SHOST_DIX_TYPE2_PROTECTION,
885 SHOST_DIX_TYPE3_PROTECTION }; 888 SHOST_DIX_TYPE3_PROTECTION };
886 889
890 if (target_type > SHOST_DIX_TYPE3_PROTECTION)
891 return 0;
892
887 return shost->prot_capabilities & cap[target_type]; 893 return shost->prot_capabilities & cap[target_type];
888#endif 894#endif
889 return 0; 895 return 0;
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h
index 5cb20ccb1956..62b4edab15d3 100644
--- a/include/scsi/scsi_netlink.h
+++ b/include/scsi/scsi_netlink.h
@@ -119,29 +119,5 @@ struct scsi_nl_host_vendor_msg {
119 (hdr)->msglen = mlen; \ 119 (hdr)->msglen = mlen; \
120 } 120 }
121 121
122
123#ifdef __KERNEL__
124
125#include <scsi/scsi_host.h>
126
127/* Exported Kernel Interfaces */
128int scsi_nl_add_transport(u8 tport,
129 int (*msg_handler)(struct sk_buff *),
130 void (*event_handler)(struct notifier_block *, unsigned long, void *));
131void scsi_nl_remove_transport(u8 tport);
132
133int scsi_nl_add_driver(u64 vendor_id, struct scsi_host_template *hostt,
134 int (*nlmsg_handler)(struct Scsi_Host *shost, void *payload,
135 u32 len, u32 pid),
136 void (*nlevt_handler)(struct notifier_block *nb,
137 unsigned long event, void *notify_ptr));
138void scsi_nl_remove_driver(u64 vendor_id);
139
140void scsi_nl_send_transport_msg(u32 pid, struct scsi_nl_hdr *hdr);
141int scsi_nl_send_vendor_msg(u32 pid, unsigned short host_no, u64 vendor_id,
142 char *data_buf, u32 data_len);
143
144#endif /* __KERNEL__ */
145
146#endif /* SCSI_NETLINK_H */ 122#endif /* SCSI_NETLINK_H */
147 123
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index 02cbb50225bb..d315a08d6c6d 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -28,9 +28,9 @@
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include "pcm.h" 31#include <sound/pcm.h>
32#include "control.h" 32#include <sound/control.h>
33#include "info.h" 33#include <sound/info.h>
34 34
35/* maximum number of devices on the AC97 bus */ 35/* maximum number of devices on the AC97 bus */
36#define AC97_BUS_MAX_DEVICES 4 36#define AC97_BUS_MAX_DEVICES 4
@@ -422,6 +422,7 @@
422 */ 422 */
423 423
424struct snd_ac97; 424struct snd_ac97;
425struct snd_pcm_chmap;
425 426
426struct snd_ac97_build_ops { 427struct snd_ac97_build_ops {
427 int (*build_3d) (struct snd_ac97 *ac97); 428 int (*build_3d) (struct snd_ac97 *ac97);
@@ -528,6 +529,8 @@ struct snd_ac97 {
528 struct delayed_work power_work; 529 struct delayed_work power_work;
529#endif 530#endif
530 struct device dev; 531 struct device dev;
532
533 struct snd_pcm_chmap *chmaps[2]; /* channel-maps (optional) */
531}; 534};
532 535
533#define to_ac97_t(d) container_of(d, struct snd_ac97, dev) 536#define to_ac97_t(d) container_of(d, struct snd_ac97, dev)
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index d010858c33c2..abdf609c5918 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -20,9 +20,9 @@
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/ 21*/
22 22
23#include "control.h" 23#include <sound/control.h>
24#include "pcm.h" 24#include <sound/pcm.h>
25#include "timer.h" 25#include <sound/timer.h>
26 26
27#define AD1816A_REG(r) (chip->port + r) 27#define AD1816A_REG(r) (chip->port + r)
28 28
@@ -147,6 +147,9 @@ struct snd_ad1816a {
147 unsigned int c_dma_size; 147 unsigned int c_dma_size;
148 148
149 struct snd_timer *timer; 149 struct snd_timer *timer;
150#ifdef CONFIG_PM
151 unsigned short image[48];
152#endif
150}; 153};
151 154
152 155
@@ -165,11 +168,15 @@ struct snd_ad1816a {
165 168
166extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, 169extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
167 int irq, int dma1, int dma2, 170 int irq, int dma1, int dma2,
168 struct snd_ad1816a **chip); 171 struct snd_ad1816a *chip);
169 172
170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); 173extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); 174extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
172extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, 175extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
173 struct snd_timer **rtimer); 176 struct snd_timer **rtimer);
177#ifdef CONFIG_PM
178extern void snd_ad1816a_suspend(struct snd_ad1816a *chip);
179extern void snd_ad1816a_resume(struct snd_ad1816a *chip);
180#endif
174 181
175#endif /* __SOUND_AD1816A_H */ 182#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/ak4531_codec.h b/include/sound/ak4531_codec.h
index 575296cf7987..85ea86ea35b3 100644
--- a/include/sound/ak4531_codec.h
+++ b/include/sound/ak4531_codec.h
@@ -25,8 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#include "info.h" 28#include <sound/info.h>
29#include "control.h" 29#include <sound/control.h>
30 30
31/* 31/*
32 * ASAHI KASEI - AK4531 codec 32 * ASAHI KASEI - AK4531 codec
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 0876a1e76aef..dfe7d441748c 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -472,6 +472,45 @@ enum {
472 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 472 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
473}; 473};
474 474
475/* channel positions */
476enum {
477 SNDRV_CHMAP_UNKNOWN = 0,
478 SNDRV_CHMAP_NA, /* N/A, silent */
479 SNDRV_CHMAP_MONO, /* mono stream */
480 /* this follows the alsa-lib mixer channel value + 3 */
481 SNDRV_CHMAP_FL, /* front left */
482 SNDRV_CHMAP_FR, /* front right */
483 SNDRV_CHMAP_RL, /* rear left */
484 SNDRV_CHMAP_RR, /* rear right */
485 SNDRV_CHMAP_FC, /* front center */
486 SNDRV_CHMAP_LFE, /* LFE */
487 SNDRV_CHMAP_SL, /* side left */
488 SNDRV_CHMAP_SR, /* side right */
489 SNDRV_CHMAP_RC, /* rear center */
490 /* new definitions */
491 SNDRV_CHMAP_FLC, /* front left center */
492 SNDRV_CHMAP_FRC, /* front right center */
493 SNDRV_CHMAP_RLC, /* rear left center */
494 SNDRV_CHMAP_RRC, /* rear right center */
495 SNDRV_CHMAP_FLW, /* front left wide */
496 SNDRV_CHMAP_FRW, /* front right wide */
497 SNDRV_CHMAP_FLH, /* front left high */
498 SNDRV_CHMAP_FCH, /* front center high */
499 SNDRV_CHMAP_FRH, /* front right high */
500 SNDRV_CHMAP_TC, /* top center */
501 SNDRV_CHMAP_TFL, /* top front left */
502 SNDRV_CHMAP_TFR, /* top front right */
503 SNDRV_CHMAP_TFC, /* top front center */
504 SNDRV_CHMAP_TRL, /* top rear left */
505 SNDRV_CHMAP_TRR, /* top rear right */
506 SNDRV_CHMAP_TRC, /* top rear center */
507 SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC,
508};
509
510#define SNDRV_CHMAP_POSITION_MASK 0xffff
511#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
512#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
513
475#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) 514#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
476#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) 515#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
477#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) 516#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 48f2a1ff2bbc..f2912abacdf3 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -61,6 +61,7 @@ struct snd_compr_runtime {
61 u64 total_bytes_available; 61 u64 total_bytes_available;
62 u64 total_bytes_transferred; 62 u64 total_bytes_transferred;
63 wait_queue_head_t sleep; 63 wait_queue_head_t sleep;
64 void *private_data;
64}; 65};
65 66
66/** 67/**
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index da4a456de032..602dc6c45d1a 100644
--- a/include/sound/compress_params.h
+++ b/include/sound/compress_params.h
@@ -72,6 +72,7 @@
72#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) 72#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
73#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) 73#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
74#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) 74#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
75#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_G729
75 76
76/* 77/*
77 * Profile and modes are listed with bit masks. This allows for a 78 * Profile and modes are listed with bit masks. This allows for a
diff --git a/include/sound/da9055.h b/include/sound/da9055.h
new file mode 100644
index 000000000000..cf1241b64d89
--- /dev/null
+++ b/include/sound/da9055.h
@@ -0,0 +1,33 @@
1/*
2 * DA9055 ALSA Soc codec driver
3 *
4 * Copyright (c) 2012 Dialog Semiconductor
5 *
6 * Tested on (Samsung SMDK6410 board + DA9055 EVB) using I2S and I2C
7 * Written by David Chen <david.chen@diasemi.com> and
8 * Ashish Chavan <ashish.chavan@kpitcummins.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifndef __SOUND_DA9055_H__
17#define __SOUND_DA9055_H__
18
19enum da9055_micbias_voltage {
20 DA9055_MICBIAS_1_6V = 0,
21 DA9055_MICBIAS_1_8V = 1,
22 DA9055_MICBIAS_2_1V = 2,
23 DA9055_MICBIAS_2_2V = 3,
24};
25
26struct da9055_platform_data {
27 /* Selects which of the two MicBias pins acts as the bias source */
28 bool micbias_source;
29 /* Selects the micbias voltage */
30 enum da9055_micbias_voltage micbias;
31};
32
33#endif
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 4f865df42f0f..1a33f48ebe78 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1788,7 +1788,7 @@ struct snd_emu10k1 {
1788 unsigned int efx_voices_mask[2]; 1788 unsigned int efx_voices_mask[2];
1789 unsigned int next_free_voice; 1789 unsigned int next_free_voice;
1790 1790
1791#ifdef CONFIG_PM 1791#ifdef CONFIG_PM_SLEEP
1792 unsigned int *saved_ptr; 1792 unsigned int *saved_ptr;
1793 unsigned int *saved_gpr; 1793 unsigned int *saved_gpr;
1794 unsigned int *tram_val_saved; 1794 unsigned int *tram_val_saved;
@@ -1856,7 +1856,7 @@ unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1856void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data); 1856void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1857unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1857unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1858 1858
1859#ifdef CONFIG_PM 1859#ifdef CONFIG_PM_SLEEP
1860void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu); 1860void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
1861void snd_emu10k1_resume_init(struct snd_emu10k1 *emu); 1861void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
1862void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu); 1862void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
diff --git a/include/sound/emu10k1_synth.h b/include/sound/emu10k1_synth.h
index 6ef61c420935..9f211e957bf9 100644
--- a/include/sound/emu10k1_synth.h
+++ b/include/sound/emu10k1_synth.h
@@ -20,8 +20,8 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include "emu10k1.h" 23#include <sound/emu10k1.h>
24#include "emux_synth.h" 24#include <sound/emux_synth.h>
25 25
26/* sequencer device id */ 26/* sequencer device id */
27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth" 27#define SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH "emu10k1-synth"
diff --git a/include/sound/emu8000.h b/include/sound/emu8000.h
index c8f66bde6d95..c321302a9143 100644
--- a/include/sound/emu8000.h
+++ b/include/sound/emu8000.h
@@ -21,8 +21,8 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include "emux_synth.h" 24#include <sound/emux_synth.h>
25#include "seq_kernel.h" 25#include <sound/seq_kernel.h>
26 26
27/* 27/*
28 * Hardware parameters. 28 * Hardware parameters.
diff --git a/include/sound/emux_legacy.h b/include/sound/emux_legacy.h
index 6fe3da2a5e15..baf43fc24d39 100644
--- a/include/sound/emux_legacy.h
+++ b/include/sound/emux_legacy.h
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include "seq_oss_legacy.h" 25#include <sound/seq_oss_legacy.h>
26 26
27/* 27/*
28 * awe hardware controls 28 * awe hardware controls
diff --git a/include/sound/emux_synth.h b/include/sound/emux_synth.h
index d8cb51b86c20..fb81f3722b6a 100644
--- a/include/sound/emux_synth.h
+++ b/include/sound/emux_synth.h
@@ -21,15 +21,15 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include "seq_kernel.h" 24#include <sound/seq_kernel.h>
25#include "seq_device.h" 25#include <sound/seq_device.h>
26#include "soundfont.h" 26#include <sound/soundfont.h>
27#include "seq_midi_emul.h" 27#include <sound/seq_midi_emul.h>
28#ifdef CONFIG_SND_SEQUENCER_OSS 28#ifdef CONFIG_SND_SEQUENCER_OSS
29#include "seq_oss.h" 29#include <sound/seq_oss.h>
30#endif 30#endif
31#include "emux_legacy.h" 31#include <sound/emux_legacy.h>
32#include "seq_virmidi.h" 32#include <sound/seq_virmidi.h>
33 33
34/* 34/*
35 * compile flags 35 * compile flags
diff --git a/include/sound/es1688.h b/include/sound/es1688.h
index f752dd33dfaf..1d636a2d8896 100644
--- a/include/sound/es1688.h
+++ b/include/sound/es1688.h
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#include "control.h" 25#include <sound/control.h>
26#include "pcm.h" 26#include <sound/pcm.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28 28
29#define ES1688_HW_AUTO 0x0000 29#define ES1688_HW_AUTO 0x0000
diff --git a/include/sound/gus.h b/include/sound/gus.h
index 841bb8df38c1..42905d811da7 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "pcm.h" 25#include <sound/pcm.h>
26#include "rawmidi.h" 26#include <sound/rawmidi.h>
27#include "timer.h" 27#include <sound/timer.h>
28#include "seq_midi_emul.h" 28#include <sound/seq_midi_emul.h>
29#include "seq_device.h" 29#include <sound/seq_device.h>
30#include <asm/io.h> 30#include <asm/io.h>
31 31
32/* IO ports */ 32/* IO ports */
diff --git a/include/sound/initval.h b/include/sound/initval.h
index f99a0d2ddfe7..ac62c67e6f42 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,6 +50,20 @@
50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } 50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR 51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
52 52
53#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
54static long snd_legacy_find_free_ioport(long *port_table, long size)
55{
56 while (*port_table != -1) {
57 if (request_region(*port_table, size, "ALSA test")) {
58 release_region(*port_table, size);
59 return *port_table;
60 }
61 port_table++;
62 }
63 return -1;
64}
65#endif
66
53#ifdef SNDRV_LEGACY_FIND_FREE_IRQ 67#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
54#include <linux/interrupt.h> 68#include <linux/interrupt.h>
55 69
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index c42506212649..844af65af626 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -98,8 +98,10 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
98/* 98/*
99 * return the physical address at the corresponding offset 99 * return the physical address at the corresponding offset
100 */ 100 */
101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
102 size_t offset)
102{ 103{
104 struct snd_sg_buf *sgbuf = dmab->private_data;
103 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 105 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
104 addr &= PAGE_MASK; 106 addr &= PAGE_MASK;
105 return addr + offset % PAGE_SIZE; 107 return addr + offset % PAGE_SIZE;
@@ -108,10 +110,31 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t off
108/* 110/*
109 * return the virtual address at the corresponding offset 111 * return the virtual address at the corresponding offset
110 */ 112 */
111static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) 113static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
114 size_t offset)
112{ 115{
116 struct snd_sg_buf *sgbuf = dmab->private_data;
113 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; 117 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
114} 118}
119
120unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab,
121 unsigned int ofs, unsigned int size);
122#else
123/* non-SG versions */
124static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
125 size_t offset)
126{
127 return dmab->addr + offset;
128}
129
130static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
131 size_t offset)
132{
133 return dmab->area + offset;
134}
135
136#define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size)
137
115#endif /* CONFIG_SND_DMA_SGBUF */ 138#endif /* CONFIG_SND_DMA_SGBUF */
116 139
117/* allocate/release a buffer */ 140/* allocate/release a buffer */
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index 20230db00ef1..e94209692513 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include "rawmidi.h" 25#include <sound/rawmidi.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27 27
28#define MPU401_HW_MPU401 1 /* native MPU401 */ 28#define MPU401_HW_MPU401 1 /* native MPU401 */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c75c0d1a85e2..6268a4192d5c 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -35,7 +35,7 @@
35#define snd_pcm_chip(pcm) ((pcm)->private_data) 35#define snd_pcm_chip(pcm) ((pcm)->private_data)
36 36
37#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 37#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
38#include "pcm_oss.h" 38#include <sound/pcm_oss.h>
39#endif 39#endif
40 40
41/* 41/*
@@ -437,6 +437,7 @@ struct snd_pcm_str {
437 struct snd_info_entry *proc_xrun_debug_entry; 437 struct snd_info_entry *proc_xrun_debug_entry;
438#endif 438#endif
439#endif 439#endif
440 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */
440}; 441};
441 442
442struct snd_pcm { 443struct snd_pcm {
@@ -982,53 +983,42 @@ static int snd_pcm_lib_alloc_vmalloc_32_buffer
982 _snd_pcm_lib_alloc_vmalloc_buffer \ 983 _snd_pcm_lib_alloc_vmalloc_buffer \
983 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) 984 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO)
984 985
986#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
987
985#ifdef CONFIG_SND_DMA_SGBUF 988#ifdef CONFIG_SND_DMA_SGBUF
986/* 989/*
987 * SG-buffer handling 990 * SG-buffer handling
988 */ 991 */
989#define snd_pcm_substream_sgbuf(substream) \ 992#define snd_pcm_substream_sgbuf(substream) \
990 ((substream)->runtime->dma_buffer_p->private_data) 993 snd_pcm_get_dma_buf(substream)->private_data
991
992static inline dma_addr_t
993snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
994{
995 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
996 return snd_sgbuf_get_addr(sg, ofs);
997}
998
999static inline void *
1000snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1001{
1002 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
1003 return snd_sgbuf_get_ptr(sg, ofs);
1004}
1005 994
1006struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, 995struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
1007 unsigned long offset); 996 unsigned long offset);
1008unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1009 unsigned int ofs, unsigned int size);
1010
1011#else /* !SND_DMA_SGBUF */ 997#else /* !SND_DMA_SGBUF */
1012/* 998/*
1013 * fake using a continuous buffer 999 * fake using a continuous buffer
1014 */ 1000 */
1001#define snd_pcm_sgbuf_ops_page NULL
1002#endif /* SND_DMA_SGBUF */
1003
1015static inline dma_addr_t 1004static inline dma_addr_t
1016snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 1005snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
1017{ 1006{
1018 return substream->runtime->dma_addr + ofs; 1007 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs);
1019} 1008}
1020 1009
1021static inline void * 1010static inline void *
1022snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1011snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1023{ 1012{
1024 return substream->runtime->dma_area + ofs; 1013 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs);
1025} 1014}
1026 1015
1027#define snd_pcm_sgbuf_ops_page NULL 1016static inline unsigned int
1028 1017snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1029#define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) 1018 unsigned int ofs, unsigned int size)
1030 1019{
1031#endif /* SND_DMA_SGBUF */ 1020 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
1021}
1032 1022
1033/* handle mmap counter - PCM mmap callback should handle this counter properly */ 1023/* handle mmap counter - PCM mmap callback should handle this counter properly */
1034static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1024static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1075,7 +1065,8 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
1075const char *snd_pcm_format_name(snd_pcm_format_t format); 1065const char *snd_pcm_format_name(snd_pcm_format_t format);
1076 1066
1077/** 1067/**
1078 * Get a string naming the direction of a stream 1068 * snd_pcm_stream_str - Get a string naming the direction of a stream
1069 * @substream: the pcm substream instance
1079 */ 1070 */
1080static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) 1071static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream)
1081{ 1072{
@@ -1085,4 +1076,51 @@ static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream
1085 return "Capture"; 1076 return "Capture";
1086} 1077}
1087 1078
1079/*
1080 * PCM channel-mapping control API
1081 */
1082/* array element of channel maps */
1083struct snd_pcm_chmap_elem {
1084 unsigned char channels;
1085 unsigned char map[15];
1086};
1087
1088/* channel map information; retrieved via snd_kcontrol_chip() */
1089struct snd_pcm_chmap {
1090 struct snd_pcm *pcm; /* assigned PCM instance */
1091 int stream; /* PLAYBACK or CAPTURE */
1092 struct snd_kcontrol *kctl;
1093 const struct snd_pcm_chmap_elem *chmap;
1094 unsigned int max_channels;
1095 unsigned int channel_mask; /* optional: active channels bitmask */
1096 void *private_data; /* optional: private data pointer */
1097};
1098
1099/* get the PCM substream assigned to the given chmap info */
1100static inline struct snd_pcm_substream *
1101snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx)
1102{
1103 struct snd_pcm_substream *s;
1104 for (s = info->pcm->streams[info->stream].substream; s; s = s->next)
1105 if (s->number == idx)
1106 return s;
1107 return NULL;
1108}
1109
1110/* ALSA-standard channel maps (RL/RR prior to C/LFE) */
1111extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[];
1112/* Other world's standard channel maps (C/LFE prior to RL/RR) */
1113extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[];
1114
1115/* bit masks to be passed to snd_pcm_chmap.channel_mask field */
1116#define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4))
1117#define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6))
1118#define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8))
1119
1120int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
1121 const struct snd_pcm_chmap_elem *chmap,
1122 int max_channels,
1123 unsigned long private_value,
1124 struct snd_pcm_chmap **info_ret);
1125
1088#endif /* __SOUND_PCM_H */ 1126#endif /* __SOUND_PCM_H */
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index 6b14359d9fed..adf0885153f3 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -30,7 +30,7 @@
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31 31
32#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) 32#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
33#include "seq_device.h" 33#include <sound/seq_device.h>
34#endif 34#endif
35 35
36/* 36/*
diff --git a/include/sound/sb.h b/include/sound/sb.h
index 95353542256a..ba3960329646 100644
--- a/include/sound/sb.h
+++ b/include/sound/sb.h
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#include "pcm.h" 25#include <sound/pcm.h>
26#include "rawmidi.h" 26#include <sound/rawmidi.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h
index af1b49e982df..7e950560e591 100644
--- a/include/sound/sb16_csp.h
+++ b/include/sound/sb16_csp.h
@@ -119,8 +119,8 @@ struct snd_sb_csp_info {
119#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) 119#define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16)
120 120
121#ifdef __KERNEL__ 121#ifdef __KERNEL__
122#include "sb.h" 122#include <sound/sb.h>
123#include "hwdep.h" 123#include <sound/hwdep.h>
124#include <linux/firmware.h> 124#include <linux/firmware.h>
125 125
126struct snd_sb_csp; 126struct snd_sb_csp;
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h
index f352a98ce4f4..2398521f0998 100644
--- a/include/sound/seq_kernel.h
+++ b/include/sound/seq_kernel.h
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24#include <linux/time.h> 24#include <linux/time.h>
25#include "asequencer.h" 25#include <sound/asequencer.h>
26 26
27typedef struct snd_seq_real_time snd_seq_real_time_t; 27typedef struct snd_seq_real_time snd_seq_real_time_t;
28typedef union snd_seq_timestamp snd_seq_timestamp_t; 28typedef union snd_seq_timestamp snd_seq_timestamp_t;
diff --git a/include/sound/seq_midi_emul.h b/include/sound/seq_midi_emul.h
index d6c4615901b9..8139d8c191ed 100644
--- a/include/sound/seq_midi_emul.h
+++ b/include/sound/seq_midi_emul.h
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include "seq_kernel.h" 25#include <sound/seq_kernel.h>
26 26
27/* 27/*
28 * This structure is used to keep track of the current state on each 28 * This structure is used to keep track of the current state on each
diff --git a/include/sound/seq_midi_event.h b/include/sound/seq_midi_event.h
index 5efab8b29c57..e40f43e6fc7b 100644
--- a/include/sound/seq_midi_event.h
+++ b/include/sound/seq_midi_event.h
@@ -22,7 +22,7 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include "asequencer.h" 25#include <sound/asequencer.h>
26 26
27#define MAX_MIDI_EVENT_BUF 256 27#define MAX_MIDI_EVENT_BUF 256
28 28
diff --git a/include/sound/seq_oss.h b/include/sound/seq_oss.h
index 9b060bbd6e02..d0b27ec6f8b8 100644
--- a/include/sound/seq_oss.h
+++ b/include/sound/seq_oss.h
@@ -21,8 +21,8 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23 23
24#include "asequencer.h" 24#include <sound/asequencer.h>
25#include "seq_kernel.h" 25#include <sound/seq_kernel.h>
26 26
27/* 27/*
28 * argument structure for synthesizer operations 28 * argument structure for synthesizer operations
diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
index d888433a3096..a03acd0d398a 100644
--- a/include/sound/seq_virmidi.h
+++ b/include/sound/seq_virmidi.h
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#include "rawmidi.h" 25#include <sound/rawmidi.h>
26#include "seq_midi_event.h" 26#include <sound/seq_midi_event.h>
27 27
28/* 28/*
29 * device file instance: 29 * device file instance:
diff --git a/include/sound/snd_wavefront.h b/include/sound/snd_wavefront.h
index fa149ca77e4b..35e94b3d1ec7 100644
--- a/include/sound/snd_wavefront.h
+++ b/include/sound/snd_wavefront.h
@@ -1,10 +1,10 @@
1#ifndef __SOUND_SND_WAVEFRONT_H__ 1#ifndef __SOUND_SND_WAVEFRONT_H__
2#define __SOUND_SND_WAVEFRONT_H__ 2#define __SOUND_SND_WAVEFRONT_H__
3 3
4#include "mpu401.h" 4#include <sound/mpu401.h>
5#include "hwdep.h" 5#include <sound/hwdep.h>
6#include "rawmidi.h" 6#include <sound/rawmidi.h>
7#include "wavefront.h" /* generic OSS/ALSA/user-level wavefront header */ 7#include <sound/wavefront.h> /* generic OSS/ALSA/user-level wavefront header */
8 8
9/* MIDI interface */ 9/* MIDI interface */
10 10
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 1f69e0af2941..628db7bca4fd 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -18,6 +18,7 @@
18 18
19struct snd_pcm_substream; 19struct snd_pcm_substream;
20struct snd_soc_dapm_widget; 20struct snd_soc_dapm_widget;
21struct snd_compr_stream;
21 22
22/* 23/*
23 * DAI hardware audio formats. 24 * DAI hardware audio formats.
@@ -205,6 +206,8 @@ struct snd_soc_dai_driver {
205 int (*remove)(struct snd_soc_dai *dai); 206 int (*remove)(struct snd_soc_dai *dai);
206 int (*suspend)(struct snd_soc_dai *dai); 207 int (*suspend)(struct snd_soc_dai *dai);
207 int (*resume)(struct snd_soc_dai *dai); 208 int (*resume)(struct snd_soc_dai *dai);
209 /* compress dai */
210 bool compress_dai;
208 211
209 /* ops */ 212 /* ops */
210 const struct snd_soc_dai_ops *ops; 213 const struct snd_soc_dai_ops *ops;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index abe373d57adc..e1ef63d4a5c4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -244,10 +244,11 @@ struct device;
244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
245 .shift = wshift, .invert = winvert, .event = wevent, \ 245 .shift = wshift, .invert = winvert, .event = wevent, \
246 .event_flags = wflags} 246 .event_flags = wflags}
247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay) \ 247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags) \
248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \ 248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \
249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ 249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } 250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \
251 .invert = wflags}
251 252
252 253
253/* dapm kcontrol types */ 254/* dapm kcontrol types */
@@ -319,6 +320,9 @@ struct device;
319#define SND_SOC_DAPM_EVENT_OFF(e) \ 320#define SND_SOC_DAPM_EVENT_OFF(e) \
320 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)) 321 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
321 322
323/* regulator widget flags */
324#define SND_SOC_DAPM_REGULATOR_BYPASS 0x1 /* bypass when disabled */
325
322struct snd_soc_dapm_widget; 326struct snd_soc_dapm_widget;
323enum snd_soc_dapm_type; 327enum snd_soc_dapm_type;
324struct snd_soc_dapm_path; 328struct snd_soc_dapm_path;
@@ -412,6 +416,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
412 416
413/* Mostly internal - should not normally be used */ 417/* Mostly internal - should not normally be used */
414void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 418void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
419void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
415 420
416/* dapm path query */ 421/* dapm path query */
417int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 422int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
@@ -510,7 +515,6 @@ struct snd_soc_dapm_widget {
510 /* dapm control */ 515 /* dapm control */
511 int reg; /* negative reg = no direct dapm */ 516 int reg; /* negative reg = no direct dapm */
512 unsigned char shift; /* bits to shift */ 517 unsigned char shift; /* bits to shift */
513 unsigned int saved_value; /* widget saved value */
514 unsigned int value; /* widget current value */ 518 unsigned int value; /* widget current value */
515 unsigned int mask; /* non-shifted mask */ 519 unsigned int mask; /* non-shifted mask */
516 unsigned int on_val; /* on state value */ 520 unsigned int on_val; /* on state value */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e063380f63a2..91244a096c19 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -20,8 +20,10 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/regmap.h> 22#include <linux/regmap.h>
23#include <linux/log2.h>
23#include <sound/core.h> 24#include <sound/core.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
26#include <sound/compress_driver.h>
25#include <sound/control.h> 27#include <sound/control.h>
26#include <sound/ac97_codec.h> 28#include <sound/ac97_codec.h>
27 29
@@ -159,7 +161,8 @@
159 .platform_max = xmax} } 161 .platform_max = xmax} }
160#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 162#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
161{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 163{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
162 .max = xmax, .texts = xtexts } 164 .max = xmax, .texts = xtexts, \
165 .mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0}
163#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ 166#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
164 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 167 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
165#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 168#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
@@ -399,6 +402,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
399int snd_soc_platform_write(struct snd_soc_platform *platform, 402int snd_soc_platform_write(struct snd_soc_platform *platform,
400 unsigned int reg, unsigned int val); 403 unsigned int reg, unsigned int val);
401int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 404int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
405int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
402 406
403struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, 407struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
404 const char *dai_link, int stream); 408 const char *dai_link, int stream);
@@ -632,6 +636,13 @@ struct snd_soc_ops {
632 int (*trigger)(struct snd_pcm_substream *, int); 636 int (*trigger)(struct snd_pcm_substream *, int);
633}; 637};
634 638
639struct snd_soc_compr_ops {
640 int (*startup)(struct snd_compr_stream *);
641 void (*shutdown)(struct snd_compr_stream *);
642 int (*set_params)(struct snd_compr_stream *);
643 int (*trigger)(struct snd_compr_stream *);
644};
645
635/* SoC cache ops */ 646/* SoC cache ops */
636struct snd_soc_cache_ops { 647struct snd_soc_cache_ops {
637 const char *name; 648 const char *name;
@@ -787,9 +798,12 @@ struct snd_soc_platform_driver {
787 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, 798 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
788 struct snd_soc_dai *); 799 struct snd_soc_dai *);
789 800
790 /* platform stream ops */ 801 /* platform stream pcm ops */
791 struct snd_pcm_ops *ops; 802 struct snd_pcm_ops *ops;
792 803
804 /* platform stream compress ops */
805 struct snd_compr_ops *compr_ops;
806
793 /* platform stream completion event */ 807 /* platform stream completion event */
794 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 808 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
795 809
@@ -891,6 +905,7 @@ struct snd_soc_dai_link {
891 905
892 /* machine stream operations */ 906 /* machine stream operations */
893 struct snd_soc_ops *ops; 907 struct snd_soc_ops *ops;
908 struct snd_soc_compr_ops *compr_ops;
894}; 909};
895 910
896struct snd_soc_codec_conf { 911struct snd_soc_codec_conf {
@@ -1027,6 +1042,7 @@ struct snd_soc_pcm_runtime {
1027 1042
1028 /* runtime devices */ 1043 /* runtime devices */
1029 struct snd_pcm *pcm; 1044 struct snd_pcm *pcm;
1045 struct snd_compr *compr;
1030 struct snd_soc_codec *codec; 1046 struct snd_soc_codec *codec;
1031 struct snd_soc_platform *platform; 1047 struct snd_soc_platform *platform;
1032 struct snd_soc_dai *codec_dai; 1048 struct snd_soc_dai *codec_dai;
diff --git a/include/sound/soundfont.h b/include/sound/soundfont.h
index 679df0574066..7c93efdba90d 100644
--- a/include/sound/soundfont.h
+++ b/include/sound/soundfont.h
@@ -22,8 +22,8 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include "sfnt_info.h" 25#include <sound/sfnt_info.h>
26#include "util_mem.h" 26#include <sound/util_mem.h>
27 27
28#define SF_MAX_INSTRUMENTS 128 /* maximum instrument number */ 28#define SF_MAX_INSTRUMENTS 128 /* maximum instrument number */
29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */ 29#define SF_MAX_PRESETS 256 /* drums are mapped from 128 to 256 */
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index fe8590cac5c2..098c4de44945 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -28,6 +28,7 @@
28#include <media/v4l2-device.h> 28#include <media/v4l2-device.h>
29 29
30#define TEA575X_FMIF 10700 30#define TEA575X_FMIF 10700
31#define TEA575X_AMIF 450
31 32
32#define TEA575X_DATA (1 << 0) 33#define TEA575X_DATA (1 << 0)
33#define TEA575X_CLK (1 << 1) 34#define TEA575X_CLK (1 << 1)
@@ -52,12 +53,14 @@ struct snd_tea575x {
52 struct video_device vd; /* video device */ 53 struct video_device vd; /* video device */
53 int radio_nr; /* radio_nr */ 54 int radio_nr; /* radio_nr */
54 bool tea5759; /* 5759 chip is present */ 55 bool tea5759; /* 5759 chip is present */
56 bool has_am; /* Device can tune to AM freqs */
55 bool cannot_read_data; /* Device cannot read the data pin */ 57 bool cannot_read_data; /* Device cannot read the data pin */
56 bool cannot_mute; /* Device cannot mute */ 58 bool cannot_mute; /* Device cannot mute */
57 bool mute; /* Device is muted? */ 59 bool mute; /* Device is muted? */
58 bool stereo; /* receiving stereo */ 60 bool stereo; /* receiving stereo */
59 bool tuned; /* tuned to a station */ 61 bool tuned; /* tuned to a station */
60 unsigned int val; /* hw value */ 62 unsigned int val; /* hw value */
63 u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
61 u32 freq; /* frequency */ 64 u32 freq; /* frequency */
62 struct mutex mutex; 65 struct mutex mutex;
63 struct snd_tea575x_ops *ops; 66 struct snd_tea575x_ops *ops;
@@ -70,5 +73,6 @@ struct snd_tea575x {
70 73
71int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner); 74int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
72void snd_tea575x_exit(struct snd_tea575x *tea); 75void snd_tea575x_exit(struct snd_tea575x *tea);
76void snd_tea575x_set_freq(struct snd_tea575x *tea);
73 77
74#endif /* __SOUND_TEA575X_TUNER_H */ 78#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h
index 51b282b76896..e6beec23d7f2 100644
--- a/include/sound/tea6330t.h
+++ b/include/sound/tea6330t.h
@@ -22,7 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include "i2c.h" /* generic i2c support */ 25#include <sound/i2c.h> /* generic i2c support */
26 26
27int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer); 27int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
28int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus, 28int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
diff --git a/include/sound/tegra_wm8903.h b/include/sound/tegra_wm8903.h
new file mode 100644
index 000000000000..57b202ee97c3
--- /dev/null
+++ b/include/sound/tegra_wm8903.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright 2011 NVIDIA, 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 __SOUND_TEGRA_WM38903_H
16#define __SOUND_TEGRA_WM38903_H
17
18struct tegra_wm8903_platform_data {
19 int gpio_spkr_en;
20 int gpio_hp_det;
21 int gpio_hp_mute;
22 int gpio_int_mic_en;
23 int gpio_ext_mic_en;
24};
25
26#endif
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index a64d8fe3f855..28c65e1ada21 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -86,4 +86,12 @@
86 86
87#define TLV_DB_GAIN_MUTE -9999999 87#define TLV_DB_GAIN_MUTE -9999999
88 88
89/*
90 * channel-mapping TLV items
91 * TLV length must match with num_channels
92 */
93#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
94#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
95#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
96
89#endif /* __SOUND_TLV_H */ 97#endif /* __SOUND_TLV_H */
diff --git a/include/sound/version.h b/include/sound/version.h
deleted file mode 100644
index cc75024c1089..000000000000
--- a/include/sound/version.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.25"
3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm0010.h b/include/sound/wm0010.h
new file mode 100644
index 000000000000..3261e90815af
--- /dev/null
+++ b/include/sound/wm0010.h
@@ -0,0 +1,27 @@
1/*
2 * wm0010.h -- Platform data for WM0010 DSP Driver
3 *
4 * Copyright 2012 Wolfson Microelectronics PLC.
5 *
6 * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.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 as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef WM0010_PDATA_H
15#define WM0010_PDATA_H
16
17struct wm0010_pdata {
18 int gpio_reset;
19
20 /* Set if there is an inverter between the GPIO controlling
21 * the reset signal and the device.
22 */
23 int reset_active_high;
24 int irq_flags;
25};
26
27#endif
diff --git a/include/sound/wm8960.h b/include/sound/wm8960.h
index 74e9a95529c5..e8ce8ee7d62d 100644
--- a/include/sound/wm8960.h
+++ b/include/sound/wm8960.h
@@ -18,7 +18,7 @@
18struct wm8960_data { 18struct wm8960_data {
19 bool capless; /* Headphone outputs configured in capless mode */ 19 bool capless; /* Headphone outputs configured in capless mode */
20 20
21 int dres; /* Discharge resistance for headphone outputs */ 21 bool shared_lrclk; /* DAC and ADC LRCLKs are wired together */
22}; 22};
23 23
24#endif 24#endif
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h
index eee19f63c0d8..8016fd826f5a 100644
--- a/include/sound/wm8993.h
+++ b/include/sound/wm8993.h
@@ -32,6 +32,10 @@ struct wm8993_platform_data {
32 unsigned int lineout1fb:1; 32 unsigned int lineout1fb:1;
33 unsigned int lineout2fb:1; 33 unsigned int lineout2fb:1;
34 34
35 /* Delay to add for microphones to stabalise after power up */
36 int micbias1_delay;
37 int micbias2_delay;
38
35 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ 39 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
36 unsigned int micbias1_lvl:1; 40 unsigned int micbias1_lvl:1;
37 unsigned int micbias2_lvl:1; 41 unsigned int micbias2_lvl:1;
diff --git a/include/sound/wss.h b/include/sound/wss.h
index fd01f22825cd..0c7f034f1e86 100644
--- a/include/sound/wss.h
+++ b/include/sound/wss.h
@@ -22,11 +22,11 @@
22 * 22 *
23 */ 23 */
24 24
25#include "control.h" 25#include <sound/control.h>
26#include "pcm.h" 26#include <sound/pcm.h>
27#include "timer.h" 27#include <sound/timer.h>
28 28
29#include "cs4231-regs.h" 29#include <sound/cs4231-regs.h>
30 30
31/* defines for codec.mode */ 31/* defines for codec.mode */
32 32
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index f1405d335a96..941c84bf1065 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -23,7 +23,9 @@ struct se_subsystem_api {
23 struct se_device *(*create_virtdevice)(struct se_hba *, 23 struct se_device *(*create_virtdevice)(struct se_hba *,
24 struct se_subsystem_dev *, void *); 24 struct se_subsystem_dev *, void *);
25 void (*free_device)(void *); 25 void (*free_device)(void *);
26 int (*transport_complete)(struct se_cmd *cmd, struct scatterlist *); 26 void (*transport_complete)(struct se_cmd *cmd,
27 struct scatterlist *,
28 unsigned char *);
27 29
28 int (*parse_cdb)(struct se_cmd *cmd); 30 int (*parse_cdb)(struct se_cmd *cmd);
29 ssize_t (*check_configfs_dev_params)(struct se_hba *, 31 ssize_t (*check_configfs_dev_params)(struct se_hba *,
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 128ce46fa48a..5be89373ceac 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -121,6 +121,7 @@
121 121
122#define SE_INQUIRY_BUF 512 122#define SE_INQUIRY_BUF 512
123#define SE_MODE_PAGE_BUF 512 123#define SE_MODE_PAGE_BUF 512
124#define SE_SENSE_BUF 96
124 125
125/* struct se_hba->hba_flags */ 126/* struct se_hba->hba_flags */
126enum hba_flags_table { 127enum hba_flags_table {
@@ -503,8 +504,6 @@ struct se_cmd {
503 u32 se_ordered_id; 504 u32 se_ordered_id;
504 /* Total size in bytes associated with command */ 505 /* Total size in bytes associated with command */
505 u32 data_length; 506 u32 data_length;
506 /* SCSI Presented Data Transfer Length */
507 u32 cmd_spdtl;
508 u32 residual_count; 507 u32 residual_count;
509 u32 orig_fe_lun; 508 u32 orig_fe_lun;
510 /* Persistent Reservation key */ 509 /* Persistent Reservation key */
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index b0b4eb24d592..1905ca8dd399 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Trace files that want to automate creationg of all tracepoints defined 2 * Trace files that want to automate creation of all tracepoints defined
3 * in their file should include this file. The following are macros that the 3 * in their file should include this file. The following are macros that the
4 * trace file may define: 4 * trace file may define:
5 * 5 *
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h
index 388bcdd26d46..fde1b3e94c7d 100644
--- a/include/trace/events/compaction.h
+++ b/include/trace/events/compaction.h
@@ -6,7 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include "gfpflags.h" 9#include <trace/events/gfpflags.h>
10 10
11DECLARE_EVENT_CLASS(mm_compaction_isolate_template, 11DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
12 12
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 69d8a69ea831..d49b285385e8 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -26,19 +26,19 @@ TRACE_EVENT(ext4_free_inode,
26 TP_STRUCT__entry( 26 TP_STRUCT__entry(
27 __field( dev_t, dev ) 27 __field( dev_t, dev )
28 __field( ino_t, ino ) 28 __field( ino_t, ino )
29 __field( __u16, mode )
30 __field( uid_t, uid ) 29 __field( uid_t, uid )
31 __field( gid_t, gid ) 30 __field( gid_t, gid )
32 __field( __u64, blocks ) 31 __field( __u64, blocks )
32 __field( __u16, mode )
33 ), 33 ),
34 34
35 TP_fast_assign( 35 TP_fast_assign(
36 __entry->dev = inode->i_sb->s_dev; 36 __entry->dev = inode->i_sb->s_dev;
37 __entry->ino = inode->i_ino; 37 __entry->ino = inode->i_ino;
38 __entry->mode = inode->i_mode;
39 __entry->uid = i_uid_read(inode); 38 __entry->uid = i_uid_read(inode);
40 __entry->gid = i_gid_read(inode); 39 __entry->gid = i_gid_read(inode);
41 __entry->blocks = inode->i_blocks; 40 __entry->blocks = inode->i_blocks;
41 __entry->mode = inode->i_mode;
42 ), 42 ),
43 43
44 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", 44 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
@@ -300,10 +300,10 @@ TRACE_EVENT(ext4_da_writepages,
300 __field( long, pages_skipped ) 300 __field( long, pages_skipped )
301 __field( loff_t, range_start ) 301 __field( loff_t, range_start )
302 __field( loff_t, range_end ) 302 __field( loff_t, range_end )
303 __field( pgoff_t, writeback_index )
303 __field( int, sync_mode ) 304 __field( int, sync_mode )
304 __field( char, for_kupdate ) 305 __field( char, for_kupdate )
305 __field( char, range_cyclic ) 306 __field( char, range_cyclic )
306 __field( pgoff_t, writeback_index )
307 ), 307 ),
308 308
309 TP_fast_assign( 309 TP_fast_assign(
@@ -313,14 +313,14 @@ TRACE_EVENT(ext4_da_writepages,
313 __entry->pages_skipped = wbc->pages_skipped; 313 __entry->pages_skipped = wbc->pages_skipped;
314 __entry->range_start = wbc->range_start; 314 __entry->range_start = wbc->range_start;
315 __entry->range_end = wbc->range_end; 315 __entry->range_end = wbc->range_end;
316 __entry->writeback_index = inode->i_mapping->writeback_index;
316 __entry->sync_mode = wbc->sync_mode; 317 __entry->sync_mode = wbc->sync_mode;
317 __entry->for_kupdate = wbc->for_kupdate; 318 __entry->for_kupdate = wbc->for_kupdate;
318 __entry->range_cyclic = wbc->range_cyclic; 319 __entry->range_cyclic = wbc->range_cyclic;
319 __entry->writeback_index = inode->i_mapping->writeback_index;
320 ), 320 ),
321 321
322 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " 322 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
323 "range_start %lld range_end %lld sync_mode %d" 323 "range_start %lld range_end %lld sync_mode %d "
324 "for_kupdate %d range_cyclic %d writeback_index %lu", 324 "for_kupdate %d range_cyclic %d writeback_index %lu",
325 MAJOR(__entry->dev), MINOR(__entry->dev), 325 MAJOR(__entry->dev), MINOR(__entry->dev),
326 (unsigned long) __entry->ino, __entry->nr_to_write, 326 (unsigned long) __entry->ino, __entry->nr_to_write,
@@ -382,8 +382,8 @@ TRACE_EVENT(ext4_da_writepages_result,
382 __field( int, ret ) 382 __field( int, ret )
383 __field( int, pages_written ) 383 __field( int, pages_written )
384 __field( long, pages_skipped ) 384 __field( long, pages_skipped )
385 __field( int, sync_mode )
386 __field( pgoff_t, writeback_index ) 385 __field( pgoff_t, writeback_index )
386 __field( int, sync_mode )
387 ), 387 ),
388 388
389 TP_fast_assign( 389 TP_fast_assign(
@@ -392,8 +392,8 @@ TRACE_EVENT(ext4_da_writepages_result,
392 __entry->ret = ret; 392 __entry->ret = ret;
393 __entry->pages_written = pages_written; 393 __entry->pages_written = pages_written;
394 __entry->pages_skipped = wbc->pages_skipped; 394 __entry->pages_skipped = wbc->pages_skipped;
395 __entry->sync_mode = wbc->sync_mode;
396 __entry->writeback_index = inode->i_mapping->writeback_index; 395 __entry->writeback_index = inode->i_mapping->writeback_index;
396 __entry->sync_mode = wbc->sync_mode;
397 ), 397 ),
398 398
399 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " 399 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
@@ -411,16 +411,16 @@ DECLARE_EVENT_CLASS(ext4__page_op,
411 TP_ARGS(page), 411 TP_ARGS(page),
412 412
413 TP_STRUCT__entry( 413 TP_STRUCT__entry(
414 __field( pgoff_t, index )
415 __field( ino_t, ino )
416 __field( dev_t, dev ) 414 __field( dev_t, dev )
415 __field( ino_t, ino )
416 __field( pgoff_t, index )
417 417
418 ), 418 ),
419 419
420 TP_fast_assign( 420 TP_fast_assign(
421 __entry->index = page->index;
422 __entry->ino = page->mapping->host->i_ino;
423 __entry->dev = page->mapping->host->i_sb->s_dev; 421 __entry->dev = page->mapping->host->i_sb->s_dev;
422 __entry->ino = page->mapping->host->i_ino;
423 __entry->index = page->index;
424 ), 424 ),
425 425
426 TP_printk("dev %d,%d ino %lu page_index %lu", 426 TP_printk("dev %d,%d ino %lu page_index %lu",
@@ -456,18 +456,18 @@ TRACE_EVENT(ext4_invalidatepage,
456 TP_ARGS(page, offset), 456 TP_ARGS(page, offset),
457 457
458 TP_STRUCT__entry( 458 TP_STRUCT__entry(
459 __field( dev_t, dev )
460 __field( ino_t, ino )
459 __field( pgoff_t, index ) 461 __field( pgoff_t, index )
460 __field( unsigned long, offset ) 462 __field( unsigned long, offset )
461 __field( ino_t, ino )
462 __field( dev_t, dev )
463 463
464 ), 464 ),
465 465
466 TP_fast_assign( 466 TP_fast_assign(
467 __entry->dev = page->mapping->host->i_sb->s_dev;
468 __entry->ino = page->mapping->host->i_ino;
467 __entry->index = page->index; 469 __entry->index = page->index;
468 __entry->offset = offset; 470 __entry->offset = offset;
469 __entry->ino = page->mapping->host->i_ino;
470 __entry->dev = page->mapping->host->i_sb->s_dev;
471 ), 471 ),
472 472
473 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", 473 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
@@ -510,8 +510,8 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
510 __field( dev_t, dev ) 510 __field( dev_t, dev )
511 __field( ino_t, ino ) 511 __field( ino_t, ino )
512 __field( __u64, pa_pstart ) 512 __field( __u64, pa_pstart )
513 __field( __u32, pa_len )
514 __field( __u64, pa_lstart ) 513 __field( __u64, pa_lstart )
514 __field( __u32, pa_len )
515 515
516 ), 516 ),
517 517
@@ -519,8 +519,8 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
519 __entry->dev = ac->ac_sb->s_dev; 519 __entry->dev = ac->ac_sb->s_dev;
520 __entry->ino = ac->ac_inode->i_ino; 520 __entry->ino = ac->ac_inode->i_ino;
521 __entry->pa_pstart = pa->pa_pstart; 521 __entry->pa_pstart = pa->pa_pstart;
522 __entry->pa_len = pa->pa_len;
523 __entry->pa_lstart = pa->pa_lstart; 522 __entry->pa_lstart = pa->pa_lstart;
523 __entry->pa_len = pa->pa_len;
524 ), 524 ),
525 525
526 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu", 526 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
@@ -645,7 +645,6 @@ TRACE_EVENT(ext4_request_blocks,
645 TP_STRUCT__entry( 645 TP_STRUCT__entry(
646 __field( dev_t, dev ) 646 __field( dev_t, dev )
647 __field( ino_t, ino ) 647 __field( ino_t, ino )
648 __field( unsigned int, flags )
649 __field( unsigned int, len ) 648 __field( unsigned int, len )
650 __field( __u32, logical ) 649 __field( __u32, logical )
651 __field( __u32, lleft ) 650 __field( __u32, lleft )
@@ -653,12 +652,12 @@ TRACE_EVENT(ext4_request_blocks,
653 __field( __u64, goal ) 652 __field( __u64, goal )
654 __field( __u64, pleft ) 653 __field( __u64, pleft )
655 __field( __u64, pright ) 654 __field( __u64, pright )
655 __field( unsigned int, flags )
656 ), 656 ),
657 657
658 TP_fast_assign( 658 TP_fast_assign(
659 __entry->dev = ar->inode->i_sb->s_dev; 659 __entry->dev = ar->inode->i_sb->s_dev;
660 __entry->ino = ar->inode->i_ino; 660 __entry->ino = ar->inode->i_ino;
661 __entry->flags = ar->flags;
662 __entry->len = ar->len; 661 __entry->len = ar->len;
663 __entry->logical = ar->logical; 662 __entry->logical = ar->logical;
664 __entry->goal = ar->goal; 663 __entry->goal = ar->goal;
@@ -666,6 +665,7 @@ TRACE_EVENT(ext4_request_blocks,
666 __entry->lright = ar->lright; 665 __entry->lright = ar->lright;
667 __entry->pleft = ar->pleft; 666 __entry->pleft = ar->pleft;
668 __entry->pright = ar->pright; 667 __entry->pright = ar->pright;
668 __entry->flags = ar->flags;
669 ), 669 ),
670 670
671 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu " 671 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu "
@@ -686,7 +686,6 @@ TRACE_EVENT(ext4_allocate_blocks,
686 __field( dev_t, dev ) 686 __field( dev_t, dev )
687 __field( ino_t, ino ) 687 __field( ino_t, ino )
688 __field( __u64, block ) 688 __field( __u64, block )
689 __field( unsigned int, flags )
690 __field( unsigned int, len ) 689 __field( unsigned int, len )
691 __field( __u32, logical ) 690 __field( __u32, logical )
692 __field( __u32, lleft ) 691 __field( __u32, lleft )
@@ -694,13 +693,13 @@ TRACE_EVENT(ext4_allocate_blocks,
694 __field( __u64, goal ) 693 __field( __u64, goal )
695 __field( __u64, pleft ) 694 __field( __u64, pleft )
696 __field( __u64, pright ) 695 __field( __u64, pright )
696 __field( unsigned int, flags )
697 ), 697 ),
698 698
699 TP_fast_assign( 699 TP_fast_assign(
700 __entry->dev = ar->inode->i_sb->s_dev; 700 __entry->dev = ar->inode->i_sb->s_dev;
701 __entry->ino = ar->inode->i_ino; 701 __entry->ino = ar->inode->i_ino;
702 __entry->block = block; 702 __entry->block = block;
703 __entry->flags = ar->flags;
704 __entry->len = ar->len; 703 __entry->len = ar->len;
705 __entry->logical = ar->logical; 704 __entry->logical = ar->logical;
706 __entry->goal = ar->goal; 705 __entry->goal = ar->goal;
@@ -708,6 +707,7 @@ TRACE_EVENT(ext4_allocate_blocks,
708 __entry->lright = ar->lright; 707 __entry->lright = ar->lright;
709 __entry->pleft = ar->pleft; 708 __entry->pleft = ar->pleft;
710 __entry->pright = ar->pright; 709 __entry->pright = ar->pright;
710 __entry->flags = ar->flags;
711 ), 711 ),
712 712
713 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u " 713 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u "
@@ -728,19 +728,19 @@ TRACE_EVENT(ext4_free_blocks,
728 TP_STRUCT__entry( 728 TP_STRUCT__entry(
729 __field( dev_t, dev ) 729 __field( dev_t, dev )
730 __field( ino_t, ino ) 730 __field( ino_t, ino )
731 __field( __u16, mode )
732 __field( __u64, block ) 731 __field( __u64, block )
733 __field( unsigned long, count ) 732 __field( unsigned long, count )
734 __field( int, flags ) 733 __field( int, flags )
734 __field( __u16, mode )
735 ), 735 ),
736 736
737 TP_fast_assign( 737 TP_fast_assign(
738 __entry->dev = inode->i_sb->s_dev; 738 __entry->dev = inode->i_sb->s_dev;
739 __entry->ino = inode->i_ino; 739 __entry->ino = inode->i_ino;
740 __entry->mode = inode->i_mode;
741 __entry->block = block; 740 __entry->block = block;
742 __entry->count = count; 741 __entry->count = count;
743 __entry->flags = flags; 742 __entry->flags = flags;
743 __entry->mode = inode->i_mode;
744 ), 744 ),
745 745
746 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", 746 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
@@ -783,15 +783,15 @@ TRACE_EVENT(ext4_sync_file_exit,
783 TP_ARGS(inode, ret), 783 TP_ARGS(inode, ret),
784 784
785 TP_STRUCT__entry( 785 TP_STRUCT__entry(
786 __field( int, ret )
787 __field( ino_t, ino )
788 __field( dev_t, dev ) 786 __field( dev_t, dev )
787 __field( ino_t, ino )
788 __field( int, ret )
789 ), 789 ),
790 790
791 TP_fast_assign( 791 TP_fast_assign(
792 __entry->ret = ret;
793 __entry->ino = inode->i_ino;
794 __entry->dev = inode->i_sb->s_dev; 792 __entry->dev = inode->i_sb->s_dev;
793 __entry->ino = inode->i_ino;
794 __entry->ret = ret;
795 ), 795 ),
796 796
797 TP_printk("dev %d,%d ino %lu ret %d", 797 TP_printk("dev %d,%d ino %lu ret %d",
@@ -854,12 +854,6 @@ TRACE_EVENT(ext4_mballoc_alloc,
854 TP_STRUCT__entry( 854 TP_STRUCT__entry(
855 __field( dev_t, dev ) 855 __field( dev_t, dev )
856 __field( ino_t, ino ) 856 __field( ino_t, ino )
857 __field( __u16, found )
858 __field( __u16, groups )
859 __field( __u16, buddy )
860 __field( __u16, flags )
861 __field( __u16, tail )
862 __field( __u8, cr )
863 __field( __u32, orig_logical ) 857 __field( __u32, orig_logical )
864 __field( int, orig_start ) 858 __field( int, orig_start )
865 __field( __u32, orig_group ) 859 __field( __u32, orig_group )
@@ -872,17 +866,17 @@ TRACE_EVENT(ext4_mballoc_alloc,
872 __field( int, result_start ) 866 __field( int, result_start )
873 __field( __u32, result_group ) 867 __field( __u32, result_group )
874 __field( int, result_len ) 868 __field( int, result_len )
869 __field( __u16, found )
870 __field( __u16, groups )
871 __field( __u16, buddy )
872 __field( __u16, flags )
873 __field( __u16, tail )
874 __field( __u8, cr )
875 ), 875 ),
876 876
877 TP_fast_assign( 877 TP_fast_assign(
878 __entry->dev = ac->ac_inode->i_sb->s_dev; 878 __entry->dev = ac->ac_inode->i_sb->s_dev;
879 __entry->ino = ac->ac_inode->i_ino; 879 __entry->ino = ac->ac_inode->i_ino;
880 __entry->found = ac->ac_found;
881 __entry->flags = ac->ac_flags;
882 __entry->groups = ac->ac_groups_scanned;
883 __entry->buddy = ac->ac_buddy;
884 __entry->tail = ac->ac_tail;
885 __entry->cr = ac->ac_criteria;
886 __entry->orig_logical = ac->ac_o_ex.fe_logical; 880 __entry->orig_logical = ac->ac_o_ex.fe_logical;
887 __entry->orig_start = ac->ac_o_ex.fe_start; 881 __entry->orig_start = ac->ac_o_ex.fe_start;
888 __entry->orig_group = ac->ac_o_ex.fe_group; 882 __entry->orig_group = ac->ac_o_ex.fe_group;
@@ -895,6 +889,12 @@ TRACE_EVENT(ext4_mballoc_alloc,
895 __entry->result_start = ac->ac_f_ex.fe_start; 889 __entry->result_start = ac->ac_f_ex.fe_start;
896 __entry->result_group = ac->ac_f_ex.fe_group; 890 __entry->result_group = ac->ac_f_ex.fe_group;
897 __entry->result_len = ac->ac_f_ex.fe_len; 891 __entry->result_len = ac->ac_f_ex.fe_len;
892 __entry->found = ac->ac_found;
893 __entry->flags = ac->ac_flags;
894 __entry->groups = ac->ac_groups_scanned;
895 __entry->buddy = ac->ac_buddy;
896 __entry->tail = ac->ac_tail;
897 __entry->cr = ac->ac_criteria;
898 ), 898 ),
899 899
900 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " 900 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
@@ -1015,17 +1015,17 @@ TRACE_EVENT(ext4_forget,
1015 TP_STRUCT__entry( 1015 TP_STRUCT__entry(
1016 __field( dev_t, dev ) 1016 __field( dev_t, dev )
1017 __field( ino_t, ino ) 1017 __field( ino_t, ino )
1018 __field( __u16, mode )
1019 __field( int, is_metadata )
1020 __field( __u64, block ) 1018 __field( __u64, block )
1019 __field( int, is_metadata )
1020 __field( __u16, mode )
1021 ), 1021 ),
1022 1022
1023 TP_fast_assign( 1023 TP_fast_assign(
1024 __entry->dev = inode->i_sb->s_dev; 1024 __entry->dev = inode->i_sb->s_dev;
1025 __entry->ino = inode->i_ino; 1025 __entry->ino = inode->i_ino;
1026 __entry->mode = inode->i_mode;
1027 __entry->is_metadata = is_metadata;
1028 __entry->block = block; 1026 __entry->block = block;
1027 __entry->is_metadata = is_metadata;
1028 __entry->mode = inode->i_mode;
1029 ), 1029 ),
1030 1030
1031 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu", 1031 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
@@ -1042,19 +1042,18 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1042 TP_STRUCT__entry( 1042 TP_STRUCT__entry(
1043 __field( dev_t, dev ) 1043 __field( dev_t, dev )
1044 __field( ino_t, ino ) 1044 __field( ino_t, ino )
1045 __field( __u16, mode )
1046 __field( __u64, i_blocks ) 1045 __field( __u64, i_blocks )
1047 __field( int, used_blocks ) 1046 __field( int, used_blocks )
1048 __field( int, reserved_data_blocks ) 1047 __field( int, reserved_data_blocks )
1049 __field( int, reserved_meta_blocks ) 1048 __field( int, reserved_meta_blocks )
1050 __field( int, allocated_meta_blocks ) 1049 __field( int, allocated_meta_blocks )
1051 __field( int, quota_claim ) 1050 __field( int, quota_claim )
1051 __field( __u16, mode )
1052 ), 1052 ),
1053 1053
1054 TP_fast_assign( 1054 TP_fast_assign(
1055 __entry->dev = inode->i_sb->s_dev; 1055 __entry->dev = inode->i_sb->s_dev;
1056 __entry->ino = inode->i_ino; 1056 __entry->ino = inode->i_ino;
1057 __entry->mode = inode->i_mode;
1058 __entry->i_blocks = inode->i_blocks; 1057 __entry->i_blocks = inode->i_blocks;
1059 __entry->used_blocks = used_blocks; 1058 __entry->used_blocks = used_blocks;
1060 __entry->reserved_data_blocks = 1059 __entry->reserved_data_blocks =
@@ -1064,6 +1063,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1064 __entry->allocated_meta_blocks = 1063 __entry->allocated_meta_blocks =
1065 EXT4_I(inode)->i_allocated_meta_blocks; 1064 EXT4_I(inode)->i_allocated_meta_blocks;
1066 __entry->quota_claim = quota_claim; 1065 __entry->quota_claim = quota_claim;
1066 __entry->mode = inode->i_mode;
1067 ), 1067 ),
1068 1068
1069 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d " 1069 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
@@ -1085,21 +1085,21 @@ TRACE_EVENT(ext4_da_reserve_space,
1085 TP_STRUCT__entry( 1085 TP_STRUCT__entry(
1086 __field( dev_t, dev ) 1086 __field( dev_t, dev )
1087 __field( ino_t, ino ) 1087 __field( ino_t, ino )
1088 __field( __u16, mode )
1089 __field( __u64, i_blocks ) 1088 __field( __u64, i_blocks )
1090 __field( int, md_needed ) 1089 __field( int, md_needed )
1091 __field( int, reserved_data_blocks ) 1090 __field( int, reserved_data_blocks )
1092 __field( int, reserved_meta_blocks ) 1091 __field( int, reserved_meta_blocks )
1092 __field( __u16, mode )
1093 ), 1093 ),
1094 1094
1095 TP_fast_assign( 1095 TP_fast_assign(
1096 __entry->dev = inode->i_sb->s_dev; 1096 __entry->dev = inode->i_sb->s_dev;
1097 __entry->ino = inode->i_ino; 1097 __entry->ino = inode->i_ino;
1098 __entry->mode = inode->i_mode;
1099 __entry->i_blocks = inode->i_blocks; 1098 __entry->i_blocks = inode->i_blocks;
1100 __entry->md_needed = md_needed; 1099 __entry->md_needed = md_needed;
1101 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 1100 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1102 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1101 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1102 __entry->mode = inode->i_mode;
1103 ), 1103 ),
1104 1104
1105 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d " 1105 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
@@ -1119,23 +1119,23 @@ TRACE_EVENT(ext4_da_release_space,
1119 TP_STRUCT__entry( 1119 TP_STRUCT__entry(
1120 __field( dev_t, dev ) 1120 __field( dev_t, dev )
1121 __field( ino_t, ino ) 1121 __field( ino_t, ino )
1122 __field( __u16, mode )
1123 __field( __u64, i_blocks ) 1122 __field( __u64, i_blocks )
1124 __field( int, freed_blocks ) 1123 __field( int, freed_blocks )
1125 __field( int, reserved_data_blocks ) 1124 __field( int, reserved_data_blocks )
1126 __field( int, reserved_meta_blocks ) 1125 __field( int, reserved_meta_blocks )
1127 __field( int, allocated_meta_blocks ) 1126 __field( int, allocated_meta_blocks )
1127 __field( __u16, mode )
1128 ), 1128 ),
1129 1129
1130 TP_fast_assign( 1130 TP_fast_assign(
1131 __entry->dev = inode->i_sb->s_dev; 1131 __entry->dev = inode->i_sb->s_dev;
1132 __entry->ino = inode->i_ino; 1132 __entry->ino = inode->i_ino;
1133 __entry->mode = inode->i_mode;
1134 __entry->i_blocks = inode->i_blocks; 1133 __entry->i_blocks = inode->i_blocks;
1135 __entry->freed_blocks = freed_blocks; 1134 __entry->freed_blocks = freed_blocks;
1136 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 1135 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1137 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1136 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1138 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1137 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1138 __entry->mode = inode->i_mode;
1139 ), 1139 ),
1140 1140
1141 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d " 1141 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
@@ -1203,16 +1203,16 @@ TRACE_EVENT(ext4_direct_IO_enter,
1203 TP_ARGS(inode, offset, len, rw), 1203 TP_ARGS(inode, offset, len, rw),
1204 1204
1205 TP_STRUCT__entry( 1205 TP_STRUCT__entry(
1206 __field( ino_t, ino )
1207 __field( dev_t, dev ) 1206 __field( dev_t, dev )
1207 __field( ino_t, ino )
1208 __field( loff_t, pos ) 1208 __field( loff_t, pos )
1209 __field( unsigned long, len ) 1209 __field( unsigned long, len )
1210 __field( int, rw ) 1210 __field( int, rw )
1211 ), 1211 ),
1212 1212
1213 TP_fast_assign( 1213 TP_fast_assign(
1214 __entry->ino = inode->i_ino;
1215 __entry->dev = inode->i_sb->s_dev; 1214 __entry->dev = inode->i_sb->s_dev;
1215 __entry->ino = inode->i_ino;
1216 __entry->pos = offset; 1216 __entry->pos = offset;
1217 __entry->len = len; 1217 __entry->len = len;
1218 __entry->rw = rw; 1218 __entry->rw = rw;
@@ -1231,8 +1231,8 @@ TRACE_EVENT(ext4_direct_IO_exit,
1231 TP_ARGS(inode, offset, len, rw, ret), 1231 TP_ARGS(inode, offset, len, rw, ret),
1232 1232
1233 TP_STRUCT__entry( 1233 TP_STRUCT__entry(
1234 __field( ino_t, ino )
1235 __field( dev_t, dev ) 1234 __field( dev_t, dev )
1235 __field( ino_t, ino )
1236 __field( loff_t, pos ) 1236 __field( loff_t, pos )
1237 __field( unsigned long, len ) 1237 __field( unsigned long, len )
1238 __field( int, rw ) 1238 __field( int, rw )
@@ -1240,8 +1240,8 @@ TRACE_EVENT(ext4_direct_IO_exit,
1240 ), 1240 ),
1241 1241
1242 TP_fast_assign( 1242 TP_fast_assign(
1243 __entry->ino = inode->i_ino;
1244 __entry->dev = inode->i_sb->s_dev; 1243 __entry->dev = inode->i_sb->s_dev;
1244 __entry->ino = inode->i_ino;
1245 __entry->pos = offset; 1245 __entry->pos = offset;
1246 __entry->len = len; 1246 __entry->len = len;
1247 __entry->rw = rw; 1247 __entry->rw = rw;
@@ -1261,16 +1261,16 @@ TRACE_EVENT(ext4_fallocate_enter,
1261 TP_ARGS(inode, offset, len, mode), 1261 TP_ARGS(inode, offset, len, mode),
1262 1262
1263 TP_STRUCT__entry( 1263 TP_STRUCT__entry(
1264 __field( ino_t, ino )
1265 __field( dev_t, dev ) 1264 __field( dev_t, dev )
1265 __field( ino_t, ino )
1266 __field( loff_t, pos ) 1266 __field( loff_t, pos )
1267 __field( loff_t, len ) 1267 __field( loff_t, len )
1268 __field( int, mode ) 1268 __field( int, mode )
1269 ), 1269 ),
1270 1270
1271 TP_fast_assign( 1271 TP_fast_assign(
1272 __entry->ino = inode->i_ino;
1273 __entry->dev = inode->i_sb->s_dev; 1272 __entry->dev = inode->i_sb->s_dev;
1273 __entry->ino = inode->i_ino;
1274 __entry->pos = offset; 1274 __entry->pos = offset;
1275 __entry->len = len; 1275 __entry->len = len;
1276 __entry->mode = mode; 1276 __entry->mode = mode;
@@ -1289,16 +1289,16 @@ TRACE_EVENT(ext4_fallocate_exit,
1289 TP_ARGS(inode, offset, max_blocks, ret), 1289 TP_ARGS(inode, offset, max_blocks, ret),
1290 1290
1291 TP_STRUCT__entry( 1291 TP_STRUCT__entry(
1292 __field( ino_t, ino )
1293 __field( dev_t, dev ) 1292 __field( dev_t, dev )
1293 __field( ino_t, ino )
1294 __field( loff_t, pos ) 1294 __field( loff_t, pos )
1295 __field( unsigned int, blocks ) 1295 __field( unsigned int, blocks )
1296 __field( int, ret ) 1296 __field( int, ret )
1297 ), 1297 ),
1298 1298
1299 TP_fast_assign( 1299 TP_fast_assign(
1300 __entry->ino = inode->i_ino;
1301 __entry->dev = inode->i_sb->s_dev; 1300 __entry->dev = inode->i_sb->s_dev;
1301 __entry->ino = inode->i_ino;
1302 __entry->pos = offset; 1302 __entry->pos = offset;
1303 __entry->blocks = max_blocks; 1303 __entry->blocks = max_blocks;
1304 __entry->ret = ret; 1304 __entry->ret = ret;
@@ -1317,17 +1317,17 @@ TRACE_EVENT(ext4_unlink_enter,
1317 TP_ARGS(parent, dentry), 1317 TP_ARGS(parent, dentry),
1318 1318
1319 TP_STRUCT__entry( 1319 TP_STRUCT__entry(
1320 __field( ino_t, parent ) 1320 __field( dev_t, dev )
1321 __field( ino_t, ino ) 1321 __field( ino_t, ino )
1322 __field( ino_t, parent )
1322 __field( loff_t, size ) 1323 __field( loff_t, size )
1323 __field( dev_t, dev )
1324 ), 1324 ),
1325 1325
1326 TP_fast_assign( 1326 TP_fast_assign(
1327 __entry->parent = parent->i_ino; 1327 __entry->dev = dentry->d_inode->i_sb->s_dev;
1328 __entry->ino = dentry->d_inode->i_ino; 1328 __entry->ino = dentry->d_inode->i_ino;
1329 __entry->parent = parent->i_ino;
1329 __entry->size = dentry->d_inode->i_size; 1330 __entry->size = dentry->d_inode->i_size;
1330 __entry->dev = dentry->d_inode->i_sb->s_dev;
1331 ), 1331 ),
1332 1332
1333 TP_printk("dev %d,%d ino %lu size %lld parent %lu", 1333 TP_printk("dev %d,%d ino %lu size %lld parent %lu",
@@ -1342,14 +1342,14 @@ TRACE_EVENT(ext4_unlink_exit,
1342 TP_ARGS(dentry, ret), 1342 TP_ARGS(dentry, ret),
1343 1343
1344 TP_STRUCT__entry( 1344 TP_STRUCT__entry(
1345 __field( ino_t, ino )
1346 __field( dev_t, dev ) 1345 __field( dev_t, dev )
1346 __field( ino_t, ino )
1347 __field( int, ret ) 1347 __field( int, ret )
1348 ), 1348 ),
1349 1349
1350 TP_fast_assign( 1350 TP_fast_assign(
1351 __entry->ino = dentry->d_inode->i_ino;
1352 __entry->dev = dentry->d_inode->i_sb->s_dev; 1351 __entry->dev = dentry->d_inode->i_sb->s_dev;
1352 __entry->ino = dentry->d_inode->i_ino;
1353 __entry->ret = ret; 1353 __entry->ret = ret;
1354 ), 1354 ),
1355 1355
@@ -1365,14 +1365,14 @@ DECLARE_EVENT_CLASS(ext4__truncate,
1365 TP_ARGS(inode), 1365 TP_ARGS(inode),
1366 1366
1367 TP_STRUCT__entry( 1367 TP_STRUCT__entry(
1368 __field( ino_t, ino ) 1368 __field( dev_t, dev )
1369 __field( dev_t, dev ) 1369 __field( ino_t, ino )
1370 __field( __u64, blocks ) 1370 __field( __u64, blocks )
1371 ), 1371 ),
1372 1372
1373 TP_fast_assign( 1373 TP_fast_assign(
1374 __entry->ino = inode->i_ino;
1375 __entry->dev = inode->i_sb->s_dev; 1374 __entry->dev = inode->i_sb->s_dev;
1375 __entry->ino = inode->i_ino;
1376 __entry->blocks = inode->i_blocks; 1376 __entry->blocks = inode->i_blocks;
1377 ), 1377 ),
1378 1378
@@ -1403,8 +1403,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1403 TP_ARGS(inode, map, ux), 1403 TP_ARGS(inode, map, ux),
1404 1404
1405 TP_STRUCT__entry( 1405 TP_STRUCT__entry(
1406 __field( ino_t, ino )
1407 __field( dev_t, dev ) 1406 __field( dev_t, dev )
1407 __field( ino_t, ino )
1408 __field( ext4_lblk_t, m_lblk ) 1408 __field( ext4_lblk_t, m_lblk )
1409 __field( unsigned, m_len ) 1409 __field( unsigned, m_len )
1410 __field( ext4_lblk_t, u_lblk ) 1410 __field( ext4_lblk_t, u_lblk )
@@ -1413,8 +1413,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1413 ), 1413 ),
1414 1414
1415 TP_fast_assign( 1415 TP_fast_assign(
1416 __entry->ino = inode->i_ino;
1417 __entry->dev = inode->i_sb->s_dev; 1416 __entry->dev = inode->i_sb->s_dev;
1417 __entry->ino = inode->i_ino;
1418 __entry->m_lblk = map->m_lblk; 1418 __entry->m_lblk = map->m_lblk;
1419 __entry->m_len = map->m_len; 1419 __entry->m_len = map->m_len;
1420 __entry->u_lblk = le32_to_cpu(ux->ee_block); 1420 __entry->u_lblk = le32_to_cpu(ux->ee_block);
@@ -1441,8 +1441,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1441 TP_ARGS(inode, map, ux, ix), 1441 TP_ARGS(inode, map, ux, ix),
1442 1442
1443 TP_STRUCT__entry( 1443 TP_STRUCT__entry(
1444 __field( ino_t, ino )
1445 __field( dev_t, dev ) 1444 __field( dev_t, dev )
1445 __field( ino_t, ino )
1446 __field( ext4_lblk_t, m_lblk ) 1446 __field( ext4_lblk_t, m_lblk )
1447 __field( unsigned, m_len ) 1447 __field( unsigned, m_len )
1448 __field( ext4_lblk_t, u_lblk ) 1448 __field( ext4_lblk_t, u_lblk )
@@ -1454,8 +1454,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1454 ), 1454 ),
1455 1455
1456 TP_fast_assign( 1456 TP_fast_assign(
1457 __entry->ino = inode->i_ino;
1458 __entry->dev = inode->i_sb->s_dev; 1457 __entry->dev = inode->i_sb->s_dev;
1458 __entry->ino = inode->i_ino;
1459 __entry->m_lblk = map->m_lblk; 1459 __entry->m_lblk = map->m_lblk;
1460 __entry->m_len = map->m_len; 1460 __entry->m_len = map->m_len;
1461 __entry->u_lblk = le32_to_cpu(ux->ee_block); 1461 __entry->u_lblk = le32_to_cpu(ux->ee_block);
@@ -1483,16 +1483,16 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1483 TP_ARGS(inode, lblk, len, flags), 1483 TP_ARGS(inode, lblk, len, flags),
1484 1484
1485 TP_STRUCT__entry( 1485 TP_STRUCT__entry(
1486 __field( ino_t, ino ) 1486 __field( dev_t, dev )
1487 __field( dev_t, dev ) 1487 __field( ino_t, ino )
1488 __field( ext4_lblk_t, lblk ) 1488 __field( ext4_lblk_t, lblk )
1489 __field( unsigned int, len ) 1489 __field( unsigned int, len )
1490 __field( unsigned int, flags ) 1490 __field( unsigned int, flags )
1491 ), 1491 ),
1492 1492
1493 TP_fast_assign( 1493 TP_fast_assign(
1494 __entry->ino = inode->i_ino;
1495 __entry->dev = inode->i_sb->s_dev; 1494 __entry->dev = inode->i_sb->s_dev;
1495 __entry->ino = inode->i_ino;
1496 __entry->lblk = lblk; 1496 __entry->lblk = lblk;
1497 __entry->len = len; 1497 __entry->len = len;
1498 __entry->flags = flags; 1498 __entry->flags = flags;
@@ -1525,19 +1525,19 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1525 TP_ARGS(inode, lblk, pblk, len, ret), 1525 TP_ARGS(inode, lblk, pblk, len, ret),
1526 1526
1527 TP_STRUCT__entry( 1527 TP_STRUCT__entry(
1528 __field( ino_t, ino )
1529 __field( dev_t, dev ) 1528 __field( dev_t, dev )
1530 __field( ext4_lblk_t, lblk ) 1529 __field( ino_t, ino )
1531 __field( ext4_fsblk_t, pblk ) 1530 __field( ext4_fsblk_t, pblk )
1531 __field( ext4_lblk_t, lblk )
1532 __field( unsigned int, len ) 1532 __field( unsigned int, len )
1533 __field( int, ret ) 1533 __field( int, ret )
1534 ), 1534 ),
1535 1535
1536 TP_fast_assign( 1536 TP_fast_assign(
1537 __entry->ino = inode->i_ino;
1538 __entry->dev = inode->i_sb->s_dev; 1537 __entry->dev = inode->i_sb->s_dev;
1539 __entry->lblk = lblk; 1538 __entry->ino = inode->i_ino;
1540 __entry->pblk = pblk; 1539 __entry->pblk = pblk;
1540 __entry->lblk = lblk;
1541 __entry->len = len; 1541 __entry->len = len;
1542 __entry->ret = ret; 1542 __entry->ret = ret;
1543 ), 1543 ),
@@ -1569,17 +1569,17 @@ TRACE_EVENT(ext4_ext_load_extent,
1569 TP_ARGS(inode, lblk, pblk), 1569 TP_ARGS(inode, lblk, pblk),
1570 1570
1571 TP_STRUCT__entry( 1571 TP_STRUCT__entry(
1572 __field( ino_t, ino )
1573 __field( dev_t, dev ) 1572 __field( dev_t, dev )
1574 __field( ext4_lblk_t, lblk ) 1573 __field( ino_t, ino )
1575 __field( ext4_fsblk_t, pblk ) 1574 __field( ext4_fsblk_t, pblk )
1575 __field( ext4_lblk_t, lblk )
1576 ), 1576 ),
1577 1577
1578 TP_fast_assign( 1578 TP_fast_assign(
1579 __entry->ino = inode->i_ino;
1580 __entry->dev = inode->i_sb->s_dev; 1579 __entry->dev = inode->i_sb->s_dev;
1581 __entry->lblk = lblk; 1580 __entry->ino = inode->i_ino;
1582 __entry->pblk = pblk; 1581 __entry->pblk = pblk;
1582 __entry->lblk = lblk;
1583 ), 1583 ),
1584 1584
1585 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu", 1585 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
@@ -1594,13 +1594,13 @@ TRACE_EVENT(ext4_load_inode,
1594 TP_ARGS(inode), 1594 TP_ARGS(inode),
1595 1595
1596 TP_STRUCT__entry( 1596 TP_STRUCT__entry(
1597 __field( ino_t, ino )
1598 __field( dev_t, dev ) 1597 __field( dev_t, dev )
1598 __field( ino_t, ino )
1599 ), 1599 ),
1600 1600
1601 TP_fast_assign( 1601 TP_fast_assign(
1602 __entry->ino = inode->i_ino;
1603 __entry->dev = inode->i_sb->s_dev; 1602 __entry->dev = inode->i_sb->s_dev;
1603 __entry->ino = inode->i_ino;
1604 ), 1604 ),
1605 1605
1606 TP_printk("dev %d,%d ino %ld", 1606 TP_printk("dev %d,%d ino %ld",
@@ -1615,14 +1615,14 @@ TRACE_EVENT(ext4_journal_start,
1615 1615
1616 TP_STRUCT__entry( 1616 TP_STRUCT__entry(
1617 __field( dev_t, dev ) 1617 __field( dev_t, dev )
1618 __field( int, nblocks )
1619 __field(unsigned long, ip ) 1618 __field(unsigned long, ip )
1619 __field( int, nblocks )
1620 ), 1620 ),
1621 1621
1622 TP_fast_assign( 1622 TP_fast_assign(
1623 __entry->dev = sb->s_dev; 1623 __entry->dev = sb->s_dev;
1624 __entry->nblocks = nblocks;
1625 __entry->ip = IP; 1624 __entry->ip = IP;
1625 __entry->nblocks = nblocks;
1626 ), 1626 ),
1627 1627
1628 TP_printk("dev %d,%d nblocks %d caller %pF", 1628 TP_printk("dev %d,%d nblocks %d caller %pF",
@@ -1686,23 +1686,23 @@ TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1686 TP_ARGS(inode, map, allocated, newblock), 1686 TP_ARGS(inode, map, allocated, newblock),
1687 1687
1688 TP_STRUCT__entry( 1688 TP_STRUCT__entry(
1689 __field( ino_t, ino )
1690 __field( dev_t, dev ) 1689 __field( dev_t, dev )
1690 __field( ino_t, ino )
1691 __field( int, flags )
1691 __field( ext4_lblk_t, lblk ) 1692 __field( ext4_lblk_t, lblk )
1692 __field( ext4_fsblk_t, pblk ) 1693 __field( ext4_fsblk_t, pblk )
1693 __field( unsigned int, len ) 1694 __field( unsigned int, len )
1694 __field( int, flags )
1695 __field( unsigned int, allocated ) 1695 __field( unsigned int, allocated )
1696 __field( ext4_fsblk_t, newblk ) 1696 __field( ext4_fsblk_t, newblk )
1697 ), 1697 ),
1698 1698
1699 TP_fast_assign( 1699 TP_fast_assign(
1700 __entry->ino = inode->i_ino;
1701 __entry->dev = inode->i_sb->s_dev; 1700 __entry->dev = inode->i_sb->s_dev;
1701 __entry->ino = inode->i_ino;
1702 __entry->flags = map->m_flags;
1702 __entry->lblk = map->m_lblk; 1703 __entry->lblk = map->m_lblk;
1703 __entry->pblk = map->m_pblk; 1704 __entry->pblk = map->m_pblk;
1704 __entry->len = map->m_len; 1705 __entry->len = map->m_len;
1705 __entry->flags = map->m_flags;
1706 __entry->allocated = allocated; 1706 __entry->allocated = allocated;
1707 __entry->newblk = newblock; 1707 __entry->newblk = newblock;
1708 ), 1708 ),
@@ -1724,19 +1724,19 @@ TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1724 1724
1725 TP_STRUCT__entry( 1725 TP_STRUCT__entry(
1726 __field( dev_t, dev ) 1726 __field( dev_t, dev )
1727 __field( unsigned int, flags )
1727 __field( ext4_lblk_t, lblk ) 1728 __field( ext4_lblk_t, lblk )
1728 __field( ext4_fsblk_t, pblk ) 1729 __field( ext4_fsblk_t, pblk )
1729 __field( unsigned int, len ) 1730 __field( unsigned int, len )
1730 __field( unsigned int, flags )
1731 __field( int, ret ) 1731 __field( int, ret )
1732 ), 1732 ),
1733 1733
1734 TP_fast_assign( 1734 TP_fast_assign(
1735 __entry->dev = sb->s_dev; 1735 __entry->dev = sb->s_dev;
1736 __entry->flags = map->m_flags;
1736 __entry->lblk = map->m_lblk; 1737 __entry->lblk = map->m_lblk;
1737 __entry->pblk = map->m_pblk; 1738 __entry->pblk = map->m_pblk;
1738 __entry->len = map->m_len; 1739 __entry->len = map->m_len;
1739 __entry->flags = map->m_flags;
1740 __entry->ret = ret; 1740 __entry->ret = ret;
1741 ), 1741 ),
1742 1742
@@ -1753,16 +1753,16 @@ TRACE_EVENT(ext4_ext_put_in_cache,
1753 TP_ARGS(inode, lblk, len, start), 1753 TP_ARGS(inode, lblk, len, start),
1754 1754
1755 TP_STRUCT__entry( 1755 TP_STRUCT__entry(
1756 __field( ino_t, ino )
1757 __field( dev_t, dev ) 1756 __field( dev_t, dev )
1757 __field( ino_t, ino )
1758 __field( ext4_lblk_t, lblk ) 1758 __field( ext4_lblk_t, lblk )
1759 __field( unsigned int, len ) 1759 __field( unsigned int, len )
1760 __field( ext4_fsblk_t, start ) 1760 __field( ext4_fsblk_t, start )
1761 ), 1761 ),
1762 1762
1763 TP_fast_assign( 1763 TP_fast_assign(
1764 __entry->ino = inode->i_ino;
1765 __entry->dev = inode->i_sb->s_dev; 1764 __entry->dev = inode->i_sb->s_dev;
1765 __entry->ino = inode->i_ino;
1766 __entry->lblk = lblk; 1766 __entry->lblk = lblk;
1767 __entry->len = len; 1767 __entry->len = len;
1768 __entry->start = start; 1768 __entry->start = start;
@@ -1782,15 +1782,15 @@ TRACE_EVENT(ext4_ext_in_cache,
1782 TP_ARGS(inode, lblk, ret), 1782 TP_ARGS(inode, lblk, ret),
1783 1783
1784 TP_STRUCT__entry( 1784 TP_STRUCT__entry(
1785 __field( ino_t, ino )
1786 __field( dev_t, dev ) 1785 __field( dev_t, dev )
1786 __field( ino_t, ino )
1787 __field( ext4_lblk_t, lblk ) 1787 __field( ext4_lblk_t, lblk )
1788 __field( int, ret ) 1788 __field( int, ret )
1789 ), 1789 ),
1790 1790
1791 TP_fast_assign( 1791 TP_fast_assign(
1792 __entry->ino = inode->i_ino;
1793 __entry->dev = inode->i_sb->s_dev; 1792 __entry->dev = inode->i_sb->s_dev;
1793 __entry->ino = inode->i_ino;
1794 __entry->lblk = lblk; 1794 __entry->lblk = lblk;
1795 __entry->ret = ret; 1795 __entry->ret = ret;
1796 ), 1796 ),
@@ -1810,8 +1810,8 @@ TRACE_EVENT(ext4_find_delalloc_range,
1810 TP_ARGS(inode, from, to, reverse, found, found_blk), 1810 TP_ARGS(inode, from, to, reverse, found, found_blk),
1811 1811
1812 TP_STRUCT__entry( 1812 TP_STRUCT__entry(
1813 __field( ino_t, ino )
1814 __field( dev_t, dev ) 1813 __field( dev_t, dev )
1814 __field( ino_t, ino )
1815 __field( ext4_lblk_t, from ) 1815 __field( ext4_lblk_t, from )
1816 __field( ext4_lblk_t, to ) 1816 __field( ext4_lblk_t, to )
1817 __field( int, reverse ) 1817 __field( int, reverse )
@@ -1820,8 +1820,8 @@ TRACE_EVENT(ext4_find_delalloc_range,
1820 ), 1820 ),
1821 1821
1822 TP_fast_assign( 1822 TP_fast_assign(
1823 __entry->ino = inode->i_ino;
1824 __entry->dev = inode->i_sb->s_dev; 1823 __entry->dev = inode->i_sb->s_dev;
1824 __entry->ino = inode->i_ino;
1825 __entry->from = from; 1825 __entry->from = from;
1826 __entry->to = to; 1826 __entry->to = to;
1827 __entry->reverse = reverse; 1827 __entry->reverse = reverse;
@@ -1844,15 +1844,15 @@ TRACE_EVENT(ext4_get_reserved_cluster_alloc,
1844 TP_ARGS(inode, lblk, len), 1844 TP_ARGS(inode, lblk, len),
1845 1845
1846 TP_STRUCT__entry( 1846 TP_STRUCT__entry(
1847 __field( ino_t, ino )
1848 __field( dev_t, dev ) 1847 __field( dev_t, dev )
1848 __field( ino_t, ino )
1849 __field( ext4_lblk_t, lblk ) 1849 __field( ext4_lblk_t, lblk )
1850 __field( unsigned int, len ) 1850 __field( unsigned int, len )
1851 ), 1851 ),
1852 1852
1853 TP_fast_assign( 1853 TP_fast_assign(
1854 __entry->ino = inode->i_ino;
1855 __entry->dev = inode->i_sb->s_dev; 1854 __entry->dev = inode->i_sb->s_dev;
1855 __entry->ino = inode->i_ino;
1856 __entry->lblk = lblk; 1856 __entry->lblk = lblk;
1857 __entry->len = len; 1857 __entry->len = len;
1858 ), 1858 ),
@@ -1871,18 +1871,18 @@ TRACE_EVENT(ext4_ext_show_extent,
1871 TP_ARGS(inode, lblk, pblk, len), 1871 TP_ARGS(inode, lblk, pblk, len),
1872 1872
1873 TP_STRUCT__entry( 1873 TP_STRUCT__entry(
1874 __field( ino_t, ino )
1875 __field( dev_t, dev ) 1874 __field( dev_t, dev )
1876 __field( ext4_lblk_t, lblk ) 1875 __field( ino_t, ino )
1877 __field( ext4_fsblk_t, pblk ) 1876 __field( ext4_fsblk_t, pblk )
1877 __field( ext4_lblk_t, lblk )
1878 __field( unsigned short, len ) 1878 __field( unsigned short, len )
1879 ), 1879 ),
1880 1880
1881 TP_fast_assign( 1881 TP_fast_assign(
1882 __entry->ino = inode->i_ino;
1883 __entry->dev = inode->i_sb->s_dev; 1882 __entry->dev = inode->i_sb->s_dev;
1884 __entry->lblk = lblk; 1883 __entry->ino = inode->i_ino;
1885 __entry->pblk = pblk; 1884 __entry->pblk = pblk;
1885 __entry->lblk = lblk;
1886 __entry->len = len; 1886 __entry->len = len;
1887 ), 1887 ),
1888 1888
@@ -1902,25 +1902,25 @@ TRACE_EVENT(ext4_remove_blocks,
1902 TP_ARGS(inode, ex, from, to, partial_cluster), 1902 TP_ARGS(inode, ex, from, to, partial_cluster),
1903 1903
1904 TP_STRUCT__entry( 1904 TP_STRUCT__entry(
1905 __field( ino_t, ino )
1906 __field( dev_t, dev ) 1905 __field( dev_t, dev )
1907 __field( ext4_lblk_t, ee_lblk ) 1906 __field( ino_t, ino )
1908 __field( ext4_fsblk_t, ee_pblk )
1909 __field( unsigned short, ee_len )
1910 __field( ext4_lblk_t, from ) 1907 __field( ext4_lblk_t, from )
1911 __field( ext4_lblk_t, to ) 1908 __field( ext4_lblk_t, to )
1912 __field( ext4_fsblk_t, partial ) 1909 __field( ext4_fsblk_t, partial )
1910 __field( ext4_fsblk_t, ee_pblk )
1911 __field( ext4_lblk_t, ee_lblk )
1912 __field( unsigned short, ee_len )
1913 ), 1913 ),
1914 1914
1915 TP_fast_assign( 1915 TP_fast_assign(
1916 __entry->ino = inode->i_ino;
1917 __entry->dev = inode->i_sb->s_dev; 1916 __entry->dev = inode->i_sb->s_dev;
1918 __entry->ee_lblk = cpu_to_le32(ex->ee_block); 1917 __entry->ino = inode->i_ino;
1919 __entry->ee_pblk = ext4_ext_pblock(ex);
1920 __entry->ee_len = ext4_ext_get_actual_len(ex);
1921 __entry->from = from; 1918 __entry->from = from;
1922 __entry->to = to; 1919 __entry->to = to;
1923 __entry->partial = partial_cluster; 1920 __entry->partial = partial_cluster;
1921 __entry->ee_pblk = ext4_ext_pblock(ex);
1922 __entry->ee_lblk = cpu_to_le32(ex->ee_block);
1923 __entry->ee_len = ext4_ext_get_actual_len(ex);
1924 ), 1924 ),
1925 1925
1926 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]" 1926 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
@@ -1942,23 +1942,23 @@ TRACE_EVENT(ext4_ext_rm_leaf,
1942 TP_ARGS(inode, start, ex, partial_cluster), 1942 TP_ARGS(inode, start, ex, partial_cluster),
1943 1943
1944 TP_STRUCT__entry( 1944 TP_STRUCT__entry(
1945 __field( ino_t, ino )
1946 __field( dev_t, dev ) 1945 __field( dev_t, dev )
1946 __field( ino_t, ino )
1947 __field( ext4_fsblk_t, partial )
1947 __field( ext4_lblk_t, start ) 1948 __field( ext4_lblk_t, start )
1948 __field( ext4_lblk_t, ee_lblk ) 1949 __field( ext4_lblk_t, ee_lblk )
1949 __field( ext4_fsblk_t, ee_pblk ) 1950 __field( ext4_fsblk_t, ee_pblk )
1950 __field( short, ee_len ) 1951 __field( short, ee_len )
1951 __field( ext4_fsblk_t, partial )
1952 ), 1952 ),
1953 1953
1954 TP_fast_assign( 1954 TP_fast_assign(
1955 __entry->ino = inode->i_ino;
1956 __entry->dev = inode->i_sb->s_dev; 1955 __entry->dev = inode->i_sb->s_dev;
1956 __entry->ino = inode->i_ino;
1957 __entry->partial = partial_cluster;
1957 __entry->start = start; 1958 __entry->start = start;
1958 __entry->ee_lblk = le32_to_cpu(ex->ee_block); 1959 __entry->ee_lblk = le32_to_cpu(ex->ee_block);
1959 __entry->ee_pblk = ext4_ext_pblock(ex); 1960 __entry->ee_pblk = ext4_ext_pblock(ex);
1960 __entry->ee_len = ext4_ext_get_actual_len(ex); 1961 __entry->ee_len = ext4_ext_get_actual_len(ex);
1961 __entry->partial = partial_cluster;
1962 ), 1962 ),
1963 1963
1964 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]" 1964 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
@@ -1978,14 +1978,14 @@ TRACE_EVENT(ext4_ext_rm_idx,
1978 TP_ARGS(inode, pblk), 1978 TP_ARGS(inode, pblk),
1979 1979
1980 TP_STRUCT__entry( 1980 TP_STRUCT__entry(
1981 __field( ino_t, ino )
1982 __field( dev_t, dev ) 1981 __field( dev_t, dev )
1982 __field( ino_t, ino )
1983 __field( ext4_fsblk_t, pblk ) 1983 __field( ext4_fsblk_t, pblk )
1984 ), 1984 ),
1985 1985
1986 TP_fast_assign( 1986 TP_fast_assign(
1987 __entry->ino = inode->i_ino;
1988 __entry->dev = inode->i_sb->s_dev; 1987 __entry->dev = inode->i_sb->s_dev;
1988 __entry->ino = inode->i_ino;
1989 __entry->pblk = pblk; 1989 __entry->pblk = pblk;
1990 ), 1990 ),
1991 1991
@@ -2001,15 +2001,15 @@ TRACE_EVENT(ext4_ext_remove_space,
2001 TP_ARGS(inode, start, depth), 2001 TP_ARGS(inode, start, depth),
2002 2002
2003 TP_STRUCT__entry( 2003 TP_STRUCT__entry(
2004 __field( ino_t, ino )
2005 __field( dev_t, dev ) 2004 __field( dev_t, dev )
2005 __field( ino_t, ino )
2006 __field( ext4_lblk_t, start ) 2006 __field( ext4_lblk_t, start )
2007 __field( int, depth ) 2007 __field( int, depth )
2008 ), 2008 ),
2009 2009
2010 TP_fast_assign( 2010 TP_fast_assign(
2011 __entry->ino = inode->i_ino;
2012 __entry->dev = inode->i_sb->s_dev; 2011 __entry->dev = inode->i_sb->s_dev;
2012 __entry->ino = inode->i_ino;
2013 __entry->start = start; 2013 __entry->start = start;
2014 __entry->depth = depth; 2014 __entry->depth = depth;
2015 ), 2015 ),
@@ -2028,8 +2028,8 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2028 TP_ARGS(inode, start, depth, partial, eh_entries), 2028 TP_ARGS(inode, start, depth, partial, eh_entries),
2029 2029
2030 TP_STRUCT__entry( 2030 TP_STRUCT__entry(
2031 __field( ino_t, ino )
2032 __field( dev_t, dev ) 2031 __field( dev_t, dev )
2032 __field( ino_t, ino )
2033 __field( ext4_lblk_t, start ) 2033 __field( ext4_lblk_t, start )
2034 __field( int, depth ) 2034 __field( int, depth )
2035 __field( ext4_lblk_t, partial ) 2035 __field( ext4_lblk_t, partial )
@@ -2037,8 +2037,8 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2037 ), 2037 ),
2038 2038
2039 TP_fast_assign( 2039 TP_fast_assign(
2040 __entry->ino = inode->i_ino;
2041 __entry->dev = inode->i_sb->s_dev; 2040 __entry->dev = inode->i_sb->s_dev;
2041 __entry->ino = inode->i_ino;
2042 __entry->start = start; 2042 __entry->start = start;
2043 __entry->depth = depth; 2043 __entry->depth = depth;
2044 __entry->partial = partial; 2044 __entry->partial = partial;
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index d6fd8e5b14b7..9391706e9254 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -36,7 +36,6 @@
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
39 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
40 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 39 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \
41 ) : "GFP_NOWAIT" 40 ) : "GFP_NOWAIT"
42 41
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index 5f889f16b0c8..6bc943ecb841 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -6,7 +6,7 @@
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include "gfpflags.h" 9#include <trace/events/gfpflags.h>
10 10
11DECLARE_EVENT_CLASS(kmem_alloc, 11DECLARE_EVENT_CLASS(kmem_alloc,
12 12
@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc,
214 214
215 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s", 215 TP_printk("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s",
216 __entry->page, 216 __entry->page,
217 page_to_pfn(__entry->page), 217 __entry->page ? page_to_pfn(__entry->page) : 0,
218 __entry->order, 218 __entry->order,
219 __entry->migratetype, 219 __entry->migratetype,
220 show_gfp_flags(__entry->gfp_flags)) 220 show_gfp_flags(__entry->gfp_flags))
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page,
240 240
241 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d", 241 TP_printk("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d",
242 __entry->page, 242 __entry->page,
243 page_to_pfn(__entry->page), 243 __entry->page ? page_to_pfn(__entry->page) : 0,
244 __entry->order, 244 __entry->order,
245 __entry->migratetype, 245 __entry->migratetype,
246 __entry->order == 0) 246 __entry->order == 0)
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index bab3b87e4064..63cfcccaebb3 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -8,7 +8,7 @@
8#include <linux/tracepoint.h> 8#include <linux/tracepoint.h>
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/memcontrol.h> 10#include <linux/memcontrol.h>
11#include "gfpflags.h" 11#include <trace/events/gfpflags.h>
12 12
13#define RECLAIM_WB_ANON 0x0001u 13#define RECLAIM_WB_ANON 0x0001u
14#define RECLAIM_WB_FILE 0x0002u 14#define RECLAIM_WB_FILE 0x0002u
diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
new file mode 100644
index 000000000000..81d2106287fe
--- /dev/null
+++ b/include/uapi/Kbuild
@@ -0,0 +1,14 @@
1# UAPI Header export list
2# Top-level Makefile calls into asm-$(ARCH)
3# List only non-arch directories below
4
5
6header-y += asm-generic/
7header-y += linux/
8header-y += sound/
9header-y += mtd/
10header-y += rdma/
11header-y += video/
12header-y += drm/
13header-y += xen/
14header-y += scsi/
diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild
new file mode 100644
index 000000000000..b73de7bb7a62
--- /dev/null
+++ b/include/uapi/asm-generic/Kbuild
@@ -0,0 +1,36 @@
1# UAPI Header export list
2header-y += auxvec.h
3header-y += bitsperlong.h
4header-y += errno-base.h
5header-y += errno.h
6header-y += fcntl.h
7header-y += int-l64.h
8header-y += int-ll64.h
9header-y += ioctl.h
10header-y += ioctls.h
11header-y += ipcbuf.h
12header-y += kvm_para.h
13header-y += mman-common.h
14header-y += mman.h
15header-y += msgbuf.h
16header-y += param.h
17header-y += poll.h
18header-y += posix_types.h
19header-y += resource.h
20header-y += sembuf.h
21header-y += setup.h
22header-y += shmbuf.h
23header-y += shmparam.h
24header-y += siginfo.h
25header-y += signal-defs.h
26header-y += signal.h
27header-y += socket.h
28header-y += sockios.h
29header-y += stat.h
30header-y += statfs.h
31header-y += swab.h
32header-y += termbits.h
33header-y += termios.h
34header-y += types.h
35header-y += ucontext.h
36header-y += unistd.h
diff --git a/include/uapi/asm-generic/Kbuild.asm b/include/uapi/asm-generic/Kbuild.asm
new file mode 100644
index 000000000000..fcd50b759217
--- /dev/null
+++ b/include/uapi/asm-generic/Kbuild.asm
@@ -0,0 +1,49 @@
1#
2# Headers that are optional in usr/include/asm/
3#
4opt-header += kvm.h
5opt-header += kvm_para.h
6opt-header += a.out.h
7
8#
9# Headers that are mandatory in usr/include/asm/
10#
11header-y += auxvec.h
12header-y += bitsperlong.h
13header-y += byteorder.h
14header-y += errno.h
15header-y += fcntl.h
16header-y += ioctl.h
17header-y += ioctls.h
18header-y += ipcbuf.h
19header-y += mman.h
20header-y += msgbuf.h
21header-y += param.h
22header-y += poll.h
23header-y += posix_types.h
24header-y += ptrace.h
25header-y += resource.h
26header-y += sembuf.h
27header-y += setup.h
28header-y += shmbuf.h
29header-y += sigcontext.h
30header-y += siginfo.h
31header-y += signal.h
32header-y += socket.h
33header-y += sockios.h
34header-y += stat.h
35header-y += statfs.h
36header-y += swab.h
37header-y += termbits.h
38header-y += termios.h
39header-y += types.h
40header-y += unistd.h
41
42header-y += $(foreach hdr,$(opt-header), \
43 $(if \
44 $(wildcard \
45 $(srctree)/arch/$(SRCARCH)/include/uapi/asm/$(hdr) \
46 $(srctree)/arch/$(SRCARCH)/include/asm/$(hdr) \
47 ), \
48 $(hdr) \
49 ))
diff --git a/include/asm-generic/auxvec.h b/include/uapi/asm-generic/auxvec.h
index b99573b0ad12..b99573b0ad12 100644
--- a/include/asm-generic/auxvec.h
+++ b/include/uapi/asm-generic/auxvec.h
diff --git a/include/uapi/asm-generic/bitsperlong.h b/include/uapi/asm-generic/bitsperlong.h
new file mode 100644
index 000000000000..23e6c416b85f
--- /dev/null
+++ b/include/uapi/asm-generic/bitsperlong.h
@@ -0,0 +1,15 @@
1#ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
2#define _UAPI__ASM_GENERIC_BITS_PER_LONG
3
4/*
5 * There seems to be no way of detecting this automatically from user
6 * space, so 64 bit architectures should override this in their
7 * bitsperlong.h. In particular, an architecture that supports
8 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
9 * to decide it, but rather check a compiler provided macro.
10 */
11#ifndef __BITS_PER_LONG
12#define __BITS_PER_LONG 32
13#endif
14
15#endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/errno-base.h b/include/uapi/asm-generic/errno-base.h
index 65115978510f..65115978510f 100644
--- a/include/asm-generic/errno-base.h
+++ b/include/uapi/asm-generic/errno-base.h
diff --git a/include/asm-generic/errno.h b/include/uapi/asm-generic/errno.h
index a1331ce50445..a1331ce50445 100644
--- a/include/asm-generic/errno.h
+++ b/include/uapi/asm-generic/errno.h
diff --git a/include/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index a48937d4a5ea..a48937d4a5ea 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
diff --git a/include/uapi/asm-generic/int-l64.h b/include/uapi/asm-generic/int-l64.h
new file mode 100644
index 000000000000..978f21cae2f4
--- /dev/null
+++ b/include/uapi/asm-generic/int-l64.h
@@ -0,0 +1,34 @@
1/*
2 * asm-generic/int-l64.h
3 *
4 * Integer declarations for architectures which use "long"
5 * for 64-bit types.
6 */
7
8#ifndef _UAPI_ASM_GENERIC_INT_L64_H
9#define _UAPI_ASM_GENERIC_INT_L64_H
10
11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28typedef __signed__ long __s64;
29typedef unsigned long __u64;
30
31#endif /* __ASSEMBLY__ */
32
33
34#endif /* _UAPI_ASM_GENERIC_INT_L64_H */
diff --git a/include/uapi/asm-generic/int-ll64.h b/include/uapi/asm-generic/int-ll64.h
new file mode 100644
index 000000000000..a8658b2423ba
--- /dev/null
+++ b/include/uapi/asm-generic/int-ll64.h
@@ -0,0 +1,39 @@
1/*
2 * asm-generic/int-ll64.h
3 *
4 * Integer declarations for architectures which use "long long"
5 * for 64-bit types.
6 */
7
8#ifndef _UAPI_ASM_GENERIC_INT_LL64_H
9#define _UAPI_ASM_GENERIC_INT_LL64_H
10
11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#ifdef __GNUC__
29__extension__ typedef __signed__ long long __s64;
30__extension__ typedef unsigned long long __u64;
31#else
32typedef __signed__ long long __s64;
33typedef unsigned long long __u64;
34#endif
35
36#endif /* __ASSEMBLY__ */
37
38
39#endif /* _UAPI_ASM_GENERIC_INT_LL64_H */
diff --git a/include/uapi/asm-generic/ioctl.h b/include/uapi/asm-generic/ioctl.h
new file mode 100644
index 000000000000..7e7c11b52143
--- /dev/null
+++ b/include/uapi/asm-generic/ioctl.h
@@ -0,0 +1,98 @@
1#ifndef _UAPI_ASM_GENERIC_IOCTL_H
2#define _UAPI_ASM_GENERIC_IOCTL_H
3
4/* ioctl command encoding: 32 bits total, command in lower 16 bits,
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
13
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24
25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
37
38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
40#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
41#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
42
43#define _IOC_NRSHIFT 0
44#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
45#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
47
48/*
49 * Direction bits, which any architecture can choose to override
50 * before including this file.
51 */
52
53#ifndef _IOC_NONE
54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
64
65#define _IOC(dir,type,nr,size) \
66 (((dir) << _IOC_DIRSHIFT) | \
67 ((type) << _IOC_TYPESHIFT) | \
68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT))
70
71#ifndef __KERNEL__
72#define _IOC_TYPECHECK(t) (sizeof(t))
73#endif
74
75/* used to create numbers */
76#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
77#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
78#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
79#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
80#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
81#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
82#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
83
84/* used to decode ioctl numbers.. */
85#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
86#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
87#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
88#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
89
90/* ...and for the drivers/sound files... */
91
92#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
93#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
94#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
95#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
96#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
97
98#endif /* _UAPI_ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h
index 199975fac395..199975fac395 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/uapi/asm-generic/ioctls.h
diff --git a/include/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
index 76982b2a1b58..76982b2a1b58 100644
--- a/include/asm-generic/ipcbuf.h
+++ b/include/uapi/asm-generic/ipcbuf.h
diff --git a/include/uapi/asm-generic/kvm_para.h b/include/uapi/asm-generic/kvm_para.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/include/uapi/asm-generic/kvm_para.h
diff --git a/include/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index d030d2c2647a..d030d2c2647a 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
diff --git a/include/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
index 32c8bd6a196d..32c8bd6a196d 100644
--- a/include/asm-generic/mman.h
+++ b/include/uapi/asm-generic/mman.h
diff --git a/include/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index aec850d9159e..aec850d9159e 100644
--- a/include/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
diff --git a/include/uapi/asm-generic/param.h b/include/uapi/asm-generic/param.h
new file mode 100644
index 000000000000..5becc84396b8
--- /dev/null
+++ b/include/uapi/asm-generic/param.h
@@ -0,0 +1,19 @@
1#ifndef _UAPI__ASM_GENERIC_PARAM_H
2#define _UAPI__ASM_GENERIC_PARAM_H
3
4#ifndef HZ
5#define HZ 100
6#endif
7
8#ifndef EXEC_PAGESIZE
9#define EXEC_PAGESIZE 4096
10#endif
11
12#ifndef NOGROUP
13#define NOGROUP (-1)
14#endif
15
16#define MAXHOSTNAMELEN 64 /* max length of hostname */
17
18
19#endif /* _UAPI__ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/poll.h b/include/uapi/asm-generic/poll.h
index 9ce7f44aebd2..9ce7f44aebd2 100644
--- a/include/asm-generic/poll.h
+++ b/include/uapi/asm-generic/poll.h
diff --git a/include/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h
index fe74fccf18db..fe74fccf18db 100644
--- a/include/asm-generic/posix_types.h
+++ b/include/uapi/asm-generic/posix_types.h
diff --git a/include/uapi/asm-generic/resource.h b/include/uapi/asm-generic/resource.h
new file mode 100644
index 000000000000..f863428796d5
--- /dev/null
+++ b/include/uapi/asm-generic/resource.h
@@ -0,0 +1,68 @@
1#ifndef _UAPI_ASM_GENERIC_RESOURCE_H
2#define _UAPI_ASM_GENERIC_RESOURCE_H
3
4/*
5 * Resource limit IDs
6 *
7 * ( Compatibility detail: there are architectures that have
8 * a different rlimit ID order in the 5-9 range and want
9 * to keep that order for binary compatibility. The reasons
10 * are historic and all new rlimits are identical across all
11 * arches. If an arch has such special order for some rlimits
12 * then it defines them prior including asm-generic/resource.h. )
13 */
14
15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */
19#define RLIMIT_CORE 4 /* max core file size */
20
21#ifndef RLIMIT_RSS
22# define RLIMIT_RSS 5 /* max resident set size */
23#endif
24
25#ifndef RLIMIT_NPROC
26# define RLIMIT_NPROC 6 /* max number of processes */
27#endif
28
29#ifndef RLIMIT_NOFILE
30# define RLIMIT_NOFILE 7 /* max number of open files */
31#endif
32
33#ifndef RLIMIT_MEMLOCK
34# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
35#endif
36
37#ifndef RLIMIT_AS
38# define RLIMIT_AS 9 /* address space limit */
39#endif
40
41#define RLIMIT_LOCKS 10 /* maximum file locks held */
42#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
43#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
44#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
45 0-39 for nice level 19 .. -20 */
46#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
47#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
48#define RLIM_NLIMITS 16
49
50/*
51 * SuS says limits have to be unsigned.
52 * Which makes a ton more sense anyway.
53 *
54 * Some architectures override this (for compatibility reasons):
55 */
56#ifndef RLIM_INFINITY
57# define RLIM_INFINITY (~0UL)
58#endif
59
60/*
61 * RLIMIT_STACK default maximum - some architectures override it:
62 */
63#ifndef _STK_LIM_MAX
64# define _STK_LIM_MAX RLIM_INFINITY
65#endif
66
67
68#endif /* _UAPI_ASM_GENERIC_RESOURCE_H */
diff --git a/include/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
index 4cb2c13e5090..4cb2c13e5090 100644
--- a/include/asm-generic/sembuf.h
+++ b/include/uapi/asm-generic/sembuf.h
diff --git a/include/asm-generic/setup.h b/include/uapi/asm-generic/setup.h
index 6fc26a51003c..6fc26a51003c 100644
--- a/include/asm-generic/setup.h
+++ b/include/uapi/asm-generic/setup.h
diff --git a/include/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 5768fa60ac82..5768fa60ac82 100644
--- a/include/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
diff --git a/include/asm-generic/shmparam.h b/include/uapi/asm-generic/shmparam.h
index 51a3852de733..51a3852de733 100644
--- a/include/asm-generic/shmparam.h
+++ b/include/uapi/asm-generic/shmparam.h
diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h
new file mode 100644
index 000000000000..ba5be7fdbdfe
--- /dev/null
+++ b/include/uapi/asm-generic/siginfo.h
@@ -0,0 +1,298 @@
1#ifndef _UAPI_ASM_GENERIC_SIGINFO_H
2#define _UAPI_ASM_GENERIC_SIGINFO_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12/*
13 * This is the size (including padding) of the part of the
14 * struct siginfo that is before the union.
15 */
16#ifndef __ARCH_SI_PREAMBLE_SIZE
17#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
18#endif
19
20#define SI_MAX_SIZE 128
21#ifndef SI_PAD_SIZE
22#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
23#endif
24
25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif
28
29/*
30 * The default "si_band" type is "long", as specified by POSIX.
31 * However, some architectures want to override this to "int"
32 * for historical compatibility reasons, so we allow that.
33 */
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef __ARCH_SI_CLOCK_T
39#define __ARCH_SI_CLOCK_T __kernel_clock_t
40#endif
41
42#ifndef __ARCH_SI_ATTRIBUTES
43#define __ARCH_SI_ATTRIBUTES
44#endif
45
46#ifndef HAVE_ARCH_SIGINFO_T
47
48typedef struct siginfo {
49 int si_signo;
50 int si_errno;
51 int si_code;
52
53 union {
54 int _pad[SI_PAD_SIZE];
55
56 /* kill() */
57 struct {
58 __kernel_pid_t _pid; /* sender's pid */
59 __ARCH_SI_UID_T _uid; /* sender's uid */
60 } _kill;
61
62 /* POSIX.1b timers */
63 struct {
64 __kernel_timer_t _tid; /* timer id */
65 int _overrun; /* overrun count */
66 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
67 sigval_t _sigval; /* same as below */
68 int _sys_private; /* not to be passed to user */
69 } _timer;
70
71 /* POSIX.1b signals */
72 struct {
73 __kernel_pid_t _pid; /* sender's pid */
74 __ARCH_SI_UID_T _uid; /* sender's uid */
75 sigval_t _sigval;
76 } _rt;
77
78 /* SIGCHLD */
79 struct {
80 __kernel_pid_t _pid; /* which child */
81 __ARCH_SI_UID_T _uid; /* sender's uid */
82 int _status; /* exit code */
83 __ARCH_SI_CLOCK_T _utime;
84 __ARCH_SI_CLOCK_T _stime;
85 } _sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90#ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92#endif
93 short _addr_lsb; /* LSB of the reported address */
94 } _sigfault;
95
96 /* SIGPOLL */
97 struct {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd;
100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
108 } _sifields;
109} __ARCH_SI_ATTRIBUTES siginfo_t;
110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
113#endif
114
115/*
116 * How these fields are to be accessed.
117 */
118#define si_pid _sifields._kill._pid
119#define si_uid _sifields._kill._uid
120#define si_tid _sifields._timer._tid
121#define si_overrun _sifields._timer._overrun
122#define si_sys_private _sifields._timer._sys_private
123#define si_status _sifields._sigchld._status
124#define si_utime _sifields._sigchld._utime
125#define si_stime _sifields._sigchld._stime
126#define si_value _sifields._rt._sigval
127#define si_int _sifields._rt._sigval.sival_int
128#define si_ptr _sifields._rt._sigval.sival_ptr
129#define si_addr _sifields._sigfault._addr
130#ifdef __ARCH_SI_TRAPNO
131#define si_trapno _sifields._sigfault._trapno
132#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb
134#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
141
142#ifndef __KERNEL__
143#define __SI_KILL 0
144#define __SI_TIMER 0
145#define __SI_POLL 0
146#define __SI_FAULT 0
147#define __SI_CHLD 0
148#define __SI_RT 0
149#define __SI_MESGQ 0
150#define __SI_SYS 0
151#define __SI_CODE(T,N) (N)
152#endif
153
154/*
155 * si_code values
156 * Digital reserves positive values for kernel-generated signals.
157 */
158#define SI_USER 0 /* sent by kill, sigsend, raise */
159#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
160#define SI_QUEUE -1 /* sent by sigqueue */
161#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
162#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
163#define SI_ASYNCIO -4 /* sent by AIO completion */
164#define SI_SIGIO -5 /* sent by queued SIGIO */
165#define SI_TKILL -6 /* sent by tkill system call */
166#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
167
168#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
169#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
170
171/*
172 * SIGILL si_codes
173 */
174#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
175#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
176#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
177#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
178#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
179#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
180#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
181#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
182#define NSIGILL 8
183
184/*
185 * SIGFPE si_codes
186 */
187#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
188#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
189#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
190#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
191#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
192#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
193#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
194#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
195#define NSIGFPE 8
196
197/*
198 * SIGSEGV si_codes
199 */
200#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
201#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
202#define NSIGSEGV 2
203
204/*
205 * SIGBUS si_codes
206 */
207#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
208#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
209#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
210/* hardware memory error consumed on a machine check: action required */
211#define BUS_MCEERR_AR (__SI_FAULT|4)
212/* hardware memory error detected in process but not consumed: action optional*/
213#define BUS_MCEERR_AO (__SI_FAULT|5)
214#define NSIGBUS 5
215
216/*
217 * SIGTRAP si_codes
218 */
219#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
220#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
221#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
222#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
223#define NSIGTRAP 4
224
225/*
226 * SIGCHLD si_codes
227 */
228#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
229#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
230#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
231#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
232#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
233#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
234#define NSIGCHLD 6
235
236/*
237 * SIGPOLL si_codes
238 */
239#define POLL_IN (__SI_POLL|1) /* data input available */
240#define POLL_OUT (__SI_POLL|2) /* output buffers available */
241#define POLL_MSG (__SI_POLL|3) /* input message available */
242#define POLL_ERR (__SI_POLL|4) /* i/o error */
243#define POLL_PRI (__SI_POLL|5) /* high priority input available */
244#define POLL_HUP (__SI_POLL|6) /* device disconnected */
245#define NSIGPOLL 6
246
247/*
248 * SIGSYS si_codes
249 */
250#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
251#define NSIGSYS 1
252
253/*
254 * sigevent definitions
255 *
256 * It seems likely that SIGEV_THREAD will have to be handled from
257 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
258 * thread manager then catches and does the appropriate nonsense.
259 * However, everything is written out here so as to not get lost.
260 */
261#define SIGEV_SIGNAL 0 /* notify via signal */
262#define SIGEV_NONE 1 /* other notification: meaningless */
263#define SIGEV_THREAD 2 /* deliver via thread creation */
264#define SIGEV_THREAD_ID 4 /* deliver to thread */
265
266/*
267 * This works because the alignment is ok on all current architectures
268 * but we leave open this being overridden in the future
269 */
270#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
271#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
272#endif
273
274#define SIGEV_MAX_SIZE 64
275#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
276 / sizeof(int))
277
278typedef struct sigevent {
279 sigval_t sigev_value;
280 int sigev_signo;
281 int sigev_notify;
282 union {
283 int _pad[SIGEV_PAD_SIZE];
284 int _tid;
285
286 struct {
287 void (*_function)(sigval_t);
288 void *_attribute; /* really pthread_attr_t */
289 } _sigev_thread;
290 } _sigev_un;
291} sigevent_t;
292
293#define sigev_notify_function _sigev_un._sigev_thread._function
294#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
295#define sigev_notify_thread_id _sigev_un._tid
296
297
298#endif /* _UAPI_ASM_GENERIC_SIGINFO_H */
diff --git a/include/asm-generic/signal-defs.h b/include/uapi/asm-generic/signal-defs.h
index 00f95df54297..00f95df54297 100644
--- a/include/asm-generic/signal-defs.h
+++ b/include/uapi/asm-generic/signal-defs.h
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
new file mode 100644
index 000000000000..0a78028984de
--- /dev/null
+++ b/include/uapi/asm-generic/signal.h
@@ -0,0 +1,123 @@
1#ifndef _UAPI__ASM_GENERIC_SIGNAL_H
2#define _UAPI__ASM_GENERIC_SIGNAL_H
3
4#include <linux/types.h>
5
6#define _NSIG 64
7#define _NSIG_BPW __BITS_PER_LONG
8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9
10#define SIGHUP 1
11#define SIGINT 2
12#define SIGQUIT 3
13#define SIGILL 4
14#define SIGTRAP 5
15#define SIGABRT 6
16#define SIGIOT 6
17#define SIGBUS 7
18#define SIGFPE 8
19#define SIGKILL 9
20#define SIGUSR1 10
21#define SIGSEGV 11
22#define SIGUSR2 12
23#define SIGPIPE 13
24#define SIGALRM 14
25#define SIGTERM 15
26#define SIGSTKFLT 16
27#define SIGCHLD 17
28#define SIGCONT 18
29#define SIGSTOP 19
30#define SIGTSTP 20
31#define SIGTTIN 21
32#define SIGTTOU 22
33#define SIGURG 23
34#define SIGXCPU 24
35#define SIGXFSZ 25
36#define SIGVTALRM 26
37#define SIGPROF 27
38#define SIGWINCH 28
39#define SIGIO 29
40#define SIGPOLL SIGIO
41/*
42#define SIGLOST 29
43*/
44#define SIGPWR 30
45#define SIGSYS 31
46#define SIGUNUSED 31
47
48/* These should not be considered constants from userland. */
49#define SIGRTMIN 32
50#ifndef SIGRTMAX
51#define SIGRTMAX _NSIG
52#endif
53
54/*
55 * SA_FLAGS values:
56 *
57 * SA_ONSTACK indicates that a registered stack_t will be used.
58 * SA_RESTART flag to get restarting signals (which were the default long ago)
59 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
60 * SA_RESETHAND clears the handler when the signal is delivered.
61 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
62 * SA_NODEFER prevents the current signal from being masked in the handler.
63 *
64 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
65 * Unix names RESETHAND and NODEFER respectively.
66 */
67#define SA_NOCLDSTOP 0x00000001
68#define SA_NOCLDWAIT 0x00000002
69#define SA_SIGINFO 0x00000004
70#define SA_ONSTACK 0x08000000
71#define SA_RESTART 0x10000000
72#define SA_NODEFER 0x40000000
73#define SA_RESETHAND 0x80000000
74
75#define SA_NOMASK SA_NODEFER
76#define SA_ONESHOT SA_RESETHAND
77
78/*
79 * New architectures should not define the obsolete
80 * SA_RESTORER 0x04000000
81 */
82
83/*
84 * sigaltstack controls
85 */
86#define SS_ONSTACK 1
87#define SS_DISABLE 2
88
89#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192
91
92#ifndef __ASSEMBLY__
93typedef struct {
94 unsigned long sig[_NSIG_WORDS];
95} sigset_t;
96
97/* not actually used, but required for linux/syscalls.h */
98typedef unsigned long old_sigset_t;
99
100#include <asm-generic/signal-defs.h>
101
102struct sigaction {
103 __sighandler_t sa_handler;
104 unsigned long sa_flags;
105#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
107#endif
108 sigset_t sa_mask; /* mask last for extensibility */
109};
110
111struct k_sigaction {
112 struct sigaction sa;
113};
114
115typedef struct sigaltstack {
116 void __user *ss_sp;
117 int ss_flags;
118 size_t ss_size;
119} stack_t;
120
121#endif /* __ASSEMBLY__ */
122
123#endif /* _UAPI__ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index b1bea03274d5..b1bea03274d5 100644
--- a/include/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
diff --git a/include/asm-generic/sockios.h b/include/uapi/asm-generic/sockios.h
index 9a61a369b901..9a61a369b901 100644
--- a/include/asm-generic/sockios.h
+++ b/include/uapi/asm-generic/sockios.h
diff --git a/include/asm-generic/stat.h b/include/uapi/asm-generic/stat.h
index bd8cad21998e..bd8cad21998e 100644
--- a/include/asm-generic/stat.h
+++ b/include/uapi/asm-generic/stat.h
diff --git a/include/uapi/asm-generic/statfs.h b/include/uapi/asm-generic/statfs.h
new file mode 100644
index 000000000000..0999647fca13
--- /dev/null
+++ b/include/uapi/asm-generic/statfs.h
@@ -0,0 +1,83 @@
1#ifndef _UAPI_GENERIC_STATFS_H
2#define _UAPI_GENERIC_STATFS_H
3
4#include <linux/types.h>
5
6
7/*
8 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
9 * Yes, they differ in signedness as well as size.
10 * Special cases can override it for themselves -- except for S390x, which
11 * is just a little too special for us. And MIPS, which I'm not touching
12 * with a 10' pole.
13 */
14#ifndef __statfs_word
15#if __BITS_PER_LONG == 64
16#define __statfs_word long
17#else
18#define __statfs_word __u32
19#endif
20#endif
21
22struct statfs {
23 __statfs_word f_type;
24 __statfs_word f_bsize;
25 __statfs_word f_blocks;
26 __statfs_word f_bfree;
27 __statfs_word f_bavail;
28 __statfs_word f_files;
29 __statfs_word f_ffree;
30 __kernel_fsid_t f_fsid;
31 __statfs_word f_namelen;
32 __statfs_word f_frsize;
33 __statfs_word f_flags;
34 __statfs_word f_spare[4];
35};
36
37/*
38 * ARM needs to avoid the 32-bit padding at the end, for consistency
39 * between EABI and OABI
40 */
41#ifndef ARCH_PACK_STATFS64
42#define ARCH_PACK_STATFS64
43#endif
44
45struct statfs64 {
46 __statfs_word f_type;
47 __statfs_word f_bsize;
48 __u64 f_blocks;
49 __u64 f_bfree;
50 __u64 f_bavail;
51 __u64 f_files;
52 __u64 f_ffree;
53 __kernel_fsid_t f_fsid;
54 __statfs_word f_namelen;
55 __statfs_word f_frsize;
56 __statfs_word f_flags;
57 __statfs_word f_spare[4];
58} ARCH_PACK_STATFS64;
59
60/*
61 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
62 * to be compatible with the i386 ABI
63 */
64#ifndef ARCH_PACK_COMPAT_STATFS64
65#define ARCH_PACK_COMPAT_STATFS64
66#endif
67
68struct compat_statfs64 {
69 __u32 f_type;
70 __u32 f_bsize;
71 __u64 f_blocks;
72 __u64 f_bfree;
73 __u64 f_bavail;
74 __u64 f_files;
75 __u64 f_ffree;
76 __kernel_fsid_t f_fsid;
77 __u32 f_namelen;
78 __u32 f_frsize;
79 __u32 f_flags;
80 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64;
82
83#endif /* _UAPI_GENERIC_STATFS_H */
diff --git a/include/asm-generic/swab.h b/include/uapi/asm-generic/swab.h
index a8e9029d9eba..a8e9029d9eba 100644
--- a/include/asm-generic/swab.h
+++ b/include/uapi/asm-generic/swab.h
diff --git a/include/asm-generic/termbits.h b/include/uapi/asm-generic/termbits.h
index 232b4781aef3..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/uapi/asm-generic/termbits.h
diff --git a/include/uapi/asm-generic/termios.h b/include/uapi/asm-generic/termios.h
new file mode 100644
index 000000000000..088176062133
--- /dev/null
+++ b/include/uapi/asm-generic/termios.h
@@ -0,0 +1,50 @@
1#ifndef _UAPI_ASM_GENERIC_TERMIOS_H
2#define _UAPI_ASM_GENERIC_TERMIOS_H
3/*
4 * Most architectures have straight copies of the x86 code, with
5 * varying levels of bug fixes on top. Usually it's a good idea
6 * to use this generic version instead, but be careful to avoid
7 * ABI changes.
8 * New architectures should not provide their own version.
9 */
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49
50#endif /* _UAPI_ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/types.h b/include/uapi/asm-generic/types.h
index bd39806013b5..bd39806013b5 100644
--- a/include/asm-generic/types.h
+++ b/include/uapi/asm-generic/types.h
diff --git a/include/asm-generic/ucontext.h b/include/uapi/asm-generic/ucontext.h
index ad77343e8a9a..ad77343e8a9a 100644
--- a/include/asm-generic/ucontext.h
+++ b/include/uapi/asm-generic/ucontext.h
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
new file mode 100644
index 000000000000..6e595ba545f4
--- /dev/null
+++ b/include/uapi/asm-generic/unistd.h
@@ -0,0 +1,902 @@
1#include <asm/bitsperlong.h>
2
3/*
4 * This file contains the system call numbers, based on the
5 * layout of the x86-64 architecture, which embeds the
6 * pointer to the syscall in the table.
7 *
8 * As a basic principle, no duplication of functionality
9 * should be added, e.g. we don't use lseek when llseek
10 * is present. New architectures should use this file
11 * and implement the less feature-full calls in user space.
12 */
13
14#ifndef __SYSCALL
15#define __SYSCALL(x, y)
16#endif
17
18#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
19#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
20#else
21#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
22#endif
23
24#ifdef __SYSCALL_COMPAT
25#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
26#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
27#else
28#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
29#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
30#endif
31
32#define __NR_io_setup 0
33__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
34#define __NR_io_destroy 1
35__SYSCALL(__NR_io_destroy, sys_io_destroy)
36#define __NR_io_submit 2
37__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
38#define __NR_io_cancel 3
39__SYSCALL(__NR_io_cancel, sys_io_cancel)
40#define __NR_io_getevents 4
41__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
42
43/* fs/xattr.c */
44#define __NR_setxattr 5
45__SYSCALL(__NR_setxattr, sys_setxattr)
46#define __NR_lsetxattr 6
47__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
48#define __NR_fsetxattr 7
49__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
50#define __NR_getxattr 8
51__SYSCALL(__NR_getxattr, sys_getxattr)
52#define __NR_lgetxattr 9
53__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
54#define __NR_fgetxattr 10
55__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
56#define __NR_listxattr 11
57__SYSCALL(__NR_listxattr, sys_listxattr)
58#define __NR_llistxattr 12
59__SYSCALL(__NR_llistxattr, sys_llistxattr)
60#define __NR_flistxattr 13
61__SYSCALL(__NR_flistxattr, sys_flistxattr)
62#define __NR_removexattr 14
63__SYSCALL(__NR_removexattr, sys_removexattr)
64#define __NR_lremovexattr 15
65__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
66#define __NR_fremovexattr 16
67__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
68
69/* fs/dcache.c */
70#define __NR_getcwd 17
71__SYSCALL(__NR_getcwd, sys_getcwd)
72
73/* fs/cookies.c */
74#define __NR_lookup_dcookie 18
75__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
76
77/* fs/eventfd.c */
78#define __NR_eventfd2 19
79__SYSCALL(__NR_eventfd2, sys_eventfd2)
80
81/* fs/eventpoll.c */
82#define __NR_epoll_create1 20
83__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
84#define __NR_epoll_ctl 21
85__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
86#define __NR_epoll_pwait 22
87__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
88
89/* fs/fcntl.c */
90#define __NR_dup 23
91__SYSCALL(__NR_dup, sys_dup)
92#define __NR_dup3 24
93__SYSCALL(__NR_dup3, sys_dup3)
94#define __NR3264_fcntl 25
95__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
96
97/* fs/inotify_user.c */
98#define __NR_inotify_init1 26
99__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
100#define __NR_inotify_add_watch 27
101__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
102#define __NR_inotify_rm_watch 28
103__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
104
105/* fs/ioctl.c */
106#define __NR_ioctl 29
107__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
108
109/* fs/ioprio.c */
110#define __NR_ioprio_set 30
111__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
112#define __NR_ioprio_get 31
113__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
114
115/* fs/locks.c */
116#define __NR_flock 32
117__SYSCALL(__NR_flock, sys_flock)
118
119/* fs/namei.c */
120#define __NR_mknodat 33
121__SYSCALL(__NR_mknodat, sys_mknodat)
122#define __NR_mkdirat 34
123__SYSCALL(__NR_mkdirat, sys_mkdirat)
124#define __NR_unlinkat 35
125__SYSCALL(__NR_unlinkat, sys_unlinkat)
126#define __NR_symlinkat 36
127__SYSCALL(__NR_symlinkat, sys_symlinkat)
128#define __NR_linkat 37
129__SYSCALL(__NR_linkat, sys_linkat)
130#define __NR_renameat 38
131__SYSCALL(__NR_renameat, sys_renameat)
132
133/* fs/namespace.c */
134#define __NR_umount2 39
135__SYSCALL(__NR_umount2, sys_umount)
136#define __NR_mount 40
137__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
138#define __NR_pivot_root 41
139__SYSCALL(__NR_pivot_root, sys_pivot_root)
140
141/* fs/nfsctl.c */
142#define __NR_nfsservctl 42
143__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
144
145/* fs/open.c */
146#define __NR3264_statfs 43
147__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
148 compat_sys_statfs64)
149#define __NR3264_fstatfs 44
150__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
151 compat_sys_fstatfs64)
152#define __NR3264_truncate 45
153__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
154 compat_sys_truncate64)
155#define __NR3264_ftruncate 46
156__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
157 compat_sys_ftruncate64)
158
159#define __NR_fallocate 47
160__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
161#define __NR_faccessat 48
162__SYSCALL(__NR_faccessat, sys_faccessat)
163#define __NR_chdir 49
164__SYSCALL(__NR_chdir, sys_chdir)
165#define __NR_fchdir 50
166__SYSCALL(__NR_fchdir, sys_fchdir)
167#define __NR_chroot 51
168__SYSCALL(__NR_chroot, sys_chroot)
169#define __NR_fchmod 52
170__SYSCALL(__NR_fchmod, sys_fchmod)
171#define __NR_fchmodat 53
172__SYSCALL(__NR_fchmodat, sys_fchmodat)
173#define __NR_fchownat 54
174__SYSCALL(__NR_fchownat, sys_fchownat)
175#define __NR_fchown 55
176__SYSCALL(__NR_fchown, sys_fchown)
177#define __NR_openat 56
178__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
179#define __NR_close 57
180__SYSCALL(__NR_close, sys_close)
181#define __NR_vhangup 58
182__SYSCALL(__NR_vhangup, sys_vhangup)
183
184/* fs/pipe.c */
185#define __NR_pipe2 59
186__SYSCALL(__NR_pipe2, sys_pipe2)
187
188/* fs/quota.c */
189#define __NR_quotactl 60
190__SYSCALL(__NR_quotactl, sys_quotactl)
191
192/* fs/readdir.c */
193#define __NR_getdents64 61
194__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
195
196/* fs/read_write.c */
197#define __NR3264_lseek 62
198__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
199#define __NR_read 63
200__SYSCALL(__NR_read, sys_read)
201#define __NR_write 64
202__SYSCALL(__NR_write, sys_write)
203#define __NR_readv 65
204__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
205#define __NR_writev 66
206__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
207#define __NR_pread64 67
208__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
209#define __NR_pwrite64 68
210__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
211#define __NR_preadv 69
212__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
213#define __NR_pwritev 70
214__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
215
216/* fs/sendfile.c */
217#define __NR3264_sendfile 71
218__SYSCALL(__NR3264_sendfile, sys_sendfile64)
219
220/* fs/select.c */
221#define __NR_pselect6 72
222__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
223#define __NR_ppoll 73
224__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
225
226/* fs/signalfd.c */
227#define __NR_signalfd4 74
228__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
229
230/* fs/splice.c */
231#define __NR_vmsplice 75
232__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
233#define __NR_splice 76
234__SYSCALL(__NR_splice, sys_splice)
235#define __NR_tee 77
236__SYSCALL(__NR_tee, sys_tee)
237
238/* fs/stat.c */
239#define __NR_readlinkat 78
240__SYSCALL(__NR_readlinkat, sys_readlinkat)
241#define __NR3264_fstatat 79
242__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
243#define __NR3264_fstat 80
244__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
245
246/* fs/sync.c */
247#define __NR_sync 81
248__SYSCALL(__NR_sync, sys_sync)
249#define __NR_fsync 82
250__SYSCALL(__NR_fsync, sys_fsync)
251#define __NR_fdatasync 83
252__SYSCALL(__NR_fdatasync, sys_fdatasync)
253#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
254#define __NR_sync_file_range2 84
255__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
256 compat_sys_sync_file_range2)
257#else
258#define __NR_sync_file_range 84
259__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
260 compat_sys_sync_file_range)
261#endif
262
263/* fs/timerfd.c */
264#define __NR_timerfd_create 85
265__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
266#define __NR_timerfd_settime 86
267__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
268 compat_sys_timerfd_settime)
269#define __NR_timerfd_gettime 87
270__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
271 compat_sys_timerfd_gettime)
272
273/* fs/utimes.c */
274#define __NR_utimensat 88
275__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
276
277/* kernel/acct.c */
278#define __NR_acct 89
279__SYSCALL(__NR_acct, sys_acct)
280
281/* kernel/capability.c */
282#define __NR_capget 90
283__SYSCALL(__NR_capget, sys_capget)
284#define __NR_capset 91
285__SYSCALL(__NR_capset, sys_capset)
286
287/* kernel/exec_domain.c */
288#define __NR_personality 92
289__SYSCALL(__NR_personality, sys_personality)
290
291/* kernel/exit.c */
292#define __NR_exit 93
293__SYSCALL(__NR_exit, sys_exit)
294#define __NR_exit_group 94
295__SYSCALL(__NR_exit_group, sys_exit_group)
296#define __NR_waitid 95
297__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
298
299/* kernel/fork.c */
300#define __NR_set_tid_address 96
301__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
302#define __NR_unshare 97
303__SYSCALL(__NR_unshare, sys_unshare)
304
305/* kernel/futex.c */
306#define __NR_futex 98
307__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
308#define __NR_set_robust_list 99
309__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
310 compat_sys_set_robust_list)
311#define __NR_get_robust_list 100
312__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
313 compat_sys_get_robust_list)
314
315/* kernel/hrtimer.c */
316#define __NR_nanosleep 101
317__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
318
319/* kernel/itimer.c */
320#define __NR_getitimer 102
321__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
322#define __NR_setitimer 103
323__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
324
325/* kernel/kexec.c */
326#define __NR_kexec_load 104
327__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
328
329/* kernel/module.c */
330#define __NR_init_module 105
331__SYSCALL(__NR_init_module, sys_init_module)
332#define __NR_delete_module 106
333__SYSCALL(__NR_delete_module, sys_delete_module)
334
335/* kernel/posix-timers.c */
336#define __NR_timer_create 107
337__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
338#define __NR_timer_gettime 108
339__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
340#define __NR_timer_getoverrun 109
341__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
342#define __NR_timer_settime 110
343__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
344#define __NR_timer_delete 111
345__SYSCALL(__NR_timer_delete, sys_timer_delete)
346#define __NR_clock_settime 112
347__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
348#define __NR_clock_gettime 113
349__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
350#define __NR_clock_getres 114
351__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
352#define __NR_clock_nanosleep 115
353__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
354 compat_sys_clock_nanosleep)
355
356/* kernel/printk.c */
357#define __NR_syslog 116
358__SYSCALL(__NR_syslog, sys_syslog)
359
360/* kernel/ptrace.c */
361#define __NR_ptrace 117
362__SYSCALL(__NR_ptrace, sys_ptrace)
363
364/* kernel/sched.c */
365#define __NR_sched_setparam 118
366__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
367#define __NR_sched_setscheduler 119
368__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
369#define __NR_sched_getscheduler 120
370__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
371#define __NR_sched_getparam 121
372__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
373#define __NR_sched_setaffinity 122
374__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
375 compat_sys_sched_setaffinity)
376#define __NR_sched_getaffinity 123
377__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
378 compat_sys_sched_getaffinity)
379#define __NR_sched_yield 124
380__SYSCALL(__NR_sched_yield, sys_sched_yield)
381#define __NR_sched_get_priority_max 125
382__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
383#define __NR_sched_get_priority_min 126
384__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
385#define __NR_sched_rr_get_interval 127
386__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
387 compat_sys_sched_rr_get_interval)
388
389/* kernel/signal.c */
390#define __NR_restart_syscall 128
391__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
392#define __NR_kill 129
393__SYSCALL(__NR_kill, sys_kill)
394#define __NR_tkill 130
395__SYSCALL(__NR_tkill, sys_tkill)
396#define __NR_tgkill 131
397__SYSCALL(__NR_tgkill, sys_tgkill)
398#define __NR_sigaltstack 132
399__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
400#define __NR_rt_sigsuspend 133
401__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
402#define __NR_rt_sigaction 134
403__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
404#define __NR_rt_sigprocmask 135
405__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
406#define __NR_rt_sigpending 136
407__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
408#define __NR_rt_sigtimedwait 137
409__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
410 compat_sys_rt_sigtimedwait)
411#define __NR_rt_sigqueueinfo 138
412__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
413 compat_sys_rt_sigqueueinfo)
414#define __NR_rt_sigreturn 139
415__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
416
417/* kernel/sys.c */
418#define __NR_setpriority 140
419__SYSCALL(__NR_setpriority, sys_setpriority)
420#define __NR_getpriority 141
421__SYSCALL(__NR_getpriority, sys_getpriority)
422#define __NR_reboot 142
423__SYSCALL(__NR_reboot, sys_reboot)
424#define __NR_setregid 143
425__SYSCALL(__NR_setregid, sys_setregid)
426#define __NR_setgid 144
427__SYSCALL(__NR_setgid, sys_setgid)
428#define __NR_setreuid 145
429__SYSCALL(__NR_setreuid, sys_setreuid)
430#define __NR_setuid 146
431__SYSCALL(__NR_setuid, sys_setuid)
432#define __NR_setresuid 147
433__SYSCALL(__NR_setresuid, sys_setresuid)
434#define __NR_getresuid 148
435__SYSCALL(__NR_getresuid, sys_getresuid)
436#define __NR_setresgid 149
437__SYSCALL(__NR_setresgid, sys_setresgid)
438#define __NR_getresgid 150
439__SYSCALL(__NR_getresgid, sys_getresgid)
440#define __NR_setfsuid 151
441__SYSCALL(__NR_setfsuid, sys_setfsuid)
442#define __NR_setfsgid 152
443__SYSCALL(__NR_setfsgid, sys_setfsgid)
444#define __NR_times 153
445__SC_COMP(__NR_times, sys_times, compat_sys_times)
446#define __NR_setpgid 154
447__SYSCALL(__NR_setpgid, sys_setpgid)
448#define __NR_getpgid 155
449__SYSCALL(__NR_getpgid, sys_getpgid)
450#define __NR_getsid 156
451__SYSCALL(__NR_getsid, sys_getsid)
452#define __NR_setsid 157
453__SYSCALL(__NR_setsid, sys_setsid)
454#define __NR_getgroups 158
455__SYSCALL(__NR_getgroups, sys_getgroups)
456#define __NR_setgroups 159
457__SYSCALL(__NR_setgroups, sys_setgroups)
458#define __NR_uname 160
459__SYSCALL(__NR_uname, sys_newuname)
460#define __NR_sethostname 161
461__SYSCALL(__NR_sethostname, sys_sethostname)
462#define __NR_setdomainname 162
463__SYSCALL(__NR_setdomainname, sys_setdomainname)
464#define __NR_getrlimit 163
465__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
466#define __NR_setrlimit 164
467__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
468#define __NR_getrusage 165
469__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
470#define __NR_umask 166
471__SYSCALL(__NR_umask, sys_umask)
472#define __NR_prctl 167
473__SYSCALL(__NR_prctl, sys_prctl)
474#define __NR_getcpu 168
475__SYSCALL(__NR_getcpu, sys_getcpu)
476
477/* kernel/time.c */
478#define __NR_gettimeofday 169
479__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
480#define __NR_settimeofday 170
481__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
482#define __NR_adjtimex 171
483__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
484
485/* kernel/timer.c */
486#define __NR_getpid 172
487__SYSCALL(__NR_getpid, sys_getpid)
488#define __NR_getppid 173
489__SYSCALL(__NR_getppid, sys_getppid)
490#define __NR_getuid 174
491__SYSCALL(__NR_getuid, sys_getuid)
492#define __NR_geteuid 175
493__SYSCALL(__NR_geteuid, sys_geteuid)
494#define __NR_getgid 176
495__SYSCALL(__NR_getgid, sys_getgid)
496#define __NR_getegid 177
497__SYSCALL(__NR_getegid, sys_getegid)
498#define __NR_gettid 178
499__SYSCALL(__NR_gettid, sys_gettid)
500#define __NR_sysinfo 179
501__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
502
503/* ipc/mqueue.c */
504#define __NR_mq_open 180
505__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
506#define __NR_mq_unlink 181
507__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
508#define __NR_mq_timedsend 182
509__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
510#define __NR_mq_timedreceive 183
511__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
512 compat_sys_mq_timedreceive)
513#define __NR_mq_notify 184
514__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
515#define __NR_mq_getsetattr 185
516__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
517
518/* ipc/msg.c */
519#define __NR_msgget 186
520__SYSCALL(__NR_msgget, sys_msgget)
521#define __NR_msgctl 187
522__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
523#define __NR_msgrcv 188
524__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
525#define __NR_msgsnd 189
526__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
527
528/* ipc/sem.c */
529#define __NR_semget 190
530__SYSCALL(__NR_semget, sys_semget)
531#define __NR_semctl 191
532__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
533#define __NR_semtimedop 192
534__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
535#define __NR_semop 193
536__SYSCALL(__NR_semop, sys_semop)
537
538/* ipc/shm.c */
539#define __NR_shmget 194
540__SYSCALL(__NR_shmget, sys_shmget)
541#define __NR_shmctl 195
542__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
543#define __NR_shmat 196
544__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
545#define __NR_shmdt 197
546__SYSCALL(__NR_shmdt, sys_shmdt)
547
548/* net/socket.c */
549#define __NR_socket 198
550__SYSCALL(__NR_socket, sys_socket)
551#define __NR_socketpair 199
552__SYSCALL(__NR_socketpair, sys_socketpair)
553#define __NR_bind 200
554__SYSCALL(__NR_bind, sys_bind)
555#define __NR_listen 201
556__SYSCALL(__NR_listen, sys_listen)
557#define __NR_accept 202
558__SYSCALL(__NR_accept, sys_accept)
559#define __NR_connect 203
560__SYSCALL(__NR_connect, sys_connect)
561#define __NR_getsockname 204
562__SYSCALL(__NR_getsockname, sys_getsockname)
563#define __NR_getpeername 205
564__SYSCALL(__NR_getpeername, sys_getpeername)
565#define __NR_sendto 206
566__SYSCALL(__NR_sendto, sys_sendto)
567#define __NR_recvfrom 207
568__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
569#define __NR_setsockopt 208
570__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
571#define __NR_getsockopt 209
572__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
573#define __NR_shutdown 210
574__SYSCALL(__NR_shutdown, sys_shutdown)
575#define __NR_sendmsg 211
576__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
577#define __NR_recvmsg 212
578__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
579
580/* mm/filemap.c */
581#define __NR_readahead 213
582__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
583
584/* mm/nommu.c, also with MMU */
585#define __NR_brk 214
586__SYSCALL(__NR_brk, sys_brk)
587#define __NR_munmap 215
588__SYSCALL(__NR_munmap, sys_munmap)
589#define __NR_mremap 216
590__SYSCALL(__NR_mremap, sys_mremap)
591
592/* security/keys/keyctl.c */
593#define __NR_add_key 217
594__SYSCALL(__NR_add_key, sys_add_key)
595#define __NR_request_key 218
596__SYSCALL(__NR_request_key, sys_request_key)
597#define __NR_keyctl 219
598__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
599
600/* arch/example/kernel/sys_example.c */
601#define __NR_clone 220
602__SYSCALL(__NR_clone, sys_clone)
603#define __NR_execve 221
604__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
605
606#define __NR3264_mmap 222
607__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
608/* mm/fadvise.c */
609#define __NR3264_fadvise64 223
610__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
611
612/* mm/, CONFIG_MMU only */
613#ifndef __ARCH_NOMMU
614#define __NR_swapon 224
615__SYSCALL(__NR_swapon, sys_swapon)
616#define __NR_swapoff 225
617__SYSCALL(__NR_swapoff, sys_swapoff)
618#define __NR_mprotect 226
619__SYSCALL(__NR_mprotect, sys_mprotect)
620#define __NR_msync 227
621__SYSCALL(__NR_msync, sys_msync)
622#define __NR_mlock 228
623__SYSCALL(__NR_mlock, sys_mlock)
624#define __NR_munlock 229
625__SYSCALL(__NR_munlock, sys_munlock)
626#define __NR_mlockall 230
627__SYSCALL(__NR_mlockall, sys_mlockall)
628#define __NR_munlockall 231
629__SYSCALL(__NR_munlockall, sys_munlockall)
630#define __NR_mincore 232
631__SYSCALL(__NR_mincore, sys_mincore)
632#define __NR_madvise 233
633__SYSCALL(__NR_madvise, sys_madvise)
634#define __NR_remap_file_pages 234
635__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
636#define __NR_mbind 235
637__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
638#define __NR_get_mempolicy 236
639__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
640#define __NR_set_mempolicy 237
641__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
642#define __NR_migrate_pages 238
643__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
644#define __NR_move_pages 239
645__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
646#endif
647
648#define __NR_rt_tgsigqueueinfo 240
649__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
650 compat_sys_rt_tgsigqueueinfo)
651#define __NR_perf_event_open 241
652__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
653#define __NR_accept4 242
654__SYSCALL(__NR_accept4, sys_accept4)
655#define __NR_recvmmsg 243
656__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
657
658/*
659 * Architectures may provide up to 16 syscalls of their own
660 * starting with this value.
661 */
662#define __NR_arch_specific_syscall 244
663
664#define __NR_wait4 260
665__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
666#define __NR_prlimit64 261
667__SYSCALL(__NR_prlimit64, sys_prlimit64)
668#define __NR_fanotify_init 262
669__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
670#define __NR_fanotify_mark 263
671__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
672#define __NR_name_to_handle_at 264
673__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
674#define __NR_open_by_handle_at 265
675__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
676 compat_sys_open_by_handle_at)
677#define __NR_clock_adjtime 266
678__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
679#define __NR_syncfs 267
680__SYSCALL(__NR_syncfs, sys_syncfs)
681#define __NR_setns 268
682__SYSCALL(__NR_setns, sys_setns)
683#define __NR_sendmmsg 269
684__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
685#define __NR_process_vm_readv 270
686__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
687 compat_sys_process_vm_readv)
688#define __NR_process_vm_writev 271
689__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
690 compat_sys_process_vm_writev)
691#define __NR_kcmp 272
692__SYSCALL(__NR_kcmp, sys_kcmp)
693
694#undef __NR_syscalls
695#define __NR_syscalls 273
696
697/*
698 * All syscalls below here should go away really,
699 * these are provided for both review and as a porting
700 * help for the C library version.
701*
702 * Last chance: are any of these important enough to
703 * enable by default?
704 */
705#ifdef __ARCH_WANT_SYSCALL_NO_AT
706#define __NR_open 1024
707__SYSCALL(__NR_open, sys_open)
708#define __NR_link 1025
709__SYSCALL(__NR_link, sys_link)
710#define __NR_unlink 1026
711__SYSCALL(__NR_unlink, sys_unlink)
712#define __NR_mknod 1027
713__SYSCALL(__NR_mknod, sys_mknod)
714#define __NR_chmod 1028
715__SYSCALL(__NR_chmod, sys_chmod)
716#define __NR_chown 1029
717__SYSCALL(__NR_chown, sys_chown)
718#define __NR_mkdir 1030
719__SYSCALL(__NR_mkdir, sys_mkdir)
720#define __NR_rmdir 1031
721__SYSCALL(__NR_rmdir, sys_rmdir)
722#define __NR_lchown 1032
723__SYSCALL(__NR_lchown, sys_lchown)
724#define __NR_access 1033
725__SYSCALL(__NR_access, sys_access)
726#define __NR_rename 1034
727__SYSCALL(__NR_rename, sys_rename)
728#define __NR_readlink 1035
729__SYSCALL(__NR_readlink, sys_readlink)
730#define __NR_symlink 1036
731__SYSCALL(__NR_symlink, sys_symlink)
732#define __NR_utimes 1037
733__SYSCALL(__NR_utimes, sys_utimes)
734#define __NR3264_stat 1038
735__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
736#define __NR3264_lstat 1039
737__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
738
739#undef __NR_syscalls
740#define __NR_syscalls (__NR3264_lstat+1)
741#endif /* __ARCH_WANT_SYSCALL_NO_AT */
742
743#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
744#define __NR_pipe 1040
745__SYSCALL(__NR_pipe, sys_pipe)
746#define __NR_dup2 1041
747__SYSCALL(__NR_dup2, sys_dup2)
748#define __NR_epoll_create 1042
749__SYSCALL(__NR_epoll_create, sys_epoll_create)
750#define __NR_inotify_init 1043
751__SYSCALL(__NR_inotify_init, sys_inotify_init)
752#define __NR_eventfd 1044
753__SYSCALL(__NR_eventfd, sys_eventfd)
754#define __NR_signalfd 1045
755__SYSCALL(__NR_signalfd, sys_signalfd)
756
757#undef __NR_syscalls
758#define __NR_syscalls (__NR_signalfd+1)
759#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
760
761#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
762 defined(__ARCH_WANT_SYSCALL_OFF_T)
763#define __NR_sendfile 1046
764__SYSCALL(__NR_sendfile, sys_sendfile)
765#define __NR_ftruncate 1047
766__SYSCALL(__NR_ftruncate, sys_ftruncate)
767#define __NR_truncate 1048
768__SYSCALL(__NR_truncate, sys_truncate)
769#define __NR_stat 1049
770__SYSCALL(__NR_stat, sys_newstat)
771#define __NR_lstat 1050
772__SYSCALL(__NR_lstat, sys_newlstat)
773#define __NR_fstat 1051
774__SYSCALL(__NR_fstat, sys_newfstat)
775#define __NR_fcntl 1052
776__SYSCALL(__NR_fcntl, sys_fcntl)
777#define __NR_fadvise64 1053
778#define __ARCH_WANT_SYS_FADVISE64
779__SYSCALL(__NR_fadvise64, sys_fadvise64)
780#define __NR_newfstatat 1054
781#define __ARCH_WANT_SYS_NEWFSTATAT
782__SYSCALL(__NR_newfstatat, sys_newfstatat)
783#define __NR_fstatfs 1055
784__SYSCALL(__NR_fstatfs, sys_fstatfs)
785#define __NR_statfs 1056
786__SYSCALL(__NR_statfs, sys_statfs)
787#define __NR_lseek 1057
788__SYSCALL(__NR_lseek, sys_lseek)
789#define __NR_mmap 1058
790__SYSCALL(__NR_mmap, sys_mmap)
791
792#undef __NR_syscalls
793#define __NR_syscalls (__NR_mmap+1)
794#endif /* 32 bit off_t syscalls */
795
796#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
797#define __NR_alarm 1059
798#define __ARCH_WANT_SYS_ALARM
799__SYSCALL(__NR_alarm, sys_alarm)
800#define __NR_getpgrp 1060
801#define __ARCH_WANT_SYS_GETPGRP
802__SYSCALL(__NR_getpgrp, sys_getpgrp)
803#define __NR_pause 1061
804#define __ARCH_WANT_SYS_PAUSE
805__SYSCALL(__NR_pause, sys_pause)
806#define __NR_time 1062
807#define __ARCH_WANT_SYS_TIME
808#define __ARCH_WANT_COMPAT_SYS_TIME
809__SYSCALL(__NR_time, sys_time)
810#define __NR_utime 1063
811#define __ARCH_WANT_SYS_UTIME
812__SYSCALL(__NR_utime, sys_utime)
813
814#define __NR_creat 1064
815__SYSCALL(__NR_creat, sys_creat)
816#define __NR_getdents 1065
817#define __ARCH_WANT_SYS_GETDENTS
818__SYSCALL(__NR_getdents, sys_getdents)
819#define __NR_futimesat 1066
820__SYSCALL(__NR_futimesat, sys_futimesat)
821#define __NR_select 1067
822#define __ARCH_WANT_SYS_SELECT
823__SYSCALL(__NR_select, sys_select)
824#define __NR_poll 1068
825__SYSCALL(__NR_poll, sys_poll)
826#define __NR_epoll_wait 1069
827__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
828#define __NR_ustat 1070
829__SYSCALL(__NR_ustat, sys_ustat)
830#define __NR_vfork 1071
831__SYSCALL(__NR_vfork, sys_vfork)
832#define __NR_oldwait4 1072
833__SYSCALL(__NR_oldwait4, sys_wait4)
834#define __NR_recv 1073
835__SYSCALL(__NR_recv, sys_recv)
836#define __NR_send 1074
837__SYSCALL(__NR_send, sys_send)
838#define __NR_bdflush 1075
839__SYSCALL(__NR_bdflush, sys_bdflush)
840#define __NR_umount 1076
841__SYSCALL(__NR_umount, sys_oldumount)
842#define __ARCH_WANT_SYS_OLDUMOUNT
843#define __NR_uselib 1077
844__SYSCALL(__NR_uselib, sys_uselib)
845#define __NR__sysctl 1078
846__SYSCALL(__NR__sysctl, sys_sysctl)
847
848#define __NR_fork 1079
849#ifdef CONFIG_MMU
850__SYSCALL(__NR_fork, sys_fork)
851#else
852__SYSCALL(__NR_fork, sys_ni_syscall)
853#endif /* CONFIG_MMU */
854
855#undef __NR_syscalls
856#define __NR_syscalls (__NR_fork+1)
857
858#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
859
860/*
861 * 32 bit systems traditionally used different
862 * syscalls for off_t and loff_t arguments, while
863 * 64 bit systems only need the off_t version.
864 * For new 32 bit platforms, there is no need to
865 * implement the old 32 bit off_t syscalls, so
866 * they take different names.
867 * Here we map the numbers so that both versions
868 * use the same syscall table layout.
869 */
870#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
871#define __NR_fcntl __NR3264_fcntl
872#define __NR_statfs __NR3264_statfs
873#define __NR_fstatfs __NR3264_fstatfs
874#define __NR_truncate __NR3264_truncate
875#define __NR_ftruncate __NR3264_ftruncate
876#define __NR_lseek __NR3264_lseek
877#define __NR_sendfile __NR3264_sendfile
878#define __NR_newfstatat __NR3264_fstatat
879#define __NR_fstat __NR3264_fstat
880#define __NR_mmap __NR3264_mmap
881#define __NR_fadvise64 __NR3264_fadvise64
882#ifdef __NR3264_stat
883#define __NR_stat __NR3264_stat
884#define __NR_lstat __NR3264_lstat
885#endif
886#else
887#define __NR_fcntl64 __NR3264_fcntl
888#define __NR_statfs64 __NR3264_statfs
889#define __NR_fstatfs64 __NR3264_fstatfs
890#define __NR_truncate64 __NR3264_truncate
891#define __NR_ftruncate64 __NR3264_ftruncate
892#define __NR_llseek __NR3264_lseek
893#define __NR_sendfile64 __NR3264_sendfile
894#define __NR_fstatat64 __NR3264_fstatat
895#define __NR_fstat64 __NR3264_fstat
896#define __NR_mmap2 __NR3264_mmap
897#define __NR_fadvise64_64 __NR3264_fadvise64
898#ifdef __NR3264_stat
899#define __NR_stat64 __NR3264_stat
900#define __NR_lstat64 __NR3264_lstat
901#endif
902#endif
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild
new file mode 100644
index 000000000000..ba99ce3f7372
--- /dev/null
+++ b/include/uapi/drm/Kbuild
@@ -0,0 +1,16 @@
1# UAPI Header export list
2header-y += drm.h
3header-y += drm_fourcc.h
4header-y += drm_mode.h
5header-y += drm_sarea.h
6header-y += exynos_drm.h
7header-y += i810_drm.h
8header-y += i915_drm.h
9header-y += mga_drm.h
10header-y += nouveau_drm.h
11header-y += r128_drm.h
12header-y += radeon_drm.h
13header-y += savage_drm.h
14header-y += sis_drm.h
15header-y += via_drm.h
16header-y += vmwgfx_drm.h
diff --git a/include/drm/drm.h b/include/uapi/drm/drm.h
index e51035a3757f..1e3481edf062 100644
--- a/include/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -628,7 +628,7 @@ struct drm_prime_handle {
628 __s32 fd; 628 __s32 fd;
629}; 629};
630 630
631#include "drm_mode.h" 631#include <drm/drm_mode.h>
632 632
633#define DRM_IOCTL_BASE 'd' 633#define DRM_IOCTL_BASE 'd'
634#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) 634#define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr)
diff --git a/include/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index bdf0152cbbe9..646ae5f39f42 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -106,9 +106,10 @@
106#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */ 106#define DRM_FORMAT_NV21 fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
107#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ 107#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
108#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 108#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
109#define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */
110#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
109 111
110/* 2 non contiguous plane YCbCr */ 112/* special NV12 tiled format */
111#define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
112#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */ 113#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
113 114
114/* 115/*
@@ -131,7 +132,4 @@
131#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ 132#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
132#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ 133#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
133 134
134/* 3 non contiguous plane YCbCr */
135#define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
136
137#endif /* DRM_FOURCC_H */ 135#endif /* DRM_FOURCC_H */
diff --git a/include/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 5581980b14f6..3d6301b6ec16 100644
--- a/include/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -359,8 +359,9 @@ struct drm_mode_mode_cmd {
359 struct drm_mode_modeinfo mode; 359 struct drm_mode_modeinfo mode;
360}; 360};
361 361
362#define DRM_MODE_CURSOR_BO (1<<0) 362#define DRM_MODE_CURSOR_BO 0x01
363#define DRM_MODE_CURSOR_MOVE (1<<1) 363#define DRM_MODE_CURSOR_MOVE 0x02
364#define DRM_MODE_CURSOR_FLAGS 0x03
364 365
365/* 366/*
366 * depending on the value in flags different members are used. 367 * depending on the value in flags different members are used.
diff --git a/include/drm/drm_sarea.h b/include/uapi/drm/drm_sarea.h
index ee5389d22c64..413a5642d49f 100644
--- a/include/drm/drm_sarea.h
+++ b/include/uapi/drm/drm_sarea.h
@@ -32,11 +32,13 @@
32#ifndef _DRM_SAREA_H_ 32#ifndef _DRM_SAREA_H_
33#define _DRM_SAREA_H_ 33#define _DRM_SAREA_H_
34 34
35#include "drm.h" 35#include <drm/drm.h>
36 36
37/* SAREA area needs to be at least a page */ 37/* SAREA area needs to be at least a page */
38#if defined(__alpha__) 38#if defined(__alpha__)
39#define SAREA_MAX 0x2000U 39#define SAREA_MAX 0x2000U
40#elif defined(__mips__)
41#define SAREA_MAX 0x4000U
40#elif defined(__ia64__) 42#elif defined(__ia64__)
41#define SAREA_MAX 0x10000U /* 64kB */ 43#define SAREA_MAX 0x10000U /* 64kB */
42#else 44#else
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
new file mode 100644
index 000000000000..c0494d586e23
--- /dev/null
+++ b/include/uapi/drm/exynos_drm.h
@@ -0,0 +1,203 @@
1/* exynos_drm.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authors:
5 * Inki Dae <inki.dae@samsung.com>
6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29#ifndef _UAPI_EXYNOS_DRM_H_
30#define _UAPI_EXYNOS_DRM_H_
31
32#include <drm/drm.h>
33
34/**
35 * User-desired buffer creation information structure.
36 *
37 * @size: user-desired memory allocation size.
38 * - this size value would be page-aligned internally.
39 * @flags: user request for setting memory type or cache attributes.
40 * @handle: returned a handle to created gem object.
41 * - this handle will be set by gem module of kernel side.
42 */
43struct drm_exynos_gem_create {
44 uint64_t size;
45 unsigned int flags;
46 unsigned int handle;
47};
48
49/**
50 * A structure for getting buffer offset.
51 *
52 * @handle: a pointer to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @offset: relatived offset value of the memory region allocated.
55 * - this value should be set by user.
56 */
57struct drm_exynos_gem_map_off {
58 unsigned int handle;
59 unsigned int pad;
60 uint64_t offset;
61};
62
63/**
64 * A structure for mapping buffer.
65 *
66 * @handle: a handle to gem object created.
67 * @pad: just padding to be 64-bit aligned.
68 * @size: memory size to be mapped.
69 * @mapped: having user virtual address mmaped.
70 * - this variable would be filled by exynos gem module
71 * of kernel side with user virtual address which is allocated
72 * by do_mmap().
73 */
74struct drm_exynos_gem_mmap {
75 unsigned int handle;
76 unsigned int pad;
77 uint64_t size;
78 uint64_t mapped;
79};
80
81/**
82 * A structure to gem information.
83 *
84 * @handle: a handle to gem object created.
85 * @flags: flag value including memory type and cache attribute and
86 * this value would be set by driver.
87 * @size: size to memory region allocated by gem and this size would
88 * be set by driver.
89 */
90struct drm_exynos_gem_info {
91 unsigned int handle;
92 unsigned int flags;
93 uint64_t size;
94};
95
96/**
97 * A structure for user connection request of virtual display.
98 *
99 * @connection: indicate whether doing connetion or not by user.
100 * @extensions: if this value is 1 then the vidi driver would need additional
101 * 128bytes edid data.
102 * @edid: the edid data pointer from user side.
103 */
104struct drm_exynos_vidi_connection {
105 unsigned int connection;
106 unsigned int extensions;
107 uint64_t edid;
108};
109
110/* memory type definitions. */
111enum e_drm_exynos_gem_mem_type {
112 /* Physically Continuous memory and used as default. */
113 EXYNOS_BO_CONTIG = 0 << 0,
114 /* Physically Non-Continuous memory. */
115 EXYNOS_BO_NONCONTIG = 1 << 0,
116 /* non-cachable mapping and used as default. */
117 EXYNOS_BO_NONCACHABLE = 0 << 1,
118 /* cachable mapping. */
119 EXYNOS_BO_CACHABLE = 1 << 1,
120 /* write-combine mapping. */
121 EXYNOS_BO_WC = 1 << 2,
122 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
123 EXYNOS_BO_WC
124};
125
126struct drm_exynos_g2d_get_ver {
127 __u32 major;
128 __u32 minor;
129};
130
131struct drm_exynos_g2d_cmd {
132 __u32 offset;
133 __u32 data;
134};
135
136enum drm_exynos_g2d_event_type {
137 G2D_EVENT_NOT,
138 G2D_EVENT_NONSTOP,
139 G2D_EVENT_STOP, /* not yet */
140};
141
142struct drm_exynos_g2d_set_cmdlist {
143 __u64 cmd;
144 __u64 cmd_gem;
145 __u32 cmd_nr;
146 __u32 cmd_gem_nr;
147
148 /* for g2d event */
149 __u64 event_type;
150 __u64 user_data;
151};
152
153struct drm_exynos_g2d_exec {
154 __u64 async;
155};
156
157#define DRM_EXYNOS_GEM_CREATE 0x00
158#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
159#define DRM_EXYNOS_GEM_MMAP 0x02
160/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
161#define DRM_EXYNOS_GEM_GET 0x04
162#define DRM_EXYNOS_VIDI_CONNECTION 0x07
163
164/* G2D */
165#define DRM_EXYNOS_G2D_GET_VER 0x20
166#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
167#define DRM_EXYNOS_G2D_EXEC 0x22
168
169#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
170 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
171
172#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
173 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
174
175#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
176 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
177
178#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
179 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
180
181#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
182 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
183
184#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
185 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
186#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
187 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
188#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
189 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
190
191/* EXYNOS specific events */
192#define DRM_EXYNOS_G2D_EVENT 0x80000000
193
194struct drm_exynos_g2d_event {
195 struct drm_event base;
196 __u64 user_data;
197 __u32 tv_sec;
198 __u32 tv_usec;
199 __u32 cmdlist_no;
200 __u32 reserved;
201};
202
203#endif /* _UAPI_EXYNOS_DRM_H_ */
diff --git a/include/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index 7a10bb6f2c0f..7a10bb6f2c0f 100644
--- a/include/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
new file mode 100644
index 000000000000..4322b1e7d2ed
--- /dev/null
+++ b/include/uapi/drm/i915_drm.h
@@ -0,0 +1,947 @@
1/*
2 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef _UAPI_I915_DRM_H_
28#define _UAPI_I915_DRM_H_
29
30#include <drm/drm.h>
31
32/* Please note that modifications to all structs defined here are
33 * subject to backwards-compatibility constraints.
34 */
35
36
37/* Each region is a minimum of 16k, and there are at most 255 of them.
38 */
39#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
40 * of chars for next/prev indices */
41#define I915_LOG_MIN_TEX_REGION_SIZE 14
42
43typedef struct _drm_i915_init {
44 enum {
45 I915_INIT_DMA = 0x01,
46 I915_CLEANUP_DMA = 0x02,
47 I915_RESUME_DMA = 0x03
48 } func;
49 unsigned int mmio_offset;
50 int sarea_priv_offset;
51 unsigned int ring_start;
52 unsigned int ring_end;
53 unsigned int ring_size;
54 unsigned int front_offset;
55 unsigned int back_offset;
56 unsigned int depth_offset;
57 unsigned int w;
58 unsigned int h;
59 unsigned int pitch;
60 unsigned int pitch_bits;
61 unsigned int back_pitch;
62 unsigned int depth_pitch;
63 unsigned int cpp;
64 unsigned int chipset;
65} drm_i915_init_t;
66
67typedef struct _drm_i915_sarea {
68 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
69 int last_upload; /* last time texture was uploaded */
70 int last_enqueue; /* last time a buffer was enqueued */
71 int last_dispatch; /* age of the most recently dispatched buffer */
72 int ctxOwner; /* last context to upload state */
73 int texAge;
74 int pf_enabled; /* is pageflipping allowed? */
75 int pf_active;
76 int pf_current_page; /* which buffer is being displayed? */
77 int perf_boxes; /* performance boxes to be displayed */
78 int width, height; /* screen size in pixels */
79
80 drm_handle_t front_handle;
81 int front_offset;
82 int front_size;
83
84 drm_handle_t back_handle;
85 int back_offset;
86 int back_size;
87
88 drm_handle_t depth_handle;
89 int depth_offset;
90 int depth_size;
91
92 drm_handle_t tex_handle;
93 int tex_offset;
94 int tex_size;
95 int log_tex_granularity;
96 int pitch;
97 int rotation; /* 0, 90, 180 or 270 */
98 int rotated_offset;
99 int rotated_size;
100 int rotated_pitch;
101 int virtualX, virtualY;
102
103 unsigned int front_tiled;
104 unsigned int back_tiled;
105 unsigned int depth_tiled;
106 unsigned int rotated_tiled;
107 unsigned int rotated2_tiled;
108
109 int pipeA_x;
110 int pipeA_y;
111 int pipeA_w;
112 int pipeA_h;
113 int pipeB_x;
114 int pipeB_y;
115 int pipeB_w;
116 int pipeB_h;
117
118 /* fill out some space for old userspace triple buffer */
119 drm_handle_t unused_handle;
120 __u32 unused1, unused2, unused3;
121
122 /* buffer object handles for static buffers. May change
123 * over the lifetime of the client.
124 */
125 __u32 front_bo_handle;
126 __u32 back_bo_handle;
127 __u32 unused_bo_handle;
128 __u32 depth_bo_handle;
129
130} drm_i915_sarea_t;
131
132/* due to userspace building against these headers we need some compat here */
133#define planeA_x pipeA_x
134#define planeA_y pipeA_y
135#define planeA_w pipeA_w
136#define planeA_h pipeA_h
137#define planeB_x pipeB_x
138#define planeB_y pipeB_y
139#define planeB_w pipeB_w
140#define planeB_h pipeB_h
141
142/* Flags for perf_boxes
143 */
144#define I915_BOX_RING_EMPTY 0x1
145#define I915_BOX_FLIP 0x2
146#define I915_BOX_WAIT 0x4
147#define I915_BOX_TEXTURE_LOAD 0x8
148#define I915_BOX_LOST_CONTEXT 0x10
149
150/* I915 specific ioctls
151 * The device specific ioctl range is 0x40 to 0x79.
152 */
153#define DRM_I915_INIT 0x00
154#define DRM_I915_FLUSH 0x01
155#define DRM_I915_FLIP 0x02
156#define DRM_I915_BATCHBUFFER 0x03
157#define DRM_I915_IRQ_EMIT 0x04
158#define DRM_I915_IRQ_WAIT 0x05
159#define DRM_I915_GETPARAM 0x06
160#define DRM_I915_SETPARAM 0x07
161#define DRM_I915_ALLOC 0x08
162#define DRM_I915_FREE 0x09
163#define DRM_I915_INIT_HEAP 0x0a
164#define DRM_I915_CMDBUFFER 0x0b
165#define DRM_I915_DESTROY_HEAP 0x0c
166#define DRM_I915_SET_VBLANK_PIPE 0x0d
167#define DRM_I915_GET_VBLANK_PIPE 0x0e
168#define DRM_I915_VBLANK_SWAP 0x0f
169#define DRM_I915_HWS_ADDR 0x11
170#define DRM_I915_GEM_INIT 0x13
171#define DRM_I915_GEM_EXECBUFFER 0x14
172#define DRM_I915_GEM_PIN 0x15
173#define DRM_I915_GEM_UNPIN 0x16
174#define DRM_I915_GEM_BUSY 0x17
175#define DRM_I915_GEM_THROTTLE 0x18
176#define DRM_I915_GEM_ENTERVT 0x19
177#define DRM_I915_GEM_LEAVEVT 0x1a
178#define DRM_I915_GEM_CREATE 0x1b
179#define DRM_I915_GEM_PREAD 0x1c
180#define DRM_I915_GEM_PWRITE 0x1d
181#define DRM_I915_GEM_MMAP 0x1e
182#define DRM_I915_GEM_SET_DOMAIN 0x1f
183#define DRM_I915_GEM_SW_FINISH 0x20
184#define DRM_I915_GEM_SET_TILING 0x21
185#define DRM_I915_GEM_GET_TILING 0x22
186#define DRM_I915_GEM_GET_APERTURE 0x23
187#define DRM_I915_GEM_MMAP_GTT 0x24
188#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
189#define DRM_I915_GEM_MADVISE 0x26
190#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
191#define DRM_I915_OVERLAY_ATTRS 0x28
192#define DRM_I915_GEM_EXECBUFFER2 0x29
193#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
194#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
195#define DRM_I915_GEM_WAIT 0x2c
196#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
197#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
198#define DRM_I915_GEM_SET_CACHING 0x2f
199#define DRM_I915_GEM_GET_CACHING 0x30
200#define DRM_I915_REG_READ 0x31
201
202#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
203#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
204#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
205#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
206#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
207#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
208#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
209#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
210#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
211#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
212#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
213#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
214#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
215#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
216#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
217#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
218#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
219#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
220#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
221#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
222#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
223#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
224#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
225#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
226#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
227#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
228#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
229#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
230#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
231#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
232#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
233#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
234#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
235#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
236#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
237#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
238#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
239#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
240#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
241#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
242#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
243#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
244#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
245#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
246#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
247#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
248#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
249#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
250
251/* Allow drivers to submit batchbuffers directly to hardware, relying
252 * on the security mechanisms provided by hardware.
253 */
254typedef struct drm_i915_batchbuffer {
255 int start; /* agp offset */
256 int used; /* nr bytes in use */
257 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
258 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
259 int num_cliprects; /* mulitpass with multiple cliprects? */
260 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
261} drm_i915_batchbuffer_t;
262
263/* As above, but pass a pointer to userspace buffer which can be
264 * validated by the kernel prior to sending to hardware.
265 */
266typedef struct _drm_i915_cmdbuffer {
267 char __user *buf; /* pointer to userspace command buffer */
268 int sz; /* nr bytes in buf */
269 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
270 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
271 int num_cliprects; /* mulitpass with multiple cliprects? */
272 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
273} drm_i915_cmdbuffer_t;
274
275/* Userspace can request & wait on irq's:
276 */
277typedef struct drm_i915_irq_emit {
278 int __user *irq_seq;
279} drm_i915_irq_emit_t;
280
281typedef struct drm_i915_irq_wait {
282 int irq_seq;
283} drm_i915_irq_wait_t;
284
285/* Ioctl to query kernel params:
286 */
287#define I915_PARAM_IRQ_ACTIVE 1
288#define I915_PARAM_ALLOW_BATCHBUFFER 2
289#define I915_PARAM_LAST_DISPATCH 3
290#define I915_PARAM_CHIPSET_ID 4
291#define I915_PARAM_HAS_GEM 5
292#define I915_PARAM_NUM_FENCES_AVAIL 6
293#define I915_PARAM_HAS_OVERLAY 7
294#define I915_PARAM_HAS_PAGEFLIPPING 8
295#define I915_PARAM_HAS_EXECBUF2 9
296#define I915_PARAM_HAS_BSD 10
297#define I915_PARAM_HAS_BLT 11
298#define I915_PARAM_HAS_RELAXED_FENCING 12
299#define I915_PARAM_HAS_COHERENT_RINGS 13
300#define I915_PARAM_HAS_EXEC_CONSTANTS 14
301#define I915_PARAM_HAS_RELAXED_DELTA 15
302#define I915_PARAM_HAS_GEN7_SOL_RESET 16
303#define I915_PARAM_HAS_LLC 17
304#define I915_PARAM_HAS_ALIASING_PPGTT 18
305#define I915_PARAM_HAS_WAIT_TIMEOUT 19
306#define I915_PARAM_HAS_SEMAPHORES 20
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
309
310typedef struct drm_i915_getparam {
311 int param;
312 int __user *value;
313} drm_i915_getparam_t;
314
315/* Ioctl to set kernel params:
316 */
317#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
318#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
319#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
320#define I915_SETPARAM_NUM_USED_FENCES 4
321
322typedef struct drm_i915_setparam {
323 int param;
324 int value;
325} drm_i915_setparam_t;
326
327/* A memory manager for regions of shared memory:
328 */
329#define I915_MEM_REGION_AGP 1
330
331typedef struct drm_i915_mem_alloc {
332 int region;
333 int alignment;
334 int size;
335 int __user *region_offset; /* offset from start of fb or agp */
336} drm_i915_mem_alloc_t;
337
338typedef struct drm_i915_mem_free {
339 int region;
340 int region_offset;
341} drm_i915_mem_free_t;
342
343typedef struct drm_i915_mem_init_heap {
344 int region;
345 int size;
346 int start;
347} drm_i915_mem_init_heap_t;
348
349/* Allow memory manager to be torn down and re-initialized (eg on
350 * rotate):
351 */
352typedef struct drm_i915_mem_destroy_heap {
353 int region;
354} drm_i915_mem_destroy_heap_t;
355
356/* Allow X server to configure which pipes to monitor for vblank signals
357 */
358#define DRM_I915_VBLANK_PIPE_A 1
359#define DRM_I915_VBLANK_PIPE_B 2
360
361typedef struct drm_i915_vblank_pipe {
362 int pipe;
363} drm_i915_vblank_pipe_t;
364
365/* Schedule buffer swap at given vertical blank:
366 */
367typedef struct drm_i915_vblank_swap {
368 drm_drawable_t drawable;
369 enum drm_vblank_seq_type seqtype;
370 unsigned int sequence;
371} drm_i915_vblank_swap_t;
372
373typedef struct drm_i915_hws_addr {
374 __u64 addr;
375} drm_i915_hws_addr_t;
376
377struct drm_i915_gem_init {
378 /**
379 * Beginning offset in the GTT to be managed by the DRM memory
380 * manager.
381 */
382 __u64 gtt_start;
383 /**
384 * Ending offset in the GTT to be managed by the DRM memory
385 * manager.
386 */
387 __u64 gtt_end;
388};
389
390struct drm_i915_gem_create {
391 /**
392 * Requested size for the object.
393 *
394 * The (page-aligned) allocated size for the object will be returned.
395 */
396 __u64 size;
397 /**
398 * Returned handle for the object.
399 *
400 * Object handles are nonzero.
401 */
402 __u32 handle;
403 __u32 pad;
404};
405
406struct drm_i915_gem_pread {
407 /** Handle for the object being read. */
408 __u32 handle;
409 __u32 pad;
410 /** Offset into the object to read from */
411 __u64 offset;
412 /** Length of data to read */
413 __u64 size;
414 /**
415 * Pointer to write the data into.
416 *
417 * This is a fixed-size type for 32/64 compatibility.
418 */
419 __u64 data_ptr;
420};
421
422struct drm_i915_gem_pwrite {
423 /** Handle for the object being written to. */
424 __u32 handle;
425 __u32 pad;
426 /** Offset into the object to write to */
427 __u64 offset;
428 /** Length of data to write */
429 __u64 size;
430 /**
431 * Pointer to read the data from.
432 *
433 * This is a fixed-size type for 32/64 compatibility.
434 */
435 __u64 data_ptr;
436};
437
438struct drm_i915_gem_mmap {
439 /** Handle for the object being mapped. */
440 __u32 handle;
441 __u32 pad;
442 /** Offset in the object to map. */
443 __u64 offset;
444 /**
445 * Length of data to map.
446 *
447 * The value will be page-aligned.
448 */
449 __u64 size;
450 /**
451 * Returned pointer the data was mapped at.
452 *
453 * This is a fixed-size type for 32/64 compatibility.
454 */
455 __u64 addr_ptr;
456};
457
458struct drm_i915_gem_mmap_gtt {
459 /** Handle for the object being mapped. */
460 __u32 handle;
461 __u32 pad;
462 /**
463 * Fake offset to use for subsequent mmap call
464 *
465 * This is a fixed-size type for 32/64 compatibility.
466 */
467 __u64 offset;
468};
469
470struct drm_i915_gem_set_domain {
471 /** Handle for the object */
472 __u32 handle;
473
474 /** New read domains */
475 __u32 read_domains;
476
477 /** New write domain */
478 __u32 write_domain;
479};
480
481struct drm_i915_gem_sw_finish {
482 /** Handle for the object */
483 __u32 handle;
484};
485
486struct drm_i915_gem_relocation_entry {
487 /**
488 * Handle of the buffer being pointed to by this relocation entry.
489 *
490 * It's appealing to make this be an index into the mm_validate_entry
491 * list to refer to the buffer, but this allows the driver to create
492 * a relocation list for state buffers and not re-write it per
493 * exec using the buffer.
494 */
495 __u32 target_handle;
496
497 /**
498 * Value to be added to the offset of the target buffer to make up
499 * the relocation entry.
500 */
501 __u32 delta;
502
503 /** Offset in the buffer the relocation entry will be written into */
504 __u64 offset;
505
506 /**
507 * Offset value of the target buffer that the relocation entry was last
508 * written as.
509 *
510 * If the buffer has the same offset as last time, we can skip syncing
511 * and writing the relocation. This value is written back out by
512 * the execbuffer ioctl when the relocation is written.
513 */
514 __u64 presumed_offset;
515
516 /**
517 * Target memory domains read by this operation.
518 */
519 __u32 read_domains;
520
521 /**
522 * Target memory domains written by this operation.
523 *
524 * Note that only one domain may be written by the whole
525 * execbuffer operation, so that where there are conflicts,
526 * the application will get -EINVAL back.
527 */
528 __u32 write_domain;
529};
530
531/** @{
532 * Intel memory domains
533 *
534 * Most of these just align with the various caches in
535 * the system and are used to flush and invalidate as
536 * objects end up cached in different domains.
537 */
538/** CPU cache */
539#define I915_GEM_DOMAIN_CPU 0x00000001
540/** Render cache, used by 2D and 3D drawing */
541#define I915_GEM_DOMAIN_RENDER 0x00000002
542/** Sampler cache, used by texture engine */
543#define I915_GEM_DOMAIN_SAMPLER 0x00000004
544/** Command queue, used to load batch buffers */
545#define I915_GEM_DOMAIN_COMMAND 0x00000008
546/** Instruction cache, used by shader programs */
547#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
548/** Vertex address cache */
549#define I915_GEM_DOMAIN_VERTEX 0x00000020
550/** GTT domain - aperture and scanout */
551#define I915_GEM_DOMAIN_GTT 0x00000040
552/** @} */
553
554struct drm_i915_gem_exec_object {
555 /**
556 * User's handle for a buffer to be bound into the GTT for this
557 * operation.
558 */
559 __u32 handle;
560
561 /** Number of relocations to be performed on this buffer */
562 __u32 relocation_count;
563 /**
564 * Pointer to array of struct drm_i915_gem_relocation_entry containing
565 * the relocations to be performed in this buffer.
566 */
567 __u64 relocs_ptr;
568
569 /** Required alignment in graphics aperture */
570 __u64 alignment;
571
572 /**
573 * Returned value of the updated offset of the object, for future
574 * presumed_offset writes.
575 */
576 __u64 offset;
577};
578
579struct drm_i915_gem_execbuffer {
580 /**
581 * List of buffers to be validated with their relocations to be
582 * performend on them.
583 *
584 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
585 *
586 * These buffers must be listed in an order such that all relocations
587 * a buffer is performing refer to buffers that have already appeared
588 * in the validate list.
589 */
590 __u64 buffers_ptr;
591 __u32 buffer_count;
592
593 /** Offset in the batchbuffer to start execution from. */
594 __u32 batch_start_offset;
595 /** Bytes used in batchbuffer from batch_start_offset */
596 __u32 batch_len;
597 __u32 DR1;
598 __u32 DR4;
599 __u32 num_cliprects;
600 /** This is a struct drm_clip_rect *cliprects */
601 __u64 cliprects_ptr;
602};
603
604struct drm_i915_gem_exec_object2 {
605 /**
606 * User's handle for a buffer to be bound into the GTT for this
607 * operation.
608 */
609 __u32 handle;
610
611 /** Number of relocations to be performed on this buffer */
612 __u32 relocation_count;
613 /**
614 * Pointer to array of struct drm_i915_gem_relocation_entry containing
615 * the relocations to be performed in this buffer.
616 */
617 __u64 relocs_ptr;
618
619 /** Required alignment in graphics aperture */
620 __u64 alignment;
621
622 /**
623 * Returned value of the updated offset of the object, for future
624 * presumed_offset writes.
625 */
626 __u64 offset;
627
628#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
629 __u64 flags;
630 __u64 rsvd1;
631 __u64 rsvd2;
632};
633
634struct drm_i915_gem_execbuffer2 {
635 /**
636 * List of gem_exec_object2 structs
637 */
638 __u64 buffers_ptr;
639 __u32 buffer_count;
640
641 /** Offset in the batchbuffer to start execution from. */
642 __u32 batch_start_offset;
643 /** Bytes used in batchbuffer from batch_start_offset */
644 __u32 batch_len;
645 __u32 DR1;
646 __u32 DR4;
647 __u32 num_cliprects;
648 /** This is a struct drm_clip_rect *cliprects */
649 __u64 cliprects_ptr;
650#define I915_EXEC_RING_MASK (7<<0)
651#define I915_EXEC_DEFAULT (0<<0)
652#define I915_EXEC_RENDER (1<<0)
653#define I915_EXEC_BSD (2<<0)
654#define I915_EXEC_BLT (3<<0)
655
656/* Used for switching the constants addressing mode on gen4+ RENDER ring.
657 * Gen6+ only supports relative addressing to dynamic state (default) and
658 * absolute addressing.
659 *
660 * These flags are ignored for the BSD and BLT rings.
661 */
662#define I915_EXEC_CONSTANTS_MASK (3<<6)
663#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
664#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
665#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
666 __u64 flags;
667 __u64 rsvd1; /* now used for context info */
668 __u64 rsvd2;
669};
670
671/** Resets the SO write offset registers for transform feedback on gen7. */
672#define I915_EXEC_GEN7_SOL_RESET (1<<8)
673
674#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
675#define i915_execbuffer2_set_context_id(eb2, context) \
676 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
677#define i915_execbuffer2_get_context_id(eb2) \
678 ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
679
680struct drm_i915_gem_pin {
681 /** Handle of the buffer to be pinned. */
682 __u32 handle;
683 __u32 pad;
684
685 /** alignment required within the aperture */
686 __u64 alignment;
687
688 /** Returned GTT offset of the buffer. */
689 __u64 offset;
690};
691
692struct drm_i915_gem_unpin {
693 /** Handle of the buffer to be unpinned. */
694 __u32 handle;
695 __u32 pad;
696};
697
698struct drm_i915_gem_busy {
699 /** Handle of the buffer to check for busy */
700 __u32 handle;
701
702 /** Return busy status (1 if busy, 0 if idle).
703 * The high word is used to indicate on which rings the object
704 * currently resides:
705 * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc)
706 */
707 __u32 busy;
708};
709
710#define I915_CACHING_NONE 0
711#define I915_CACHING_CACHED 1
712
713struct drm_i915_gem_caching {
714 /**
715 * Handle of the buffer to set/get the caching level of. */
716 __u32 handle;
717
718 /**
719 * Cacheing level to apply or return value
720 *
721 * bits0-15 are for generic caching control (i.e. the above defined
722 * values). bits16-31 are reserved for platform-specific variations
723 * (e.g. l3$ caching on gen7). */
724 __u32 caching;
725};
726
727#define I915_TILING_NONE 0
728#define I915_TILING_X 1
729#define I915_TILING_Y 2
730
731#define I915_BIT_6_SWIZZLE_NONE 0
732#define I915_BIT_6_SWIZZLE_9 1
733#define I915_BIT_6_SWIZZLE_9_10 2
734#define I915_BIT_6_SWIZZLE_9_11 3
735#define I915_BIT_6_SWIZZLE_9_10_11 4
736/* Not seen by userland */
737#define I915_BIT_6_SWIZZLE_UNKNOWN 5
738/* Seen by userland. */
739#define I915_BIT_6_SWIZZLE_9_17 6
740#define I915_BIT_6_SWIZZLE_9_10_17 7
741
742struct drm_i915_gem_set_tiling {
743 /** Handle of the buffer to have its tiling state updated */
744 __u32 handle;
745
746 /**
747 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
748 * I915_TILING_Y).
749 *
750 * This value is to be set on request, and will be updated by the
751 * kernel on successful return with the actual chosen tiling layout.
752 *
753 * The tiling mode may be demoted to I915_TILING_NONE when the system
754 * has bit 6 swizzling that can't be managed correctly by GEM.
755 *
756 * Buffer contents become undefined when changing tiling_mode.
757 */
758 __u32 tiling_mode;
759
760 /**
761 * Stride in bytes for the object when in I915_TILING_X or
762 * I915_TILING_Y.
763 */
764 __u32 stride;
765
766 /**
767 * Returned address bit 6 swizzling required for CPU access through
768 * mmap mapping.
769 */
770 __u32 swizzle_mode;
771};
772
773struct drm_i915_gem_get_tiling {
774 /** Handle of the buffer to get tiling state for. */
775 __u32 handle;
776
777 /**
778 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
779 * I915_TILING_Y).
780 */
781 __u32 tiling_mode;
782
783 /**
784 * Returned address bit 6 swizzling required for CPU access through
785 * mmap mapping.
786 */
787 __u32 swizzle_mode;
788};
789
790struct drm_i915_gem_get_aperture {
791 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
792 __u64 aper_size;
793
794 /**
795 * Available space in the aperture used by i915_gem_execbuffer, in
796 * bytes
797 */
798 __u64 aper_available_size;
799};
800
801struct drm_i915_get_pipe_from_crtc_id {
802 /** ID of CRTC being requested **/
803 __u32 crtc_id;
804
805 /** pipe of requested CRTC **/
806 __u32 pipe;
807};
808
809#define I915_MADV_WILLNEED 0
810#define I915_MADV_DONTNEED 1
811#define __I915_MADV_PURGED 2 /* internal state */
812
813struct drm_i915_gem_madvise {
814 /** Handle of the buffer to change the backing store advice */
815 __u32 handle;
816
817 /* Advice: either the buffer will be needed again in the near future,
818 * or wont be and could be discarded under memory pressure.
819 */
820 __u32 madv;
821
822 /** Whether the backing store still exists. */
823 __u32 retained;
824};
825
826/* flags */
827#define I915_OVERLAY_TYPE_MASK 0xff
828#define I915_OVERLAY_YUV_PLANAR 0x01
829#define I915_OVERLAY_YUV_PACKED 0x02
830#define I915_OVERLAY_RGB 0x03
831
832#define I915_OVERLAY_DEPTH_MASK 0xff00
833#define I915_OVERLAY_RGB24 0x1000
834#define I915_OVERLAY_RGB16 0x2000
835#define I915_OVERLAY_RGB15 0x3000
836#define I915_OVERLAY_YUV422 0x0100
837#define I915_OVERLAY_YUV411 0x0200
838#define I915_OVERLAY_YUV420 0x0300
839#define I915_OVERLAY_YUV410 0x0400
840
841#define I915_OVERLAY_SWAP_MASK 0xff0000
842#define I915_OVERLAY_NO_SWAP 0x000000
843#define I915_OVERLAY_UV_SWAP 0x010000
844#define I915_OVERLAY_Y_SWAP 0x020000
845#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
846
847#define I915_OVERLAY_FLAGS_MASK 0xff000000
848#define I915_OVERLAY_ENABLE 0x01000000
849
850struct drm_intel_overlay_put_image {
851 /* various flags and src format description */
852 __u32 flags;
853 /* source picture description */
854 __u32 bo_handle;
855 /* stride values and offsets are in bytes, buffer relative */
856 __u16 stride_Y; /* stride for packed formats */
857 __u16 stride_UV;
858 __u32 offset_Y; /* offset for packet formats */
859 __u32 offset_U;
860 __u32 offset_V;
861 /* in pixels */
862 __u16 src_width;
863 __u16 src_height;
864 /* to compensate the scaling factors for partially covered surfaces */
865 __u16 src_scan_width;
866 __u16 src_scan_height;
867 /* output crtc description */
868 __u32 crtc_id;
869 __u16 dst_x;
870 __u16 dst_y;
871 __u16 dst_width;
872 __u16 dst_height;
873};
874
875/* flags */
876#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
877#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
878struct drm_intel_overlay_attrs {
879 __u32 flags;
880 __u32 color_key;
881 __s32 brightness;
882 __u32 contrast;
883 __u32 saturation;
884 __u32 gamma0;
885 __u32 gamma1;
886 __u32 gamma2;
887 __u32 gamma3;
888 __u32 gamma4;
889 __u32 gamma5;
890};
891
892/*
893 * Intel sprite handling
894 *
895 * Color keying works with a min/mask/max tuple. Both source and destination
896 * color keying is allowed.
897 *
898 * Source keying:
899 * Sprite pixels within the min & max values, masked against the color channels
900 * specified in the mask field, will be transparent. All other pixels will
901 * be displayed on top of the primary plane. For RGB surfaces, only the min
902 * and mask fields will be used; ranged compares are not allowed.
903 *
904 * Destination keying:
905 * Primary plane pixels that match the min value, masked against the color
906 * channels specified in the mask field, will be replaced by corresponding
907 * pixels from the sprite plane.
908 *
909 * Note that source & destination keying are exclusive; only one can be
910 * active on a given plane.
911 */
912
913#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
914#define I915_SET_COLORKEY_DESTINATION (1<<1)
915#define I915_SET_COLORKEY_SOURCE (1<<2)
916struct drm_intel_sprite_colorkey {
917 __u32 plane_id;
918 __u32 min_value;
919 __u32 channel_mask;
920 __u32 max_value;
921 __u32 flags;
922};
923
924struct drm_i915_gem_wait {
925 /** Handle of BO we shall wait on */
926 __u32 bo_handle;
927 __u32 flags;
928 /** Number of nanoseconds to wait, Returns time remaining. */
929 __s64 timeout_ns;
930};
931
932struct drm_i915_gem_context_create {
933 /* output: id of new context*/
934 __u32 ctx_id;
935 __u32 pad;
936};
937
938struct drm_i915_gem_context_destroy {
939 __u32 ctx_id;
940 __u32 pad;
941};
942
943struct drm_i915_reg_read {
944 __u64 offset;
945 __u64 val; /* Return value */
946};
947#endif /* _UAPI_I915_DRM_H_ */
diff --git a/include/drm/mga_drm.h b/include/uapi/drm/mga_drm.h
index fca817009e13..2375bfd6e5e9 100644
--- a/include/drm/mga_drm.h
+++ b/include/uapi/drm/mga_drm.h
@@ -35,7 +35,7 @@
35#ifndef __MGA_DRM_H__ 35#ifndef __MGA_DRM_H__
36#define __MGA_DRM_H__ 36#define __MGA_DRM_H__
37 37
38#include "drm.h" 38#include <drm/drm.h>
39 39
40/* WARNING: If you change any of these defines, make sure to change the 40/* WARNING: If you change any of these defines, make sure to change the
41 * defines in the Xserver file (mga_sarea.h) 41 * defines in the Xserver file (mga_sarea.h)
diff --git a/include/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
index 2a5769fdf8ba..2a5769fdf8ba 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/uapi/drm/nouveau_drm.h
diff --git a/include/drm/r128_drm.h b/include/uapi/drm/r128_drm.h
index 8d8878b55f55..8d8878b55f55 100644
--- a/include/drm/r128_drm.h
+++ b/include/uapi/drm/r128_drm.h
diff --git a/include/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index dc3a8cd7db8a..4766c0f6a838 100644
--- a/include/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -33,7 +33,7 @@
33#ifndef __RADEON_DRM_H__ 33#ifndef __RADEON_DRM_H__
34#define __RADEON_DRM_H__ 34#define __RADEON_DRM_H__
35 35
36#include "drm.h" 36#include <drm/drm.h>
37 37
38/* WARNING: If you change any of these defines, make sure to change the 38/* WARNING: If you change any of these defines, make sure to change the
39 * defines in the X server file (radeon_sarea.h) 39 * defines in the X server file (radeon_sarea.h)
diff --git a/include/drm/savage_drm.h b/include/uapi/drm/savage_drm.h
index 818d49be2e6e..818d49be2e6e 100644
--- a/include/drm/savage_drm.h
+++ b/include/uapi/drm/savage_drm.h
diff --git a/include/drm/sis_drm.h b/include/uapi/drm/sis_drm.h
index df3763222d73..df3763222d73 100644
--- a/include/drm/sis_drm.h
+++ b/include/uapi/drm/sis_drm.h
diff --git a/include/drm/via_drm.h b/include/uapi/drm/via_drm.h
index 79b3b6e0f6b3..8b0533ccbd5a 100644
--- a/include/drm/via_drm.h
+++ b/include/uapi/drm/via_drm.h
@@ -24,7 +24,7 @@
24#ifndef _VIA_DRM_H_ 24#ifndef _VIA_DRM_H_
25#define _VIA_DRM_H_ 25#define _VIA_DRM_H_
26 26
27#include "drm.h" 27#include <drm/drm.h>
28 28
29/* WARNING: These defines must be the same as what the Xserver uses. 29/* WARNING: These defines must be the same as what the Xserver uses.
30 * if you change them, you must change the defines in the Xserver. 30 * if you change them, you must change the defines in the Xserver.
diff --git a/include/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index bcb0912afe7a..bcb0912afe7a 100644
--- a/include/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
new file mode 100644
index 000000000000..b0fd4d03499d
--- /dev/null
+++ b/include/uapi/linux/Kbuild
@@ -0,0 +1,24 @@
1# UAPI Header export list
2header-y += byteorder/
3header-y += can/
4header-y += caif/
5header-y += dvb/
6header-y += hdlc/
7header-y += hsi/
8header-y += isdn/
9header-y += mmc/
10header-y += nfsd/
11header-y += raid/
12header-y += spi/
13header-y += sunrpc/
14header-y += tc_act/
15header-y += tc_ematch/
16header-y += netfilter/
17header-y += netfilter_arp/
18header-y += netfilter_bridge/
19header-y += netfilter_ipv4/
20header-y += netfilter_ipv6/
21header-y += usb/
22header-y += wimax/
23
24genhdr-y += version.h
diff --git a/include/uapi/linux/byteorder/Kbuild b/include/uapi/linux/byteorder/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/byteorder/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/caif/Kbuild b/include/uapi/linux/caif/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/caif/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/can/Kbuild b/include/uapi/linux/can/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/can/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/dvb/Kbuild b/include/uapi/linux/dvb/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/dvb/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/hdlc/Kbuild b/include/uapi/linux/hdlc/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/hdlc/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/hsi/Kbuild b/include/uapi/linux/hsi/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/hsi/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/isdn/Kbuild b/include/uapi/linux/isdn/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/isdn/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/mmc/Kbuild b/include/uapi/linux/mmc/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/mmc/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
new file mode 100644
index 000000000000..4afbace8e869
--- /dev/null
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -0,0 +1,2 @@
1# UAPI Header export list
2header-y += ipset/
diff --git a/include/uapi/linux/netfilter/ipset/Kbuild b/include/uapi/linux/netfilter/ipset/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/netfilter/ipset/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/netfilter_arp/Kbuild b/include/uapi/linux/netfilter_arp/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/netfilter_arp/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/netfilter_bridge/Kbuild b/include/uapi/linux/netfilter_bridge/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/netfilter_bridge/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/netfilter_ipv4/Kbuild b/include/uapi/linux/netfilter_ipv4/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/netfilter_ipv6/Kbuild b/include/uapi/linux/netfilter_ipv6/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv6/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/nfsd/Kbuild b/include/uapi/linux/nfsd/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/nfsd/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/raid/Kbuild b/include/uapi/linux/raid/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/raid/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/spi/Kbuild b/include/uapi/linux/spi/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/spi/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/sunrpc/Kbuild b/include/uapi/linux/sunrpc/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/sunrpc/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/tc_ematch/Kbuild b/include/uapi/linux/tc_ematch/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/tc_ematch/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/usb/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/linux/wimax/Kbuild b/include/uapi/linux/wimax/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/linux/wimax/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/mtd/Kbuild b/include/uapi/mtd/Kbuild
new file mode 100644
index 000000000000..5a691e10cd0e
--- /dev/null
+++ b/include/uapi/mtd/Kbuild
@@ -0,0 +1,6 @@
1# UAPI Header export list
2header-y += inftl-user.h
3header-y += mtd-abi.h
4header-y += mtd-user.h
5header-y += nftl-user.h
6header-y += ubi-user.h
diff --git a/include/mtd/inftl-user.h b/include/uapi/mtd/inftl-user.h
index 8376bd1a9e01..8376bd1a9e01 100644
--- a/include/mtd/inftl-user.h
+++ b/include/uapi/mtd/inftl-user.h
diff --git a/include/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index 36eace03b2ac..36eace03b2ac 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
diff --git a/include/mtd/mtd-user.h b/include/uapi/mtd/mtd-user.h
index 83327c808c86..83327c808c86 100644
--- a/include/mtd/mtd-user.h
+++ b/include/uapi/mtd/mtd-user.h
diff --git a/include/mtd/nftl-user.h b/include/uapi/mtd/nftl-user.h
index bdeabd86ad99..bdeabd86ad99 100644
--- a/include/mtd/nftl-user.h
+++ b/include/uapi/mtd/nftl-user.h
diff --git a/include/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h
index 8787349fbafe..53cae1e11e57 100644
--- a/include/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
@@ -222,6 +222,7 @@ enum {
222 * @ubi_num: UBI device number to create 222 * @ubi_num: UBI device number to create
223 * @mtd_num: MTD device number to attach 223 * @mtd_num: MTD device number to attach
224 * @vid_hdr_offset: VID header offset (use defaults if %0) 224 * @vid_hdr_offset: VID header offset (use defaults if %0)
225 * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs
225 * @padding: reserved for future, not used, has to be zeroed 226 * @padding: reserved for future, not used, has to be zeroed
226 * 227 *
227 * This data structure is used to specify MTD device UBI has to attach and the 228 * This data structure is used to specify MTD device UBI has to attach and the
@@ -245,12 +246,25 @@ enum {
245 * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes 246 * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes
246 * aligned, which is OK, as UBI is clever enough to realize this is 4th 247 * aligned, which is OK, as UBI is clever enough to realize this is 4th
247 * sub-page of the first page and add needed padding. 248 * sub-page of the first page and add needed padding.
249 *
250 * The @max_beb_per1024 is the maximum amount of bad PEBs UBI expects on the
251 * UBI device per 1024 eraseblocks. This value is often given in an other form
252 * in the NAND datasheet (min NVB i.e. minimal number of valid blocks). The
253 * maximum expected bad eraseblocks per 1024 is then:
254 * 1024 * (1 - MinNVB / MaxNVB)
255 * Which gives 20 for most NAND devices. This limit is used in order to derive
256 * amount of eraseblock UBI reserves for handling new bad blocks. If the device
257 * has more bad eraseblocks than this limit, UBI does not reserve any physical
258 * eraseblocks for new bad eraseblocks, but attempts to use available
259 * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the
260 * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used.
248 */ 261 */
249struct ubi_attach_req { 262struct ubi_attach_req {
250 __s32 ubi_num; 263 __s32 ubi_num;
251 __s32 mtd_num; 264 __s32 mtd_num;
252 __s32 vid_hdr_offset; 265 __s32 vid_hdr_offset;
253 __s8 padding[12]; 266 __s16 max_beb_per1024;
267 __s8 padding[10];
254}; 268};
255 269
256/** 270/**
diff --git a/include/uapi/rdma/Kbuild b/include/uapi/rdma/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/rdma/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/scsi/Kbuild b/include/uapi/scsi/Kbuild
new file mode 100644
index 000000000000..29a87dd26cfb
--- /dev/null
+++ b/include/uapi/scsi/Kbuild
@@ -0,0 +1,2 @@
1# UAPI Header export list
2header-y += fc/
diff --git a/include/uapi/scsi/fc/Kbuild b/include/uapi/scsi/fc/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/scsi/fc/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/sound/Kbuild b/include/uapi/sound/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/sound/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/video/Kbuild b/include/uapi/video/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/video/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/uapi/xen/Kbuild b/include/uapi/xen/Kbuild
new file mode 100644
index 000000000000..aafaa5aa54d4
--- /dev/null
+++ b/include/uapi/xen/Kbuild
@@ -0,0 +1 @@
# UAPI Header export list
diff --git a/include/video/epson1355.h b/include/video/epson1355.h
deleted file mode 100644
index 9759f299499e..000000000000
--- a/include/video/epson1355.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * include/video/epson13xx.h -- Epson 13xx frame buffer
3 *
4 * Copyright (C) Hewlett-Packard Company. All rights reserved.
5 *
6 * Written by Christopher Hoover <ch@hpl.hp.com>
7 *
8 */
9
10#ifndef _EPSON13XX_H_
11#define _EPSON13XX_H_
12
13#define REG_REVISION_CODE 0x00
14#define REG_MEMORY_CONFIG 0x01
15#define REG_PANEL_TYPE 0x02
16#define REG_MOD_RATE 0x03
17#define REG_HORZ_DISP_WIDTH 0x04
18#define REG_HORZ_NONDISP_PERIOD 0x05
19#define REG_HRTC_START_POSITION 0x06
20#define REG_HRTC_PULSE_WIDTH 0x07
21#define REG_VERT_DISP_HEIGHT0 0x08
22#define REG_VERT_DISP_HEIGHT1 0x09
23#define REG_VERT_NONDISP_PERIOD 0x0A
24#define REG_VRTC_START_POSITION 0x0B
25#define REG_VRTC_PULSE_WIDTH 0x0C
26#define REG_DISPLAY_MODE 0x0D
27#define REG_SCRN1_LINE_COMPARE0 0x0E
28#define REG_SCRN1_LINE_COMPARE1 0x0F
29#define REG_SCRN1_DISP_START_ADDR0 0x10
30#define REG_SCRN1_DISP_START_ADDR1 0x11
31#define REG_SCRN1_DISP_START_ADDR2 0x12
32#define REG_SCRN2_DISP_START_ADDR0 0x13
33#define REG_SCRN2_DISP_START_ADDR1 0x14
34#define REG_SCRN2_DISP_START_ADDR2 0x15
35#define REG_MEM_ADDR_OFFSET0 0x16
36#define REG_MEM_ADDR_OFFSET1 0x17
37#define REG_PIXEL_PANNING 0x18
38#define REG_CLOCK_CONFIG 0x19
39#define REG_POWER_SAVE_CONFIG 0x1A
40#define REG_MISC 0x1B
41#define REG_MD_CONFIG_READBACK0 0x1C
42#define REG_MD_CONFIG_READBACK1 0x1D
43#define REG_GPIO_CONFIG0 0x1E
44#define REG_GPIO_CONFIG1 0x1F
45#define REG_GPIO_CONTROL0 0x20
46#define REG_GPIO_CONTROL1 0x21
47#define REG_PERF_ENHANCEMENT0 0x22
48#define REG_PERF_ENHANCEMENT1 0x23
49#define REG_LUT_ADDR 0x24
50#define REG_RESERVED_1 0x25
51#define REG_LUT_DATA 0x26
52#define REG_INK_CURSOR_CONTROL 0x27
53#define REG_CURSOR_X_POSITION0 0x28
54#define REG_CURSOR_X_POSITION1 0x29
55#define REG_CURSOR_Y_POSITION0 0x2A
56#define REG_CURSOR_Y_POSITION1 0x2B
57#define REG_INK_CURSOR_COLOR0_0 0x2C
58#define REG_INK_CURSOR_COLOR0_1 0x2D
59#define REG_INK_CURSOR_COLOR1_0 0x2E
60#define REG_INK_CURSOR_COLOR1_1 0x2F
61#define REG_INK_CURSOR_START_ADDR 0x30
62#define REG_ALTERNATE_FRM 0x31
63
64#endif
diff --git a/include/xen/events.h b/include/xen/events.h
index 9c641deb65d2..c6bfe01acf6b 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -58,8 +58,6 @@ void notify_remote_via_irq(int irq);
58 58
59void xen_irq_resume(void); 59void xen_irq_resume(void);
60 60
61void xen_hvm_prepare_kexec(struct shared_info *sip, unsigned long pfn);
62
63/* Clear an irq's pending state, in preparation for polling on it */ 61/* Clear an irq's pending state, in preparation for polling on it */
64void xen_clear_irq_pending(int irq); 62void xen_clear_irq_pending(int irq);
65void xen_set_irq_pending(int irq); 63void xen_set_irq_pending(int irq);
@@ -111,4 +109,6 @@ int xen_irq_from_gsi(unsigned gsi);
111/* Determine whether to ignore this IRQ if it is passed to a guest. */ 109/* Determine whether to ignore this IRQ if it is passed to a guest. */
112int xen_test_irq_shared(int irq); 110int xen_test_irq_shared(int irq);
113 111
112/* initialize Xen IRQ subsystem */
113void xen_init_IRQ(void);
114#endif /* _XEN_EVENTS_H */ 114#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index 11e27c3af3cb..aecee9d112cb 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -187,6 +187,19 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
187 struct gnttab_map_grant_ref *kmap_ops, 187 struct gnttab_map_grant_ref *kmap_ops,
188 struct page **pages, unsigned int count); 188 struct page **pages, unsigned int count);
189int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops, 189int gnttab_unmap_refs(struct gnttab_unmap_grant_ref *unmap_ops,
190 struct page **pages, unsigned int count, bool clear_pte); 190 struct gnttab_map_grant_ref *kunmap_ops,
191 struct page **pages, unsigned int count);
192
193/* Perform a batch of grant map/copy operations. Retry every batch slot
194 * for which the hypervisor returns GNTST_eagain. This is typically due
195 * to paged out target frames.
196 *
197 * Will retry for 1, 2, ... 255 ms, i.e. 256 times during 32 seconds.
198 *
199 * Return value in each iand every status field of the batch guaranteed
200 * to not be GNTST_eagain.
201 */
202void gnttab_batch_map(struct gnttab_map_grant_ref *batch, unsigned count);
203void gnttab_batch_copy(struct gnttab_copy *batch, unsigned count);
191 204
192#endif /* __ASM_GNTTAB_H__ */ 205#endif /* __ASM_GNTTAB_H__ */
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h
index 2ae3cd243264..8c5fa0e20155 100644
--- a/include/xen/interface/callback.h
+++ b/include/xen/interface/callback.h
@@ -27,7 +27,7 @@
27#ifndef __XEN_PUBLIC_CALLBACK_H__ 27#ifndef __XEN_PUBLIC_CALLBACK_H__
28#define __XEN_PUBLIC_CALLBACK_H__ 28#define __XEN_PUBLIC_CALLBACK_H__
29 29
30#include "xen.h" 30#include <xen/interface/xen.h>
31 31
32/* 32/*
33 * Prototype for this hypercall is: 33 * Prototype for this hypercall is:
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index b6ca39a069d8..131a6ccdba25 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -50,6 +50,9 @@
50/* x86: pirq can be used by HVM guests */ 50/* x86: pirq can be used by HVM guests */
51#define XENFEAT_hvm_pirqs 10 51#define XENFEAT_hvm_pirqs 10
52 52
53/* operation as Dom0 is supported */
54#define XENFEAT_dom0 11
55
53#define XENFEAT_NR_SUBMAPS 1 56#define XENFEAT_NR_SUBMAPS 1
54 57
55#endif /* __XEN_PUBLIC_FEATURES_H__ */ 58#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index a17d84433e6a..f9f8b975ae74 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -338,7 +338,7 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_dump_table);
338#define GNTTABOP_transfer 4 338#define GNTTABOP_transfer 4
339struct gnttab_transfer { 339struct gnttab_transfer {
340 /* IN parameters. */ 340 /* IN parameters. */
341 unsigned long mfn; 341 xen_pfn_t mfn;
342 domid_t domid; 342 domid_t domid;
343 grant_ref_t ref; 343 grant_ref_t ref;
344 /* OUT parameters. */ 344 /* OUT parameters. */
@@ -375,7 +375,7 @@ struct gnttab_copy {
375 struct { 375 struct {
376 union { 376 union {
377 grant_ref_t ref; 377 grant_ref_t ref;
378 unsigned long gmfn; 378 xen_pfn_t gmfn;
379 } u; 379 } u;
380 domid_t domid; 380 domid_t domid;
381 uint16_t offset; 381 uint16_t offset;
@@ -519,7 +519,9 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
519#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */ 519#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */
520#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */ 520#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */
521#define GNTST_bad_page (-9) /* Specified page was invalid for op. */ 521#define GNTST_bad_page (-9) /* Specified page was invalid for op. */
522#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */ 522#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */
523#define GNTST_address_too_big (-11) /* transfer page address too large. */
524#define GNTST_eagain (-12) /* Operation not done; try again. */
523 525
524#define GNTTABOP_error_msgs { \ 526#define GNTTABOP_error_msgs { \
525 "okay", \ 527 "okay", \
@@ -532,7 +534,9 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
532 "no spare translation slot in the I/O MMU", \ 534 "no spare translation slot in the I/O MMU", \
533 "permission denied", \ 535 "permission denied", \
534 "bad page", \ 536 "bad page", \
535 "copy arguments cross page boundary" \ 537 "copy arguments cross page boundary", \
538 "page address size too large", \
539 "operation not done; try again" \
536} 540}
537 541
538#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */ 542#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
index 1b4f923d7086..a6c79911e729 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -21,7 +21,7 @@
21#ifndef __XEN_PUBLIC_HVM_PARAMS_H__ 21#ifndef __XEN_PUBLIC_HVM_PARAMS_H__
22#define __XEN_PUBLIC_HVM_PARAMS_H__ 22#define __XEN_PUBLIC_HVM_PARAMS_H__
23 23
24#include "hvm_op.h" 24#include <xen/interface/hvm/hvm_op.h>
25 25
26/* 26/*
27 * Parameter space for HVMOP_{set,get}_param. 27 * Parameter space for HVMOP_{set,get}_param.
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h
index ee338bfde18b..01c3d62436ef 100644
--- a/include/xen/interface/io/blkif.h
+++ b/include/xen/interface/io/blkif.h
@@ -9,8 +9,8 @@
9#ifndef __XEN_PUBLIC_IO_BLKIF_H__ 9#ifndef __XEN_PUBLIC_IO_BLKIF_H__
10#define __XEN_PUBLIC_IO_BLKIF_H__ 10#define __XEN_PUBLIC_IO_BLKIF_H__
11 11
12#include "ring.h" 12#include <xen/interface/io/ring.h>
13#include "../grant_table.h" 13#include <xen/interface/grant_table.h>
14 14
15/* 15/*
16 * Front->back notifications: When enqueuing a new request, sending a 16 * Front->back notifications: When enqueuing a new request, sending a
diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h
index cb94668f6e9f..9dfc12000980 100644
--- a/include/xen/interface/io/netif.h
+++ b/include/xen/interface/io/netif.h
@@ -9,8 +9,8 @@
9#ifndef __XEN_PUBLIC_IO_NETIF_H__ 9#ifndef __XEN_PUBLIC_IO_NETIF_H__
10#define __XEN_PUBLIC_IO_NETIF_H__ 10#define __XEN_PUBLIC_IO_NETIF_H__
11 11
12#include "ring.h" 12#include <xen/interface/io/ring.h>
13#include "../grant_table.h" 13#include <xen/interface/grant_table.h>
14 14
15/* 15/*
16 * Notifications after enqueuing any type of message should be conditional on 16 * Notifications after enqueuing any type of message should be conditional on
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
index 01fc8ae5f0b0..0eafaf254fff 100644
--- a/include/xen/interface/io/protocols.h
+++ b/include/xen/interface/io/protocols.h
@@ -5,6 +5,7 @@
5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" 5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi" 6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" 7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi"
8#define XEN_IO_PROTO_ABI_ARM "arm-abi"
8 9
9#if defined(__i386__) 10#if defined(__i386__)
10# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 11# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -14,6 +15,8 @@
14# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 15# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
15#elif defined(__powerpc64__) 16#elif defined(__powerpc64__)
16# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 17# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
18#elif defined(__arm__)
19# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
17#else 20#else
18# error arch fixup needed here 21# error arch fixup needed here
19#endif 22#endif
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index eac3ce153719..b66d04ce6957 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -31,10 +31,10 @@ struct xen_memory_reservation {
31 * OUT: GMFN bases of extents that were allocated 31 * OUT: GMFN bases of extents that were allocated
32 * (NB. This command also updates the mach_to_phys translation table) 32 * (NB. This command also updates the mach_to_phys translation table)
33 */ 33 */
34 GUEST_HANDLE(ulong) extent_start; 34 GUEST_HANDLE(xen_pfn_t) extent_start;
35 35
36 /* Number of extents, and size/alignment of each (2^extent_order pages). */ 36 /* Number of extents, and size/alignment of each (2^extent_order pages). */
37 unsigned long nr_extents; 37 xen_ulong_t nr_extents;
38 unsigned int extent_order; 38 unsigned int extent_order;
39 39
40 /* 40 /*
@@ -92,7 +92,7 @@ struct xen_memory_exchange {
92 * command will be non-zero. 92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER! 93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
94 */ 94 */
95 unsigned long nr_exchanged; 95 xen_ulong_t nr_exchanged;
96}; 96};
97 97
98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange); 98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
@@ -130,7 +130,7 @@ struct xen_machphys_mfn_list {
130 * any large discontiguities in the machine address space, 2MB gaps in 130 * any large discontiguities in the machine address space, 2MB gaps in
131 * the machphys table will be represented by an MFN base of zero. 131 * the machphys table will be represented by an MFN base of zero.
132 */ 132 */
133 GUEST_HANDLE(ulong) extent_start; 133 GUEST_HANDLE(xen_pfn_t) extent_start;
134 134
135 /* 135 /*
136 * Number of extents written to the above array. This will be smaller 136 * Number of extents written to the above array. This will be smaller
@@ -148,8 +148,8 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
148 */ 148 */
149#define XENMEM_machphys_mapping 12 149#define XENMEM_machphys_mapping 12
150struct xen_machphys_mapping { 150struct xen_machphys_mapping {
151 unsigned long v_start, v_end; /* Start and end virtual addresses. */ 151 xen_ulong_t v_start, v_end; /* Start and end virtual addresses. */
152 unsigned long max_mfn; /* Maximum MFN that can be looked up. */ 152 xen_ulong_t max_mfn; /* Maximum MFN that can be looked up. */
153}; 153};
154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t); 154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
155 155
@@ -163,16 +163,19 @@ struct xen_add_to_physmap {
163 /* Which domain to change the mapping for. */ 163 /* Which domain to change the mapping for. */
164 domid_t domid; 164 domid_t domid;
165 165
166 /* Number of pages to go through for gmfn_range */
167 uint16_t size;
168
166 /* Source mapping space. */ 169 /* Source mapping space. */
167#define XENMAPSPACE_shared_info 0 /* shared info page */ 170#define XENMAPSPACE_shared_info 0 /* shared info page */
168#define XENMAPSPACE_grant_table 1 /* grant table page */ 171#define XENMAPSPACE_grant_table 1 /* grant table page */
169 unsigned int space; 172 unsigned int space;
170 173
171 /* Index into source mapping space. */ 174 /* Index into source mapping space. */
172 unsigned long idx; 175 xen_ulong_t idx;
173 176
174 /* GPFN where the source mapping page should appear. */ 177 /* GPFN where the source mapping page should appear. */
175 unsigned long gpfn; 178 xen_pfn_t gpfn;
176}; 179};
177DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); 180DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
178 181
@@ -186,7 +189,7 @@ struct xen_translate_gpfn_list {
186 domid_t domid; 189 domid_t domid;
187 190
188 /* Length of list. */ 191 /* Length of list. */
189 unsigned long nr_gpfns; 192 xen_ulong_t nr_gpfns;
190 193
191 /* List of GPFNs to translate. */ 194 /* List of GPFNs to translate. */
192 GUEST_HANDLE(ulong) gpfn_list; 195 GUEST_HANDLE(ulong) gpfn_list;
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 9ce788d8cf49..1844d31f4552 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -56,7 +56,7 @@ struct physdev_eoi {
56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28 56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
57struct physdev_pirq_eoi_gmfn { 57struct physdev_pirq_eoi_gmfn {
58 /* IN */ 58 /* IN */
59 unsigned long gmfn; 59 xen_ulong_t gmfn;
60}; 60};
61 61
62/* 62/*
@@ -258,6 +258,22 @@ struct physdev_pci_device {
258 uint8_t devfn; 258 uint8_t devfn;
259}; 259};
260 260
261#define PHYSDEVOP_DBGP_RESET_PREPARE 1
262#define PHYSDEVOP_DBGP_RESET_DONE 2
263
264#define PHYSDEVOP_DBGP_BUS_UNKNOWN 0
265#define PHYSDEVOP_DBGP_BUS_PCI 1
266
267#define PHYSDEVOP_dbgp_op 29
268struct physdev_dbgp_op {
269 /* IN */
270 uint8_t op;
271 uint8_t bus;
272 union {
273 struct physdev_pci_device pci;
274 } u;
275};
276
261/* 277/*
262 * Notify that some PIRQ-bound event channels have been unmasked. 278 * Notify that some PIRQ-bound event channels have been unmasked.
263 * ** This command is obsolete since interface version 0x00030202 and is ** 279 * ** This command is obsolete since interface version 0x00030202 and is **
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index 61fa66160983..4755b5fac9c7 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -27,7 +27,7 @@
27#ifndef __XEN_PUBLIC_PLATFORM_H__ 27#ifndef __XEN_PUBLIC_PLATFORM_H__
28#define __XEN_PUBLIC_PLATFORM_H__ 28#define __XEN_PUBLIC_PLATFORM_H__
29 29
30#include "xen.h" 30#include <xen/interface/xen.h>
31 31
32#define XENPF_INTERFACE_VERSION 0x03000001 32#define XENPF_INTERFACE_VERSION 0x03000001
33 33
@@ -54,7 +54,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_settime_t);
54#define XENPF_add_memtype 31 54#define XENPF_add_memtype 31
55struct xenpf_add_memtype { 55struct xenpf_add_memtype {
56 /* IN variables. */ 56 /* IN variables. */
57 unsigned long mfn; 57 xen_pfn_t mfn;
58 uint64_t nr_mfns; 58 uint64_t nr_mfns;
59 uint32_t type; 59 uint32_t type;
60 /* OUT variables. */ 60 /* OUT variables. */
@@ -84,7 +84,7 @@ struct xenpf_read_memtype {
84 /* IN variables. */ 84 /* IN variables. */
85 uint32_t reg; 85 uint32_t reg;
86 /* OUT variables. */ 86 /* OUT variables. */
87 unsigned long mfn; 87 xen_pfn_t mfn;
88 uint64_t nr_mfns; 88 uint64_t nr_mfns;
89 uint32_t type; 89 uint32_t type;
90}; 90};
@@ -112,6 +112,7 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_platform_quirk_t);
112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */ 112#define XEN_FW_DISK_INFO 1 /* from int 13 AH=08/41/48 */
113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */ 113#define XEN_FW_DISK_MBR_SIGNATURE 2 /* from MBR offset 0x1b8 */
114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */ 114#define XEN_FW_VBEDDC_INFO 3 /* from int 10 AX=4f15 */
115#define XEN_FW_KBD_SHIFT_FLAGS 5 /* Int16, Fn02: Get keyboard shift flags. */
115struct xenpf_firmware_info { 116struct xenpf_firmware_info {
116 /* IN variables. */ 117 /* IN variables. */
117 uint32_t type; 118 uint32_t type;
@@ -142,6 +143,8 @@ struct xenpf_firmware_info {
142 /* must refer to 128-byte buffer */ 143 /* must refer to 128-byte buffer */
143 GUEST_HANDLE(uchar) edid; 144 GUEST_HANDLE(uchar) edid;
144 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */ 145 } vbeddc_info; /* XEN_FW_VBEDDC_INFO */
146
147 uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */
145 } u; 148 } u;
146}; 149};
147DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t); 150DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h
index dd55dac340de..9ce083960a25 100644
--- a/include/xen/interface/sched.h
+++ b/include/xen/interface/sched.h
@@ -9,7 +9,7 @@
9#ifndef __XEN_PUBLIC_SCHED_H__ 9#ifndef __XEN_PUBLIC_SCHED_H__
10#define __XEN_PUBLIC_SCHED_H__ 10#define __XEN_PUBLIC_SCHED_H__
11 11
12#include "event_channel.h" 12#include <xen/interface/event_channel.h>
13 13
14/* 14/*
15 * The prototype for this hypercall is: 15 * The prototype for this hypercall is:
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index e8b6519d47e9..7ff6498679a3 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -45,7 +45,7 @@ struct xen_changeset_info {
45 45
46#define XENVER_platform_parameters 5 46#define XENVER_platform_parameters 5
47struct xen_platform_parameters { 47struct xen_platform_parameters {
48 unsigned long virt_start; 48 xen_ulong_t virt_start;
49}; 49};
50 50
51#define XENVER_get_features 6 51#define XENVER_get_features 6
@@ -55,9 +55,12 @@ struct xen_feature_info {
55}; 55};
56 56
57/* Declares the features reported by XENVER_get_features. */ 57/* Declares the features reported by XENVER_get_features. */
58#include "features.h" 58#include <xen/interface/features.h>
59 59
60/* arg == NULL; returns host memory page size. */ 60/* arg == NULL; returns host memory page size. */
61#define XENVER_pagesize 7 61#define XENVER_pagesize 7
62 62
63/* arg == xen_domain_handle_t. */
64#define XENVER_guest_handle 8
65
63#endif /* __XEN_PUBLIC_VERSION_H__ */ 66#endif /* __XEN_PUBLIC_VERSION_H__ */
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h
index 0801468f9abe..886a5d80a18f 100644
--- a/include/xen/interface/xen.h
+++ b/include/xen/interface/xen.h
@@ -10,7 +10,6 @@
10#define __XEN_PUBLIC_XEN_H__ 10#define __XEN_PUBLIC_XEN_H__
11 11
12#include <asm/xen/interface.h> 12#include <asm/xen/interface.h>
13#include <asm/pvclock-abi.h>
14 13
15/* 14/*
16 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS). 15 * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
@@ -190,7 +189,7 @@ struct mmuext_op {
190 unsigned int cmd; 189 unsigned int cmd;
191 union { 190 union {
192 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */ 191 /* [UN]PIN_TABLE, NEW_BASEPTR, NEW_USER_BASEPTR */
193 unsigned long mfn; 192 xen_pfn_t mfn;
194 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */ 193 /* INVLPG_LOCAL, INVLPG_ALL, SET_LDT */
195 unsigned long linear_addr; 194 unsigned long linear_addr;
196 } arg1; 195 } arg1;
@@ -430,11 +429,11 @@ struct start_info {
430 unsigned long nr_pages; /* Total pages allocated to this domain. */ 429 unsigned long nr_pages; /* Total pages allocated to this domain. */
431 unsigned long shared_info; /* MACHINE address of shared info struct. */ 430 unsigned long shared_info; /* MACHINE address of shared info struct. */
432 uint32_t flags; /* SIF_xxx flags. */ 431 uint32_t flags; /* SIF_xxx flags. */
433 unsigned long store_mfn; /* MACHINE page number of shared page. */ 432 xen_pfn_t store_mfn; /* MACHINE page number of shared page. */
434 uint32_t store_evtchn; /* Event channel for store communication. */ 433 uint32_t store_evtchn; /* Event channel for store communication. */
435 union { 434 union {
436 struct { 435 struct {
437 unsigned long mfn; /* MACHINE page number of console page. */ 436 xen_pfn_t mfn; /* MACHINE page number of console page. */
438 uint32_t evtchn; /* Event channel for console page. */ 437 uint32_t evtchn; /* Event channel for console page. */
439 } domU; 438 } domU;
440 struct { 439 struct {
@@ -455,6 +454,7 @@ struct dom0_vga_console_info {
455 uint8_t video_type; 454 uint8_t video_type;
456#define XEN_VGATYPE_TEXT_MODE_3 0x03 455#define XEN_VGATYPE_TEXT_MODE_3 0x03
457#define XEN_VGATYPE_VESA_LFB 0x23 456#define XEN_VGATYPE_VESA_LFB 0x23
457#define XEN_VGATYPE_EFI_LFB 0x70
458 458
459 union { 459 union {
460 struct { 460 struct {
diff --git a/include/xen/privcmd.h b/include/xen/privcmd.h
index 17857fb4d550..a85316811d79 100644
--- a/include/xen/privcmd.h
+++ b/include/xen/privcmd.h
@@ -35,8 +35,7 @@
35 35
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/compiler.h> 37#include <linux/compiler.h>
38 38#include <xen/interface/xen.h>
39typedef unsigned long xen_pfn_t;
40 39
41struct privcmd_hypercall { 40struct privcmd_hypercall {
42 __u64 op; 41 __u64 op;
@@ -59,13 +58,33 @@ struct privcmd_mmapbatch {
59 int num; /* number of pages to populate */ 58 int num; /* number of pages to populate */
60 domid_t dom; /* target domain */ 59 domid_t dom; /* target domain */
61 __u64 addr; /* virtual address */ 60 __u64 addr; /* virtual address */
62 xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */ 61 xen_pfn_t __user *arr; /* array of mfns - or'd with
62 PRIVCMD_MMAPBATCH_*_ERROR on err */
63};
64
65#define PRIVCMD_MMAPBATCH_MFN_ERROR 0xf0000000U
66#define PRIVCMD_MMAPBATCH_PAGED_ERROR 0x80000000U
67
68struct privcmd_mmapbatch_v2 {
69 unsigned int num; /* number of pages to populate */
70 domid_t dom; /* target domain */
71 __u64 addr; /* virtual address */
72 const xen_pfn_t __user *arr; /* array of mfns */
73 int __user *err; /* array of error codes */
63}; 74};
64 75
65/* 76/*
66 * @cmd: IOCTL_PRIVCMD_HYPERCALL 77 * @cmd: IOCTL_PRIVCMD_HYPERCALL
67 * @arg: &privcmd_hypercall_t 78 * @arg: &privcmd_hypercall_t
68 * Return: Value returned from execution of the specified hypercall. 79 * Return: Value returned from execution of the specified hypercall.
80 *
81 * @cmd: IOCTL_PRIVCMD_MMAPBATCH_V2
82 * @arg: &struct privcmd_mmapbatch_v2
83 * Return: 0 on success (i.e., arg->err contains valid error codes for
84 * each frame). On an error other than a failed frame remap, -1 is
85 * returned and errno is set to EINVAL, EFAULT etc. As an exception,
86 * if the operation was otherwise successful but any frame failed with
87 * -ENOENT, then -1 is returned and errno is set to ENOENT.
69 */ 88 */
70#define IOCTL_PRIVCMD_HYPERCALL \ 89#define IOCTL_PRIVCMD_HYPERCALL \
71 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall)) 90 _IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall))
@@ -73,5 +92,7 @@ struct privcmd_mmapbatch {
73 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap)) 92 _IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap))
74#define IOCTL_PRIVCMD_MMAPBATCH \ 93#define IOCTL_PRIVCMD_MMAPBATCH \
75 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch)) 94 _IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch))
95#define IOCTL_PRIVCMD_MMAPBATCH_V2 \
96 _IOC(_IOC_NONE, 'P', 4, sizeof(struct privcmd_mmapbatch_v2))
76 97
77#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */ 98#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
diff --git a/include/xen/swiotlb-xen.h b/include/xen/swiotlb-xen.h
index 4f4d449f00f6..de8bcc641c49 100644
--- a/include/xen/swiotlb-xen.h
+++ b/include/xen/swiotlb-xen.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/swiotlb.h> 4#include <linux/swiotlb.h>
5 5
6extern void xen_swiotlb_init(int verbose); 6extern int xen_swiotlb_init(int verbose, bool early);
7 7
8extern void 8extern void
9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, 9*xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
@@ -23,15 +23,6 @@ extern dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
23extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr, 23extern void xen_swiotlb_unmap_page(struct device *hwdev, dma_addr_t dev_addr,
24 size_t size, enum dma_data_direction dir, 24 size_t size, enum dma_data_direction dir,
25 struct dma_attrs *attrs); 25 struct dma_attrs *attrs);
26/*
27extern int
28xen_swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
29 enum dma_data_direction dir);
30
31extern void
32xen_swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
33 enum dma_data_direction dir);
34*/
35extern int 26extern int
36xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, 27xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
37 int nelems, enum dma_data_direction dir, 28 int nelems, enum dma_data_direction dir,
diff --git a/include/xen/xen.h b/include/xen/xen.h
index a16402418d31..a74d4362c4f8 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -23,8 +23,8 @@ extern enum xen_domain_type xen_domain_type;
23#include <xen/interface/xen.h> 23#include <xen/interface/xen.h>
24#include <asm/xen/hypervisor.h> 24#include <asm/xen/hypervisor.h>
25 25
26#define xen_initial_domain() (xen_pv_domain() && \ 26#define xen_initial_domain() (xen_domain() && \
27 xen_start_info->flags & SIF_INITDOMAIN) 27 xen_start_info && xen_start_info->flags & SIF_INITDOMAIN)
28#else /* !CONFIG_XEN_DOM0 */ 28#else /* !CONFIG_XEN_DOM0 */
29#define xen_initial_domain() (0) 29#define xen_initial_domain() (0)
30#endif /* CONFIG_XEN_DOM0 */ 30#endif /* CONFIG_XEN_DOM0 */