aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2014-04-14 10:44:42 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-14 10:44:42 -0400
commit740c699a8d316c8bf8593f19e2ca47795e690622 (patch)
treea78886955770a477945c5d84e06b2e7678733b54 /include
parente69af4657e7764d03ad555f0b583d9c4217bcefa (diff)
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
Merge tag 'v3.15-rc1' into perf/urgent
Pick up the latest fixes. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acbuffer.h2
-rw-r--r--include/acpi/acconfig.h2
-rw-r--r--include/acpi/acexcep.h2
-rw-r--r--include/acpi/acnames.h2
-rw-r--r--include/acpi/acoutput.h2
-rw-r--r--include/acpi/acpi.h5
-rw-r--r--include/acpi/acpi_bus.h49
-rw-r--r--include/acpi/acpi_drivers.h26
-rw-r--r--include/acpi/acpi_numa.h1
-rw-r--r--include/acpi/acpiosxf.h2
-rw-r--r--include/acpi/acpixf.h10
-rw-r--r--include/acpi/acrestyp.h2
-rw-r--r--include/acpi/actbl.h2
-rw-r--r--include/acpi/actbl1.h2
-rw-r--r--include/acpi/actbl2.h17
-rw-r--r--include/acpi/actbl3.h2
-rw-r--r--include/acpi/actypes.h66
-rw-r--r--include/acpi/platform/acenv.h2
-rw-r--r--include/acpi/platform/acgcc.h2
-rw-r--r--include/acpi/platform/aclinux.h20
-rw-r--r--include/asm-generic/bug.h60
-rw-r--r--include/asm-generic/cmpxchg-local.h3
-rw-r--r--include/asm-generic/early_ioremap.h42
-rw-r--r--include/asm-generic/gpio.h2
-rw-r--r--include/asm-generic/io.h4
-rw-r--r--include/asm-generic/iomap.h2
-rw-r--r--include/asm-generic/percpu.h13
-rw-r--r--include/asm-generic/syscall.h4
-rw-r--r--include/asm-generic/vmlinux.lds.h21
-rw-r--r--include/crypto/algapi.h9
-rw-r--r--include/crypto/null.h11
-rw-r--r--include/drm/bridge/ptn3460.h37
-rw-r--r--include/drm/drmP.h243
-rw-r--r--include/drm/drm_crtc.h225
-rw-r--r--include/drm/drm_crtc_helper.h6
-rw-r--r--include/drm/drm_dp_helper.h125
-rw-r--r--include/drm/drm_fb_helper.h8
-rw-r--r--include/drm/drm_gem_cma_helper.h2
-rw-r--r--include/drm/drm_mipi_dsi.h6
-rw-r--r--include/drm/drm_mm.h182
-rw-r--r--include/drm/drm_modes.h237
-rw-r--r--include/drm/drm_plane_helper.h49
-rw-r--r--include/drm/drm_vma_manager.h6
-rw-r--r--include/drm/gma_drm.h70
-rw-r--r--include/drm/i915_drm.h20
-rw-r--r--include/drm/ttm/ttm_bo_driver.h49
-rw-r--r--include/drm/ttm/ttm_object.h4
-rw-r--r--include/drm/ttm/ttm_placement.h3
-rw-r--r--include/dt-bindings/clock/bcm281xx.h65
-rw-r--r--include/dt-bindings/clock/exynos-audss-clk.h (renamed from include/dt-bindings/clk/exynos-audss-clk.h)0
-rw-r--r--include/dt-bindings/clock/hi3620-clock.h5
-rw-r--r--include/dt-bindings/clock/hip04-clock.h35
-rw-r--r--include/dt-bindings/clock/r8a7790-clock.h4
-rw-r--r--include/dt-bindings/pinctrl/am43xx.h1
-rw-r--r--include/dt-bindings/reset-controller/stih415-resets.h26
-rw-r--r--include/dt-bindings/reset-controller/stih416-resets.h50
-rw-r--r--include/dt-bindings/sound/tlv320aic31xx-micbias.h8
-rw-r--r--include/dt-bindings/spmi/spmi.h (renamed from include/linux/mfd/pm8xxx/pm8921.h)22
-rw-r--r--include/linux/acpi.h13
-rw-r--r--include/linux/acpi_dma.h5
-rw-r--r--include/linux/atmel-ssc.h1
-rw-r--r--include/linux/audit.h14
-rw-r--r--include/linux/backing-dev.h2
-rw-r--r--include/linux/backlight.h6
-rw-r--r--include/linux/basic_mmio_gpio.h1
-rw-r--r--include/linux/binfmts.h1
-rw-r--r--include/linux/bio.h11
-rw-r--r--include/linux/blk-iopoll.h2
-rw-r--r--include/linux/blk-mq.h5
-rw-r--r--include/linux/blk_types.h2
-rw-r--r--include/linux/blkdev.h18
-rw-r--r--include/linux/brcmphy.h60
-rw-r--r--include/linux/buffer_head.h4
-rw-r--r--include/linux/can/dev.h9
-rw-r--r--include/linux/ccp.h7
-rw-r--r--include/linux/ceph/ceph_features.h12
-rw-r--r--include/linux/ceph/ceph_fs.h5
-rw-r--r--include/linux/ceph/osd_client.h11
-rw-r--r--include/linux/ceph/osdmap.h50
-rw-r--r--include/linux/ceph/rados.h18
-rw-r--r--include/linux/cgroup.h275
-rw-r--r--include/linux/cgroup_subsys.h30
-rw-r--r--include/linux/clk-provider.h8
-rw-r--r--include/linux/clk.h14
-rw-r--r--include/linux/clk/zynq.h2
-rw-r--r--include/linux/compat.h23
-rw-r--r--include/linux/compiler-clang.h12
-rw-r--r--include/linux/compiler.h7
-rw-r--r--include/linux/connector.h2
-rw-r--r--include/linux/cpu.h54
-rw-r--r--include/linux/cpufeature.h60
-rw-r--r--include/linux/cpufreq.h46
-rw-r--r--include/linux/cpuidle.h23
-rw-r--r--include/linux/cpuset.h27
-rw-r--r--include/linux/crash_dump.h1
-rw-r--r--include/linux/cred.h2
-rw-r--r--include/linux/crush/crush.h7
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/decompress/inflate.h4
-rw-r--r--include/linux/device-mapper.h8
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/dmaengine.h14
-rw-r--r--include/linux/dmar.h82
-rw-r--r--include/linux/drbd.h8
-rw-r--r--include/linux/drbd_genl.h6
-rw-r--r--include/linux/dw_dmac.h5
-rw-r--r--include/linux/elevator.h11
-rw-r--r--include/linux/err.h7
-rw-r--r--include/linux/ethtool.h3
-rw-r--r--include/linux/extcon.h12
-rw-r--r--include/linux/extcon/of_extcon.h31
-rw-r--r--include/linux/f2fs_fs.h2
-rw-r--r--include/linux/fdtable.h2
-rw-r--r--include/linux/filter.h118
-rw-r--r--include/linux/fmc-sdb.h2
-rw-r--r--include/linux/fs.h157
-rw-r--r--include/linux/fsl_ifc.h838
-rw-r--r--include/linux/fsnotify_backend.h2
-rw-r--r--include/linux/ftrace.h27
-rw-r--r--include/linux/ftrace_event.h50
-rw-r--r--include/linux/gpio.h2
-rw-r--r--include/linux/gpio/consumer.h15
-rw-r--r--include/linux/gpio/driver.h48
-rw-r--r--include/linux/hdmi.h12
-rw-r--r--include/linux/hid-sensor-hub.h9
-rw-r--r--include/linux/hid-sensor-ids.h26
-rw-r--r--include/linux/hid.h76
-rw-r--r--include/linux/host1x.h1
-rw-r--r--include/linux/hsi/hsi.h2
-rw-r--r--include/linux/hugetlb.h10
-rw-r--r--include/linux/hugetlb_cgroup.h2
-rw-r--r--include/linux/hyperv.h353
-rw-r--r--include/linux/i2c.h1
-rw-r--r--include/linux/i2c/adp5588.h4
-rw-r--r--include/linux/i2c/bfin_twi.h145
-rw-r--r--include/linux/i2c/twl.h12
-rw-r--r--include/linux/i2c/twl4030-madc.h2
-rw-r--r--include/linux/idr.h65
-rw-r--r--include/linux/ieee80211.h239
-rw-r--r--include/linux/if_vlan.h9
-rw-r--r--include/linux/iio/iio.h16
-rw-r--r--include/linux/input/pmic8xxx-keypad.h52
-rw-r--r--include/linux/input/pmic8xxx-pwrkey.h31
-rw-r--r--include/linux/intel-iommu.h1
-rw-r--r--include/linux/io.h2
-rw-r--r--include/linux/ioport.h12
-rw-r--r--include/linux/iova.h2
-rw-r--r--include/linux/irqchip/arm-gic.h7
-rw-r--r--include/linux/irqchip/arm-vic.h6
-rw-r--r--include/linux/irqchip/irq-crossbar.h11
-rw-r--r--include/linux/isapnp.h4
-rw-r--r--include/linux/isdn_ppp.h5
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kernfs.h109
-rw-r--r--include/linux/kfifo.h2
-rw-r--r--include/linux/kmemleak.h2
-rw-r--r--include/linux/kobject.h1
-rw-r--r--include/linux/kvm_host.h20
-rw-r--r--include/linux/lglock.h16
-rw-r--r--include/linux/list_lru.h8
-rw-r--r--include/linux/mbcache.h12
-rw-r--r--include/linux/mcb.h119
-rw-r--r--include/linux/memblock.h2
-rw-r--r--include/linux/memcontrol.h25
-rw-r--r--include/linux/mempolicy.h3
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/arizona/registers.h90
-rw-r--r--include/linux/mfd/bcm590xx.h31
-rw-r--r--include/linux/mfd/da9052/da9052.h1
-rw-r--r--include/linux/mfd/da9063/core.h6
-rw-r--r--include/linux/mfd/da9063/registers.h120
-rw-r--r--include/linux/mfd/dbx500-prcmu.h2
-rw-r--r--include/linux/mfd/lpc_ich.h25
-rw-r--r--include/linux/mfd/max14577-private.h8
-rw-r--r--include/linux/mfd/max14577.h5
-rw-r--r--include/linux/mfd/mc13xxx.h6
-rw-r--r--include/linux/mfd/pm8xxx/irq.h59
-rw-r--r--include/linux/mfd/pm8xxx/rtc.h25
-rw-r--r--include/linux/mfd/rtsx_common.h1
-rw-r--r--include/linux/mfd/rtsx_pci.h8
-rw-r--r--include/linux/mfd/rtsx_usb.h628
-rw-r--r--include/linux/mfd/samsung/core.h22
-rw-r--r--include/linux/mfd/samsung/irq.h81
-rw-r--r--include/linux/mfd/samsung/rtc.h57
-rw-r--r--include/linux/mfd/samsung/s2mpa01.h192
-rw-r--r--include/linux/mfd/samsung/s2mps14.h154
-rw-r--r--include/linux/mfd/samsung/s5m8767.h7
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h18
-rw-r--r--include/linux/mfd/tps65218.h284
-rw-r--r--include/linux/miscdevice.h17
-rw-r--r--include/linux/mlx4/cmd.h8
-rw-r--r--include/linux/mlx4/device.h50
-rw-r--r--include/linux/mlx4/driver.h12
-rw-r--r--include/linux/mlx4/qp.h11
-rw-r--r--include/linux/mlx5/cq.h1
-rw-r--r--include/linux/mlx5/device.h43
-rw-r--r--include/linux/mlx5/driver.h41
-rw-r--r--include/linux/mlx5/qp.h67
-rw-r--r--include/linux/mm.h32
-rw-r--r--include/linux/mm_types.h7
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/host.h13
-rw-r--r--include/linux/mmc/sdhci-spear.h8
-rw-r--r--include/linux/mmc/sdhci.h2
-rw-r--r--include/linux/mmc/sdio_ids.h1
-rw-r--r--include/linux/mmc/slot-gpio.h6
-rw-r--r--include/linux/mmdebug.h4
-rw-r--r--include/linux/mmzone.h6
-rw-r--r--include/linux/mod_devicetable.h27
-rw-r--r--include/linux/module.h21
-rw-r--r--include/linux/moduleparam.h10
-rw-r--r--include/linux/mount.h3
-rw-r--r--include/linux/mpls.h6
-rw-r--r--include/linux/mtd/mtd.h16
-rw-r--r--include/linux/mtd/nand.h135
-rw-r--r--include/linux/nbd.h3
-rw-r--r--include/linux/netdev_features.h2
-rw-r--r--include/linux/netdevice.h181
-rw-r--r--include/linux/netfilter/ipset/ip_set.h15
-rw-r--r--include/linux/netfilter/nfnetlink.h21
-rw-r--r--include/linux/netpoll.h71
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfs_xdr.h3
-rw-r--r--include/linux/nilfs2_fs.h52
-rw-r--r--include/linux/nl802154.h12
-rw-r--r--include/linux/ntb.h19
-rw-r--r--include/linux/nvme.h21
-rw-r--r--include/linux/of.h137
-rw-r--r--include/linux/of_fdt.h4
-rw-r--r--include/linux/of_graph.h66
-rw-r--r--include/linux/of_mtd.h12
-rw-r--r--include/linux/of_reserved_mem.h53
-rw-r--r--include/linux/omap-dma.h25
-rw-r--r--include/linux/pagemap.h43
-rw-r--r--include/linux/pagevec.h5
-rw-r--r--include/linux/pci-acpi.h4
-rw-r--r--include/linux/pci.h11
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/percpu.h350
-rw-r--r--include/linux/perf_event.h16
-rw-r--r--include/linux/phy.h56
-rw-r--r--include/linux/phy/omap_control_phy.h (renamed from include/linux/usb/omap_control_usb.h)36
-rw-r--r--include/linux/phy/omap_usb.h (renamed from include/linux/usb/omap_usb.h)14
-rw-r--r--include/linux/phy/phy.h15
-rw-r--r--include/linux/pipe_fs_i.h21
-rw-r--r--include/linux/platform_data/adau1977.h45
-rw-r--r--include/linux/platform_data/asoc-s3c.h3
-rw-r--r--include/linux/platform_data/asoc-s3c24xx_simtec.h3
-rw-r--r--include/linux/platform_data/ata-samsung_cf.h9
-rw-r--r--include/linux/platform_data/atmel.h1
-rw-r--r--include/linux/platform_data/bt-nokia-h4p.h38
-rw-r--r--include/linux/platform_data/clk-integrator.h1
-rw-r--r--include/linux/platform_data/davinci_asp.h4
-rw-r--r--include/linux/platform_data/dma-rcar-audmapp.h34
-rw-r--r--include/linux/platform_data/elm.h10
-rw-r--r--include/linux/platform_data/gpio-davinci.h4
-rw-r--r--include/linux/platform_data/i2c-s3c2410.h9
-rw-r--r--include/linux/platform_data/leds-s3c24xx.h9
-rw-r--r--include/linux/platform_data/max310x.h64
-rw-r--r--include/linux/platform_data/mmc-msm_sdcc.h7
-rw-r--r--include/linux/platform_data/mmc-mvsdio.h6
-rw-r--r--include/linux/platform_data/mtd-davinci-aemif.h5
-rw-r--r--include/linux/platform_data/mtd-nand-s3c2410.h8
-rw-r--r--include/linux/platform_data/serial-imx.h2
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h9
-rw-r--r--include/linux/platform_data/touchscreen-s3c2410.h17
-rw-r--r--include/linux/platform_data/video-imxfb.h12
-rw-r--r--include/linux/pm.h71
-rw-r--r--include/linux/pm_qos.h34
-rw-r--r--include/linux/pm_runtime.h4
-rw-r--r--include/linux/printk.h16
-rw-r--r--include/linux/ptp_classify.h103
-rw-r--r--include/linux/ptp_clock_kernel.h33
-rw-r--r--include/linux/pwm.h2
-rw-r--r--include/linux/pxa2xx_ssp.h2
-rw-r--r--include/linux/quotaops.h8
-rw-r--r--include/linux/radix-tree.h55
-rw-r--r--include/linux/random.h16
-rw-r--r--include/linux/regmap.h32
-rw-r--r--include/linux/regulator/driver.h8
-rw-r--r--include/linux/regulator/pfuze100.h14
-rw-r--r--include/linux/res_counter.h6
-rw-r--r--include/linux/reset.h65
-rw-r--r--include/linux/rio.h5
-rw-r--r--include/linux/sched.h35
-rw-r--r--include/linux/seccomp.h1
-rw-r--r--include/linux/security.h12
-rw-r--r--include/linux/serial_bcm63xx.h2
-rw-r--r--include/linux/serial_s3c.h2
-rw-r--r--include/linux/serial_sci.h93
-rw-r--r--include/linux/sh_clk.h19
-rw-r--r--include/linux/shmem_fs.h1
-rw-r--r--include/linux/skbuff.h106
-rw-r--r--include/linux/slab.h17
-rw-r--r--include/linux/slub_def.h3
-rw-r--r--include/linux/smp.h8
-rw-r--r--include/linux/spi/spi.h39
-rw-r--r--include/linux/spi/spi_bitbang.h2
-rw-r--r--include/linux/spmi.h191
-rw-r--r--include/linux/ssbi.h20
-rw-r--r--include/linux/sunrpc/bc_xprt.h3
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/svcsock.h3
-rw-r--r--include/linux/sunrpc/xprt.h13
-rw-r--r--include/linux/swap.h36
-rw-r--r--include/linux/sxgbe_platform.h54
-rw-r--r--include/linux/syscalls.h13
-rw-r--r--include/linux/sysfs.h19
-rw-r--r--include/linux/tcp.h8
-rw-r--r--include/linux/topology.h4
-rw-r--r--include/linux/tracepoint.h67
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/tty_ldisc.h1
-rw-r--r--include/linux/u64_stats_sync.h16
-rw-r--r--include/linux/uinput.h2
-rw-r--r--include/linux/uio.h52
-rw-r--r--include/linux/uprobes.h1
-rw-r--r--include/linux/usb.h15
-rw-r--r--include/linux/usb/cdc_ncm.h1
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/usb/hcd.h1
-rw-r--r--include/linux/usb/phy.h16
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/usb/uas.h14
-rw-r--r--include/linux/usb_usual.h6
-rw-r--r--include/linux/vfio.h2
-rw-r--r--include/linux/video_output.h57
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmacache.h38
-rw-r--r--include/linux/vmstat.h25
-rw-r--r--include/linux/wait.h11
-rw-r--r--include/linux/wl12xx.h24
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/linux/xilinxfb.h30
-rw-r--r--include/media/adv7842.h3
-rw-r--r--include/media/lm3646.h87
-rw-r--r--include/media/rc-core.h84
-rw-r--r--include/media/rc-map.h6
-rw-r--r--include/media/v4l2-dev.h3
-rw-r--r--include/media/v4l2-ioctl.h10
-rw-r--r--include/media/v4l2-of.h33
-rw-r--r--include/media/v4l2-subdev.h9
-rw-r--r--include/media/videobuf2-core.h117
-rw-r--r--include/net/6lowpan.h434
-rw-r--r--include/net/9p/client.h6
-rw-r--r--include/net/9p/transport.h3
-rw-r--r--include/net/act_api.h22
-rw-r--r--include/net/addrconf.h6
-rw-r--r--include/net/af_ieee802154.h4
-rw-r--r--include/net/bluetooth/bluetooth.h1
-rw-r--r--include/net/bluetooth/hci.h76
-rw-r--r--include/net/bluetooth/hci_core.h209
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/bluetooth/mgmt.h63
-rw-r--r--include/net/bluetooth/rfcomm.h10
-rw-r--r--include/net/cfg80211.h90
-rw-r--r--include/net/checksum.h23
-rw-r--r--include/net/cls_cgroup.h2
-rw-r--r--include/net/dst.h18
-rw-r--r--include/net/flow.h6
-rw-r--r--include/net/flowcache.h25
-rw-r--r--include/net/ieee80211_radiotap.h4
-rw-r--r--include/net/ieee802154.h28
-rw-r--r--include/net/ieee802154_netdev.h195
-rw-r--r--include/net/ip.h13
-rw-r--r--include/net/ip6_fib.h3
-rw-r--r--include/net/ip6_route.h14
-rw-r--r--include/net/mac80211.h107
-rw-r--r--include/net/mac802154.h41
-rw-r--r--include/net/net_namespace.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_core.h9
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_labels.h4
-rw-r--r--include/net/netfilter/nf_tables.h28
-rw-r--r--include/net/netns/conntrack.h13
-rw-r--r--include/net/netns/ieee802154_6lowpan.h22
-rw-r--r--include/net/netns/xfrm.h11
-rw-r--r--include/net/netprio_cgroup.h17
-rw-r--r--include/net/nfc/digital.h7
-rw-r--r--include/net/nfc/nfc.h3
-rw-r--r--include/net/nl802154.h6
-rw-r--r--include/net/regulatory.h21
-rw-r--r--include/net/route.h1
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sock.h41
-rw-r--r--include/net/tc_act/tc_csum.h4
-rw-r--r--include/net/tc_act/tc_defact.h4
-rw-r--r--include/net/tc_act/tc_gact.h4
-rw-r--r--include/net/tc_act/tc_ipt.h4
-rw-r--r--include/net/tc_act/tc_mirred.h4
-rw-r--r--include/net/tc_act/tc_nat.h4
-rw-r--r--include/net/tc_act/tc_pedit.h4
-rw-r--r--include/net/tc_act/tc_skbedit.h4
-rw-r--r--include/net/tcp.h13
-rw-r--r--include/net/wpan-phy.h19
-rw-r--r--include/net/xfrm.h128
-rw-r--r--include/rdma/ib_cm.h1
-rw-r--r--include/rdma/ib_umem.h11
-rw-r--r--include/rdma/ib_verbs.h201
-rw-r--r--include/scsi/libiscsi.h21
-rw-r--r--include/scsi/libiscsi_tcp.h2
-rw-r--r--include/scsi/scsi_cmnd.h6
-rw-r--r--include/scsi/scsi_device.h26
-rw-r--r--include/scsi/scsi_host.h7
-rw-r--r--include/scsi/scsi_transport_fc.h1
-rw-r--r--include/scsi/scsi_transport_iscsi.h1
-rw-r--r--include/scsi/scsi_transport_srp.h1
-rw-r--r--include/sound/core.h113
-rw-r--r--include/sound/cs8427.h1
-rw-r--r--include/sound/emu10k1.h2
-rw-r--r--include/sound/hwdep.h3
-rw-r--r--include/sound/pcm.h8
-rw-r--r--include/sound/rawmidi.h2
-rw-r--r--include/sound/rcar_snd.h36
-rw-r--r--include/sound/simple_card.h6
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--include/sound/soc-dapm.h40
-rw-r--r--include/sound/soc.h152
-rw-r--r--include/target/iscsi/iscsi_transport.h2
-rw-r--r--include/target/target_core_backend.h2
-rw-r--r--include/target/target_core_base.h33
-rw-r--r--include/target/target_core_fabric.h6
-rw-r--r--include/trace/events/bcache.h52
-rw-r--r--include/trace/events/block.h33
-rw-r--r--include/trace/events/btrfs.h137
-rw-r--r--include/trace/events/ext4.h102
-rw-r--r--include/trace/events/hswadsp.h384
-rw-r--r--include/trace/events/i2c.h372
-rw-r--r--include/trace/events/intel-sst.h148
-rw-r--r--include/trace/events/migrate.h2
-rw-r--r--include/trace/events/module.h4
-rw-r--r--include/trace/events/net.h12
-rw-r--r--include/trace/events/power.h4
-rw-r--r--include/trace/events/syscalls.h3
-rw-r--r--include/trace/events/task.h2
-rw-r--r--include/trace/events/v4l2.h1
-rw-r--r--include/trace/events/writeback.h1
-rw-r--r--include/trace/ftrace.h53
-rw-r--r--include/uapi/asm-generic/fcntl.h19
-rw-r--r--include/uapi/asm-generic/mman-common.h2
-rw-r--r--include/uapi/drm/drm.h17
-rw-r--r--include/uapi/drm/msm_drm.h12
-rw-r--r--include/uapi/drm/radeon_drm.h20
-rw-r--r--include/uapi/drm/tegra_drm.h24
-rw-r--r--include/uapi/drm/vmwgfx_drm.h12
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/audit.h3
-rw-r--r--include/uapi/linux/can.h32
-rw-r--r--include/uapi/linux/can/netlink.h3
-rw-r--r--include/uapi/linux/capability.h4
-rw-r--r--include/uapi/linux/capi.h2
-rw-r--r--include/uapi/linux/ethtool.h439
-rw-r--r--include/uapi/linux/falloc.h35
-rw-r--r--include/uapi/linux/fs.h3
-rw-r--r--include/uapi/linux/fuse.h7
-rw-r--r--include/uapi/linux/gfs2_ondisk.h12
-rw-r--r--include/uapi/linux/hyperv.h390
-rw-r--r--include/uapi/linux/if.h134
-rw-r--r--include/uapi/linux/if_ether.h6
-rw-r--r--include/uapi/linux/if_link.h1
-rw-r--r--include/uapi/linux/in.h4
-rw-r--r--include/uapi/linux/in6.h4
-rw-r--r--include/uapi/linux/kvm.h83
-rw-r--r--include/uapi/linux/libc-compat.h9
-rw-r--r--include/uapi/linux/mpls.h34
-rw-r--r--include/uapi/linux/netdevice.h6
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h12
-rw-r--r--include/uapi/linux/netfilter/nf_tables.h6
-rw-r--r--include/uapi/linux/nfc.h9
-rw-r--r--include/uapi/linux/nl80211.h92
-rw-r--r--include/uapi/linux/nvme.h1
-rw-r--r--include/uapi/linux/pfkeyv2.h15
-rw-r--r--include/uapi/linux/prctl.h3
-rw-r--r--include/uapi/linux/ptp_clock.h39
-rw-r--r--include/uapi/linux/snmp.h6
-rw-r--r--include/uapi/linux/spi/spidev.h14
-rw-r--r--include/uapi/linux/tcp.h3
-rw-r--r--include/uapi/linux/tcp_metrics.h7
-rw-r--r--include/uapi/linux/uhid.h23
-rw-r--r--include/uapi/linux/uinput.h13
-rw-r--r--include/uapi/linux/usb/cdc.h12
-rw-r--r--include/uapi/linux/usb/functionfs.h44
-rw-r--r--include/uapi/linux/usbdevice_fs.h12
-rw-r--r--include/uapi/linux/v4l2-common.h10
-rw-r--r--include/uapi/linux/v4l2-controls.h19
-rw-r--r--include/uapi/linux/v4l2-dv-timings.h17
-rw-r--r--include/uapi/linux/v4l2-subdev.h14
-rw-r--r--include/uapi/linux/vfio.h6
-rw-r--r--include/uapi/linux/videodev2.h74
-rw-r--r--include/uapi/linux/xattr.h7
-rw-r--r--include/uapi/linux/xfrm.h10
-rw-r--r--include/uapi/mtd/ubi-user.h22
-rw-r--r--include/video/omapdss.h19
-rw-r--r--include/video/sgivw.h681
-rw-r--r--include/xen/events.h6
-rw-r--r--include/xen/interface/physdev.h10
-rw-r--r--include/xen/xen-ops.h4
-rw-r--r--include/xen/xenbus.h1
501 files changed, 13301 insertions, 4555 deletions
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h
index c927a0b1de78..88cb477524a6 100644
--- a/include/acpi/acbuffer.h
+++ b/include/acpi/acbuffer.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 3ea214cff349..932a60d6ed82 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h
index 4e280bd226dd..8b06e4c1dd5d 100644
--- a/include/acpi/acexcep.h
+++ b/include/acpi/acexcep.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index 1f36777e26fe..3dd6e838dc30 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h
index 4607b027a657..1baae6edda89 100644
--- a/include/acpi/acoutput.h
+++ b/include/acpi/acoutput.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpi.h b/include/acpi/acpi.h
index 618787715d56..ca0cb603b171 100644
--- a/include/acpi/acpi.h
+++ b/include/acpi/acpi.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -62,5 +62,8 @@
62#include <acpi/acrestyp.h> /* Resource Descriptor structs */ 62#include <acpi/acrestyp.h> /* Resource Descriptor structs */
63#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */ 63#include <acpi/acpiosxf.h> /* OSL interfaces (ACPICA-to-OS) */
64#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */ 64#include <acpi/acpixf.h> /* ACPI core subsystem external interfaces */
65#ifdef ACPI_NATIVE_INTERFACE_HEADER
66#include ACPI_NATIVE_INTERFACE_HEADER
67#endif
65 68
66#endif /* __ACPI_H__ */ 69#endif /* __ACPI_H__ */
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 8256eb4ad057..84a2e29a2314 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -49,8 +49,8 @@ acpi_evaluate_reference(acpi_handle handle,
49 struct acpi_object_list *arguments, 49 struct acpi_object_list *arguments,
50 struct acpi_handle_list *list); 50 struct acpi_handle_list *list);
51acpi_status 51acpi_status
52acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, 52acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
53 u32 status_code, struct acpi_buffer *status_buf); 53 struct acpi_buffer *status_buf);
54 54
55acpi_status 55acpi_status
56acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld); 56acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
@@ -133,10 +133,24 @@ struct acpi_scan_handler {
133 struct list_head list_node; 133 struct list_head list_node;
134 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); 134 int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
135 void (*detach)(struct acpi_device *dev); 135 void (*detach)(struct acpi_device *dev);
136 void (*bind)(struct device *phys_dev);
137 void (*unbind)(struct device *phys_dev);
136 struct acpi_hotplug_profile hotplug; 138 struct acpi_hotplug_profile hotplug;
137}; 139};
138 140
139/* 141/*
142 * ACPI Hotplug Context
143 * --------------------
144 */
145
146struct acpi_hotplug_context {
147 struct acpi_device *self;
148 int (*notify)(struct acpi_device *, u32);
149 void (*uevent)(struct acpi_device *, u32);
150 void (*fixup)(struct acpi_device *);
151};
152
153/*
140 * ACPI Driver 154 * ACPI Driver
141 * ----------- 155 * -----------
142 */ 156 */
@@ -190,7 +204,9 @@ struct acpi_device_flags {
190 u32 initialized:1; 204 u32 initialized:1;
191 u32 visited:1; 205 u32 visited:1;
192 u32 no_hotplug:1; 206 u32 no_hotplug:1;
193 u32 reserved:24; 207 u32 hotplug_notify:1;
208 u32 is_dock_station:1;
209 u32 reserved:22;
194}; 210};
195 211
196/* File System */ 212/* File System */
@@ -329,6 +345,7 @@ struct acpi_device {
329 struct acpi_device_perf performance; 345 struct acpi_device_perf performance;
330 struct acpi_device_dir dir; 346 struct acpi_device_dir dir;
331 struct acpi_scan_handler *handler; 347 struct acpi_scan_handler *handler;
348 struct acpi_hotplug_context *hp;
332 struct acpi_driver *driver; 349 struct acpi_driver *driver;
333 void *driver_data; 350 void *driver_data;
334 struct device dev; 351 struct device dev;
@@ -351,6 +368,24 @@ static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
351 *((u32 *)&adev->status) = sta; 368 *((u32 *)&adev->status) = sta;
352} 369}
353 370
371static inline void acpi_set_hp_context(struct acpi_device *adev,
372 struct acpi_hotplug_context *hp,
373 int (*notify)(struct acpi_device *, u32),
374 void (*uevent)(struct acpi_device *, u32),
375 void (*fixup)(struct acpi_device *))
376{
377 hp->self = adev;
378 hp->notify = notify;
379 hp->uevent = uevent;
380 hp->fixup = fixup;
381 adev->hp = hp;
382}
383
384void acpi_initialize_hp_context(struct acpi_device *adev,
385 struct acpi_hotplug_context *hp,
386 int (*notify)(struct acpi_device *, u32),
387 void (*uevent)(struct acpi_device *, u32));
388
354/* acpi_device.dev.bus == &acpi_bus_type */ 389/* acpi_device.dev.bus == &acpi_bus_type */
355extern struct bus_type acpi_bus_type; 390extern struct bus_type acpi_bus_type;
356 391
@@ -381,6 +416,8 @@ extern int unregister_acpi_notifier(struct notifier_block *);
381 */ 416 */
382 417
383int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device); 418int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device);
419struct acpi_device *acpi_bus_get_acpi_device(acpi_handle handle);
420void acpi_bus_put_acpi_device(struct acpi_device *adev);
384acpi_status acpi_bus_get_status_handle(acpi_handle handle, 421acpi_status acpi_bus_get_status_handle(acpi_handle handle,
385 unsigned long long *sta); 422 unsigned long long *sta);
386int acpi_bus_get_status(struct acpi_device *device); 423int acpi_bus_get_status(struct acpi_device *device);
@@ -402,6 +439,8 @@ static inline bool acpi_bus_can_wakeup(acpi_handle handle) { return false; }
402 439
403void acpi_scan_lock_acquire(void); 440void acpi_scan_lock_acquire(void);
404void acpi_scan_lock_release(void); 441void acpi_scan_lock_release(void);
442void acpi_lock_hp_context(void);
443void acpi_unlock_hp_context(void);
405int acpi_scan_add_handler(struct acpi_scan_handler *handler); 444int acpi_scan_add_handler(struct acpi_scan_handler *handler);
406int acpi_bus_register_driver(struct acpi_driver *driver); 445int acpi_bus_register_driver(struct acpi_driver *driver);
407void acpi_bus_unregister_driver(struct acpi_driver *driver); 446void acpi_bus_unregister_driver(struct acpi_driver *driver);
@@ -418,10 +457,6 @@ static inline bool acpi_device_enumerated(struct acpi_device *adev)
418 return adev && adev->flags.initialized && adev->flags.visited; 457 return adev && adev->flags.initialized && adev->flags.visited;
419} 458}
420 459
421typedef void (*acpi_hp_callback)(void *data, u32 src);
422
423acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src);
424
425/** 460/**
426 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver 461 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
427 * @__acpi_driver: acpi_driver struct 462 * @__acpi_driver: acpi_driver struct
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index b124fdb26046..d504613bbf80 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -109,36 +109,14 @@ void pci_acpi_crs_quirks(void);
109/*-------------------------------------------------------------------------- 109/*--------------------------------------------------------------------------
110 Dock Station 110 Dock Station
111 -------------------------------------------------------------------------- */ 111 -------------------------------------------------------------------------- */
112struct acpi_dock_ops {
113 acpi_notify_handler fixup;
114 acpi_notify_handler handler;
115 acpi_notify_handler uevent;
116};
117 112
118#ifdef CONFIG_ACPI_DOCK 113#ifdef CONFIG_ACPI_DOCK
119extern int is_dock_device(acpi_handle handle); 114extern int is_dock_device(struct acpi_device *adev);
120extern int register_hotplug_dock_device(acpi_handle handle,
121 const struct acpi_dock_ops *ops,
122 void *context,
123 void (*init)(void *),
124 void (*release)(void *));
125extern void unregister_hotplug_dock_device(acpi_handle handle);
126#else 115#else
127static inline int is_dock_device(acpi_handle handle) 116static inline int is_dock_device(struct acpi_device *adev)
128{ 117{
129 return 0; 118 return 0;
130} 119}
131static inline int register_hotplug_dock_device(acpi_handle handle,
132 const struct acpi_dock_ops *ops,
133 void *context,
134 void (*init)(void *),
135 void (*release)(void *))
136{
137 return -ENODEV;
138}
139static inline void unregister_hotplug_dock_device(acpi_handle handle)
140{
141}
142#endif /* CONFIG_ACPI_DOCK */ 120#endif /* CONFIG_ACPI_DOCK */
143 121
144#endif /*__ACPI_DRIVERS_H__*/ 122#endif /*__ACPI_DRIVERS_H__*/
diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
index 451823cb8837..94a37cd7fbda 100644
--- a/include/acpi/acpi_numa.h
+++ b/include/acpi/acpi_numa.h
@@ -13,7 +13,6 @@
13 13
14extern int pxm_to_node(int); 14extern int pxm_to_node(int);
15extern int node_to_pxm(int); 15extern int node_to_pxm(int);
16extern void __acpi_map_pxm_to_node(int, int);
17extern int acpi_map_pxm_to_node(int); 16extern int acpi_map_pxm_to_node(int);
18extern unsigned char acpi_srat_revision; 17extern unsigned char acpi_srat_revision;
19 18
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 01e6c6d8b7e1..f6f5f8af2112 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -7,7 +7,7 @@
7 *****************************************************************************/ 7 *****************************************************************************/
8 8
9/* 9/*
10 * Copyright (C) 2000 - 2013, Intel Corp. 10 * Copyright (C) 2000 - 2014, Intel Corp.
11 * All rights reserved. 11 * All rights reserved.
12 * 12 *
13 * Redistribution and use in source and binary forms, with or without 13 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index fea6773f87fc..44f5e9749601 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
46 46
47/* Current ACPICA subsystem version in YYYYMMDD format */ 47/* Current ACPICA subsystem version in YYYYMMDD format */
48 48
49#define ACPI_CA_VERSION 0x20131218 49#define ACPI_CA_VERSION 0x20140214
50 50
51#include <acpi/acconfig.h> 51#include <acpi/acconfig.h>
52#include <acpi/actypes.h> 52#include <acpi/actypes.h>
@@ -71,7 +71,7 @@ extern u32 acpi_dbg_layer;
71 71
72/* ACPICA runtime options */ 72/* ACPICA runtime options */
73 73
74extern u8 acpi_gbl_all_methods_serialized; 74extern u8 acpi_gbl_auto_serialize_methods;
75extern u8 acpi_gbl_copy_dsdt_locally; 75extern u8 acpi_gbl_copy_dsdt_locally;
76extern u8 acpi_gbl_create_osi_method; 76extern u8 acpi_gbl_create_osi_method;
77extern u8 acpi_gbl_disable_auto_repair; 77extern u8 acpi_gbl_disable_auto_repair;
@@ -230,6 +230,10 @@ acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data);
230acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); 230acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler);
231 231
232acpi_status 232acpi_status
233acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data,
234 void (*callback)(void *));
235
236acpi_status
233acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); 237acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data);
234 238
235acpi_status 239acpi_status
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index cbf4bf977f75..eb760ca0b2e0 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 325aeae1fa99..3b30e36b53b5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 4ec8c194bfe5..212c65de75df 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 094a906a0e98..c8adad9c6b6a 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -424,7 +424,8 @@ enum acpi_dmar_type {
424 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, 424 ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
425 ACPI_DMAR_TYPE_ATSR = 2, 425 ACPI_DMAR_TYPE_ATSR = 2,
426 ACPI_DMAR_HARDWARE_AFFINITY = 3, 426 ACPI_DMAR_HARDWARE_AFFINITY = 3,
427 ACPI_DMAR_TYPE_RESERVED = 4 /* 4 and greater are reserved */ 427 ACPI_DMAR_TYPE_ANDD = 4,
428 ACPI_DMAR_TYPE_RESERVED = 5 /* 5 and greater are reserved */
428}; 429};
429 430
430/* DMAR Device Scope structure */ 431/* DMAR Device Scope structure */
@@ -445,7 +446,8 @@ enum acpi_dmar_scope_type {
445 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, 446 ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
446 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, 447 ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3,
447 ACPI_DMAR_SCOPE_TYPE_HPET = 4, 448 ACPI_DMAR_SCOPE_TYPE_HPET = 4,
448 ACPI_DMAR_SCOPE_TYPE_RESERVED = 5 /* 5 and greater are reserved */ 449 ACPI_DMAR_SCOPE_TYPE_ACPI = 5,
450 ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */
449}; 451};
450 452
451struct acpi_dmar_pci_path { 453struct acpi_dmar_pci_path {
@@ -507,6 +509,15 @@ struct acpi_dmar_rhsa {
507 u32 proximity_domain; 509 u32 proximity_domain;
508}; 510};
509 511
512/* 4: ACPI Namespace Device Declaration Structure */
513
514struct acpi_dmar_andd {
515 struct acpi_dmar_header header;
516 u8 reserved[3];
517 u8 device_number;
518 u8 object_name[];
519};
520
510/******************************************************************************* 521/*******************************************************************************
511 * 522 *
512 * HPET - High Precision Event Timer table 523 * HPET - High Precision Event Timer table
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index 01c2a9013e40..c2295cc4a5c0 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 68a3ada689c9..e76356574374 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -55,18 +55,16 @@
55#error ACPI_MACHINE_WIDTH not defined 55#error ACPI_MACHINE_WIDTH not defined
56#endif 56#endif
57 57
58/*! [Begin] no source code translation */
59
60/* 58/*
61 * Data type ranges 59 * Data type ranges
62 * Note: These macros are designed to be compiler independent as well as 60 * Note: These macros are designed to be compiler independent as well as
63 * working around problems that some 32-bit compilers have with 64-bit 61 * working around problems that some 32-bit compilers have with 64-bit
64 * constants. 62 * constants.
65 */ 63 */
66#define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ 64#define ACPI_UINT8_MAX (u8) (~((u8) 0)) /* 0xFF */
67#define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ 65#define ACPI_UINT16_MAX (u16)(~((u16) 0)) /* 0xFFFF */
68#define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ 66#define ACPI_UINT32_MAX (u32)(~((u32) 0)) /* 0xFFFFFFFF */
69#define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ 67#define ACPI_UINT64_MAX (u64)(~((u64) 0)) /* 0xFFFFFFFFFFFFFFFF */
70#define ACPI_ASCII_MAX 0x7F 68#define ACPI_ASCII_MAX 0x7F
71 69
72/* 70/*
@@ -77,18 +75,18 @@
77 * 75 *
78 * 1) The following types are of fixed size for all targets (16/32/64): 76 * 1) The following types are of fixed size for all targets (16/32/64):
79 * 77 *
80 * BOOLEAN Logical boolean 78 * u8 Logical boolean
81 * 79 *
82 * UINT8 8-bit (1 byte) unsigned value 80 * u8 8-bit (1 byte) unsigned value
83 * UINT16 16-bit (2 byte) unsigned value 81 * u16 16-bit (2 byte) unsigned value
84 * UINT32 32-bit (4 byte) unsigned value 82 * u32 32-bit (4 byte) unsigned value
85 * UINT64 64-bit (8 byte) unsigned value 83 * u64 64-bit (8 byte) unsigned value
86 * 84 *
87 * INT16 16-bit (2 byte) signed value 85 * s16 16-bit (2 byte) signed value
88 * INT32 32-bit (4 byte) signed value 86 * s32 32-bit (4 byte) signed value
89 * INT64 64-bit (8 byte) signed value 87 * s64 64-bit (8 byte) signed value
90 * 88 *
91 * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the 89 * COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the
92 * compiler-dependent header(s) and were introduced because there is no common 90 * compiler-dependent header(s) and were introduced because there is no common
93 * 64-bit integer type across the various compilation models, as shown in 91 * 64-bit integer type across the various compilation models, as shown in
94 * the table below. 92 * the table below.
@@ -110,11 +108,11 @@
110 * usually used for memory allocation, efficient loop counters, and array 108 * usually used for memory allocation, efficient loop counters, and array
111 * indexes. The types are similar to the size_t type in the C library and are 109 * indexes. The types are similar to the size_t type in the C library and are
112 * required because there is no C type that consistently represents the native 110 * required because there is no C type that consistently represents the native
113 * data width. ACPI_SIZE is needed because there is no guarantee that a 111 * data width. acpi_size is needed because there is no guarantee that a
114 * kernel-level C library is present. 112 * kernel-level C library is present.
115 * 113 *
116 * ACPI_SIZE 16/32/64-bit unsigned value 114 * acpi_size 16/32/64-bit unsigned value
117 * ACPI_NATIVE_INT 16/32/64-bit signed value 115 * acpi_native_int 16/32/64-bit signed value
118 */ 116 */
119 117
120/******************************************************************************* 118/*******************************************************************************
@@ -123,13 +121,15 @@
123 * 121 *
124 ******************************************************************************/ 122 ******************************************************************************/
125 123
126typedef unsigned char BOOLEAN; 124#ifndef ACPI_USE_SYSTEM_INTTYPES
127typedef unsigned char UINT8; 125
128typedef unsigned short UINT16; 126typedef unsigned char u8;
129typedef COMPILER_DEPENDENT_UINT64 UINT64; 127typedef unsigned char u8;
130typedef COMPILER_DEPENDENT_INT64 INT64; 128typedef unsigned short u16;
129typedef COMPILER_DEPENDENT_UINT64 u64;
130typedef COMPILER_DEPENDENT_INT64 s64;
131 131
132/*! [End] no source code translation !*/ 132#endif /* ACPI_USE_SYSTEM_INTTYPES */
133 133
134/* 134/*
135 * Value returned by acpi_os_get_thread_id. There is no standard "thread_id" 135 * Value returned by acpi_os_get_thread_id. There is no standard "thread_id"
@@ -149,12 +149,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64;
149 149
150#if ACPI_MACHINE_WIDTH == 64 150#if ACPI_MACHINE_WIDTH == 64
151 151
152/*! [Begin] no source code translation (keep the typedefs as-is) */ 152#ifndef ACPI_USE_SYSTEM_INTTYPES
153 153
154typedef unsigned int UINT32; 154typedef unsigned int u32;
155typedef int INT32; 155typedef int s32;
156 156
157/*! [End] no source code translation !*/ 157#endif /* ACPI_USE_SYSTEM_INTTYPES */
158 158
159typedef s64 acpi_native_int; 159typedef s64 acpi_native_int;
160 160
@@ -188,12 +188,12 @@ typedef u64 acpi_physical_address;
188 188
189#elif ACPI_MACHINE_WIDTH == 32 189#elif ACPI_MACHINE_WIDTH == 32
190 190
191/*! [Begin] no source code translation (keep the typedefs as-is) */ 191#ifndef ACPI_USE_SYSTEM_INTTYPES
192 192
193typedef unsigned int UINT32; 193typedef unsigned int u32;
194typedef int INT32; 194typedef int s32;
195 195
196/*! [End] no source code translation !*/ 196#endif /* ACPI_USE_SYSTEM_INTTYPES */
197 197
198typedef s32 acpi_native_int; 198typedef s32 acpi_native_int;
199 199
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index b402eb67af83..e863dd5c4e04 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index e077ce6c38ca..a476b9118b49 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 008aa287c7a9..93c55ed7c53d 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2013, Intel Corp. 8 * Copyright (C) 2000 - 2014, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,14 @@
52 52
53#ifdef __KERNEL__ 53#ifdef __KERNEL__
54 54
55#define ACPI_USE_SYSTEM_INTTYPES
56
57/* Compile for reduced hardware mode only with this kernel config */
58
59#ifdef CONFIG_ACPI_REDUCED_HARDWARE_ONLY
60#define ACPI_REDUCED_HARDWARE 1
61#endif
62
55#include <linux/string.h> 63#include <linux/string.h>
56#include <linux/kernel.h> 64#include <linux/kernel.h>
57#include <linux/ctype.h> 65#include <linux/ctype.h>
@@ -83,6 +91,16 @@
83#include <ctype.h> 91#include <ctype.h>
84#include <unistd.h> 92#include <unistd.h>
85 93
94/* Disable kernel specific declarators */
95
96#ifndef __init
97#define __init
98#endif
99
100#ifndef __iomem
101#define __iomem
102#endif
103
86/* Host-dependent types and defines for user-space ACPICA */ 104/* Host-dependent types and defines for user-space ACPICA */
87 105
88#define ACPI_FLUSH_CPU_CACHE() 106#define ACPI_FLUSH_CPU_CACHE()
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 7d10f962aa13..630dd2372238 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -52,7 +52,7 @@ struct bug_entry {
52#endif 52#endif
53 53
54#ifndef HAVE_ARCH_BUG_ON 54#ifndef HAVE_ARCH_BUG_ON
55#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0) 55#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
56#endif 56#endif
57 57
58/* 58/*
@@ -106,33 +106,6 @@ extern void warn_slowpath_null(const char *file, const int line);
106 unlikely(__ret_warn_on); \ 106 unlikely(__ret_warn_on); \
107}) 107})
108 108
109#else /* !CONFIG_BUG */
110#ifndef HAVE_ARCH_BUG
111#define BUG() do {} while(0)
112#endif
113
114#ifndef HAVE_ARCH_BUG_ON
115#define BUG_ON(condition) do { if (condition) ; } while(0)
116#endif
117
118#ifndef HAVE_ARCH_WARN_ON
119#define WARN_ON(condition) ({ \
120 int __ret_warn_on = !!(condition); \
121 unlikely(__ret_warn_on); \
122})
123#endif
124
125#ifndef WARN
126#define WARN(condition, format...) ({ \
127 int __ret_warn_on = !!(condition); \
128 unlikely(__ret_warn_on); \
129})
130#endif
131
132#define WARN_TAINT(condition, taint, format...) WARN_ON(condition)
133
134#endif
135
136#define WARN_ON_ONCE(condition) ({ \ 109#define WARN_ON_ONCE(condition) ({ \
137 static bool __section(.data.unlikely) __warned; \ 110 static bool __section(.data.unlikely) __warned; \
138 int __ret_warn_once = !!(condition); \ 111 int __ret_warn_once = !!(condition); \
@@ -163,6 +136,37 @@ extern void warn_slowpath_null(const char *file, const int line);
163 unlikely(__ret_warn_once); \ 136 unlikely(__ret_warn_once); \
164}) 137})
165 138
139#else /* !CONFIG_BUG */
140#ifndef HAVE_ARCH_BUG
141#define BUG() do {} while (1)
142#endif
143
144#ifndef HAVE_ARCH_BUG_ON
145#define BUG_ON(condition) do { if (condition) ; } while (0)
146#endif
147
148#ifndef HAVE_ARCH_WARN_ON
149#define WARN_ON(condition) ({ \
150 int __ret_warn_on = !!(condition); \
151 unlikely(__ret_warn_on); \
152})
153#endif
154
155#ifndef WARN
156#define WARN(condition, format...) ({ \
157 int __ret_warn_on = !!(condition); \
158 no_printk(format); \
159 unlikely(__ret_warn_on); \
160})
161#endif
162
163#define WARN_ON_ONCE(condition) WARN_ON(condition)
164#define WARN_ONCE(condition, format...) WARN(condition, format)
165#define WARN_TAINT(condition, taint, format...) WARN(condition, format)
166#define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format)
167
168#endif
169
166/* 170/*
167 * WARN_ON_SMP() is for cases that the warning is either 171 * WARN_ON_SMP() is for cases that the warning is either
168 * meaningless for !SMP or may even cause failures. 172 * meaningless for !SMP or may even cause failures.
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
index d8d4c898c1bb..70bef78912b7 100644
--- a/include/asm-generic/cmpxchg-local.h
+++ b/include/asm-generic/cmpxchg-local.h
@@ -4,7 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/irqflags.h> 5#include <linux/irqflags.h>
6 6
7extern unsigned long wrong_size_cmpxchg(volatile void *ptr); 7extern unsigned long wrong_size_cmpxchg(volatile void *ptr)
8 __noreturn;
8 9
9/* 10/*
10 * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned 11 * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned
diff --git a/include/asm-generic/early_ioremap.h b/include/asm-generic/early_ioremap.h
new file mode 100644
index 000000000000..a5de55c04fb2
--- /dev/null
+++ b/include/asm-generic/early_ioremap.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_EARLY_IOREMAP_H_
2#define _ASM_EARLY_IOREMAP_H_
3
4#include <linux/types.h>
5
6/*
7 * early_ioremap() and early_iounmap() are for temporary early boot-time
8 * mappings, before the real ioremap() is functional.
9 */
10extern void __iomem *early_ioremap(resource_size_t phys_addr,
11 unsigned long size);
12extern void *early_memremap(resource_size_t phys_addr,
13 unsigned long size);
14extern void early_iounmap(void __iomem *addr, unsigned long size);
15extern void early_memunmap(void *addr, unsigned long size);
16
17/*
18 * Weak function called by early_ioremap_reset(). It does nothing, but
19 * architectures may provide their own version to do any needed cleanups.
20 */
21extern void early_ioremap_shutdown(void);
22
23#if defined(CONFIG_GENERIC_EARLY_IOREMAP) && defined(CONFIG_MMU)
24/* Arch-specific initialization */
25extern void early_ioremap_init(void);
26
27/* Generic initialization called by architecture code */
28extern void early_ioremap_setup(void);
29
30/*
31 * Called as last step in paging_init() so library can act
32 * accordingly for subsequent map/unmap requests.
33 */
34extern void early_ioremap_reset(void);
35
36#else
37static inline void early_ioremap_init(void) { }
38static inline void early_ioremap_setup(void) { }
39static inline void early_ioremap_reset(void) { }
40#endif
41
42#endif /* _ASM_EARLY_IOREMAP_H_ */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index a5f56a0213a7..23e364538ab5 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -69,7 +69,7 @@ static inline int gpio_direction_input(unsigned gpio)
69} 69}
70static inline int gpio_direction_output(unsigned gpio, int value) 70static inline int gpio_direction_output(unsigned gpio, int value)
71{ 71{
72 return gpiod_direction_output(gpio_to_desc(gpio), value); 72 return gpiod_direction_output_raw(gpio_to_desc(gpio), value);
73} 73}
74 74
75static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) 75static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index d5afe96adba6..975e1cc75edb 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -327,7 +327,7 @@ static inline void iounmap(void __iomem *addr)
327} 327}
328#endif /* CONFIG_MMU */ 328#endif /* CONFIG_MMU */
329 329
330#ifdef CONFIG_HAS_IOPORT 330#ifdef CONFIG_HAS_IOPORT_MAP
331#ifndef CONFIG_GENERIC_IOMAP 331#ifndef CONFIG_GENERIC_IOMAP
332static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) 332static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
333{ 333{
@@ -341,7 +341,7 @@ static inline void ioport_unmap(void __iomem *p)
341extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 341extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
342extern void ioport_unmap(void __iomem *p); 342extern void ioport_unmap(void __iomem *p);
343#endif /* CONFIG_GENERIC_IOMAP */ 343#endif /* CONFIG_GENERIC_IOMAP */
344#endif /* CONFIG_HAS_IOPORT */ 344#endif /* CONFIG_HAS_IOPORT_MAP */
345 345
346#ifndef xlate_dev_kmem_ptr 346#ifndef xlate_dev_kmem_ptr
347#define xlate_dev_kmem_ptr(p) p 347#define xlate_dev_kmem_ptr(p) p
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 6afd7d6a9899..1b41011643a5 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -56,7 +56,7 @@ extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long coun
56extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); 56extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
57extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); 57extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);
58 58
59#ifdef CONFIG_HAS_IOPORT 59#ifdef CONFIG_HAS_IOPORT_MAP
60/* Create a virtual mapping cookie for an IO port range */ 60/* Create a virtual mapping cookie for an IO port range */
61extern void __iomem *ioport_map(unsigned long port, unsigned int nr); 61extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
62extern void ioport_unmap(void __iomem *); 62extern void ioport_unmap(void __iomem *);
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index d17784ea37ff..0703aa75b5e8 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -56,17 +56,17 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
56#define per_cpu(var, cpu) \ 56#define per_cpu(var, cpu) \
57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu))) 57 (*SHIFT_PERCPU_PTR(&(var), per_cpu_offset(cpu)))
58 58
59#ifndef __this_cpu_ptr 59#ifndef raw_cpu_ptr
60#define __this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset) 60#define raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
61#endif 61#endif
62#ifdef CONFIG_DEBUG_PREEMPT 62#ifdef CONFIG_DEBUG_PREEMPT
63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset) 63#define this_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, my_cpu_offset)
64#else 64#else
65#define this_cpu_ptr(ptr) __this_cpu_ptr(ptr) 65#define this_cpu_ptr(ptr) raw_cpu_ptr(ptr)
66#endif 66#endif
67 67
68#define __get_cpu_var(var) (*this_cpu_ptr(&(var))) 68#define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
69#define __raw_get_cpu_var(var) (*__this_cpu_ptr(&(var))) 69#define __raw_get_cpu_var(var) (*raw_cpu_ptr(&(var)))
70 70
71#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 71#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
72extern void setup_per_cpu_areas(void); 72extern void setup_per_cpu_areas(void);
@@ -83,7 +83,7 @@ extern void setup_per_cpu_areas(void);
83#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 83#define __get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
84#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var))) 84#define __raw_get_cpu_var(var) (*VERIFY_PERCPU_PTR(&(var)))
85#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0) 85#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, 0)
86#define __this_cpu_ptr(ptr) this_cpu_ptr(ptr) 86#define raw_cpu_ptr(ptr) this_cpu_ptr(ptr)
87 87
88#endif /* SMP */ 88#endif /* SMP */
89 89
@@ -122,4 +122,7 @@ extern void setup_per_cpu_areas(void);
122#define PER_CPU_DEF_ATTRIBUTES 122#define PER_CPU_DEF_ATTRIBUTES
123#endif 123#endif
124 124
125/* Keep until we have removed all uses of __this_cpu_ptr */
126#define __this_cpu_ptr raw_cpu_ptr
127
125#endif /* _ASM_GENERIC_PERCPU_H_ */ 128#endif /* _ASM_GENERIC_PERCPU_H_ */
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 5b09392db673..d401e5463fb0 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -144,8 +144,6 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
144 144
145/** 145/**
146 * syscall_get_arch - return the AUDIT_ARCH for the current system call 146 * syscall_get_arch - return the AUDIT_ARCH for the current system call
147 * @task: task of interest, must be in system call entry tracing
148 * @regs: task_pt_regs() of @task
149 * 147 *
150 * Returns the AUDIT_ARCH_* based on the system call convention in use. 148 * Returns the AUDIT_ARCH_* based on the system call convention in use.
151 * 149 *
@@ -155,5 +153,5 @@ void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
155 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must 153 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
156 * provide an implementation of this. 154 * provide an implementation of this.
157 */ 155 */
158int syscall_get_arch(struct task_struct *task, struct pt_regs *regs); 156int syscall_get_arch(void);
159#endif /* _ASM_SYSCALL_H */ 157#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bc2121fa9132..146e4fffd710 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,25 @@
167#define CLK_OF_TABLES() 167#define CLK_OF_TABLES()
168#endif 168#endif
169 169
170#ifdef CONFIG_OF_RESERVED_MEM
171#define RESERVEDMEM_OF_TABLES() \
172 . = ALIGN(8); \
173 VMLINUX_SYMBOL(__reservedmem_of_table) = .; \
174 *(__reservedmem_of_table) \
175 *(__reservedmem_of_table_end)
176#else
177#define RESERVEDMEM_OF_TABLES()
178#endif
179
180#ifdef CONFIG_SMP
181#define CPU_METHOD_OF_TABLES() . = ALIGN(8); \
182 VMLINUX_SYMBOL(__cpu_method_of_table_begin) = .; \
183 *(__cpu_method_of_table) \
184 VMLINUX_SYMBOL(__cpu_method_of_table_end) = .;
185#else
186#define CPU_METHOD_OF_TABLES()
187#endif
188
170#define KERNEL_DTB() \ 189#define KERNEL_DTB() \
171 STRUCT_ALIGN(); \ 190 STRUCT_ALIGN(); \
172 VMLINUX_SYMBOL(__dtb_start) = .; \ 191 VMLINUX_SYMBOL(__dtb_start) = .; \
@@ -490,7 +509,9 @@
490 TRACE_SYSCALLS() \ 509 TRACE_SYSCALLS() \
491 MEM_DISCARD(init.rodata) \ 510 MEM_DISCARD(init.rodata) \
492 CLK_OF_TABLES() \ 511 CLK_OF_TABLES() \
512 RESERVEDMEM_OF_TABLES() \
493 CLKSRC_OF_TABLES() \ 513 CLKSRC_OF_TABLES() \
514 CPU_METHOD_OF_TABLES() \
494 KERNEL_DTB() \ 515 KERNEL_DTB() \
495 IRQCHIP_OF_MATCH_TABLE() 516 IRQCHIP_OF_MATCH_TABLE()
496 517
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index e73c19e90e38..016c2f110f63 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -100,9 +100,12 @@ struct blkcipher_walk {
100 void *page; 100 void *page;
101 u8 *buffer; 101 u8 *buffer;
102 u8 *iv; 102 u8 *iv;
103 unsigned int ivsize;
103 104
104 int flags; 105 int flags;
105 unsigned int blocksize; 106 unsigned int walk_blocksize;
107 unsigned int cipher_blocksize;
108 unsigned int alignmask;
106}; 109};
107 110
108struct ablkcipher_walk { 111struct ablkcipher_walk {
@@ -192,6 +195,10 @@ int blkcipher_walk_phys(struct blkcipher_desc *desc,
192int blkcipher_walk_virt_block(struct blkcipher_desc *desc, 195int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
193 struct blkcipher_walk *walk, 196 struct blkcipher_walk *walk,
194 unsigned int blocksize); 197 unsigned int blocksize);
198int blkcipher_aead_walk_virt_block(struct blkcipher_desc *desc,
199 struct blkcipher_walk *walk,
200 struct crypto_aead *tfm,
201 unsigned int blocksize);
195 202
196int ablkcipher_walk_done(struct ablkcipher_request *req, 203int ablkcipher_walk_done(struct ablkcipher_request *req,
197 struct ablkcipher_walk *walk, int err); 204 struct ablkcipher_walk *walk, int err);
diff --git a/include/crypto/null.h b/include/crypto/null.h
new file mode 100644
index 000000000000..b7c864cc70df
--- /dev/null
+++ b/include/crypto/null.h
@@ -0,0 +1,11 @@
1/* Values for NULL algorithms */
2
3#ifndef _CRYPTO_NULL_H
4#define _CRYPTO_NULL_H
5
6#define NULL_KEY_SIZE 0
7#define NULL_BLOCK_SIZE 1
8#define NULL_DIGEST_SIZE 0
9#define NULL_IV_SIZE 0
10
11#endif
diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h
new file mode 100644
index 000000000000..ff62344fec6c
--- /dev/null
+++ b/include/drm/bridge/ptn3460.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2013 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#ifndef _DRM_BRIDGE_PTN3460_H_
15#define _DRM_BRIDGE_PTN3460_H_
16
17struct drm_device;
18struct drm_encoder;
19struct i2c_client;
20struct device_node;
21
22#if defined(CONFIG_DRM_PTN3460) || defined(CONFIG_DRM_PTN3460_MODULE)
23
24int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
25 struct i2c_client *client, struct device_node *node);
26#else
27
28static inline int ptn3460_init(struct drm_device *dev,
29 struct drm_encoder *encoder, struct i2c_client *client,
30 struct device_node *node)
31{
32 return 0;
33}
34
35#endif
36
37#endif
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 04a7f31301f8..a7c2a862b4f4 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -43,6 +43,7 @@
43#include <asm/current.h> 43#include <asm/current.h>
44#endif /* __alpha__ */ 44#endif /* __alpha__ */
45#include <linux/kernel.h> 45#include <linux/kernel.h>
46#include <linux/kref.h>
46#include <linux/miscdevice.h> 47#include <linux/miscdevice.h>
47#include <linux/fs.h> 48#include <linux/fs.h>
48#include <linux/init.h> 49#include <linux/init.h>
@@ -87,46 +88,41 @@ struct videomode;
87#include <drm/drm_hashtab.h> 88#include <drm/drm_hashtab.h>
88#include <drm/drm_mm.h> 89#include <drm/drm_mm.h>
89 90
90#define DRM_UT_CORE 0x01
91#define DRM_UT_DRIVER 0x02
92#define DRM_UT_KMS 0x04
93#define DRM_UT_PRIME 0x08
94/* 91/*
95 * Three debug levels are defined. 92 * 4 debug categories are defined:
96 * drm_core, drm_driver, drm_kms 93 *
97 * drm_core level can be used in the generic drm code. For example: 94 * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ...
98 * drm_ioctl, drm_mm, drm_memory 95 * This is the category used by the DRM_DEBUG() macro.
99 * The macro definition of DRM_DEBUG is used. 96 *
100 * DRM_DEBUG(fmt, args...) 97 * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ...
101 * The debug info by using the DRM_DEBUG can be obtained by adding 98 * This is the category used by the DRM_DEBUG_DRIVER() macro.
102 * the boot option of "drm.debug=1". 99 *
100 * KMS: used in the modesetting code.
101 * This is the category used by the DRM_DEBUG_KMS() macro.
102 *
103 * PRIME: used in the prime code.
104 * This is the category used by the DRM_DEBUG_PRIME() macro.
103 * 105 *
104 * drm_driver level can be used in the specific drm driver. It is used 106 * Enabling verbose debug messages is done through the drm.debug parameter,
105 * to add the debug info related with the drm driver. For example: 107 * each category being enabled by a bit.
106 * i915_drv, i915_dma, i915_gem, radeon_drv,
107 * The macro definition of DRM_DEBUG_DRIVER can be used.
108 * DRM_DEBUG_DRIVER(fmt, args...)
109 * The debug info by using the DRM_DEBUG_DRIVER can be obtained by
110 * adding the boot option of "drm.debug=0x02"
111 * 108 *
112 * drm_kms level can be used in the KMS code related with specific drm driver. 109 * drm.debug=0x1 will enable CORE messages
113 * It is used to add the debug info related with KMS mode. For example: 110 * drm.debug=0x2 will enable DRIVER messages
114 * the connector/crtc , 111 * drm.debug=0x3 will enable CORE and DRIVER messages
115 * The macro definition of DRM_DEBUG_KMS can be used. 112 * ...
116 * DRM_DEBUG_KMS(fmt, args...) 113 * drm.debug=0xf will enable all messages
117 * The debug info by using the DRM_DEBUG_KMS can be obtained by
118 * adding the boot option of "drm.debug=0x04"
119 * 114 *
120 * If we add the boot option of "drm.debug=0x06", we can get the debug info by 115 * An interesting feature is that it's possible to enable verbose logging at
121 * using the DRM_DEBUG_KMS and DRM_DEBUG_DRIVER. 116 * run-time by echoing the debug value in its sysfs node:
122 * If we add the boot option of "drm.debug=0x05", we can get the debug info by 117 * # echo 0xf > /sys/module/drm/parameters/debug
123 * using the DRM_DEBUG_KMS and DRM_DEBUG.
124 */ 118 */
119#define DRM_UT_CORE 0x01
120#define DRM_UT_DRIVER 0x02
121#define DRM_UT_KMS 0x04
122#define DRM_UT_PRIME 0x08
125 123
126extern __printf(4, 5) 124extern __printf(2, 3)
127void drm_ut_debug_printk(unsigned int request_level, 125void drm_ut_debug_printk(const char *function_name,
128 const char *prefix,
129 const char *function_name,
130 const char *format, ...); 126 const char *format, ...);
131extern __printf(2, 3) 127extern __printf(2, 3)
132int drm_err(const char *func, const char *format, ...); 128int drm_err(const char *func, const char *format, ...);
@@ -211,55 +207,30 @@ int drm_err(const char *func, const char *format, ...);
211#if DRM_DEBUG_CODE 207#if DRM_DEBUG_CODE
212#define DRM_DEBUG(fmt, args...) \ 208#define DRM_DEBUG(fmt, args...) \
213 do { \ 209 do { \
214 drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME, \ 210 if (unlikely(drm_debug & DRM_UT_CORE)) \
215 __func__, fmt, ##args); \ 211 drm_ut_debug_printk(__func__, fmt, ##args); \
216 } while (0) 212 } while (0)
217 213
218#define DRM_DEBUG_DRIVER(fmt, args...) \ 214#define DRM_DEBUG_DRIVER(fmt, args...) \
219 do { \ 215 do { \
220 drm_ut_debug_printk(DRM_UT_DRIVER, DRM_NAME, \ 216 if (unlikely(drm_debug & DRM_UT_DRIVER)) \
221 __func__, fmt, ##args); \ 217 drm_ut_debug_printk(__func__, fmt, ##args); \
222 } while (0) 218 } while (0)
223#define DRM_DEBUG_KMS(fmt, args...) \ 219#define DRM_DEBUG_KMS(fmt, args...) \
224 do { \ 220 do { \
225 drm_ut_debug_printk(DRM_UT_KMS, DRM_NAME, \ 221 if (unlikely(drm_debug & DRM_UT_KMS)) \
226 __func__, fmt, ##args); \ 222 drm_ut_debug_printk(__func__, fmt, ##args); \
227 } while (0) 223 } while (0)
228#define DRM_DEBUG_PRIME(fmt, args...) \ 224#define DRM_DEBUG_PRIME(fmt, args...) \
229 do { \ 225 do { \
230 drm_ut_debug_printk(DRM_UT_PRIME, DRM_NAME, \ 226 if (unlikely(drm_debug & DRM_UT_PRIME)) \
231 __func__, fmt, ##args); \ 227 drm_ut_debug_printk(__func__, fmt, ##args); \
232 } while (0)
233#define DRM_LOG(fmt, args...) \
234 do { \
235 drm_ut_debug_printk(DRM_UT_CORE, NULL, \
236 NULL, fmt, ##args); \
237 } while (0)
238#define DRM_LOG_KMS(fmt, args...) \
239 do { \
240 drm_ut_debug_printk(DRM_UT_KMS, NULL, \
241 NULL, fmt, ##args); \
242 } while (0)
243#define DRM_LOG_MODE(fmt, args...) \
244 do { \
245 drm_ut_debug_printk(DRM_UT_MODE, NULL, \
246 NULL, fmt, ##args); \
247 } while (0)
248#define DRM_LOG_DRIVER(fmt, args...) \
249 do { \
250 drm_ut_debug_printk(DRM_UT_DRIVER, NULL, \
251 NULL, fmt, ##args); \
252 } while (0) 228 } while (0)
253#else 229#else
254#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0) 230#define DRM_DEBUG_DRIVER(fmt, args...) do { } while (0)
255#define DRM_DEBUG_KMS(fmt, args...) do { } while (0) 231#define DRM_DEBUG_KMS(fmt, args...) do { } while (0)
256#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0) 232#define DRM_DEBUG_PRIME(fmt, args...) do { } while (0)
257#define DRM_DEBUG(fmt, arg...) do { } while (0) 233#define DRM_DEBUG(fmt, arg...) do { } while (0)
258#define DRM_LOG(fmt, arg...) do { } while (0)
259#define DRM_LOG_KMS(fmt, args...) do { } while (0)
260#define DRM_LOG_MODE(fmt, arg...) do { } while (0)
261#define DRM_LOG_DRIVER(fmt, arg...) do { } while (0)
262
263#endif 234#endif
264 235
265/*@}*/ 236/*@}*/
@@ -434,9 +405,15 @@ struct drm_prime_file_private {
434struct drm_file { 405struct drm_file {
435 unsigned always_authenticated :1; 406 unsigned always_authenticated :1;
436 unsigned authenticated :1; 407 unsigned authenticated :1;
437 unsigned is_master :1; /* this file private is a master for a minor */ 408 /* Whether we're master for a minor. Protected by master_mutex */
409 unsigned is_master :1;
438 /* true when the client has asked us to expose stereo 3D mode flags */ 410 /* true when the client has asked us to expose stereo 3D mode flags */
439 unsigned stereo_allowed :1; 411 unsigned stereo_allowed :1;
412 /*
413 * true if client understands CRTC primary planes and cursor planes
414 * in the plane list
415 */
416 unsigned universal_planes:1;
440 417
441 struct pid *pid; 418 struct pid *pid;
442 kuid_t uid; 419 kuid_t uid;
@@ -713,29 +690,29 @@ struct drm_gem_object {
713 690
714#include <drm/drm_crtc.h> 691#include <drm/drm_crtc.h>
715 692
716/* per-master structure */ 693/**
694 * struct drm_master - drm master structure
695 *
696 * @refcount: Refcount for this master object.
697 * @minor: Link back to minor char device we are master for. Immutable.
698 * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex.
699 * @unique_len: Length of unique field. Protected by drm_global_mutex.
700 * @unique_size: Amount allocated. Protected by drm_global_mutex.
701 * @magiclist: Hash of used authentication tokens. Protected by struct_mutex.
702 * @magicfree: List of used authentication tokens. Protected by struct_mutex.
703 * @lock: DRI lock information.
704 * @driver_priv: Pointer to driver-private information.
705 */
717struct drm_master { 706struct drm_master {
718 707 struct kref refcount;
719 struct kref refcount; /* refcount for this master */ 708 struct drm_minor *minor;
720 709 char *unique;
721 struct list_head head; /**< each minor contains a list of masters */ 710 int unique_len;
722 struct drm_minor *minor; /**< link back to minor we are a master for */ 711 int unique_size;
723
724 char *unique; /**< Unique identifier: e.g., busid */
725 int unique_len; /**< Length of unique field */
726 int unique_size; /**< amount allocated */
727
728 int blocked; /**< Blocked due to VC switch? */
729
730 /** \name Authentication */
731 /*@{ */
732 struct drm_open_hash magiclist; 712 struct drm_open_hash magiclist;
733 struct list_head magicfree; 713 struct list_head magicfree;
734 /*@} */ 714 struct drm_lock_data lock;
735 715 void *driver_priv;
736 struct drm_lock_data lock; /**< Information on hardware lock */
737
738 void *driver_priv; /**< Private structure for driver to use */
739}; 716};
740 717
741/* Size of ringbuffer for vblank timestamps. Just double-buffer 718/* Size of ringbuffer for vblank timestamps. Just double-buffer
@@ -1008,10 +985,12 @@ struct drm_driver {
1008 struct list_head legacy_dev_list; 985 struct list_head legacy_dev_list;
1009}; 986};
1010 987
1011#define DRM_MINOR_UNASSIGNED 0 988enum drm_minor_type {
1012#define DRM_MINOR_LEGACY 1 989 DRM_MINOR_LEGACY,
1013#define DRM_MINOR_CONTROL 2 990 DRM_MINOR_CONTROL,
1014#define DRM_MINOR_RENDER 3 991 DRM_MINOR_RENDER,
992 DRM_MINOR_CNT,
993};
1015 994
1016/** 995/**
1017 * Info file list entry. This structure represents a debugfs or proc file to 996 * Info file list entry. This structure represents a debugfs or proc file to
@@ -1040,7 +1019,6 @@ struct drm_info_node {
1040struct drm_minor { 1019struct drm_minor {
1041 int index; /**< Minor device number */ 1020 int index; /**< Minor device number */
1042 int type; /**< Control or render */ 1021 int type; /**< Control or render */
1043 dev_t device; /**< Device number for mknod */
1044 struct device *kdev; /**< Linux device */ 1022 struct device *kdev; /**< Linux device */
1045 struct drm_device *dev; 1023 struct drm_device *dev;
1046 1024
@@ -1049,26 +1027,11 @@ struct drm_minor {
1049 struct list_head debugfs_list; 1027 struct list_head debugfs_list;
1050 struct mutex debugfs_lock; /* Protects debugfs_list. */ 1028 struct mutex debugfs_lock; /* Protects debugfs_list. */
1051 1029
1052 struct drm_master *master; /* currently active master for this node */ 1030 /* currently active master for this node. Protected by master_mutex */
1053 struct list_head master_list; 1031 struct drm_master *master;
1054 struct drm_mode_group mode_group; 1032 struct drm_mode_group mode_group;
1055}; 1033};
1056 1034
1057/* mode specified on the command line */
1058struct drm_cmdline_mode {
1059 bool specified;
1060 bool refresh_specified;
1061 bool bpp_specified;
1062 int xres, yres;
1063 int bpp;
1064 int refresh;
1065 bool rb;
1066 bool interlace;
1067 bool cvt;
1068 bool margins;
1069 enum drm_connector_force force;
1070};
1071
1072 1035
1073struct drm_pending_vblank_event { 1036struct drm_pending_vblank_event {
1074 struct drm_pending_event base; 1037 struct drm_pending_event base;
@@ -1098,10 +1061,24 @@ struct drm_device {
1098 char *devname; /**< For /proc/interrupts */ 1061 char *devname; /**< For /proc/interrupts */
1099 int if_version; /**< Highest interface version set */ 1062 int if_version; /**< Highest interface version set */
1100 1063
1064 /** \name Lifetime Management */
1065 /*@{ */
1066 struct kref ref; /**< Object ref-count */
1067 struct device *dev; /**< Device structure of bus-device */
1068 struct drm_driver *driver; /**< DRM driver managing the device */
1069 void *dev_private; /**< DRM driver private data */
1070 struct drm_minor *control; /**< Control node */
1071 struct drm_minor *primary; /**< Primary node */
1072 struct drm_minor *render; /**< Render node */
1073 atomic_t unplugged; /**< Flag whether dev is dead */
1074 struct inode *anon_inode; /**< inode for private address-space */
1075 /*@} */
1076
1101 /** \name Locks */ 1077 /** \name Locks */
1102 /*@{ */ 1078 /*@{ */
1103 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */ 1079 spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
1104 struct mutex struct_mutex; /**< For others */ 1080 struct mutex struct_mutex; /**< For others */
1081 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
1105 /*@} */ 1082 /*@} */
1106 1083
1107 /** \name Usage Counters */ 1084 /** \name Usage Counters */
@@ -1171,7 +1148,6 @@ struct drm_device {
1171 1148
1172 struct drm_agp_head *agp; /**< AGP data */ 1149 struct drm_agp_head *agp; /**< AGP data */
1173 1150
1174 struct device *dev; /**< Device structure */
1175 struct pci_dev *pdev; /**< PCI device structure */ 1151 struct pci_dev *pdev; /**< PCI device structure */
1176#ifdef __alpha__ 1152#ifdef __alpha__
1177 struct pci_controller *hose; 1153 struct pci_controller *hose;
@@ -1182,17 +1158,11 @@ struct drm_device {
1182 1158
1183 struct drm_sg_mem *sg; /**< Scatter gather memory */ 1159 struct drm_sg_mem *sg; /**< Scatter gather memory */
1184 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 1160 unsigned int num_crtcs; /**< Number of CRTCs on this device */
1185 void *dev_private; /**< device private data */
1186 struct address_space *dev_mapping;
1187 struct drm_sigdata sigdata; /**< For block_all_signals */ 1161 struct drm_sigdata sigdata; /**< For block_all_signals */
1188 sigset_t sigmask; 1162 sigset_t sigmask;
1189 1163
1190 struct drm_driver *driver;
1191 struct drm_local_map *agp_buffer_map; 1164 struct drm_local_map *agp_buffer_map;
1192 unsigned int agp_buffer_token; 1165 unsigned int agp_buffer_token;
1193 struct drm_minor *control; /**< Control node for card */
1194 struct drm_minor *primary; /**< render type primary screen head */
1195 struct drm_minor *render; /**< render node for card */
1196 1166
1197 struct drm_mode_config mode_config; /**< Current mode config */ 1167 struct drm_mode_config mode_config; /**< Current mode config */
1198 1168
@@ -1203,8 +1173,6 @@ struct drm_device {
1203 struct drm_vma_offset_manager *vma_offset_manager; 1173 struct drm_vma_offset_manager *vma_offset_manager;
1204 /*@} */ 1174 /*@} */
1205 int switch_power_state; 1175 int switch_power_state;
1206
1207 atomic_t unplugged; /* device has been unplugged or gone away */
1208}; 1176};
1209 1177
1210#define DRM_SWITCH_POWER_ON 0 1178#define DRM_SWITCH_POWER_ON 0
@@ -1241,11 +1209,21 @@ static inline bool drm_modeset_is_locked(struct drm_device *dev)
1241 return mutex_is_locked(&dev->mode_config.mutex); 1209 return mutex_is_locked(&dev->mode_config.mutex);
1242} 1210}
1243 1211
1244static inline bool drm_is_render_client(struct drm_file *file_priv) 1212static inline bool drm_is_render_client(const struct drm_file *file_priv)
1245{ 1213{
1246 return file_priv->minor->type == DRM_MINOR_RENDER; 1214 return file_priv->minor->type == DRM_MINOR_RENDER;
1247} 1215}
1248 1216
1217static inline bool drm_is_control_client(const struct drm_file *file_priv)
1218{
1219 return file_priv->minor->type == DRM_MINOR_CONTROL;
1220}
1221
1222static inline bool drm_is_primary_client(const struct drm_file *file_priv)
1223{
1224 return file_priv->minor->type == DRM_MINOR_LEGACY;
1225}
1226
1249/******************************************************************/ 1227/******************************************************************/
1250/** \name Internal function definitions */ 1228/** \name Internal function definitions */
1251/*@{*/ 1229/*@{*/
@@ -1256,6 +1234,7 @@ extern long drm_ioctl(struct file *filp,
1256extern long drm_compat_ioctl(struct file *filp, 1234extern long drm_compat_ioctl(struct file *filp,
1257 unsigned int cmd, unsigned long arg); 1235 unsigned int cmd, unsigned long arg);
1258extern int drm_lastclose(struct drm_device *dev); 1236extern int drm_lastclose(struct drm_device *dev);
1237extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
1259 1238
1260 /* Device support (drm_fops.h) */ 1239 /* Device support (drm_fops.h) */
1261extern struct mutex drm_global_mutex; 1240extern struct mutex drm_global_mutex;
@@ -1411,20 +1390,6 @@ extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
1411extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, 1390extern void drm_calc_timestamping_constants(struct drm_crtc *crtc,
1412 const struct drm_display_mode *mode); 1391 const struct drm_display_mode *mode);
1413 1392
1414extern bool
1415drm_mode_parse_command_line_for_connector(const char *mode_option,
1416 struct drm_connector *connector,
1417 struct drm_cmdline_mode *mode);
1418
1419extern struct drm_display_mode *
1420drm_mode_create_from_cmdline_mode(struct drm_device *dev,
1421 struct drm_cmdline_mode *cmd);
1422
1423extern int drm_display_mode_from_videomode(const struct videomode *vm,
1424 struct drm_display_mode *dmode);
1425extern int of_get_drm_display_mode(struct device_node *np,
1426 struct drm_display_mode *dmode,
1427 int index);
1428 1393
1429/* Modesetting support */ 1394/* Modesetting support */
1430extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); 1395extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
@@ -1449,6 +1414,7 @@ extern void drm_put_dev(struct drm_device *dev);
1449extern void drm_unplug_dev(struct drm_device *dev); 1414extern void drm_unplug_dev(struct drm_device *dev);
1450extern unsigned int drm_debug; 1415extern unsigned int drm_debug;
1451extern unsigned int drm_rnodes; 1416extern unsigned int drm_rnodes;
1417extern unsigned int drm_universal_planes;
1452 1418
1453extern unsigned int drm_vblank_offdelay; 1419extern unsigned int drm_vblank_offdelay;
1454extern unsigned int drm_timestamp_precision; 1420extern unsigned int drm_timestamp_precision;
@@ -1661,9 +1627,14 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1661 1627
1662struct drm_device *drm_dev_alloc(struct drm_driver *driver, 1628struct drm_device *drm_dev_alloc(struct drm_driver *driver,
1663 struct device *parent); 1629 struct device *parent);
1664void drm_dev_free(struct drm_device *dev); 1630void drm_dev_ref(struct drm_device *dev);
1631void drm_dev_unref(struct drm_device *dev);
1665int drm_dev_register(struct drm_device *dev, unsigned long flags); 1632int drm_dev_register(struct drm_device *dev, unsigned long flags);
1666void drm_dev_unregister(struct drm_device *dev); 1633void drm_dev_unregister(struct drm_device *dev);
1634
1635struct drm_minor *drm_minor_acquire(unsigned int minor_id);
1636void drm_minor_release(struct drm_minor *minor);
1637
1667/*@}*/ 1638/*@}*/
1668 1639
1669/* PCI section */ 1640/* PCI section */
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 8f3dee097579..e55fccbe7c42 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -32,7 +32,6 @@
32#include <linux/fb.h> 32#include <linux/fb.h>
33#include <linux/hdmi.h> 33#include <linux/hdmi.h>
34#include <drm/drm_mode.h> 34#include <drm/drm_mode.h>
35
36#include <drm/drm_fourcc.h> 35#include <drm/drm_fourcc.h>
37 36
38struct drm_device; 37struct drm_device;
@@ -65,130 +64,14 @@ struct drm_object_properties {
65 uint64_t values[DRM_OBJECT_MAX_PROPERTY]; 64 uint64_t values[DRM_OBJECT_MAX_PROPERTY];
66}; 65};
67 66
68/* 67enum drm_connector_force {
69 * Note on terminology: here, for brevity and convenience, we refer to connector 68 DRM_FORCE_UNSPECIFIED,
70 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS, 69 DRM_FORCE_OFF,
71 * DVI, etc. And 'screen' refers to the whole of the visible display, which 70 DRM_FORCE_ON, /* force on analog part normally */
72 * may span multiple monitors (and therefore multiple CRTC and connector 71 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
73 * structures).
74 */
75
76enum drm_mode_status {
77 MODE_OK = 0, /* Mode OK */
78 MODE_HSYNC, /* hsync out of range */
79 MODE_VSYNC, /* vsync out of range */
80 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
81 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
82 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
83 MODE_NOMODE, /* no mode with a matching name */
84 MODE_NO_INTERLACE, /* interlaced mode not supported */
85 MODE_NO_DBLESCAN, /* doublescan mode not supported */
86 MODE_NO_VSCAN, /* multiscan mode not supported */
87 MODE_MEM, /* insufficient video memory */
88 MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
89 MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
90 MODE_MEM_VIRT, /* insufficient video memory given virtual size */
91 MODE_NOCLOCK, /* no fixed clock available */
92 MODE_CLOCK_HIGH, /* clock required is too high */
93 MODE_CLOCK_LOW, /* clock required is too low */
94 MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
95 MODE_BAD_HVALUE, /* horizontal timing was out of range */
96 MODE_BAD_VVALUE, /* vertical timing was out of range */
97 MODE_BAD_VSCAN, /* VScan value out of range */
98 MODE_HSYNC_NARROW, /* horizontal sync too narrow */
99 MODE_HSYNC_WIDE, /* horizontal sync too wide */
100 MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
101 MODE_HBLANK_WIDE, /* horizontal blanking too wide */
102 MODE_VSYNC_NARROW, /* vertical sync too narrow */
103 MODE_VSYNC_WIDE, /* vertical sync too wide */
104 MODE_VBLANK_NARROW, /* vertical blanking too narrow */
105 MODE_VBLANK_WIDE, /* vertical blanking too wide */
106 MODE_PANEL, /* exceeds panel dimensions */
107 MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
108 MODE_ONE_WIDTH, /* only one width is supported */
109 MODE_ONE_HEIGHT, /* only one height is supported */
110 MODE_ONE_SIZE, /* only one resolution is supported */
111 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
112 MODE_NO_STEREO, /* stereo modes not supported */
113 MODE_UNVERIFIED = -3, /* mode needs to reverified */
114 MODE_BAD = -2, /* unspecified reason */
115 MODE_ERROR = -1 /* error condition */
116};
117
118#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
119 DRM_MODE_TYPE_CRTC_C)
120
121#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
122 .name = nm, .status = 0, .type = (t), .clock = (c), \
123 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
124 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
125 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
126 .vscan = (vs), .flags = (f), \
127 .base.type = DRM_MODE_OBJECT_MODE
128
129#define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */
130#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */
131
132#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
133
134struct drm_display_mode {
135 /* Header */
136 struct list_head head;
137 struct drm_mode_object base;
138
139 char name[DRM_DISPLAY_MODE_LEN];
140
141 enum drm_mode_status status;
142 unsigned int type;
143
144 /* Proposed mode values */
145 int clock; /* in kHz */
146 int hdisplay;
147 int hsync_start;
148 int hsync_end;
149 int htotal;
150 int hskew;
151 int vdisplay;
152 int vsync_start;
153 int vsync_end;
154 int vtotal;
155 int vscan;
156 unsigned int flags;
157
158 /* Addressable image size (may be 0 for projectors, etc.) */
159 int width_mm;
160 int height_mm;
161
162 /* Actual mode we give to hw */
163 int crtc_clock; /* in KHz */
164 int crtc_hdisplay;
165 int crtc_hblank_start;
166 int crtc_hblank_end;
167 int crtc_hsync_start;
168 int crtc_hsync_end;
169 int crtc_htotal;
170 int crtc_hskew;
171 int crtc_vdisplay;
172 int crtc_vblank_start;
173 int crtc_vblank_end;
174 int crtc_vsync_start;
175 int crtc_vsync_end;
176 int crtc_vtotal;
177
178 /* Driver private mode info */
179 int private_size;
180 int *private;
181 int private_flags;
182
183 int vrefresh; /* in Hz */
184 int hsync; /* in kHz */
185 enum hdmi_picture_aspect picture_aspect_ratio;
186}; 72};
187 73
188static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode) 74#include <drm/drm_modes.h>
189{
190 return mode->flags & DRM_MODE_FLAG_3D_MASK;
191}
192 75
193enum drm_connector_status { 76enum drm_connector_status {
194 connector_status_connected = 1, 77 connector_status_connected = 1,
@@ -387,6 +270,8 @@ struct drm_crtc_funcs {
387 * @dev: parent DRM device 270 * @dev: parent DRM device
388 * @head: list management 271 * @head: list management
389 * @base: base KMS object for ID tracking etc. 272 * @base: base KMS object for ID tracking etc.
273 * @primary: primary plane for this CRTC
274 * @cursor: cursor plane for this CRTC
390 * @enabled: is this CRTC enabled? 275 * @enabled: is this CRTC enabled?
391 * @mode: current mode timings 276 * @mode: current mode timings
392 * @hwmode: mode timings as programmed to hw regs 277 * @hwmode: mode timings as programmed to hw regs
@@ -422,8 +307,9 @@ struct drm_crtc {
422 307
423 struct drm_mode_object base; 308 struct drm_mode_object base;
424 309
425 /* framebuffer the connector is currently bound to */ 310 /* primary and cursor planes for CRTC */
426 struct drm_framebuffer *fb; 311 struct drm_plane *primary;
312 struct drm_plane *cursor;
427 313
428 /* Temporary tracking of the old fb while a modeset is ongoing. Used 314 /* Temporary tracking of the old fb while a modeset is ongoing. Used
429 * by drm_mode_set_config_internal to implement correct refcounting. */ 315 * by drm_mode_set_config_internal to implement correct refcounting. */
@@ -540,13 +426,6 @@ struct drm_encoder {
540 void *helper_private; 426 void *helper_private;
541}; 427};
542 428
543enum drm_connector_force {
544 DRM_FORCE_UNSPECIFIED,
545 DRM_FORCE_OFF,
546 DRM_FORCE_ON, /* force on analog part normally */
547 DRM_FORCE_ON_DIGITAL, /* for DVI-I use digital connector */
548};
549
550/* should we poll this connector for connects and disconnects */ 429/* should we poll this connector for connects and disconnects */
551/* hot plug detectable */ 430/* hot plug detectable */
552#define DRM_CONNECTOR_POLL_HPD (1 << 0) 431#define DRM_CONNECTOR_POLL_HPD (1 << 0)
@@ -665,6 +544,12 @@ struct drm_plane_funcs {
665 struct drm_property *property, uint64_t val); 544 struct drm_property *property, uint64_t val);
666}; 545};
667 546
547enum drm_plane_type {
548 DRM_PLANE_TYPE_OVERLAY,
549 DRM_PLANE_TYPE_PRIMARY,
550 DRM_PLANE_TYPE_CURSOR,
551};
552
668/** 553/**
669 * drm_plane - central DRM plane control structure 554 * drm_plane - central DRM plane control structure
670 * @dev: DRM device this plane belongs to 555 * @dev: DRM device this plane belongs to
@@ -677,6 +562,7 @@ struct drm_plane_funcs {
677 * @fb: currently bound fb 562 * @fb: currently bound fb
678 * @funcs: helper functions 563 * @funcs: helper functions
679 * @properties: property tracking for this plane 564 * @properties: property tracking for this plane
565 * @type: type of plane (overlay, primary, cursor)
680 */ 566 */
681struct drm_plane { 567struct drm_plane {
682 struct drm_device *dev; 568 struct drm_device *dev;
@@ -694,6 +580,8 @@ struct drm_plane {
694 const struct drm_plane_funcs *funcs; 580 const struct drm_plane_funcs *funcs;
695 581
696 struct drm_object_properties properties; 582 struct drm_object_properties properties;
583
584 enum drm_plane_type type;
697}; 585};
698 586
699/** 587/**
@@ -856,7 +744,15 @@ struct drm_mode_config {
856 struct list_head bridge_list; 744 struct list_head bridge_list;
857 int num_encoder; 745 int num_encoder;
858 struct list_head encoder_list; 746 struct list_head encoder_list;
859 int num_plane; 747
748 /*
749 * Track # of overlay planes separately from # of total planes. By
750 * default we only advertise overlay planes to userspace; if userspace
751 * sets the "universal plane" capability bit, we'll go ahead and
752 * expose all planes.
753 */
754 int num_overlay_plane;
755 int num_total_plane;
860 struct list_head plane_list; 756 struct list_head plane_list;
861 757
862 int num_crtc; 758 int num_crtc;
@@ -878,6 +774,7 @@ struct drm_mode_config {
878 struct list_head property_blob_list; 774 struct list_head property_blob_list;
879 struct drm_property *edid_property; 775 struct drm_property *edid_property;
880 struct drm_property *dpms_property; 776 struct drm_property *dpms_property;
777 struct drm_property *plane_type_property;
881 778
882 /* DVI-I properties */ 779 /* DVI-I properties */
883 struct drm_property *dvi_i_subconnector_property; 780 struct drm_property *dvi_i_subconnector_property;
@@ -930,6 +827,11 @@ extern void drm_modeset_lock_all(struct drm_device *dev);
930extern void drm_modeset_unlock_all(struct drm_device *dev); 827extern void drm_modeset_unlock_all(struct drm_device *dev);
931extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev); 828extern void drm_warn_on_modeset_not_all_locked(struct drm_device *dev);
932 829
830extern int drm_crtc_init_with_planes(struct drm_device *dev,
831 struct drm_crtc *crtc,
832 struct drm_plane *primary,
833 void *cursor,
834 const struct drm_crtc_funcs *funcs);
933extern int drm_crtc_init(struct drm_device *dev, 835extern int drm_crtc_init(struct drm_device *dev,
934 struct drm_crtc *crtc, 836 struct drm_crtc *crtc,
935 const struct drm_crtc_funcs *funcs); 837 const struct drm_crtc_funcs *funcs);
@@ -981,19 +883,31 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
981 return !!(encoder->possible_crtcs & drm_crtc_mask(crtc)); 883 return !!(encoder->possible_crtcs & drm_crtc_mask(crtc));
982} 884}
983 885
886extern int drm_universal_plane_init(struct drm_device *dev,
887 struct drm_plane *plane,
888 unsigned long possible_crtcs,
889 const struct drm_plane_funcs *funcs,
890 const uint32_t *formats,
891 uint32_t format_count,
892 enum drm_plane_type type);
984extern int drm_plane_init(struct drm_device *dev, 893extern int drm_plane_init(struct drm_device *dev,
985 struct drm_plane *plane, 894 struct drm_plane *plane,
986 unsigned long possible_crtcs, 895 unsigned long possible_crtcs,
987 const struct drm_plane_funcs *funcs, 896 const struct drm_plane_funcs *funcs,
988 const uint32_t *formats, uint32_t format_count, 897 const uint32_t *formats, uint32_t format_count,
989 bool priv); 898 bool is_primary);
990extern void drm_plane_cleanup(struct drm_plane *plane); 899extern void drm_plane_cleanup(struct drm_plane *plane);
991extern void drm_plane_force_disable(struct drm_plane *plane); 900extern void drm_plane_force_disable(struct drm_plane *plane);
901extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
902 int x, int y,
903 const struct drm_display_mode *mode,
904 const struct drm_framebuffer *fb);
992 905
993extern void drm_encoder_cleanup(struct drm_encoder *encoder); 906extern void drm_encoder_cleanup(struct drm_encoder *encoder);
994 907
995extern const char *drm_get_connector_name(const struct drm_connector *connector); 908extern const char *drm_get_connector_name(const struct drm_connector *connector);
996extern const char *drm_get_connector_status_name(enum drm_connector_status status); 909extern const char *drm_get_connector_status_name(enum drm_connector_status status);
910extern const char *drm_get_subpixel_order_name(enum subpixel_order order);
997extern const char *drm_get_dpms_name(int val); 911extern const char *drm_get_dpms_name(int val);
998extern const char *drm_get_dvi_i_subconnector_name(int val); 912extern const char *drm_get_dvi_i_subconnector_name(int val);
999extern const char *drm_get_dvi_i_select_name(int val); 913extern const char *drm_get_dvi_i_select_name(int val);
@@ -1006,34 +920,10 @@ extern struct edid *drm_get_edid(struct drm_connector *connector,
1006 struct i2c_adapter *adapter); 920 struct i2c_adapter *adapter);
1007extern struct edid *drm_edid_duplicate(const struct edid *edid); 921extern struct edid *drm_edid_duplicate(const struct edid *edid);
1008extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 922extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
1009extern void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
1010extern void drm_mode_copy(struct drm_display_mode *dst, const struct drm_display_mode *src);
1011extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
1012 const struct drm_display_mode *mode);
1013extern void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
1014extern void drm_mode_config_init(struct drm_device *dev); 923extern void drm_mode_config_init(struct drm_device *dev);
1015extern void drm_mode_config_reset(struct drm_device *dev); 924extern void drm_mode_config_reset(struct drm_device *dev);
1016extern void drm_mode_config_cleanup(struct drm_device *dev); 925extern void drm_mode_config_cleanup(struct drm_device *dev);
1017extern void drm_mode_set_name(struct drm_display_mode *mode); 926
1018extern bool drm_mode_equal(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
1019extern bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, const struct drm_display_mode *mode2);
1020extern int drm_mode_width(const struct drm_display_mode *mode);
1021extern int drm_mode_height(const struct drm_display_mode *mode);
1022
1023/* for us by fb module */
1024extern struct drm_display_mode *drm_mode_create(struct drm_device *dev);
1025extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
1026extern void drm_mode_validate_size(struct drm_device *dev,
1027 struct list_head *mode_list,
1028 int maxX, int maxY, int maxPitch);
1029extern void drm_mode_prune_invalid(struct drm_device *dev,
1030 struct list_head *mode_list, bool verbose);
1031extern void drm_mode_sort(struct list_head *mode_list);
1032extern int drm_mode_hsync(const struct drm_display_mode *mode);
1033extern int drm_mode_vrefresh(const struct drm_display_mode *mode);
1034extern void drm_mode_set_crtcinfo(struct drm_display_mode *p,
1035 int adjust_flags);
1036extern void drm_mode_connector_list_update(struct drm_connector *connector);
1037extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 927extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
1038 struct edid *edid); 928 struct edid *edid);
1039extern int drm_object_property_set_value(struct drm_mode_object *obj, 929extern int drm_object_property_set_value(struct drm_mode_object *obj,
@@ -1081,8 +971,6 @@ extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
1081 971
1082extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 972extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1083 struct drm_encoder *encoder); 973 struct drm_encoder *encoder);
1084extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
1085 struct drm_encoder *encoder);
1086extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, 974extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
1087 int gamma_size); 975 int gamma_size);
1088extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, 976extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
@@ -1137,16 +1025,6 @@ extern bool drm_detect_monitor_audio(struct edid *edid);
1137extern bool drm_rgb_quant_range_selectable(struct edid *edid); 1025extern bool drm_rgb_quant_range_selectable(struct edid *edid);
1138extern int drm_mode_page_flip_ioctl(struct drm_device *dev, 1026extern int drm_mode_page_flip_ioctl(struct drm_device *dev,
1139 void *data, struct drm_file *file_priv); 1027 void *data, struct drm_file *file_priv);
1140extern struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
1141 int hdisplay, int vdisplay, int vrefresh,
1142 bool reduced, bool interlaced, bool margins);
1143extern struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
1144 int hdisplay, int vdisplay, int vrefresh,
1145 bool interlaced, int margins);
1146extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
1147 int hdisplay, int vdisplay, int vrefresh,
1148 bool interlaced, int margins, int GTF_M,
1149 int GTF_2C, int GTF_K, int GTF_2J);
1150extern int drm_add_modes_noedid(struct drm_connector *connector, 1028extern int drm_add_modes_noedid(struct drm_connector *connector,
1151 int hdisplay, int vdisplay); 1029 int hdisplay, int vdisplay);
1152extern void drm_set_preferred_mode(struct drm_connector *connector, 1030extern void drm_set_preferred_mode(struct drm_connector *connector,
@@ -1195,4 +1073,9 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
1195 return mo ? obj_to_encoder(mo) : NULL; 1073 return mo ? obj_to_encoder(mo) : NULL;
1196} 1074}
1197 1075
1076/* Plane list iterator for legacy (overlay only) planes. */
1077#define drm_for_each_legacy_plane(plane, planelist) \
1078 list_for_each_entry(plane, planelist, head) \
1079 if (plane->type == DRM_PLANE_TYPE_OVERLAY)
1080
1198#endif /* __DRM_CRTC_H__ */ 1081#endif /* __DRM_CRTC_H__ */
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index b1388b5fe7ac..0bb34ca2ad2b 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -139,8 +139,8 @@ extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode)
139 139
140extern void drm_helper_move_panel_connectors_to_head(struct drm_device *); 140extern void drm_helper_move_panel_connectors_to_head(struct drm_device *);
141 141
142extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 142extern void drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
143 struct drm_mode_fb_cmd2 *mode_cmd); 143 struct drm_mode_fb_cmd2 *mode_cmd);
144 144
145static inline void drm_crtc_helper_add(struct drm_crtc *crtc, 145static inline void drm_crtc_helper_add(struct drm_crtc *crtc,
146 const struct drm_crtc_helper_funcs *funcs) 146 const struct drm_crtc_helper_funcs *funcs)
@@ -160,7 +160,7 @@ static inline void drm_connector_helper_add(struct drm_connector *connector,
160 connector->helper_private = (void *)funcs; 160 connector->helper_private = (void *)funcs;
161} 161}
162 162
163extern int drm_helper_resume_force_mode(struct drm_device *dev); 163extern void drm_helper_resume_force_mode(struct drm_device *dev);
164extern void drm_kms_helper_poll_init(struct drm_device *dev); 164extern void drm_kms_helper_poll_init(struct drm_device *dev);
165extern void drm_kms_helper_poll_fini(struct drm_device *dev); 165extern void drm_kms_helper_poll_fini(struct drm_device *dev);
166extern bool drm_helper_hpd_irq_event(struct drm_device *dev); 166extern bool drm_helper_hpd_irq_event(struct drm_device *dev);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 1d09050a8c00..b4f58914bf7d 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -279,11 +279,21 @@
279 279
280#define DP_TEST_PATTERN 0x221 280#define DP_TEST_PATTERN 0x221
281 281
282#define DP_TEST_CRC_R_CR 0x240
283#define DP_TEST_CRC_G_Y 0x242
284#define DP_TEST_CRC_B_CB 0x244
285
286#define DP_TEST_SINK_MISC 0x246
287#define DP_TEST_CRC_SUPPORTED (1 << 5)
288
282#define DP_TEST_RESPONSE 0x260 289#define DP_TEST_RESPONSE 0x260
283# define DP_TEST_ACK (1 << 0) 290# define DP_TEST_ACK (1 << 0)
284# define DP_TEST_NAK (1 << 1) 291# define DP_TEST_NAK (1 << 1)
285# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 292# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2)
286 293
294#define DP_TEST_SINK 0x270
295#define DP_TEST_SINK_START (1 << 0)
296
287#define DP_SOURCE_OUI 0x300 297#define DP_SOURCE_OUI 0x300
288#define DP_SINK_OUI 0x400 298#define DP_SINK_OUI 0x400
289#define DP_BRANCH_OUI 0x500 299#define DP_BRANCH_OUI 0x500
@@ -291,6 +301,7 @@
291#define DP_SET_POWER 0x600 301#define DP_SET_POWER 0x600
292# define DP_SET_POWER_D0 0x1 302# define DP_SET_POWER_D0 0x1
293# define DP_SET_POWER_D3 0x2 303# define DP_SET_POWER_D3 0x2
304# define DP_SET_POWER_MASK 0x3
294 305
295#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ 306#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
296# define DP_PSR_LINK_CRC_ERROR (1 << 0) 307# define DP_PSR_LINK_CRC_ERROR (1 << 0)
@@ -398,4 +409,118 @@ drm_dp_enhanced_frame_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
398 (dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP); 409 (dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP);
399} 410}
400 411
412/*
413 * DisplayPort AUX channel
414 */
415
416/**
417 * struct drm_dp_aux_msg - DisplayPort AUX channel transaction
418 * @address: address of the (first) register to access
419 * @request: contains the type of transaction (see DP_AUX_* macros)
420 * @reply: upon completion, contains the reply type of the transaction
421 * @buffer: pointer to a transmission or reception buffer
422 * @size: size of @buffer
423 */
424struct drm_dp_aux_msg {
425 unsigned int address;
426 u8 request;
427 u8 reply;
428 void *buffer;
429 size_t size;
430};
431
432/**
433 * struct drm_dp_aux - DisplayPort AUX channel
434 * @ddc: I2C adapter that can be used for I2C-over-AUX communication
435 * @dev: pointer to struct device that is the parent for this AUX channel
436 * @transfer: transfers a message representing a single AUX transaction
437 *
438 * The .dev field should be set to a pointer to the device that implements
439 * the AUX channel.
440 *
441 * The .name field may be used to specify the name of the I2C adapter. If set to
442 * NULL, dev_name() of .dev will be used.
443 *
444 * Drivers provide a hardware-specific implementation of how transactions
445 * are executed via the .transfer() function. A pointer to a drm_dp_aux_msg
446 * structure describing the transaction is passed into this function. Upon
447 * success, the implementation should return the number of payload bytes
448 * that were transferred, or a negative error-code on failure. Helpers
449 * propagate errors from the .transfer() function, with the exception of
450 * the -EBUSY error, which causes a transaction to be retried. On a short,
451 * helpers will return -EPROTO to make it simpler to check for failure.
452 *
453 * An AUX channel can also be used to transport I2C messages to a sink. A
454 * typical application of that is to access an EDID that's present in the
455 * sink device. The .transfer() function can also be used to execute such
456 * transactions. The drm_dp_aux_register_i2c_bus() function registers an
457 * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers
458 * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter.
459 */
460struct drm_dp_aux {
461 const char *name;
462 struct i2c_adapter ddc;
463 struct device *dev;
464
465 ssize_t (*transfer)(struct drm_dp_aux *aux,
466 struct drm_dp_aux_msg *msg);
467};
468
469ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
470 void *buffer, size_t size);
471ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
472 void *buffer, size_t size);
473
474/**
475 * drm_dp_dpcd_readb() - read a single byte from the DPCD
476 * @aux: DisplayPort AUX channel
477 * @offset: address of the register to read
478 * @valuep: location where the value of the register will be stored
479 *
480 * Returns the number of bytes transferred (1) on success, or a negative
481 * error code on failure.
482 */
483static inline ssize_t drm_dp_dpcd_readb(struct drm_dp_aux *aux,
484 unsigned int offset, u8 *valuep)
485{
486 return drm_dp_dpcd_read(aux, offset, valuep, 1);
487}
488
489/**
490 * drm_dp_dpcd_writeb() - write a single byte to the DPCD
491 * @aux: DisplayPort AUX channel
492 * @offset: address of the register to write
493 * @value: value to write to the register
494 *
495 * Returns the number of bytes transferred (1) on success, or a negative
496 * error code on failure.
497 */
498static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux,
499 unsigned int offset, u8 value)
500{
501 return drm_dp_dpcd_write(aux, offset, &value, 1);
502}
503
504int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
505 u8 status[DP_LINK_STATUS_SIZE]);
506
507/*
508 * DisplayPort link
509 */
510#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
511
512struct drm_dp_link {
513 unsigned char revision;
514 unsigned int rate;
515 unsigned int num_lanes;
516 unsigned long capabilities;
517};
518
519int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
520int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
521int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
522
523int drm_dp_aux_register_i2c_bus(struct drm_dp_aux *aux);
524void drm_dp_aux_unregister_i2c_bus(struct drm_dp_aux *aux);
525
401#endif /* _DRM_DP_HELPER_H_ */ 526#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 471f276ce8f7..6e622f7d481d 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -55,7 +55,7 @@ struct drm_fb_helper_surface_size {
55 * save the current lut when force-restoring the fbdev for e.g. 55 * save the current lut when force-restoring the fbdev for e.g.
56 * kdbg. 56 * kdbg.
57 * @fb_probe: Driver callback to allocate and initialize the fbdev info 57 * @fb_probe: Driver callback to allocate and initialize the fbdev info
58 * structure. Futhermore it also needs to allocate the drm 58 * structure. Furthermore it also needs to allocate the drm
59 * framebuffer used to back the fbdev. 59 * framebuffer used to back the fbdev.
60 * @initial_config: Setup an initial fbdev display configuration 60 * @initial_config: Setup an initial fbdev display configuration
61 * 61 *
@@ -121,5 +121,11 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
121int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 121int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
122int drm_fb_helper_debug_enter(struct fb_info *info); 122int drm_fb_helper_debug_enter(struct fb_info *info);
123int drm_fb_helper_debug_leave(struct fb_info *info); 123int drm_fb_helper_debug_leave(struct fb_info *info);
124struct drm_display_mode *
125drm_has_preferred_mode(struct drm_fb_helper_connector *fb_connector,
126 int width, int height);
127struct drm_display_mode *
128drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
129 int width, int height);
124 130
125#endif 131#endif
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
index 89b4d7db1ebd..2a3cea91606d 100644
--- a/include/drm/drm_gem_cma_helper.h
+++ b/include/drm/drm_gem_cma_helper.h
@@ -1,6 +1,8 @@
1#ifndef __DRM_GEM_CMA_HELPER_H__ 1#ifndef __DRM_GEM_CMA_HELPER_H__
2#define __DRM_GEM_CMA_HELPER_H__ 2#define __DRM_GEM_CMA_HELPER_H__
3 3
4#include <drm/drmP.h>
5
4struct drm_gem_cma_object { 6struct drm_gem_cma_object {
5 struct drm_gem_object base; 7 struct drm_gem_object base;
6 dma_addr_t paddr; 8 dma_addr_t paddr;
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index d32628acdd90..7209df15a3cd 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -17,6 +17,11 @@
17struct mipi_dsi_host; 17struct mipi_dsi_host;
18struct mipi_dsi_device; 18struct mipi_dsi_device;
19 19
20/* request ACK from peripheral */
21#define MIPI_DSI_MSG_REQ_ACK BIT(0)
22/* use Low Power Mode to transmit message */
23#define MIPI_DSI_MSG_USE_LPM BIT(1)
24
20/** 25/**
21 * struct mipi_dsi_msg - read/write DSI buffer 26 * struct mipi_dsi_msg - read/write DSI buffer
22 * @channel: virtual channel id 27 * @channel: virtual channel id
@@ -29,6 +34,7 @@ struct mipi_dsi_device;
29struct mipi_dsi_msg { 34struct mipi_dsi_msg {
30 u8 channel; 35 u8 channel;
31 u8 type; 36 u8 type;
37 u16 flags;
32 38
33 size_t tx_len; 39 size_t tx_len;
34 const void *tx_buf; 40 const void *tx_buf;
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index cba67865d18f..a24addfdfcec 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -47,8 +47,17 @@
47enum drm_mm_search_flags { 47enum drm_mm_search_flags {
48 DRM_MM_SEARCH_DEFAULT = 0, 48 DRM_MM_SEARCH_DEFAULT = 0,
49 DRM_MM_SEARCH_BEST = 1 << 0, 49 DRM_MM_SEARCH_BEST = 1 << 0,
50 DRM_MM_SEARCH_BELOW = 1 << 1,
50}; 51};
51 52
53enum drm_mm_allocator_flags {
54 DRM_MM_CREATE_DEFAULT = 0,
55 DRM_MM_CREATE_TOP = 1 << 0,
56};
57
58#define DRM_MM_BOTTOMUP DRM_MM_SEARCH_DEFAULT, DRM_MM_CREATE_DEFAULT
59#define DRM_MM_TOPDOWN DRM_MM_SEARCH_BELOW, DRM_MM_CREATE_TOP
60
52struct drm_mm_node { 61struct drm_mm_node {
53 struct list_head node_list; 62 struct list_head node_list;
54 struct list_head hole_stack; 63 struct list_head hole_stack;
@@ -85,11 +94,31 @@ struct drm_mm {
85 unsigned long *start, unsigned long *end); 94 unsigned long *start, unsigned long *end);
86}; 95};
87 96
97/**
98 * drm_mm_node_allocated - checks whether a node is allocated
99 * @node: drm_mm_node to check
100 *
101 * Drivers should use this helpers for proper encapusulation of drm_mm
102 * internals.
103 *
104 * Returns:
105 * True if the @node is allocated.
106 */
88static inline bool drm_mm_node_allocated(struct drm_mm_node *node) 107static inline bool drm_mm_node_allocated(struct drm_mm_node *node)
89{ 108{
90 return node->allocated; 109 return node->allocated;
91} 110}
92 111
112/**
113 * drm_mm_initialized - checks whether an allocator is initialized
114 * @mm: drm_mm to check
115 *
116 * Drivers should use this helpers for proper encapusulation of drm_mm
117 * internals.
118 *
119 * Returns:
120 * True if the @mm is initialized.
121 */
93static inline bool drm_mm_initialized(struct drm_mm *mm) 122static inline bool drm_mm_initialized(struct drm_mm *mm)
94{ 123{
95 return mm->hole_stack.next; 124 return mm->hole_stack.next;
@@ -100,6 +129,17 @@ static inline unsigned long __drm_mm_hole_node_start(struct drm_mm_node *hole_no
100 return hole_node->start + hole_node->size; 129 return hole_node->start + hole_node->size;
101} 130}
102 131
132/**
133 * drm_mm_hole_node_start - computes the start of the hole following @node
134 * @hole_node: drm_mm_node which implicitly tracks the following hole
135 *
136 * This is useful for driver-sepific debug dumpers. Otherwise drivers should not
137 * inspect holes themselves. Drivers must check first whether a hole indeed
138 * follows by looking at node->hole_follows.
139 *
140 * Returns:
141 * Start of the subsequent hole.
142 */
103static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node) 143static inline unsigned long drm_mm_hole_node_start(struct drm_mm_node *hole_node)
104{ 144{
105 BUG_ON(!hole_node->hole_follows); 145 BUG_ON(!hole_node->hole_follows);
@@ -112,18 +152,52 @@ static inline unsigned long __drm_mm_hole_node_end(struct drm_mm_node *hole_node
112 struct drm_mm_node, node_list)->start; 152 struct drm_mm_node, node_list)->start;
113} 153}
114 154
155/**
156 * drm_mm_hole_node_end - computes the end of the hole following @node
157 * @hole_node: drm_mm_node which implicitly tracks the following hole
158 *
159 * This is useful for driver-sepific debug dumpers. Otherwise drivers should not
160 * inspect holes themselves. Drivers must check first whether a hole indeed
161 * follows by looking at node->hole_follows.
162 *
163 * Returns:
164 * End of the subsequent hole.
165 */
115static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node) 166static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node)
116{ 167{
117 return __drm_mm_hole_node_end(hole_node); 168 return __drm_mm_hole_node_end(hole_node);
118} 169}
119 170
171/**
172 * drm_mm_for_each_node - iterator to walk over all allocated nodes
173 * @entry: drm_mm_node structure to assign to in each iteration step
174 * @mm: drm_mm allocator to walk
175 *
176 * This iterator walks over all nodes in the range allocator. It is implemented
177 * with list_for_each, so not save against removal of elements.
178 */
120#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \ 179#define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
121 &(mm)->head_node.node_list, \ 180 &(mm)->head_node.node_list, \
122 node_list) 181 node_list)
123 182
124/* Note that we need to unroll list_for_each_entry in order to inline 183/**
125 * setting hole_start and hole_end on each iteration and keep the 184 * drm_mm_for_each_hole - iterator to walk over all holes
126 * macro sane. 185 * @entry: drm_mm_node used internally to track progress
186 * @mm: drm_mm allocator to walk
187 * @hole_start: ulong variable to assign the hole start to on each iteration
188 * @hole_end: ulong variable to assign the hole end to on each iteration
189 *
190 * This iterator walks over all holes in the range allocator. It is implemented
191 * with list_for_each, so not save against removal of elements. @entry is used
192 * internally and will not reflect a real drm_mm_node for the very first hole.
193 * Hence users of this iterator may not access it.
194 *
195 * Implementation Note:
196 * We need to inline list_for_each_entry in order to be able to set hole_start
197 * and hole_end on each iteration while keeping the macro sane.
198 *
199 * The __drm_mm_for_each_hole version is similar, but with added support for
200 * going backwards.
127 */ 201 */
128#define drm_mm_for_each_hole(entry, mm, hole_start, hole_end) \ 202#define drm_mm_for_each_hole(entry, mm, hole_start, hole_end) \
129 for (entry = list_entry((mm)->hole_stack.next, struct drm_mm_node, hole_stack); \ 203 for (entry = list_entry((mm)->hole_stack.next, struct drm_mm_node, hole_stack); \
@@ -133,34 +207,79 @@ static inline unsigned long drm_mm_hole_node_end(struct drm_mm_node *hole_node)
133 1 : 0; \ 207 1 : 0; \
134 entry = list_entry(entry->hole_stack.next, struct drm_mm_node, hole_stack)) 208 entry = list_entry(entry->hole_stack.next, struct drm_mm_node, hole_stack))
135 209
210#define __drm_mm_for_each_hole(entry, mm, hole_start, hole_end, backwards) \
211 for (entry = list_entry((backwards) ? (mm)->hole_stack.prev : (mm)->hole_stack.next, struct drm_mm_node, hole_stack); \
212 &entry->hole_stack != &(mm)->hole_stack ? \
213 hole_start = drm_mm_hole_node_start(entry), \
214 hole_end = drm_mm_hole_node_end(entry), \
215 1 : 0; \
216 entry = list_entry((backwards) ? entry->hole_stack.prev : entry->hole_stack.next, struct drm_mm_node, hole_stack))
217
136/* 218/*
137 * Basic range manager support (drm_mm.c) 219 * Basic range manager support (drm_mm.c)
138 */ 220 */
139extern int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node); 221int drm_mm_reserve_node(struct drm_mm *mm, struct drm_mm_node *node);
140 222
141extern int drm_mm_insert_node_generic(struct drm_mm *mm, 223int drm_mm_insert_node_generic(struct drm_mm *mm,
142 struct drm_mm_node *node, 224 struct drm_mm_node *node,
143 unsigned long size, 225 unsigned long size,
144 unsigned alignment, 226 unsigned alignment,
145 unsigned long color, 227 unsigned long color,
146 enum drm_mm_search_flags flags); 228 enum drm_mm_search_flags sflags,
229 enum drm_mm_allocator_flags aflags);
230/**
231 * drm_mm_insert_node - search for space and insert @node
232 * @mm: drm_mm to allocate from
233 * @node: preallocate node to insert
234 * @size: size of the allocation
235 * @alignment: alignment of the allocation
236 * @flags: flags to fine-tune the allocation
237 *
238 * This is a simplified version of drm_mm_insert_node_generic() with @color set
239 * to 0.
240 *
241 * The preallocated node must be cleared to 0.
242 *
243 * Returns:
244 * 0 on success, -ENOSPC if there's no suitable hole.
245 */
147static inline int drm_mm_insert_node(struct drm_mm *mm, 246static inline int drm_mm_insert_node(struct drm_mm *mm,
148 struct drm_mm_node *node, 247 struct drm_mm_node *node,
149 unsigned long size, 248 unsigned long size,
150 unsigned alignment, 249 unsigned alignment,
151 enum drm_mm_search_flags flags) 250 enum drm_mm_search_flags flags)
152{ 251{
153 return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags); 252 return drm_mm_insert_node_generic(mm, node, size, alignment, 0, flags,
253 DRM_MM_CREATE_DEFAULT);
154} 254}
155 255
156extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, 256int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
157 struct drm_mm_node *node, 257 struct drm_mm_node *node,
158 unsigned long size, 258 unsigned long size,
159 unsigned alignment, 259 unsigned alignment,
160 unsigned long color, 260 unsigned long color,
161 unsigned long start, 261 unsigned long start,
162 unsigned long end, 262 unsigned long end,
163 enum drm_mm_search_flags flags); 263 enum drm_mm_search_flags sflags,
264 enum drm_mm_allocator_flags aflags);
265/**
266 * drm_mm_insert_node_in_range - ranged search for space and insert @node
267 * @mm: drm_mm to allocate from
268 * @node: preallocate node to insert
269 * @size: size of the allocation
270 * @alignment: alignment of the allocation
271 * @start: start of the allowed range for this node
272 * @end: end of the allowed range for this node
273 * @flags: flags to fine-tune the allocation
274 *
275 * This is a simplified version of drm_mm_insert_node_in_range_generic() with
276 * @color set to 0.
277 *
278 * The preallocated node must be cleared to 0.
279 *
280 * Returns:
281 * 0 on success, -ENOSPC if there's no suitable hole.
282 */
164static inline int drm_mm_insert_node_in_range(struct drm_mm *mm, 283static inline int drm_mm_insert_node_in_range(struct drm_mm *mm,
165 struct drm_mm_node *node, 284 struct drm_mm_node *node,
166 unsigned long size, 285 unsigned long size,
@@ -170,16 +289,17 @@ static inline int drm_mm_insert_node_in_range(struct drm_mm *mm,
170 enum drm_mm_search_flags flags) 289 enum drm_mm_search_flags flags)
171{ 290{
172 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 291 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment,
173 0, start, end, flags); 292 0, start, end, flags,
293 DRM_MM_CREATE_DEFAULT);
174} 294}
175 295
176extern void drm_mm_remove_node(struct drm_mm_node *node); 296void drm_mm_remove_node(struct drm_mm_node *node);
177extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); 297void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
178extern void drm_mm_init(struct drm_mm *mm, 298void drm_mm_init(struct drm_mm *mm,
179 unsigned long start, 299 unsigned long start,
180 unsigned long size); 300 unsigned long size);
181extern void drm_mm_takedown(struct drm_mm *mm); 301void drm_mm_takedown(struct drm_mm *mm);
182extern int drm_mm_clean(struct drm_mm *mm); 302bool drm_mm_clean(struct drm_mm *mm);
183 303
184void drm_mm_init_scan(struct drm_mm *mm, 304void drm_mm_init_scan(struct drm_mm *mm,
185 unsigned long size, 305 unsigned long size,
@@ -191,10 +311,10 @@ void drm_mm_init_scan_with_range(struct drm_mm *mm,
191 unsigned long color, 311 unsigned long color,
192 unsigned long start, 312 unsigned long start,
193 unsigned long end); 313 unsigned long end);
194int drm_mm_scan_add_block(struct drm_mm_node *node); 314bool drm_mm_scan_add_block(struct drm_mm_node *node);
195int drm_mm_scan_remove_block(struct drm_mm_node *node); 315bool drm_mm_scan_remove_block(struct drm_mm_node *node);
196 316
197extern void drm_mm_debug_table(struct drm_mm *mm, const char *prefix); 317void drm_mm_debug_table(struct drm_mm *mm, const char *prefix);
198#ifdef CONFIG_DEBUG_FS 318#ifdef CONFIG_DEBUG_FS
199int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm); 319int drm_mm_dump_table(struct seq_file *m, struct drm_mm *mm);
200#endif 320#endif
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
new file mode 100644
index 000000000000..2dbbf9976669
--- /dev/null
+++ b/include/drm/drm_modes.h
@@ -0,0 +1,237 @@
1/*
2 * Copyright © 2006 Keith Packard
3 * Copyright © 2007-2008 Dave Airlie
4 * Copyright © 2007-2008 Intel Corporation
5 * Jesse Barnes <jesse.barnes@intel.com>
6 * Copyright © 2014 Intel Corporation
7 * Daniel Vetter <daniel.vetter@ffwll.ch>
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 shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 * OTHER DEALINGS IN THE SOFTWARE.
26 */
27#ifndef __DRM_MODES_H__
28#define __DRM_MODES_H__
29
30/*
31 * Note on terminology: here, for brevity and convenience, we refer to connector
32 * control chips as 'CRTCs'. They can control any type of connector, VGA, LVDS,
33 * DVI, etc. And 'screen' refers to the whole of the visible display, which
34 * may span multiple monitors (and therefore multiple CRTC and connector
35 * structures).
36 */
37
38enum drm_mode_status {
39 MODE_OK = 0, /* Mode OK */
40 MODE_HSYNC, /* hsync out of range */
41 MODE_VSYNC, /* vsync out of range */
42 MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
43 MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
44 MODE_BAD_WIDTH, /* requires an unsupported linepitch */
45 MODE_NOMODE, /* no mode with a matching name */
46 MODE_NO_INTERLACE, /* interlaced mode not supported */
47 MODE_NO_DBLESCAN, /* doublescan mode not supported */
48 MODE_NO_VSCAN, /* multiscan mode not supported */
49 MODE_MEM, /* insufficient video memory */
50 MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
51 MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
52 MODE_MEM_VIRT, /* insufficient video memory given virtual size */
53 MODE_NOCLOCK, /* no fixed clock available */
54 MODE_CLOCK_HIGH, /* clock required is too high */
55 MODE_CLOCK_LOW, /* clock required is too low */
56 MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
57 MODE_BAD_HVALUE, /* horizontal timing was out of range */
58 MODE_BAD_VVALUE, /* vertical timing was out of range */
59 MODE_BAD_VSCAN, /* VScan value out of range */
60 MODE_HSYNC_NARROW, /* horizontal sync too narrow */
61 MODE_HSYNC_WIDE, /* horizontal sync too wide */
62 MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
63 MODE_HBLANK_WIDE, /* horizontal blanking too wide */
64 MODE_VSYNC_NARROW, /* vertical sync too narrow */
65 MODE_VSYNC_WIDE, /* vertical sync too wide */
66 MODE_VBLANK_NARROW, /* vertical blanking too narrow */
67 MODE_VBLANK_WIDE, /* vertical blanking too wide */
68 MODE_PANEL, /* exceeds panel dimensions */
69 MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
70 MODE_ONE_WIDTH, /* only one width is supported */
71 MODE_ONE_HEIGHT, /* only one height is supported */
72 MODE_ONE_SIZE, /* only one resolution is supported */
73 MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
74 MODE_NO_STEREO, /* stereo modes not supported */
75 MODE_UNVERIFIED = -3, /* mode needs to reverified */
76 MODE_BAD = -2, /* unspecified reason */
77 MODE_ERROR = -1 /* error condition */
78};
79
80#define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
81 DRM_MODE_TYPE_CRTC_C)
82
83#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
84 .name = nm, .status = 0, .type = (t), .clock = (c), \
85 .hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
86 .htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
87 .vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
88 .vscan = (vs), .flags = (f), \
89 .base.type = DRM_MODE_OBJECT_MODE
90
91#define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */
92#define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */
93
94#define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
95
96struct drm_display_mode {
97 /* Header */
98 struct list_head head;
99 struct drm_mode_object base;
100
101 char name[DRM_DISPLAY_MODE_LEN];
102
103 enum drm_mode_status status;
104 unsigned int type;
105
106 /* Proposed mode values */
107 int clock; /* in kHz */
108 int hdisplay;
109 int hsync_start;
110 int hsync_end;
111 int htotal;
112 int hskew;
113 int vdisplay;
114 int vsync_start;
115 int vsync_end;
116 int vtotal;
117 int vscan;
118 unsigned int flags;
119
120 /* Addressable image size (may be 0 for projectors, etc.) */
121 int width_mm;
122 int height_mm;
123
124 /* Actual mode we give to hw */
125 int crtc_clock; /* in KHz */
126 int crtc_hdisplay;
127 int crtc_hblank_start;
128 int crtc_hblank_end;
129 int crtc_hsync_start;
130 int crtc_hsync_end;
131 int crtc_htotal;
132 int crtc_hskew;
133 int crtc_vdisplay;
134 int crtc_vblank_start;
135 int crtc_vblank_end;
136 int crtc_vsync_start;
137 int crtc_vsync_end;
138 int crtc_vtotal;
139
140 /* Driver private mode info */
141 int *private;
142 int private_flags;
143
144 int vrefresh; /* in Hz */
145 int hsync; /* in kHz */
146 enum hdmi_picture_aspect picture_aspect_ratio;
147};
148
149/* mode specified on the command line */
150struct drm_cmdline_mode {
151 bool specified;
152 bool refresh_specified;
153 bool bpp_specified;
154 int xres, yres;
155 int bpp;
156 int refresh;
157 bool rb;
158 bool interlace;
159 bool cvt;
160 bool margins;
161 enum drm_connector_force force;
162};
163
164/**
165 * drm_mode_is_stereo - check for stereo mode flags
166 * @mode: drm_display_mode to check
167 *
168 * Returns:
169 * True if the mode is one of the stereo modes (like side-by-side), false if
170 * not.
171 */
172static inline bool drm_mode_is_stereo(const struct drm_display_mode *mode)
173{
174 return mode->flags & DRM_MODE_FLAG_3D_MASK;
175}
176
177struct drm_connector;
178struct drm_cmdline_mode;
179
180struct drm_display_mode *drm_mode_create(struct drm_device *dev);
181void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode);
182void drm_mode_probed_add(struct drm_connector *connector, struct drm_display_mode *mode);
183void drm_mode_debug_printmodeline(const struct drm_display_mode *mode);
184
185struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
186 int hdisplay, int vdisplay, int vrefresh,
187 bool reduced, bool interlaced,
188 bool margins);
189struct drm_display_mode *drm_gtf_mode(struct drm_device *dev,
190 int hdisplay, int vdisplay, int vrefresh,
191 bool interlaced, int margins);
192struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
193 int hdisplay, int vdisplay,
194 int vrefresh, bool interlaced,
195 int margins,
196 int GTF_M, int GTF_2C,
197 int GTF_K, int GTF_2J);
198void drm_display_mode_from_videomode(const struct videomode *vm,
199 struct drm_display_mode *dmode);
200int of_get_drm_display_mode(struct device_node *np,
201 struct drm_display_mode *dmode,
202 int index);
203
204void drm_mode_set_name(struct drm_display_mode *mode);
205int drm_mode_hsync(const struct drm_display_mode *mode);
206int drm_mode_vrefresh(const struct drm_display_mode *mode);
207
208void drm_mode_set_crtcinfo(struct drm_display_mode *p,
209 int adjust_flags);
210void drm_mode_copy(struct drm_display_mode *dst,
211 const struct drm_display_mode *src);
212struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev,
213 const struct drm_display_mode *mode);
214bool drm_mode_equal(const struct drm_display_mode *mode1,
215 const struct drm_display_mode *mode2);
216bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1,
217 const struct drm_display_mode *mode2);
218
219/* for use by the crtc helper probe functions */
220void drm_mode_validate_size(struct drm_device *dev,
221 struct list_head *mode_list,
222 int maxX, int maxY);
223void drm_mode_prune_invalid(struct drm_device *dev,
224 struct list_head *mode_list, bool verbose);
225void drm_mode_sort(struct list_head *mode_list);
226void drm_mode_connector_list_update(struct drm_connector *connector);
227
228/* parsing cmdline modes */
229bool
230drm_mode_parse_command_line_for_connector(const char *mode_option,
231 struct drm_connector *connector,
232 struct drm_cmdline_mode *mode);
233struct drm_display_mode *
234drm_mode_create_from_cmdline_mode(struct drm_device *dev,
235 struct drm_cmdline_mode *cmd);
236
237#endif /* __DRM_MODES_H__ */
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h
new file mode 100644
index 000000000000..09824becee3e
--- /dev/null
+++ b/include/drm/drm_plane_helper.h
@@ -0,0 +1,49 @@
1/*
2 * Copyright (C) 2011-2013 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24#ifndef DRM_PLANE_HELPER_H
25#define DRM_PLANE_HELPER_H
26
27/**
28 * DOC: plane helpers
29 *
30 * Helper functions to assist with creation and handling of CRTC primary
31 * planes.
32 */
33
34extern int drm_primary_helper_update(struct drm_plane *plane,
35 struct drm_crtc *crtc,
36 struct drm_framebuffer *fb,
37 int crtc_x, int crtc_y,
38 unsigned int crtc_w, unsigned int crtc_h,
39 uint32_t src_x, uint32_t src_y,
40 uint32_t src_w, uint32_t src_h);
41extern int drm_primary_helper_disable(struct drm_plane *plane);
42extern void drm_primary_helper_destroy(struct drm_plane *plane);
43extern const struct drm_plane_funcs drm_primary_helper_funcs;
44extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
45 uint32_t *formats,
46 int num_formats);
47
48
49#endif
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
index c18a593d1744..8cd402c73a5f 100644
--- a/include/drm/drm_vma_manager.h
+++ b/include/drm/drm_vma_manager.h
@@ -221,8 +221,8 @@ static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node)
221 * @file_mapping: Address space to unmap @node from 221 * @file_mapping: Address space to unmap @node from
222 * 222 *
223 * Unmap all userspace mappings for a given offset node. The mappings must be 223 * Unmap all userspace mappings for a given offset node. The mappings must be
224 * associated with the @file_mapping address-space. If no offset exists or 224 * associated with the @file_mapping address-space. If no offset exists
225 * the address-space is invalid, nothing is done. 225 * nothing is done.
226 * 226 *
227 * This call is unlocked. The caller must guarantee that drm_vma_offset_remove() 227 * This call is unlocked. The caller must guarantee that drm_vma_offset_remove()
228 * is not called on this node concurrently. 228 * is not called on this node concurrently.
@@ -230,7 +230,7 @@ static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node)
230static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, 230static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node,
231 struct address_space *file_mapping) 231 struct address_space *file_mapping)
232{ 232{
233 if (file_mapping && drm_vma_node_has_offset(node)) 233 if (drm_vma_node_has_offset(node))
234 unmap_mapping_range(file_mapping, 234 unmap_mapping_range(file_mapping,
235 drm_vma_node_offset_addr(node), 235 drm_vma_node_offset_addr(node),
236 drm_vma_node_size(node) << PAGE_SHIFT, 1); 236 drm_vma_node_size(node) << PAGE_SHIFT, 1);
diff --git a/include/drm/gma_drm.h b/include/drm/gma_drm.h
index 884613ee00ad..87ac5e6ca551 100644
--- a/include/drm/gma_drm.h
+++ b/include/drm/gma_drm.h
@@ -19,73 +19,7 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#ifndef _PSB_DRM_H_ 22#ifndef _GMA_DRM_H_
23#define _PSB_DRM_H_ 23#define _GMA_DRM_H_
24
25/*
26 * Manage the LUT for an output
27 */
28struct drm_psb_dpst_lut_arg {
29 uint8_t lut[256];
30 int output_id;
31};
32
33/*
34 * Validate modes
35 */
36struct drm_psb_mode_operation_arg {
37 u32 obj_id;
38 u16 operation;
39 struct drm_mode_modeinfo mode;
40 u64 data;
41};
42
43/*
44 * Query the stolen memory for smarter management of
45 * memory by the server
46 */
47struct drm_psb_stolen_memory_arg {
48 u32 base;
49 u32 size;
50};
51
52struct drm_psb_get_pipe_from_crtc_id_arg {
53 /** ID of CRTC being requested **/
54 u32 crtc_id;
55 /** pipe of requested CRTC **/
56 u32 pipe;
57};
58
59struct drm_psb_gem_create {
60 __u64 size;
61 __u32 handle;
62 __u32 flags;
63#define GMA_GEM_CREATE_STOLEN 1 /* Stolen memory can be used */
64};
65
66struct drm_psb_gem_mmap {
67 __u32 handle;
68 __u32 pad;
69 /**
70 * Fake offset to use for subsequent mmap call
71 *
72 * This is a fixed-size type for 32/64 compatibility.
73 */
74 __u64 offset;
75};
76
77/* Controlling the kernel modesetting buffers */
78
79#define DRM_GMA_GEM_CREATE 0x00 /* Create a GEM object */
80#define DRM_GMA_GEM_MMAP 0x01 /* Map GEM memory */
81#define DRM_GMA_STOLEN_MEMORY 0x02 /* Report stolen memory */
82#define DRM_GMA_2D_OP 0x03 /* Will be merged later */
83#define DRM_GMA_GAMMA 0x04 /* Set gamma table */
84#define DRM_GMA_ADB 0x05 /* Get backlight */
85#define DRM_GMA_DPST_BL 0x06 /* Set backlight */
86#define DRM_GMA_MODE_OPERATION 0x07 /* Mode validation/DC set */
87#define PSB_MODE_OPERATION_MODE_VALID 0x01
88#define DRM_GMA_GET_PIPE_FROM_CRTC_ID 0x08 /* CRTC to physical pipe# */
89
90 24
91#endif 25#endif
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index 97d5497debc1..595f85c392ac 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -56,6 +56,12 @@ extern bool i915_gpu_turbo_disable(void);
56 56
57#define I830_GMCH_CTRL 0x52 57#define I830_GMCH_CTRL 0x52
58 58
59#define I830_GMCH_GMS_MASK 0x70
60#define I830_GMCH_GMS_LOCAL 0x10
61#define I830_GMCH_GMS_STOLEN_512 0x20
62#define I830_GMCH_GMS_STOLEN_1024 0x30
63#define I830_GMCH_GMS_STOLEN_8192 0x40
64
59#define I855_GMCH_GMS_MASK 0xF0 65#define I855_GMCH_GMS_MASK 0xF0
60#define I855_GMCH_GMS_STOLEN_0M 0x0 66#define I855_GMCH_GMS_STOLEN_0M 0x0
61#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4) 67#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
@@ -72,4 +78,18 @@ extern bool i915_gpu_turbo_disable(void);
72#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4) 78#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)
73#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) 79#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)
74 80
81#define I830_DRB3 0x63
82#define I85X_DRB3 0x43
83#define I865_TOUD 0xc4
84
85#define I830_ESMRAMC 0x91
86#define I845_ESMRAMC 0x9e
87#define I85X_ESMRAMC 0x61
88#define TSEG_ENABLE (1 << 0)
89#define I830_TSEG_SIZE_512K (0 << 1)
90#define I830_TSEG_SIZE_1M (1 << 1)
91#define I845_TSEG_SIZE_MASK (3 << 1)
92#define I845_TSEG_SIZE_512K (2 << 1)
93#define I845_TSEG_SIZE_1M (3 << 1)
94
75#endif /* _I915_DRM_H_ */ 95#endif /* _I915_DRM_H_ */
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 32d34ebf0706..a5183da3ef92 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -747,6 +747,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
747 * @bdev: A pointer to a struct ttm_bo_device to initialize. 747 * @bdev: A pointer to a struct ttm_bo_device to initialize.
748 * @glob: A pointer to an initialized struct ttm_bo_global. 748 * @glob: A pointer to an initialized struct ttm_bo_global.
749 * @driver: A pointer to a struct ttm_bo_driver set up by the caller. 749 * @driver: A pointer to a struct ttm_bo_driver set up by the caller.
750 * @mapping: The address space to use for this bo.
750 * @file_page_offset: Offset into the device address space that is available 751 * @file_page_offset: Offset into the device address space that is available
751 * for buffer data. This ensures compatibility with other users of the 752 * for buffer data. This ensures compatibility with other users of the
752 * address space. 753 * address space.
@@ -758,6 +759,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
758extern int ttm_bo_device_init(struct ttm_bo_device *bdev, 759extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
759 struct ttm_bo_global *glob, 760 struct ttm_bo_global *glob,
760 struct ttm_bo_driver *driver, 761 struct ttm_bo_driver *driver,
762 struct address_space *mapping,
761 uint64_t file_page_offset, bool need_dma32); 763 uint64_t file_page_offset, bool need_dma32);
762 764
763/** 765/**
@@ -786,7 +788,7 @@ extern void ttm_bo_del_sub_from_lru(struct ttm_buffer_object *bo);
786extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); 788extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
787 789
788/** 790/**
789 * ttm_bo_reserve_nolru: 791 * __ttm_bo_reserve:
790 * 792 *
791 * @bo: A pointer to a struct ttm_buffer_object. 793 * @bo: A pointer to a struct ttm_buffer_object.
792 * @interruptible: Sleep interruptible if waiting. 794 * @interruptible: Sleep interruptible if waiting.
@@ -807,10 +809,10 @@ extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo);
807 * -EALREADY: Bo already reserved using @ticket. This error code will only 809 * -EALREADY: Bo already reserved using @ticket. This error code will only
808 * be returned if @use_ticket is set to true. 810 * be returned if @use_ticket is set to true.
809 */ 811 */
810static inline int ttm_bo_reserve_nolru(struct ttm_buffer_object *bo, 812static inline int __ttm_bo_reserve(struct ttm_buffer_object *bo,
811 bool interruptible, 813 bool interruptible,
812 bool no_wait, bool use_ticket, 814 bool no_wait, bool use_ticket,
813 struct ww_acquire_ctx *ticket) 815 struct ww_acquire_ctx *ticket)
814{ 816{
815 int ret = 0; 817 int ret = 0;
816 818
@@ -886,8 +888,7 @@ static inline int ttm_bo_reserve(struct ttm_buffer_object *bo,
886 888
887 WARN_ON(!atomic_read(&bo->kref.refcount)); 889 WARN_ON(!atomic_read(&bo->kref.refcount));
888 890
889 ret = ttm_bo_reserve_nolru(bo, interruptible, no_wait, use_ticket, 891 ret = __ttm_bo_reserve(bo, interruptible, no_wait, use_ticket, ticket);
890 ticket);
891 if (likely(ret == 0)) 892 if (likely(ret == 0))
892 ttm_bo_del_sub_from_lru(bo); 893 ttm_bo_del_sub_from_lru(bo);
893 894
@@ -927,20 +928,14 @@ static inline int ttm_bo_reserve_slowpath(struct ttm_buffer_object *bo,
927} 928}
928 929
929/** 930/**
930 * ttm_bo_unreserve_ticket 931 * __ttm_bo_unreserve
931 * @bo: A pointer to a struct ttm_buffer_object. 932 * @bo: A pointer to a struct ttm_buffer_object.
932 * @ticket: ww_acquire_ctx used for reserving
933 * 933 *
934 * Unreserve a previous reservation of @bo made with @ticket. 934 * Unreserve a previous reservation of @bo where the buffer object is
935 * already on lru lists.
935 */ 936 */
936static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo, 937static inline void __ttm_bo_unreserve(struct ttm_buffer_object *bo)
937 struct ww_acquire_ctx *t)
938{ 938{
939 if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
940 spin_lock(&bo->glob->lru_lock);
941 ttm_bo_add_to_lru(bo);
942 spin_unlock(&bo->glob->lru_lock);
943 }
944 ww_mutex_unlock(&bo->resv->lock); 939 ww_mutex_unlock(&bo->resv->lock);
945} 940}
946 941
@@ -953,7 +948,25 @@ static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
953 */ 948 */
954static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo) 949static inline void ttm_bo_unreserve(struct ttm_buffer_object *bo)
955{ 950{
956 ttm_bo_unreserve_ticket(bo, NULL); 951 if (!(bo->mem.placement & TTM_PL_FLAG_NO_EVICT)) {
952 spin_lock(&bo->glob->lru_lock);
953 ttm_bo_add_to_lru(bo);
954 spin_unlock(&bo->glob->lru_lock);
955 }
956 __ttm_bo_unreserve(bo);
957}
958
959/**
960 * ttm_bo_unreserve_ticket
961 * @bo: A pointer to a struct ttm_buffer_object.
962 * @ticket: ww_acquire_ctx used for reserving
963 *
964 * Unreserve a previous reservation of @bo made with @ticket.
965 */
966static inline void ttm_bo_unreserve_ticket(struct ttm_buffer_object *bo,
967 struct ww_acquire_ctx *t)
968{
969 ttm_bo_unreserve(bo);
957} 970}
958 971
959/* 972/*
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h
index 0097cc03034e..ed953f98f0e1 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/include/drm/ttm/ttm_object.h
@@ -244,6 +244,10 @@ extern void ttm_base_object_unref(struct ttm_base_object **p_base);
244extern int ttm_ref_object_add(struct ttm_object_file *tfile, 244extern int ttm_ref_object_add(struct ttm_object_file *tfile,
245 struct ttm_base_object *base, 245 struct ttm_base_object *base,
246 enum ttm_ref_type ref_type, bool *existed); 246 enum ttm_ref_type ref_type, bool *existed);
247
248extern bool ttm_ref_object_exists(struct ttm_object_file *tfile,
249 struct ttm_base_object *base);
250
247/** 251/**
248 * ttm_ref_object_base_unref 252 * ttm_ref_object_base_unref
249 * 253 *
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
index c84ff153a564..8ed44f9bbdfb 100644
--- a/include/drm/ttm/ttm_placement.h
+++ b/include/drm/ttm/ttm_placement.h
@@ -65,6 +65,8 @@
65 * reference the buffer. 65 * reference the buffer.
66 * TTM_PL_FLAG_NO_EVICT means that the buffer may never 66 * TTM_PL_FLAG_NO_EVICT means that the buffer may never
67 * be evicted to make room for other buffers. 67 * be evicted to make room for other buffers.
68 * TTM_PL_FLAG_TOPDOWN requests to be placed from the
69 * top of the memory area, instead of the bottom.
68 */ 70 */
69 71
70#define TTM_PL_FLAG_CACHED (1 << 16) 72#define TTM_PL_FLAG_CACHED (1 << 16)
@@ -72,6 +74,7 @@
72#define TTM_PL_FLAG_WC (1 << 18) 74#define TTM_PL_FLAG_WC (1 << 18)
73#define TTM_PL_FLAG_SHARED (1 << 20) 75#define TTM_PL_FLAG_SHARED (1 << 20)
74#define TTM_PL_FLAG_NO_EVICT (1 << 21) 76#define TTM_PL_FLAG_NO_EVICT (1 << 21)
77#define TTM_PL_FLAG_TOPDOWN (1 << 22)
75 78
76#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ 79#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \
77 TTM_PL_FLAG_UNCACHED | \ 80 TTM_PL_FLAG_UNCACHED | \
diff --git a/include/dt-bindings/clock/bcm281xx.h b/include/dt-bindings/clock/bcm281xx.h
new file mode 100644
index 000000000000..e0096940886d
--- /dev/null
+++ b/include/dt-bindings/clock/bcm281xx.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2013 Broadcom Corporation
3 * Copyright 2013 Linaro Limited
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 as
7 * published by the Free Software Foundation version 2.
8 *
9 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
10 * kind, whether express or implied; without even the implied warranty
11 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef _CLOCK_BCM281XX_H
16#define _CLOCK_BCM281XX_H
17
18/*
19 * This file defines the values used to specify clocks provided by
20 * the clock control units (CCUs) on Broadcom BCM281XX family SoCs.
21 */
22
23/* root CCU clock ids */
24
25#define BCM281XX_ROOT_CCU_FRAC_1M 0
26#define BCM281XX_ROOT_CCU_CLOCK_COUNT 1
27
28/* aon CCU clock ids */
29
30#define BCM281XX_AON_CCU_HUB_TIMER 0
31#define BCM281XX_AON_CCU_PMU_BSC 1
32#define BCM281XX_AON_CCU_PMU_BSC_VAR 2
33#define BCM281XX_AON_CCU_CLOCK_COUNT 3
34
35/* hub CCU clock ids */
36
37#define BCM281XX_HUB_CCU_TMON_1M 0
38#define BCM281XX_HUB_CCU_CLOCK_COUNT 1
39
40/* master CCU clock ids */
41
42#define BCM281XX_MASTER_CCU_SDIO1 0
43#define BCM281XX_MASTER_CCU_SDIO2 1
44#define BCM281XX_MASTER_CCU_SDIO3 2
45#define BCM281XX_MASTER_CCU_SDIO4 3
46#define BCM281XX_MASTER_CCU_USB_IC 4
47#define BCM281XX_MASTER_CCU_HSIC2_48M 5
48#define BCM281XX_MASTER_CCU_HSIC2_12M 6
49#define BCM281XX_MASTER_CCU_CLOCK_COUNT 7
50
51/* slave CCU clock ids */
52
53#define BCM281XX_SLAVE_CCU_UARTB 0
54#define BCM281XX_SLAVE_CCU_UARTB2 1
55#define BCM281XX_SLAVE_CCU_UARTB3 2
56#define BCM281XX_SLAVE_CCU_UARTB4 3
57#define BCM281XX_SLAVE_CCU_SSP0 4
58#define BCM281XX_SLAVE_CCU_SSP2 5
59#define BCM281XX_SLAVE_CCU_BSC1 6
60#define BCM281XX_SLAVE_CCU_BSC2 7
61#define BCM281XX_SLAVE_CCU_BSC3 8
62#define BCM281XX_SLAVE_CCU_PWM 9
63#define BCM281XX_SLAVE_CCU_CLOCK_COUNT 10
64
65#endif /* _CLOCK_BCM281XX_H */
diff --git a/include/dt-bindings/clk/exynos-audss-clk.h b/include/dt-bindings/clock/exynos-audss-clk.h
index 0ae6f5a75d2a..0ae6f5a75d2a 100644
--- a/include/dt-bindings/clk/exynos-audss-clk.h
+++ b/include/dt-bindings/clock/exynos-audss-clk.h
diff --git a/include/dt-bindings/clock/hi3620-clock.h b/include/dt-bindings/clock/hi3620-clock.h
index 6eaa6a45e110..21b9d0e2eb0c 100644
--- a/include/dt-bindings/clock/hi3620-clock.h
+++ b/include/dt-bindings/clock/hi3620-clock.h
@@ -147,6 +147,11 @@
147#define HI3620_MMC_CLK3 217 147#define HI3620_MMC_CLK3 217
148#define HI3620_MCU_CLK 218 148#define HI3620_MCU_CLK 218
149 149
150#define HI3620_SD_CIUCLK 0
151#define HI3620_MMC_CIUCLK1 1
152#define HI3620_MMC_CIUCLK2 2
153#define HI3620_MMC_CIUCLK3 3
154
150#define HI3620_NR_CLKS 219 155#define HI3620_NR_CLKS 219
151 156
152#endif /* __DTS_HI3620_CLOCK_H */ 157#endif /* __DTS_HI3620_CLOCK_H */
diff --git a/include/dt-bindings/clock/hip04-clock.h b/include/dt-bindings/clock/hip04-clock.h
new file mode 100644
index 000000000000..695e61cd1523
--- /dev/null
+++ b/include/dt-bindings/clock/hip04-clock.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2013-2014 Hisilicon Limited.
3 * Copyright (c) 2013-2014 Linaro Limited.
4 *
5 * Author: Haojian Zhuang <haojian.zhuang@linaro.org>
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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef __DTS_HIP04_CLOCK_H
24#define __DTS_HIP04_CLOCK_H
25
26#define HIP04_NONE_CLOCK 0
27
28/* fixed rate & fixed factor clocks */
29#define HIP04_OSC50M 1
30#define HIP04_CLK_50M 2
31#define HIP04_CLK_168M 3
32
33#define HIP04_NR_CLKS 64
34
35#endif /* __DTS_HIP04_CLOCK_H */
diff --git a/include/dt-bindings/clock/r8a7790-clock.h b/include/dt-bindings/clock/r8a7790-clock.h
index 859e9be511d9..6548a5fbcf4a 100644
--- a/include/dt-bindings/clock/r8a7790-clock.h
+++ b/include/dt-bindings/clock/r8a7790-clock.h
@@ -46,8 +46,8 @@
46#define R8A7790_CLK_MSIOF1 8 46#define R8A7790_CLK_MSIOF1 8
47#define R8A7790_CLK_MSIOF3 15 47#define R8A7790_CLK_MSIOF3 15
48#define R8A7790_CLK_SCIFB2 16 48#define R8A7790_CLK_SCIFB2 16
49#define R8A7790_CLK_SYS_DMAC0 18 49#define R8A7790_CLK_SYS_DMAC1 18
50#define R8A7790_CLK_SYS_DMAC1 19 50#define R8A7790_CLK_SYS_DMAC0 19
51 51
52/* MSTP3 */ 52/* MSTP3 */
53#define R8A7790_CLK_TPU0 4 53#define R8A7790_CLK_TPU0 4
diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h
index eb6c366adfba..9c2e4f82381e 100644
--- a/include/dt-bindings/pinctrl/am43xx.h
+++ b/include/dt-bindings/pinctrl/am43xx.h
@@ -13,6 +13,7 @@
13#define MUX_MODE5 5 13#define MUX_MODE5 5
14#define MUX_MODE6 6 14#define MUX_MODE6 6
15#define MUX_MODE7 7 15#define MUX_MODE7 7
16#define MUX_MODE8 8
16 17
17#define PULL_DISABLE (1 << 16) 18#define PULL_DISABLE (1 << 16)
18#define PULL_UP (1 << 17) 19#define PULL_UP (1 << 17)
diff --git a/include/dt-bindings/reset-controller/stih415-resets.h b/include/dt-bindings/reset-controller/stih415-resets.h
new file mode 100644
index 000000000000..c2f8a66913c5
--- /dev/null
+++ b/include/dt-bindings/reset-controller/stih415-resets.h
@@ -0,0 +1,26 @@
1/*
2 * This header provides constants for the reset controller
3 * based peripheral powerdown requests on the STMicroelectronics
4 * STiH415 SoC.
5 */
6#ifndef _DT_BINDINGS_RESET_CONTROLLER_STIH415
7#define _DT_BINDINGS_RESET_CONTROLLER_STIH415
8
9#define STIH415_EMISS_POWERDOWN 0
10#define STIH415_NAND_POWERDOWN 1
11#define STIH415_KEYSCAN_POWERDOWN 2
12#define STIH415_USB0_POWERDOWN 3
13#define STIH415_USB1_POWERDOWN 4
14#define STIH415_USB2_POWERDOWN 5
15#define STIH415_SATA0_POWERDOWN 6
16#define STIH415_SATA1_POWERDOWN 7
17#define STIH415_PCIE_POWERDOWN 8
18
19#define STIH415_ETH0_SOFTRESET 0
20#define STIH415_ETH1_SOFTRESET 1
21#define STIH415_IRB_SOFTRESET 2
22#define STIH415_USB0_SOFTRESET 3
23#define STIH415_USB1_SOFTRESET 4
24#define STIH415_USB2_SOFTRESET 5
25
26#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH415 */
diff --git a/include/dt-bindings/reset-controller/stih416-resets.h b/include/dt-bindings/reset-controller/stih416-resets.h
new file mode 100644
index 000000000000..2127743f23e3
--- /dev/null
+++ b/include/dt-bindings/reset-controller/stih416-resets.h
@@ -0,0 +1,50 @@
1/*
2 * This header provides constants for the reset controller
3 * based peripheral powerdown requests on the STMicroelectronics
4 * STiH416 SoC.
5 */
6#ifndef _DT_BINDINGS_RESET_CONTROLLER_STIH416
7#define _DT_BINDINGS_RESET_CONTROLLER_STIH416
8
9#define STIH416_EMISS_POWERDOWN 0
10#define STIH416_NAND_POWERDOWN 1
11#define STIH416_KEYSCAN_POWERDOWN 2
12#define STIH416_USB0_POWERDOWN 3
13#define STIH416_USB1_POWERDOWN 4
14#define STIH416_USB2_POWERDOWN 5
15#define STIH416_USB3_POWERDOWN 6
16#define STIH416_SATA0_POWERDOWN 7
17#define STIH416_SATA1_POWERDOWN 8
18#define STIH416_PCIE0_POWERDOWN 9
19#define STIH416_PCIE1_POWERDOWN 10
20
21#define STIH416_ETH0_SOFTRESET 0
22#define STIH416_ETH1_SOFTRESET 1
23#define STIH416_IRB_SOFTRESET 2
24#define STIH416_USB0_SOFTRESET 3
25#define STIH416_USB1_SOFTRESET 4
26#define STIH416_USB2_SOFTRESET 5
27#define STIH416_USB3_SOFTRESET 6
28#define STIH416_SATA0_SOFTRESET 7
29#define STIH416_SATA1_SOFTRESET 8
30#define STIH416_PCIE0_SOFTRESET 9
31#define STIH416_PCIE1_SOFTRESET 10
32#define STIH416_AUD_DAC_SOFTRESET 11
33#define STIH416_HDTVOUT_SOFTRESET 12
34#define STIH416_VTAC_M_RX_SOFTRESET 13
35#define STIH416_VTAC_A_RX_SOFTRESET 14
36#define STIH416_SYNC_HD_SOFTRESET 15
37#define STIH416_SYNC_SD_SOFTRESET 16
38#define STIH416_BLITTER_SOFTRESET 17
39#define STIH416_GPU_SOFTRESET 18
40#define STIH416_VTAC_M_TX_SOFTRESET 19
41#define STIH416_VTAC_A_TX_SOFTRESET 20
42#define STIH416_VTG_AUX_SOFTRESET 21
43#define STIH416_JPEG_DEC_SOFTRESET 22
44#define STIH416_HVA_SOFTRESET 23
45#define STIH416_COMPO_M_SOFTRESET 24
46#define STIH416_COMPO_A_SOFTRESET 25
47#define STIH416_VP8_DEC_SOFTRESET 26
48#define STIH416_VTG_MAIN_SOFTRESET 27
49
50#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH416 */
diff --git a/include/dt-bindings/sound/tlv320aic31xx-micbias.h b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
new file mode 100644
index 000000000000..f5cb772ab9c8
--- /dev/null
+++ b/include/dt-bindings/sound/tlv320aic31xx-micbias.h
@@ -0,0 +1,8 @@
1#ifndef __DT_TLV320AIC31XX_MICBIAS_H
2#define __DT_TLV320AIC31XX_MICBIAS_H
3
4#define MICBIAS_2_0V 1
5#define MICBIAS_2_5V 2
6#define MICBIAS_AVDDV 3
7
8#endif /* __DT_TLV320AIC31XX_MICBIAS_H */
diff --git a/include/linux/mfd/pm8xxx/pm8921.h b/include/dt-bindings/spmi/spmi.h
index 00fa3de7659d..d11e1e543871 100644
--- a/include/linux/mfd/pm8xxx/pm8921.h
+++ b/include/dt-bindings/spmi/spmi.h
@@ -1,5 +1,4 @@
1/* 1/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
2 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
3 * 2 *
4 * This program is free software; you can redistribute it and/or modify 3 * 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 and 4 * it under the terms of the GNU General Public License version 2 and
@@ -10,21 +9,10 @@
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details. 10 * GNU General Public License for more details.
12 */ 11 */
13/* 12#ifndef __DT_BINDINGS_SPMI_H
14 * Qualcomm PMIC 8921 driver header file 13#define __DT_BINDINGS_SPMI_H
15 *
16 */
17
18#ifndef __MFD_PM8921_H
19#define __MFD_PM8921_H
20
21#include <linux/mfd/pm8xxx/irq.h>
22
23#define PM8921_NR_IRQS 256
24 14
25struct pm8921_platform_data { 15#define SPMI_USID 0
26 int irq_base; 16#define SPMI_GSID 1
27 struct pm8xxx_irq_platform_data *irq_pdata;
28};
29 17
30#endif 18#endif
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 1151a1dcfe41..7a8f2cd66c8b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -108,6 +108,10 @@ static inline void acpi_initrd_override(void *data, size_t size)
108} 108}
109#endif 109#endif
110 110
111#define BAD_MADT_ENTRY(entry, end) ( \
112 (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
113 ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
114
111char * __acpi_map_table (unsigned long phys_addr, unsigned long size); 115char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
112void __acpi_unmap_table(char *map, unsigned long size); 116void __acpi_unmap_table(char *map, unsigned long size);
113int early_acpi_boot_init(void); 117int early_acpi_boot_init(void);
@@ -259,14 +263,9 @@ extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
259extern void acpi_osi_setup(char *str); 263extern void acpi_osi_setup(char *str);
260 264
261#ifdef CONFIG_ACPI_NUMA 265#ifdef CONFIG_ACPI_NUMA
262int acpi_get_pxm(acpi_handle handle); 266int acpi_get_node(acpi_handle handle);
263int acpi_get_node(acpi_handle *handle);
264#else 267#else
265static inline int acpi_get_pxm(acpi_handle handle) 268static inline int acpi_get_node(acpi_handle handle)
266{
267 return 0;
268}
269static inline int acpi_get_node(acpi_handle *handle)
270{ 269{
271 return 0; 270 return 0;
272} 271}
diff --git a/include/linux/acpi_dma.h b/include/linux/acpi_dma.h
index fb0298082916..329436d38e66 100644
--- a/include/linux/acpi_dma.h
+++ b/include/linux/acpi_dma.h
@@ -16,6 +16,7 @@
16 16
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/err.h>
19#include <linux/dmaengine.h> 20#include <linux/dmaengine.h>
20 21
21/** 22/**
@@ -103,12 +104,12 @@ static inline void devm_acpi_dma_controller_free(struct device *dev)
103static inline struct dma_chan *acpi_dma_request_slave_chan_by_index( 104static inline struct dma_chan *acpi_dma_request_slave_chan_by_index(
104 struct device *dev, size_t index) 105 struct device *dev, size_t index)
105{ 106{
106 return NULL; 107 return ERR_PTR(-ENODEV);
107} 108}
108static inline struct dma_chan *acpi_dma_request_slave_chan_by_name( 109static inline struct dma_chan *acpi_dma_request_slave_chan_by_name(
109 struct device *dev, const char *name) 110 struct device *dev, const char *name)
110{ 111{
111 return NULL; 112 return ERR_PTR(-ENODEV);
112} 113}
113 114
114#define acpi_dma_simple_xlate NULL 115#define acpi_dma_simple_xlate NULL
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h
index 66a0e5384edd..571a12ebb018 100644
--- a/include/linux/atmel-ssc.h
+++ b/include/linux/atmel-ssc.h
@@ -18,6 +18,7 @@ struct ssc_device {
18 struct clk *clk; 18 struct clk *clk;
19 int user; 19 int user;
20 int irq; 20 int irq;
21 bool clk_from_rk_pin;
21}; 22};
22 23
23struct ssc_device * __must_check ssc_request(unsigned int ssc_num); 24struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
diff --git a/include/linux/audit.h b/include/linux/audit.h
index ec1464df4c60..22cfddb75566 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -79,6 +79,14 @@ extern int is_audit_feature_set(int which);
79extern int __init audit_register_class(int class, unsigned *list); 79extern int __init audit_register_class(int class, unsigned *list);
80extern int audit_classify_syscall(int abi, unsigned syscall); 80extern int audit_classify_syscall(int abi, unsigned syscall);
81extern int audit_classify_arch(int arch); 81extern int audit_classify_arch(int arch);
82/* only for compat system calls */
83extern unsigned compat_write_class[];
84extern unsigned compat_read_class[];
85extern unsigned compat_dir_class[];
86extern unsigned compat_chattr_class[];
87extern unsigned compat_signal_class[];
88
89extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall);
82 90
83/* audit_names->type values */ 91/* audit_names->type values */
84#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */ 92#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
@@ -94,6 +102,12 @@ struct filename;
94 102
95extern void audit_log_session_info(struct audit_buffer *ab); 103extern void audit_log_session_info(struct audit_buffer *ab);
96 104
105#ifdef CONFIG_AUDIT_COMPAT_GENERIC
106#define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
107#else
108#define audit_is_compat(arch) false
109#endif
110
97#ifdef CONFIG_AUDITSYSCALL 111#ifdef CONFIG_AUDITSYSCALL
98/* These are defined in auditsc.c */ 112/* These are defined in auditsc.c */
99 /* Public API */ 113 /* Public API */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 24819001f5c8..e488e9459a93 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -95,7 +95,7 @@ struct backing_dev_info {
95 unsigned int max_ratio, max_prop_frac; 95 unsigned int max_ratio, max_prop_frac;
96 96
97 struct bdi_writeback wb; /* default writeback info for this bdi */ 97 struct bdi_writeback wb; /* default writeback info for this bdi */
98 spinlock_t wb_lock; /* protects work_list */ 98 spinlock_t wb_lock; /* protects work_list & wb.dwork scheduling */
99 99
100 struct list_head work_list; 100 struct list_head work_list;
101 101
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f9cd963213d..72647429adf6 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -9,6 +9,7 @@
9#define _LINUX_BACKLIGHT_H 9#define _LINUX_BACKLIGHT_H
10 10
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/fb.h>
12#include <linux/mutex.h> 13#include <linux/mutex.h>
13#include <linux/notifier.h> 14#include <linux/notifier.h>
14 15
@@ -104,6 +105,11 @@ struct backlight_device {
104 struct list_head entry; 105 struct list_head entry;
105 106
106 struct device dev; 107 struct device dev;
108
109 /* Multiple framebuffers may share one backlight device */
110 bool fb_bl_on[FB_MAX];
111
112 int use_count;
107}; 113};
108 114
109static inline void backlight_update_status(struct backlight_device *bd) 115static inline void backlight_update_status(struct backlight_device *bd)
diff --git a/include/linux/basic_mmio_gpio.h b/include/linux/basic_mmio_gpio.h
index d8a97ec0e2b8..0e97856b2cff 100644
--- a/include/linux/basic_mmio_gpio.h
+++ b/include/linux/basic_mmio_gpio.h
@@ -19,6 +19,7 @@
19#include <linux/spinlock_types.h> 19#include <linux/spinlock_types.h>
20 20
21struct bgpio_pdata { 21struct bgpio_pdata {
22 const char *label;
22 int base; 23 int base;
23 int ngpio; 24 int ngpio;
24}; 25};
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index b4a745d7d9a9..61f29e5ea840 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -44,7 +44,6 @@ struct linux_binprm {
44 unsigned interp_flags; 44 unsigned interp_flags;
45 unsigned interp_data; 45 unsigned interp_data;
46 unsigned long loader, exec; 46 unsigned long loader, exec;
47 char tcomm[TASK_COMM_LEN];
48}; 47};
49 48
50#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 49#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5a4d39b4686b..bba550826921 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -216,9 +216,9 @@ static inline void bvec_iter_advance(struct bio_vec *bv, struct bvec_iter *iter,
216} 216}
217 217
218#define for_each_bvec(bvl, bio_vec, iter, start) \ 218#define for_each_bvec(bvl, bio_vec, iter, start) \
219 for ((iter) = start; \ 219 for (iter = (start); \
220 (bvl) = bvec_iter_bvec((bio_vec), (iter)), \ 220 (iter).bi_size && \
221 (iter).bi_size; \ 221 ((bvl = bvec_iter_bvec((bio_vec), (iter))), 1); \
222 bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len)) 222 bvec_iter_advance((bio_vec), &(iter), (bvl).bv_len))
223 223
224 224
@@ -388,7 +388,7 @@ struct sg_iovec;
388struct rq_map_data; 388struct rq_map_data;
389extern struct bio *bio_map_user_iov(struct request_queue *, 389extern struct bio *bio_map_user_iov(struct request_queue *,
390 struct block_device *, 390 struct block_device *,
391 struct sg_iovec *, int, int, gfp_t); 391 const struct sg_iovec *, int, int, gfp_t);
392extern void bio_unmap_user(struct bio *); 392extern void bio_unmap_user(struct bio *);
393extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 393extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
394 gfp_t); 394 gfp_t);
@@ -414,7 +414,8 @@ extern int bio_alloc_pages(struct bio *bio, gfp_t gfp);
414extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *, 414extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
415 unsigned long, unsigned int, int, gfp_t); 415 unsigned long, unsigned int, int, gfp_t);
416extern struct bio *bio_copy_user_iov(struct request_queue *, 416extern struct bio *bio_copy_user_iov(struct request_queue *,
417 struct rq_map_data *, struct sg_iovec *, 417 struct rq_map_data *,
418 const struct sg_iovec *,
418 int, int, gfp_t); 419 int, int, gfp_t);
419extern int bio_uncopy_user(struct bio *); 420extern int bio_uncopy_user(struct bio *);
420void zero_fill_bio(struct bio *bio); 421void zero_fill_bio(struct bio *bio);
diff --git a/include/linux/blk-iopoll.h b/include/linux/blk-iopoll.h
index 308734d3d4a2..77ae77c0b704 100644
--- a/include/linux/blk-iopoll.h
+++ b/include/linux/blk-iopoll.h
@@ -43,6 +43,4 @@ extern void __blk_iopoll_complete(struct blk_iopoll *);
43extern void blk_iopoll_enable(struct blk_iopoll *); 43extern void blk_iopoll_enable(struct blk_iopoll *);
44extern void blk_iopoll_disable(struct blk_iopoll *); 44extern void blk_iopoll_disable(struct blk_iopoll *);
45 45
46extern int blk_iopoll_enabled;
47
48#endif 46#endif
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 2ff2e8d982be..0120451545d8 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -109,7 +109,7 @@ enum {
109 BLK_MQ_F_SHOULD_SORT = 1 << 1, 109 BLK_MQ_F_SHOULD_SORT = 1 << 1,
110 BLK_MQ_F_SHOULD_IPI = 1 << 2, 110 BLK_MQ_F_SHOULD_IPI = 1 << 2,
111 111
112 BLK_MQ_S_STOPPED = 1 << 0, 112 BLK_MQ_S_STOPPED = 0,
113 113
114 BLK_MQ_MAX_DEPTH = 2048, 114 BLK_MQ_MAX_DEPTH = 2048,
115}; 115};
@@ -117,7 +117,8 @@ enum {
117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *); 117struct request_queue *blk_mq_init_queue(struct blk_mq_reg *, void *);
118int blk_mq_register_disk(struct gendisk *); 118int blk_mq_register_disk(struct gendisk *);
119void blk_mq_unregister_disk(struct gendisk *); 119void blk_mq_unregister_disk(struct gendisk *);
120void blk_mq_init_commands(struct request_queue *, void (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data); 120int blk_mq_init_commands(struct request_queue *, int (*init)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data);
121void blk_mq_free_commands(struct request_queue *, void (*free)(void *data, struct blk_mq_hw_ctx *, struct request *, unsigned int), void *data);
121 122
122void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule); 123void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
123 124
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index bbc3a6c88fce..aa0eaa2d0bd8 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -189,6 +189,7 @@ enum rq_flag_bits {
189 __REQ_KERNEL, /* direct IO to kernel pages */ 189 __REQ_KERNEL, /* direct IO to kernel pages */
190 __REQ_PM, /* runtime pm request */ 190 __REQ_PM, /* runtime pm request */
191 __REQ_END, /* last of chain of requests */ 191 __REQ_END, /* last of chain of requests */
192 __REQ_HASHED, /* on IO scheduler merge hash */
192 __REQ_NR_BITS, /* stops here */ 193 __REQ_NR_BITS, /* stops here */
193}; 194};
194 195
@@ -241,5 +242,6 @@ enum rq_flag_bits {
241#define REQ_KERNEL (1ULL << __REQ_KERNEL) 242#define REQ_KERNEL (1ULL << __REQ_KERNEL)
242#define REQ_PM (1ULL << __REQ_PM) 243#define REQ_PM (1ULL << __REQ_PM)
243#define REQ_END (1ULL << __REQ_END) 244#define REQ_END (1ULL << __REQ_END)
245#define REQ_HASHED (1ULL << __REQ_HASHED)
244 246
245#endif /* __LINUX_BLK_TYPES_H */ 247#endif /* __LINUX_BLK_TYPES_H */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4afa4f8f6090..0d84981ee03f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -99,6 +99,7 @@ struct request {
99 union { 99 union {
100 struct call_single_data csd; 100 struct call_single_data csd;
101 struct work_struct mq_flush_work; 101 struct work_struct mq_flush_work;
102 unsigned long fifo_time;
102 }; 103 };
103 104
104 struct request_queue *q; 105 struct request_queue *q;
@@ -117,7 +118,18 @@ struct request {
117 struct bio *bio; 118 struct bio *bio;
118 struct bio *biotail; 119 struct bio *biotail;
119 120
120 struct hlist_node hash; /* merge hash */ 121 /*
122 * The hash is used inside the scheduler, and killed once the
123 * request reaches the dispatch list. The ipi_list is only used
124 * to queue the request for softirq completion, which is long
125 * after the request has been unhashed (and even removed from
126 * the dispatch list).
127 */
128 union {
129 struct hlist_node hash; /* merge hash */
130 struct list_head ipi_list;
131 };
132
121 /* 133 /*
122 * The rb_node is only used inside the io scheduler, requests 134 * The rb_node is only used inside the io scheduler, requests
123 * are pruned when moved to the dispatch queue. So let the 135 * are pruned when moved to the dispatch queue. So let the
@@ -823,8 +835,8 @@ extern int blk_rq_map_user(struct request_queue *, struct request *,
823extern int blk_rq_unmap_user(struct bio *); 835extern int blk_rq_unmap_user(struct bio *);
824extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); 836extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t);
825extern int blk_rq_map_user_iov(struct request_queue *, struct request *, 837extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
826 struct rq_map_data *, struct sg_iovec *, int, 838 struct rq_map_data *, const struct sg_iovec *,
827 unsigned int, gfp_t); 839 int, unsigned int, gfp_t);
828extern int blk_execute_rq(struct request_queue *, struct gendisk *, 840extern int blk_execute_rq(struct request_queue *, struct gendisk *,
829 struct request *, int); 841 struct request *, int);
830extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 842extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 677b4f01b2d0..6f76277baf39 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -13,10 +13,17 @@
13#define PHY_ID_BCM5461 0x002060c0 13#define PHY_ID_BCM5461 0x002060c0
14#define PHY_ID_BCM57780 0x03625d90 14#define PHY_ID_BCM57780 0x03625d90
15 15
16#define PHY_ID_BCM7366 0x600d8490
17#define PHY_ID_BCM7439 0x600d8480
18#define PHY_ID_BCM7445 0x600d8510
19#define PHY_ID_BCM7XXX_28 0x600d8400
20
16#define PHY_BCM_OUI_MASK 0xfffffc00 21#define PHY_BCM_OUI_MASK 0xfffffc00
17#define PHY_BCM_OUI_1 0x00206000 22#define PHY_BCM_OUI_1 0x00206000
18#define PHY_BCM_OUI_2 0x0143bc00 23#define PHY_BCM_OUI_2 0x0143bc00
19#define PHY_BCM_OUI_3 0x03625c00 24#define PHY_BCM_OUI_3 0x03625c00
25#define PHY_BCM_OUI_4 0x600d0000
26#define PHY_BCM_OUI_5 0x03625e00
20 27
21 28
22#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001 29#define PHY_BCM_FLAGS_MODE_COPPER 0x00000001
@@ -31,6 +38,59 @@
31#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000 38#define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
32#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000 39#define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
33#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000 40#define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
41/* Broadcom BCM7xxx specific workarounds */
42#define PHY_BRCM_100MBPS_WAR 0x00010000
34#define PHY_BCM_FLAGS_VALID 0x80000000 43#define PHY_BCM_FLAGS_VALID 0x80000000
35 44
45/* Broadcom BCM54XX register definitions, common to most Broadcom PHYs */
46#define MII_BCM54XX_ECR 0x10 /* BCM54xx extended control register */
47#define MII_BCM54XX_ECR_IM 0x1000 /* Interrupt mask */
48#define MII_BCM54XX_ECR_IF 0x0800 /* Interrupt force */
49
50#define MII_BCM54XX_ESR 0x11 /* BCM54xx extended status register */
51#define MII_BCM54XX_ESR_IS 0x1000 /* Interrupt status */
52
53#define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */
54#define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */
55#define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */
56#define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */
57
58#define MII_BCM54XX_AUX_CTL 0x18 /* Auxiliary control register */
59#define MII_BCM54XX_ISR 0x1a /* BCM54xx interrupt status register */
60#define MII_BCM54XX_IMR 0x1b /* BCM54xx interrupt mask register */
61#define MII_BCM54XX_INT_CRCERR 0x0001 /* CRC error */
62#define MII_BCM54XX_INT_LINK 0x0002 /* Link status changed */
63#define MII_BCM54XX_INT_SPEED 0x0004 /* Link speed change */
64#define MII_BCM54XX_INT_DUPLEX 0x0008 /* Duplex mode changed */
65#define MII_BCM54XX_INT_LRS 0x0010 /* Local receiver status changed */
66#define MII_BCM54XX_INT_RRS 0x0020 /* Remote receiver status changed */
67#define MII_BCM54XX_INT_SSERR 0x0040 /* Scrambler synchronization error */
68#define MII_BCM54XX_INT_UHCD 0x0080 /* Unsupported HCD negotiated */
69#define MII_BCM54XX_INT_NHCD 0x0100 /* No HCD */
70#define MII_BCM54XX_INT_NHCDL 0x0200 /* No HCD link */
71#define MII_BCM54XX_INT_ANPR 0x0400 /* Auto-negotiation page received */
72#define MII_BCM54XX_INT_LC 0x0800 /* All counters below 128 */
73#define MII_BCM54XX_INT_HC 0x1000 /* Counter above 32768 */
74#define MII_BCM54XX_INT_MDIX 0x2000 /* MDIX status change */
75#define MII_BCM54XX_INT_PSERR 0x4000 /* Pair swap error */
76
77#define MII_BCM54XX_SHD 0x1c /* 0x1c shadow registers */
78#define MII_BCM54XX_SHD_WRITE 0x8000
79#define MII_BCM54XX_SHD_VAL(x) ((x & 0x1f) << 10)
80#define MII_BCM54XX_SHD_DATA(x) ((x & 0x3ff) << 0)
81
82/*
83 * AUXILIARY CONTROL SHADOW ACCESS REGISTERS. (PHY REG 0x18)
84 */
85#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
86#define MII_BCM54XX_AUXCTL_ACTL_TX_6DB 0x0400
87#define MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA 0x0800
88
89#define MII_BCM54XX_AUXCTL_MISC_WREN 0x8000
90#define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
91#define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000
92#define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007
93
94#define MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL 0x0000
95
36#endif /* _LINUX_BRCMPHY_H */ 96#endif /* _LINUX_BRCMPHY_H */
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d77797a52b7b..c40302f909ce 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -210,8 +210,8 @@ int block_write_full_page(struct page *page, get_block_t *get_block,
210int block_write_full_page_endio(struct page *page, get_block_t *get_block, 210int block_write_full_page_endio(struct page *page, get_block_t *get_block,
211 struct writeback_control *wbc, bh_end_io_t *handler); 211 struct writeback_control *wbc, bh_end_io_t *handler);
212int block_read_full_page(struct page*, get_block_t*); 212int block_read_full_page(struct page*, get_block_t*);
213int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, 213int block_is_partially_uptodate(struct page *page, unsigned long from,
214 unsigned long from); 214 unsigned long count);
215int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len, 215int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
216 unsigned flags, struct page **pagep, get_block_t *get_block); 216 unsigned flags, struct page **pagep, get_block_t *get_block);
217int __block_write_begin(struct page *page, loff_t pos, unsigned len, 217int __block_write_begin(struct page *page, loff_t pos, unsigned len,
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab651a041..3ce5e526525f 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -33,8 +33,9 @@ enum can_mode {
33struct can_priv { 33struct can_priv {
34 struct can_device_stats can_stats; 34 struct can_device_stats can_stats;
35 35
36 struct can_bittiming bittiming; 36 struct can_bittiming bittiming, data_bittiming;
37 const struct can_bittiming_const *bittiming_const; 37 const struct can_bittiming_const *bittiming_const,
38 *data_bittiming_const;
38 struct can_clock clock; 39 struct can_clock clock;
39 40
40 enum can_state state; 41 enum can_state state;
@@ -45,6 +46,7 @@ struct can_priv {
45 struct timer_list restart_timer; 46 struct timer_list restart_timer;
46 47
47 int (*do_set_bittiming)(struct net_device *dev); 48 int (*do_set_bittiming)(struct net_device *dev);
49 int (*do_set_data_bittiming)(struct net_device *dev);
48 int (*do_set_mode)(struct net_device *dev, enum can_mode mode); 50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
49 int (*do_get_state)(const struct net_device *dev, 51 int (*do_get_state)(const struct net_device *dev,
50 enum can_state *state); 52 enum can_state *state);
@@ -111,6 +113,7 @@ struct can_priv *safe_candev_priv(struct net_device *dev);
111 113
112int open_candev(struct net_device *dev); 114int open_candev(struct net_device *dev);
113void close_candev(struct net_device *dev); 115void close_candev(struct net_device *dev);
116int can_change_mtu(struct net_device *dev, int new_mtu);
114 117
115int register_candev(struct net_device *dev); 118int register_candev(struct net_device *dev);
116void unregister_candev(struct net_device *dev); 119void unregister_candev(struct net_device *dev);
@@ -124,6 +127,8 @@ unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
124void can_free_echo_skb(struct net_device *dev, unsigned int idx); 127void can_free_echo_skb(struct net_device *dev, unsigned int idx);
125 128
126struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 129struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);
130struct sk_buff *alloc_canfd_skb(struct net_device *dev,
131 struct canfd_frame **cfd);
127struct sk_buff *alloc_can_err_skb(struct net_device *dev, 132struct sk_buff *alloc_can_err_skb(struct net_device *dev,
128 struct can_frame **cf); 133 struct can_frame **cf);
129 134
diff --git a/include/linux/ccp.h b/include/linux/ccp.h
index b941ab9f762b..ebcc9d146219 100644
--- a/include/linux/ccp.h
+++ b/include/linux/ccp.h
@@ -232,6 +232,9 @@ enum ccp_sha_type {
232 * @ctx_len: length in bytes of hash value 232 * @ctx_len: length in bytes of hash value
233 * @src: data to be used for this operation 233 * @src: data to be used for this operation
234 * @src_len: length in bytes of data used for this operation 234 * @src_len: length in bytes of data used for this operation
235 * @opad: data to be used for final HMAC operation
236 * @opad_len: length in bytes of data used for final HMAC operation
237 * @first: indicates first SHA operation
235 * @final: indicates final SHA operation 238 * @final: indicates final SHA operation
236 * @msg_bits: total length of the message in bits used in final SHA operation 239 * @msg_bits: total length of the message in bits used in final SHA operation
237 * 240 *
@@ -251,6 +254,10 @@ struct ccp_sha_engine {
251 struct scatterlist *src; 254 struct scatterlist *src;
252 u64 src_len; /* In bytes */ 255 u64 src_len; /* In bytes */
253 256
257 struct scatterlist *opad;
258 u32 opad_len; /* In bytes */
259
260 u32 first; /* Indicates first sha cmd */
254 u32 final; /* Indicates final sha cmd */ 261 u32 final; /* Indicates final sha cmd */
255 u64 msg_bits; /* Message length in bits required for 262 u64 msg_bits; /* Message length in bits required for
256 * final sha cmd */ 263 * final sha cmd */
diff --git a/include/linux/ceph/ceph_features.h b/include/linux/ceph/ceph_features.h
index 138448f766b4..d12659ce550d 100644
--- a/include/linux/ceph/ceph_features.h
+++ b/include/linux/ceph/ceph_features.h
@@ -43,6 +43,13 @@
43#define CEPH_FEATURE_CRUSH_V2 (1ULL<<36) /* new indep; SET_* steps */ 43#define CEPH_FEATURE_CRUSH_V2 (1ULL<<36) /* new indep; SET_* steps */
44#define CEPH_FEATURE_EXPORT_PEER (1ULL<<37) 44#define CEPH_FEATURE_EXPORT_PEER (1ULL<<37)
45#define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38) 45#define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38)
46#define CEPH_FEATURE_OSD_TMAP2OMAP (1ULL<<38) /* overlap with EC */
47/* The process supports new-style OSDMap encoding. Monitors also use
48 this bit to determine if peers support NAK messages. */
49#define CEPH_FEATURE_OSDMAP_ENC (1ULL<<39)
50#define CEPH_FEATURE_MDS_INLINE_DATA (1ULL<<40)
51#define CEPH_FEATURE_CRUSH_TUNABLES3 (1ULL<<41)
52#define CEPH_FEATURE_OSD_PRIMARY_AFFINITY (1ULL<<41) /* overlap w/ tunables3 */
46 53
47/* 54/*
48 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature 55 * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature
@@ -82,7 +89,10 @@ static inline u64 ceph_sanitize_features(u64 features)
82 CEPH_FEATURE_OSDHASHPSPOOL | \ 89 CEPH_FEATURE_OSDHASHPSPOOL | \
83 CEPH_FEATURE_OSD_CACHEPOOL | \ 90 CEPH_FEATURE_OSD_CACHEPOOL | \
84 CEPH_FEATURE_CRUSH_V2 | \ 91 CEPH_FEATURE_CRUSH_V2 | \
85 CEPH_FEATURE_EXPORT_PEER) 92 CEPH_FEATURE_EXPORT_PEER | \
93 CEPH_FEATURE_OSDMAP_ENC | \
94 CEPH_FEATURE_CRUSH_TUNABLES3 | \
95 CEPH_FEATURE_OSD_PRIMARY_AFFINITY)
86 96
87#define CEPH_FEATURES_REQUIRED_DEFAULT \ 97#define CEPH_FEATURES_REQUIRED_DEFAULT \
88 (CEPH_FEATURE_NOSRCADDR | \ 98 (CEPH_FEATURE_NOSRCADDR | \
diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
index 25bfb0eff772..5f6db18d72e8 100644
--- a/include/linux/ceph/ceph_fs.h
+++ b/include/linux/ceph/ceph_fs.h
@@ -332,6 +332,7 @@ enum {
332 CEPH_MDS_OP_LOOKUPHASH = 0x00102, 332 CEPH_MDS_OP_LOOKUPHASH = 0x00102,
333 CEPH_MDS_OP_LOOKUPPARENT = 0x00103, 333 CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
334 CEPH_MDS_OP_LOOKUPINO = 0x00104, 334 CEPH_MDS_OP_LOOKUPINO = 0x00104,
335 CEPH_MDS_OP_LOOKUPNAME = 0x00105,
335 336
336 CEPH_MDS_OP_SETXATTR = 0x01105, 337 CEPH_MDS_OP_SETXATTR = 0x01105,
337 CEPH_MDS_OP_RMXATTR = 0x01106, 338 CEPH_MDS_OP_RMXATTR = 0x01106,
@@ -420,8 +421,8 @@ union ceph_mds_request_args {
420 struct { 421 struct {
421 __u8 rule; /* currently fcntl or flock */ 422 __u8 rule; /* currently fcntl or flock */
422 __u8 type; /* shared, exclusive, remove*/ 423 __u8 type; /* shared, exclusive, remove*/
424 __le64 owner; /* owner of the lock */
423 __le64 pid; /* process id requesting the lock */ 425 __le64 pid; /* process id requesting the lock */
424 __le64 pid_namespace;
425 __le64 start; /* initial location to lock */ 426 __le64 start; /* initial location to lock */
426 __le64 length; /* num bytes to lock from start */ 427 __le64 length; /* num bytes to lock from start */
427 __u8 wait; /* will caller wait for lock to become available? */ 428 __u8 wait; /* will caller wait for lock to become available? */
@@ -532,8 +533,8 @@ struct ceph_filelock {
532 __le64 start;/* file offset to start lock at */ 533 __le64 start;/* file offset to start lock at */
533 __le64 length; /* num bytes to lock; 0 for all following start */ 534 __le64 length; /* num bytes to lock; 0 for all following start */
534 __le64 client; /* which client holds the lock */ 535 __le64 client; /* which client holds the lock */
536 __le64 owner; /* owner the lock */
535 __le64 pid; /* process id holding the lock on the client */ 537 __le64 pid; /* process id holding the lock on the client */
536 __le64 pid_namespace;
537 __u8 type; /* shared lock, exclusive lock, or unlock */ 538 __u8 type; /* shared lock, exclusive lock, or unlock */
538} __attribute__ ((packed)); 539} __attribute__ ((packed));
539 540
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index fd47e872ebcc..94ec69672164 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -43,7 +43,7 @@ struct ceph_osd {
43}; 43};
44 44
45 45
46#define CEPH_OSD_MAX_OP 2 46#define CEPH_OSD_MAX_OP 3
47 47
48enum ceph_osd_data_type { 48enum ceph_osd_data_type {
49 CEPH_OSD_DATA_TYPE_NONE = 0, 49 CEPH_OSD_DATA_TYPE_NONE = 0,
@@ -76,6 +76,7 @@ struct ceph_osd_data {
76 76
77struct ceph_osd_req_op { 77struct ceph_osd_req_op {
78 u16 op; /* CEPH_OSD_OP_* */ 78 u16 op; /* CEPH_OSD_OP_* */
79 u32 flags; /* CEPH_OSD_OP_FLAG_* */
79 u32 payload_len; 80 u32 payload_len;
80 union { 81 union {
81 struct ceph_osd_data raw_data_in; 82 struct ceph_osd_data raw_data_in;
@@ -102,6 +103,10 @@ struct ceph_osd_req_op {
102 u32 timeout; 103 u32 timeout;
103 __u8 flag; 104 __u8 flag;
104 } watch; 105 } watch;
106 struct {
107 u64 expected_object_size;
108 u64 expected_write_size;
109 } alloc_hint;
105 }; 110 };
106}; 111};
107 112
@@ -293,6 +298,10 @@ extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
293extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req, 298extern void osd_req_op_watch_init(struct ceph_osd_request *osd_req,
294 unsigned int which, u16 opcode, 299 unsigned int which, u16 opcode,
295 u64 cookie, u64 version, int flag); 300 u64 cookie, u64 version, int flag);
301extern void osd_req_op_alloc_hint_init(struct ceph_osd_request *osd_req,
302 unsigned int which,
303 u64 expected_object_size,
304 u64 expected_write_size);
296 305
297extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, 306extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc,
298 struct ceph_snap_context *snapc, 307 struct ceph_snap_context *snapc,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 49ff69f0746b..561ea896c657 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -41,6 +41,18 @@ struct ceph_pg_pool_info {
41 char *name; 41 char *name;
42}; 42};
43 43
44static inline bool ceph_can_shift_osds(struct ceph_pg_pool_info *pool)
45{
46 switch (pool->type) {
47 case CEPH_POOL_TYPE_REP:
48 return true;
49 case CEPH_POOL_TYPE_EC:
50 return false;
51 default:
52 BUG_ON(1);
53 }
54}
55
44struct ceph_object_locator { 56struct ceph_object_locator {
45 s64 pool; 57 s64 pool;
46}; 58};
@@ -60,8 +72,16 @@ struct ceph_object_id {
60struct ceph_pg_mapping { 72struct ceph_pg_mapping {
61 struct rb_node node; 73 struct rb_node node;
62 struct ceph_pg pgid; 74 struct ceph_pg pgid;
63 int len; 75
64 int osds[]; 76 union {
77 struct {
78 int len;
79 int osds[];
80 } pg_temp;
81 struct {
82 int osd;
83 } primary_temp;
84 };
65}; 85};
66 86
67struct ceph_osdmap { 87struct ceph_osdmap {
@@ -78,12 +98,19 @@ struct ceph_osdmap {
78 struct ceph_entity_addr *osd_addr; 98 struct ceph_entity_addr *osd_addr;
79 99
80 struct rb_root pg_temp; 100 struct rb_root pg_temp;
101 struct rb_root primary_temp;
102
103 u32 *osd_primary_affinity;
104
81 struct rb_root pg_pools; 105 struct rb_root pg_pools;
82 u32 pool_max; 106 u32 pool_max;
83 107
84 /* the CRUSH map specifies the mapping of placement groups to 108 /* the CRUSH map specifies the mapping of placement groups to
85 * the list of osds that store+replicate them. */ 109 * the list of osds that store+replicate them. */
86 struct crush_map *crush; 110 struct crush_map *crush;
111
112 struct mutex crush_scratch_mutex;
113 int crush_scratch_ary[CEPH_PG_MAX_SIZE * 3];
87}; 114};
88 115
89static inline void ceph_oid_set_name(struct ceph_object_id *oid, 116static inline void ceph_oid_set_name(struct ceph_object_id *oid,
@@ -110,9 +137,21 @@ static inline void ceph_oid_copy(struct ceph_object_id *dest,
110 dest->name_len = src->name_len; 137 dest->name_len = src->name_len;
111} 138}
112 139
140static inline int ceph_osd_exists(struct ceph_osdmap *map, int osd)
141{
142 return osd >= 0 && osd < map->max_osd &&
143 (map->osd_state[osd] & CEPH_OSD_EXISTS);
144}
145
113static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd) 146static inline int ceph_osd_is_up(struct ceph_osdmap *map, int osd)
114{ 147{
115 return (osd < map->max_osd) && (map->osd_state[osd] & CEPH_OSD_UP); 148 return ceph_osd_exists(map, osd) &&
149 (map->osd_state[osd] & CEPH_OSD_UP);
150}
151
152static inline int ceph_osd_is_down(struct ceph_osdmap *map, int osd)
153{
154 return !ceph_osd_is_up(map, osd);
116} 155}
117 156
118static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag) 157static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
@@ -121,6 +160,7 @@ static inline bool ceph_osdmap_flag(struct ceph_osdmap *map, int flag)
121} 160}
122 161
123extern char *ceph_osdmap_state_str(char *str, int len, int state); 162extern char *ceph_osdmap_state_str(char *str, int len, int state);
163extern u32 ceph_get_primary_affinity(struct ceph_osdmap *map, int osd);
124 164
125static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map, 165static inline struct ceph_entity_addr *ceph_osd_addr(struct ceph_osdmap *map,
126 int osd) 166 int osd)
@@ -153,7 +193,7 @@ static inline int ceph_decode_pgid(void **p, void *end, struct ceph_pg *pgid)
153 return 0; 193 return 0;
154} 194}
155 195
156extern struct ceph_osdmap *osdmap_decode(void **p, void *end); 196extern struct ceph_osdmap *ceph_osdmap_decode(void **p, void *end);
157extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, 197extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
158 struct ceph_osdmap *map, 198 struct ceph_osdmap *map,
159 struct ceph_messenger *msgr); 199 struct ceph_messenger *msgr);
@@ -172,7 +212,7 @@ extern int ceph_oloc_oid_to_pg(struct ceph_osdmap *osdmap,
172 212
173extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, 213extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
174 struct ceph_pg pgid, 214 struct ceph_pg pgid,
175 int *acting); 215 int *osds, int *primary);
176extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, 216extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
177 struct ceph_pg pgid); 217 struct ceph_pg pgid);
178 218
diff --git a/include/linux/ceph/rados.h b/include/linux/ceph/rados.h
index 96292df4041b..f20e0d8a2155 100644
--- a/include/linux/ceph/rados.h
+++ b/include/linux/ceph/rados.h
@@ -81,8 +81,9 @@ struct ceph_pg_v1 {
81 */ 81 */
82#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */ 82#define CEPH_NOPOOL ((__u64) (-1)) /* pool id not defined */
83 83
84#define CEPH_PG_TYPE_REP 1 84#define CEPH_POOL_TYPE_REP 1
85#define CEPH_PG_TYPE_RAID4 2 85#define CEPH_POOL_TYPE_RAID4 2 /* never implemented */
86#define CEPH_POOL_TYPE_EC 3
86 87
87/* 88/*
88 * stable_mod func is used to control number of placement groups. 89 * stable_mod func is used to control number of placement groups.
@@ -133,6 +134,10 @@ extern const char *ceph_osd_state_name(int s);
133#define CEPH_OSD_IN 0x10000 134#define CEPH_OSD_IN 0x10000
134#define CEPH_OSD_OUT 0 135#define CEPH_OSD_OUT 0
135 136
137/* osd primary-affinity. fixed point value: 0x10000 == baseline */
138#define CEPH_OSD_MAX_PRIMARY_AFFINITY 0x10000
139#define CEPH_OSD_DEFAULT_PRIMARY_AFFINITY 0x10000
140
136 141
137/* 142/*
138 * osd map flag bits 143 * osd map flag bits
@@ -227,6 +232,9 @@ enum {
227 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24, 232 CEPH_OSD_OP_OMAPRMKEYS = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 24,
228 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25, 233 CEPH_OSD_OP_OMAP_CMP = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_DATA | 25,
229 234
235 /* hints */
236 CEPH_OSD_OP_SETALLOCHINT = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_DATA | 35,
237
230 /** multi **/ 238 /** multi **/
231 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1, 239 CEPH_OSD_OP_CLONERANGE = CEPH_OSD_OP_MODE_WR | CEPH_OSD_OP_TYPE_MULTI | 1,
232 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2, 240 CEPH_OSD_OP_ASSERT_SRC_VERSION = CEPH_OSD_OP_MODE_RD | CEPH_OSD_OP_TYPE_MULTI | 2,
@@ -382,7 +390,7 @@ enum {
382 */ 390 */
383struct ceph_osd_op { 391struct ceph_osd_op {
384 __le16 op; /* CEPH_OSD_OP_* */ 392 __le16 op; /* CEPH_OSD_OP_* */
385 __le32 flags; /* CEPH_OSD_FLAG_* */ 393 __le32 flags; /* CEPH_OSD_OP_FLAG_* */
386 union { 394 union {
387 struct { 395 struct {
388 __le64 offset, length; 396 __le64 offset, length;
@@ -416,6 +424,10 @@ struct ceph_osd_op {
416 __le64 offset, length; 424 __le64 offset, length;
417 __le64 src_offset; 425 __le64 src_offset;
418 } __attribute__ ((packed)) clonerange; 426 } __attribute__ ((packed)) clonerange;
427 struct {
428 __le64 expected_object_size;
429 __le64 expected_write_size;
430 } __attribute__ ((packed)) alloc_hint;
419 }; 431 };
420 __le32 payload_len; 432 __le32 payload_len;
421} __attribute__ ((packed)); 433} __attribute__ ((packed));
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 9450f025fe0c..c2515851c1aa 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -14,18 +14,17 @@
14#include <linux/rcupdate.h> 14#include <linux/rcupdate.h>
15#include <linux/rculist.h> 15#include <linux/rculist.h>
16#include <linux/cgroupstats.h> 16#include <linux/cgroupstats.h>
17#include <linux/prio_heap.h>
18#include <linux/rwsem.h> 17#include <linux/rwsem.h>
19#include <linux/idr.h> 18#include <linux/idr.h>
20#include <linux/workqueue.h> 19#include <linux/workqueue.h>
21#include <linux/xattr.h>
22#include <linux/fs.h> 20#include <linux/fs.h>
23#include <linux/percpu-refcount.h> 21#include <linux/percpu-refcount.h>
24#include <linux/seq_file.h> 22#include <linux/seq_file.h>
23#include <linux/kernfs.h>
25 24
26#ifdef CONFIG_CGROUPS 25#ifdef CONFIG_CGROUPS
27 26
28struct cgroupfs_root; 27struct cgroup_root;
29struct cgroup_subsys; 28struct cgroup_subsys;
30struct inode; 29struct inode;
31struct cgroup; 30struct cgroup;
@@ -34,31 +33,16 @@ extern int cgroup_init_early(void);
34extern int cgroup_init(void); 33extern int cgroup_init(void);
35extern void cgroup_fork(struct task_struct *p); 34extern void cgroup_fork(struct task_struct *p);
36extern void cgroup_post_fork(struct task_struct *p); 35extern void cgroup_post_fork(struct task_struct *p);
37extern void cgroup_exit(struct task_struct *p, int run_callbacks); 36extern void cgroup_exit(struct task_struct *p);
38extern int cgroupstats_build(struct cgroupstats *stats, 37extern int cgroupstats_build(struct cgroupstats *stats,
39 struct dentry *dentry); 38 struct dentry *dentry);
40extern int cgroup_load_subsys(struct cgroup_subsys *ss);
41extern void cgroup_unload_subsys(struct cgroup_subsys *ss);
42 39
43extern int proc_cgroup_show(struct seq_file *, void *); 40extern int proc_cgroup_show(struct seq_file *, void *);
44 41
45/* 42/* define the enumeration of all cgroup subsystems */
46 * Define the enumeration of all cgroup subsystems. 43#define SUBSYS(_x) _x ## _cgrp_id,
47 *
48 * We define ids for builtin subsystems and then modular ones.
49 */
50#define SUBSYS(_x) _x ## _subsys_id,
51enum cgroup_subsys_id { 44enum cgroup_subsys_id {
52#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
53#include <linux/cgroup_subsys.h>
54#undef IS_SUBSYS_ENABLED
55 CGROUP_BUILTIN_SUBSYS_COUNT,
56
57 __CGROUP_SUBSYS_TEMP_PLACEHOLDER = CGROUP_BUILTIN_SUBSYS_COUNT - 1,
58
59#define IS_SUBSYS_ENABLED(option) IS_MODULE(option)
60#include <linux/cgroup_subsys.h> 45#include <linux/cgroup_subsys.h>
61#undef IS_SUBSYS_ENABLED
62 CGROUP_SUBSYS_COUNT, 46 CGROUP_SUBSYS_COUNT,
63}; 47};
64#undef SUBSYS 48#undef SUBSYS
@@ -153,11 +137,6 @@ enum {
153 CGRP_SANE_BEHAVIOR, 137 CGRP_SANE_BEHAVIOR,
154}; 138};
155 139
156struct cgroup_name {
157 struct rcu_head rcu_head;
158 char name[];
159};
160
161struct cgroup { 140struct cgroup {
162 unsigned long flags; /* "unsigned long" so bitops work */ 141 unsigned long flags; /* "unsigned long" so bitops work */
163 142
@@ -174,16 +153,17 @@ struct cgroup {
174 /* the number of attached css's */ 153 /* the number of attached css's */
175 int nr_css; 154 int nr_css;
176 155
156 atomic_t refcnt;
157
177 /* 158 /*
178 * We link our 'sibling' struct into our parent's 'children'. 159 * We link our 'sibling' struct into our parent's 'children'.
179 * Our children link their 'sibling' into our 'children'. 160 * Our children link their 'sibling' into our 'children'.
180 */ 161 */
181 struct list_head sibling; /* my parent's children */ 162 struct list_head sibling; /* my parent's children */
182 struct list_head children; /* my children */ 163 struct list_head children; /* my children */
183 struct list_head files; /* my files */
184 164
185 struct cgroup *parent; /* my parent */ 165 struct cgroup *parent; /* my parent */
186 struct dentry *dentry; /* cgroup fs entry, RCU protected */ 166 struct kernfs_node *kn; /* cgroup kernfs entry */
187 167
188 /* 168 /*
189 * Monotonically increasing unique serial number which defines a 169 * Monotonically increasing unique serial number which defines a
@@ -193,23 +173,13 @@ struct cgroup {
193 */ 173 */
194 u64 serial_nr; 174 u64 serial_nr;
195 175
196 /* 176 /* The bitmask of subsystems attached to this cgroup */
197 * This is a copy of dentry->d_name, and it's needed because 177 unsigned long subsys_mask;
198 * we can't use dentry->d_name in cgroup_path().
199 *
200 * You must acquire rcu_read_lock() to access cgrp->name, and
201 * the only place that can change it is rename(), which is
202 * protected by parent dir's i_mutex.
203 *
204 * Normally you should use cgroup_name() wrapper rather than
205 * access it directly.
206 */
207 struct cgroup_name __rcu *name;
208 178
209 /* Private pointers for each registered subsystem */ 179 /* Private pointers for each registered subsystem */
210 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT]; 180 struct cgroup_subsys_state __rcu *subsys[CGROUP_SUBSYS_COUNT];
211 181
212 struct cgroupfs_root *root; 182 struct cgroup_root *root;
213 183
214 /* 184 /*
215 * List of cgrp_cset_links pointing at css_sets with tasks in this 185 * List of cgrp_cset_links pointing at css_sets with tasks in this
@@ -237,14 +207,11 @@ struct cgroup {
237 /* For css percpu_ref killing and RCU-protected deletion */ 207 /* For css percpu_ref killing and RCU-protected deletion */
238 struct rcu_head rcu_head; 208 struct rcu_head rcu_head;
239 struct work_struct destroy_work; 209 struct work_struct destroy_work;
240
241 /* directory xattrs */
242 struct simple_xattrs xattrs;
243}; 210};
244 211
245#define MAX_CGROUP_ROOT_NAMELEN 64 212#define MAX_CGROUP_ROOT_NAMELEN 64
246 213
247/* cgroupfs_root->flags */ 214/* cgroup_root->flags */
248enum { 215enum {
249 /* 216 /*
250 * Unfortunately, cgroup core and various controllers are riddled 217 * Unfortunately, cgroup core and various controllers are riddled
@@ -262,8 +229,8 @@ enum {
262 * 229 *
263 * The followings are the behaviors currently affected this flag. 230 * The followings are the behaviors currently affected this flag.
264 * 231 *
265 * - Mount options "noprefix" and "clone_children" are disallowed. 232 * - Mount options "noprefix", "xattr", "clone_children",
266 * Also, cgroupfs file cgroup.clone_children is not created. 233 * "release_agent" and "name" are disallowed.
267 * 234 *
268 * - When mounting an existing superblock, mount options should 235 * - When mounting an existing superblock, mount options should
269 * match. 236 * match.
@@ -281,6 +248,11 @@ enum {
281 * - "release_agent" and "notify_on_release" are removed. 248 * - "release_agent" and "notify_on_release" are removed.
282 * Replacement notification mechanism will be implemented. 249 * Replacement notification mechanism will be implemented.
283 * 250 *
251 * - "cgroup.clone_children" is removed.
252 *
253 * - If mount is requested with sane_behavior but without any
254 * subsystem, the default unified hierarchy is mounted.
255 *
284 * - cpuset: tasks will be kept in empty cpusets when hotplug happens 256 * - cpuset: tasks will be kept in empty cpusets when hotplug happens
285 * and take masks of ancestors with non-empty cpus/mems, instead of 257 * and take masks of ancestors with non-empty cpus/mems, instead of
286 * being moved to an ancestor. 258 * being moved to an ancestor.
@@ -300,29 +272,24 @@ enum {
300 272
301 /* mount options live below bit 16 */ 273 /* mount options live below bit 16 */
302 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1, 274 CGRP_ROOT_OPTION_MASK = (1 << 16) - 1,
303
304 CGRP_ROOT_SUBSYS_BOUND = (1 << 16), /* subsystems finished binding */
305}; 275};
306 276
307/* 277/*
308 * A cgroupfs_root represents the root of a cgroup hierarchy, and may be 278 * A cgroup_root represents the root of a cgroup hierarchy, and may be
309 * associated with a superblock to form an active hierarchy. This is 279 * associated with a kernfs_root to form an active hierarchy. This is
310 * internal to cgroup core. Don't access directly from controllers. 280 * internal to cgroup core. Don't access directly from controllers.
311 */ 281 */
312struct cgroupfs_root { 282struct cgroup_root {
313 struct super_block *sb; 283 struct kernfs_root *kf_root;
314
315 /* The bitmask of subsystems attached to this hierarchy */
316 unsigned long subsys_mask;
317 284
318 /* Unique id for this hierarchy. */ 285 /* Unique id for this hierarchy. */
319 int hierarchy_id; 286 int hierarchy_id;
320 287
321 /* The root cgroup for this hierarchy */ 288 /* The root cgroup. Root is destroyed on its release. */
322 struct cgroup top_cgroup; 289 struct cgroup cgrp;
323 290
324 /* Tracks how many cgroups are currently defined in hierarchy.*/ 291 /* Number of cgroups in the hierarchy, used only for /proc/cgroups */
325 int number_of_cgroups; 292 atomic_t nr_cgrps;
326 293
327 /* A list running through the active hierarchies */ 294 /* A list running through the active hierarchies */
328 struct list_head root_list; 295 struct list_head root_list;
@@ -360,10 +327,14 @@ struct css_set {
360 struct hlist_node hlist; 327 struct hlist_node hlist;
361 328
362 /* 329 /*
363 * List running through all tasks using this cgroup 330 * Lists running through all tasks using this cgroup group.
364 * group. Protected by css_set_lock 331 * mg_tasks lists tasks which belong to this cset but are in the
332 * process of being migrated out or in. Protected by
333 * css_set_rwsem, but, during migration, once tasks are moved to
334 * mg_tasks, it can be read safely while holding cgroup_mutex.
365 */ 335 */
366 struct list_head tasks; 336 struct list_head tasks;
337 struct list_head mg_tasks;
367 338
368 /* 339 /*
369 * List of cgrp_cset_links pointing at cgroups referenced from this 340 * List of cgrp_cset_links pointing at cgroups referenced from this
@@ -372,13 +343,29 @@ struct css_set {
372 struct list_head cgrp_links; 343 struct list_head cgrp_links;
373 344
374 /* 345 /*
375 * Set of subsystem states, one for each subsystem. This array 346 * Set of subsystem states, one for each subsystem. This array is
376 * is immutable after creation apart from the init_css_set 347 * immutable after creation apart from the init_css_set during
377 * during subsystem registration (at boot time) and modular subsystem 348 * subsystem registration (at boot time).
378 * loading/unloading.
379 */ 349 */
380 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 350 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
381 351
352 /*
353 * List of csets participating in the on-going migration either as
354 * source or destination. Protected by cgroup_mutex.
355 */
356 struct list_head mg_preload_node;
357 struct list_head mg_node;
358
359 /*
360 * If this cset is acting as the source of migration the following
361 * two fields are set. mg_src_cgrp is the source cgroup of the
362 * on-going migration and mg_dst_cset is the destination cset the
363 * target tasks on this cset should be migrated to. Protected by
364 * cgroup_mutex.
365 */
366 struct cgroup *mg_src_cgrp;
367 struct css_set *mg_dst_cset;
368
382 /* For RCU-protected deletion */ 369 /* For RCU-protected deletion */
383 struct rcu_head rcu_head; 370 struct rcu_head rcu_head;
384}; 371};
@@ -397,6 +384,7 @@ enum {
397 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */ 384 CFTYPE_NOT_ON_ROOT = (1 << 1), /* don't create on root cgrp */
398 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */ 385 CFTYPE_INSANE = (1 << 2), /* don't create if sane_behavior */
399 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */ 386 CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
387 CFTYPE_ONLY_ON_DFL = (1 << 4), /* only on default hierarchy */
400}; 388};
401 389
402#define MAX_CFTYPE_NAME 64 390#define MAX_CFTYPE_NAME 64
@@ -416,8 +404,9 @@ struct cftype {
416 umode_t mode; 404 umode_t mode;
417 405
418 /* 406 /*
419 * If non-zero, defines the maximum length of string that can 407 * The maximum length of string, excluding trailing nul, that can
420 * be passed to write_string; defaults to 64 408 * be passed to write_string. If < PAGE_SIZE-1, PAGE_SIZE-1 is
409 * assumed.
421 */ 410 */
422 size_t max_write_len; 411 size_t max_write_len;
423 412
@@ -425,10 +414,12 @@ struct cftype {
425 unsigned int flags; 414 unsigned int flags;
426 415
427 /* 416 /*
428 * The subsys this file belongs to. Initialized automatically 417 * Fields used for internal bookkeeping. Initialized automatically
429 * during registration. NULL for cgroup core files. 418 * during registration.
430 */ 419 */
431 struct cgroup_subsys *ss; 420 struct cgroup_subsys *ss; /* NULL for cgroup core files */
421 struct list_head node; /* anchored at ss->cfts */
422 struct kernfs_ops *kf_ops;
432 423
433 /* 424 /*
434 * read_u64() is a shortcut for the common case of returning a 425 * read_u64() is a shortcut for the common case of returning a
@@ -467,7 +458,7 @@ struct cftype {
467 * Returns 0 or -ve error code. 458 * Returns 0 or -ve error code.
468 */ 459 */
469 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft, 460 int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft,
470 const char *buffer); 461 char *buffer);
471 /* 462 /*
472 * trigger() callback can be used to get some kick from the 463 * trigger() callback can be used to get some kick from the
473 * userspace, when the actual string written is not important 464 * userspace, when the actual string written is not important
@@ -475,37 +466,18 @@ struct cftype {
475 * kick type for multiplexing. 466 * kick type for multiplexing.
476 */ 467 */
477 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); 468 int (*trigger)(struct cgroup_subsys_state *css, unsigned int event);
478};
479 469
480/* 470#ifdef CONFIG_DEBUG_LOCK_ALLOC
481 * cftype_sets describe cftypes belonging to a subsystem and are chained at 471 struct lock_class_key lockdep_key;
482 * cgroup_subsys->cftsets. Each cftset points to an array of cftypes 472#endif
483 * terminated by zero length name.
484 */
485struct cftype_set {
486 struct list_head node; /* chained at subsys->cftsets */
487 struct cftype *cfts;
488}; 473};
489 474
490/* 475extern struct cgroup_root cgrp_dfl_root;
491 * cgroupfs file entry, pointed to from leaf dentry->d_fsdata. Don't
492 * access directly.
493 */
494struct cfent {
495 struct list_head node;
496 struct dentry *dentry;
497 struct cftype *type;
498 struct cgroup_subsys_state *css;
499
500 /* file xattrs */
501 struct simple_xattrs xattrs;
502};
503 476
504/* seq_file->private points to the following, only ->priv is public */ 477static inline bool cgroup_on_dfl(const struct cgroup *cgrp)
505struct cgroup_open_file { 478{
506 struct cfent *cfe; 479 return cgrp->root == &cgrp_dfl_root;
507 void *priv; 480}
508};
509 481
510/* 482/*
511 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This 483 * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details. This
@@ -516,34 +488,63 @@ static inline bool cgroup_sane_behavior(const struct cgroup *cgrp)
516 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR; 488 return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR;
517} 489}
518 490
519/* Caller should hold rcu_read_lock() */ 491/* no synchronization, the result can only be used as a hint */
520static inline const char *cgroup_name(const struct cgroup *cgrp) 492static inline bool cgroup_has_tasks(struct cgroup *cgrp)
521{ 493{
522 return rcu_dereference(cgrp->name)->name; 494 return !list_empty(&cgrp->cset_links);
523} 495}
524 496
525static inline struct cgroup_subsys_state *seq_css(struct seq_file *seq) 497/* returns ino associated with a cgroup, 0 indicates unmounted root */
498static inline ino_t cgroup_ino(struct cgroup *cgrp)
526{ 499{
527 struct cgroup_open_file *of = seq->private; 500 if (cgrp->kn)
528 return of->cfe->css; 501 return cgrp->kn->ino;
502 else
503 return 0;
529} 504}
530 505
531static inline struct cftype *seq_cft(struct seq_file *seq) 506static inline struct cftype *seq_cft(struct seq_file *seq)
532{ 507{
533 struct cgroup_open_file *of = seq->private; 508 struct kernfs_open_file *of = seq->private;
534 return of->cfe->type; 509
510 return of->kn->priv;
511}
512
513struct cgroup_subsys_state *seq_css(struct seq_file *seq);
514
515/*
516 * Name / path handling functions. All are thin wrappers around the kernfs
517 * counterparts and can be called under any context.
518 */
519
520static inline int cgroup_name(struct cgroup *cgrp, char *buf, size_t buflen)
521{
522 return kernfs_name(cgrp->kn, buf, buflen);
535} 523}
536 524
525static inline char * __must_check cgroup_path(struct cgroup *cgrp, char *buf,
526 size_t buflen)
527{
528 return kernfs_path(cgrp->kn, buf, buflen);
529}
530
531static inline void pr_cont_cgroup_name(struct cgroup *cgrp)
532{
533 pr_cont_kernfs_name(cgrp->kn);
534}
535
536static inline void pr_cont_cgroup_path(struct cgroup *cgrp)
537{
538 pr_cont_kernfs_path(cgrp->kn);
539}
540
541char *task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
542
537int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); 543int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);
538int cgroup_rm_cftypes(struct cftype *cfts); 544int cgroup_rm_cftypes(struct cftype *cfts);
539 545
540bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor); 546bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);
541 547
542int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
543int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
544
545int cgroup_task_count(const struct cgroup *cgrp);
546
547/* 548/*
548 * Control Group taskset, used to pass around set of tasks to cgroup_subsys 549 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
549 * methods. 550 * methods.
@@ -551,22 +552,15 @@ int cgroup_task_count(const struct cgroup *cgrp);
551struct cgroup_taskset; 552struct cgroup_taskset;
552struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); 553struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
553struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); 554struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
554struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset,
555 int subsys_id);
556int cgroup_taskset_size(struct cgroup_taskset *tset);
557 555
558/** 556/**
559 * cgroup_taskset_for_each - iterate cgroup_taskset 557 * cgroup_taskset_for_each - iterate cgroup_taskset
560 * @task: the loop cursor 558 * @task: the loop cursor
561 * @skip_css: skip if task's css matches this, %NULL to iterate through all
562 * @tset: taskset to iterate 559 * @tset: taskset to iterate
563 */ 560 */
564#define cgroup_taskset_for_each(task, skip_css, tset) \ 561#define cgroup_taskset_for_each(task, tset) \
565 for ((task) = cgroup_taskset_first((tset)); (task); \ 562 for ((task) = cgroup_taskset_first((tset)); (task); \
566 (task) = cgroup_taskset_next((tset))) \ 563 (task) = cgroup_taskset_next((tset)))
567 if (!(skip_css) || \
568 cgroup_taskset_cur_css((tset), \
569 (skip_css)->ss->subsys_id) != (skip_css))
570 564
571/* 565/*
572 * Control Group subsystem type. 566 * Control Group subsystem type.
@@ -591,7 +585,6 @@ struct cgroup_subsys {
591 struct task_struct *task); 585 struct task_struct *task);
592 void (*bind)(struct cgroup_subsys_state *root_css); 586 void (*bind)(struct cgroup_subsys_state *root_css);
593 587
594 int subsys_id;
595 int disabled; 588 int disabled;
596 int early_init; 589 int early_init;
597 590
@@ -610,27 +603,26 @@ struct cgroup_subsys {
610 bool broken_hierarchy; 603 bool broken_hierarchy;
611 bool warned_broken_hierarchy; 604 bool warned_broken_hierarchy;
612 605
606 /* the following two fields are initialized automtically during boot */
607 int id;
613#define MAX_CGROUP_TYPE_NAMELEN 32 608#define MAX_CGROUP_TYPE_NAMELEN 32
614 const char *name; 609 const char *name;
615 610
616 /* link to parent, protected by cgroup_lock() */ 611 /* link to parent, protected by cgroup_lock() */
617 struct cgroupfs_root *root; 612 struct cgroup_root *root;
618 613
619 /* list of cftype_sets */ 614 /*
620 struct list_head cftsets; 615 * List of cftypes. Each entry is the first entry of an array
616 * terminated by zero length name.
617 */
618 struct list_head cfts;
621 619
622 /* base cftypes, automatically [de]registered with subsys itself */ 620 /* base cftypes, automatically registered with subsys itself */
623 struct cftype *base_cftypes; 621 struct cftype *base_cftypes;
624 struct cftype_set base_cftset;
625
626 /* should be defined only by modular subsystems */
627 struct module *module;
628}; 622};
629 623
630#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys; 624#define SUBSYS(_x) extern struct cgroup_subsys _x ## _cgrp_subsys;
631#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)
632#include <linux/cgroup_subsys.h> 625#include <linux/cgroup_subsys.h>
633#undef IS_SUBSYS_ENABLED
634#undef SUBSYS 626#undef SUBSYS
635 627
636/** 628/**
@@ -661,10 +653,12 @@ struct cgroup_subsys_state *css_parent(struct cgroup_subsys_state *css)
661 */ 653 */
662#ifdef CONFIG_PROVE_RCU 654#ifdef CONFIG_PROVE_RCU
663extern struct mutex cgroup_mutex; 655extern struct mutex cgroup_mutex;
656extern struct rw_semaphore css_set_rwsem;
664#define task_css_set_check(task, __c) \ 657#define task_css_set_check(task, __c) \
665 rcu_dereference_check((task)->cgroups, \ 658 rcu_dereference_check((task)->cgroups, \
666 lockdep_is_held(&(task)->alloc_lock) || \ 659 lockdep_is_held(&cgroup_mutex) || \
667 lockdep_is_held(&cgroup_mutex) || (__c)) 660 lockdep_is_held(&css_set_rwsem) || \
661 ((task)->flags & PF_EXITING) || (__c))
668#else 662#else
669#define task_css_set_check(task, __c) \ 663#define task_css_set_check(task, __c) \
670 rcu_dereference((task)->cgroups) 664 rcu_dereference((task)->cgroups)
@@ -837,16 +831,11 @@ void css_task_iter_start(struct cgroup_subsys_state *css,
837struct task_struct *css_task_iter_next(struct css_task_iter *it); 831struct task_struct *css_task_iter_next(struct css_task_iter *it);
838void css_task_iter_end(struct css_task_iter *it); 832void css_task_iter_end(struct css_task_iter *it);
839 833
840int css_scan_tasks(struct cgroup_subsys_state *css,
841 bool (*test)(struct task_struct *, void *),
842 void (*process)(struct task_struct *, void *),
843 void *data, struct ptr_heap *heap);
844
845int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); 834int cgroup_attach_task_all(struct task_struct *from, struct task_struct *);
846int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from); 835int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);
847 836
848struct cgroup_subsys_state *css_from_dir(struct dentry *dentry, 837struct cgroup_subsys_state *css_tryget_from_dir(struct dentry *dentry,
849 struct cgroup_subsys *ss); 838 struct cgroup_subsys *ss);
850 839
851#else /* !CONFIG_CGROUPS */ 840#else /* !CONFIG_CGROUPS */
852 841
@@ -854,7 +843,7 @@ static inline int cgroup_init_early(void) { return 0; }
854static inline int cgroup_init(void) { return 0; } 843static inline int cgroup_init(void) { return 0; }
855static inline void cgroup_fork(struct task_struct *p) {} 844static inline void cgroup_fork(struct task_struct *p) {}
856static inline void cgroup_post_fork(struct task_struct *p) {} 845static inline void cgroup_post_fork(struct task_struct *p) {}
857static inline void cgroup_exit(struct task_struct *p, int callbacks) {} 846static inline void cgroup_exit(struct task_struct *p) {}
858 847
859static inline int cgroupstats_build(struct cgroupstats *stats, 848static inline int cgroupstats_build(struct cgroupstats *stats,
860 struct dentry *dentry) 849 struct dentry *dentry)
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 7b99d717411d..768fe44e19f0 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -3,51 +3,51 @@
3 * 3 *
4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS. 4 * DO NOT ADD ANY SUBSYSTEM WITHOUT EXPLICIT ACKS FROM CGROUP MAINTAINERS.
5 */ 5 */
6#if IS_SUBSYS_ENABLED(CONFIG_CPUSETS) 6#if IS_ENABLED(CONFIG_CPUSETS)
7SUBSYS(cpuset) 7SUBSYS(cpuset)
8#endif 8#endif
9 9
10#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEBUG) 10#if IS_ENABLED(CONFIG_CGROUP_DEBUG)
11SUBSYS(debug) 11SUBSYS(debug)
12#endif 12#endif
13 13
14#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_SCHED) 14#if IS_ENABLED(CONFIG_CGROUP_SCHED)
15SUBSYS(cpu_cgroup) 15SUBSYS(cpu)
16#endif 16#endif
17 17
18#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_CPUACCT) 18#if IS_ENABLED(CONFIG_CGROUP_CPUACCT)
19SUBSYS(cpuacct) 19SUBSYS(cpuacct)
20#endif 20#endif
21 21
22#if IS_SUBSYS_ENABLED(CONFIG_MEMCG) 22#if IS_ENABLED(CONFIG_MEMCG)
23SUBSYS(mem_cgroup) 23SUBSYS(memory)
24#endif 24#endif
25 25
26#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_DEVICE) 26#if IS_ENABLED(CONFIG_CGROUP_DEVICE)
27SUBSYS(devices) 27SUBSYS(devices)
28#endif 28#endif
29 29
30#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_FREEZER) 30#if IS_ENABLED(CONFIG_CGROUP_FREEZER)
31SUBSYS(freezer) 31SUBSYS(freezer)
32#endif 32#endif
33 33
34#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_CLASSID) 34#if IS_ENABLED(CONFIG_CGROUP_NET_CLASSID)
35SUBSYS(net_cls) 35SUBSYS(net_cls)
36#endif 36#endif
37 37
38#if IS_SUBSYS_ENABLED(CONFIG_BLK_CGROUP) 38#if IS_ENABLED(CONFIG_BLK_CGROUP)
39SUBSYS(blkio) 39SUBSYS(blkio)
40#endif 40#endif
41 41
42#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) 42#if IS_ENABLED(CONFIG_CGROUP_PERF)
43SUBSYS(perf) 43SUBSYS(perf_event)
44#endif 44#endif
45 45
46#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_PRIO) 46#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
47SUBSYS(net_prio) 47SUBSYS(net_prio)
48#endif 48#endif
49 49
50#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_HUGETLB) 50#if IS_ENABLED(CONFIG_CGROUP_HUGETLB)
51SUBSYS(hugetlb) 51SUBSYS(hugetlb)
52#endif 52#endif
53/* 53/*
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 939533da93a7..511917416fb0 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -32,6 +32,7 @@
32#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ 32#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
33 33
34struct clk_hw; 34struct clk_hw;
35struct dentry;
35 36
36/** 37/**
37 * struct clk_ops - Callback operations for hardware clocks; these are to 38 * struct clk_ops - Callback operations for hardware clocks; these are to
@@ -127,6 +128,12 @@ struct clk_hw;
127 * separately via calls to .set_parent and .set_rate. 128 * separately via calls to .set_parent and .set_rate.
128 * Returns 0 on success, -EERROR otherwise. 129 * Returns 0 on success, -EERROR otherwise.
129 * 130 *
131 * @debug_init: Set up type-specific debugfs entries for this clock. This
132 * is called once, after the debugfs directory entry for this
133 * clock has been created. The dentry pointer representing that
134 * directory is provided as an argument. Called with
135 * prepare_lock held. Returns 0 on success, -EERROR otherwise.
136 *
130 * 137 *
131 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow 138 * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow
132 * implementations to split any work between atomic (enable) and sleepable 139 * implementations to split any work between atomic (enable) and sleepable
@@ -165,6 +172,7 @@ struct clk_ops {
165 unsigned long (*recalc_accuracy)(struct clk_hw *hw, 172 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
166 unsigned long parent_accuracy); 173 unsigned long parent_accuracy);
167 void (*init)(struct clk_hw *hw); 174 void (*init)(struct clk_hw *hw);
175 int (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
168}; 176};
169 177
170/** 178/**
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 0dd91148165e..fb5e097d8f72 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -78,8 +78,22 @@ struct clk_notifier_data {
78 unsigned long new_rate; 78 unsigned long new_rate;
79}; 79};
80 80
81/**
82 * clk_notifier_register: register a clock rate-change notifier callback
83 * @clk: clock whose rate we are interested in
84 * @nb: notifier block with callback function pointer
85 *
86 * ProTip: debugging across notifier chains can be frustrating. Make sure that
87 * your notifier callback function prints a nice big warning in case of
88 * failure.
89 */
81int clk_notifier_register(struct clk *clk, struct notifier_block *nb); 90int clk_notifier_register(struct clk *clk, struct notifier_block *nb);
82 91
92/**
93 * clk_notifier_unregister: unregister a clock rate-change notifier callback
94 * @clk: clock whose rate we are no longer interested in
95 * @nb: notifier block which will be unregistered
96 */
83int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); 97int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb);
84 98
85/** 99/**
diff --git a/include/linux/clk/zynq.h b/include/linux/clk/zynq.h
index e062d317ccce..7a5633b71533 100644
--- a/include/linux/clk/zynq.h
+++ b/include/linux/clk/zynq.h
@@ -22,7 +22,7 @@
22 22
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24 24
25void zynq_clock_init(void __iomem *slcr); 25void zynq_clock_init(void);
26 26
27struct clk *clk_register_zynq_pll(const char *name, const char *parent, 27struct clk *clk_register_zynq_pll(const char *name, const char *parent,
28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index, 28 void __iomem *pll_ctrl, void __iomem *pll_status, u8 lock_index,
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 01c0aa57ccec..e6494261eaff 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -147,26 +147,23 @@ struct compat_sigaction {
147}; 147};
148 148
149/* 149/*
150 * These functions operate strictly on struct compat_time*
151 */
152extern int get_compat_timespec(struct timespec *,
153 const struct compat_timespec __user *);
154extern int put_compat_timespec(const struct timespec *,
155 struct compat_timespec __user *);
156extern int get_compat_timeval(struct timeval *,
157 const struct compat_timeval __user *);
158extern int put_compat_timeval(const struct timeval *,
159 struct compat_timeval __user *);
160/*
161 * These functions operate on 32- or 64-bit specs depending on 150 * These functions operate on 32- or 64-bit specs depending on
162 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments and the 151 * COMPAT_USE_64BIT_TIME, hence the void user pointer arguments.
163 * naming as compat_get/put_ rather than get/put_compat_.
164 */ 152 */
165extern int compat_get_timespec(struct timespec *, const void __user *); 153extern int compat_get_timespec(struct timespec *, const void __user *);
166extern int compat_put_timespec(const struct timespec *, void __user *); 154extern int compat_put_timespec(const struct timespec *, void __user *);
167extern int compat_get_timeval(struct timeval *, const void __user *); 155extern int compat_get_timeval(struct timeval *, const void __user *);
168extern int compat_put_timeval(const struct timeval *, void __user *); 156extern int compat_put_timeval(const struct timeval *, void __user *);
169 157
158/*
159 * This function convert a timespec if necessary and returns a *user
160 * space* pointer. If no conversion is necessary, it returns the
161 * initial pointer. NULL is a legitimate argument and will always
162 * output NULL.
163 */
164extern int compat_convert_timespec(struct timespec __user **,
165 const void __user *);
166
170struct compat_iovec { 167struct compat_iovec {
171 compat_uptr_t iov_base; 168 compat_uptr_t iov_base;
172 compat_size_t iov_len; 169 compat_size_t iov_len;
diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
new file mode 100644
index 000000000000..d1e49d52b640
--- /dev/null
+++ b/include/linux/compiler-clang.h
@@ -0,0 +1,12 @@
1#ifndef __LINUX_COMPILER_H
2#error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
3#endif
4
5/* Some compiler specific definitions are overwritten here
6 * for Clang compiler
7 */
8
9#ifdef uninitialized_var
10#undef uninitialized_var
11#define uninitialized_var(x) x = *(&(x))
12#endif
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2472740d7ab2..ee7239ea1583 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -63,6 +63,13 @@ extern void __chk_io_ptr(const volatile void __iomem *);
63# include <linux/compiler-intel.h> 63# include <linux/compiler-intel.h>
64#endif 64#endif
65 65
66/* Clang compiler defines __GNUC__. So we will overwrite implementations
67 * coming from above header files here
68 */
69#ifdef __clang__
70#include <linux/compiler-clang.h>
71#endif
72
66/* 73/*
67 * Generic compiler-dependent macros required for kernel 74 * Generic compiler-dependent macros required for kernel
68 * build go below this comment. Actual compiler/compiler version 75 * build go below this comment. Actual compiler/compiler version
diff --git a/include/linux/connector.h b/include/linux/connector.h
index b2b5a41b6a24..be9c4747d511 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -71,7 +71,7 @@ struct cn_dev {
71int cn_add_callback(struct cb_id *id, const char *name, 71int cn_add_callback(struct cb_id *id, const char *name,
72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); 72 void (*callback)(struct cn_msg *, struct netlink_skb_parms *));
73void cn_del_callback(struct cb_id *); 73void cn_del_callback(struct cb_id *);
74int cn_netlink_send(struct cn_msg *, u32, gfp_t); 74int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask);
75 75
76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, 76int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name,
77 struct cb_id *id, 77 struct cb_id *id,
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 03e235ad1bba..81887120395c 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -46,13 +46,6 @@ extern ssize_t arch_cpu_release(const char *, size_t);
46#endif 46#endif
47struct notifier_block; 47struct notifier_block;
48 48
49#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
50extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env);
51extern ssize_t arch_print_cpu_modalias(struct device *dev,
52 struct device_attribute *attr,
53 char *bufptr);
54#endif
55
56/* 49/*
57 * CPU notifier priorities. 50 * CPU notifier priorities.
58 */ 51 */
@@ -122,26 +115,46 @@ enum {
122 { .notifier_call = fn, .priority = pri }; \ 115 { .notifier_call = fn, .priority = pri }; \
123 register_cpu_notifier(&fn##_nb); \ 116 register_cpu_notifier(&fn##_nb); \
124} 117}
118
119#define __cpu_notifier(fn, pri) { \
120 static struct notifier_block fn##_nb = \
121 { .notifier_call = fn, .priority = pri }; \
122 __register_cpu_notifier(&fn##_nb); \
123}
125#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 124#else /* #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
126#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 125#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
126#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
127#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */ 127#endif /* #else #if defined(CONFIG_HOTPLUG_CPU) || !defined(MODULE) */
128
128#ifdef CONFIG_HOTPLUG_CPU 129#ifdef CONFIG_HOTPLUG_CPU
129extern int register_cpu_notifier(struct notifier_block *nb); 130extern int register_cpu_notifier(struct notifier_block *nb);
131extern int __register_cpu_notifier(struct notifier_block *nb);
130extern void unregister_cpu_notifier(struct notifier_block *nb); 132extern void unregister_cpu_notifier(struct notifier_block *nb);
133extern void __unregister_cpu_notifier(struct notifier_block *nb);
131#else 134#else
132 135
133#ifndef MODULE 136#ifndef MODULE
134extern int register_cpu_notifier(struct notifier_block *nb); 137extern int register_cpu_notifier(struct notifier_block *nb);
138extern int __register_cpu_notifier(struct notifier_block *nb);
135#else 139#else
136static inline int register_cpu_notifier(struct notifier_block *nb) 140static inline int register_cpu_notifier(struct notifier_block *nb)
137{ 141{
138 return 0; 142 return 0;
139} 143}
144
145static inline int __register_cpu_notifier(struct notifier_block *nb)
146{
147 return 0;
148}
140#endif 149#endif
141 150
142static inline void unregister_cpu_notifier(struct notifier_block *nb) 151static inline void unregister_cpu_notifier(struct notifier_block *nb)
143{ 152{
144} 153}
154
155static inline void __unregister_cpu_notifier(struct notifier_block *nb)
156{
157}
145#endif 158#endif
146 159
147int cpu_up(unsigned int cpu); 160int cpu_up(unsigned int cpu);
@@ -149,19 +162,32 @@ void notify_cpu_starting(unsigned int cpu);
149extern void cpu_maps_update_begin(void); 162extern void cpu_maps_update_begin(void);
150extern void cpu_maps_update_done(void); 163extern void cpu_maps_update_done(void);
151 164
165#define cpu_notifier_register_begin cpu_maps_update_begin
166#define cpu_notifier_register_done cpu_maps_update_done
167
152#else /* CONFIG_SMP */ 168#else /* CONFIG_SMP */
153 169
154#define cpu_notifier(fn, pri) do { (void)(fn); } while (0) 170#define cpu_notifier(fn, pri) do { (void)(fn); } while (0)
171#define __cpu_notifier(fn, pri) do { (void)(fn); } while (0)
155 172
156static inline int register_cpu_notifier(struct notifier_block *nb) 173static inline int register_cpu_notifier(struct notifier_block *nb)
157{ 174{
158 return 0; 175 return 0;
159} 176}
160 177
178static inline int __register_cpu_notifier(struct notifier_block *nb)
179{
180 return 0;
181}
182
161static inline void unregister_cpu_notifier(struct notifier_block *nb) 183static inline void unregister_cpu_notifier(struct notifier_block *nb)
162{ 184{
163} 185}
164 186
187static inline void __unregister_cpu_notifier(struct notifier_block *nb)
188{
189}
190
165static inline void cpu_maps_update_begin(void) 191static inline void cpu_maps_update_begin(void)
166{ 192{
167} 193}
@@ -170,6 +196,14 @@ static inline void cpu_maps_update_done(void)
170{ 196{
171} 197}
172 198
199static inline void cpu_notifier_register_begin(void)
200{
201}
202
203static inline void cpu_notifier_register_done(void)
204{
205}
206
173#endif /* CONFIG_SMP */ 207#endif /* CONFIG_SMP */
174extern struct bus_type cpu_subsys; 208extern struct bus_type cpu_subsys;
175 209
@@ -183,8 +217,11 @@ extern void put_online_cpus(void);
183extern void cpu_hotplug_disable(void); 217extern void cpu_hotplug_disable(void);
184extern void cpu_hotplug_enable(void); 218extern void cpu_hotplug_enable(void);
185#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri) 219#define hotcpu_notifier(fn, pri) cpu_notifier(fn, pri)
220#define __hotcpu_notifier(fn, pri) __cpu_notifier(fn, pri)
186#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 221#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
222#define __register_hotcpu_notifier(nb) __register_cpu_notifier(nb)
187#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 223#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
224#define __unregister_hotcpu_notifier(nb) __unregister_cpu_notifier(nb)
188void clear_tasks_mm_cpumask(int cpu); 225void clear_tasks_mm_cpumask(int cpu);
189int cpu_down(unsigned int cpu); 226int cpu_down(unsigned int cpu);
190 227
@@ -197,9 +234,12 @@ static inline void cpu_hotplug_done(void) {}
197#define cpu_hotplug_disable() do { } while (0) 234#define cpu_hotplug_disable() do { } while (0)
198#define cpu_hotplug_enable() do { } while (0) 235#define cpu_hotplug_enable() do { } while (0)
199#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 236#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
237#define __hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
200/* These aren't inline functions due to a GCC bug. */ 238/* These aren't inline functions due to a GCC bug. */
201#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 239#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
240#define __register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
202#define unregister_hotcpu_notifier(nb) ({ (void)(nb); }) 241#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
242#define __unregister_hotcpu_notifier(nb) ({ (void)(nb); })
203#endif /* CONFIG_HOTPLUG_CPU */ 243#endif /* CONFIG_HOTPLUG_CPU */
204 244
205#ifdef CONFIG_PM_SLEEP_SMP 245#ifdef CONFIG_PM_SLEEP_SMP
diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h
new file mode 100644
index 000000000000..c4d4eb8ac9fe
--- /dev/null
+++ b/include/linux/cpufeature.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_CPUFEATURE_H
10#define __LINUX_CPUFEATURE_H
11
12#ifdef CONFIG_GENERIC_CPU_AUTOPROBE
13
14#include <linux/mod_devicetable.h>
15#include <asm/cpufeature.h>
16
17/*
18 * Macros imported from <asm/cpufeature.h>:
19 * - cpu_feature(x) ordinal value of feature called 'x'
20 * - cpu_have_feature(u32 n) whether feature #n is available
21 * - MAX_CPU_FEATURES upper bound for feature ordinal values
22 * Optional:
23 * - CPU_FEATURE_TYPEFMT format string fragment for printing the cpu type
24 * - CPU_FEATURE_TYPEVAL set of values matching the format string above
25 */
26
27#ifndef CPU_FEATURE_TYPEFMT
28#define CPU_FEATURE_TYPEFMT "%s"
29#endif
30
31#ifndef CPU_FEATURE_TYPEVAL
32#define CPU_FEATURE_TYPEVAL ELF_PLATFORM
33#endif
34
35/*
36 * Use module_cpu_feature_match(feature, module_init_function) to
37 * declare that
38 * a) the module shall be probed upon discovery of CPU feature 'feature'
39 * (typically at boot time using udev)
40 * b) the module must not be loaded if CPU feature 'feature' is not present
41 * (not even by manual insmod).
42 *
43 * For a list of legal values for 'feature', please consult the file
44 * 'asm/cpufeature.h' of your favorite architecture.
45 */
46#define module_cpu_feature_match(x, __init) \
47static struct cpu_feature const cpu_feature_match_ ## x[] = \
48 { { .feature = cpu_feature(x) }, { } }; \
49MODULE_DEVICE_TABLE(cpu, cpu_feature_match_ ## x); \
50 \
51static int cpu_feature_match_ ## x ## _init(void) \
52{ \
53 if (!cpu_have_feature(cpu_feature(x))) \
54 return -ENODEV; \
55 return __init(); \
56} \
57module_init(cpu_feature_match_ ## x ## _init)
58
59#endif
60#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 4d89e0e6f9cc..5ae5100c1f24 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -16,6 +16,7 @@
16#include <linux/completion.h> 16#include <linux/completion.h>
17#include <linux/kobject.h> 17#include <linux/kobject.h>
18#include <linux/notifier.h> 18#include <linux/notifier.h>
19#include <linux/spinlock.h>
19#include <linux/sysfs.h> 20#include <linux/sysfs.h>
20 21
21/********************************************************************* 22/*********************************************************************
@@ -74,6 +75,8 @@ struct cpufreq_policy {
74 unsigned int max; /* in kHz */ 75 unsigned int max; /* in kHz */
75 unsigned int cur; /* in kHz, only needed if cpufreq 76 unsigned int cur; /* in kHz, only needed if cpufreq
76 * governors are used */ 77 * governors are used */
78 unsigned int suspend_freq; /* freq to set during suspend */
79
77 unsigned int policy; /* see above */ 80 unsigned int policy; /* see above */
78 struct cpufreq_governor *governor; /* see below */ 81 struct cpufreq_governor *governor; /* see below */
79 void *governor_data; 82 void *governor_data;
@@ -83,6 +86,7 @@ struct cpufreq_policy {
83 * called, but you're in IRQ context */ 86 * called, but you're in IRQ context */
84 87
85 struct cpufreq_real_policy user_policy; 88 struct cpufreq_real_policy user_policy;
89 struct cpufreq_frequency_table *freq_table;
86 90
87 struct list_head policy_list; 91 struct list_head policy_list;
88 struct kobject kobj; 92 struct kobject kobj;
@@ -101,6 +105,11 @@ struct cpufreq_policy {
101 * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); 105 * __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
102 */ 106 */
103 struct rw_semaphore rwsem; 107 struct rw_semaphore rwsem;
108
109 /* Synchronization for frequency transitions */
110 bool transition_ongoing; /* Tracks transition status */
111 spinlock_t transition_lock;
112 wait_queue_head_t transition_wait;
104}; 113};
105 114
106/* Only for ACPI */ 115/* Only for ACPI */
@@ -224,6 +233,7 @@ struct cpufreq_driver {
224 int (*bios_limit) (int cpu, unsigned int *limit); 233 int (*bios_limit) (int cpu, unsigned int *limit);
225 234
226 int (*exit) (struct cpufreq_policy *policy); 235 int (*exit) (struct cpufreq_policy *policy);
236 void (*stop_cpu) (struct cpufreq_policy *policy);
227 int (*suspend) (struct cpufreq_policy *policy); 237 int (*suspend) (struct cpufreq_policy *policy);
228 int (*resume) (struct cpufreq_policy *policy); 238 int (*resume) (struct cpufreq_policy *policy);
229 struct freq_attr **attr; 239 struct freq_attr **attr;
@@ -296,6 +306,15 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
296 policy->cpuinfo.max_freq); 306 policy->cpuinfo.max_freq);
297} 307}
298 308
309#ifdef CONFIG_CPU_FREQ
310void cpufreq_suspend(void);
311void cpufreq_resume(void);
312int cpufreq_generic_suspend(struct cpufreq_policy *policy);
313#else
314static inline void cpufreq_suspend(void) {}
315static inline void cpufreq_resume(void) {}
316#endif
317
299/********************************************************************* 318/*********************************************************************
300 * CPUFREQ NOTIFIER INTERFACE * 319 * CPUFREQ NOTIFIER INTERFACE *
301 *********************************************************************/ 320 *********************************************************************/
@@ -306,8 +325,6 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
306/* Transition notifiers */ 325/* Transition notifiers */
307#define CPUFREQ_PRECHANGE (0) 326#define CPUFREQ_PRECHANGE (0)
308#define CPUFREQ_POSTCHANGE (1) 327#define CPUFREQ_POSTCHANGE (1)
309#define CPUFREQ_RESUMECHANGE (8)
310#define CPUFREQ_SUSPENDCHANGE (9)
311 328
312/* Policy Notifiers */ 329/* Policy Notifiers */
313#define CPUFREQ_ADJUST (0) 330#define CPUFREQ_ADJUST (0)
@@ -322,9 +339,9 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
322int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); 339int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
323int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); 340int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
324 341
325void cpufreq_notify_transition(struct cpufreq_policy *policy, 342void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
326 struct cpufreq_freqs *freqs, unsigned int state); 343 struct cpufreq_freqs *freqs);
327void cpufreq_notify_post_transition(struct cpufreq_policy *policy, 344void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
328 struct cpufreq_freqs *freqs, int transition_failed); 345 struct cpufreq_freqs *freqs, int transition_failed);
329 346
330#else /* CONFIG_CPU_FREQ */ 347#else /* CONFIG_CPU_FREQ */
@@ -438,11 +455,14 @@ extern struct cpufreq_governor cpufreq_gov_conservative;
438 * FREQUENCY TABLE HELPERS * 455 * FREQUENCY TABLE HELPERS *
439 *********************************************************************/ 456 *********************************************************************/
440 457
441#define CPUFREQ_ENTRY_INVALID ~0 458/* Special Values of .frequency field */
442#define CPUFREQ_TABLE_END ~1 459#define CPUFREQ_ENTRY_INVALID ~0
443#define CPUFREQ_BOOST_FREQ ~2 460#define CPUFREQ_TABLE_END ~1
461/* Special Values of .flags field */
462#define CPUFREQ_BOOST_FREQ (1 << 0)
444 463
445struct cpufreq_frequency_table { 464struct cpufreq_frequency_table {
465 unsigned int flags;
446 unsigned int driver_data; /* driver specific data, not used by core */ 466 unsigned int driver_data; /* driver specific data, not used by core */
447 unsigned int frequency; /* kHz - doesn't need to be in ascending 467 unsigned int frequency; /* kHz - doesn't need to be in ascending
448 * order */ 468 * order */
@@ -463,7 +483,6 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
463int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, 483int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy,
464 unsigned int freq); 484 unsigned int freq);
465 485
466void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy);
467ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf); 486ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf);
468 487
469#ifdef CONFIG_CPU_FREQ 488#ifdef CONFIG_CPU_FREQ
@@ -490,9 +509,6 @@ struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu);
490/* the following are really really optional */ 509/* the following are really really optional */
491extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; 510extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
492extern struct freq_attr *cpufreq_generic_attr[]; 511extern struct freq_attr *cpufreq_generic_attr[];
493void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
494 unsigned int cpu);
495void cpufreq_frequency_table_put_attr(unsigned int cpu);
496int cpufreq_table_validate_and_show(struct cpufreq_policy *policy, 512int cpufreq_table_validate_and_show(struct cpufreq_policy *policy,
497 struct cpufreq_frequency_table *table); 513 struct cpufreq_frequency_table *table);
498 514
@@ -500,10 +516,4 @@ unsigned int cpufreq_generic_get(unsigned int cpu);
500int cpufreq_generic_init(struct cpufreq_policy *policy, 516int cpufreq_generic_init(struct cpufreq_policy *policy,
501 struct cpufreq_frequency_table *table, 517 struct cpufreq_frequency_table *table,
502 unsigned int transition_latency); 518 unsigned int transition_latency);
503static inline int cpufreq_generic_exit(struct cpufreq_policy *policy)
504{
505 cpufreq_frequency_table_put_attr(policy->cpu);
506 return 0;
507}
508
509#endif /* _LINUX_CPUFREQ_H */ 519#endif /* _LINUX_CPUFREQ_H */
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 50fcbb0ac4e7..b0238cba440b 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -119,7 +119,15 @@ struct cpuidle_driver {
119 119
120#ifdef CONFIG_CPU_IDLE 120#ifdef CONFIG_CPU_IDLE
121extern void disable_cpuidle(void); 121extern void disable_cpuidle(void);
122extern int cpuidle_idle_call(void); 122
123extern int cpuidle_enabled(struct cpuidle_driver *drv,
124 struct cpuidle_device *dev);
125extern int cpuidle_select(struct cpuidle_driver *drv,
126 struct cpuidle_device *dev);
127extern int cpuidle_enter(struct cpuidle_driver *drv,
128 struct cpuidle_device *dev, int index);
129extern void cpuidle_reflect(struct cpuidle_device *dev, int index);
130
123extern int cpuidle_register_driver(struct cpuidle_driver *drv); 131extern int cpuidle_register_driver(struct cpuidle_driver *drv);
124extern struct cpuidle_driver *cpuidle_get_driver(void); 132extern struct cpuidle_driver *cpuidle_get_driver(void);
125extern struct cpuidle_driver *cpuidle_driver_ref(void); 133extern struct cpuidle_driver *cpuidle_driver_ref(void);
@@ -141,7 +149,16 @@ extern int cpuidle_play_dead(void);
141extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); 149extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
142#else 150#else
143static inline void disable_cpuidle(void) { } 151static inline void disable_cpuidle(void) { }
144static inline int cpuidle_idle_call(void) { return -ENODEV; } 152static inline int cpuidle_enabled(struct cpuidle_driver *drv,
153 struct cpuidle_device *dev)
154{return -ENODEV; }
155static inline int cpuidle_select(struct cpuidle_driver *drv,
156 struct cpuidle_device *dev)
157{return -ENODEV; }
158static inline int cpuidle_enter(struct cpuidle_driver *drv,
159 struct cpuidle_device *dev, int index)
160{return -ENODEV; }
161static inline void cpuidle_reflect(struct cpuidle_device *dev, int index) { }
145static inline int cpuidle_register_driver(struct cpuidle_driver *drv) 162static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
146{return -ENODEV; } 163{return -ENODEV; }
147static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; } 164static inline struct cpuidle_driver *cpuidle_get_driver(void) {return NULL; }
@@ -163,6 +180,8 @@ static inline int cpuidle_enable_device(struct cpuidle_device *dev)
163{return -ENODEV; } 180{return -ENODEV; }
164static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } 181static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
165static inline int cpuidle_play_dead(void) {return -ENODEV; } 182static inline int cpuidle_play_dead(void) {return -ENODEV; }
183static inline struct cpuidle_driver *cpuidle_get_cpu_driver(
184 struct cpuidle_device *dev) {return NULL; }
166#endif 185#endif
167 186
168#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED 187#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 3fe661fe96d1..b19d3dc2e651 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -87,25 +87,26 @@ extern void rebuild_sched_domains(void);
87extern void cpuset_print_task_mems_allowed(struct task_struct *p); 87extern void cpuset_print_task_mems_allowed(struct task_struct *p);
88 88
89/* 89/*
90 * get_mems_allowed is required when making decisions involving mems_allowed 90 * read_mems_allowed_begin is required when making decisions involving
91 * such as during page allocation. mems_allowed can be updated in parallel 91 * mems_allowed such as during page allocation. mems_allowed can be updated in
92 * and depending on the new value an operation can fail potentially causing 92 * parallel and depending on the new value an operation can fail potentially
93 * process failure. A retry loop with get_mems_allowed and put_mems_allowed 93 * causing process failure. A retry loop with read_mems_allowed_begin and
94 * prevents these artificial failures. 94 * read_mems_allowed_retry prevents these artificial failures.
95 */ 95 */
96static inline unsigned int get_mems_allowed(void) 96static inline unsigned int read_mems_allowed_begin(void)
97{ 97{
98 return read_seqcount_begin(&current->mems_allowed_seq); 98 return read_seqcount_begin(&current->mems_allowed_seq);
99} 99}
100 100
101/* 101/*
102 * If this returns false, the operation that took place after get_mems_allowed 102 * If this returns true, the operation that took place after
103 * may have failed. It is up to the caller to retry the operation if 103 * read_mems_allowed_begin may have failed artificially due to a concurrent
104 * update of mems_allowed. It is up to the caller to retry the operation if
104 * appropriate. 105 * appropriate.
105 */ 106 */
106static inline bool put_mems_allowed(unsigned int seq) 107static inline bool read_mems_allowed_retry(unsigned int seq)
107{ 108{
108 return !read_seqcount_retry(&current->mems_allowed_seq, seq); 109 return read_seqcount_retry(&current->mems_allowed_seq, seq);
109} 110}
110 111
111static inline void set_mems_allowed(nodemask_t nodemask) 112static inline void set_mems_allowed(nodemask_t nodemask)
@@ -225,14 +226,14 @@ static inline void set_mems_allowed(nodemask_t nodemask)
225{ 226{
226} 227}
227 228
228static inline unsigned int get_mems_allowed(void) 229static inline unsigned int read_mems_allowed_begin(void)
229{ 230{
230 return 0; 231 return 0;
231} 232}
232 233
233static inline bool put_mems_allowed(unsigned int seq) 234static inline bool read_mems_allowed_retry(unsigned int seq)
234{ 235{
235 return true; 236 return false;
236} 237}
237 238
238#endif /* !CONFIG_CPUSETS */ 239#endif /* !CONFIG_CPUSETS */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 7032518f8542..72ab536ad3de 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -25,6 +25,7 @@ extern int __weak remap_oldmem_pfn_range(struct vm_area_struct *vma,
25 25
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int); 27 unsigned long, int);
28void vmcore_cleanup(void);
28 29
29/* Architecture code defines this if there are other possible ELF 30/* Architecture code defines this if there are other possible ELF
30 * machine types, e.g. on bi-arch capable hardware. */ 31 * machine types, e.g. on bi-arch capable hardware. */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 04421e825365..f61d6c8f5ef3 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -66,7 +66,7 @@ extern struct group_info *groups_alloc(int);
66extern struct group_info init_groups; 66extern struct group_info init_groups;
67extern void groups_free(struct group_info *); 67extern void groups_free(struct group_info *);
68extern int set_current_groups(struct group_info *); 68extern int set_current_groups(struct group_info *);
69extern int set_groups(struct cred *, struct group_info *); 69extern void set_groups(struct cred *, struct group_info *);
70extern int groups_search(const struct group_info *, kgid_t); 70extern int groups_search(const struct group_info *, kgid_t);
71 71
72/* access the groups "array" with this macro */ 72/* access the groups "array" with this macro */
diff --git a/include/linux/crush/crush.h b/include/linux/crush/crush.h
index acaa5615d634..4fad5f8ee01d 100644
--- a/include/linux/crush/crush.h
+++ b/include/linux/crush/crush.h
@@ -51,6 +51,7 @@ enum {
51 CRUSH_RULE_SET_CHOOSELEAF_TRIES = 9, /* override chooseleaf_descend_once */ 51 CRUSH_RULE_SET_CHOOSELEAF_TRIES = 9, /* override chooseleaf_descend_once */
52 CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES = 10, 52 CRUSH_RULE_SET_CHOOSE_LOCAL_TRIES = 10,
53 CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES = 11, 53 CRUSH_RULE_SET_CHOOSE_LOCAL_FALLBACK_TRIES = 11,
54 CRUSH_RULE_SET_CHOOSELEAF_VARY_R = 12
54}; 55};
55 56
56/* 57/*
@@ -173,6 +174,12 @@ struct crush_map {
173 * apply to a collision: in that case we will retry as we used 174 * apply to a collision: in that case we will retry as we used
174 * to. */ 175 * to. */
175 __u32 chooseleaf_descend_once; 176 __u32 chooseleaf_descend_once;
177
178 /* if non-zero, feed r into chooseleaf, bit-shifted right by (r-1)
179 * bits. a value of 1 is best for new clusters. for legacy clusters
180 * that want to limit reshuffling, a value of 3 or 4 will make the
181 * mappings line up a bit better with previous mappings. */
182 __u8 chooseleaf_vary_r;
176}; 183};
177 184
178 185
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index bf72e9ac6de0..3b9bfdb83ba6 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -308,6 +308,7 @@ extern void dentry_update_name_case(struct dentry *, struct qstr *);
308 308
309/* used for rename() and baskets */ 309/* used for rename() and baskets */
310extern void d_move(struct dentry *, struct dentry *); 310extern void d_move(struct dentry *, struct dentry *);
311extern void d_exchange(struct dentry *, struct dentry *);
311extern struct dentry *d_ancestor(struct dentry *, struct dentry *); 312extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
312 313
313/* appendix may either be NULL or be used for transname suffixes */ 314/* appendix may either be NULL or be used for transname suffixes */
@@ -429,7 +430,7 @@ static inline unsigned __d_entry_type(const struct dentry *dentry)
429 return dentry->d_flags & DCACHE_ENTRY_TYPE; 430 return dentry->d_flags & DCACHE_ENTRY_TYPE;
430} 431}
431 432
432static inline bool d_is_directory(const struct dentry *dentry) 433static inline bool d_can_lookup(const struct dentry *dentry)
433{ 434{
434 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE; 435 return __d_entry_type(dentry) == DCACHE_DIRECTORY_TYPE;
435} 436}
@@ -439,6 +440,11 @@ static inline bool d_is_autodir(const struct dentry *dentry)
439 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE; 440 return __d_entry_type(dentry) == DCACHE_AUTODIR_TYPE;
440} 441}
441 442
443static inline bool d_is_dir(const struct dentry *dentry)
444{
445 return d_can_lookup(dentry) || d_is_autodir(dentry);
446}
447
442static inline bool d_is_symlink(const struct dentry *dentry) 448static inline bool d_is_symlink(const struct dentry *dentry)
443{ 449{
444 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE; 450 return __d_entry_type(dentry) == DCACHE_SYMLINK_TYPE;
diff --git a/include/linux/decompress/inflate.h b/include/linux/decompress/inflate.h
index 8c0aef1ba5f5..1d0aedef9822 100644
--- a/include/linux/decompress/inflate.h
+++ b/include/linux/decompress/inflate.h
@@ -1,5 +1,5 @@
1#ifndef INFLATE_H 1#ifndef LINUX_DECOMPRESS_INFLATE_H
2#define INFLATE_H 2#define LINUX_DECOMPRESS_INFLATE_H
3 3
4int gunzip(unsigned char *inbuf, int len, 4int gunzip(unsigned char *inbuf, int len,
5 int(*fill)(void*, unsigned int), 5 int(*fill)(void*, unsigned int),
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index ed419c62dde1..63da56ed9796 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -23,7 +23,6 @@ typedef enum { STATUSTYPE_INFO, STATUSTYPE_TABLE } status_type_t;
23 23
24union map_info { 24union map_info {
25 void *ptr; 25 void *ptr;
26 unsigned long long ll;
27}; 26};
28 27
29/* 28/*
@@ -291,7 +290,6 @@ struct dm_target_callbacks {
291struct dm_target_io { 290struct dm_target_io {
292 struct dm_io *io; 291 struct dm_io *io;
293 struct dm_target *ti; 292 struct dm_target *ti;
294 union map_info info;
295 unsigned target_bio_nr; 293 unsigned target_bio_nr;
296 struct bio clone; 294 struct bio clone;
297}; 295};
@@ -403,7 +401,6 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
403struct gendisk *dm_disk(struct mapped_device *md); 401struct gendisk *dm_disk(struct mapped_device *md);
404int dm_suspended(struct dm_target *ti); 402int dm_suspended(struct dm_target *ti);
405int dm_noflush_suspending(struct dm_target *ti); 403int dm_noflush_suspending(struct dm_target *ti);
406union map_info *dm_get_mapinfo(struct bio *bio);
407union map_info *dm_get_rq_mapinfo(struct request *rq); 404union map_info *dm_get_rq_mapinfo(struct request *rq);
408 405
409struct queue_limits *dm_get_queue_limits(struct mapped_device *md); 406struct queue_limits *dm_get_queue_limits(struct mapped_device *md);
@@ -466,6 +463,11 @@ struct mapped_device *dm_table_get_md(struct dm_table *t);
466void dm_table_event(struct dm_table *t); 463void dm_table_event(struct dm_table *t);
467 464
468/* 465/*
466 * Run the queue for request-based targets.
467 */
468void dm_table_run_md_queue_async(struct dm_table *t);
469
470/*
469 * The device must be suspended before calling this method. 471 * The device must be suspended before calling this method.
470 * Returns the previous table, which the caller must destroy. 472 * Returns the previous table, which the caller must destroy.
471 */ 473 */
diff --git a/include/linux/device.h b/include/linux/device.h
index 952b01033c32..233bbbeb768d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -560,6 +560,8 @@ extern int device_create_file(struct device *device,
560 const struct device_attribute *entry); 560 const struct device_attribute *entry);
561extern void device_remove_file(struct device *dev, 561extern void device_remove_file(struct device *dev,
562 const struct device_attribute *attr); 562 const struct device_attribute *attr);
563extern bool device_remove_file_self(struct device *dev,
564 const struct device_attribute *attr);
563extern int __must_check device_create_bin_file(struct device *dev, 565extern int __must_check device_create_bin_file(struct device *dev,
564 const struct bin_attribute *attr); 566 const struct bin_attribute *attr);
565extern void device_remove_bin_file(struct device *dev, 567extern void device_remove_bin_file(struct device *dev,
@@ -626,6 +628,7 @@ static inline void *devm_kcalloc(struct device *dev,
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO); 628 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627} 629}
628extern void devm_kfree(struct device *dev, void *p); 630extern void devm_kfree(struct device *dev, void *p);
631extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
629 632
630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 633void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
631void __iomem *devm_request_and_ioremap(struct device *dev, 634void __iomem *devm_request_and_ioremap(struct device *dev,
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index c5c92d59e531..8300fb87b84a 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -341,15 +341,11 @@ enum dma_slave_buswidth {
341 * and this struct will then be passed in as an argument to the 341 * and this struct will then be passed in as an argument to the
342 * DMA engine device_control() function. 342 * DMA engine device_control() function.
343 * 343 *
344 * The rationale for adding configuration information to this struct 344 * The rationale for adding configuration information to this struct is as
345 * is as follows: if it is likely that most DMA slave controllers in 345 * follows: if it is likely that more than one DMA slave controllers in
346 * the world will support the configuration option, then make it 346 * the world will support the configuration option, then make it generic.
347 * generic. If not: if it is fixed so that it be sent in static from 347 * If not: if it is fixed so that it be sent in static from the platform
348 * the platform data, then prefer to do that. Else, if it is neither 348 * data, then prefer to do that.
349 * fixed at runtime, nor generic enough (such as bus mastership on
350 * some CPU family and whatnot) then create a custom slave config
351 * struct and pass that, then make this config a member of that
352 * struct, if applicable.
353 */ 349 */
354struct dma_slave_config { 350struct dma_slave_config {
355 enum dma_transfer_direction direction; 351 enum dma_transfer_direction direction;
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index eccb0c0c6cf6..23c8db129560 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -25,6 +25,8 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27#include <linux/irqreturn.h> 27#include <linux/irqreturn.h>
28#include <linux/rwsem.h>
29#include <linux/rcupdate.h>
28 30
29struct acpi_dmar_header; 31struct acpi_dmar_header;
30 32
@@ -34,13 +36,19 @@ struct acpi_dmar_header;
34 36
35struct intel_iommu; 37struct intel_iommu;
36 38
39struct dmar_dev_scope {
40 struct device __rcu *dev;
41 u8 bus;
42 u8 devfn;
43};
44
37#ifdef CONFIG_DMAR_TABLE 45#ifdef CONFIG_DMAR_TABLE
38extern struct acpi_table_header *dmar_tbl; 46extern struct acpi_table_header *dmar_tbl;
39struct dmar_drhd_unit { 47struct dmar_drhd_unit {
40 struct list_head list; /* list of drhd units */ 48 struct list_head list; /* list of drhd units */
41 struct acpi_dmar_header *hdr; /* ACPI header */ 49 struct acpi_dmar_header *hdr; /* ACPI header */
42 u64 reg_base_addr; /* register base address*/ 50 u64 reg_base_addr; /* register base address*/
43 struct pci_dev **devices; /* target device array */ 51 struct dmar_dev_scope *devices;/* target device array */
44 int devices_cnt; /* target device count */ 52 int devices_cnt; /* target device count */
45 u16 segment; /* PCI domain */ 53 u16 segment; /* PCI domain */
46 u8 ignored:1; /* ignore drhd */ 54 u8 ignored:1; /* ignore drhd */
@@ -48,33 +56,66 @@ struct dmar_drhd_unit {
48 struct intel_iommu *iommu; 56 struct intel_iommu *iommu;
49}; 57};
50 58
59struct dmar_pci_notify_info {
60 struct pci_dev *dev;
61 unsigned long event;
62 int bus;
63 u16 seg;
64 u16 level;
65 struct acpi_dmar_pci_path path[];
66} __attribute__((packed));
67
68extern struct rw_semaphore dmar_global_lock;
51extern struct list_head dmar_drhd_units; 69extern struct list_head dmar_drhd_units;
52 70
53#define for_each_drhd_unit(drhd) \ 71#define for_each_drhd_unit(drhd) \
54 list_for_each_entry(drhd, &dmar_drhd_units, list) 72 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list)
55 73
56#define for_each_active_drhd_unit(drhd) \ 74#define for_each_active_drhd_unit(drhd) \
57 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 75 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
58 if (drhd->ignored) {} else 76 if (drhd->ignored) {} else
59 77
60#define for_each_active_iommu(i, drhd) \ 78#define for_each_active_iommu(i, drhd) \
61 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 79 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
62 if (i=drhd->iommu, drhd->ignored) {} else 80 if (i=drhd->iommu, drhd->ignored) {} else
63 81
64#define for_each_iommu(i, drhd) \ 82#define for_each_iommu(i, drhd) \
65 list_for_each_entry(drhd, &dmar_drhd_units, list) \ 83 list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
66 if (i=drhd->iommu, 0) {} else 84 if (i=drhd->iommu, 0) {} else
67 85
86static inline bool dmar_rcu_check(void)
87{
88 return rwsem_is_locked(&dmar_global_lock) ||
89 system_state == SYSTEM_BOOTING;
90}
91
92#define dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
93
94#define for_each_dev_scope(a, c, p, d) \
95 for ((p) = 0; ((d) = (p) < (c) ? dmar_rcu_dereference((a)[(p)].dev) : \
96 NULL, (p) < (c)); (p)++)
97
98#define for_each_active_dev_scope(a, c, p, d) \
99 for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else
100
68extern int dmar_table_init(void); 101extern int dmar_table_init(void);
69extern int dmar_dev_scope_init(void); 102extern int dmar_dev_scope_init(void);
70extern int dmar_parse_dev_scope(void *start, void *end, int *cnt, 103extern int dmar_parse_dev_scope(void *start, void *end, int *cnt,
71 struct pci_dev ***devices, u16 segment); 104 struct dmar_dev_scope **devices, u16 segment);
72extern void dmar_free_dev_scope(struct pci_dev ***devices, int *cnt); 105extern void *dmar_alloc_dev_scope(void *start, void *end, int *cnt);
73 106extern void dmar_free_dev_scope(struct dmar_dev_scope **devices, int *cnt);
107extern int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,
108 void *start, void*end, u16 segment,
109 struct dmar_dev_scope *devices,
110 int devices_cnt);
111extern int dmar_remove_dev_scope(struct dmar_pci_notify_info *info,
112 u16 segment, struct dmar_dev_scope *devices,
113 int count);
74/* Intel IOMMU detection */ 114/* Intel IOMMU detection */
75extern int detect_intel_iommu(void); 115extern int detect_intel_iommu(void);
76extern int enable_drhd_fault_handling(void); 116extern int enable_drhd_fault_handling(void);
77#else 117#else
118struct dmar_pci_notify_info;
78static inline int detect_intel_iommu(void) 119static inline int detect_intel_iommu(void)
79{ 120{
80 return -ENODEV; 121 return -ENODEV;
@@ -138,30 +179,9 @@ extern int arch_setup_dmar_msi(unsigned int irq);
138 179
139#ifdef CONFIG_INTEL_IOMMU 180#ifdef CONFIG_INTEL_IOMMU
140extern int iommu_detected, no_iommu; 181extern int iommu_detected, no_iommu;
141extern struct list_head dmar_rmrr_units;
142struct dmar_rmrr_unit {
143 struct list_head list; /* list of rmrr units */
144 struct acpi_dmar_header *hdr; /* ACPI header */
145 u64 base_address; /* reserved base address*/
146 u64 end_address; /* reserved end address */
147 struct pci_dev **devices; /* target devices */
148 int devices_cnt; /* target device count */
149};
150
151#define for_each_rmrr_units(rmrr) \
152 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
153
154struct dmar_atsr_unit {
155 struct list_head list; /* list of ATSR units */
156 struct acpi_dmar_header *hdr; /* ACPI header */
157 struct pci_dev **devices; /* target devices */
158 int devices_cnt; /* target device count */
159 u8 include_all:1; /* include all ports */
160};
161
162int dmar_parse_rmrr_atsr_dev(void);
163extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header); 182extern int dmar_parse_one_rmrr(struct acpi_dmar_header *header);
164extern int dmar_parse_one_atsr(struct acpi_dmar_header *header); 183extern int dmar_parse_one_atsr(struct acpi_dmar_header *header);
184extern int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info);
165extern int intel_iommu_init(void); 185extern int intel_iommu_init(void);
166#else /* !CONFIG_INTEL_IOMMU: */ 186#else /* !CONFIG_INTEL_IOMMU: */
167static inline int intel_iommu_init(void) { return -ENODEV; } 187static inline int intel_iommu_init(void) { return -ENODEV; }
@@ -173,7 +193,7 @@ static inline int dmar_parse_one_atsr(struct acpi_dmar_header *header)
173{ 193{
174 return 0; 194 return 0;
175} 195}
176static inline int dmar_parse_rmrr_atsr_dev(void) 196static inline int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info)
177{ 197{
178 return 0; 198 return 0;
179} 199}
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index de7d74ab3de6..3dbe9bd57a09 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -327,12 +327,6 @@ enum drbd_state_rv {
327 SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */ 327 SS_AFTER_LAST_ERROR = -22, /* Keep this at bottom */
328}; 328};
329 329
330/* from drbd_strings.c */
331extern const char *drbd_conn_str(enum drbd_conns);
332extern const char *drbd_role_str(enum drbd_role);
333extern const char *drbd_disk_str(enum drbd_disk_state);
334extern const char *drbd_set_st_err_str(enum drbd_state_rv);
335
336#define SHARED_SECRET_MAX 64 330#define SHARED_SECRET_MAX 64
337 331
338#define MDF_CONSISTENT (1 << 0) 332#define MDF_CONSISTENT (1 << 0)
@@ -382,4 +376,6 @@ enum drbd_timeout_flag {
382#define DRBD_MD_INDEX_FLEX_EXT -2 376#define DRBD_MD_INDEX_FLEX_EXT -2
383#define DRBD_MD_INDEX_FLEX_INT -3 377#define DRBD_MD_INDEX_FLEX_INT -3
384 378
379#define DRBD_CPU_MASK_SIZE 32
380
385#endif 381#endif
diff --git a/include/linux/drbd_genl.h b/include/linux/drbd_genl.h
index e8c44572b8cb..4193f5f2636c 100644
--- a/include/linux/drbd_genl.h
+++ b/include/linux/drbd_genl.h
@@ -135,7 +135,7 @@ GENL_struct(DRBD_NLA_DISK_CONF, 3, disk_conf,
135) 135)
136 136
137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts, 137GENL_struct(DRBD_NLA_RESOURCE_OPTS, 4, res_opts,
138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, 32) 138 __str_field_def(1, DRBD_GENLA_F_MANDATORY, cpu_mask, DRBD_CPU_MASK_SIZE)
139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF) 139 __u32_field_def(2, DRBD_GENLA_F_MANDATORY, on_no_data, DRBD_ON_NO_DATA_DEF)
140) 140)
141 141
@@ -276,9 +276,9 @@ GENL_op(
276) 276)
277 277
278 /* add DRBD minor devices as volumes to resources */ 278 /* add DRBD minor devices as volumes to resources */
279GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_add_minor), 279GENL_op(DRBD_ADM_NEW_MINOR, 5, GENL_doit(drbd_adm_new_minor),
280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 280 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
281GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_delete_minor), 281GENL_op(DRBD_ADM_DEL_MINOR, 6, GENL_doit(drbd_adm_del_minor),
282 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED)) 282 GENL_tla_expected(DRBD_NLA_CFG_CONTEXT, DRBD_F_REQUIRED))
283 283
284 /* add or delete resources */ 284 /* add or delete resources */
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 481ab2345d6b..68b4024184de 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * Driver for the Synopsys DesignWare DMA Controller (aka DMACA on 2 * Driver for the Synopsys DesignWare DMA Controller
3 * AVR32 systems.)
4 * 3 *
5 * Copyright (C) 2007 Atmel Corporation 4 * Copyright (C) 2007 Atmel Corporation
6 * Copyright (C) 2010-2011 ST Microelectronics 5 * Copyright (C) 2010-2011 ST Microelectronics
@@ -44,8 +43,6 @@ struct dw_dma_slave {
44 * @nr_masters: Number of AHB masters supported by the controller 43 * @nr_masters: Number of AHB masters supported by the controller
45 * @data_width: Maximum data width supported by hardware per AHB master 44 * @data_width: Maximum data width supported by hardware per AHB master
46 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits) 45 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
47 * @sd: slave specific data. Used for configuring channels
48 * @sd_count: count of slave data structures passed.
49 */ 46 */
50struct dw_dma_platform_data { 47struct dw_dma_platform_data {
51 unsigned int nr_channels; 48 unsigned int nr_channels;
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 306dd8cd0b6f..df63bd3a8cf1 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -202,17 +202,8 @@ enum {
202#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq)) 202#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
203#define rb_entry_rq(node) rb_entry((node), struct request, rb_node) 203#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
204 204
205/*
206 * Hack to reuse the csd.list list_head as the fifo time holder while
207 * the request is in the io scheduler. Saves an unsigned long in rq.
208 */
209#define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next)
210#define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp))
211#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) 205#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
212#define rq_fifo_clear(rq) do { \ 206#define rq_fifo_clear(rq) list_del_init(&(rq)->queuelist)
213 list_del_init(&(rq)->queuelist); \
214 INIT_LIST_HEAD(&(rq)->csd.list); \
215 } while (0)
216 207
217#else /* CONFIG_BLOCK */ 208#else /* CONFIG_BLOCK */
218 209
diff --git a/include/linux/err.h b/include/linux/err.h
index 15f92e072450..a729120644d5 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -2,12 +2,13 @@
2#define _LINUX_ERR_H 2#define _LINUX_ERR_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
6#include <asm/errno.h> 7#include <asm/errno.h>
7 8
8/* 9/*
9 * Kernel pointers have redundant information, so we can use a 10 * Kernel pointers have redundant information, so we can use a
10 * scheme where we can return either an error code or a dentry 11 * scheme where we can return either an error code or a normal
11 * pointer with the same return value. 12 * pointer with the same return value.
12 * 13 *
13 * This should be a per-architecture thing, to allow different 14 * This should be a per-architecture thing, to allow different
@@ -29,12 +30,12 @@ static inline long __must_check PTR_ERR(__force const void *ptr)
29 return (long) ptr; 30 return (long) ptr;
30} 31}
31 32
32static inline long __must_check IS_ERR(__force const void *ptr) 33static inline bool __must_check IS_ERR(__force const void *ptr)
33{ 34{
34 return IS_ERR_VALUE((unsigned long)ptr); 35 return IS_ERR_VALUE((unsigned long)ptr);
35} 36}
36 37
37static inline long __must_check IS_ERR_OR_NULL(__force const void *ptr) 38static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
38{ 39{
39 return !ptr || IS_ERR_VALUE((unsigned long)ptr); 40 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
40} 41}
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c8e3e7e39c6b..0a114d05f68d 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -183,6 +183,9 @@ static inline u32 ethtool_rxfh_indir_default(u32 index, u32 n_rx_rings)
183 * hold the RTNL lock. 183 * hold the RTNL lock.
184 * 184 *
185 * See the structures used by these operations for further documentation. 185 * See the structures used by these operations for further documentation.
186 * Note that for all operations using a structure ending with a zero-
187 * length array, the array is allocated separately in the kernel and
188 * is passed to the driver as an additional parameter.
186 * 189 *
187 * See &struct net_device and &struct net_device_ops for documentation 190 * See &struct net_device and &struct net_device_ops for documentation
188 * of the generic netdev features interface. 191 * of the generic netdev features interface.
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 21c59af1150b..f488145bb2d4 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -240,6 +240,12 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
240 struct notifier_block *nb); 240 struct notifier_block *nb);
241extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
242 struct notifier_block *nb); 242 struct notifier_block *nb);
243
244/*
245 * Following API get the extcon device from devicetree.
246 * This function use phandle of devicetree to get extcon device directly.
247 */
248extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index);
243#else /* CONFIG_EXTCON */ 249#else /* CONFIG_EXTCON */
244static inline int extcon_dev_register(struct extcon_dev *edev) 250static inline int extcon_dev_register(struct extcon_dev *edev)
245{ 251{
@@ -324,5 +330,11 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb
324{ 330{
325 return 0; 331 return 0;
326} 332}
333
334static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev,
335 int index)
336{
337 return ERR_PTR(-ENODEV);
338}
327#endif /* CONFIG_EXTCON */ 339#endif /* CONFIG_EXTCON */
328#endif /* __LINUX_EXTCON_H__ */ 340#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/of_extcon.h b/include/linux/extcon/of_extcon.h
deleted file mode 100644
index 0ebfeff1b55d..000000000000
--- a/include/linux/extcon/of_extcon.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * OF helpers for External connector (extcon) framework
3 *
4 * Copyright (C) 2013 Texas Instruments, Inc.
5 * Kishon Vijay Abraham I <kishon@ti.com>
6 *
7 * Copyright (C) 2013 Samsung Electronics
8 * Chanwoo Choi <cw00.choi@samsung.com>
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 __LINUX_OF_EXTCON_H
17#define __LINUX_OF_EXTCON_H
18
19#include <linux/err.h>
20
21#if IS_ENABLED(CONFIG_OF_EXTCON)
22extern struct extcon_dev
23 *of_extcon_get_extcon_dev(struct device *dev, int index);
24#else
25static inline struct extcon_dev
26 *of_extcon_get_extcon_dev(struct device *dev, int index)
27{
28 return ERR_PTR(-ENOSYS);
29}
30#endif /* CONFIG_OF_EXTCON */
31#endif /* __LINUX_OF_EXTCON_H */
diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
index da74d878dc4f..df53e1753a76 100644
--- a/include/linux/f2fs_fs.h
+++ b/include/linux/f2fs_fs.h
@@ -183,7 +183,7 @@ struct f2fs_inode {
183 __le32 i_pino; /* parent inode number */ 183 __le32 i_pino; /* parent inode number */
184 __le32 i_namelen; /* file name length */ 184 __le32 i_namelen; /* file name length */
185 __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */ 185 __u8 i_name[F2FS_NAME_LEN]; /* file name for SPOR */
186 __u8 i_reserved2; /* for backward compatibility */ 186 __u8 i_dir_level; /* dentry_level for large dir */
187 187
188 struct f2fs_extent i_ext; /* caching a largest extent */ 188 struct f2fs_extent i_ext; /* caching a largest extent */
189 189
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 70e8e21c0a30..230f87bdf5ad 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -63,8 +63,6 @@ struct file_operations;
63struct vfsmount; 63struct vfsmount;
64struct dentry; 64struct dentry;
65 65
66extern void __init files_defer_init(void);
67
68#define rcu_dereference_check_fdtable(files, fdtfd) \ 66#define rcu_dereference_check_fdtable(files, fdtfd) \
69 rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock)) 67 rcu_dereference_check((fdtfd), lockdep_is_held(&(files)->file_lock))
70 68
diff --git a/include/linux/filter.h b/include/linux/filter.h
index e568c8ef896b..262dcbb75ffe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -9,28 +9,81 @@
9#include <linux/workqueue.h> 9#include <linux/workqueue.h>
10#include <uapi/linux/filter.h> 10#include <uapi/linux/filter.h>
11 11
12#ifdef CONFIG_COMPAT 12/* Internally used and optimized filter representation with extended
13/* 13 * instruction set based on top of classic BPF.
14 * A struct sock_filter is architecture independent.
15 */ 14 */
15
16/* instruction classes */
17#define BPF_ALU64 0x07 /* alu mode in double word width */
18
19/* ld/ldx fields */
20#define BPF_DW 0x18 /* double word */
21#define BPF_XADD 0xc0 /* exclusive add */
22
23/* alu/jmp fields */
24#define BPF_MOV 0xb0 /* mov reg to reg */
25#define BPF_ARSH 0xc0 /* sign extending arithmetic shift right */
26
27/* change endianness of a register */
28#define BPF_END 0xd0 /* flags for endianness conversion: */
29#define BPF_TO_LE 0x00 /* convert to little-endian */
30#define BPF_TO_BE 0x08 /* convert to big-endian */
31#define BPF_FROM_LE BPF_TO_LE
32#define BPF_FROM_BE BPF_TO_BE
33
34#define BPF_JNE 0x50 /* jump != */
35#define BPF_JSGT 0x60 /* SGT is signed '>', GT in x86 */
36#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
37#define BPF_CALL 0x80 /* function call */
38#define BPF_EXIT 0x90 /* function return */
39
40/* BPF has 10 general purpose 64-bit registers and stack frame. */
41#define MAX_BPF_REG 11
42
43/* BPF program can access up to 512 bytes of stack space. */
44#define MAX_BPF_STACK 512
45
46/* Arg1, context and stack frame pointer register positions. */
47#define ARG1_REG 1
48#define CTX_REG 6
49#define FP_REG 10
50
51struct sock_filter_int {
52 __u8 code; /* opcode */
53 __u8 a_reg:4; /* dest register */
54 __u8 x_reg:4; /* source register */
55 __s16 off; /* signed offset */
56 __s32 imm; /* signed immediate constant */
57};
58
59#ifdef CONFIG_COMPAT
60/* A struct sock_filter is architecture independent. */
16struct compat_sock_fprog { 61struct compat_sock_fprog {
17 u16 len; 62 u16 len;
18 compat_uptr_t filter; /* struct sock_filter * */ 63 compat_uptr_t filter; /* struct sock_filter * */
19}; 64};
20#endif 65#endif
21 66
67struct sock_fprog_kern {
68 u16 len;
69 struct sock_filter *filter;
70};
71
22struct sk_buff; 72struct sk_buff;
23struct sock; 73struct sock;
74struct seccomp_data;
24 75
25struct sk_filter 76struct sk_filter {
26{
27 atomic_t refcnt; 77 atomic_t refcnt;
28 unsigned int len; /* Number of filter blocks */ 78 u32 jited:1, /* Is our filter JIT'ed? */
79 len:31; /* Number of filter blocks */
80 struct sock_fprog_kern *orig_prog; /* Original BPF program */
29 struct rcu_head rcu; 81 struct rcu_head rcu;
30 unsigned int (*bpf_func)(const struct sk_buff *skb, 82 unsigned int (*bpf_func)(const struct sk_buff *skb,
31 const struct sock_filter *filter); 83 const struct sock_filter_int *filter);
32 union { 84 union {
33 struct sock_filter insns[0]; 85 struct sock_filter insns[0];
86 struct sock_filter_int insnsi[0];
34 struct work_struct work; 87 struct work_struct work;
35 }; 88 };
36}; 89};
@@ -41,25 +94,44 @@ static inline unsigned int sk_filter_size(unsigned int proglen)
41 offsetof(struct sk_filter, insns[proglen])); 94 offsetof(struct sk_filter, insns[proglen]));
42} 95}
43 96
44extern int sk_filter(struct sock *sk, struct sk_buff *skb); 97#define sk_filter_proglen(fprog) \
45extern unsigned int sk_run_filter(const struct sk_buff *skb, 98 (fprog->len * sizeof(fprog->filter[0]))
46 const struct sock_filter *filter); 99
47extern int sk_unattached_filter_create(struct sk_filter **pfp, 100#define SK_RUN_FILTER(filter, ctx) \
48 struct sock_fprog *fprog); 101 (*filter->bpf_func)(ctx, filter->insnsi)
49extern void sk_unattached_filter_destroy(struct sk_filter *fp); 102
50extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 103int sk_filter(struct sock *sk, struct sk_buff *skb);
51extern int sk_detach_filter(struct sock *sk); 104
52extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen); 105u32 sk_run_filter_int_seccomp(const struct seccomp_data *ctx,
53extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len); 106 const struct sock_filter_int *insni);
54extern void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to); 107u32 sk_run_filter_int_skb(const struct sk_buff *ctx,
108 const struct sock_filter_int *insni);
109
110int sk_convert_filter(struct sock_filter *prog, int len,
111 struct sock_filter_int *new_prog, int *new_len);
112
113int sk_unattached_filter_create(struct sk_filter **pfp,
114 struct sock_fprog *fprog);
115void sk_unattached_filter_destroy(struct sk_filter *fp);
116
117int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
118int sk_detach_filter(struct sock *sk);
119
120int sk_chk_filter(struct sock_filter *filter, unsigned int flen);
121int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
122 unsigned int len);
123void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to);
124
125void sk_filter_charge(struct sock *sk, struct sk_filter *fp);
126void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp);
55 127
56#ifdef CONFIG_BPF_JIT 128#ifdef CONFIG_BPF_JIT
57#include <stdarg.h> 129#include <stdarg.h>
58#include <linux/linkage.h> 130#include <linux/linkage.h>
59#include <linux/printk.h> 131#include <linux/printk.h>
60 132
61extern void bpf_jit_compile(struct sk_filter *fp); 133void bpf_jit_compile(struct sk_filter *fp);
62extern void bpf_jit_free(struct sk_filter *fp); 134void bpf_jit_free(struct sk_filter *fp);
63 135
64static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, 136static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
65 u32 pass, void *image) 137 u32 pass, void *image)
@@ -70,7 +142,6 @@ static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen,
70 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET, 142 print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_OFFSET,
71 16, 1, image, proglen, false); 143 16, 1, image, proglen, false);
72} 144}
73#define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)
74#else 145#else
75#include <linux/slab.h> 146#include <linux/slab.h>
76static inline void bpf_jit_compile(struct sk_filter *fp) 147static inline void bpf_jit_compile(struct sk_filter *fp)
@@ -80,7 +151,6 @@ static inline void bpf_jit_free(struct sk_filter *fp)
80{ 151{
81 kfree(fp); 152 kfree(fp);
82} 153}
83#define SK_RUN_FILTER(FILTER, SKB) sk_run_filter(SKB, FILTER->insns)
84#endif 154#endif
85 155
86static inline int bpf_tell_extensions(void) 156static inline int bpf_tell_extensions(void)
diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h
index 1974317a9b3d..599bd6bab56d 100644
--- a/include/linux/fmc-sdb.h
+++ b/include/linux/fmc-sdb.h
@@ -14,6 +14,8 @@ union sdb_record {
14 struct sdb_bridge bridge; 14 struct sdb_bridge bridge;
15 struct sdb_integration integr; 15 struct sdb_integration integr;
16 struct sdb_empty empty; 16 struct sdb_empty empty;
17 struct sdb_synthesis synthesis;
18 struct sdb_repo_url repo_url;
17}; 19};
18 20
19struct fmc_device; 21struct fmc_device;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 23b2a35d712e..7a9c5bca2b76 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -48,6 +48,7 @@ struct cred;
48struct swap_info_struct; 48struct swap_info_struct;
49struct seq_file; 49struct seq_file;
50struct workqueue_struct; 50struct workqueue_struct;
51struct iov_iter;
51 52
52extern void __init inode_init(void); 53extern void __init inode_init(void);
53extern void __init inode_init_early(void); 54extern void __init inode_init_early(void);
@@ -125,6 +126,8 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
125 126
126/* File needs atomic accesses to f_pos */ 127/* File needs atomic accesses to f_pos */
127#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000) 128#define FMODE_ATOMIC_POS ((__force fmode_t)0x8000)
129/* Write access to underlying fs */
130#define FMODE_WRITER ((__force fmode_t)0x10000)
128 131
129/* File was opened by fanotify and shouldn't generate fanotify events */ 132/* File was opened by fanotify and shouldn't generate fanotify events */
130#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 133#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
@@ -293,38 +296,6 @@ struct page;
293struct address_space; 296struct address_space;
294struct writeback_control; 297struct writeback_control;
295 298
296struct iov_iter {
297 const struct iovec *iov;
298 unsigned long nr_segs;
299 size_t iov_offset;
300 size_t count;
301};
302
303size_t iov_iter_copy_from_user_atomic(struct page *page,
304 struct iov_iter *i, unsigned long offset, size_t bytes);
305size_t iov_iter_copy_from_user(struct page *page,
306 struct iov_iter *i, unsigned long offset, size_t bytes);
307void iov_iter_advance(struct iov_iter *i, size_t bytes);
308int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
309size_t iov_iter_single_seg_count(const struct iov_iter *i);
310
311static inline void iov_iter_init(struct iov_iter *i,
312 const struct iovec *iov, unsigned long nr_segs,
313 size_t count, size_t written)
314{
315 i->iov = iov;
316 i->nr_segs = nr_segs;
317 i->iov_offset = 0;
318 i->count = count + written;
319
320 iov_iter_advance(i, written);
321}
322
323static inline size_t iov_iter_count(struct iov_iter *i)
324{
325 return i->count;
326}
327
328/* 299/*
329 * "descriptor" for what we're up to with a read. 300 * "descriptor" for what we're up to with a read.
330 * This allows us to use the same read code yet 301 * This allows us to use the same read code yet
@@ -383,7 +354,7 @@ struct address_space_operations {
383 int (*migratepage) (struct address_space *, 354 int (*migratepage) (struct address_space *,
384 struct page *, struct page *, enum migrate_mode); 355 struct page *, struct page *, enum migrate_mode);
385 int (*launder_page) (struct page *); 356 int (*launder_page) (struct page *);
386 int (*is_partially_uptodate) (struct page *, read_descriptor_t *, 357 int (*is_partially_uptodate) (struct page *, unsigned long,
387 unsigned long); 358 unsigned long);
388 void (*is_dirty_writeback) (struct page *, bool *, bool *); 359 void (*is_dirty_writeback) (struct page *, bool *, bool *);
389 int (*error_remove_page)(struct address_space *, struct page *); 360 int (*error_remove_page)(struct address_space *, struct page *);
@@ -419,6 +390,7 @@ struct address_space {
419 struct mutex i_mmap_mutex; /* protect tree, count, list */ 390 struct mutex i_mmap_mutex; /* protect tree, count, list */
420 /* Protected by tree_lock together with the radix tree */ 391 /* Protected by tree_lock together with the radix tree */
421 unsigned long nrpages; /* number of total pages */ 392 unsigned long nrpages; /* number of total pages */
393 unsigned long nrshadows; /* number of shadow entries */
422 pgoff_t writeback_index;/* writeback starts here */ 394 pgoff_t writeback_index;/* writeback starts here */
423 const struct address_space_operations *a_ops; /* methods */ 395 const struct address_space_operations *a_ops; /* methods */
424 unsigned long flags; /* error bits/gfp mask */ 396 unsigned long flags; /* error bits/gfp mask */
@@ -589,6 +561,9 @@ struct inode {
589 atomic_t i_count; 561 atomic_t i_count;
590 atomic_t i_dio_count; 562 atomic_t i_dio_count;
591 atomic_t i_writecount; 563 atomic_t i_writecount;
564#ifdef CONFIG_IMA
565 atomic_t i_readcount; /* struct files open RO */
566#endif
592 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */ 567 const struct file_operations *i_fop; /* former ->i_op->default_file_ops */
593 struct file_lock *i_flock; 568 struct file_lock *i_flock;
594 struct address_space i_data; 569 struct address_space i_data;
@@ -609,9 +584,6 @@ struct inode {
609 struct hlist_head i_fsnotify_marks; 584 struct hlist_head i_fsnotify_marks;
610#endif 585#endif
611 586
612#ifdef CONFIG_IMA
613 atomic_t i_readcount; /* struct files open RO */
614#endif
615 void *i_private; /* fs or device private pointer */ 587 void *i_private; /* fs or device private pointer */
616}; 588};
617 589
@@ -769,9 +741,6 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
769 index < ra->start + ra->size); 741 index < ra->start + ra->size);
770} 742}
771 743
772#define FILE_MNT_WRITE_TAKEN 1
773#define FILE_MNT_WRITE_RELEASED 2
774
775struct file { 744struct file {
776 union { 745 union {
777 struct llist_node fu_llist; 746 struct llist_node fu_llist;
@@ -809,9 +778,6 @@ struct file {
809 struct list_head f_tfile_llink; 778 struct list_head f_tfile_llink;
810#endif /* #ifdef CONFIG_EPOLL */ 779#endif /* #ifdef CONFIG_EPOLL */
811 struct address_space *f_mapping; 780 struct address_space *f_mapping;
812#ifdef CONFIG_DEBUG_WRITECOUNT
813 unsigned long f_mnt_write_state;
814#endif
815} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 781} __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */
816 782
817struct file_handle { 783struct file_handle {
@@ -829,49 +795,6 @@ static inline struct file *get_file(struct file *f)
829#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 795#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
830#define file_count(x) atomic_long_read(&(x)->f_count) 796#define file_count(x) atomic_long_read(&(x)->f_count)
831 797
832#ifdef CONFIG_DEBUG_WRITECOUNT
833static inline void file_take_write(struct file *f)
834{
835 WARN_ON(f->f_mnt_write_state != 0);
836 f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN;
837}
838static inline void file_release_write(struct file *f)
839{
840 f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED;
841}
842static inline void file_reset_write(struct file *f)
843{
844 f->f_mnt_write_state = 0;
845}
846static inline void file_check_state(struct file *f)
847{
848 /*
849 * At this point, either both or neither of these bits
850 * should be set.
851 */
852 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN);
853 WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED);
854}
855static inline int file_check_writeable(struct file *f)
856{
857 if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN)
858 return 0;
859 printk(KERN_WARNING "writeable file with no "
860 "mnt_want_write()\n");
861 WARN_ON(1);
862 return -EINVAL;
863}
864#else /* !CONFIG_DEBUG_WRITECOUNT */
865static inline void file_take_write(struct file *filp) {}
866static inline void file_release_write(struct file *filp) {}
867static inline void file_reset_write(struct file *filp) {}
868static inline void file_check_state(struct file *filp) {}
869static inline int file_check_writeable(struct file *filp)
870{
871 return 0;
872}
873#endif /* CONFIG_DEBUG_WRITECOUNT */
874
875#define MAX_NON_LFS ((1UL<<31) - 1) 798#define MAX_NON_LFS ((1UL<<31) - 1)
876 799
877/* Page cache limit. The filesystems should put that into their s_maxbytes 800/* Page cache limit. The filesystems should put that into their s_maxbytes
@@ -892,6 +815,7 @@ static inline int file_check_writeable(struct file *filp)
892#define FL_SLEEP 128 /* A blocking lock */ 815#define FL_SLEEP 128 /* A blocking lock */
893#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */ 816#define FL_DOWNGRADE_PENDING 256 /* Lease is being downgraded */
894#define FL_UNLOCK_PENDING 512 /* Lease is being broken */ 817#define FL_UNLOCK_PENDING 512 /* Lease is being broken */
818#define FL_FILE_PVT 1024 /* lock is private to the file */
895 819
896/* 820/*
897 * Special return value from posix_lock_file() and vfs_lock_file() for 821 * Special return value from posix_lock_file() and vfs_lock_file() for
@@ -996,12 +920,12 @@ struct file_lock {
996extern void send_sigio(struct fown_struct *fown, int fd, int band); 920extern void send_sigio(struct fown_struct *fown, int fd, int band);
997 921
998#ifdef CONFIG_FILE_LOCKING 922#ifdef CONFIG_FILE_LOCKING
999extern int fcntl_getlk(struct file *, struct flock __user *); 923extern int fcntl_getlk(struct file *, unsigned int, struct flock __user *);
1000extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 924extern int fcntl_setlk(unsigned int, struct file *, unsigned int,
1001 struct flock __user *); 925 struct flock __user *);
1002 926
1003#if BITS_PER_LONG == 32 927#if BITS_PER_LONG == 32
1004extern int fcntl_getlk64(struct file *, struct flock64 __user *); 928extern int fcntl_getlk64(struct file *, unsigned int, struct flock64 __user *);
1005extern int fcntl_setlk64(unsigned int, struct file *, unsigned int, 929extern int fcntl_setlk64(unsigned int, struct file *, unsigned int,
1006 struct flock64 __user *); 930 struct flock64 __user *);
1007#endif 931#endif
@@ -1016,7 +940,7 @@ extern struct file_lock * locks_alloc_lock(void);
1016extern void locks_copy_lock(struct file_lock *, struct file_lock *); 940extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1017extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 941extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
1018extern void locks_remove_posix(struct file *, fl_owner_t); 942extern void locks_remove_posix(struct file *, fl_owner_t);
1019extern void locks_remove_flock(struct file *); 943extern void locks_remove_file(struct file *);
1020extern void locks_release_private(struct file_lock *); 944extern void locks_release_private(struct file_lock *);
1021extern void posix_test_lock(struct file *, struct file_lock *); 945extern void posix_test_lock(struct file *, struct file_lock *);
1022extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 946extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
@@ -1034,7 +958,8 @@ extern int lease_modify(struct file_lock **, int);
1034extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 958extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1035extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 959extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1036#else /* !CONFIG_FILE_LOCKING */ 960#else /* !CONFIG_FILE_LOCKING */
1037static inline int fcntl_getlk(struct file *file, struct flock __user *user) 961static inline int fcntl_getlk(struct file *file, unsigned int cmd,
962 struct flock __user *user)
1038{ 963{
1039 return -EINVAL; 964 return -EINVAL;
1040} 965}
@@ -1046,7 +971,8 @@ static inline int fcntl_setlk(unsigned int fd, struct file *file,
1046} 971}
1047 972
1048#if BITS_PER_LONG == 32 973#if BITS_PER_LONG == 32
1049static inline int fcntl_getlk64(struct file *file, struct flock64 __user *user) 974static inline int fcntl_getlk64(struct file *file, unsigned int cmd,
975 struct flock64 __user *user)
1050{ 976{
1051 return -EINVAL; 977 return -EINVAL;
1052} 978}
@@ -1087,7 +1013,7 @@ static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
1087 return; 1013 return;
1088} 1014}
1089 1015
1090static inline void locks_remove_flock(struct file *filp) 1016static inline void locks_remove_file(struct file *filp)
1091{ 1017{
1092 return; 1018 return;
1093} 1019}
@@ -1460,7 +1386,7 @@ extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1460extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **); 1386extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct inode **);
1461extern int vfs_rmdir(struct inode *, struct dentry *); 1387extern int vfs_rmdir(struct inode *, struct dentry *);
1462extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1388extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1463extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **); 1389extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1464 1390
1465/* 1391/*
1466 * VFS dentry helper functions. 1392 * VFS dentry helper functions.
@@ -1571,6 +1497,8 @@ struct inode_operations {
1571 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t); 1497 int (*mknod) (struct inode *,struct dentry *,umode_t,dev_t);
1572 int (*rename) (struct inode *, struct dentry *, 1498 int (*rename) (struct inode *, struct dentry *,
1573 struct inode *, struct dentry *); 1499 struct inode *, struct dentry *);
1500 int (*rename2) (struct inode *, struct dentry *,
1501 struct inode *, struct dentry *, unsigned int);
1574 int (*setattr) (struct dentry *, struct iattr *); 1502 int (*setattr) (struct dentry *, struct iattr *);
1575 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1503 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1576 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1504 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1913,6 +1841,11 @@ extern int current_umask(void);
1913extern void ihold(struct inode * inode); 1841extern void ihold(struct inode * inode);
1914extern void iput(struct inode *); 1842extern void iput(struct inode *);
1915 1843
1844static inline struct inode *file_inode(struct file *f)
1845{
1846 return f->f_inode;
1847}
1848
1916/* /sys/fs */ 1849/* /sys/fs */
1917extern struct kobject *fs_kobj; 1850extern struct kobject *fs_kobj;
1918 1851
@@ -1922,7 +1855,7 @@ extern struct kobject *fs_kobj;
1922#define FLOCK_VERIFY_WRITE 2 1855#define FLOCK_VERIFY_WRITE 2
1923 1856
1924#ifdef CONFIG_FILE_LOCKING 1857#ifdef CONFIG_FILE_LOCKING
1925extern int locks_mandatory_locked(struct inode *); 1858extern int locks_mandatory_locked(struct file *);
1926extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t); 1859extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
1927 1860
1928/* 1861/*
@@ -1945,10 +1878,10 @@ static inline int mandatory_lock(struct inode *ino)
1945 return IS_MANDLOCK(ino) && __mandatory_lock(ino); 1878 return IS_MANDLOCK(ino) && __mandatory_lock(ino);
1946} 1879}
1947 1880
1948static inline int locks_verify_locked(struct inode *inode) 1881static inline int locks_verify_locked(struct file *file)
1949{ 1882{
1950 if (mandatory_lock(inode)) 1883 if (mandatory_lock(file_inode(file)))
1951 return locks_mandatory_locked(inode); 1884 return locks_mandatory_locked(file);
1952 return 0; 1885 return 0;
1953} 1886}
1954 1887
@@ -1968,6 +1901,12 @@ static inline int locks_verify_truncate(struct inode *inode,
1968 1901
1969static inline int break_lease(struct inode *inode, unsigned int mode) 1902static inline int break_lease(struct inode *inode, unsigned int mode)
1970{ 1903{
1904 /*
1905 * Since this check is lockless, we must ensure that any refcounts
1906 * taken are done before checking inode->i_flock. Otherwise, we could
1907 * end up racing with tasks trying to set a new lease on this file.
1908 */
1909 smp_mb();
1971 if (inode->i_flock) 1910 if (inode->i_flock)
1972 return __break_lease(inode, mode, FL_LEASE); 1911 return __break_lease(inode, mode, FL_LEASE);
1973 return 0; 1912 return 0;
@@ -2003,7 +1942,7 @@ static inline int break_deleg_wait(struct inode **delegated_inode)
2003} 1942}
2004 1943
2005#else /* !CONFIG_FILE_LOCKING */ 1944#else /* !CONFIG_FILE_LOCKING */
2006static inline int locks_mandatory_locked(struct inode *inode) 1945static inline int locks_mandatory_locked(struct file *file)
2007{ 1946{
2008 return 0; 1947 return 0;
2009} 1948}
@@ -2025,7 +1964,7 @@ static inline int mandatory_lock(struct inode *inode)
2025 return 0; 1964 return 0;
2026} 1965}
2027 1966
2028static inline int locks_verify_locked(struct inode *inode) 1967static inline int locks_verify_locked(struct file *file)
2029{ 1968{
2030 return 0; 1969 return 0;
2031} 1970}
@@ -2299,11 +2238,6 @@ static inline bool execute_ok(struct inode *inode)
2299 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); 2238 return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
2300} 2239}
2301 2240
2302static inline struct inode *file_inode(struct file *f)
2303{
2304 return f->f_inode;
2305}
2306
2307static inline void file_start_write(struct file *file) 2241static inline void file_start_write(struct file *file)
2308{ 2242{
2309 if (!S_ISREG(file_inode(file)->i_mode)) 2243 if (!S_ISREG(file_inode(file)->i_mode))
@@ -2469,16 +2403,13 @@ extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2469extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2403extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2470extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr, 2404extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2471 unsigned long size, pgoff_t pgoff); 2405 unsigned long size, pgoff_t pgoff);
2472extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2473int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2406int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2474extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2407extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2475extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, 2408extern ssize_t __generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long);
2476 loff_t *);
2477extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2409extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
2478extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *, 2410extern ssize_t generic_file_direct_write(struct kiocb *, const struct iovec *,
2479 unsigned long *, loff_t, loff_t *, size_t, size_t); 2411 unsigned long *, loff_t, size_t, size_t);
2480extern ssize_t generic_file_buffered_write(struct kiocb *, const struct iovec *, 2412extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2481 unsigned long, loff_t, loff_t *, size_t, ssize_t);
2482extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos); 2413extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos);
2483extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); 2414extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
2484extern int generic_segment_checks(const struct iovec *iov, 2415extern int generic_segment_checks(const struct iovec *iov,
@@ -2538,6 +2469,9 @@ enum {
2538 2469
2539 /* filesystem does not support filling holes */ 2470 /* filesystem does not support filling holes */
2540 DIO_SKIP_HOLES = 0x02, 2471 DIO_SKIP_HOLES = 0x02,
2472
2473 /* filesystem can handle aio writes beyond i_size */
2474 DIO_ASYNC_EXTEND = 0x04,
2541}; 2475};
2542 2476
2543void dio_end_io(struct bio *bio, int error); 2477void dio_end_io(struct bio *bio, int error);
@@ -2560,11 +2494,14 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2560void inode_dio_wait(struct inode *inode); 2494void inode_dio_wait(struct inode *inode);
2561void inode_dio_done(struct inode *inode); 2495void inode_dio_done(struct inode *inode);
2562 2496
2497extern void inode_set_flags(struct inode *inode, unsigned int flags,
2498 unsigned int mask);
2499
2563extern const struct file_operations generic_ro_fops; 2500extern const struct file_operations generic_ro_fops;
2564 2501
2565#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) 2502#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
2566 2503
2567extern int vfs_readlink(struct dentry *, char __user *, int, const char *); 2504extern int readlink_copy(char __user *, int, const char *);
2568extern int page_readlink(struct dentry *, char __user *, int); 2505extern int page_readlink(struct dentry *, char __user *, int);
2569extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2506extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2570extern void page_put_link(struct dentry *, struct nameidata *, void *); 2507extern void page_put_link(struct dentry *, struct nameidata *, void *);
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
new file mode 100644
index 000000000000..f49ddb1b2273
--- /dev/null
+++ b/include/linux/fsl_ifc.h
@@ -0,0 +1,838 @@
1/* Freescale Integrated Flash Controller
2 *
3 * Copyright 2011 Freescale Semiconductor, Inc
4 *
5 * Author: Dipen Dudhat <dipen.dudhat@freescale.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __ASM_FSL_IFC_H
23#define __ASM_FSL_IFC_H
24
25#include <linux/compiler.h>
26#include <linux/types.h>
27#include <linux/io.h>
28
29#include <linux/of_platform.h>
30#include <linux/interrupt.h>
31
32#define FSL_IFC_BANK_COUNT 4
33
34/*
35 * CSPR - Chip Select Property Register
36 */
37#define CSPR_BA 0xFFFF0000
38#define CSPR_BA_SHIFT 16
39#define CSPR_PORT_SIZE 0x00000180
40#define CSPR_PORT_SIZE_SHIFT 7
41/* Port Size 8 bit */
42#define CSPR_PORT_SIZE_8 0x00000080
43/* Port Size 16 bit */
44#define CSPR_PORT_SIZE_16 0x00000100
45/* Port Size 32 bit */
46#define CSPR_PORT_SIZE_32 0x00000180
47/* Write Protect */
48#define CSPR_WP 0x00000040
49#define CSPR_WP_SHIFT 6
50/* Machine Select */
51#define CSPR_MSEL 0x00000006
52#define CSPR_MSEL_SHIFT 1
53/* NOR */
54#define CSPR_MSEL_NOR 0x00000000
55/* NAND */
56#define CSPR_MSEL_NAND 0x00000002
57/* GPCM */
58#define CSPR_MSEL_GPCM 0x00000004
59/* Bank Valid */
60#define CSPR_V 0x00000001
61#define CSPR_V_SHIFT 0
62
63/*
64 * Address Mask Register
65 */
66#define IFC_AMASK_MASK 0xFFFF0000
67#define IFC_AMASK_SHIFT 16
68#define IFC_AMASK(n) (IFC_AMASK_MASK << \
69 (__ilog2(n) - IFC_AMASK_SHIFT))
70
71/*
72 * Chip Select Option Register IFC_NAND Machine
73 */
74/* Enable ECC Encoder */
75#define CSOR_NAND_ECC_ENC_EN 0x80000000
76#define CSOR_NAND_ECC_MODE_MASK 0x30000000
77/* 4 bit correction per 520 Byte sector */
78#define CSOR_NAND_ECC_MODE_4 0x00000000
79/* 8 bit correction per 528 Byte sector */
80#define CSOR_NAND_ECC_MODE_8 0x10000000
81/* Enable ECC Decoder */
82#define CSOR_NAND_ECC_DEC_EN 0x04000000
83/* Row Address Length */
84#define CSOR_NAND_RAL_MASK 0x01800000
85#define CSOR_NAND_RAL_SHIFT 20
86#define CSOR_NAND_RAL_1 0x00000000
87#define CSOR_NAND_RAL_2 0x00800000
88#define CSOR_NAND_RAL_3 0x01000000
89#define CSOR_NAND_RAL_4 0x01800000
90/* Page Size 512b, 2k, 4k */
91#define CSOR_NAND_PGS_MASK 0x00180000
92#define CSOR_NAND_PGS_SHIFT 16
93#define CSOR_NAND_PGS_512 0x00000000
94#define CSOR_NAND_PGS_2K 0x00080000
95#define CSOR_NAND_PGS_4K 0x00100000
96#define CSOR_NAND_PGS_8K 0x00180000
97/* Spare region Size */
98#define CSOR_NAND_SPRZ_MASK 0x0000E000
99#define CSOR_NAND_SPRZ_SHIFT 13
100#define CSOR_NAND_SPRZ_16 0x00000000
101#define CSOR_NAND_SPRZ_64 0x00002000
102#define CSOR_NAND_SPRZ_128 0x00004000
103#define CSOR_NAND_SPRZ_210 0x00006000
104#define CSOR_NAND_SPRZ_218 0x00008000
105#define CSOR_NAND_SPRZ_224 0x0000A000
106#define CSOR_NAND_SPRZ_CSOR_EXT 0x0000C000
107/* Pages Per Block */
108#define CSOR_NAND_PB_MASK 0x00000700
109#define CSOR_NAND_PB_SHIFT 8
110#define CSOR_NAND_PB(n) ((__ilog2(n) - 5) << CSOR_NAND_PB_SHIFT)
111/* Time for Read Enable High to Output High Impedance */
112#define CSOR_NAND_TRHZ_MASK 0x0000001C
113#define CSOR_NAND_TRHZ_SHIFT 2
114#define CSOR_NAND_TRHZ_20 0x00000000
115#define CSOR_NAND_TRHZ_40 0x00000004
116#define CSOR_NAND_TRHZ_60 0x00000008
117#define CSOR_NAND_TRHZ_80 0x0000000C
118#define CSOR_NAND_TRHZ_100 0x00000010
119/* Buffer control disable */
120#define CSOR_NAND_BCTLD 0x00000001
121
122/*
123 * Chip Select Option Register - NOR Flash Mode
124 */
125/* Enable Address shift Mode */
126#define CSOR_NOR_ADM_SHFT_MODE_EN 0x80000000
127/* Page Read Enable from NOR device */
128#define CSOR_NOR_PGRD_EN 0x10000000
129/* AVD Toggle Enable during Burst Program */
130#define CSOR_NOR_AVD_TGL_PGM_EN 0x01000000
131/* Address Data Multiplexing Shift */
132#define CSOR_NOR_ADM_MASK 0x0003E000
133#define CSOR_NOR_ADM_SHIFT_SHIFT 13
134#define CSOR_NOR_ADM_SHIFT(n) ((n) << CSOR_NOR_ADM_SHIFT_SHIFT)
135/* Type of the NOR device hooked */
136#define CSOR_NOR_NOR_MODE_AYSNC_NOR 0x00000000
137#define CSOR_NOR_NOR_MODE_AVD_NOR 0x00000020
138/* Time for Read Enable High to Output High Impedance */
139#define CSOR_NOR_TRHZ_MASK 0x0000001C
140#define CSOR_NOR_TRHZ_SHIFT 2
141#define CSOR_NOR_TRHZ_20 0x00000000
142#define CSOR_NOR_TRHZ_40 0x00000004
143#define CSOR_NOR_TRHZ_60 0x00000008
144#define CSOR_NOR_TRHZ_80 0x0000000C
145#define CSOR_NOR_TRHZ_100 0x00000010
146/* Buffer control disable */
147#define CSOR_NOR_BCTLD 0x00000001
148
149/*
150 * Chip Select Option Register - GPCM Mode
151 */
152/* GPCM Mode - Normal */
153#define CSOR_GPCM_GPMODE_NORMAL 0x00000000
154/* GPCM Mode - GenericASIC */
155#define CSOR_GPCM_GPMODE_ASIC 0x80000000
156/* Parity Mode odd/even */
157#define CSOR_GPCM_PARITY_EVEN 0x40000000
158/* Parity Checking enable/disable */
159#define CSOR_GPCM_PAR_EN 0x20000000
160/* GPCM Timeout Count */
161#define CSOR_GPCM_GPTO_MASK 0x0F000000
162#define CSOR_GPCM_GPTO_SHIFT 24
163#define CSOR_GPCM_GPTO(n) ((__ilog2(n) - 8) << CSOR_GPCM_GPTO_SHIFT)
164/* GPCM External Access Termination mode for read access */
165#define CSOR_GPCM_RGETA_EXT 0x00080000
166/* GPCM External Access Termination mode for write access */
167#define CSOR_GPCM_WGETA_EXT 0x00040000
168/* Address Data Multiplexing Shift */
169#define CSOR_GPCM_ADM_MASK 0x0003E000
170#define CSOR_GPCM_ADM_SHIFT_SHIFT 13
171#define CSOR_GPCM_ADM_SHIFT(n) ((n) << CSOR_GPCM_ADM_SHIFT_SHIFT)
172/* Generic ASIC Parity error indication delay */
173#define CSOR_GPCM_GAPERRD_MASK 0x00000180
174#define CSOR_GPCM_GAPERRD_SHIFT 7
175#define CSOR_GPCM_GAPERRD(n) (((n) - 1) << CSOR_GPCM_GAPERRD_SHIFT)
176/* Time for Read Enable High to Output High Impedance */
177#define CSOR_GPCM_TRHZ_MASK 0x0000001C
178#define CSOR_GPCM_TRHZ_20 0x00000000
179#define CSOR_GPCM_TRHZ_40 0x00000004
180#define CSOR_GPCM_TRHZ_60 0x00000008
181#define CSOR_GPCM_TRHZ_80 0x0000000C
182#define CSOR_GPCM_TRHZ_100 0x00000010
183/* Buffer control disable */
184#define CSOR_GPCM_BCTLD 0x00000001
185
186/*
187 * Ready Busy Status Register (RB_STAT)
188 */
189/* CSn is READY */
190#define IFC_RB_STAT_READY_CS0 0x80000000
191#define IFC_RB_STAT_READY_CS1 0x40000000
192#define IFC_RB_STAT_READY_CS2 0x20000000
193#define IFC_RB_STAT_READY_CS3 0x10000000
194
195/*
196 * General Control Register (GCR)
197 */
198#define IFC_GCR_MASK 0x8000F800
199/* reset all IFC hardware */
200#define IFC_GCR_SOFT_RST_ALL 0x80000000
201/* Turnaroud Time of external buffer */
202#define IFC_GCR_TBCTL_TRN_TIME 0x0000F800
203#define IFC_GCR_TBCTL_TRN_TIME_SHIFT 11
204
205/*
206 * Common Event and Error Status Register (CM_EVTER_STAT)
207 */
208/* Chip select error */
209#define IFC_CM_EVTER_STAT_CSER 0x80000000
210
211/*
212 * Common Event and Error Enable Register (CM_EVTER_EN)
213 */
214/* Chip select error checking enable */
215#define IFC_CM_EVTER_EN_CSEREN 0x80000000
216
217/*
218 * Common Event and Error Interrupt Enable Register (CM_EVTER_INTR_EN)
219 */
220/* Chip select error interrupt enable */
221#define IFC_CM_EVTER_INTR_EN_CSERIREN 0x80000000
222
223/*
224 * Common Transfer Error Attribute Register-0 (CM_ERATTR0)
225 */
226/* transaction type of error Read/Write */
227#define IFC_CM_ERATTR0_ERTYP_READ 0x80000000
228#define IFC_CM_ERATTR0_ERAID 0x0FF00000
229#define IFC_CM_ERATTR0_ERAID_SHIFT 20
230#define IFC_CM_ERATTR0_ESRCID 0x0000FF00
231#define IFC_CM_ERATTR0_ESRCID_SHIFT 8
232
233/*
234 * Clock Control Register (CCR)
235 */
236#define IFC_CCR_MASK 0x0F0F8800
237/* Clock division ratio */
238#define IFC_CCR_CLK_DIV_MASK 0x0F000000
239#define IFC_CCR_CLK_DIV_SHIFT 24
240#define IFC_CCR_CLK_DIV(n) ((n-1) << IFC_CCR_CLK_DIV_SHIFT)
241/* IFC Clock Delay */
242#define IFC_CCR_CLK_DLY_MASK 0x000F0000
243#define IFC_CCR_CLK_DLY_SHIFT 16
244#define IFC_CCR_CLK_DLY(n) ((n) << IFC_CCR_CLK_DLY_SHIFT)
245/* Invert IFC clock before sending out */
246#define IFC_CCR_INV_CLK_EN 0x00008000
247/* Fedback IFC Clock */
248#define IFC_CCR_FB_IFC_CLK_SEL 0x00000800
249
250/*
251 * Clock Status Register (CSR)
252 */
253/* Clk is stable */
254#define IFC_CSR_CLK_STAT_STABLE 0x80000000
255
256/*
257 * IFC_NAND Machine Specific Registers
258 */
259/*
260 * NAND Configuration Register (NCFGR)
261 */
262/* Auto Boot Mode */
263#define IFC_NAND_NCFGR_BOOT 0x80000000
264/* Addressing Mode-ROW0+n/COL0 */
265#define IFC_NAND_NCFGR_ADDR_MODE_RC0 0x00000000
266/* Addressing Mode-ROW0+n/COL0+n */
267#define IFC_NAND_NCFGR_ADDR_MODE_RC1 0x00400000
268/* Number of loop iterations of FIR sequences for multi page operations */
269#define IFC_NAND_NCFGR_NUM_LOOP_MASK 0x0000F000
270#define IFC_NAND_NCFGR_NUM_LOOP_SHIFT 12
271#define IFC_NAND_NCFGR_NUM_LOOP(n) ((n) << IFC_NAND_NCFGR_NUM_LOOP_SHIFT)
272/* Number of wait cycles */
273#define IFC_NAND_NCFGR_NUM_WAIT_MASK 0x000000FF
274#define IFC_NAND_NCFGR_NUM_WAIT_SHIFT 0
275
276/*
277 * NAND Flash Command Registers (NAND_FCR0/NAND_FCR1)
278 */
279/* General purpose FCM flash command bytes CMD0-CMD7 */
280#define IFC_NAND_FCR0_CMD0 0xFF000000
281#define IFC_NAND_FCR0_CMD0_SHIFT 24
282#define IFC_NAND_FCR0_CMD1 0x00FF0000
283#define IFC_NAND_FCR0_CMD1_SHIFT 16
284#define IFC_NAND_FCR0_CMD2 0x0000FF00
285#define IFC_NAND_FCR0_CMD2_SHIFT 8
286#define IFC_NAND_FCR0_CMD3 0x000000FF
287#define IFC_NAND_FCR0_CMD3_SHIFT 0
288#define IFC_NAND_FCR1_CMD4 0xFF000000
289#define IFC_NAND_FCR1_CMD4_SHIFT 24
290#define IFC_NAND_FCR1_CMD5 0x00FF0000
291#define IFC_NAND_FCR1_CMD5_SHIFT 16
292#define IFC_NAND_FCR1_CMD6 0x0000FF00
293#define IFC_NAND_FCR1_CMD6_SHIFT 8
294#define IFC_NAND_FCR1_CMD7 0x000000FF
295#define IFC_NAND_FCR1_CMD7_SHIFT 0
296
297/*
298 * Flash ROW and COL Address Register (ROWn, COLn)
299 */
300/* Main/spare region locator */
301#define IFC_NAND_COL_MS 0x80000000
302/* Column Address */
303#define IFC_NAND_COL_CA_MASK 0x00000FFF
304
305/*
306 * NAND Flash Byte Count Register (NAND_BC)
307 */
308/* Byte Count for read/Write */
309#define IFC_NAND_BC 0x000001FF
310
311/*
312 * NAND Flash Instruction Registers (NAND_FIR0/NAND_FIR1/NAND_FIR2)
313 */
314/* NAND Machine specific opcodes OP0-OP14*/
315#define IFC_NAND_FIR0_OP0 0xFC000000
316#define IFC_NAND_FIR0_OP0_SHIFT 26
317#define IFC_NAND_FIR0_OP1 0x03F00000
318#define IFC_NAND_FIR0_OP1_SHIFT 20
319#define IFC_NAND_FIR0_OP2 0x000FC000
320#define IFC_NAND_FIR0_OP2_SHIFT 14
321#define IFC_NAND_FIR0_OP3 0x00003F00
322#define IFC_NAND_FIR0_OP3_SHIFT 8
323#define IFC_NAND_FIR0_OP4 0x000000FC
324#define IFC_NAND_FIR0_OP4_SHIFT 2
325#define IFC_NAND_FIR1_OP5 0xFC000000
326#define IFC_NAND_FIR1_OP5_SHIFT 26
327#define IFC_NAND_FIR1_OP6 0x03F00000
328#define IFC_NAND_FIR1_OP6_SHIFT 20
329#define IFC_NAND_FIR1_OP7 0x000FC000
330#define IFC_NAND_FIR1_OP7_SHIFT 14
331#define IFC_NAND_FIR1_OP8 0x00003F00
332#define IFC_NAND_FIR1_OP8_SHIFT 8
333#define IFC_NAND_FIR1_OP9 0x000000FC
334#define IFC_NAND_FIR1_OP9_SHIFT 2
335#define IFC_NAND_FIR2_OP10 0xFC000000
336#define IFC_NAND_FIR2_OP10_SHIFT 26
337#define IFC_NAND_FIR2_OP11 0x03F00000
338#define IFC_NAND_FIR2_OP11_SHIFT 20
339#define IFC_NAND_FIR2_OP12 0x000FC000
340#define IFC_NAND_FIR2_OP12_SHIFT 14
341#define IFC_NAND_FIR2_OP13 0x00003F00
342#define IFC_NAND_FIR2_OP13_SHIFT 8
343#define IFC_NAND_FIR2_OP14 0x000000FC
344#define IFC_NAND_FIR2_OP14_SHIFT 2
345
346/*
347 * Instruction opcodes to be programmed
348 * in FIR registers- 6bits
349 */
350enum ifc_nand_fir_opcodes {
351 IFC_FIR_OP_NOP,
352 IFC_FIR_OP_CA0,
353 IFC_FIR_OP_CA1,
354 IFC_FIR_OP_CA2,
355 IFC_FIR_OP_CA3,
356 IFC_FIR_OP_RA0,
357 IFC_FIR_OP_RA1,
358 IFC_FIR_OP_RA2,
359 IFC_FIR_OP_RA3,
360 IFC_FIR_OP_CMD0,
361 IFC_FIR_OP_CMD1,
362 IFC_FIR_OP_CMD2,
363 IFC_FIR_OP_CMD3,
364 IFC_FIR_OP_CMD4,
365 IFC_FIR_OP_CMD5,
366 IFC_FIR_OP_CMD6,
367 IFC_FIR_OP_CMD7,
368 IFC_FIR_OP_CW0,
369 IFC_FIR_OP_CW1,
370 IFC_FIR_OP_CW2,
371 IFC_FIR_OP_CW3,
372 IFC_FIR_OP_CW4,
373 IFC_FIR_OP_CW5,
374 IFC_FIR_OP_CW6,
375 IFC_FIR_OP_CW7,
376 IFC_FIR_OP_WBCD,
377 IFC_FIR_OP_RBCD,
378 IFC_FIR_OP_BTRD,
379 IFC_FIR_OP_RDSTAT,
380 IFC_FIR_OP_NWAIT,
381 IFC_FIR_OP_WFR,
382 IFC_FIR_OP_SBRD,
383 IFC_FIR_OP_UA,
384 IFC_FIR_OP_RB,
385};
386
387/*
388 * NAND Chip Select Register (NAND_CSEL)
389 */
390#define IFC_NAND_CSEL 0x0C000000
391#define IFC_NAND_CSEL_SHIFT 26
392#define IFC_NAND_CSEL_CS0 0x00000000
393#define IFC_NAND_CSEL_CS1 0x04000000
394#define IFC_NAND_CSEL_CS2 0x08000000
395#define IFC_NAND_CSEL_CS3 0x0C000000
396
397/*
398 * NAND Operation Sequence Start (NANDSEQ_STRT)
399 */
400/* NAND Flash Operation Start */
401#define IFC_NAND_SEQ_STRT_FIR_STRT 0x80000000
402/* Automatic Erase */
403#define IFC_NAND_SEQ_STRT_AUTO_ERS 0x00800000
404/* Automatic Program */
405#define IFC_NAND_SEQ_STRT_AUTO_PGM 0x00100000
406/* Automatic Copyback */
407#define IFC_NAND_SEQ_STRT_AUTO_CPB 0x00020000
408/* Automatic Read Operation */
409#define IFC_NAND_SEQ_STRT_AUTO_RD 0x00004000
410/* Automatic Status Read */
411#define IFC_NAND_SEQ_STRT_AUTO_STAT_RD 0x00000800
412
413/*
414 * NAND Event and Error Status Register (NAND_EVTER_STAT)
415 */
416/* Operation Complete */
417#define IFC_NAND_EVTER_STAT_OPC 0x80000000
418/* Flash Timeout Error */
419#define IFC_NAND_EVTER_STAT_FTOER 0x08000000
420/* Write Protect Error */
421#define IFC_NAND_EVTER_STAT_WPER 0x04000000
422/* ECC Error */
423#define IFC_NAND_EVTER_STAT_ECCER 0x02000000
424/* RCW Load Done */
425#define IFC_NAND_EVTER_STAT_RCW_DN 0x00008000
426/* Boot Loadr Done */
427#define IFC_NAND_EVTER_STAT_BOOT_DN 0x00004000
428/* Bad Block Indicator search select */
429#define IFC_NAND_EVTER_STAT_BBI_SRCH_SE 0x00000800
430
431/*
432 * NAND Flash Page Read Completion Event Status Register
433 * (PGRDCMPL_EVT_STAT)
434 */
435#define PGRDCMPL_EVT_STAT_MASK 0xFFFF0000
436/* Small Page 0-15 Done */
437#define PGRDCMPL_EVT_STAT_SECTION_SP(n) (1 << (31 - (n)))
438/* Large Page(2K) 0-3 Done */
439#define PGRDCMPL_EVT_STAT_LP_2K(n) (0xF << (28 - (n)*4))
440/* Large Page(4K) 0-1 Done */
441#define PGRDCMPL_EVT_STAT_LP_4K(n) (0xFF << (24 - (n)*8))
442
443/*
444 * NAND Event and Error Enable Register (NAND_EVTER_EN)
445 */
446/* Operation complete event enable */
447#define IFC_NAND_EVTER_EN_OPC_EN 0x80000000
448/* Page read complete event enable */
449#define IFC_NAND_EVTER_EN_PGRDCMPL_EN 0x20000000
450/* Flash Timeout error enable */
451#define IFC_NAND_EVTER_EN_FTOER_EN 0x08000000
452/* Write Protect error enable */
453#define IFC_NAND_EVTER_EN_WPER_EN 0x04000000
454/* ECC error logging enable */
455#define IFC_NAND_EVTER_EN_ECCER_EN 0x02000000
456
457/*
458 * NAND Event and Error Interrupt Enable Register (NAND_EVTER_INTR_EN)
459 */
460/* Enable interrupt for operation complete */
461#define IFC_NAND_EVTER_INTR_OPCIR_EN 0x80000000
462/* Enable interrupt for Page read complete */
463#define IFC_NAND_EVTER_INTR_PGRDCMPLIR_EN 0x20000000
464/* Enable interrupt for Flash timeout error */
465#define IFC_NAND_EVTER_INTR_FTOERIR_EN 0x08000000
466/* Enable interrupt for Write protect error */
467#define IFC_NAND_EVTER_INTR_WPERIR_EN 0x04000000
468/* Enable interrupt for ECC error*/
469#define IFC_NAND_EVTER_INTR_ECCERIR_EN 0x02000000
470
471/*
472 * NAND Transfer Error Attribute Register-0 (NAND_ERATTR0)
473 */
474#define IFC_NAND_ERATTR0_MASK 0x0C080000
475/* Error on CS0-3 for NAND */
476#define IFC_NAND_ERATTR0_ERCS_CS0 0x00000000
477#define IFC_NAND_ERATTR0_ERCS_CS1 0x04000000
478#define IFC_NAND_ERATTR0_ERCS_CS2 0x08000000
479#define IFC_NAND_ERATTR0_ERCS_CS3 0x0C000000
480/* Transaction type of error Read/Write */
481#define IFC_NAND_ERATTR0_ERTTYPE_READ 0x00080000
482
483/*
484 * NAND Flash Status Register (NAND_FSR)
485 */
486/* First byte of data read from read status op */
487#define IFC_NAND_NFSR_RS0 0xFF000000
488/* Second byte of data read from read status op */
489#define IFC_NAND_NFSR_RS1 0x00FF0000
490
491/*
492 * ECC Error Status Registers (ECCSTAT0-ECCSTAT3)
493 */
494/* Number of ECC errors on sector n (n = 0-15) */
495#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_MASK 0x0F000000
496#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR0_SHIFT 24
497#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_MASK 0x000F0000
498#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR1_SHIFT 16
499#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_MASK 0x00000F00
500#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR2_SHIFT 8
501#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_MASK 0x0000000F
502#define IFC_NAND_ECCSTAT0_ERRCNT_SECTOR3_SHIFT 0
503#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_MASK 0x0F000000
504#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR4_SHIFT 24
505#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_MASK 0x000F0000
506#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR5_SHIFT 16
507#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_MASK 0x00000F00
508#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR6_SHIFT 8
509#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_MASK 0x0000000F
510#define IFC_NAND_ECCSTAT1_ERRCNT_SECTOR7_SHIFT 0
511#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_MASK 0x0F000000
512#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR8_SHIFT 24
513#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_MASK 0x000F0000
514#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR9_SHIFT 16
515#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_MASK 0x00000F00
516#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR10_SHIFT 8
517#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_MASK 0x0000000F
518#define IFC_NAND_ECCSTAT2_ERRCNT_SECTOR11_SHIFT 0
519#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_MASK 0x0F000000
520#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR12_SHIFT 24
521#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_MASK 0x000F0000
522#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR13_SHIFT 16
523#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_MASK 0x00000F00
524#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR14_SHIFT 8
525#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_MASK 0x0000000F
526#define IFC_NAND_ECCSTAT3_ERRCNT_SECTOR15_SHIFT 0
527
528/*
529 * NAND Control Register (NANDCR)
530 */
531#define IFC_NAND_NCR_FTOCNT_MASK 0x1E000000
532#define IFC_NAND_NCR_FTOCNT_SHIFT 25
533#define IFC_NAND_NCR_FTOCNT(n) ((_ilog2(n) - 8) << IFC_NAND_NCR_FTOCNT_SHIFT)
534
535/*
536 * NAND_AUTOBOOT_TRGR
537 */
538/* Trigger RCW load */
539#define IFC_NAND_AUTOBOOT_TRGR_RCW_LD 0x80000000
540/* Trigget Auto Boot */
541#define IFC_NAND_AUTOBOOT_TRGR_BOOT_LD 0x20000000
542
543/*
544 * NAND_MDR
545 */
546/* 1st read data byte when opcode SBRD */
547#define IFC_NAND_MDR_RDATA0 0xFF000000
548/* 2nd read data byte when opcode SBRD */
549#define IFC_NAND_MDR_RDATA1 0x00FF0000
550
551/*
552 * NOR Machine Specific Registers
553 */
554/*
555 * NOR Event and Error Status Register (NOR_EVTER_STAT)
556 */
557/* NOR Command Sequence Operation Complete */
558#define IFC_NOR_EVTER_STAT_OPC_NOR 0x80000000
559/* Write Protect Error */
560#define IFC_NOR_EVTER_STAT_WPER 0x04000000
561/* Command Sequence Timeout Error */
562#define IFC_NOR_EVTER_STAT_STOER 0x01000000
563
564/*
565 * NOR Event and Error Enable Register (NOR_EVTER_EN)
566 */
567/* NOR Command Seq complete event enable */
568#define IFC_NOR_EVTER_EN_OPCEN_NOR 0x80000000
569/* Write Protect Error Checking Enable */
570#define IFC_NOR_EVTER_EN_WPEREN 0x04000000
571/* Timeout Error Enable */
572#define IFC_NOR_EVTER_EN_STOEREN 0x01000000
573
574/*
575 * NOR Event and Error Interrupt Enable Register (NOR_EVTER_INTR_EN)
576 */
577/* Enable interrupt for OPC complete */
578#define IFC_NOR_EVTER_INTR_OPCEN_NOR 0x80000000
579/* Enable interrupt for write protect error */
580#define IFC_NOR_EVTER_INTR_WPEREN 0x04000000
581/* Enable interrupt for timeout error */
582#define IFC_NOR_EVTER_INTR_STOEREN 0x01000000
583
584/*
585 * NOR Transfer Error Attribute Register-0 (NOR_ERATTR0)
586 */
587/* Source ID for error transaction */
588#define IFC_NOR_ERATTR0_ERSRCID 0xFF000000
589/* AXI ID for error transation */
590#define IFC_NOR_ERATTR0_ERAID 0x000FF000
591/* Chip select corresponds to NOR error */
592#define IFC_NOR_ERATTR0_ERCS_CS0 0x00000000
593#define IFC_NOR_ERATTR0_ERCS_CS1 0x00000010
594#define IFC_NOR_ERATTR0_ERCS_CS2 0x00000020
595#define IFC_NOR_ERATTR0_ERCS_CS3 0x00000030
596/* Type of transaction read/write */
597#define IFC_NOR_ERATTR0_ERTYPE_READ 0x00000001
598
599/*
600 * NOR Transfer Error Attribute Register-2 (NOR_ERATTR2)
601 */
602#define IFC_NOR_ERATTR2_ER_NUM_PHASE_EXP 0x000F0000
603#define IFC_NOR_ERATTR2_ER_NUM_PHASE_PER 0x00000F00
604
605/*
606 * NOR Control Register (NORCR)
607 */
608#define IFC_NORCR_MASK 0x0F0F0000
609/* No. of Address/Data Phase */
610#define IFC_NORCR_NUM_PHASE_MASK 0x0F000000
611#define IFC_NORCR_NUM_PHASE_SHIFT 24
612#define IFC_NORCR_NUM_PHASE(n) ((n-1) << IFC_NORCR_NUM_PHASE_SHIFT)
613/* Sequence Timeout Count */
614#define IFC_NORCR_STOCNT_MASK 0x000F0000
615#define IFC_NORCR_STOCNT_SHIFT 16
616#define IFC_NORCR_STOCNT(n) ((__ilog2(n) - 8) << IFC_NORCR_STOCNT_SHIFT)
617
618/*
619 * GPCM Machine specific registers
620 */
621/*
622 * GPCM Event and Error Status Register (GPCM_EVTER_STAT)
623 */
624/* Timeout error */
625#define IFC_GPCM_EVTER_STAT_TOER 0x04000000
626/* Parity error */
627#define IFC_GPCM_EVTER_STAT_PER 0x01000000
628
629/*
630 * GPCM Event and Error Enable Register (GPCM_EVTER_EN)
631 */
632/* Timeout error enable */
633#define IFC_GPCM_EVTER_EN_TOER_EN 0x04000000
634/* Parity error enable */
635#define IFC_GPCM_EVTER_EN_PER_EN 0x01000000
636
637/*
638 * GPCM Event and Error Interrupt Enable Register (GPCM_EVTER_INTR_EN)
639 */
640/* Enable Interrupt for timeout error */
641#define IFC_GPCM_EEIER_TOERIR_EN 0x04000000
642/* Enable Interrupt for Parity error */
643#define IFC_GPCM_EEIER_PERIR_EN 0x01000000
644
645/*
646 * GPCM Transfer Error Attribute Register-0 (GPCM_ERATTR0)
647 */
648/* Source ID for error transaction */
649#define IFC_GPCM_ERATTR0_ERSRCID 0xFF000000
650/* AXI ID for error transaction */
651#define IFC_GPCM_ERATTR0_ERAID 0x000FF000
652/* Chip select corresponds to GPCM error */
653#define IFC_GPCM_ERATTR0_ERCS_CS0 0x00000000
654#define IFC_GPCM_ERATTR0_ERCS_CS1 0x00000040
655#define IFC_GPCM_ERATTR0_ERCS_CS2 0x00000080
656#define IFC_GPCM_ERATTR0_ERCS_CS3 0x000000C0
657/* Type of transaction read/Write */
658#define IFC_GPCM_ERATTR0_ERTYPE_READ 0x00000001
659
660/*
661 * GPCM Transfer Error Attribute Register-2 (GPCM_ERATTR2)
662 */
663/* On which beat of address/data parity error is observed */
664#define IFC_GPCM_ERATTR2_PERR_BEAT 0x00000C00
665/* Parity Error on byte */
666#define IFC_GPCM_ERATTR2_PERR_BYTE 0x000000F0
667/* Parity Error reported in addr or data phase */
668#define IFC_GPCM_ERATTR2_PERR_DATA_PHASE 0x00000001
669
670/*
671 * GPCM Status Register (GPCM_STAT)
672 */
673#define IFC_GPCM_STAT_BSY 0x80000000 /* GPCM is busy */
674
675/*
676 * IFC Controller NAND Machine registers
677 */
678struct fsl_ifc_nand {
679 __be32 ncfgr;
680 u32 res1[0x4];
681 __be32 nand_fcr0;
682 __be32 nand_fcr1;
683 u32 res2[0x8];
684 __be32 row0;
685 u32 res3;
686 __be32 col0;
687 u32 res4;
688 __be32 row1;
689 u32 res5;
690 __be32 col1;
691 u32 res6;
692 __be32 row2;
693 u32 res7;
694 __be32 col2;
695 u32 res8;
696 __be32 row3;
697 u32 res9;
698 __be32 col3;
699 u32 res10[0x24];
700 __be32 nand_fbcr;
701 u32 res11;
702 __be32 nand_fir0;
703 __be32 nand_fir1;
704 __be32 nand_fir2;
705 u32 res12[0x10];
706 __be32 nand_csel;
707 u32 res13;
708 __be32 nandseq_strt;
709 u32 res14;
710 __be32 nand_evter_stat;
711 u32 res15;
712 __be32 pgrdcmpl_evt_stat;
713 u32 res16[0x2];
714 __be32 nand_evter_en;
715 u32 res17[0x2];
716 __be32 nand_evter_intr_en;
717 u32 res18[0x2];
718 __be32 nand_erattr0;
719 __be32 nand_erattr1;
720 u32 res19[0x10];
721 __be32 nand_fsr;
722 u32 res20;
723 __be32 nand_eccstat[4];
724 u32 res21[0x20];
725 __be32 nanndcr;
726 u32 res22[0x2];
727 __be32 nand_autoboot_trgr;
728 u32 res23;
729 __be32 nand_mdr;
730 u32 res24[0x5C];
731};
732
733/*
734 * IFC controller NOR Machine registers
735 */
736struct fsl_ifc_nor {
737 __be32 nor_evter_stat;
738 u32 res1[0x2];
739 __be32 nor_evter_en;
740 u32 res2[0x2];
741 __be32 nor_evter_intr_en;
742 u32 res3[0x2];
743 __be32 nor_erattr0;
744 __be32 nor_erattr1;
745 __be32 nor_erattr2;
746 u32 res4[0x4];
747 __be32 norcr;
748 u32 res5[0xEF];
749};
750
751/*
752 * IFC controller GPCM Machine registers
753 */
754struct fsl_ifc_gpcm {
755 __be32 gpcm_evter_stat;
756 u32 res1[0x2];
757 __be32 gpcm_evter_en;
758 u32 res2[0x2];
759 __be32 gpcm_evter_intr_en;
760 u32 res3[0x2];
761 __be32 gpcm_erattr0;
762 __be32 gpcm_erattr1;
763 __be32 gpcm_erattr2;
764 __be32 gpcm_stat;
765 u32 res4[0x1F3];
766};
767
768/*
769 * IFC Controller Registers
770 */
771struct fsl_ifc_regs {
772 __be32 ifc_rev;
773 u32 res1[0x2];
774 struct {
775 __be32 cspr_ext;
776 __be32 cspr;
777 u32 res2;
778 } cspr_cs[FSL_IFC_BANK_COUNT];
779 u32 res3[0x19];
780 struct {
781 __be32 amask;
782 u32 res4[0x2];
783 } amask_cs[FSL_IFC_BANK_COUNT];
784 u32 res5[0x17];
785 struct {
786 __be32 csor_ext;
787 __be32 csor;
788 u32 res6;
789 } csor_cs[FSL_IFC_BANK_COUNT];
790 u32 res7[0x19];
791 struct {
792 __be32 ftim[4];
793 u32 res8[0x8];
794 } ftim_cs[FSL_IFC_BANK_COUNT];
795 u32 res9[0x60];
796 __be32 rb_stat;
797 u32 res10[0x2];
798 __be32 ifc_gcr;
799 u32 res11[0x2];
800 __be32 cm_evter_stat;
801 u32 res12[0x2];
802 __be32 cm_evter_en;
803 u32 res13[0x2];
804 __be32 cm_evter_intr_en;
805 u32 res14[0x2];
806 __be32 cm_erattr0;
807 __be32 cm_erattr1;
808 u32 res15[0x2];
809 __be32 ifc_ccr;
810 __be32 ifc_csr;
811 u32 res16[0x2EB];
812 struct fsl_ifc_nand ifc_nand;
813 struct fsl_ifc_nor ifc_nor;
814 struct fsl_ifc_gpcm ifc_gpcm;
815};
816
817extern unsigned int convert_ifc_address(phys_addr_t addr_base);
818extern int fsl_ifc_find(phys_addr_t addr_base);
819
820/* overview of the fsl ifc controller */
821
822struct fsl_ifc_ctrl {
823 /* device info */
824 struct device *dev;
825 struct fsl_ifc_regs __iomem *regs;
826 int irq;
827 int nand_irq;
828 spinlock_t lock;
829 void *nand;
830
831 u32 nand_stat;
832 wait_queue_head_t nand_wait;
833};
834
835extern struct fsl_ifc_ctrl *fsl_ifc_ctrl_dev;
836
837
838#endif /* __ASM_FSL_IFC_H */
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 64cf3ef50696..fc7718c6bd3e 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -178,7 +178,7 @@ struct fsnotify_group {
178 struct fanotify_group_private_data { 178 struct fanotify_group_private_data {
179#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS 179#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
180 /* allows a group to block waiting for a userspace response */ 180 /* allows a group to block waiting for a userspace response */
181 struct mutex access_mutex; 181 spinlock_t access_lock;
182 struct list_head access_list; 182 struct list_head access_list;
183 wait_queue_head_t access_waitq; 183 wait_queue_head_t access_waitq;
184 atomic_t bypass_perm; 184 atomic_t bypass_perm;
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f4233b195dab..9212b017bc72 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -92,6 +92,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
92 * STUB - The ftrace_ops is just a place holder. 92 * STUB - The ftrace_ops is just a place holder.
93 * INITIALIZED - The ftrace_ops has already been initialized (first use time 93 * INITIALIZED - The ftrace_ops has already been initialized (first use time
94 * register_ftrace_function() is called, it will initialized the ops) 94 * register_ftrace_function() is called, it will initialized the ops)
95 * DELETED - The ops are being deleted, do not let them be registered again.
95 */ 96 */
96enum { 97enum {
97 FTRACE_OPS_FL_ENABLED = 1 << 0, 98 FTRACE_OPS_FL_ENABLED = 1 << 0,
@@ -103,13 +104,26 @@ enum {
103 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6, 104 FTRACE_OPS_FL_RECURSION_SAFE = 1 << 6,
104 FTRACE_OPS_FL_STUB = 1 << 7, 105 FTRACE_OPS_FL_STUB = 1 << 7,
105 FTRACE_OPS_FL_INITIALIZED = 1 << 8, 106 FTRACE_OPS_FL_INITIALIZED = 1 << 8,
107 FTRACE_OPS_FL_DELETED = 1 << 9,
106}; 108};
107 109
110/*
111 * Note, ftrace_ops can be referenced outside of RCU protection.
112 * (Although, for perf, the control ops prevent that). If ftrace_ops is
113 * allocated and not part of kernel core data, the unregistering of it will
114 * perform a scheduling on all CPUs to make sure that there are no more users.
115 * Depending on the load of the system that may take a bit of time.
116 *
117 * Any private data added must also take care not to be freed and if private
118 * data is added to a ftrace_ops that is in core code, the user of the
119 * ftrace_ops must perform a schedule_on_each_cpu() before freeing it.
120 */
108struct ftrace_ops { 121struct ftrace_ops {
109 ftrace_func_t func; 122 ftrace_func_t func;
110 struct ftrace_ops *next; 123 struct ftrace_ops *next;
111 unsigned long flags; 124 unsigned long flags;
112 int __percpu *disabled; 125 int __percpu *disabled;
126 void *private;
113#ifdef CONFIG_DYNAMIC_FTRACE 127#ifdef CONFIG_DYNAMIC_FTRACE
114 struct ftrace_hash *notrace_hash; 128 struct ftrace_hash *notrace_hash;
115 struct ftrace_hash *filter_hash; 129 struct ftrace_hash *filter_hash;
@@ -285,7 +299,7 @@ extern void
285unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops); 299unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
286extern void unregister_ftrace_function_probe_all(char *glob); 300extern void unregister_ftrace_function_probe_all(char *glob);
287 301
288extern int ftrace_text_reserved(void *start, void *end); 302extern int ftrace_text_reserved(const void *start, const void *end);
289 303
290extern int ftrace_nr_registered_ops(void); 304extern int ftrace_nr_registered_ops(void);
291 305
@@ -316,12 +330,9 @@ enum {
316#define FTRACE_REF_MAX ((1UL << 29) - 1) 330#define FTRACE_REF_MAX ((1UL << 29) - 1)
317 331
318struct dyn_ftrace { 332struct dyn_ftrace {
319 union { 333 unsigned long ip; /* address of mcount call-site */
320 unsigned long ip; /* address of mcount call-site */
321 struct dyn_ftrace *freelist;
322 };
323 unsigned long flags; 334 unsigned long flags;
324 struct dyn_arch_ftrace arch; 335 struct dyn_arch_ftrace arch;
325}; 336};
326 337
327int ftrace_force_update(void); 338int ftrace_force_update(void);
@@ -409,7 +420,7 @@ ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
409 420
410/* defined in arch */ 421/* defined in arch */
411extern int ftrace_ip_converted(unsigned long ip); 422extern int ftrace_ip_converted(unsigned long ip);
412extern int ftrace_dyn_arch_init(void *data); 423extern int ftrace_dyn_arch_init(void);
413extern void ftrace_replace_code(int enable); 424extern void ftrace_replace_code(int enable);
414extern int ftrace_update_ftrace_func(ftrace_func_t func); 425extern int ftrace_update_ftrace_func(ftrace_func_t func);
415extern void ftrace_caller(void); 426extern void ftrace_caller(void);
@@ -541,7 +552,7 @@ static inline __init int unregister_ftrace_command(char *cmd_name)
541{ 552{
542 return -EINVAL; 553 return -EINVAL;
543} 554}
544static inline int ftrace_text_reserved(void *start, void *end) 555static inline int ftrace_text_reserved(const void *start, const void *end)
545{ 556{
546 return 0; 557 return 0;
547} 558}
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4cdb3a17bcb5..d16da3e53bc7 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -7,6 +7,7 @@
7#include <linux/percpu.h> 7#include <linux/percpu.h>
8#include <linux/hardirq.h> 8#include <linux/hardirq.h>
9#include <linux/perf_event.h> 9#include <linux/perf_event.h>
10#include <linux/tracepoint.h>
10 11
11struct trace_array; 12struct trace_array;
12struct trace_buffer; 13struct trace_buffer;
@@ -163,6 +164,8 @@ void trace_current_buffer_discard_commit(struct ring_buffer *buffer,
163 164
164void tracing_record_cmdline(struct task_struct *tsk); 165void tracing_record_cmdline(struct task_struct *tsk);
165 166
167int ftrace_output_call(struct trace_iterator *iter, char *name, char *fmt, ...);
168
166struct event_filter; 169struct event_filter;
167 170
168enum trace_reg { 171enum trace_reg {
@@ -197,6 +200,32 @@ struct ftrace_event_class {
197extern int ftrace_event_reg(struct ftrace_event_call *event, 200extern int ftrace_event_reg(struct ftrace_event_call *event,
198 enum trace_reg type, void *data); 201 enum trace_reg type, void *data);
199 202
203int ftrace_output_event(struct trace_iterator *iter, struct ftrace_event_call *event,
204 char *fmt, ...);
205
206int ftrace_event_define_field(struct ftrace_event_call *call,
207 char *type, int len, char *item, int offset,
208 int field_size, int sign, int filter);
209
210struct ftrace_event_buffer {
211 struct ring_buffer *buffer;
212 struct ring_buffer_event *event;
213 struct ftrace_event_file *ftrace_file;
214 void *entry;
215 unsigned long flags;
216 int pc;
217};
218
219void *ftrace_event_buffer_reserve(struct ftrace_event_buffer *fbuffer,
220 struct ftrace_event_file *ftrace_file,
221 unsigned long len);
222
223void ftrace_event_buffer_commit(struct ftrace_event_buffer *fbuffer);
224
225int ftrace_event_define_field(struct ftrace_event_call *call,
226 char *type, int len, char *item, int offset,
227 int field_size, int sign, int filter);
228
200enum { 229enum {
201 TRACE_EVENT_FL_FILTERED_BIT, 230 TRACE_EVENT_FL_FILTERED_BIT,
202 TRACE_EVENT_FL_CAP_ANY_BIT, 231 TRACE_EVENT_FL_CAP_ANY_BIT,
@@ -204,6 +233,7 @@ enum {
204 TRACE_EVENT_FL_IGNORE_ENABLE_BIT, 233 TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
205 TRACE_EVENT_FL_WAS_ENABLED_BIT, 234 TRACE_EVENT_FL_WAS_ENABLED_BIT,
206 TRACE_EVENT_FL_USE_CALL_FILTER_BIT, 235 TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
236 TRACE_EVENT_FL_TRACEPOINT_BIT,
207}; 237};
208 238
209/* 239/*
@@ -216,6 +246,7 @@ enum {
216 * (used for module unloading, if a module event is enabled, 246 * (used for module unloading, if a module event is enabled,
217 * it is best to clear the buffers that used it). 247 * it is best to clear the buffers that used it).
218 * USE_CALL_FILTER - For ftrace internal events, don't use file filter 248 * USE_CALL_FILTER - For ftrace internal events, don't use file filter
249 * TRACEPOINT - Event is a tracepoint
219 */ 250 */
220enum { 251enum {
221 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), 252 TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
@@ -224,12 +255,17 @@ enum {
224 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), 255 TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
225 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT), 256 TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
226 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT), 257 TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
258 TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
227}; 259};
228 260
229struct ftrace_event_call { 261struct ftrace_event_call {
230 struct list_head list; 262 struct list_head list;
231 struct ftrace_event_class *class; 263 struct ftrace_event_class *class;
232 char *name; 264 union {
265 char *name;
266 /* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
267 struct tracepoint *tp;
268 };
233 struct trace_event event; 269 struct trace_event event;
234 const char *print_fmt; 270 const char *print_fmt;
235 struct event_filter *filter; 271 struct event_filter *filter;
@@ -243,6 +279,7 @@ struct ftrace_event_call {
243 * bit 3: ftrace internal event (do not enable) 279 * bit 3: ftrace internal event (do not enable)
244 * bit 4: Event was enabled by module 280 * bit 4: Event was enabled by module
245 * bit 5: use call filter rather than file filter 281 * bit 5: use call filter rather than file filter
282 * bit 6: Event is a tracepoint
246 */ 283 */
247 int flags; /* static flags of different events */ 284 int flags; /* static flags of different events */
248 285
@@ -255,6 +292,15 @@ struct ftrace_event_call {
255#endif 292#endif
256}; 293};
257 294
295static inline const char *
296ftrace_event_name(struct ftrace_event_call *call)
297{
298 if (call->flags & TRACE_EVENT_FL_TRACEPOINT)
299 return call->tp ? call->tp->name : NULL;
300 else
301 return call->name;
302}
303
258struct trace_array; 304struct trace_array;
259struct ftrace_subsystem_dir; 305struct ftrace_subsystem_dir;
260 306
@@ -325,7 +371,7 @@ struct ftrace_event_file {
325#define __TRACE_EVENT_FLAGS(name, value) \ 371#define __TRACE_EVENT_FLAGS(name, value) \
326 static int __init trace_init_flags_##name(void) \ 372 static int __init trace_init_flags_##name(void) \
327 { \ 373 { \
328 event_##name.flags = value; \ 374 event_##name.flags |= value; \
329 return 0; \ 375 return 0; \
330 } \ 376 } \
331 early_initcall(trace_init_flags_##name); 377 early_initcall(trace_init_flags_##name);
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index b581b13d29d9..85aa5d0b9357 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -3,7 +3,7 @@
3 3
4#include <linux/errno.h> 4#include <linux/errno.h>
5 5
6/* see Documentation/gpio.txt */ 6/* see Documentation/gpio/gpio-legacy.txt */
7 7
8/* make these flag values available regardless of GPIO kconfig options */ 8/* make these flag values available regardless of GPIO kconfig options */
9#define GPIOF_DIR_OUT (0 << 0) 9#define GPIOF_DIR_OUT (0 << 0)
diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 7a8144fef406..bed128e8f4b1 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -5,7 +5,6 @@
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6 6
7struct device; 7struct device;
8struct gpio_chip;
9 8
10/** 9/**
11 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are 10 * Opaque descriptor for a GPIO. These are obtained using gpiod_get() and are
@@ -36,6 +35,7 @@ void devm_gpiod_put(struct device *dev, struct gpio_desc *desc);
36int gpiod_get_direction(const struct gpio_desc *desc); 35int gpiod_get_direction(const struct gpio_desc *desc);
37int gpiod_direction_input(struct gpio_desc *desc); 36int gpiod_direction_input(struct gpio_desc *desc);
38int gpiod_direction_output(struct gpio_desc *desc, int value); 37int gpiod_direction_output(struct gpio_desc *desc, int value);
38int gpiod_direction_output_raw(struct gpio_desc *desc, int value);
39 39
40/* Value get/set from non-sleeping context */ 40/* Value get/set from non-sleeping context */
41int gpiod_get_value(const struct gpio_desc *desc); 41int gpiod_get_value(const struct gpio_desc *desc);
@@ -59,7 +59,6 @@ int gpiod_to_irq(const struct gpio_desc *desc);
59/* Convert between the old gpio_ and new gpiod_ interfaces */ 59/* Convert between the old gpio_ and new gpiod_ interfaces */
60struct gpio_desc *gpio_to_desc(unsigned gpio); 60struct gpio_desc *gpio_to_desc(unsigned gpio);
61int desc_to_gpio(const struct gpio_desc *desc); 61int desc_to_gpio(const struct gpio_desc *desc);
62struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
63 62
64#else /* CONFIG_GPIOLIB */ 63#else /* CONFIG_GPIOLIB */
65 64
@@ -121,6 +120,12 @@ static inline int gpiod_direction_output(struct gpio_desc *desc, int value)
121 WARN_ON(1); 120 WARN_ON(1);
122 return -ENOSYS; 121 return -ENOSYS;
123} 122}
123static inline int gpiod_direction_output_raw(struct gpio_desc *desc, int value)
124{
125 /* GPIO can never have been requested */
126 WARN_ON(1);
127 return -ENOSYS;
128}
124 129
125 130
126static inline int gpiod_get_value(const struct gpio_desc *desc) 131static inline int gpiod_get_value(const struct gpio_desc *desc)
@@ -207,12 +212,6 @@ static inline int desc_to_gpio(const struct gpio_desc *desc)
207 WARN_ON(1); 212 WARN_ON(1);
208 return -EINVAL; 213 return -EINVAL;
209} 214}
210static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
211{
212 /* GPIO can never have been requested */
213 WARN_ON(1);
214 return ERR_PTR(-ENODEV);
215}
216 215
217 216
218#endif /* CONFIG_GPIOLIB */ 217#endif /* CONFIG_GPIOLIB */
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index a3e181e09636..1827b43966d9 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -3,6 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/irq.h>
7#include <linux/irqchip/chained_irq.h>
8#include <linux/irqdomain.h>
6 9
7struct device; 10struct device;
8struct gpio_desc; 11struct gpio_desc;
@@ -10,6 +13,8 @@ struct of_phandle_args;
10struct device_node; 13struct device_node;
11struct seq_file; 14struct seq_file;
12 15
16#ifdef CONFIG_GPIOLIB
17
13/** 18/**
14 * struct gpio_chip - abstract a GPIO controller 19 * struct gpio_chip - abstract a GPIO controller
15 * @label: for diagnostics 20 * @label: for diagnostics
@@ -95,6 +100,18 @@ struct gpio_chip {
95 bool can_sleep; 100 bool can_sleep;
96 bool exported; 101 bool exported;
97 102
103#ifdef CONFIG_GPIOLIB_IRQCHIP
104 /*
105 * With CONFIG_GPIO_IRQCHIP we get an irqchip inside the gpiolib
106 * to handle IRQs for most practical cases.
107 */
108 struct irq_chip *irqchip;
109 struct irq_domain *irqdomain;
110 unsigned int irq_base;
111 irq_flow_handler_t irq_handler;
112 unsigned int irq_default_type;
113#endif
114
98#if defined(CONFIG_OF_GPIO) 115#if defined(CONFIG_OF_GPIO)
99 /* 116 /*
100 * If CONFIG_OF is enabled, then all GPIO controllers described in the 117 * If CONFIG_OF is enabled, then all GPIO controllers described in the
@@ -129,6 +146,11 @@ extern struct gpio_chip *gpiochip_find(void *data,
129int gpiod_lock_as_irq(struct gpio_desc *desc); 146int gpiod_lock_as_irq(struct gpio_desc *desc);
130void gpiod_unlock_as_irq(struct gpio_desc *desc); 147void gpiod_unlock_as_irq(struct gpio_desc *desc);
131 148
149struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
150
151struct gpio_desc *gpiochip_get_desc(struct gpio_chip *chip,
152 u16 hwnum);
153
132enum gpio_lookup_flags { 154enum gpio_lookup_flags {
133 GPIO_ACTIVE_HIGH = (0 << 0), 155 GPIO_ACTIVE_HIGH = (0 << 0),
134 GPIO_ACTIVE_LOW = (1 << 0), 156 GPIO_ACTIVE_LOW = (1 << 0),
@@ -183,4 +205,30 @@ struct gpiod_lookup_table {
183 205
184void gpiod_add_lookup_table(struct gpiod_lookup_table *table); 206void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
185 207
208#ifdef CONFIG_GPIOLIB_IRQCHIP
209
210void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip,
211 struct irq_chip *irqchip,
212 int parent_irq,
213 irq_flow_handler_t parent_handler);
214
215int gpiochip_irqchip_add(struct gpio_chip *gpiochip,
216 struct irq_chip *irqchip,
217 unsigned int first_irq,
218 irq_flow_handler_t handler,
219 unsigned int type);
220
221#endif /* CONFIG_GPIO_IRQCHIP */
222
223#else /* CONFIG_GPIOLIB */
224
225static inline struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc)
226{
227 /* GPIO can never have been requested */
228 WARN_ON(1);
229 return ERR_PTR(-ENODEV);
230}
231
232#endif /* CONFIG_GPIOLIB */
233
186#endif 234#endif
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 9231be9e90a2..11c0182a153b 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -262,6 +262,18 @@ union hdmi_vendor_any_infoframe {
262 struct hdmi_vendor_infoframe hdmi; 262 struct hdmi_vendor_infoframe hdmi;
263}; 263};
264 264
265/**
266 * union hdmi_infoframe - overall union of all abstract infoframe representations
267 * @any: generic infoframe
268 * @avi: avi infoframe
269 * @spd: spd infoframe
270 * @vendor: union of all vendor infoframes
271 * @audio: audio infoframe
272 *
273 * This is used by the generic pack function. This works since all infoframes
274 * have the same header which also indicates which type of infoframe should be
275 * packed.
276 */
265union hdmi_infoframe { 277union hdmi_infoframe {
266 struct hdmi_any_infoframe any; 278 struct hdmi_any_infoframe any;
267 struct hdmi_avi_infoframe avi; 279 struct hdmi_avi_infoframe avi;
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b914ca3f57ba..b70cfd7ff29c 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -51,13 +51,15 @@ struct hid_sensor_hub_attribute_info {
51 * @hdev: Stores the hid instance. 51 * @hdev: Stores the hid instance.
52 * @vendor_id: Vendor id of hub device. 52 * @vendor_id: Vendor id of hub device.
53 * @product_id: Product id of hub device. 53 * @product_id: Product id of hub device.
54 * @ref_cnt: Number of MFD clients have opened this device 54 * @start_collection_index: Starting index for a phy type collection
55 * @end_collection_index: Last index for a phy type collection
55 */ 56 */
56struct hid_sensor_hub_device { 57struct hid_sensor_hub_device {
57 struct hid_device *hdev; 58 struct hid_device *hdev;
58 u32 vendor_id; 59 u32 vendor_id;
59 u32 product_id; 60 u32 product_id;
60 int ref_cnt; 61 int start_collection_index;
62 int end_collection_index;
61}; 63};
62 64
63/** 65/**
@@ -218,4 +220,7 @@ int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st,
218int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, 220int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
219 int *val1, int *val2); 221 int *val1, int *val2);
220 222
223int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
224 u32 report_id, int field_index, u32 usage_id);
225
221#endif 226#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index beaf965621c1..14ead9e8eda8 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -33,6 +33,16 @@
33#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0 33#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0
34#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1 34#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
35 35
36/* PROX (200011) */
37#define HID_USAGE_SENSOR_PROX 0x200011
38#define HID_USAGE_SENSOR_DATA_PRESENCE 0x2004b0
39#define HID_USAGE_SENSOR_HUMAN_PRESENCE 0x2004b1
40
41/* Pressure (200031) */
42#define HID_USAGE_SENSOR_PRESSURE 0x200031
43#define HID_USAGE_SENSOR_DATA_ATMOSPHERIC_PRESSURE 0x200430
44#define HID_USAGE_SENSOR_ATMOSPHERIC_PRESSURE 0x200431
45
36/* Gyro 3D: (200076) */ 46/* Gyro 3D: (200076) */
37#define HID_USAGE_SENSOR_GYRO_3D 0x200076 47#define HID_USAGE_SENSOR_GYRO_3D 0x200076
38#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456 48#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456
@@ -130,15 +140,15 @@
130#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000 140#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000
131 141
132/* Power state enumerations */ 142/* Power state enumerations */
133#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 143#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x200850
134#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 144#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x200851
135#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x02 145#define HID_USAGE_SENSOR_PROP_POWER_STATE_D1_LOW_POWER_ENUM 0x200852
136#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x03 146#define HID_USAGE_SENSOR_PROP_POWER_STATE_D2_STANDBY_WITH_WAKE_ENUM 0x200853
137#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x04 147#define HID_USAGE_SENSOR_PROP_POWER_STATE_D3_SLEEP_WITH_WAKE_ENUM 0x200854
138#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x05 148#define HID_USAGE_SENSOR_PROP_POWER_STATE_D4_POWER_OFF_ENUM 0x200855
139 149
140/* Report State enumerations */ 150/* Report State enumerations */
141#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x00 151#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_NO_EVENTS_ENUM 0x200840
142#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x01 152#define HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM 0x200841
143 153
144#endif 154#endif
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 31b9d299ef6c..720e3a10608c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -201,6 +201,7 @@ struct hid_item {
201#define HID_GD_VBRZ 0x00010045 201#define HID_GD_VBRZ 0x00010045
202#define HID_GD_VNO 0x00010046 202#define HID_GD_VNO 0x00010046
203#define HID_GD_FEATURE 0x00010047 203#define HID_GD_FEATURE 0x00010047
204#define HID_GD_SYSTEM_CONTROL 0x00010080
204#define HID_GD_UP 0x00010090 205#define HID_GD_UP 0x00010090
205#define HID_GD_DOWN 0x00010091 206#define HID_GD_DOWN 0x00010091
206#define HID_GD_RIGHT 0x00010092 207#define HID_GD_RIGHT 0x00010092
@@ -208,6 +209,8 @@ struct hid_item {
208 209
209#define HID_DC_BATTERYSTRENGTH 0x00060020 210#define HID_DC_BATTERYSTRENGTH 0x00060020
210 211
212#define HID_CP_CONSUMER_CONTROL 0x000c0001
213
211#define HID_DG_DIGITIZER 0x000d0001 214#define HID_DG_DIGITIZER 0x000d0001
212#define HID_DG_PEN 0x000d0002 215#define HID_DG_PEN 0x000d0002
213#define HID_DG_LIGHTPEN 0x000d0003 216#define HID_DG_LIGHTPEN 0x000d0003
@@ -287,6 +290,8 @@ struct hid_item {
287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 290#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 291#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 292#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
293#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
294#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
290#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 295#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
291#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 296#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
292#define HID_QUIRK_NO_IGNORE 0x40000000 297#define HID_QUIRK_NO_IGNORE 0x40000000
@@ -508,12 +513,6 @@ struct hid_device { /* device report descriptor */
508 struct hid_usage *, __s32); 513 struct hid_usage *, __s32);
509 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 514 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
510 515
511 /* handler for raw input (Get_Report) data, used by hidraw */
512 int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
513
514 /* handler for raw output data, used by hidraw */
515 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
516
517 /* debugging support via debugfs */ 516 /* debugging support via debugfs */
518 unsigned short debug; 517 unsigned short debug;
519 struct dentry *debug_dir; 518 struct dentry *debug_dir;
@@ -675,11 +674,12 @@ struct hid_driver {
675 * @stop: called on remove 674 * @stop: called on remove
676 * @open: called by input layer on open 675 * @open: called by input layer on open
677 * @close: called by input layer on close 676 * @close: called by input layer on close
678 * @hidinput_input_event: event input event (e.g. ff or leds)
679 * @parse: this method is called only once to parse the device data, 677 * @parse: this method is called only once to parse the device data,
680 * shouldn't allocate anything to not leak memory 678 * shouldn't allocate anything to not leak memory
681 * @request: send report request to device (e.g. feature report) 679 * @request: send report request to device (e.g. feature report)
682 * @wait: wait for buffered io to complete (send/recv reports) 680 * @wait: wait for buffered io to complete (send/recv reports)
681 * @raw_request: send raw report request to device (e.g. feature report)
682 * @output_report: send output report to device
683 * @idle: send idle request to device 683 * @idle: send idle request to device
684 */ 684 */
685struct hid_ll_driver { 685struct hid_ll_driver {
@@ -691,17 +691,20 @@ struct hid_ll_driver {
691 691
692 int (*power)(struct hid_device *hdev, int level); 692 int (*power)(struct hid_device *hdev, int level);
693 693
694 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
695 unsigned int code, int value);
696
697 int (*parse)(struct hid_device *hdev); 694 int (*parse)(struct hid_device *hdev);
698 695
699 void (*request)(struct hid_device *hdev, 696 void (*request)(struct hid_device *hdev,
700 struct hid_report *report, int reqtype); 697 struct hid_report *report, int reqtype);
701 698
702 int (*wait)(struct hid_device *hdev); 699 int (*wait)(struct hid_device *hdev);
703 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
704 700
701 int (*raw_request) (struct hid_device *hdev, unsigned char reportnum,
702 __u8 *buf, size_t len, unsigned char rtype,
703 int reqtype);
704
705 int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
706
707 int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
705}; 708};
706 709
707#define PM_HINT_FULLON 1<<5 710#define PM_HINT_FULLON 1<<5
@@ -752,6 +755,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
752unsigned int hidinput_count_leds(struct hid_device *hid); 755unsigned int hidinput_count_leds(struct hid_device *hid);
753__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 756__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
754void hid_output_report(struct hid_report *report, __u8 *data); 757void hid_output_report(struct hid_report *report, __u8 *data);
758void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
755u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); 759u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
756struct hid_device *hid_allocate_device(void); 760struct hid_device *hid_allocate_device(void);
757struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 761struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -964,7 +968,55 @@ static inline void hid_hw_request(struct hid_device *hdev,
964 struct hid_report *report, int reqtype) 968 struct hid_report *report, int reqtype)
965{ 969{
966 if (hdev->ll_driver->request) 970 if (hdev->ll_driver->request)
967 hdev->ll_driver->request(hdev, report, reqtype); 971 return hdev->ll_driver->request(hdev, report, reqtype);
972
973 __hid_request(hdev, report, reqtype);
974}
975
976/**
977 * hid_hw_raw_request - send report request to device
978 *
979 * @hdev: hid device
980 * @reportnum: report ID
981 * @buf: in/out data to transfer
982 * @len: length of buf
983 * @rtype: HID report type
984 * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
985 *
986 * @return: count of data transfered, negative if error
987 *
988 * Same behavior as hid_hw_request, but with raw buffers instead.
989 */
990static inline int hid_hw_raw_request(struct hid_device *hdev,
991 unsigned char reportnum, __u8 *buf,
992 size_t len, unsigned char rtype, int reqtype)
993{
994 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
995 return -EINVAL;
996
997 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
998 rtype, reqtype);
999}
1000
1001/**
1002 * hid_hw_output_report - send output report to device
1003 *
1004 * @hdev: hid device
1005 * @buf: raw data to transfer
1006 * @len: length of buf
1007 *
1008 * @return: count of data transfered, negative if error
1009 */
1010static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
1011 size_t len)
1012{
1013 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
1014 return -EINVAL;
1015
1016 if (hdev->ll_driver->output_report)
1017 return hdev->ll_driver->output_report(hdev, buf, len);
1018
1019 return -ENOSYS;
968} 1020}
969 1021
970/** 1022/**
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 3af847273277..d2b52999e771 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -136,6 +136,7 @@ u32 host1x_syncpt_id(struct host1x_syncpt *sp);
136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp); 136u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp); 137u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
138int host1x_syncpt_incr(struct host1x_syncpt *sp); 138int host1x_syncpt_incr(struct host1x_syncpt *sp);
139u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
139int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, 140int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
140 u32 *value); 141 u32 *value);
141struct host1x_syncpt *host1x_syncpt_request(struct device *dev, 142struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
diff --git a/include/linux/hsi/hsi.h b/include/linux/hsi/hsi.h
index 0dca785288cf..39bfd5b89077 100644
--- a/include/linux/hsi/hsi.h
+++ b/include/linux/hsi/hsi.h
@@ -178,7 +178,7 @@ static inline void hsi_unregister_client_driver(struct hsi_client_driver *drv)
178 * @complete: Transfer completion callback 178 * @complete: Transfer completion callback
179 * @destructor: Destructor to free resources when flushing 179 * @destructor: Destructor to free resources when flushing
180 * @status: Status of the transfer when completed 180 * @status: Status of the transfer when completed
181 * @actual_len: Actual length of data transfered on completion 181 * @actual_len: Actual length of data transferred on completion
182 * @channel: Channel were to TX/RX the message 182 * @channel: Channel were to TX/RX the message
183 * @ttype: Transfer type (TX if set, RX otherwise) 183 * @ttype: Transfer type (TX if set, RX otherwise)
184 * @break_frame: if true HSI will send/receive a break frame. Data buffers are 184 * @break_frame: if true HSI will send/receive a break frame. Data buffers are
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 8c43cc469d78..5b337cf8fb86 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -6,6 +6,8 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/hugetlb_inline.h> 7#include <linux/hugetlb_inline.h>
8#include <linux/cgroup.h> 8#include <linux/cgroup.h>
9#include <linux/list.h>
10#include <linux/kref.h>
9 11
10struct ctl_table; 12struct ctl_table;
11struct user_struct; 13struct user_struct;
@@ -23,6 +25,14 @@ struct hugepage_subpool {
23 long max_hpages, used_hpages; 25 long max_hpages, used_hpages;
24}; 26};
25 27
28struct resv_map {
29 struct kref refs;
30 spinlock_t lock;
31 struct list_head regions;
32};
33extern struct resv_map *resv_map_alloc(void);
34void resv_map_release(struct kref *ref);
35
26extern spinlock_t hugetlb_lock; 36extern spinlock_t hugetlb_lock;
27extern int hugetlb_max_hstate __read_mostly; 37extern int hugetlb_max_hstate __read_mostly;
28#define for_each_hstate(h) \ 38#define for_each_hstate(h) \
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index 787bba3bf552..0129f89cf98d 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -49,7 +49,7 @@ int set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg)
49 49
50static inline bool hugetlb_cgroup_disabled(void) 50static inline bool hugetlb_cgroup_disabled(void)
51{ 51{
52 if (hugetlb_subsys.disabled) 52 if (hugetlb_cgrp_subsys.disabled)
53 return true; 53 return true;
54 return false; 54 return false;
55} 55}
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 344883dce584..ab7359fde987 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -25,328 +25,11 @@
25#ifndef _HYPERV_H 25#ifndef _HYPERV_H
26#define _HYPERV_H 26#define _HYPERV_H
27 27
28#include <linux/types.h> 28#include <uapi/linux/hyperv.h>
29
30/*
31 * Framework version for util services.
32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
38#define UTIL_FW_MAJOR 3
39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
40
41
42/*
43 * Implementation of host controlled snapshot of the guest.
44 */
45
46#define VSS_OP_REGISTER 128
47
48enum hv_vss_op {
49 VSS_OP_CREATE = 0,
50 VSS_OP_DELETE,
51 VSS_OP_HOT_BACKUP,
52 VSS_OP_GET_DM_INFO,
53 VSS_OP_BU_COMPLETE,
54 /*
55 * Following operations are only supported with IC version >= 5.0
56 */
57 VSS_OP_FREEZE, /* Freeze the file systems in the VM */
58 VSS_OP_THAW, /* Unfreeze the file systems */
59 VSS_OP_AUTO_RECOVER,
60 VSS_OP_COUNT /* Number of operations, must be last */
61};
62
63
64/*
65 * Header for all VSS messages.
66 */
67struct hv_vss_hdr {
68 __u8 operation;
69 __u8 reserved[7];
70} __attribute__((packed));
71
72
73/*
74 * Flag values for the hv_vss_check_feature. Linux supports only
75 * one value.
76 */
77#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
78
79struct hv_vss_check_feature {
80 __u32 flags;
81} __attribute__((packed));
82
83struct hv_vss_check_dm_info {
84 __u32 flags;
85} __attribute__((packed));
86
87struct hv_vss_msg {
88 union {
89 struct hv_vss_hdr vss_hdr;
90 int error;
91 };
92 union {
93 struct hv_vss_check_feature vss_cf;
94 struct hv_vss_check_dm_info dm_info;
95 };
96} __attribute__((packed));
97
98/*
99 * An implementation of HyperV key value pair (KVP) functionality for Linux.
100 *
101 *
102 * Copyright (C) 2010, Novell, Inc.
103 * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
104 *
105 */
106
107/*
108 * Maximum value size - used for both key names and value data, and includes
109 * any applicable NULL terminators.
110 *
111 * Note: This limit is somewhat arbitrary, but falls easily within what is
112 * supported for all native guests (back to Win 2000) and what is reasonable
113 * for the IC KVP exchange functionality. Note that Windows Me/98/95 are
114 * limited to 255 character key names.
115 *
116 * MSDN recommends not storing data values larger than 2048 bytes in the
117 * registry.
118 *
119 * Note: This value is used in defining the KVP exchange message - this value
120 * cannot be modified without affecting the message size and compatibility.
121 */
122
123/*
124 * bytes, including any null terminators
125 */
126#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
127
128
129/*
130 * Maximum key size - the registry limit for the length of an entry name
131 * is 256 characters, including the null terminator
132 */
133
134#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
135
136/*
137 * In Linux, we implement the KVP functionality in two components:
138 * 1) The kernel component which is packaged as part of the hv_utils driver
139 * is responsible for communicating with the host and responsible for
140 * implementing the host/guest protocol. 2) A user level daemon that is
141 * responsible for data gathering.
142 *
143 * Host/Guest Protocol: The host iterates over an index and expects the guest
144 * to assign a key name to the index and also return the value corresponding to
145 * the key. The host will have atmost one KVP transaction outstanding at any
146 * given point in time. The host side iteration stops when the guest returns
147 * an error. Microsoft has specified the following mapping of key names to
148 * host specified index:
149 *
150 * Index Key Name
151 * 0 FullyQualifiedDomainName
152 * 1 IntegrationServicesVersion
153 * 2 NetworkAddressIPv4
154 * 3 NetworkAddressIPv6
155 * 4 OSBuildNumber
156 * 5 OSName
157 * 6 OSMajorVersion
158 * 7 OSMinorVersion
159 * 8 OSVersion
160 * 9 ProcessorArchitecture
161 *
162 * The Windows host expects the Key Name and Key Value to be encoded in utf16.
163 *
164 * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
165 * data gathering functionality in a user mode daemon. The user level daemon
166 * is also responsible for binding the key name to the index as well. The
167 * kernel and user-level daemon communicate using a connector channel.
168 *
169 * The user mode component first registers with the
170 * the kernel component. Subsequently, the kernel component requests, data
171 * for the specified keys. In response to this message the user mode component
172 * fills in the value corresponding to the specified key. We overload the
173 * sequence field in the cn_msg header to define our KVP message types.
174 *
175 *
176 * The kernel component simply acts as a conduit for communication between the
177 * Windows host and the user-level daemon. The kernel component passes up the
178 * index received from the Host to the user-level daemon. If the index is
179 * valid (supported), the corresponding key as well as its
180 * value (both are strings) is returned. If the index is invalid
181 * (not supported), a NULL key string is returned.
182 */
183
184
185/*
186 * Registry value types.
187 */
188
189#define REG_SZ 1
190#define REG_U32 4
191#define REG_U64 8
192
193/*
194 * As we look at expanding the KVP functionality to include
195 * IP injection functionality, we need to maintain binary
196 * compatibility with older daemons.
197 *
198 * The KVP opcodes are defined by the host and it was unfortunate
199 * that I chose to treat the registration operation as part of the
200 * KVP operations defined by the host.
201 * Here is the level of compatibility
202 * (between the user level daemon and the kernel KVP driver) that we
203 * will implement:
204 *
205 * An older daemon will always be supported on a newer driver.
206 * A given user level daemon will require a minimal version of the
207 * kernel driver.
208 * If we cannot handle the version differences, we will fail gracefully
209 * (this can happen when we have a user level daemon that is more
210 * advanced than the KVP driver.
211 *
212 * We will use values used in this handshake for determining if we have
213 * workable user level daemon and the kernel driver. We begin by taking the
214 * registration opcode out of the KVP opcode namespace. We will however,
215 * maintain compatibility with the existing user-level daemon code.
216 */
217
218/*
219 * Daemon code not supporting IP injection (legacy daemon).
220 */
221
222#define KVP_OP_REGISTER 4
223
224/*
225 * Daemon code supporting IP injection.
226 * The KVP opcode field is used to communicate the
227 * registration information; so define a namespace that
228 * will be distinct from the host defined KVP opcode.
229 */
230
231#define KVP_OP_REGISTER1 100
232
233enum hv_kvp_exchg_op {
234 KVP_OP_GET = 0,
235 KVP_OP_SET,
236 KVP_OP_DELETE,
237 KVP_OP_ENUMERATE,
238 KVP_OP_GET_IP_INFO,
239 KVP_OP_SET_IP_INFO,
240 KVP_OP_COUNT /* Number of operations, must be last. */
241};
242
243enum hv_kvp_exchg_pool {
244 KVP_POOL_EXTERNAL = 0,
245 KVP_POOL_GUEST,
246 KVP_POOL_AUTO,
247 KVP_POOL_AUTO_EXTERNAL,
248 KVP_POOL_AUTO_INTERNAL,
249 KVP_POOL_COUNT /* Number of pools, must be last. */
250};
251
252/*
253 * Some Hyper-V status codes.
254 */
255 29
256#define HV_S_OK 0x00000000 30#include <linux/types.h>
257#define HV_E_FAIL 0x80004005
258#define HV_S_CONT 0x80070103
259#define HV_ERROR_NOT_SUPPORTED 0x80070032
260#define HV_ERROR_MACHINE_LOCKED 0x800704F7
261#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
262#define HV_INVALIDARG 0x80070057
263#define HV_GUID_NOTFOUND 0x80041002
264
265#define ADDR_FAMILY_NONE 0x00
266#define ADDR_FAMILY_IPV4 0x01
267#define ADDR_FAMILY_IPV6 0x02
268
269#define MAX_ADAPTER_ID_SIZE 128
270#define MAX_IP_ADDR_SIZE 1024
271#define MAX_GATEWAY_SIZE 512
272
273
274struct hv_kvp_ipaddr_value {
275 __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
276 __u8 addr_family;
277 __u8 dhcp_enabled;
278 __u16 ip_addr[MAX_IP_ADDR_SIZE];
279 __u16 sub_net[MAX_IP_ADDR_SIZE];
280 __u16 gate_way[MAX_GATEWAY_SIZE];
281 __u16 dns_addr[MAX_IP_ADDR_SIZE];
282} __attribute__((packed));
283
284
285struct hv_kvp_hdr {
286 __u8 operation;
287 __u8 pool;
288 __u16 pad;
289} __attribute__((packed));
290
291struct hv_kvp_exchg_msg_value {
292 __u32 value_type;
293 __u32 key_size;
294 __u32 value_size;
295 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
296 union {
297 __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
298 __u32 value_u32;
299 __u64 value_u64;
300 };
301} __attribute__((packed));
302
303struct hv_kvp_msg_enumerate {
304 __u32 index;
305 struct hv_kvp_exchg_msg_value data;
306} __attribute__((packed));
307
308struct hv_kvp_msg_get {
309 struct hv_kvp_exchg_msg_value data;
310};
311
312struct hv_kvp_msg_set {
313 struct hv_kvp_exchg_msg_value data;
314};
315
316struct hv_kvp_msg_delete {
317 __u32 key_size;
318 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
319};
320
321struct hv_kvp_register {
322 __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
323};
324
325struct hv_kvp_msg {
326 union {
327 struct hv_kvp_hdr kvp_hdr;
328 int error;
329 };
330 union {
331 struct hv_kvp_msg_get kvp_get;
332 struct hv_kvp_msg_set kvp_set;
333 struct hv_kvp_msg_delete kvp_delete;
334 struct hv_kvp_msg_enumerate kvp_enum_data;
335 struct hv_kvp_ipaddr_value kvp_ip_val;
336 struct hv_kvp_register kvp_register;
337 } body;
338} __attribute__((packed));
339
340struct hv_kvp_ip_msg {
341 __u8 operation;
342 __u8 pool;
343 struct hv_kvp_ipaddr_value kvp_ip_val;
344} __attribute__((packed));
345
346#ifdef __KERNEL__
347#include <linux/scatterlist.h> 31#include <linux/scatterlist.h>
348#include <linux/list.h> 32#include <linux/list.h>
349#include <linux/uuid.h>
350#include <linux/timer.h> 33#include <linux/timer.h>
351#include <linux/workqueue.h> 34#include <linux/workqueue.h>
352#include <linux/completion.h> 35#include <linux/completion.h>
@@ -354,7 +37,7 @@ struct hv_kvp_ip_msg {
354#include <linux/mod_devicetable.h> 37#include <linux/mod_devicetable.h>
355 38
356 39
357#define MAX_PAGE_BUFFER_COUNT 19 40#define MAX_PAGE_BUFFER_COUNT 32
358#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */ 41#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
359 42
360#pragma pack(push, 1) 43#pragma pack(push, 1)
@@ -1043,6 +726,10 @@ struct vmbus_channel {
1043 * This will be NULL for the primary channel. 726 * This will be NULL for the primary channel.
1044 */ 727 */
1045 struct vmbus_channel *primary_channel; 728 struct vmbus_channel *primary_channel;
729 /*
730 * Support per-channel state for use by vmbus drivers.
731 */
732 void *per_channel_state;
1046}; 733};
1047 734
1048static inline void set_channel_read_state(struct vmbus_channel *c, bool state) 735static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
@@ -1050,6 +737,16 @@ static inline void set_channel_read_state(struct vmbus_channel *c, bool state)
1050 c->batched_reading = state; 737 c->batched_reading = state;
1051} 738}
1052 739
740static inline void set_per_channel_state(struct vmbus_channel *c, void *s)
741{
742 c->per_channel_state = s;
743}
744
745static inline void *get_per_channel_state(struct vmbus_channel *c)
746{
747 return c->per_channel_state;
748}
749
1053void vmbus_onmessage(void *context); 750void vmbus_onmessage(void *context);
1054 751
1055int vmbus_request_offers(void); 752int vmbus_request_offers(void);
@@ -1118,7 +815,7 @@ extern int vmbus_open(struct vmbus_channel *channel,
1118extern void vmbus_close(struct vmbus_channel *channel); 815extern void vmbus_close(struct vmbus_channel *channel);
1119 816
1120extern int vmbus_sendpacket(struct vmbus_channel *channel, 817extern int vmbus_sendpacket(struct vmbus_channel *channel,
1121 const void *buffer, 818 void *buffer,
1122 u32 bufferLen, 819 u32 bufferLen,
1123 u64 requestid, 820 u64 requestid,
1124 enum vmbus_packet_type type, 821 enum vmbus_packet_type type,
@@ -1352,6 +1049,17 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);
1352 } 1049 }
1353 1050
1354/* 1051/*
1052 * Guest File Copy Service
1053 * {34D14BE3-DEE4-41c8-9AE7-6B174977C192}
1054 */
1055
1056#define HV_FCOPY_GUID \
1057 .guid = { \
1058 0xE3, 0x4B, 0xD1, 0x34, 0xE4, 0xDE, 0xC8, 0x41, \
1059 0x9A, 0xE7, 0x6B, 0x17, 0x49, 0x77, 0xC1, 0x92 \
1060 }
1061
1062/*
1355 * Common header for Hyper-V ICs 1063 * Common header for Hyper-V ICs
1356 */ 1064 */
1357 1065
@@ -1459,11 +1167,12 @@ int hv_vss_init(struct hv_util_service *);
1459void hv_vss_deinit(void); 1167void hv_vss_deinit(void);
1460void hv_vss_onchannelcallback(void *); 1168void hv_vss_onchannelcallback(void *);
1461 1169
1170extern struct resource hyperv_mmio;
1171
1462/* 1172/*
1463 * Negotiated version with the Host. 1173 * Negotiated version with the Host.
1464 */ 1174 */
1465 1175
1466extern __u32 vmbus_proto_version; 1176extern __u32 vmbus_proto_version;
1467 1177
1468#endif /* __KERNEL__ */
1469#endif /* _HYPERV_H */ 1178#endif /* _HYPERV_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index deddeb8c337c..b556e0ab946f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -487,6 +487,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 487#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 488#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
489#define I2C_CLASS_SPD (1<<7) /* Memory modules */ 489#define I2C_CLASS_SPD (1<<7) /* Memory modules */
490#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */
490 491
491/* Internal numbers to terminate lists */ 492/* Internal numbers to terminate lists */
492#define I2C_CLIENT_END 0xfffeU 493#define I2C_CLIENT_END 0xfffeU
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index d8341cb47b60..c2153049cfbd 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -161,10 +161,10 @@ struct adp5588_gpio_platform_data {
161 unsigned irq_base; /* interrupt base # */ 161 unsigned irq_base; /* interrupt base # */
162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ 162 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
163 int (*setup)(struct i2c_client *client, 163 int (*setup)(struct i2c_client *client,
164 int gpio, unsigned ngpio, 164 unsigned gpio, unsigned ngpio,
165 void *context); 165 void *context);
166 int (*teardown)(struct i2c_client *client, 166 int (*teardown)(struct i2c_client *client,
167 int gpio, unsigned ngpio, 167 unsigned gpio, unsigned ngpio,
168 void *context); 168 void *context);
169 void *context; 169 void *context;
170}; 170};
diff --git a/include/linux/i2c/bfin_twi.h b/include/linux/i2c/bfin_twi.h
new file mode 100644
index 000000000000..135a4e0876ae
--- /dev/null
+++ b/include/linux/i2c/bfin_twi.h
@@ -0,0 +1,145 @@
1/*
2 * i2c-bfin-twi.h - interface to ADI TWI controller
3 *
4 * Copyright 2005-2014 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __I2C_BFIN_TWI_H__
10#define __I2C_BFIN_TWI_H__
11
12#include <linux/types.h>
13#include <linux/i2c.h>
14
15/*
16 * ADI twi registers layout
17 */
18struct bfin_twi_regs {
19 u16 clkdiv;
20 u16 dummy1;
21 u16 control;
22 u16 dummy2;
23 u16 slave_ctl;
24 u16 dummy3;
25 u16 slave_stat;
26 u16 dummy4;
27 u16 slave_addr;
28 u16 dummy5;
29 u16 master_ctl;
30 u16 dummy6;
31 u16 master_stat;
32 u16 dummy7;
33 u16 master_addr;
34 u16 dummy8;
35 u16 int_stat;
36 u16 dummy9;
37 u16 int_mask;
38 u16 dummy10;
39 u16 fifo_ctl;
40 u16 dummy11;
41 u16 fifo_stat;
42 u16 dummy12;
43 u32 __pad[20];
44 u16 xmt_data8;
45 u16 dummy13;
46 u16 xmt_data16;
47 u16 dummy14;
48 u16 rcv_data8;
49 u16 dummy15;
50 u16 rcv_data16;
51 u16 dummy16;
52};
53
54struct bfin_twi_iface {
55 int irq;
56 spinlock_t lock;
57 char read_write;
58 u8 command;
59 u8 *transPtr;
60 int readNum;
61 int writeNum;
62 int cur_mode;
63 int manual_stop;
64 int result;
65 struct i2c_adapter adap;
66 struct completion complete;
67 struct i2c_msg *pmsg;
68 int msg_num;
69 int cur_msg;
70 u16 saved_clkdiv;
71 u16 saved_control;
72 struct bfin_twi_regs __iomem *regs_base;
73};
74
75/* ******************** TWO-WIRE INTERFACE (TWI) MASKS ********************/
76/* TWI_CLKDIV Macros (Use: *pTWI_CLKDIV = CLKLOW(x)|CLKHI(y); ) */
77#define CLKLOW(x) ((x) & 0xFF) /* Periods Clock Is Held Low */
78#define CLKHI(y) (((y)&0xFF)<<0x8) /* Periods Before New Clock Low */
79
80/* TWI_PRESCALE Masks */
81#define PRESCALE 0x007F /* SCLKs Per Internal Time Reference (10MHz) */
82#define TWI_ENA 0x0080 /* TWI Enable */
83#define SCCB 0x0200 /* SCCB Compatibility Enable */
84
85/* TWI_SLAVE_CTL Masks */
86#define SEN 0x0001 /* Slave Enable */
87#define SADD_LEN 0x0002 /* Slave Address Length */
88#define STDVAL 0x0004 /* Slave Transmit Data Valid */
89#define NAK 0x0008 /* NAK Generated At Conclusion Of Transfer */
90#define GEN 0x0010 /* General Call Address Matching Enabled */
91
92/* TWI_SLAVE_STAT Masks */
93#define SDIR 0x0001 /* Slave Transfer Direction (RX/TX*) */
94#define GCALL 0x0002 /* General Call Indicator */
95
96/* TWI_MASTER_CTL Masks */
97#define MEN 0x0001 /* Master Mode Enable */
98#define MADD_LEN 0x0002 /* Master Address Length */
99#define MDIR 0x0004 /* Master Transmit Direction (RX/TX*) */
100#define FAST 0x0008 /* Use Fast Mode Timing Specs */
101#define STOP 0x0010 /* Issue Stop Condition */
102#define RSTART 0x0020 /* Repeat Start or Stop* At End Of Transfer */
103#define DCNT 0x3FC0 /* Data Bytes To Transfer */
104#define SDAOVR 0x4000 /* Serial Data Override */
105#define SCLOVR 0x8000 /* Serial Clock Override */
106
107/* TWI_MASTER_STAT Masks */
108#define MPROG 0x0001 /* Master Transfer In Progress */
109#define LOSTARB 0x0002 /* Lost Arbitration Indicator (Xfer Aborted) */
110#define ANAK 0x0004 /* Address Not Acknowledged */
111#define DNAK 0x0008 /* Data Not Acknowledged */
112#define BUFRDERR 0x0010 /* Buffer Read Error */
113#define BUFWRERR 0x0020 /* Buffer Write Error */
114#define SDASEN 0x0040 /* Serial Data Sense */
115#define SCLSEN 0x0080 /* Serial Clock Sense */
116#define BUSBUSY 0x0100 /* Bus Busy Indicator */
117
118/* TWI_INT_SRC and TWI_INT_ENABLE Masks */
119#define SINIT 0x0001 /* Slave Transfer Initiated */
120#define SCOMP 0x0002 /* Slave Transfer Complete */
121#define SERR 0x0004 /* Slave Transfer Error */
122#define SOVF 0x0008 /* Slave Overflow */
123#define MCOMP 0x0010 /* Master Transfer Complete */
124#define MERR 0x0020 /* Master Transfer Error */
125#define XMTSERV 0x0040 /* Transmit FIFO Service */
126#define RCVSERV 0x0080 /* Receive FIFO Service */
127
128/* TWI_FIFO_CTRL Masks */
129#define XMTFLUSH 0x0001 /* Transmit Buffer Flush */
130#define RCVFLUSH 0x0002 /* Receive Buffer Flush */
131#define XMTINTLEN 0x0004 /* Transmit Buffer Interrupt Length */
132#define RCVINTLEN 0x0008 /* Receive Buffer Interrupt Length */
133
134/* TWI_FIFO_STAT Masks */
135#define XMTSTAT 0x0003 /* Transmit FIFO Status */
136#define XMT_EMPTY 0x0000 /* Transmit FIFO Empty */
137#define XMT_HALF 0x0001 /* Transmit FIFO Has 1 Byte To Write */
138#define XMT_FULL 0x0003 /* Transmit FIFO Full (2 Bytes To Write) */
139
140#define RCVSTAT 0x000C /* Receive FIFO Status */
141#define RCV_EMPTY 0x0000 /* Receive FIFO Empty */
142#define RCV_HALF 0x0004 /* Receive FIFO Has 1 Byte To Read */
143#define RCV_FULL 0x000C /* Receive FIFO Full (2 Bytes To Read) */
144
145#endif
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index ade1c06d4ceb..d2b16704624c 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -195,6 +195,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
195 return twl_i2c_read(mod_no, val, reg, 1); 195 return twl_i2c_read(mod_no, val, reg, 1);
196} 196}
197 197
198static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
199 val = cpu_to_le16(val);
200 return twl_i2c_write(mod_no, (u8*) &val, reg, 2);
201}
202
203static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
204 int ret;
205 ret = twl_i2c_read(mod_no, (u8*) val, reg, 2);
206 *val = le16_to_cpu(*val);
207 return ret;
208}
209
198int twl_get_type(void); 210int twl_get_type(void);
199int twl_get_version(void); 211int twl_get_version(void);
200int twl_get_hfclk_rate(void); 212int twl_get_hfclk_rate(void);
diff --git a/include/linux/i2c/twl4030-madc.h b/include/linux/i2c/twl4030-madc.h
index 01f595107048..1c0134dd3271 100644
--- a/include/linux/i2c/twl4030-madc.h
+++ b/include/linux/i2c/twl4030-madc.h
@@ -44,7 +44,7 @@ struct twl4030_madc_conversion_method {
44 44
45struct twl4030_madc_request { 45struct twl4030_madc_request {
46 unsigned long channels; 46 unsigned long channels;
47 u16 do_avg; 47 bool do_avg;
48 u16 method; 48 u16 method;
49 u16 type; 49 u16 type;
50 bool active; 50 bool active;
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 871a213a8477..6af3400b9b2f 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -82,9 +82,9 @@ int idr_for_each(struct idr *idp,
82void *idr_get_next(struct idr *idp, int *nextid); 82void *idr_get_next(struct idr *idp, int *nextid);
83void *idr_replace(struct idr *idp, void *ptr, int id); 83void *idr_replace(struct idr *idp, void *ptr, int id);
84void idr_remove(struct idr *idp, int id); 84void idr_remove(struct idr *idp, int id);
85void idr_free(struct idr *idp, int id);
86void idr_destroy(struct idr *idp); 85void idr_destroy(struct idr *idp);
87void idr_init(struct idr *idp); 86void idr_init(struct idr *idp);
87bool idr_is_empty(struct idr *idp);
88 88
89/** 89/**
90 * idr_preload_end - end preload section started with idr_preload() 90 * idr_preload_end - end preload section started with idr_preload()
@@ -133,69 +133,6 @@ static inline void *idr_find(struct idr *idr, int id)
133 for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id) 133 for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)
134 134
135/* 135/*
136 * Don't use the following functions. These exist only to suppress
137 * deprecated warnings on EXPORT_SYMBOL()s.
138 */
139int __idr_pre_get(struct idr *idp, gfp_t gfp_mask);
140int __idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
141void __idr_remove_all(struct idr *idp);
142
143/**
144 * idr_pre_get - reserve resources for idr allocation
145 * @idp: idr handle
146 * @gfp_mask: memory allocation flags
147 *
148 * Part of old alloc interface. This is going away. Use
149 * idr_preload[_end]() and idr_alloc() instead.
150 */
151static inline int __deprecated idr_pre_get(struct idr *idp, gfp_t gfp_mask)
152{
153 return __idr_pre_get(idp, gfp_mask);
154}
155
156/**
157 * idr_get_new_above - allocate new idr entry above or equal to a start id
158 * @idp: idr handle
159 * @ptr: pointer you want associated with the id
160 * @starting_id: id to start search at
161 * @id: pointer to the allocated handle
162 *
163 * Part of old alloc interface. This is going away. Use
164 * idr_preload[_end]() and idr_alloc() instead.
165 */
166static inline int __deprecated idr_get_new_above(struct idr *idp, void *ptr,
167 int starting_id, int *id)
168{
169 return __idr_get_new_above(idp, ptr, starting_id, id);
170}
171
172/**
173 * idr_get_new - allocate new idr entry
174 * @idp: idr handle
175 * @ptr: pointer you want associated with the id
176 * @id: pointer to the allocated handle
177 *
178 * Part of old alloc interface. This is going away. Use
179 * idr_preload[_end]() and idr_alloc() instead.
180 */
181static inline int __deprecated idr_get_new(struct idr *idp, void *ptr, int *id)
182{
183 return __idr_get_new_above(idp, ptr, 0, id);
184}
185
186/**
187 * idr_remove_all - remove all ids from the given idr tree
188 * @idp: idr handle
189 *
190 * If you're trying to destroy @idp, calling idr_destroy() is enough.
191 * This is going away. Don't use.
192 */
193static inline void __deprecated idr_remove_all(struct idr *idp)
194{
195 __idr_remove_all(idp);
196}
197
198/*
199 * IDA - IDR based id allocator, use when translation from id to 136 * IDA - IDR based id allocator, use when translation from id to
200 * pointer isn't necessary. 137 * pointer isn't necessary.
201 * 138 *
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index e526a8cecb70..f194ccb8539c 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -154,6 +154,10 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
154 802.11e clarifies the figure in section 7.1.2. The frame body is 154 802.11e clarifies the figure in section 7.1.2. The frame body is
155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ 155 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
156#define IEEE80211_MAX_DATA_LEN 2304 156#define IEEE80211_MAX_DATA_LEN 2304
157/* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks
158 * to 7920 bytes, see 8.2.3 General frame format
159 */
160#define IEEE80211_MAX_DATA_LEN_DMG 7920
157/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ 161/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
158#define IEEE80211_MAX_FRAME_LEN 2352 162#define IEEE80211_MAX_FRAME_LEN 2352
159 163
@@ -597,6 +601,20 @@ static inline int ieee80211_is_qos_nullfunc(__le16 fc)
597} 601}
598 602
599/** 603/**
604 * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
605 * @fc: frame control field in little-endian byteorder
606 */
607static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
608{
609 /* IEEE 802.11-2012, definition of "bufferable management frame";
610 * note that this ignores the IBSS special case. */
611 return ieee80211_is_mgmt(fc) &&
612 (ieee80211_is_action(fc) ||
613 ieee80211_is_disassoc(fc) ||
614 ieee80211_is_deauth(fc));
615}
616
617/**
600 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set 618 * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
601 * @seq_ctrl: frame sequence control bytes in little-endian byteorder 619 * @seq_ctrl: frame sequence control bytes in little-endian byteorder
602 */ 620 */
@@ -1636,51 +1654,22 @@ enum ieee80211_reasoncode {
1636enum ieee80211_eid { 1654enum ieee80211_eid {
1637 WLAN_EID_SSID = 0, 1655 WLAN_EID_SSID = 0,
1638 WLAN_EID_SUPP_RATES = 1, 1656 WLAN_EID_SUPP_RATES = 1,
1639 WLAN_EID_FH_PARAMS = 2, 1657 WLAN_EID_FH_PARAMS = 2, /* reserved now */
1640 WLAN_EID_DS_PARAMS = 3, 1658 WLAN_EID_DS_PARAMS = 3,
1641 WLAN_EID_CF_PARAMS = 4, 1659 WLAN_EID_CF_PARAMS = 4,
1642 WLAN_EID_TIM = 5, 1660 WLAN_EID_TIM = 5,
1643 WLAN_EID_IBSS_PARAMS = 6, 1661 WLAN_EID_IBSS_PARAMS = 6,
1644 WLAN_EID_CHALLENGE = 16,
1645
1646 WLAN_EID_COUNTRY = 7, 1662 WLAN_EID_COUNTRY = 7,
1647 WLAN_EID_HP_PARAMS = 8, 1663 WLAN_EID_HP_PARAMS = 8,
1648 WLAN_EID_HP_TABLE = 9, 1664 WLAN_EID_HP_TABLE = 9,
1649 WLAN_EID_REQUEST = 10, 1665 WLAN_EID_REQUEST = 10,
1650
1651 WLAN_EID_QBSS_LOAD = 11, 1666 WLAN_EID_QBSS_LOAD = 11,
1652 WLAN_EID_EDCA_PARAM_SET = 12, 1667 WLAN_EID_EDCA_PARAM_SET = 12,
1653 WLAN_EID_TSPEC = 13, 1668 WLAN_EID_TSPEC = 13,
1654 WLAN_EID_TCLAS = 14, 1669 WLAN_EID_TCLAS = 14,
1655 WLAN_EID_SCHEDULE = 15, 1670 WLAN_EID_SCHEDULE = 15,
1656 WLAN_EID_TS_DELAY = 43, 1671 WLAN_EID_CHALLENGE = 16,
1657 WLAN_EID_TCLAS_PROCESSING = 44, 1672 /* 17-31 reserved for challenge text extension */
1658 WLAN_EID_QOS_CAPA = 46,
1659 /* 802.11z */
1660 WLAN_EID_LINK_ID = 101,
1661 /* 802.11s */
1662 WLAN_EID_MESH_CONFIG = 113,
1663 WLAN_EID_MESH_ID = 114,
1664 WLAN_EID_LINK_METRIC_REPORT = 115,
1665 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1666 WLAN_EID_PEER_MGMT = 117,
1667 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1668 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1669 WLAN_EID_BEACON_TIMING = 120,
1670 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1671 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1672 WLAN_EID_MCCAOP_ADVERT = 123,
1673 WLAN_EID_MCCAOP_TEARDOWN = 124,
1674 WLAN_EID_GANN = 125,
1675 WLAN_EID_RANN = 126,
1676 WLAN_EID_PREQ = 130,
1677 WLAN_EID_PREP = 131,
1678 WLAN_EID_PERR = 132,
1679 WLAN_EID_PXU = 137,
1680 WLAN_EID_PXUC = 138,
1681 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1682 WLAN_EID_MIC = 140,
1683
1684 WLAN_EID_PWR_CONSTRAINT = 32, 1673 WLAN_EID_PWR_CONSTRAINT = 32,
1685 WLAN_EID_PWR_CAPABILITY = 33, 1674 WLAN_EID_PWR_CAPABILITY = 33,
1686 WLAN_EID_TPC_REQUEST = 34, 1675 WLAN_EID_TPC_REQUEST = 34,
@@ -1691,66 +1680,114 @@ enum ieee80211_eid {
1691 WLAN_EID_MEASURE_REPORT = 39, 1680 WLAN_EID_MEASURE_REPORT = 39,
1692 WLAN_EID_QUIET = 40, 1681 WLAN_EID_QUIET = 40,
1693 WLAN_EID_IBSS_DFS = 41, 1682 WLAN_EID_IBSS_DFS = 41,
1694
1695 WLAN_EID_ERP_INFO = 42, 1683 WLAN_EID_ERP_INFO = 42,
1696 WLAN_EID_EXT_SUPP_RATES = 50, 1684 WLAN_EID_TS_DELAY = 43,
1697 1685 WLAN_EID_TCLAS_PROCESSING = 44,
1698 WLAN_EID_HT_CAPABILITY = 45, 1686 WLAN_EID_HT_CAPABILITY = 45,
1699 WLAN_EID_HT_OPERATION = 61, 1687 WLAN_EID_QOS_CAPA = 46,
1700 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62, 1688 /* 47 reserved for Broadcom */
1701
1702 WLAN_EID_RSN = 48, 1689 WLAN_EID_RSN = 48,
1703 WLAN_EID_MMIE = 76, 1690 WLAN_EID_802_15_COEX = 49,
1704 WLAN_EID_VENDOR_SPECIFIC = 221, 1691 WLAN_EID_EXT_SUPP_RATES = 50,
1705 WLAN_EID_QOS_PARAMETER = 222,
1706
1707 WLAN_EID_AP_CHAN_REPORT = 51, 1692 WLAN_EID_AP_CHAN_REPORT = 51,
1708 WLAN_EID_NEIGHBOR_REPORT = 52, 1693 WLAN_EID_NEIGHBOR_REPORT = 52,
1709 WLAN_EID_RCPI = 53, 1694 WLAN_EID_RCPI = 53,
1695 WLAN_EID_MOBILITY_DOMAIN = 54,
1696 WLAN_EID_FAST_BSS_TRANSITION = 55,
1697 WLAN_EID_TIMEOUT_INTERVAL = 56,
1698 WLAN_EID_RIC_DATA = 57,
1699 WLAN_EID_DSE_REGISTERED_LOCATION = 58,
1700 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
1701 WLAN_EID_EXT_CHANSWITCH_ANN = 60,
1702 WLAN_EID_HT_OPERATION = 61,
1703 WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
1710 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, 1704 WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
1711 WLAN_EID_ANTENNA_INFO = 64, 1705 WLAN_EID_ANTENNA_INFO = 64,
1712 WLAN_EID_RSNI = 65, 1706 WLAN_EID_RSNI = 65,
1713 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, 1707 WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
1714 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, 1708 WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
1715 WLAN_EID_BSS_AC_ACCESS_DELAY = 68, 1709 WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
1710 WLAN_EID_TIME_ADVERTISEMENT = 69,
1716 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, 1711 WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
1717 WLAN_EID_MULTIPLE_BSSID = 71, 1712 WLAN_EID_MULTIPLE_BSSID = 71,
1718 WLAN_EID_BSS_COEX_2040 = 72, 1713 WLAN_EID_BSS_COEX_2040 = 72,
1719 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, 1714 WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
1720 WLAN_EID_EXT_CAPABILITY = 127,
1721
1722 WLAN_EID_MOBILITY_DOMAIN = 54,
1723 WLAN_EID_FAST_BSS_TRANSITION = 55,
1724 WLAN_EID_TIMEOUT_INTERVAL = 56,
1725 WLAN_EID_RIC_DATA = 57,
1726 WLAN_EID_RIC_DESCRIPTOR = 75, 1715 WLAN_EID_RIC_DESCRIPTOR = 75,
1727 1716 WLAN_EID_MMIE = 76,
1728 WLAN_EID_DSE_REGISTERED_LOCATION = 58, 1717 WLAN_EID_ASSOC_COMEBACK_TIME = 77,
1729 WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, 1718 WLAN_EID_EVENT_REQUEST = 78,
1730 WLAN_EID_EXT_CHANSWITCH_ANN = 60, 1719 WLAN_EID_EVENT_REPORT = 79,
1731 1720 WLAN_EID_DIAGNOSTIC_REQUEST = 80,
1732 WLAN_EID_VHT_CAPABILITY = 191, 1721 WLAN_EID_DIAGNOSTIC_REPORT = 81,
1733 WLAN_EID_VHT_OPERATION = 192, 1722 WLAN_EID_LOCATION_PARAMS = 82,
1734 WLAN_EID_OPMODE_NOTIF = 199,
1735 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1736 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1737 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1738 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1739 WLAN_EID_AID = 197,
1740 WLAN_EID_QUIET_CHANNEL = 198,
1741
1742 /* 802.11ad */
1743 WLAN_EID_NON_TX_BSSID_CAP = 83, 1723 WLAN_EID_NON_TX_BSSID_CAP = 83,
1724 WLAN_EID_SSID_LIST = 84,
1725 WLAN_EID_MULTI_BSSID_IDX = 85,
1726 WLAN_EID_FMS_DESCRIPTOR = 86,
1727 WLAN_EID_FMS_REQUEST = 87,
1728 WLAN_EID_FMS_RESPONSE = 88,
1729 WLAN_EID_QOS_TRAFFIC_CAPA = 89,
1730 WLAN_EID_BSS_MAX_IDLE_PERIOD = 90,
1731 WLAN_EID_TSF_REQUEST = 91,
1732 WLAN_EID_TSF_RESPOSNE = 92,
1733 WLAN_EID_WNM_SLEEP_MODE = 93,
1734 WLAN_EID_TIM_BCAST_REQ = 94,
1735 WLAN_EID_TIM_BCAST_RESP = 95,
1736 WLAN_EID_COLL_IF_REPORT = 96,
1737 WLAN_EID_CHANNEL_USAGE = 97,
1738 WLAN_EID_TIME_ZONE = 98,
1739 WLAN_EID_DMS_REQUEST = 99,
1740 WLAN_EID_DMS_RESPONSE = 100,
1741 WLAN_EID_LINK_ID = 101,
1742 WLAN_EID_WAKEUP_SCHEDUL = 102,
1743 /* 103 reserved */
1744 WLAN_EID_CHAN_SWITCH_TIMING = 104,
1745 WLAN_EID_PTI_CONTROL = 105,
1746 WLAN_EID_PU_BUFFER_STATUS = 106,
1747 WLAN_EID_INTERWORKING = 107,
1748 WLAN_EID_ADVERTISEMENT_PROTOCOL = 108,
1749 WLAN_EID_EXPEDITED_BW_REQ = 109,
1750 WLAN_EID_QOS_MAP_SET = 110,
1751 WLAN_EID_ROAMING_CONSORTIUM = 111,
1752 WLAN_EID_EMERGENCY_ALERT = 112,
1753 WLAN_EID_MESH_CONFIG = 113,
1754 WLAN_EID_MESH_ID = 114,
1755 WLAN_EID_LINK_METRIC_REPORT = 115,
1756 WLAN_EID_CONGESTION_NOTIFICATION = 116,
1757 WLAN_EID_PEER_MGMT = 117,
1758 WLAN_EID_CHAN_SWITCH_PARAM = 118,
1759 WLAN_EID_MESH_AWAKE_WINDOW = 119,
1760 WLAN_EID_BEACON_TIMING = 120,
1761 WLAN_EID_MCCAOP_SETUP_REQ = 121,
1762 WLAN_EID_MCCAOP_SETUP_RESP = 122,
1763 WLAN_EID_MCCAOP_ADVERT = 123,
1764 WLAN_EID_MCCAOP_TEARDOWN = 124,
1765 WLAN_EID_GANN = 125,
1766 WLAN_EID_RANN = 126,
1767 WLAN_EID_EXT_CAPABILITY = 127,
1768 /* 128, 129 reserved for Agere */
1769 WLAN_EID_PREQ = 130,
1770 WLAN_EID_PREP = 131,
1771 WLAN_EID_PERR = 132,
1772 /* 133-136 reserved for Cisco */
1773 WLAN_EID_PXU = 137,
1774 WLAN_EID_PXUC = 138,
1775 WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
1776 WLAN_EID_MIC = 140,
1777 WLAN_EID_DESTINATION_URI = 141,
1778 WLAN_EID_UAPSD_COEX = 142,
1744 WLAN_EID_WAKEUP_SCHEDULE = 143, 1779 WLAN_EID_WAKEUP_SCHEDULE = 143,
1745 WLAN_EID_EXT_SCHEDULE = 144, 1780 WLAN_EID_EXT_SCHEDULE = 144,
1746 WLAN_EID_STA_AVAILABILITY = 145, 1781 WLAN_EID_STA_AVAILABILITY = 145,
1747 WLAN_EID_DMG_TSPEC = 146, 1782 WLAN_EID_DMG_TSPEC = 146,
1748 WLAN_EID_DMG_AT = 147, 1783 WLAN_EID_DMG_AT = 147,
1749 WLAN_EID_DMG_CAP = 148, 1784 WLAN_EID_DMG_CAP = 148,
1785 /* 149-150 reserved for Cisco */
1750 WLAN_EID_DMG_OPERATION = 151, 1786 WLAN_EID_DMG_OPERATION = 151,
1751 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152, 1787 WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
1752 WLAN_EID_DMG_BEAM_REFINEMENT = 153, 1788 WLAN_EID_DMG_BEAM_REFINEMENT = 153,
1753 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154, 1789 WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
1790 /* 155-156 reserved for Cisco */
1754 WLAN_EID_AWAKE_WINDOW = 157, 1791 WLAN_EID_AWAKE_WINDOW = 157,
1755 WLAN_EID_MULTI_BAND = 158, 1792 WLAN_EID_MULTI_BAND = 158,
1756 WLAN_EID_ADDBA_EXT = 159, 1793 WLAN_EID_ADDBA_EXT = 159,
@@ -1767,11 +1804,34 @@ enum ieee80211_eid {
1767 WLAN_EID_MULTIPLE_MAC_ADDR = 170, 1804 WLAN_EID_MULTIPLE_MAC_ADDR = 170,
1768 WLAN_EID_U_PID = 171, 1805 WLAN_EID_U_PID = 171,
1769 WLAN_EID_DMG_LINK_ADAPT_ACK = 172, 1806 WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
1807 /* 173 reserved for Symbol */
1808 WLAN_EID_MCCAOP_ADV_OVERVIEW = 174,
1770 WLAN_EID_QUIET_PERIOD_REQ = 175, 1809 WLAN_EID_QUIET_PERIOD_REQ = 175,
1810 /* 176 reserved for Symbol */
1771 WLAN_EID_QUIET_PERIOD_RESP = 177, 1811 WLAN_EID_QUIET_PERIOD_RESP = 177,
1812 /* 178-179 reserved for Symbol */
1813 /* 180 reserved for ISO/IEC 20011 */
1772 WLAN_EID_EPAC_POLICY = 182, 1814 WLAN_EID_EPAC_POLICY = 182,
1773 WLAN_EID_CLISTER_TIME_OFF = 183, 1815 WLAN_EID_CLISTER_TIME_OFF = 183,
1816 WLAN_EID_INTER_AC_PRIO = 184,
1817 WLAN_EID_SCS_DESCRIPTOR = 185,
1818 WLAN_EID_QLOAD_REPORT = 186,
1819 WLAN_EID_HCCA_TXOP_UPDATE_COUNT = 187,
1820 WLAN_EID_HL_STREAM_ID = 188,
1821 WLAN_EID_GCR_GROUP_ADDR = 189,
1774 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190, 1822 WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
1823 WLAN_EID_VHT_CAPABILITY = 191,
1824 WLAN_EID_VHT_OPERATION = 192,
1825 WLAN_EID_EXTENDED_BSS_LOAD = 193,
1826 WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
1827 WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
1828 WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
1829 WLAN_EID_AID = 197,
1830 WLAN_EID_QUIET_CHANNEL = 198,
1831 WLAN_EID_OPMODE_NOTIF = 199,
1832
1833 WLAN_EID_VENDOR_SPECIFIC = 221,
1834 WLAN_EID_QOS_PARAMETER = 222,
1775}; 1835};
1776 1836
1777/* Action category code */ 1837/* Action category code */
@@ -2192,10 +2252,10 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
2192} 2252}
2193 2253
2194/** 2254/**
2195 * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame 2255 * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
2196 * @hdr: the frame (buffer must include at least the first octet of payload) 2256 * @hdr: the frame (buffer must include at least the first octet of payload)
2197 */ 2257 */
2198static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) 2258static inline bool _ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2199{ 2259{
2200 if (ieee80211_is_disassoc(hdr->frame_control) || 2260 if (ieee80211_is_disassoc(hdr->frame_control) ||
2201 ieee80211_is_deauth(hdr->frame_control)) 2261 ieee80211_is_deauth(hdr->frame_control))
@@ -2224,6 +2284,17 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
2224} 2284}
2225 2285
2226/** 2286/**
2287 * ieee80211_is_robust_mgmt_frame - check if skb contains a robust mgmt frame
2288 * @skb: the skb containing the frame, length will be checked
2289 */
2290static inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
2291{
2292 if (skb->len < 25)
2293 return false;
2294 return _ieee80211_is_robust_mgmt_frame((void *)skb->data);
2295}
2296
2297/**
2227 * ieee80211_is_public_action - check if frame is a public action frame 2298 * ieee80211_is_public_action - check if frame is a public action frame
2228 * @hdr: the frame 2299 * @hdr: the frame
2229 * @len: length of the frame 2300 * @len: length of the frame
@@ -2241,42 +2312,6 @@ static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
2241} 2312}
2242 2313
2243/** 2314/**
2244 * ieee80211_dsss_chan_to_freq - get channel center frequency
2245 * @channel: the DSSS channel
2246 *
2247 * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
2248 * Ref IEEE 802.11-2007 section 15.6
2249 */
2250static inline int ieee80211_dsss_chan_to_freq(int channel)
2251{
2252 if ((channel > 0) && (channel < 14))
2253 return 2407 + (channel * 5);
2254 else if (channel == 14)
2255 return 2484;
2256 else
2257 return -1;
2258}
2259
2260/**
2261 * ieee80211_freq_to_dsss_chan - get channel
2262 * @freq: the frequency
2263 *
2264 * Convert frequency (MHz) to IEEE802.11 DSSS channel
2265 * Ref IEEE 802.11-2007 section 15.6
2266 *
2267 * This routine selects the channel with the closest center frequency.
2268 */
2269static inline int ieee80211_freq_to_dsss_chan(int freq)
2270{
2271 if ((freq >= 2410) && (freq < 2475))
2272 return (freq - 2405) / 5;
2273 else if ((freq >= 2482) && (freq < 2487))
2274 return 14;
2275 else
2276 return -1;
2277}
2278
2279/**
2280 * ieee80211_tu_to_usec - convert time units (TU) to microseconds 2315 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
2281 * @tu: the TUs 2316 * @tu: the TUs
2282 */ 2317 */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index bbedfb56bd66..13bbbde00e68 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -110,6 +110,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
110 __be16 vlan_proto, u16 vlan_id); 110 __be16 vlan_proto, u16 vlan_id);
111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 111extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
112extern u16 vlan_dev_vlan_id(const struct net_device *dev); 112extern u16 vlan_dev_vlan_id(const struct net_device *dev);
113extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);
113 114
114/** 115/**
115 * struct vlan_priority_tci_mapping - vlan egress priority mappings 116 * struct vlan_priority_tci_mapping - vlan egress priority mappings
@@ -216,6 +217,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
216 return 0; 217 return 0;
217} 218}
218 219
220static inline __be16 vlan_dev_vlan_proto(const struct net_device *dev)
221{
222 BUG();
223 return 0;
224}
225
219static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev, 226static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
220 u32 skprio) 227 u32 skprio)
221{ 228{
@@ -288,7 +295,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
288 struct vlan_ethhdr *veth; 295 struct vlan_ethhdr *veth;
289 296
290 if (skb_cow_head(skb, VLAN_HLEN) < 0) { 297 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
291 kfree_skb(skb); 298 dev_kfree_skb_any(skb);
292 return NULL; 299 return NULL;
293 } 300 }
294 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); 301 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 75a8a20c8179..5f2d00e7e488 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -254,12 +254,16 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
254 (chan->info_mask_shared_by_all & BIT(type)); 254 (chan->info_mask_shared_by_all & BIT(type));
255} 255}
256 256
257#define IIO_ST(si, rb, sb, sh) \ 257#define IIO_CHAN_SOFT_TIMESTAMP(_si) { \
258 { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh } 258 .type = IIO_TIMESTAMP, \
259 259 .channel = -1, \
260#define IIO_CHAN_SOFT_TIMESTAMP(_si) \ 260 .scan_index = _si, \
261 { .type = IIO_TIMESTAMP, .channel = -1, \ 261 .scan_type = { \
262 .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) } 262 .sign = 's', \
263 .realbits = 64, \
264 .storagebits = 64, \
265 }, \
266}
263 267
264/** 268/**
265 * iio_get_time_ns() - utility function to get a time stamp for events etc 269 * iio_get_time_ns() - utility function to get a time stamp for events etc
diff --git a/include/linux/input/pmic8xxx-keypad.h b/include/linux/input/pmic8xxx-keypad.h
deleted file mode 100644
index 5f1e2f9ad959..000000000000
--- a/include/linux/input/pmic8xxx-keypad.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
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 version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __PMIC8XXX_KEYPAD_H__
14#define __PMIC8XXX_KEYPAD_H__
15
16#include <linux/input/matrix_keypad.h>
17
18#define PM8XXX_KEYPAD_DEV_NAME "pm8xxx-keypad"
19
20/**
21 * struct pm8xxx_keypad_platform_data - platform data for keypad
22 * @keymap_data - matrix keymap data
23 * @input_name - input device name
24 * @input_phys_device - input device name
25 * @num_cols - number of columns of keypad
26 * @num_rows - number of row of keypad
27 * @debounce_ms - debounce period in milliseconds
28 * @scan_delay_ms - scan delay in milliseconds
29 * @row_hold_ns - row hold period in nanoseconds
30 * @wakeup - configure keypad as wakeup
31 * @rep - enable or disable key repeat bit
32 */
33struct pm8xxx_keypad_platform_data {
34 const struct matrix_keymap_data *keymap_data;
35
36 const char *input_name;
37 const char *input_phys_device;
38
39 unsigned int num_cols;
40 unsigned int num_rows;
41 unsigned int rows_gpio_start;
42 unsigned int cols_gpio_start;
43
44 unsigned int debounce_ms;
45 unsigned int scan_delay_ms;
46 unsigned int row_hold_ns;
47
48 bool wakeup;
49 bool rep;
50};
51
52#endif /*__PMIC8XXX_KEYPAD_H__ */
diff --git a/include/linux/input/pmic8xxx-pwrkey.h b/include/linux/input/pmic8xxx-pwrkey.h
deleted file mode 100644
index 6d2974e57109..000000000000
--- a/include/linux/input/pmic8xxx-pwrkey.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
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 version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __PMIC8XXX_PWRKEY_H__
14#define __PMIC8XXX_PWRKEY_H__
15
16#define PM8XXX_PWRKEY_DEV_NAME "pm8xxx-pwrkey"
17
18/**
19 * struct pm8xxx_pwrkey_platform_data - platform data for pwrkey driver
20 * @pull up: power on register control for pull up/down configuration
21 * @kpd_trigger_delay_us: time delay for power key state change interrupt
22 * trigger.
23 * @wakeup: configure power key as wakeup source
24 */
25struct pm8xxx_pwrkey_platform_data {
26 bool pull_up;
27 u32 kpd_trigger_delay_us;
28 u32 wakeup;
29};
30
31#endif /* __PMIC8XXX_PWRKEY_H__ */
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 2c4bed593b32..0a2da5188217 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -319,6 +319,7 @@ struct intel_iommu {
319 int agaw; /* agaw of this iommu */ 319 int agaw; /* agaw of this iommu */
320 int msagaw; /* max sagaw of this iommu */ 320 int msagaw; /* max sagaw of this iommu */
321 unsigned int irq; 321 unsigned int irq;
322 u16 segment; /* PCI segment# */
322 unsigned char name[13]; /* Device Name */ 323 unsigned char name[13]; /* Device Name */
323 324
324#ifdef CONFIG_INTEL_IOMMU 325#ifdef CONFIG_INTEL_IOMMU
diff --git a/include/linux/io.h b/include/linux/io.h
index 8a18e75600cc..b76e6e545806 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -41,7 +41,7 @@ static inline int ioremap_page_range(unsigned long addr, unsigned long end,
41/* 41/*
42 * Managed iomap interface 42 * Managed iomap interface
43 */ 43 */
44#ifdef CONFIG_HAS_IOPORT 44#ifdef CONFIG_HAS_IOPORT_MAP
45void __iomem * devm_ioport_map(struct device *dev, unsigned long port, 45void __iomem * devm_ioport_map(struct device *dev, unsigned long port,
46 unsigned int nr); 46 unsigned int nr);
47void devm_ioport_unmap(struct device *dev, void __iomem *addr); 47void devm_ioport_unmap(struct device *dev, void __iomem *addr);
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 89b7c24a36e9..5e3a906cc089 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -51,7 +51,7 @@ struct resource {
51 51
52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
53#define IORESOURCE_DISABLED 0x10000000 53#define IORESOURCE_DISABLED 0x10000000
54#define IORESOURCE_UNSET 0x20000000 54#define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */
55#define IORESOURCE_AUTO 0x40000000 55#define IORESOURCE_AUTO 0x40000000
56#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 56#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
57 57
@@ -169,6 +169,16 @@ static inline unsigned long resource_type(const struct resource *res)
169{ 169{
170 return res->flags & IORESOURCE_TYPE_BITS; 170 return res->flags & IORESOURCE_TYPE_BITS;
171} 171}
172/* True iff r1 completely contains r2 */
173static inline bool resource_contains(struct resource *r1, struct resource *r2)
174{
175 if (resource_type(r1) != resource_type(r2))
176 return false;
177 if (r1->flags & IORESOURCE_UNSET || r2->flags & IORESOURCE_UNSET)
178 return false;
179 return r1->start <= r2->start && r1->end >= r2->end;
180}
181
172 182
173/* Convenience shorthand with allocation */ 183/* Convenience shorthand with allocation */
174#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0) 184#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
diff --git a/include/linux/iova.h b/include/linux/iova.h
index 76a0759e88ec..3277f4711349 100644
--- a/include/linux/iova.h
+++ b/include/linux/iova.h
@@ -47,5 +47,7 @@ void copy_reserved_iova(struct iova_domain *from, struct iova_domain *to);
47void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit); 47void init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit);
48struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn); 48struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn);
49void put_iova_domain(struct iova_domain *iovad); 49void put_iova_domain(struct iova_domain *iovad);
50struct iova *split_and_remove_iova(struct iova_domain *iovad,
51 struct iova *iova, unsigned long pfn_lo, unsigned long pfn_hi);
50 52
51#endif 53#endif
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index 0ceb389dba6c..7ed92d0560d5 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -93,6 +93,11 @@ int gic_get_cpu_id(unsigned int cpu);
93void gic_migrate_target(unsigned int new_cpu_id); 93void gic_migrate_target(unsigned int new_cpu_id);
94unsigned long gic_get_sgir_physaddr(void); 94unsigned long gic_get_sgir_physaddr(void);
95 95
96extern const struct irq_domain_ops *gic_routable_irq_domain_ops;
97static inline void __init register_routable_domain_ops
98 (const struct irq_domain_ops *ops)
99{
100 gic_routable_irq_domain_ops = ops;
101}
96#endif /* __ASSEMBLY */ 102#endif /* __ASSEMBLY */
97
98#endif 103#endif
diff --git a/include/linux/irqchip/arm-vic.h b/include/linux/irqchip/arm-vic.h
index e3c82dc95756..ba46c794b4e5 100644
--- a/include/linux/irqchip/arm-vic.h
+++ b/include/linux/irqchip/arm-vic.h
@@ -29,8 +29,10 @@
29struct device_node; 29struct device_node;
30struct pt_regs; 30struct pt_regs;
31 31
32void __vic_init(void __iomem *base, int irq_start, u32 vic_sources, 32void __vic_init(void __iomem *base, int parent_irq, int irq_start,
33 u32 resume_sources, struct device_node *node); 33 u32 vic_sources, u32 resume_sources, struct device_node *node);
34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); 34void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
35int vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
36 u32 vic_sources, u32 resume_sources);
35 37
36#endif 38#endif
diff --git a/include/linux/irqchip/irq-crossbar.h b/include/linux/irqchip/irq-crossbar.h
new file mode 100644
index 000000000000..e5537b81df8d
--- /dev/null
+++ b/include/linux/irqchip/irq-crossbar.h
@@ -0,0 +1,11 @@
1/*
2 * drivers/irqchip/irq-crossbar.h
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.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 */
11int irqcrossbar_init(void);
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index e2d28b026a8c..3c77bf9b1efd 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -56,10 +56,6 @@
56#define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \ 56#define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
57 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) } 57 { .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
58 58
59/* export used IDs outside module */
60#define ISAPNP_CARD_TABLE(name) \
61 MODULE_GENERIC_TABLE(isapnp_card, name)
62
63struct isapnp_card_id { 59struct isapnp_card_id {
64 unsigned long driver_data; /* data private to the driver */ 60 unsigned long driver_data; /* data private to the driver */
65 unsigned short card_vendor, card_device; 61 unsigned short card_vendor, card_device;
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index d5f62bc5f4be..8e10f57f109f 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -180,9 +180,8 @@ struct ippp_struct {
180 struct slcompress *slcomp; 180 struct slcompress *slcomp;
181#endif 181#endif
182#ifdef CONFIG_IPPP_FILTER 182#ifdef CONFIG_IPPP_FILTER
183 struct sock_filter *pass_filter; /* filter for packets to pass */ 183 struct sk_filter *pass_filter; /* filter for packets to pass */
184 struct sock_filter *active_filter; /* filter for pkts to reset idle */ 184 struct sk_filter *active_filter; /* filter for pkts to reset idle */
185 unsigned pass_len, active_len;
186#endif 185#endif
187 unsigned long debug; 186 unsigned long debug;
188 struct isdn_ppp_compressor *compressor,*decompressor; 187 struct isdn_ppp_compressor *compressor,*decompressor;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 08fb02477641..4c52907a6d8b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -469,6 +469,7 @@ extern enum system_states {
469#define TAINT_CRAP 10 469#define TAINT_CRAP 10
470#define TAINT_FIRMWARE_WORKAROUND 11 470#define TAINT_FIRMWARE_WORKAROUND 11
471#define TAINT_OOT_MODULE 12 471#define TAINT_OOT_MODULE 12
472#define TAINT_UNSIGNED_MODULE 13
472 473
473extern const char hex_asc[]; 474extern const char hex_asc[];
474#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 475#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
@@ -841,4 +842,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
841# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 842# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
842#endif 843#endif
843 844
845/* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */
846#define VERIFY_OCTAL_PERMISSIONS(perms) \
847 (BUILD_BUG_ON_ZERO((perms) < 0) + \
848 BUILD_BUG_ON_ZERO((perms) > 0777) + \
849 /* User perms >= group perms >= other perms */ \
850 BUILD_BUG_ON_ZERO(((perms) >> 6) < (((perms) >> 3) & 7)) + \
851 BUILD_BUG_ON_ZERO((((perms) >> 3) & 7) < ((perms) & 7)) + \
852 (perms))
844#endif 853#endif
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index d267623c28cf..b0122dc6f96a 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -15,7 +15,7 @@
15#include <linux/lockdep.h> 15#include <linux/lockdep.h>
16#include <linux/rbtree.h> 16#include <linux/rbtree.h>
17#include <linux/atomic.h> 17#include <linux/atomic.h>
18#include <linux/completion.h> 18#include <linux/wait.h>
19 19
20struct file; 20struct file;
21struct dentry; 21struct dentry;
@@ -35,16 +35,22 @@ enum kernfs_node_type {
35}; 35};
36 36
37#define KERNFS_TYPE_MASK 0x000f 37#define KERNFS_TYPE_MASK 0x000f
38#define KERNFS_ACTIVE_REF KERNFS_FILE
39#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK 38#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
40 39
41enum kernfs_node_flag { 40enum kernfs_node_flag {
42 KERNFS_REMOVED = 0x0010, 41 KERNFS_ACTIVATED = 0x0010,
43 KERNFS_NS = 0x0020, 42 KERNFS_NS = 0x0020,
44 KERNFS_HAS_SEQ_SHOW = 0x0040, 43 KERNFS_HAS_SEQ_SHOW = 0x0040,
45 KERNFS_HAS_MMAP = 0x0080, 44 KERNFS_HAS_MMAP = 0x0080,
46 KERNFS_LOCKDEP = 0x0100, 45 KERNFS_LOCKDEP = 0x0100,
47 KERNFS_STATIC_NAME = 0x0200, 46 KERNFS_STATIC_NAME = 0x0200,
47 KERNFS_SUICIDAL = 0x0400,
48 KERNFS_SUICIDED = 0x0800,
49};
50
51/* @flags for kernfs_create_root() */
52enum kernfs_root_flag {
53 KERNFS_ROOT_CREATE_DEACTIVATED = 0x0001,
48}; 54};
49 55
50/* type-specific structures for kernfs_node union members */ 56/* type-specific structures for kernfs_node union members */
@@ -85,17 +91,17 @@ struct kernfs_node {
85#ifdef CONFIG_DEBUG_LOCK_ALLOC 91#ifdef CONFIG_DEBUG_LOCK_ALLOC
86 struct lockdep_map dep_map; 92 struct lockdep_map dep_map;
87#endif 93#endif
88 /* the following two fields are published */ 94 /*
95 * Use kernfs_get_parent() and kernfs_name/path() instead of
96 * accessing the following two fields directly. If the node is
97 * never moved to a different parent, it is safe to access the
98 * parent directly.
99 */
89 struct kernfs_node *parent; 100 struct kernfs_node *parent;
90 const char *name; 101 const char *name;
91 102
92 struct rb_node rb; 103 struct rb_node rb;
93 104
94 union {
95 struct completion *completion;
96 struct kernfs_node *removed_list;
97 } u;
98
99 const void *ns; /* namespace tag */ 105 const void *ns; /* namespace tag */
100 unsigned int hash; /* ns + name hash */ 106 unsigned int hash; /* ns + name hash */
101 union { 107 union {
@@ -113,12 +119,16 @@ struct kernfs_node {
113}; 119};
114 120
115/* 121/*
116 * kernfs_dir_ops may be specified on kernfs_create_root() to support 122 * kernfs_syscall_ops may be specified on kernfs_create_root() to support
117 * directory manipulation syscalls. These optional callbacks are invoked 123 * syscalls. These optional callbacks are invoked on the matching syscalls
118 * on the matching syscalls and can perform any kernfs operations which 124 * and can perform any kernfs operations which don't necessarily have to be
119 * don't necessarily have to be the exact operation requested. 125 * the exact operation requested. An active reference is held for each
126 * kernfs_node parameter.
120 */ 127 */
121struct kernfs_dir_ops { 128struct kernfs_syscall_ops {
129 int (*remount_fs)(struct kernfs_root *root, int *flags, char *data);
130 int (*show_options)(struct seq_file *sf, struct kernfs_root *root);
131
122 int (*mkdir)(struct kernfs_node *parent, const char *name, 132 int (*mkdir)(struct kernfs_node *parent, const char *name,
123 umode_t mode); 133 umode_t mode);
124 int (*rmdir)(struct kernfs_node *kn); 134 int (*rmdir)(struct kernfs_node *kn);
@@ -129,22 +139,26 @@ struct kernfs_dir_ops {
129struct kernfs_root { 139struct kernfs_root {
130 /* published fields */ 140 /* published fields */
131 struct kernfs_node *kn; 141 struct kernfs_node *kn;
142 unsigned int flags; /* KERNFS_ROOT_* flags */
132 143
133 /* private fields, do not use outside kernfs proper */ 144 /* private fields, do not use outside kernfs proper */
134 struct ida ino_ida; 145 struct ida ino_ida;
135 struct kernfs_dir_ops *dir_ops; 146 struct kernfs_syscall_ops *syscall_ops;
147 wait_queue_head_t deactivate_waitq;
136}; 148};
137 149
138struct kernfs_open_file { 150struct kernfs_open_file {
139 /* published fields */ 151 /* published fields */
140 struct kernfs_node *kn; 152 struct kernfs_node *kn;
141 struct file *file; 153 struct file *file;
154 void *priv;
142 155
143 /* private fields, do not use outside kernfs proper */ 156 /* private fields, do not use outside kernfs proper */
144 struct mutex mutex; 157 struct mutex mutex;
145 int event; 158 int event;
146 struct list_head list; 159 struct list_head list;
147 160
161 size_t atomic_write_len;
148 bool mmapped; 162 bool mmapped;
149 const struct vm_operations_struct *vm_ops; 163 const struct vm_operations_struct *vm_ops;
150}; 164};
@@ -171,9 +185,13 @@ struct kernfs_ops {
171 loff_t off); 185 loff_t off);
172 186
173 /* 187 /*
174 * write() is bounced through kernel buffer and a write larger than 188 * write() is bounced through kernel buffer. If atomic_write_len
175 * PAGE_SIZE results in partial operation of PAGE_SIZE. 189 * is not set, a write larger than PAGE_SIZE results in partial
190 * operations of PAGE_SIZE chunks. If atomic_write_len is set,
191 * writes upto the specified size are executed atomically but
192 * larger ones are rejected with -E2BIG.
176 */ 193 */
194 size_t atomic_write_len;
177 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes, 195 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
178 loff_t off); 196 loff_t off);
179 197
@@ -184,7 +202,7 @@ struct kernfs_ops {
184#endif 202#endif
185}; 203};
186 204
187#ifdef CONFIG_SYSFS 205#ifdef CONFIG_KERNFS
188 206
189static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) 207static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
190{ 208{
@@ -217,13 +235,22 @@ static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
217 return kn->flags & KERNFS_NS; 235 return kn->flags & KERNFS_NS;
218} 236}
219 237
238int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen);
239char * __must_check kernfs_path(struct kernfs_node *kn, char *buf,
240 size_t buflen);
241void pr_cont_kernfs_name(struct kernfs_node *kn);
242void pr_cont_kernfs_path(struct kernfs_node *kn);
243struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn);
220struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent, 244struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
221 const char *name, const void *ns); 245 const char *name, const void *ns);
222void kernfs_get(struct kernfs_node *kn); 246void kernfs_get(struct kernfs_node *kn);
223void kernfs_put(struct kernfs_node *kn); 247void kernfs_put(struct kernfs_node *kn);
224 248
225struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops, 249struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry);
226 void *priv); 250struct kernfs_root *kernfs_root_from_sb(struct super_block *sb);
251
252struct kernfs_root *kernfs_create_root(struct kernfs_syscall_ops *scops,
253 unsigned int flags, void *priv);
227void kernfs_destroy_root(struct kernfs_root *root); 254void kernfs_destroy_root(struct kernfs_root *root);
228 255
229struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent, 256struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
@@ -239,7 +266,11 @@ struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
239struct kernfs_node *kernfs_create_link(struct kernfs_node *parent, 266struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
240 const char *name, 267 const char *name,
241 struct kernfs_node *target); 268 struct kernfs_node *target);
269void kernfs_activate(struct kernfs_node *kn);
242void kernfs_remove(struct kernfs_node *kn); 270void kernfs_remove(struct kernfs_node *kn);
271void kernfs_break_active_protection(struct kernfs_node *kn);
272void kernfs_unbreak_active_protection(struct kernfs_node *kn);
273bool kernfs_remove_self(struct kernfs_node *kn);
243int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name, 274int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
244 const void *ns); 275 const void *ns);
245int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent, 276int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
@@ -255,7 +286,7 @@ void kernfs_kill_sb(struct super_block *sb);
255 286
256void kernfs_init(void); 287void kernfs_init(void);
257 288
258#else /* CONFIG_SYSFS */ 289#else /* CONFIG_KERNFS */
259 290
260static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn) 291static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
261{ return 0; } /* whatever */ 292{ return 0; } /* whatever */
@@ -265,6 +296,19 @@ static inline void kernfs_enable_ns(struct kernfs_node *kn) { }
265static inline bool kernfs_ns_enabled(struct kernfs_node *kn) 296static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
266{ return false; } 297{ return false; }
267 298
299static inline int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
300{ return -ENOSYS; }
301
302static inline char * __must_check kernfs_path(struct kernfs_node *kn, char *buf,
303 size_t buflen)
304{ return NULL; }
305
306static inline void pr_cont_kernfs_name(struct kernfs_node *kn) { }
307static inline void pr_cont_kernfs_path(struct kernfs_node *kn) { }
308
309static inline struct kernfs_node *kernfs_get_parent(struct kernfs_node *kn)
310{ return NULL; }
311
268static inline struct kernfs_node * 312static inline struct kernfs_node *
269kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name, 313kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
270 const void *ns) 314 const void *ns)
@@ -273,8 +317,15 @@ kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
273static inline void kernfs_get(struct kernfs_node *kn) { } 317static inline void kernfs_get(struct kernfs_node *kn) { }
274static inline void kernfs_put(struct kernfs_node *kn) { } 318static inline void kernfs_put(struct kernfs_node *kn) { }
275 319
320static inline struct kernfs_node *kernfs_node_from_dentry(struct dentry *dentry)
321{ return NULL; }
322
323static inline struct kernfs_root *kernfs_root_from_sb(struct super_block *sb)
324{ return NULL; }
325
276static inline struct kernfs_root * 326static inline struct kernfs_root *
277kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv) 327kernfs_create_root(struct kernfs_syscall_ops *scops, unsigned int flags,
328 void *priv)
278{ return ERR_PTR(-ENOSYS); } 329{ return ERR_PTR(-ENOSYS); }
279 330
280static inline void kernfs_destroy_root(struct kernfs_root *root) { } 331static inline void kernfs_destroy_root(struct kernfs_root *root) { }
@@ -296,8 +347,13 @@ kernfs_create_link(struct kernfs_node *parent, const char *name,
296 struct kernfs_node *target) 347 struct kernfs_node *target)
297{ return ERR_PTR(-ENOSYS); } 348{ return ERR_PTR(-ENOSYS); }
298 349
350static inline void kernfs_activate(struct kernfs_node *kn) { }
351
299static inline void kernfs_remove(struct kernfs_node *kn) { } 352static inline void kernfs_remove(struct kernfs_node *kn) { }
300 353
354static inline bool kernfs_remove_self(struct kernfs_node *kn)
355{ return false; }
356
301static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn, 357static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn,
302 const char *name, const void *ns) 358 const char *name, const void *ns)
303{ return -ENOSYS; } 359{ return -ENOSYS; }
@@ -325,7 +381,7 @@ static inline void kernfs_kill_sb(struct super_block *sb) { }
325 381
326static inline void kernfs_init(void) { } 382static inline void kernfs_init(void) { }
327 383
328#endif /* CONFIG_SYSFS */ 384#endif /* CONFIG_KERNFS */
329 385
330static inline struct kernfs_node * 386static inline struct kernfs_node *
331kernfs_find_and_get(struct kernfs_node *kn, const char *name) 387kernfs_find_and_get(struct kernfs_node *kn, const char *name)
@@ -367,6 +423,13 @@ static inline int kernfs_remove_by_name(struct kernfs_node *parent,
367 return kernfs_remove_by_name_ns(parent, name, NULL); 423 return kernfs_remove_by_name_ns(parent, name, NULL);
368} 424}
369 425
426static inline int kernfs_rename(struct kernfs_node *kn,
427 struct kernfs_node *new_parent,
428 const char *new_name)
429{
430 return kernfs_rename_ns(kn, new_parent, new_name, NULL);
431}
432
370static inline struct dentry * 433static inline struct dentry *
371kernfs_mount(struct file_system_type *fs_type, int flags, 434kernfs_mount(struct file_system_type *fs_type, int flags,
372 struct kernfs_root *root, bool *new_sb_created) 435 struct kernfs_root *root, bool *new_sb_created)
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 552d51efb429..554fde3a3927 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -722,7 +722,7 @@ __kfifo_uint_must_check_helper( \
722/** 722/**
723 * kfifo_dma_out_finish - finish a DMA OUT operation 723 * kfifo_dma_out_finish - finish a DMA OUT operation
724 * @fifo: address of the fifo to be used 724 * @fifo: address of the fifo to be used
725 * @len: number of bytes transferd 725 * @len: number of bytes transferrd
726 * 726 *
727 * This macro finish a DMA OUT operation. The out counter will be updated by 727 * This macro finish a DMA OUT operation. The out counter will be updated by
728 * the len parameter. No error checking will be done. 728 * the len parameter. No error checking will be done.
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
index 2a5e5548a1d2..5bb424659c04 100644
--- a/include/linux/kmemleak.h
+++ b/include/linux/kmemleak.h
@@ -30,8 +30,6 @@ extern void kmemleak_alloc_percpu(const void __percpu *ptr, size_t size) __ref;
30extern void kmemleak_free(const void *ptr) __ref; 30extern void kmemleak_free(const void *ptr) __ref;
31extern void kmemleak_free_part(const void *ptr, size_t size) __ref; 31extern void kmemleak_free_part(const void *ptr, size_t size) __ref;
32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref; 32extern void kmemleak_free_percpu(const void __percpu *ptr) __ref;
33extern void kmemleak_padding(const void *ptr, unsigned long offset,
34 size_t size) __ref;
35extern void kmemleak_not_leak(const void *ptr) __ref; 33extern void kmemleak_not_leak(const void *ptr) __ref;
36extern void kmemleak_ignore(const void *ptr) __ref; 34extern void kmemleak_ignore(const void *ptr) __ref;
37extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; 35extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 926afb6f6b5f..f896a33e8341 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -119,6 +119,7 @@ struct kobj_type {
119}; 119};
120 120
121struct kobj_uevent_env { 121struct kobj_uevent_env {
122 char *argv[3];
122 char *envp[UEVENT_NUM_ENVP]; 123 char *envp[UEVENT_NUM_ENVP];
123 int envp_idx; 124 int envp_idx;
124 char buf[UEVENT_BUFFER_SIZE]; 125 char buf[UEVENT_BUFFER_SIZE];
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index b8e9a43e501a..7d21cf9f4380 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -192,7 +192,7 @@ struct kvm_async_pf {
192 192
193void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu); 193void kvm_clear_async_pf_completion_queue(struct kvm_vcpu *vcpu);
194void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu); 194void kvm_check_async_pf_completion(struct kvm_vcpu *vcpu);
195int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn, 195int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, unsigned long hva,
196 struct kvm_arch_async_pf *arch); 196 struct kvm_arch_async_pf *arch);
197int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); 197int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu);
198#endif 198#endif
@@ -297,6 +297,14 @@ static inline unsigned long kvm_dirty_bitmap_bytes(struct kvm_memory_slot *memsl
297 return ALIGN(memslot->npages, BITS_PER_LONG) / 8; 297 return ALIGN(memslot->npages, BITS_PER_LONG) / 8;
298} 298}
299 299
300struct kvm_s390_adapter_int {
301 u64 ind_addr;
302 u64 summary_addr;
303 u64 ind_offset;
304 u32 summary_offset;
305 u32 adapter_id;
306};
307
300struct kvm_kernel_irq_routing_entry { 308struct kvm_kernel_irq_routing_entry {
301 u32 gsi; 309 u32 gsi;
302 u32 type; 310 u32 type;
@@ -309,6 +317,7 @@ struct kvm_kernel_irq_routing_entry {
309 unsigned pin; 317 unsigned pin;
310 } irqchip; 318 } irqchip;
311 struct msi_msg msi; 319 struct msi_msg msi;
320 struct kvm_s390_adapter_int adapter;
312 }; 321 };
313 struct hlist_node link; 322 struct hlist_node link;
314}; 323};
@@ -401,7 +410,9 @@ struct kvm {
401 unsigned long mmu_notifier_seq; 410 unsigned long mmu_notifier_seq;
402 long mmu_notifier_count; 411 long mmu_notifier_count;
403#endif 412#endif
404 long tlbs_dirty; 413 /* Protected by mmu_lock */
414 bool tlbs_dirty;
415
405 struct list_head devices; 416 struct list_head devices;
406}; 417};
407 418
@@ -911,7 +922,11 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
911 922
912#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING 923#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING
913 924
925#ifdef CONFIG_S390
926#define KVM_MAX_IRQ_ROUTES 4096 //FIXME: we can have more than that...
927#else
914#define KVM_MAX_IRQ_ROUTES 1024 928#define KVM_MAX_IRQ_ROUTES 1024
929#endif
915 930
916int kvm_setup_default_irq_routing(struct kvm *kvm); 931int kvm_setup_default_irq_routing(struct kvm *kvm);
917int kvm_set_irq_routing(struct kvm *kvm, 932int kvm_set_irq_routing(struct kvm *kvm,
@@ -1064,6 +1079,7 @@ extern struct kvm_device_ops kvm_mpic_ops;
1064extern struct kvm_device_ops kvm_xics_ops; 1079extern struct kvm_device_ops kvm_xics_ops;
1065extern struct kvm_device_ops kvm_vfio_ops; 1080extern struct kvm_device_ops kvm_vfio_ops;
1066extern struct kvm_device_ops kvm_arm_vgic_v2_ops; 1081extern struct kvm_device_ops kvm_arm_vgic_v2_ops;
1082extern struct kvm_device_ops kvm_flic_ops;
1067 1083
1068#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT 1084#ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT
1069 1085
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index 96549abe8842..0081f000e34b 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -25,6 +25,8 @@
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/notifier.h> 26#include <linux/notifier.h>
27 27
28#ifdef CONFIG_SMP
29
28#ifdef CONFIG_DEBUG_LOCK_ALLOC 30#ifdef CONFIG_DEBUG_LOCK_ALLOC
29#define LOCKDEP_INIT_MAP lockdep_init_map 31#define LOCKDEP_INIT_MAP lockdep_init_map
30#else 32#else
@@ -57,4 +59,18 @@ void lg_local_unlock_cpu(struct lglock *lg, int cpu);
57void lg_global_lock(struct lglock *lg); 59void lg_global_lock(struct lglock *lg);
58void lg_global_unlock(struct lglock *lg); 60void lg_global_unlock(struct lglock *lg);
59 61
62#else
63/* When !CONFIG_SMP, map lglock to spinlock */
64#define lglock spinlock
65#define DEFINE_LGLOCK(name) DEFINE_SPINLOCK(name)
66#define DEFINE_STATIC_LGLOCK(name) static DEFINE_SPINLOCK(name)
67#define lg_lock_init(lg, name) spin_lock_init(lg)
68#define lg_local_lock spin_lock
69#define lg_local_unlock spin_unlock
70#define lg_local_lock_cpu(lg, cpu) spin_lock(lg)
71#define lg_local_unlock_cpu(lg, cpu) spin_unlock(lg)
72#define lg_global_lock spin_lock
73#define lg_global_unlock spin_unlock
74#endif
75
60#endif 76#endif
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index 3ce541753c88..f3434533fbf8 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -13,6 +13,8 @@
13/* list_lru_walk_cb has to always return one of those */ 13/* list_lru_walk_cb has to always return one of those */
14enum lru_status { 14enum lru_status {
15 LRU_REMOVED, /* item removed from list */ 15 LRU_REMOVED, /* item removed from list */
16 LRU_REMOVED_RETRY, /* item removed, but lock has been
17 dropped and reacquired */
16 LRU_ROTATE, /* item referenced, give another pass */ 18 LRU_ROTATE, /* item referenced, give another pass */
17 LRU_SKIP, /* item cannot be locked, skip */ 19 LRU_SKIP, /* item cannot be locked, skip */
18 LRU_RETRY, /* item not freeable. May drop the lock 20 LRU_RETRY, /* item not freeable. May drop the lock
@@ -32,7 +34,11 @@ struct list_lru {
32}; 34};
33 35
34void list_lru_destroy(struct list_lru *lru); 36void list_lru_destroy(struct list_lru *lru);
35int list_lru_init(struct list_lru *lru); 37int list_lru_init_key(struct list_lru *lru, struct lock_class_key *key);
38static inline int list_lru_init(struct list_lru *lru)
39{
40 return list_lru_init_key(lru, NULL);
41}
36 42
37/** 43/**
38 * list_lru_add: add an element to the lru list's tail 44 * list_lru_add: add an element to the lru list's tail
diff --git a/include/linux/mbcache.h b/include/linux/mbcache.h
index 5525d370701d..6a392e7a723a 100644
--- a/include/linux/mbcache.h
+++ b/include/linux/mbcache.h
@@ -3,19 +3,21 @@
3 3
4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 4 (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/ 5*/
6
7struct mb_cache_entry { 6struct mb_cache_entry {
8 struct list_head e_lru_list; 7 struct list_head e_lru_list;
9 struct mb_cache *e_cache; 8 struct mb_cache *e_cache;
10 unsigned short e_used; 9 unsigned short e_used;
11 unsigned short e_queued; 10 unsigned short e_queued;
11 atomic_t e_refcnt;
12 struct block_device *e_bdev; 12 struct block_device *e_bdev;
13 sector_t e_block; 13 sector_t e_block;
14 struct list_head e_block_list; 14 struct hlist_bl_node e_block_list;
15 struct { 15 struct {
16 struct list_head o_list; 16 struct hlist_bl_node o_list;
17 unsigned int o_key; 17 unsigned int o_key;
18 } e_index; 18 } e_index;
19 struct hlist_bl_head *e_block_hash_p;
20 struct hlist_bl_head *e_index_hash_p;
19}; 21};
20 22
21struct mb_cache { 23struct mb_cache {
@@ -25,8 +27,8 @@ struct mb_cache {
25 int c_max_entries; 27 int c_max_entries;
26 int c_bucket_bits; 28 int c_bucket_bits;
27 struct kmem_cache *c_entry_cache; 29 struct kmem_cache *c_entry_cache;
28 struct list_head *c_block_hash; 30 struct hlist_bl_head *c_block_hash;
29 struct list_head *c_index_hash; 31 struct hlist_bl_head *c_index_hash;
30}; 32};
31 33
32/* Functions on caches */ 34/* Functions on caches */
diff --git a/include/linux/mcb.h b/include/linux/mcb.h
new file mode 100644
index 000000000000..2db284d14064
--- /dev/null
+++ b/include/linux/mcb.h
@@ -0,0 +1,119 @@
1/*
2 * MEN Chameleon Bus.
3 *
4 * Copyright (C) 2014 MEN Mikroelektronik GmbH (www.men.de)
5 * Author: Johannes Thumshirn <johannes.thumshirn@men.de>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; version 2 of the License.
10 */
11#ifndef _LINUX_MCB_H
12#define _LINUX_MCB_H
13
14#include <linux/mod_devicetable.h>
15#include <linux/device.h>
16#include <linux/irqreturn.h>
17
18struct mcb_driver;
19
20/**
21 * struct mcb_bus - MEN Chameleon Bus
22 *
23 * @dev: pointer to carrier device
24 * @children: the child busses
25 * @bus_nr: mcb bus number
26 */
27struct mcb_bus {
28 struct list_head children;
29 struct device dev;
30 int bus_nr;
31};
32#define to_mcb_bus(b) container_of((b), struct mcb_bus, dev)
33
34/**
35 * struct mcb_device - MEN Chameleon Bus device
36 *
37 * @bus_list: internal list handling for bus code
38 * @dev: device in kernel representation
39 * @bus: mcb bus the device is plugged to
40 * @subordinate: subordinate MCBus in case of bridge
41 * @is_added: flag to check if device is added to bus
42 * @driver: associated mcb_driver
43 * @id: mcb device id
44 * @inst: instance in Chameleon table
45 * @group: group in Chameleon table
46 * @var: variant in Chameleon table
47 * @bar: BAR in Chameleon table
48 * @rev: revision in Chameleon table
49 * @irq: IRQ resource
50 * @memory: memory resource
51 */
52struct mcb_device {
53 struct list_head bus_list;
54 struct device dev;
55 struct mcb_bus *bus;
56 struct mcb_bus *subordinate;
57 bool is_added;
58 struct mcb_driver *driver;
59 u16 id;
60 int inst;
61 int group;
62 int var;
63 int bar;
64 int rev;
65 struct resource irq;
66 struct resource mem;
67};
68#define to_mcb_device(x) container_of((x), struct mcb_device, dev)
69
70/**
71 * struct mcb_driver - MEN Chameleon Bus device driver
72 *
73 * @driver: device_driver
74 * @id_table: mcb id table
75 * @probe: probe callback
76 * @remove: remove callback
77 * @shutdown: shutdown callback
78 */
79struct mcb_driver {
80 struct device_driver driver;
81 const struct mcb_device_id *id_table;
82 int (*probe)(struct mcb_device *mdev, const struct mcb_device_id *id);
83 void (*remove)(struct mcb_device *mdev);
84 void (*shutdown)(struct mcb_device *mdev);
85};
86#define to_mcb_driver(x) container_of((x), struct mcb_driver, driver)
87
88static inline void *mcb_get_drvdata(struct mcb_device *dev)
89{
90 return dev_get_drvdata(&dev->dev);
91}
92
93static inline void mcb_set_drvdata(struct mcb_device *dev, void *data)
94{
95 dev_set_drvdata(&dev->dev, data);
96}
97
98extern int __must_check __mcb_register_driver(struct mcb_driver *drv,
99 struct module *owner,
100 const char *mod_name);
101#define mcb_register_driver(driver) \
102 __mcb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
103extern void mcb_unregister_driver(struct mcb_driver *driver);
104#define module_mcb_driver(__mcb_driver) \
105 module_driver(__mcb_driver, mcb_register_driver, mcb_unregister_driver);
106extern void mcb_bus_add_devices(const struct mcb_bus *bus);
107extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev);
108extern struct mcb_bus *mcb_alloc_bus(void);
109extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus);
110extern void mcb_bus_put(struct mcb_bus *bus);
111extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus);
112extern void mcb_free_dev(struct mcb_device *dev);
113extern void mcb_release_bus(struct mcb_bus *bus);
114extern struct resource *mcb_request_mem(struct mcb_device *dev,
115 const char *name);
116extern void mcb_release_mem(struct resource *mem);
117extern int mcb_get_irq(struct mcb_device *dev);
118
119#endif /* _LINUX_MCB_H */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 1ef66360f0b0..8a20a51ed42d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -252,6 +252,8 @@ static inline void memblock_dump_all(void)
252void memblock_set_current_limit(phys_addr_t limit); 252void memblock_set_current_limit(phys_addr_t limit);
253 253
254 254
255phys_addr_t memblock_get_current_limit(void);
256
255/* 257/*
256 * pfn conversion functions 258 * pfn conversion functions
257 * 259 *
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index abd0113b6620..b569b8be5c5a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -65,7 +65,7 @@ struct mem_cgroup_reclaim_cookie {
65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.) 65 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
66 */ 66 */
67 67
68extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm, 68extern int mem_cgroup_charge_anon(struct page *page, struct mm_struct *mm,
69 gfp_t gfp_mask); 69 gfp_t gfp_mask);
70/* for swap handling */ 70/* for swap handling */
71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm, 71extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
@@ -74,7 +74,7 @@ extern void mem_cgroup_commit_charge_swapin(struct page *page,
74 struct mem_cgroup *memcg); 74 struct mem_cgroup *memcg);
75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg); 75extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *memcg);
76 76
77extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 77extern int mem_cgroup_charge_file(struct page *page, struct mm_struct *mm,
78 gfp_t gfp_mask); 78 gfp_t gfp_mask);
79 79
80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *); 80struct lruvec *mem_cgroup_zone_lruvec(struct zone *, struct mem_cgroup *);
@@ -94,7 +94,6 @@ bool task_in_mem_cgroup(struct task_struct *task,
94 94
95extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page); 95extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
96extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 96extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
97extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm);
98 97
99extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); 98extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
100extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css); 99extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css);
@@ -162,7 +161,7 @@ extern int do_swap_account;
162 161
163static inline bool mem_cgroup_disabled(void) 162static inline bool mem_cgroup_disabled(void)
164{ 163{
165 if (mem_cgroup_subsys.disabled) 164 if (memory_cgrp_subsys.disabled)
166 return true; 165 return true;
167 return false; 166 return false;
168} 167}
@@ -234,13 +233,13 @@ void mem_cgroup_print_bad_page(struct page *page);
234#else /* CONFIG_MEMCG */ 233#else /* CONFIG_MEMCG */
235struct mem_cgroup; 234struct mem_cgroup;
236 235
237static inline int mem_cgroup_newpage_charge(struct page *page, 236static inline int mem_cgroup_charge_anon(struct page *page,
238 struct mm_struct *mm, gfp_t gfp_mask) 237 struct mm_struct *mm, gfp_t gfp_mask)
239{ 238{
240 return 0; 239 return 0;
241} 240}
242 241
243static inline int mem_cgroup_cache_charge(struct page *page, 242static inline int mem_cgroup_charge_file(struct page *page,
244 struct mm_struct *mm, gfp_t gfp_mask) 243 struct mm_struct *mm, gfp_t gfp_mask)
245{ 244{
246 return 0; 245 return 0;
@@ -294,11 +293,6 @@ static inline struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page)
294 return NULL; 293 return NULL;
295} 294}
296 295
297static inline struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
298{
299 return NULL;
300}
301
302static inline bool mm_match_cgroup(struct mm_struct *mm, 296static inline bool mm_match_cgroup(struct mm_struct *mm,
303 struct mem_cgroup *memcg) 297 struct mem_cgroup *memcg)
304{ 298{
@@ -497,6 +491,9 @@ void __memcg_kmem_commit_charge(struct page *page,
497void __memcg_kmem_uncharge_pages(struct page *page, int order); 491void __memcg_kmem_uncharge_pages(struct page *page, int order);
498 492
499int memcg_cache_id(struct mem_cgroup *memcg); 493int memcg_cache_id(struct mem_cgroup *memcg);
494
495char *memcg_create_cache_name(struct mem_cgroup *memcg,
496 struct kmem_cache *root_cache);
500int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s, 497int memcg_alloc_cache_params(struct mem_cgroup *memcg, struct kmem_cache *s,
501 struct kmem_cache *root_cache); 498 struct kmem_cache *root_cache);
502void memcg_free_cache_params(struct kmem_cache *s); 499void memcg_free_cache_params(struct kmem_cache *s);
@@ -510,7 +507,7 @@ struct kmem_cache *
510__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp); 507__memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp);
511 508
512void mem_cgroup_destroy_cache(struct kmem_cache *cachep); 509void mem_cgroup_destroy_cache(struct kmem_cache *cachep);
513void kmem_cache_destroy_memcg_children(struct kmem_cache *s); 510int __kmem_cache_destroy_memcg_children(struct kmem_cache *s);
514 511
515/** 512/**
516 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed. 513 * memcg_kmem_newpage_charge: verify if a new kmem allocation is allowed.
@@ -664,10 +661,6 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
664{ 661{
665 return cachep; 662 return cachep;
666} 663}
667
668static inline void kmem_cache_destroy_memcg_children(struct kmem_cache *s)
669{
670}
671#endif /* CONFIG_MEMCG_KMEM */ 664#endif /* CONFIG_MEMCG_KMEM */
672#endif /* _LINUX_MEMCONTROL_H */ 665#endif /* _LINUX_MEMCONTROL_H */
673 666
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 5f1ea756aace..3c1b968da0ca 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -143,7 +143,6 @@ extern void numa_policy_init(void);
143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new, 143extern void mpol_rebind_task(struct task_struct *tsk, const nodemask_t *new,
144 enum mpol_rebind_step step); 144 enum mpol_rebind_step step);
145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 145extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
146extern void mpol_fix_fork_child_flag(struct task_struct *p);
147 146
148extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 147extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
149 unsigned long addr, gfp_t gfp_flags, 148 unsigned long addr, gfp_t gfp_flags,
@@ -151,7 +150,7 @@ extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
151extern bool init_nodemask_of_mempolicy(nodemask_t *mask); 150extern bool init_nodemask_of_mempolicy(nodemask_t *mask);
152extern bool mempolicy_nodemask_intersects(struct task_struct *tsk, 151extern bool mempolicy_nodemask_intersects(struct task_struct *tsk,
153 const nodemask_t *mask); 152 const nodemask_t *mask);
154extern unsigned slab_node(void); 153extern unsigned int mempolicy_slab_node(void);
155 154
156extern enum zone_type policy_zone; 155extern enum zone_type policy_zone;
157 156
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index a86ca1406fb8..4e7fe7417fc9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -347,7 +347,6 @@ struct ab8500 {
347 struct mutex lock; 347 struct mutex lock;
348 struct mutex irq_lock; 348 struct mutex irq_lock;
349 atomic_t transfer_ongoing; 349 atomic_t transfer_ongoing;
350 int irq_base;
351 int irq; 350 int irq;
352 struct irq_domain *domain; 351 struct irq_domain *domain;
353 enum ab8500_version version; 352 enum ab8500_version version;
@@ -378,7 +377,6 @@ struct ab8500_sysctrl_platform_data;
378 * @regulator: machine-specific constraints for regulators 377 * @regulator: machine-specific constraints for regulators
379 */ 378 */
380struct ab8500_platform_data { 379struct ab8500_platform_data {
381 int irq_base;
382 void (*init) (struct ab8500 *); 380 void (*init) (struct ab8500 *);
383 struct ab8500_regulator_platform_data *regulator; 381 struct ab8500_regulator_platform_data *regulator;
384 struct ab8500_codec_platform_data *codec; 382 struct ab8500_codec_platform_data *codec;
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index fdf3aa376eb2..7b35c21170d5 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -1034,6 +1034,27 @@
1034#define ARIZONA_DSP1_STATUS_1 0x1104 1034#define ARIZONA_DSP1_STATUS_1 0x1104
1035#define ARIZONA_DSP1_STATUS_2 0x1105 1035#define ARIZONA_DSP1_STATUS_2 0x1105
1036#define ARIZONA_DSP1_STATUS_3 0x1106 1036#define ARIZONA_DSP1_STATUS_3 0x1106
1037#define ARIZONA_DSP1_STATUS_4 0x1107
1038#define ARIZONA_DSP1_WDMA_BUFFER_1 0x1110
1039#define ARIZONA_DSP1_WDMA_BUFFER_2 0x1111
1040#define ARIZONA_DSP1_WDMA_BUFFER_3 0x1112
1041#define ARIZONA_DSP1_WDMA_BUFFER_4 0x1113
1042#define ARIZONA_DSP1_WDMA_BUFFER_5 0x1114
1043#define ARIZONA_DSP1_WDMA_BUFFER_6 0x1115
1044#define ARIZONA_DSP1_WDMA_BUFFER_7 0x1116
1045#define ARIZONA_DSP1_WDMA_BUFFER_8 0x1117
1046#define ARIZONA_DSP1_RDMA_BUFFER_1 0x1120
1047#define ARIZONA_DSP1_RDMA_BUFFER_2 0x1121
1048#define ARIZONA_DSP1_RDMA_BUFFER_3 0x1122
1049#define ARIZONA_DSP1_RDMA_BUFFER_4 0x1123
1050#define ARIZONA_DSP1_RDMA_BUFFER_5 0x1124
1051#define ARIZONA_DSP1_RDMA_BUFFER_6 0x1125
1052#define ARIZONA_DSP1_WDMA_CONFIG_1 0x1130
1053#define ARIZONA_DSP1_WDMA_CONFIG_2 0x1131
1054#define ARIZONA_DSP1_WDMA_OFFSET_1 0x1132
1055#define ARIZONA_DSP1_RDMA_CONFIG_1 0x1134
1056#define ARIZONA_DSP1_RDMA_OFFSET_1 0x1135
1057#define ARIZONA_DSP1_EXTERNAL_START_SELECT_1 0x1138
1037#define ARIZONA_DSP1_SCRATCH_0 0x1140 1058#define ARIZONA_DSP1_SCRATCH_0 0x1140
1038#define ARIZONA_DSP1_SCRATCH_1 0x1141 1059#define ARIZONA_DSP1_SCRATCH_1 0x1141
1039#define ARIZONA_DSP1_SCRATCH_2 0x1142 1060#define ARIZONA_DSP1_SCRATCH_2 0x1142
@@ -1043,6 +1064,27 @@
1043#define ARIZONA_DSP2_STATUS_1 0x1204 1064#define ARIZONA_DSP2_STATUS_1 0x1204
1044#define ARIZONA_DSP2_STATUS_2 0x1205 1065#define ARIZONA_DSP2_STATUS_2 0x1205
1045#define ARIZONA_DSP2_STATUS_3 0x1206 1066#define ARIZONA_DSP2_STATUS_3 0x1206
1067#define ARIZONA_DSP2_STATUS_4 0x1207
1068#define ARIZONA_DSP2_WDMA_BUFFER_1 0x1210
1069#define ARIZONA_DSP2_WDMA_BUFFER_2 0x1211
1070#define ARIZONA_DSP2_WDMA_BUFFER_3 0x1212
1071#define ARIZONA_DSP2_WDMA_BUFFER_4 0x1213
1072#define ARIZONA_DSP2_WDMA_BUFFER_5 0x1214
1073#define ARIZONA_DSP2_WDMA_BUFFER_6 0x1215
1074#define ARIZONA_DSP2_WDMA_BUFFER_7 0x1216
1075#define ARIZONA_DSP2_WDMA_BUFFER_8 0x1217
1076#define ARIZONA_DSP2_RDMA_BUFFER_1 0x1220
1077#define ARIZONA_DSP2_RDMA_BUFFER_2 0x1221
1078#define ARIZONA_DSP2_RDMA_BUFFER_3 0x1222
1079#define ARIZONA_DSP2_RDMA_BUFFER_4 0x1223
1080#define ARIZONA_DSP2_RDMA_BUFFER_5 0x1224
1081#define ARIZONA_DSP2_RDMA_BUFFER_6 0x1225
1082#define ARIZONA_DSP2_WDMA_CONFIG_1 0x1230
1083#define ARIZONA_DSP2_WDMA_CONFIG_2 0x1231
1084#define ARIZONA_DSP2_WDMA_OFFSET_1 0x1232
1085#define ARIZONA_DSP2_RDMA_CONFIG_1 0x1234
1086#define ARIZONA_DSP2_RDMA_OFFSET_1 0x1235
1087#define ARIZONA_DSP2_EXTERNAL_START_SELECT_1 0x1238
1046#define ARIZONA_DSP2_SCRATCH_0 0x1240 1088#define ARIZONA_DSP2_SCRATCH_0 0x1240
1047#define ARIZONA_DSP2_SCRATCH_1 0x1241 1089#define ARIZONA_DSP2_SCRATCH_1 0x1241
1048#define ARIZONA_DSP2_SCRATCH_2 0x1242 1090#define ARIZONA_DSP2_SCRATCH_2 0x1242
@@ -1052,6 +1094,27 @@
1052#define ARIZONA_DSP3_STATUS_1 0x1304 1094#define ARIZONA_DSP3_STATUS_1 0x1304
1053#define ARIZONA_DSP3_STATUS_2 0x1305 1095#define ARIZONA_DSP3_STATUS_2 0x1305
1054#define ARIZONA_DSP3_STATUS_3 0x1306 1096#define ARIZONA_DSP3_STATUS_3 0x1306
1097#define ARIZONA_DSP3_STATUS_4 0x1307
1098#define ARIZONA_DSP3_WDMA_BUFFER_1 0x1310
1099#define ARIZONA_DSP3_WDMA_BUFFER_2 0x1311
1100#define ARIZONA_DSP3_WDMA_BUFFER_3 0x1312
1101#define ARIZONA_DSP3_WDMA_BUFFER_4 0x1313
1102#define ARIZONA_DSP3_WDMA_BUFFER_5 0x1314
1103#define ARIZONA_DSP3_WDMA_BUFFER_6 0x1315
1104#define ARIZONA_DSP3_WDMA_BUFFER_7 0x1316
1105#define ARIZONA_DSP3_WDMA_BUFFER_8 0x1317
1106#define ARIZONA_DSP3_RDMA_BUFFER_1 0x1320
1107#define ARIZONA_DSP3_RDMA_BUFFER_2 0x1321
1108#define ARIZONA_DSP3_RDMA_BUFFER_3 0x1322
1109#define ARIZONA_DSP3_RDMA_BUFFER_4 0x1323
1110#define ARIZONA_DSP3_RDMA_BUFFER_5 0x1324
1111#define ARIZONA_DSP3_RDMA_BUFFER_6 0x1325
1112#define ARIZONA_DSP3_WDMA_CONFIG_1 0x1330
1113#define ARIZONA_DSP3_WDMA_CONFIG_2 0x1331
1114#define ARIZONA_DSP3_WDMA_OFFSET_1 0x1332
1115#define ARIZONA_DSP3_RDMA_CONFIG_1 0x1334
1116#define ARIZONA_DSP3_RDMA_OFFSET_1 0x1335
1117#define ARIZONA_DSP3_EXTERNAL_START_SELECT_1 0x1338
1055#define ARIZONA_DSP3_SCRATCH_0 0x1340 1118#define ARIZONA_DSP3_SCRATCH_0 0x1340
1056#define ARIZONA_DSP3_SCRATCH_1 0x1341 1119#define ARIZONA_DSP3_SCRATCH_1 0x1341
1057#define ARIZONA_DSP3_SCRATCH_2 0x1342 1120#define ARIZONA_DSP3_SCRATCH_2 0x1342
@@ -1061,6 +1124,27 @@
1061#define ARIZONA_DSP4_STATUS_1 0x1404 1124#define ARIZONA_DSP4_STATUS_1 0x1404
1062#define ARIZONA_DSP4_STATUS_2 0x1405 1125#define ARIZONA_DSP4_STATUS_2 0x1405
1063#define ARIZONA_DSP4_STATUS_3 0x1406 1126#define ARIZONA_DSP4_STATUS_3 0x1406
1127#define ARIZONA_DSP4_STATUS_4 0x1407
1128#define ARIZONA_DSP4_WDMA_BUFFER_1 0x1410
1129#define ARIZONA_DSP4_WDMA_BUFFER_2 0x1411
1130#define ARIZONA_DSP4_WDMA_BUFFER_3 0x1412
1131#define ARIZONA_DSP4_WDMA_BUFFER_4 0x1413
1132#define ARIZONA_DSP4_WDMA_BUFFER_5 0x1414
1133#define ARIZONA_DSP4_WDMA_BUFFER_6 0x1415
1134#define ARIZONA_DSP4_WDMA_BUFFER_7 0x1416
1135#define ARIZONA_DSP4_WDMA_BUFFER_8 0x1417
1136#define ARIZONA_DSP4_RDMA_BUFFER_1 0x1420
1137#define ARIZONA_DSP4_RDMA_BUFFER_2 0x1421
1138#define ARIZONA_DSP4_RDMA_BUFFER_3 0x1422
1139#define ARIZONA_DSP4_RDMA_BUFFER_4 0x1423
1140#define ARIZONA_DSP4_RDMA_BUFFER_5 0x1424
1141#define ARIZONA_DSP4_RDMA_BUFFER_6 0x1425
1142#define ARIZONA_DSP4_WDMA_CONFIG_1 0x1430
1143#define ARIZONA_DSP4_WDMA_CONFIG_2 0x1431
1144#define ARIZONA_DSP4_WDMA_OFFSET_1 0x1432
1145#define ARIZONA_DSP4_RDMA_CONFIG_1 0x1434
1146#define ARIZONA_DSP4_RDMA_OFFSET_1 0x1435
1147#define ARIZONA_DSP4_EXTERNAL_START_SELECT_1 0x1438
1064#define ARIZONA_DSP4_SCRATCH_0 0x1440 1148#define ARIZONA_DSP4_SCRATCH_0 0x1440
1065#define ARIZONA_DSP4_SCRATCH_1 0x1441 1149#define ARIZONA_DSP4_SCRATCH_1 0x1441
1066#define ARIZONA_DSP4_SCRATCH_2 0x1442 1150#define ARIZONA_DSP4_SCRATCH_2 0x1442
@@ -1702,9 +1786,9 @@
1702/* 1786/*
1703 * R373 (0x175) - FLL1 Control 5 1787 * R373 (0x175) - FLL1 Control 5
1704 */ 1788 */
1705#define ARIZONA_FLL1_FRATIO_MASK 0x0700 /* FLL1_FRATIO - [10:8] */ 1789#define ARIZONA_FLL1_FRATIO_MASK 0x0F00 /* FLL1_FRATIO - [11:8] */
1706#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [10:8] */ 1790#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [11:8] */
1707#define ARIZONA_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [10:8] */ 1791#define ARIZONA_FLL1_FRATIO_WIDTH 4 /* FLL1_FRATIO - [11:8] */
1708#define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */ 1792#define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */
1709#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */ 1793#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */
1710#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */ 1794#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */
diff --git a/include/linux/mfd/bcm590xx.h b/include/linux/mfd/bcm590xx.h
new file mode 100644
index 000000000000..434df2d4e587
--- /dev/null
+++ b/include/linux/mfd/bcm590xx.h
@@ -0,0 +1,31 @@
1/*
2 * Broadcom BCM590xx PMU
3 *
4 * Copyright 2014 Linaro Limited
5 * Author: Matt Porter <mporter@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_BCM590XX_H
15#define __LINUX_MFD_BCM590XX_H
16
17#include <linux/device.h>
18#include <linux/i2c.h>
19#include <linux/regmap.h>
20
21/* max register address */
22#define BCM590XX_MAX_REGISTER 0xe7
23
24struct bcm590xx {
25 struct device *dev;
26 struct i2c_client *i2c_client;
27 struct regmap *regmap;
28 unsigned int id;
29};
30
31#endif /* __LINUX_MFD_BCM590XX_H */
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index 21e21b81cc75..bba65f51a0b5 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -83,6 +83,7 @@ enum da9052_chip_id {
83 DA9053_AA, 83 DA9053_AA,
84 DA9053_BA, 84 DA9053_BA,
85 DA9053_BB, 85 DA9053_BB,
86 DA9053_BC,
86}; 87};
87 88
88struct da9052_pdata; 89struct da9052_pdata;
diff --git a/include/linux/mfd/da9063/core.h b/include/linux/mfd/da9063/core.h
index 2d2a0af675fd..00a9aac5d1e8 100644
--- a/include/linux/mfd/da9063/core.h
+++ b/include/linux/mfd/da9063/core.h
@@ -33,6 +33,10 @@ enum da9063_models {
33 PMIC_DA9063 = 0x61, 33 PMIC_DA9063 = 0x61,
34}; 34};
35 35
36enum da9063_variant_codes {
37 PMIC_DA9063_BB = 0x5
38};
39
36/* Interrupts */ 40/* Interrupts */
37enum da9063_irqs { 41enum da9063_irqs {
38 DA9063_IRQ_ONKEY = 0, 42 DA9063_IRQ_ONKEY = 0,
@@ -72,7 +76,7 @@ struct da9063 {
72 /* Device */ 76 /* Device */
73 struct device *dev; 77 struct device *dev;
74 unsigned short model; 78 unsigned short model;
75 unsigned short revision; 79 unsigned char variant_code;
76 unsigned int flags; 80 unsigned int flags;
77 81
78 /* Control interface */ 82 /* Control interface */
diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da9063/registers.h
index 5834813fb5f3..09a85c699da1 100644
--- a/include/linux/mfd/da9063/registers.h
+++ b/include/linux/mfd/da9063/registers.h
@@ -17,11 +17,7 @@
17#define _DA9063_REG_H 17#define _DA9063_REG_H
18 18
19#define DA9063_I2C_PAGE_SEL_SHIFT 1 19#define DA9063_I2C_PAGE_SEL_SHIFT 1
20
21#define DA9063_EVENT_REG_NUM 4 20#define DA9063_EVENT_REG_NUM 4
22#define DA9210_EVENT_REG_NUM 2
23#define DA9063_EXT_EVENT_REG_NUM (DA9063_EVENT_REG_NUM + \
24 DA9210_EVENT_REG_NUM)
25 21
26/* Page selection I2C or SPI always in the begining of any page. */ 22/* Page selection I2C or SPI always in the begining of any page. */
27/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */ 23/* Page 0 : I2C access 0x000 - 0x0FF SPI access 0x000 - 0x07F */
@@ -61,9 +57,9 @@
61#define DA9063_REG_GPIO_10_11 0x1A 57#define DA9063_REG_GPIO_10_11 0x1A
62#define DA9063_REG_GPIO_12_13 0x1B 58#define DA9063_REG_GPIO_12_13 0x1B
63#define DA9063_REG_GPIO_14_15 0x1C 59#define DA9063_REG_GPIO_14_15 0x1C
64#define DA9063_REG_GPIO_MODE_0_7 0x1D 60#define DA9063_REG_GPIO_MODE0_7 0x1D
65#define DA9063_REG_GPIO_MODE_8_15 0x1E 61#define DA9063_REG_GPIO_MODE8_15 0x1E
66#define DA9063_REG_GPIO_SWITCH_CONT 0x1F 62#define DA9063_REG_SWITCH_CONT 0x1F
67 63
68/* Regulator Control Registers */ 64/* Regulator Control Registers */
69#define DA9063_REG_BCORE2_CONT 0x20 65#define DA9063_REG_BCORE2_CONT 0x20
@@ -83,7 +79,7 @@
83#define DA9063_REG_LDO9_CONT 0x2E 79#define DA9063_REG_LDO9_CONT 0x2E
84#define DA9063_REG_LDO10_CONT 0x2F 80#define DA9063_REG_LDO10_CONT 0x2F
85#define DA9063_REG_LDO11_CONT 0x30 81#define DA9063_REG_LDO11_CONT 0x30
86#define DA9063_REG_VIB 0x31 82#define DA9063_REG_SUPPLIES 0x31
87#define DA9063_REG_DVC_1 0x32 83#define DA9063_REG_DVC_1 0x32
88#define DA9063_REG_DVC_2 0x33 84#define DA9063_REG_DVC_2 0x33
89 85
@@ -97,9 +93,9 @@
97#define DA9063_REG_ADCIN1_RES 0x3A 93#define DA9063_REG_ADCIN1_RES 0x3A
98#define DA9063_REG_ADCIN2_RES 0x3B 94#define DA9063_REG_ADCIN2_RES 0x3B
99#define DA9063_REG_ADCIN3_RES 0x3C 95#define DA9063_REG_ADCIN3_RES 0x3C
100#define DA9063_REG_MON1_RES 0x3D 96#define DA9063_REG_MON_A8_RES 0x3D
101#define DA9063_REG_MON2_RES 0x3E 97#define DA9063_REG_MON_A9_RES 0x3E
102#define DA9063_REG_MON3_RES 0x3F 98#define DA9063_REG_MON_A10_RES 0x3F
103 99
104/* RTC Calendar and Alarm Registers */ 100/* RTC Calendar and Alarm Registers */
105#define DA9063_REG_COUNT_S 0x40 101#define DA9063_REG_COUNT_S 0x40
@@ -108,15 +104,16 @@
108#define DA9063_REG_COUNT_D 0x43 104#define DA9063_REG_COUNT_D 0x43
109#define DA9063_REG_COUNT_MO 0x44 105#define DA9063_REG_COUNT_MO 0x44
110#define DA9063_REG_COUNT_Y 0x45 106#define DA9063_REG_COUNT_Y 0x45
111#define DA9063_REG_ALARM_MI 0x46 107#define DA9063_REG_ALARM_S 0x46
112#define DA9063_REG_ALARM_H 0x47 108#define DA9063_REG_ALARM_MI 0x47
113#define DA9063_REG_ALARM_D 0x48 109#define DA9063_REG_ALARM_H 0x48
114#define DA9063_REG_ALARM_MO 0x49 110#define DA9063_REG_ALARM_D 0x49
115#define DA9063_REG_ALARM_Y 0x4A 111#define DA9063_REG_ALARM_MO 0x4A
116#define DA9063_REG_SECOND_A 0x4B 112#define DA9063_REG_ALARM_Y 0x4B
117#define DA9063_REG_SECOND_B 0x4C 113#define DA9063_REG_SECOND_A 0x4C
118#define DA9063_REG_SECOND_C 0x4D 114#define DA9063_REG_SECOND_B 0x4D
119#define DA9063_REG_SECOND_D 0x4E 115#define DA9063_REG_SECOND_C 0x4E
116#define DA9063_REG_SECOND_D 0x4F
120 117
121/* Sequencer Control Registers */ 118/* Sequencer Control Registers */
122#define DA9063_REG_SEQ 0x81 119#define DA9063_REG_SEQ 0x81
@@ -226,35 +223,37 @@
226#define DA9063_REG_CONFIG_J 0x10F 223#define DA9063_REG_CONFIG_J 0x10F
227#define DA9063_REG_CONFIG_K 0x110 224#define DA9063_REG_CONFIG_K 0x110
228#define DA9063_REG_CONFIG_L 0x111 225#define DA9063_REG_CONFIG_L 0x111
229#define DA9063_REG_MON_REG_1 0x112 226#define DA9063_REG_CONFIG_M 0x112
230#define DA9063_REG_MON_REG_2 0x113 227#define DA9063_REG_CONFIG_N 0x113
231#define DA9063_REG_MON_REG_3 0x114 228
232#define DA9063_REG_MON_REG_4 0x115 229#define DA9063_REG_MON_REG_1 0x114
233#define DA9063_REG_MON_REG_5 0x116 230#define DA9063_REG_MON_REG_2 0x115
234#define DA9063_REG_MON_REG_6 0x117 231#define DA9063_REG_MON_REG_3 0x116
235#define DA9063_REG_TRIM_CLDR 0x118 232#define DA9063_REG_MON_REG_4 0x117
236 233#define DA9063_REG_MON_REG_5 0x11E
234#define DA9063_REG_MON_REG_6 0x11F
235#define DA9063_REG_TRIM_CLDR 0x120
237/* General Purpose Registers */ 236/* General Purpose Registers */
238#define DA9063_REG_GP_ID_0 0x119 237#define DA9063_REG_GP_ID_0 0x121
239#define DA9063_REG_GP_ID_1 0x11A 238#define DA9063_REG_GP_ID_1 0x122
240#define DA9063_REG_GP_ID_2 0x11B 239#define DA9063_REG_GP_ID_2 0x123
241#define DA9063_REG_GP_ID_3 0x11C 240#define DA9063_REG_GP_ID_3 0x124
242#define DA9063_REG_GP_ID_4 0x11D 241#define DA9063_REG_GP_ID_4 0x125
243#define DA9063_REG_GP_ID_5 0x11E 242#define DA9063_REG_GP_ID_5 0x126
244#define DA9063_REG_GP_ID_6 0x11F 243#define DA9063_REG_GP_ID_6 0x127
245#define DA9063_REG_GP_ID_7 0x120 244#define DA9063_REG_GP_ID_7 0x128
246#define DA9063_REG_GP_ID_8 0x121 245#define DA9063_REG_GP_ID_8 0x129
247#define DA9063_REG_GP_ID_9 0x122 246#define DA9063_REG_GP_ID_9 0x12A
248#define DA9063_REG_GP_ID_10 0x123 247#define DA9063_REG_GP_ID_10 0x12B
249#define DA9063_REG_GP_ID_11 0x124 248#define DA9063_REG_GP_ID_11 0x12C
250#define DA9063_REG_GP_ID_12 0x125 249#define DA9063_REG_GP_ID_12 0x12D
251#define DA9063_REG_GP_ID_13 0x126 250#define DA9063_REG_GP_ID_13 0x12E
252#define DA9063_REG_GP_ID_14 0x127 251#define DA9063_REG_GP_ID_14 0x12F
253#define DA9063_REG_GP_ID_15 0x128 252#define DA9063_REG_GP_ID_15 0x130
254#define DA9063_REG_GP_ID_16 0x129 253#define DA9063_REG_GP_ID_16 0x131
255#define DA9063_REG_GP_ID_17 0x12A 254#define DA9063_REG_GP_ID_17 0x132
256#define DA9063_REG_GP_ID_18 0x12B 255#define DA9063_REG_GP_ID_18 0x133
257#define DA9063_REG_GP_ID_19 0x12C 256#define DA9063_REG_GP_ID_19 0x134
258 257
259/* Chip ID and variant */ 258/* Chip ID and variant */
260#define DA9063_REG_CHIP_ID 0x181 259#define DA9063_REG_CHIP_ID 0x181
@@ -405,8 +404,10 @@
405/* DA9063_REG_CONTROL_B (addr=0x0F) */ 404/* DA9063_REG_CONTROL_B (addr=0x0F) */
406#define DA9063_CHG_SEL 0x01 405#define DA9063_CHG_SEL 0x01
407#define DA9063_WATCHDOG_PD 0x02 406#define DA9063_WATCHDOG_PD 0x02
407#define DA9063_RESET_BLINKING 0x04
408#define DA9063_NRES_MODE 0x08 408#define DA9063_NRES_MODE 0x08
409#define DA9063_NONKEY_LOCK 0x10 409#define DA9063_NONKEY_LOCK 0x10
410#define DA9063_BUCK_SLOWSTART 0x80
410 411
411/* DA9063_REG_CONTROL_C (addr=0x10) */ 412/* DA9063_REG_CONTROL_C (addr=0x10) */
412#define DA9063_DEBOUNCING_MASK 0x07 413#define DA9063_DEBOUNCING_MASK 0x07
@@ -466,6 +467,7 @@
466#define DA9063_GPADC_PAUSE 0x02 467#define DA9063_GPADC_PAUSE 0x02
467#define DA9063_PMIF_DIS 0x04 468#define DA9063_PMIF_DIS 0x04
468#define DA9063_HS2WIRE_DIS 0x08 469#define DA9063_HS2WIRE_DIS 0x08
470#define DA9063_CLDR_PAUSE 0x10
469#define DA9063_BBAT_DIS 0x20 471#define DA9063_BBAT_DIS 0x20
470#define DA9063_OUT_32K_PAUSE 0x40 472#define DA9063_OUT_32K_PAUSE 0x40
471#define DA9063_PMCONT_DIS 0x80 473#define DA9063_PMCONT_DIS 0x80
@@ -660,7 +662,7 @@
660#define DA9063_GPIO15_TYPE_GPO 0x04 662#define DA9063_GPIO15_TYPE_GPO 0x04
661#define DA9063_GPIO15_NO_WAKEUP 0x80 663#define DA9063_GPIO15_NO_WAKEUP 0x80
662 664
663/* DA9063_REG_GPIO_MODE_0_7 (addr=0x1D) */ 665/* DA9063_REG_GPIO_MODE0_7 (addr=0x1D) */
664#define DA9063_GPIO0_MODE 0x01 666#define DA9063_GPIO0_MODE 0x01
665#define DA9063_GPIO1_MODE 0x02 667#define DA9063_GPIO1_MODE 0x02
666#define DA9063_GPIO2_MODE 0x04 668#define DA9063_GPIO2_MODE 0x04
@@ -670,7 +672,7 @@
670#define DA9063_GPIO6_MODE 0x40 672#define DA9063_GPIO6_MODE 0x40
671#define DA9063_GPIO7_MODE 0x80 673#define DA9063_GPIO7_MODE 0x80
672 674
673/* DA9063_REG_GPIO_MODE_8_15 (addr=0x1E) */ 675/* DA9063_REG_GPIO_MODE8_15 (addr=0x1E) */
674#define DA9063_GPIO8_MODE 0x01 676#define DA9063_GPIO8_MODE 0x01
675#define DA9063_GPIO9_MODE 0x02 677#define DA9063_GPIO9_MODE 0x02
676#define DA9063_GPIO10_MODE 0x04 678#define DA9063_GPIO10_MODE 0x04
@@ -702,12 +704,12 @@
702#define DA9063_SWITCH_SR_5MV 0x10 704#define DA9063_SWITCH_SR_5MV 0x10
703#define DA9063_SWITCH_SR_10MV 0x20 705#define DA9063_SWITCH_SR_10MV 0x20
704#define DA9063_SWITCH_SR_50MV 0x30 706#define DA9063_SWITCH_SR_50MV 0x30
705#define DA9063_SWITCH_SR_DIS 0x40 707#define DA9063_CORE_SW_INTERNAL 0x40
706#define DA9063_CP_EN_MODE 0x80 708#define DA9063_CP_EN_MODE 0x80
707 709
708/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */ 710/* DA9063_REGL_Bxxxx_CONT common bits (addr=0x20-0x25) */
709#define DA9063_BUCK_EN 0x01 711#define DA9063_BUCK_EN 0x01
710#define DA9063_BUCK_GPI_MASK 0x06 712#define DA9063_BUCK_GPI_MASK 0x06
711#define DA9063_BUCK_GPI_OFF 0x00 713#define DA9063_BUCK_GPI_OFF 0x00
712#define DA9063_BUCK_GPI_GPIO1 0x02 714#define DA9063_BUCK_GPI_GPIO1 0x02
713#define DA9063_BUCK_GPI_GPIO2 0x04 715#define DA9063_BUCK_GPI_GPIO2 0x04
@@ -841,25 +843,27 @@
841#define DA9063_COUNT_YEAR_MASK 0x3F 843#define DA9063_COUNT_YEAR_MASK 0x3F
842#define DA9063_MONITOR 0x40 844#define DA9063_MONITOR 0x40
843 845
844/* DA9063_REG_ALARM_MI (addr=0x46) */ 846/* DA9063_REG_ALARM_S (addr=0x46) */
847#define DA9063_ALARM_S_MASK 0x3F
845#define DA9063_ALARM_STATUS_ALARM 0x80 848#define DA9063_ALARM_STATUS_ALARM 0x80
846#define DA9063_ALARM_STATUS_TICK 0x40 849#define DA9063_ALARM_STATUS_TICK 0x40
850/* DA9063_REG_ALARM_MI (addr=0x47) */
847#define DA9063_ALARM_MIN_MASK 0x3F 851#define DA9063_ALARM_MIN_MASK 0x3F
848 852
849/* DA9063_REG_ALARM_H (addr=0x47) */ 853/* DA9063_REG_ALARM_H (addr=0x48) */
850#define DA9063_ALARM_HOUR_MASK 0x1F 854#define DA9063_ALARM_HOUR_MASK 0x1F
851 855
852/* DA9063_REG_ALARM_D (addr=0x48) */ 856/* DA9063_REG_ALARM_D (addr=0x49) */
853#define DA9063_ALARM_DAY_MASK 0x1F 857#define DA9063_ALARM_DAY_MASK 0x1F
854 858
855/* DA9063_REG_ALARM_MO (addr=0x49) */ 859/* DA9063_REG_ALARM_MO (addr=0x4A) */
856#define DA9063_TICK_WAKE 0x20 860#define DA9063_TICK_WAKE 0x20
857#define DA9063_TICK_TYPE 0x10 861#define DA9063_TICK_TYPE 0x10
858#define DA9063_TICK_TYPE_SEC 0x00 862#define DA9063_TICK_TYPE_SEC 0x00
859#define DA9063_TICK_TYPE_MIN 0x10 863#define DA9063_TICK_TYPE_MIN 0x10
860#define DA9063_ALARM_MONTH_MASK 0x0F 864#define DA9063_ALARM_MONTH_MASK 0x0F
861 865
862/* DA9063_REG_ALARM_Y (addr=0x4A) */ 866/* DA9063_REG_ALARM_Y (addr=0x4B) */
863#define DA9063_TICK_ON 0x80 867#define DA9063_TICK_ON 0x80
864#define DA9063_ALARM_ON 0x40 868#define DA9063_ALARM_ON 0x40
865#define DA9063_ALARM_YEAR_MASK 0x3F 869#define DA9063_ALARM_YEAR_MASK 0x3F
@@ -906,7 +910,7 @@
906 910
907/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */ 911/* DA9063_REG_Bxxxx_CFG common bits (addr=0x9D-0xA2) */
908#define DA9063_BUCK_FB_MASK 0x07 912#define DA9063_BUCK_FB_MASK 0x07
909#define DA9063_BUCK_PD_DIS_SHIFT 5 913#define DA9063_BUCK_PD_DIS_MASK 0x20
910#define DA9063_BUCK_MODE_MASK 0xC0 914#define DA9063_BUCK_MODE_MASK 0xC0
911#define DA9063_BUCK_MODE_MANUAL 0x00 915#define DA9063_BUCK_MODE_MANUAL 0x00
912#define DA9063_BUCK_MODE_SLEEP 0x40 916#define DA9063_BUCK_MODE_SLEEP 0x40
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index 060e11256fbc..bf5109d38a26 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -183,8 +183,6 @@ struct prcmu_pdata
183 bool enable_set_ddr_opp; 183 bool enable_set_ddr_opp;
184 bool enable_ape_opp_100_voltage; 184 bool enable_ape_opp_100_voltage;
185 struct ab8500_platform_data *ab_platdata; 185 struct ab8500_platform_data *ab_platdata;
186 int ab_irq;
187 int irq_base;
188 u32 version_offset; 186 u32 version_offset;
189 u32 legacy_offset; 187 u32 legacy_offset;
190 u32 adt_offset; 188 u32 adt_offset;
diff --git a/include/linux/mfd/lpc_ich.h b/include/linux/mfd/lpc_ich.h
index 3e1df644c407..8feac782fa83 100644
--- a/include/linux/mfd/lpc_ich.h
+++ b/include/linux/mfd/lpc_ich.h
@@ -21,23 +21,26 @@
21#define LPC_ICH_H 21#define LPC_ICH_H
22 22
23/* Watchdog resources */ 23/* Watchdog resources */
24#define ICH_RES_IO_TCO 0 24#define ICH_RES_IO_TCO 0
25#define ICH_RES_IO_SMI 1 25#define ICH_RES_IO_SMI 1
26#define ICH_RES_MEM_OFF 2 26#define ICH_RES_MEM_OFF 2
27#define ICH_RES_MEM_GCS 0 27#define ICH_RES_MEM_GCS_PMC 0
28 28
29/* GPIO resources */ 29/* GPIO resources */
30#define ICH_RES_GPIO 0 30#define ICH_RES_GPIO 0
31#define ICH_RES_GPE0 1 31#define ICH_RES_GPE0 1
32 32
33/* GPIO compatibility */ 33/* GPIO compatibility */
34#define ICH_I3100_GPIO 0x401 34enum {
35#define ICH_V5_GPIO 0x501 35 ICH_I3100_GPIO,
36#define ICH_V6_GPIO 0x601 36 ICH_V5_GPIO,
37#define ICH_V7_GPIO 0x701 37 ICH_V6_GPIO,
38#define ICH_V9_GPIO 0x801 38 ICH_V7_GPIO,
39#define ICH_V10CORP_GPIO 0xa01 39 ICH_V9_GPIO,
40#define ICH_V10CONS_GPIO 0xa11 40 ICH_V10CORP_GPIO,
41 ICH_V10CONS_GPIO,
42 AVOTON_GPIO,
43};
41 44
42struct lpc_ich_info { 45struct lpc_ich_info {
43 char name[32]; 46 char name[32];
diff --git a/include/linux/mfd/max14577-private.h b/include/linux/mfd/max14577-private.h
index a3d0185196d3..c9b332fb0d5d 100644
--- a/include/linux/mfd/max14577-private.h
+++ b/include/linux/mfd/max14577-private.h
@@ -248,14 +248,6 @@ enum max14577_charger_reg {
248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */ 248/* MAX14577 regulator SFOUT LDO voltage, fixed, uV */
249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000 249#define MAX14577_REGULATOR_SAFEOUT_VOLTAGE 4900000
250 250
251enum max14577_irq_source {
252 MAX14577_IRQ_INT1 = 0,
253 MAX14577_IRQ_INT2,
254 MAX14577_IRQ_INT3,
255
256 MAX14577_IRQ_REGS_NUM,
257};
258
259enum max14577_irq { 251enum max14577_irq {
260 /* INT1 */ 252 /* INT1 */
261 MAX14577_IRQ_INT1_ADC, 253 MAX14577_IRQ_INT1_ADC,
diff --git a/include/linux/mfd/max14577.h b/include/linux/mfd/max14577.h
index 247b021dfaaf..736d39c3ec0d 100644
--- a/include/linux/mfd/max14577.h
+++ b/include/linux/mfd/max14577.h
@@ -25,13 +25,8 @@
25#ifndef __MAX14577_H__ 25#ifndef __MAX14577_H__
26#define __MAX14577_H__ 26#define __MAX14577_H__
27 27
28#include <linux/mfd/max14577-private.h>
29#include <linux/regulator/consumer.h> 28#include <linux/regulator/consumer.h>
30 29
31/*
32 * MAX14577 Regulator
33 */
34
35/* MAX14577 regulator IDs */ 30/* MAX14577 regulator IDs */
36enum max14577_regulators { 31enum max14577_regulators {
37 MAX14577_SAFEOUT = 0, 32 MAX14577_SAFEOUT = 0,
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h
index ac39d910e70b..a326c850f046 100644
--- a/include/linux/mfd/mc13xxx.h
+++ b/include/linux/mfd/mc13xxx.h
@@ -104,6 +104,9 @@ enum {
104 MC13892_LED_R, 104 MC13892_LED_R,
105 MC13892_LED_G, 105 MC13892_LED_G,
106 MC13892_LED_B, 106 MC13892_LED_B,
107 /* MC34708 LED IDs */
108 MC34708_LED_R,
109 MC34708_LED_G,
107}; 110};
108 111
109struct mc13xxx_led_platform_data { 112struct mc13xxx_led_platform_data {
@@ -163,6 +166,9 @@ struct mc13xxx_leds_platform_data {
163#define MC13892_LED_C2_CURRENT_G(x) (((x) & 0x7) << 21) 166#define MC13892_LED_C2_CURRENT_G(x) (((x) & 0x7) << 21)
164/* MC13892 LED Control 3 */ 167/* MC13892 LED Control 3 */
165#define MC13892_LED_C3_CURRENT_B(x) (((x) & 0x7) << 9) 168#define MC13892_LED_C3_CURRENT_B(x) (((x) & 0x7) << 9)
169/* MC34708 LED Control 0 */
170#define MC34708_LED_C0_CURRENT_R(x) (((x) & 0x3) << 9)
171#define MC34708_LED_C0_CURRENT_G(x) (((x) & 0x3) << 21)
166 u32 led_control[MAX_LED_CONTROL_REGS]; 172 u32 led_control[MAX_LED_CONTROL_REGS];
167}; 173};
168 174
diff --git a/include/linux/mfd/pm8xxx/irq.h b/include/linux/mfd/pm8xxx/irq.h
deleted file mode 100644
index f83d6b43ecbb..000000000000
--- a/include/linux/mfd/pm8xxx/irq.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright (c) 2011, Code Aurora Forum. 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 and
6 * only version 2 as 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/*
14 * Qualcomm PMIC irq 8xxx driver header file
15 *
16 */
17
18#ifndef __MFD_PM8XXX_IRQ_H
19#define __MFD_PM8XXX_IRQ_H
20
21#include <linux/errno.h>
22#include <linux/err.h>
23
24struct pm8xxx_irq_core_data {
25 u32 rev;
26 int nirqs;
27};
28
29struct pm8xxx_irq_platform_data {
30 int irq_base;
31 struct pm8xxx_irq_core_data irq_cdata;
32 int devirq;
33 int irq_trigger_flag;
34};
35
36struct pm_irq_chip;
37
38#ifdef CONFIG_MFD_PM8XXX_IRQ
39int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq);
40struct pm_irq_chip *pm8xxx_irq_init(struct device *dev,
41 const struct pm8xxx_irq_platform_data *pdata);
42int pm8xxx_irq_exit(struct pm_irq_chip *chip);
43#else
44static inline int pm8xxx_get_irq_stat(struct pm_irq_chip *chip, int irq)
45{
46 return -ENXIO;
47}
48static inline struct pm_irq_chip *pm8xxx_irq_init(
49 const struct device *dev,
50 const struct pm8xxx_irq_platform_data *pdata)
51{
52 return ERR_PTR(-ENXIO);
53}
54static inline int pm8xxx_irq_exit(struct pm_irq_chip *chip)
55{
56 return -ENXIO;
57}
58#endif /* CONFIG_MFD_PM8XXX_IRQ */
59#endif /* __MFD_PM8XXX_IRQ_H */
diff --git a/include/linux/mfd/pm8xxx/rtc.h b/include/linux/mfd/pm8xxx/rtc.h
deleted file mode 100644
index 14f1983eaecc..000000000000
--- a/include/linux/mfd/pm8xxx/rtc.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
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 version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __RTC_PM8XXX_H__
14#define __RTC_PM8XXX_H__
15
16#define PM8XXX_RTC_DEV_NAME "rtc-pm8xxx"
17/**
18 * struct pm8xxx_rtc_pdata - RTC driver platform data
19 * @rtc_write_enable: variable stating RTC write capability
20 */
21struct pm8xxx_rtc_platform_data {
22 bool rtc_write_enable;
23};
24
25#endif /* __RTC_PM8XXX_H__ */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/mfd/rtsx_common.h
index 443176ee1ab0..7c36cc55d2c7 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/mfd/rtsx_common.h
@@ -45,6 +45,7 @@ struct platform_device;
45struct rtsx_slot { 45struct rtsx_slot {
46 struct platform_device *p_dev; 46 struct platform_device *p_dev;
47 void (*card_event)(struct platform_device *p_dev); 47 void (*card_event)(struct platform_device *p_dev);
48 void (*done_transfer)(struct platform_device *p_dev);
48}; 49};
49 50
50#endif 51#endif
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h
index 0ce772105508..8d6bbd609ad9 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/mfd/rtsx_pci.h
@@ -144,7 +144,7 @@
144#define HOST_TO_DEVICE 0 144#define HOST_TO_DEVICE 0
145#define DEVICE_TO_HOST 1 145#define DEVICE_TO_HOST 1
146 146
147#define MAX_PHASE 31 147#define RTSX_PHASE_MAX 32
148#define RX_TUNING_CNT 3 148#define RX_TUNING_CNT 3
149 149
150/* SG descriptor */ 150/* SG descriptor */
@@ -943,6 +943,12 @@ void rtsx_pci_send_cmd_no_wait(struct rtsx_pcr *pcr);
943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout); 943int rtsx_pci_send_cmd(struct rtsx_pcr *pcr, int timeout);
944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist, 944int rtsx_pci_transfer_data(struct rtsx_pcr *pcr, struct scatterlist *sglist,
945 int num_sg, bool read, int timeout); 945 int num_sg, bool read, int timeout);
946int rtsx_pci_dma_map_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
947 int num_sg, bool read);
948int rtsx_pci_dma_unmap_sg(struct rtsx_pcr *pcr, struct scatterlist *sglist,
949 int num_sg, bool read);
950int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist,
951 int sg_count, bool read);
946int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 952int rtsx_pci_read_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
947int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len); 953int rtsx_pci_write_ppbuf(struct rtsx_pcr *pcr, u8 *buf, int buf_len);
948int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card); 954int rtsx_pci_card_pull_ctl_enable(struct rtsx_pcr *pcr, int card);
diff --git a/include/linux/mfd/rtsx_usb.h b/include/linux/mfd/rtsx_usb.h
new file mode 100644
index 000000000000..c446e4fd6b5c
--- /dev/null
+++ b/include/linux/mfd/rtsx_usb.h
@@ -0,0 +1,628 @@
1/* Driver for Realtek RTS5139 USB card reader
2 *
3 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author:
18 * Roger Tseng <rogerable@realtek.com>
19 */
20
21#ifndef __RTSX_USB_H
22#define __RTSX_USB_H
23
24#include <linux/usb.h>
25
26/* related module names */
27#define RTSX_USB_SD_CARD 0
28#define RTSX_USB_MS_CARD 1
29
30/* endpoint numbers */
31#define EP_BULK_OUT 1
32#define EP_BULK_IN 2
33#define EP_INTR_IN 3
34
35/* USB vendor requests */
36#define RTSX_USB_REQ_REG_OP 0x00
37#define RTSX_USB_REQ_POLL 0x02
38
39/* miscellaneous parameters */
40#define MIN_DIV_N 60
41#define MAX_DIV_N 120
42
43#define MAX_PHASE 15
44#define RX_TUNING_CNT 3
45
46#define QFN24 0
47#define LQFP48 1
48#define CHECK_PKG(ucr, pkg) ((ucr)->package == (pkg))
49
50/* data structures */
51struct rtsx_ucr {
52 u16 vendor_id;
53 u16 product_id;
54
55 int package;
56 u8 ic_version;
57 bool is_rts5179;
58
59 unsigned int cur_clk;
60
61 u8 *cmd_buf;
62 unsigned int cmd_idx;
63 u8 *rsp_buf;
64
65 struct usb_device *pusb_dev;
66 struct usb_interface *pusb_intf;
67 struct usb_sg_request current_sg;
68 unsigned char *iobuf;
69 dma_addr_t iobuf_dma;
70
71 struct timer_list sg_timer;
72 struct mutex dev_mutex;
73};
74
75/* buffer size */
76#define IOBUF_SIZE 1024
77
78/* prototypes of exported functions */
79extern int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status);
80
81extern int rtsx_usb_read_register(struct rtsx_ucr *ucr, u16 addr, u8 *data);
82extern int rtsx_usb_write_register(struct rtsx_ucr *ucr, u16 addr, u8 mask,
83 u8 data);
84
85extern int rtsx_usb_ep0_write_register(struct rtsx_ucr *ucr, u16 addr, u8 mask,
86 u8 data);
87extern int rtsx_usb_ep0_read_register(struct rtsx_ucr *ucr, u16 addr,
88 u8 *data);
89
90extern void rtsx_usb_add_cmd(struct rtsx_ucr *ucr, u8 cmd_type,
91 u16 reg_addr, u8 mask, u8 data);
92extern int rtsx_usb_send_cmd(struct rtsx_ucr *ucr, u8 flag, int timeout);
93extern int rtsx_usb_get_rsp(struct rtsx_ucr *ucr, int rsp_len, int timeout);
94extern int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
95 void *buf, unsigned int len, int use_sg,
96 unsigned int *act_len, int timeout);
97
98extern int rtsx_usb_read_ppbuf(struct rtsx_ucr *ucr, u8 *buf, int buf_len);
99extern int rtsx_usb_write_ppbuf(struct rtsx_ucr *ucr, u8 *buf, int buf_len);
100extern int rtsx_usb_switch_clock(struct rtsx_ucr *ucr, unsigned int card_clock,
101 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk);
102extern int rtsx_usb_card_exclusive_check(struct rtsx_ucr *ucr, int card);
103
104/* card status */
105#define SD_CD 0x01
106#define MS_CD 0x02
107#define XD_CD 0x04
108#define CD_MASK (SD_CD | MS_CD | XD_CD)
109#define SD_WP 0x08
110
111/* reader command field offset & parameters */
112#define READ_REG_CMD 0
113#define WRITE_REG_CMD 1
114#define CHECK_REG_CMD 2
115
116#define PACKET_TYPE 4
117#define CNT_H 5
118#define CNT_L 6
119#define STAGE_FLAG 7
120#define CMD_OFFSET 8
121#define SEQ_WRITE_DATA_OFFSET 12
122
123#define BATCH_CMD 0
124#define SEQ_READ 1
125#define SEQ_WRITE 2
126
127#define STAGE_R 0x01
128#define STAGE_DI 0x02
129#define STAGE_DO 0x04
130#define STAGE_MS_STATUS 0x08
131#define STAGE_XD_STATUS 0x10
132#define MODE_C 0x00
133#define MODE_CR (STAGE_R)
134#define MODE_CDIR (STAGE_R | STAGE_DI)
135#define MODE_CDOR (STAGE_R | STAGE_DO)
136
137#define EP0_OP_SHIFT 14
138#define EP0_READ_REG_CMD 2
139#define EP0_WRITE_REG_CMD 3
140
141#define rtsx_usb_cmd_hdr_tag(ucr) \
142 do { \
143 ucr->cmd_buf[0] = 'R'; \
144 ucr->cmd_buf[1] = 'T'; \
145 ucr->cmd_buf[2] = 'C'; \
146 ucr->cmd_buf[3] = 'R'; \
147 } while (0)
148
149static inline void rtsx_usb_init_cmd(struct rtsx_ucr *ucr)
150{
151 rtsx_usb_cmd_hdr_tag(ucr);
152 ucr->cmd_idx = 0;
153 ucr->cmd_buf[PACKET_TYPE] = BATCH_CMD;
154}
155
156/* internal register address */
157#define FPDCTL 0xFC00
158#define SSC_DIV_N_0 0xFC07
159#define SSC_CTL1 0xFC09
160#define SSC_CTL2 0xFC0A
161#define CFG_MODE 0xFC0E
162#define CFG_MODE_1 0xFC0F
163#define RCCTL 0xFC14
164#define SOF_WDOG 0xFC28
165#define SYS_DUMMY0 0xFC30
166
167#define MS_BLKEND 0xFD30
168#define MS_READ_START 0xFD31
169#define MS_READ_COUNT 0xFD32
170#define MS_WRITE_START 0xFD33
171#define MS_WRITE_COUNT 0xFD34
172#define MS_COMMAND 0xFD35
173#define MS_OLD_BLOCK_0 0xFD36
174#define MS_OLD_BLOCK_1 0xFD37
175#define MS_NEW_BLOCK_0 0xFD38
176#define MS_NEW_BLOCK_1 0xFD39
177#define MS_LOG_BLOCK_0 0xFD3A
178#define MS_LOG_BLOCK_1 0xFD3B
179#define MS_BUS_WIDTH 0xFD3C
180#define MS_PAGE_START 0xFD3D
181#define MS_PAGE_LENGTH 0xFD3E
182#define MS_CFG 0xFD40
183#define MS_TPC 0xFD41
184#define MS_TRANS_CFG 0xFD42
185#define MS_TRANSFER 0xFD43
186#define MS_INT_REG 0xFD44
187#define MS_BYTE_CNT 0xFD45
188#define MS_SECTOR_CNT_L 0xFD46
189#define MS_SECTOR_CNT_H 0xFD47
190#define MS_DBUS_H 0xFD48
191
192#define CARD_DMA1_CTL 0xFD5C
193#define CARD_PULL_CTL1 0xFD60
194#define CARD_PULL_CTL2 0xFD61
195#define CARD_PULL_CTL3 0xFD62
196#define CARD_PULL_CTL4 0xFD63
197#define CARD_PULL_CTL5 0xFD64
198#define CARD_PULL_CTL6 0xFD65
199#define CARD_EXIST 0xFD6F
200#define CARD_INT_PEND 0xFD71
201
202#define LDO_POWER_CFG 0xFD7B
203
204#define SD_CFG1 0xFDA0
205#define SD_CFG2 0xFDA1
206#define SD_CFG3 0xFDA2
207#define SD_STAT1 0xFDA3
208#define SD_STAT2 0xFDA4
209#define SD_BUS_STAT 0xFDA5
210#define SD_PAD_CTL 0xFDA6
211#define SD_SAMPLE_POINT_CTL 0xFDA7
212#define SD_PUSH_POINT_CTL 0xFDA8
213#define SD_CMD0 0xFDA9
214#define SD_CMD1 0xFDAA
215#define SD_CMD2 0xFDAB
216#define SD_CMD3 0xFDAC
217#define SD_CMD4 0xFDAD
218#define SD_CMD5 0xFDAE
219#define SD_BYTE_CNT_L 0xFDAF
220#define SD_BYTE_CNT_H 0xFDB0
221#define SD_BLOCK_CNT_L 0xFDB1
222#define SD_BLOCK_CNT_H 0xFDB2
223#define SD_TRANSFER 0xFDB3
224#define SD_CMD_STATE 0xFDB5
225#define SD_DATA_STATE 0xFDB6
226#define SD_VPCLK0_CTL 0xFC2A
227#define SD_VPCLK1_CTL 0xFC2B
228#define SD_DCMPS0_CTL 0xFC2C
229#define SD_DCMPS1_CTL 0xFC2D
230
231#define CARD_DMA1_CTL 0xFD5C
232
233#define HW_VERSION 0xFC01
234
235#define SSC_CLK_FPGA_SEL 0xFC02
236#define CLK_DIV 0xFC03
237#define SFSM_ED 0xFC04
238
239#define CD_DEGLITCH_WIDTH 0xFC20
240#define CD_DEGLITCH_EN 0xFC21
241#define AUTO_DELINK_EN 0xFC23
242
243#define FPGA_PULL_CTL 0xFC1D
244#define CARD_CLK_SOURCE 0xFC2E
245
246#define CARD_SHARE_MODE 0xFD51
247#define CARD_DRIVE_SEL 0xFD52
248#define CARD_STOP 0xFD53
249#define CARD_OE 0xFD54
250#define CARD_AUTO_BLINK 0xFD55
251#define CARD_GPIO 0xFD56
252#define SD30_DRIVE_SEL 0xFD57
253
254#define CARD_DATA_SOURCE 0xFD5D
255#define CARD_SELECT 0xFD5E
256
257#define CARD_CLK_EN 0xFD79
258#define CARD_PWR_CTL 0xFD7A
259
260#define OCPCTL 0xFD80
261#define OCPPARA1 0xFD81
262#define OCPPARA2 0xFD82
263#define OCPSTAT 0xFD83
264
265#define HS_USB_STAT 0xFE01
266#define HS_VCONTROL 0xFE26
267#define HS_VSTAIN 0xFE27
268#define HS_VLOADM 0xFE28
269#define HS_VSTAOUT 0xFE29
270
271#define MC_IRQ 0xFF00
272#define MC_IRQEN 0xFF01
273#define MC_FIFO_CTL 0xFF02
274#define MC_FIFO_BC0 0xFF03
275#define MC_FIFO_BC1 0xFF04
276#define MC_FIFO_STAT 0xFF05
277#define MC_FIFO_MODE 0xFF06
278#define MC_FIFO_RD_PTR0 0xFF07
279#define MC_FIFO_RD_PTR1 0xFF08
280#define MC_DMA_CTL 0xFF10
281#define MC_DMA_TC0 0xFF11
282#define MC_DMA_TC1 0xFF12
283#define MC_DMA_TC2 0xFF13
284#define MC_DMA_TC3 0xFF14
285#define MC_DMA_RST 0xFF15
286
287#define RBUF_SIZE_MASK 0xFBFF
288#define RBUF_BASE 0xF000
289#define PPBUF_BASE1 0xF800
290#define PPBUF_BASE2 0xFA00
291
292/* internal register value macros */
293#define POWER_OFF 0x03
294#define PARTIAL_POWER_ON 0x02
295#define POWER_ON 0x00
296#define POWER_MASK 0x03
297#define LDO3318_PWR_MASK 0x0C
298#define LDO_ON 0x00
299#define LDO_SUSPEND 0x08
300#define LDO_OFF 0x0C
301#define DV3318_AUTO_PWR_OFF 0x10
302#define FORCE_LDO_POWERB 0x60
303
304/* LDO_POWER_CFG */
305#define TUNE_SD18_MASK 0x1C
306#define TUNE_SD18_1V7 0x00
307#define TUNE_SD18_1V8 (0x01 << 2)
308#define TUNE_SD18_1V9 (0x02 << 2)
309#define TUNE_SD18_2V0 (0x03 << 2)
310#define TUNE_SD18_2V7 (0x04 << 2)
311#define TUNE_SD18_2V8 (0x05 << 2)
312#define TUNE_SD18_2V9 (0x06 << 2)
313#define TUNE_SD18_3V3 (0x07 << 2)
314
315/* CLK_DIV */
316#define CLK_CHANGE 0x80
317#define CLK_DIV_1 0x00
318#define CLK_DIV_2 0x01
319#define CLK_DIV_4 0x02
320#define CLK_DIV_8 0x03
321
322#define SSC_POWER_MASK 0x01
323#define SSC_POWER_DOWN 0x01
324#define SSC_POWER_ON 0x00
325
326#define FPGA_VER 0x80
327#define HW_VER_MASK 0x0F
328
329#define EXTEND_DMA1_ASYNC_SIGNAL 0x02
330
331/* CFG_MODE*/
332#define XTAL_FREE 0x80
333#define CLK_MODE_MASK 0x03
334#define CLK_MODE_12M_XTAL 0x00
335#define CLK_MODE_NON_XTAL 0x01
336#define CLK_MODE_24M_OSC 0x02
337#define CLK_MODE_48M_OSC 0x03
338
339/* CFG_MODE_1*/
340#define RTS5179 0x02
341
342#define NYET_EN 0x01
343#define NYET_MSAK 0x01
344
345#define SD30_DRIVE_MASK 0x07
346#define SD20_DRIVE_MASK 0x03
347
348#define DISABLE_SD_CD 0x08
349#define DISABLE_MS_CD 0x10
350#define DISABLE_XD_CD 0x20
351#define SD_CD_DEGLITCH_EN 0x01
352#define MS_CD_DEGLITCH_EN 0x02
353#define XD_CD_DEGLITCH_EN 0x04
354
355#define CARD_SHARE_LQFP48 0x04
356#define CARD_SHARE_QFN24 0x00
357#define CARD_SHARE_LQFP_SEL 0x04
358#define CARD_SHARE_XD 0x00
359#define CARD_SHARE_SD 0x01
360#define CARD_SHARE_MS 0x02
361#define CARD_SHARE_MASK 0x03
362
363
364/* SD30_DRIVE_SEL */
365#define DRIVER_TYPE_A 0x05
366#define DRIVER_TYPE_B 0x03
367#define DRIVER_TYPE_C 0x02
368#define DRIVER_TYPE_D 0x01
369
370/* SD_BUS_STAT */
371#define SD_CLK_TOGGLE_EN 0x80
372#define SD_CLK_FORCE_STOP 0x40
373#define SD_DAT3_STATUS 0x10
374#define SD_DAT2_STATUS 0x08
375#define SD_DAT1_STATUS 0x04
376#define SD_DAT0_STATUS 0x02
377#define SD_CMD_STATUS 0x01
378
379/* SD_PAD_CTL */
380#define SD_IO_USING_1V8 0x80
381#define SD_IO_USING_3V3 0x7F
382#define TYPE_A_DRIVING 0x00
383#define TYPE_B_DRIVING 0x01
384#define TYPE_C_DRIVING 0x02
385#define TYPE_D_DRIVING 0x03
386
387/* CARD_CLK_EN */
388#define SD_CLK_EN 0x04
389#define MS_CLK_EN 0x08
390
391/* CARD_SELECT */
392#define SD_MOD_SEL 2
393#define MS_MOD_SEL 3
394
395/* CARD_SHARE_MODE */
396#define CARD_SHARE_LQFP48 0x04
397#define CARD_SHARE_QFN24 0x00
398#define CARD_SHARE_LQFP_SEL 0x04
399#define CARD_SHARE_XD 0x00
400#define CARD_SHARE_SD 0x01
401#define CARD_SHARE_MS 0x02
402#define CARD_SHARE_MASK 0x03
403
404/* SSC_CTL1 */
405#define SSC_RSTB 0x80
406#define SSC_8X_EN 0x40
407#define SSC_FIX_FRAC 0x20
408#define SSC_SEL_1M 0x00
409#define SSC_SEL_2M 0x08
410#define SSC_SEL_4M 0x10
411#define SSC_SEL_8M 0x18
412
413/* SSC_CTL2 */
414#define SSC_DEPTH_MASK 0x03
415#define SSC_DEPTH_DISALBE 0x00
416#define SSC_DEPTH_2M 0x01
417#define SSC_DEPTH_1M 0x02
418#define SSC_DEPTH_512K 0x03
419
420/* SD_VPCLK0_CTL */
421#define PHASE_CHANGE 0x80
422#define PHASE_NOT_RESET 0x40
423
424/* SD_TRANSFER */
425#define SD_TRANSFER_START 0x80
426#define SD_TRANSFER_END 0x40
427#define SD_STAT_IDLE 0x20
428#define SD_TRANSFER_ERR 0x10
429#define SD_TM_NORMAL_WRITE 0x00
430#define SD_TM_AUTO_WRITE_3 0x01
431#define SD_TM_AUTO_WRITE_4 0x02
432#define SD_TM_AUTO_READ_3 0x05
433#define SD_TM_AUTO_READ_4 0x06
434#define SD_TM_CMD_RSP 0x08
435#define SD_TM_AUTO_WRITE_1 0x09
436#define SD_TM_AUTO_WRITE_2 0x0A
437#define SD_TM_NORMAL_READ 0x0C
438#define SD_TM_AUTO_READ_1 0x0D
439#define SD_TM_AUTO_READ_2 0x0E
440#define SD_TM_AUTO_TUNING 0x0F
441
442/* SD_CFG1 */
443#define SD_CLK_DIVIDE_0 0x00
444#define SD_CLK_DIVIDE_256 0xC0
445#define SD_CLK_DIVIDE_128 0x80
446#define SD_CLK_DIVIDE_MASK 0xC0
447#define SD_BUS_WIDTH_1BIT 0x00
448#define SD_BUS_WIDTH_4BIT 0x01
449#define SD_BUS_WIDTH_8BIT 0x02
450#define SD_ASYNC_FIFO_RST 0x10
451#define SD_20_MODE 0x00
452#define SD_DDR_MODE 0x04
453#define SD_30_MODE 0x08
454
455/* SD_CFG2 */
456#define SD_CALCULATE_CRC7 0x00
457#define SD_NO_CALCULATE_CRC7 0x80
458#define SD_CHECK_CRC16 0x00
459#define SD_NO_CHECK_CRC16 0x40
460#define SD_WAIT_CRC_TO_EN 0x20
461#define SD_WAIT_BUSY_END 0x08
462#define SD_NO_WAIT_BUSY_END 0x00
463#define SD_CHECK_CRC7 0x00
464#define SD_NO_CHECK_CRC7 0x04
465#define SD_RSP_LEN_0 0x00
466#define SD_RSP_LEN_6 0x01
467#define SD_RSP_LEN_17 0x02
468#define SD_RSP_TYPE_R0 0x04
469#define SD_RSP_TYPE_R1 0x01
470#define SD_RSP_TYPE_R1b 0x09
471#define SD_RSP_TYPE_R2 0x02
472#define SD_RSP_TYPE_R3 0x05
473#define SD_RSP_TYPE_R4 0x05
474#define SD_RSP_TYPE_R5 0x01
475#define SD_RSP_TYPE_R6 0x01
476#define SD_RSP_TYPE_R7 0x01
477
478/* SD_STAT1 */
479#define SD_CRC7_ERR 0x80
480#define SD_CRC16_ERR 0x40
481#define SD_CRC_WRITE_ERR 0x20
482#define SD_CRC_WRITE_ERR_MASK 0x1C
483#define GET_CRC_TIME_OUT 0x02
484#define SD_TUNING_COMPARE_ERR 0x01
485
486/* SD_DATA_STATE */
487#define SD_DATA_IDLE 0x80
488
489/* CARD_DATA_SOURCE */
490#define PINGPONG_BUFFER 0x01
491#define RING_BUFFER 0x00
492
493/* CARD_OE */
494#define SD_OUTPUT_EN 0x04
495#define MS_OUTPUT_EN 0x08
496
497/* CARD_STOP */
498#define SD_STOP 0x04
499#define MS_STOP 0x08
500#define SD_CLR_ERR 0x40
501#define MS_CLR_ERR 0x80
502
503/* CARD_CLK_SOURCE */
504#define CRC_FIX_CLK (0x00 << 0)
505#define CRC_VAR_CLK0 (0x01 << 0)
506#define CRC_VAR_CLK1 (0x02 << 0)
507#define SD30_FIX_CLK (0x00 << 2)
508#define SD30_VAR_CLK0 (0x01 << 2)
509#define SD30_VAR_CLK1 (0x02 << 2)
510#define SAMPLE_FIX_CLK (0x00 << 4)
511#define SAMPLE_VAR_CLK0 (0x01 << 4)
512#define SAMPLE_VAR_CLK1 (0x02 << 4)
513
514/* SD_SAMPLE_POINT_CTL */
515#define DDR_FIX_RX_DAT 0x00
516#define DDR_VAR_RX_DAT 0x80
517#define DDR_FIX_RX_DAT_EDGE 0x00
518#define DDR_FIX_RX_DAT_14_DELAY 0x40
519#define DDR_FIX_RX_CMD 0x00
520#define DDR_VAR_RX_CMD 0x20
521#define DDR_FIX_RX_CMD_POS_EDGE 0x00
522#define DDR_FIX_RX_CMD_14_DELAY 0x10
523#define SD20_RX_POS_EDGE 0x00
524#define SD20_RX_14_DELAY 0x08
525#define SD20_RX_SEL_MASK 0x08
526
527/* SD_PUSH_POINT_CTL */
528#define DDR_FIX_TX_CMD_DAT 0x00
529#define DDR_VAR_TX_CMD_DAT 0x80
530#define DDR_FIX_TX_DAT_14_TSU 0x00
531#define DDR_FIX_TX_DAT_12_TSU 0x40
532#define DDR_FIX_TX_CMD_NEG_EDGE 0x00
533#define DDR_FIX_TX_CMD_14_AHEAD 0x20
534#define SD20_TX_NEG_EDGE 0x00
535#define SD20_TX_14_AHEAD 0x10
536#define SD20_TX_SEL_MASK 0x10
537#define DDR_VAR_SDCLK_POL_SWAP 0x01
538
539/* MS_CFG */
540#define SAMPLE_TIME_RISING 0x00
541#define SAMPLE_TIME_FALLING 0x80
542#define PUSH_TIME_DEFAULT 0x00
543#define PUSH_TIME_ODD 0x40
544#define NO_EXTEND_TOGGLE 0x00
545#define EXTEND_TOGGLE_CHK 0x20
546#define MS_BUS_WIDTH_1 0x00
547#define MS_BUS_WIDTH_4 0x10
548#define MS_BUS_WIDTH_8 0x18
549#define MS_2K_SECTOR_MODE 0x04
550#define MS_512_SECTOR_MODE 0x00
551#define MS_TOGGLE_TIMEOUT_EN 0x00
552#define MS_TOGGLE_TIMEOUT_DISEN 0x01
553#define MS_NO_CHECK_INT 0x02
554
555/* MS_TRANS_CFG */
556#define WAIT_INT 0x80
557#define NO_WAIT_INT 0x00
558#define NO_AUTO_READ_INT_REG 0x00
559#define AUTO_READ_INT_REG 0x40
560#define MS_CRC16_ERR 0x20
561#define MS_RDY_TIMEOUT 0x10
562#define MS_INT_CMDNK 0x08
563#define MS_INT_BREQ 0x04
564#define MS_INT_ERR 0x02
565#define MS_INT_CED 0x01
566
567/* MS_TRANSFER */
568#define MS_TRANSFER_START 0x80
569#define MS_TRANSFER_END 0x40
570#define MS_TRANSFER_ERR 0x20
571#define MS_BS_STATE 0x10
572#define MS_TM_READ_BYTES 0x00
573#define MS_TM_NORMAL_READ 0x01
574#define MS_TM_WRITE_BYTES 0x04
575#define MS_TM_NORMAL_WRITE 0x05
576#define MS_TM_AUTO_READ 0x08
577#define MS_TM_AUTO_WRITE 0x0C
578#define MS_TM_SET_CMD 0x06
579#define MS_TM_COPY_PAGE 0x07
580#define MS_TM_MULTI_READ 0x02
581#define MS_TM_MULTI_WRITE 0x03
582
583/* MC_FIFO_CTL */
584#define FIFO_FLUSH 0x01
585
586/* MC_DMA_RST */
587#define DMA_RESET 0x01
588
589/* MC_DMA_CTL */
590#define DMA_TC_EQ_0 0x80
591#define DMA_DIR_TO_CARD 0x00
592#define DMA_DIR_FROM_CARD 0x02
593#define DMA_EN 0x01
594#define DMA_128 (0 << 2)
595#define DMA_256 (1 << 2)
596#define DMA_512 (2 << 2)
597#define DMA_1024 (3 << 2)
598#define DMA_PACK_SIZE_MASK 0x0C
599
600/* CARD_INT_PEND */
601#define XD_INT 0x10
602#define MS_INT 0x08
603#define SD_INT 0x04
604
605/* LED operations*/
606static inline int rtsx_usb_turn_on_led(struct rtsx_ucr *ucr)
607{
608 return rtsx_usb_ep0_write_register(ucr, CARD_GPIO, 0x03, 0x02);
609}
610
611static inline int rtsx_usb_turn_off_led(struct rtsx_ucr *ucr)
612{
613 return rtsx_usb_ep0_write_register(ucr, CARD_GPIO, 0x03, 0x03);
614}
615
616/* HW error clearing */
617static inline void rtsx_usb_clear_fsm_err(struct rtsx_ucr *ucr)
618{
619 rtsx_usb_ep0_write_register(ucr, SFSM_ED, 0xf8, 0xf8);
620}
621
622static inline void rtsx_usb_clear_dma_err(struct rtsx_ucr *ucr)
623{
624 rtsx_usb_ep0_write_register(ucr, MC_FIFO_CTL,
625 FIFO_FLUSH, FIFO_FLUSH);
626 rtsx_usb_ep0_write_register(ucr, MC_DMA_RST, DMA_RESET, DMA_RESET);
627}
628#endif /* __RTS51139_H */
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h
index 41c9bde410c5..157e32b6ca28 100644
--- a/include/linux/mfd/samsung/core.h
+++ b/include/linux/mfd/samsung/core.h
@@ -18,7 +18,9 @@ enum sec_device_type {
18 S5M8751X, 18 S5M8751X,
19 S5M8763X, 19 S5M8763X,
20 S5M8767X, 20 S5M8767X,
21 S2MPA01,
21 S2MPS11X, 22 S2MPS11X,
23 S2MPS14X,
22}; 24};
23 25
24/** 26/**
@@ -50,7 +52,7 @@ struct sec_pmic_dev {
50 struct regmap_irq_chip_data *irq_data; 52 struct regmap_irq_chip_data *irq_data;
51 53
52 int ono; 54 int ono;
53 int type; 55 unsigned long type;
54 bool wakeup; 56 bool wakeup;
55 bool wtsr_smpl; 57 bool wtsr_smpl;
56}; 58};
@@ -92,7 +94,7 @@ struct sec_platform_data {
92 int buck3_default_idx; 94 int buck3_default_idx;
93 int buck4_default_idx; 95 int buck4_default_idx;
94 96
95 int buck_ramp_delay; 97 int buck_ramp_delay;
96 98
97 int buck2_ramp_delay; 99 int buck2_ramp_delay;
98 int buck34_ramp_delay; 100 int buck34_ramp_delay;
@@ -100,10 +102,15 @@ struct sec_platform_data {
100 int buck16_ramp_delay; 102 int buck16_ramp_delay;
101 int buck7810_ramp_delay; 103 int buck7810_ramp_delay;
102 int buck9_ramp_delay; 104 int buck9_ramp_delay;
103 105 int buck24_ramp_delay;
104 bool buck2_ramp_enable; 106 int buck3_ramp_delay;
105 bool buck3_ramp_enable; 107 int buck7_ramp_delay;
106 bool buck4_ramp_enable; 108 int buck8910_ramp_delay;
109
110 bool buck1_ramp_enable;
111 bool buck2_ramp_enable;
112 bool buck3_ramp_enable;
113 bool buck4_ramp_enable;
107 bool buck6_ramp_enable; 114 bool buck6_ramp_enable;
108 115
109 int buck2_init; 116 int buck2_init;
@@ -119,7 +126,8 @@ struct sec_platform_data {
119struct sec_regulator_data { 126struct sec_regulator_data {
120 int id; 127 int id;
121 struct regulator_init_data *initdata; 128 struct regulator_init_data *initdata;
122 struct device_node *reg_node; 129 struct device_node *reg_node;
130 int ext_control_gpio;
123}; 131};
124 132
125/* 133/*
diff --git a/include/linux/mfd/samsung/irq.h b/include/linux/mfd/samsung/irq.h
index d43b4f9e7fb2..1224f447356b 100644
--- a/include/linux/mfd/samsung/irq.h
+++ b/include/linux/mfd/samsung/irq.h
@@ -13,6 +13,56 @@
13#ifndef __LINUX_MFD_SEC_IRQ_H 13#ifndef __LINUX_MFD_SEC_IRQ_H
14#define __LINUX_MFD_SEC_IRQ_H 14#define __LINUX_MFD_SEC_IRQ_H
15 15
16enum s2mpa01_irq {
17 S2MPA01_IRQ_PWRONF,
18 S2MPA01_IRQ_PWRONR,
19 S2MPA01_IRQ_JIGONBF,
20 S2MPA01_IRQ_JIGONBR,
21 S2MPA01_IRQ_ACOKBF,
22 S2MPA01_IRQ_ACOKBR,
23 S2MPA01_IRQ_PWRON1S,
24 S2MPA01_IRQ_MRB,
25
26 S2MPA01_IRQ_RTC60S,
27 S2MPA01_IRQ_RTCA1,
28 S2MPA01_IRQ_RTCA0,
29 S2MPA01_IRQ_SMPL,
30 S2MPA01_IRQ_RTC1S,
31 S2MPA01_IRQ_WTSR,
32
33 S2MPA01_IRQ_INT120C,
34 S2MPA01_IRQ_INT140C,
35 S2MPA01_IRQ_LDO3_TSD,
36 S2MPA01_IRQ_B16_TSD,
37 S2MPA01_IRQ_B24_TSD,
38 S2MPA01_IRQ_B35_TSD,
39
40 S2MPA01_IRQ_NR,
41};
42
43#define S2MPA01_IRQ_PWRONF_MASK (1 << 0)
44#define S2MPA01_IRQ_PWRONR_MASK (1 << 1)
45#define S2MPA01_IRQ_JIGONBF_MASK (1 << 2)
46#define S2MPA01_IRQ_JIGONBR_MASK (1 << 3)
47#define S2MPA01_IRQ_ACOKBF_MASK (1 << 4)
48#define S2MPA01_IRQ_ACOKBR_MASK (1 << 5)
49#define S2MPA01_IRQ_PWRON1S_MASK (1 << 6)
50#define S2MPA01_IRQ_MRB_MASK (1 << 7)
51
52#define S2MPA01_IRQ_RTC60S_MASK (1 << 0)
53#define S2MPA01_IRQ_RTCA1_MASK (1 << 1)
54#define S2MPA01_IRQ_RTCA0_MASK (1 << 2)
55#define S2MPA01_IRQ_SMPL_MASK (1 << 3)
56#define S2MPA01_IRQ_RTC1S_MASK (1 << 4)
57#define S2MPA01_IRQ_WTSR_MASK (1 << 5)
58
59#define S2MPA01_IRQ_INT120C_MASK (1 << 0)
60#define S2MPA01_IRQ_INT140C_MASK (1 << 1)
61#define S2MPA01_IRQ_LDO3_TSD_MASK (1 << 2)
62#define S2MPA01_IRQ_B16_TSD_MASK (1 << 3)
63#define S2MPA01_IRQ_B24_TSD_MASK (1 << 4)
64#define S2MPA01_IRQ_B35_TSD_MASK (1 << 5)
65
16enum s2mps11_irq { 66enum s2mps11_irq {
17 S2MPS11_IRQ_PWRONF, 67 S2MPS11_IRQ_PWRONF,
18 S2MPS11_IRQ_PWRONR, 68 S2MPS11_IRQ_PWRONR,
@@ -24,8 +74,8 @@ enum s2mps11_irq {
24 S2MPS11_IRQ_MRB, 74 S2MPS11_IRQ_MRB,
25 75
26 S2MPS11_IRQ_RTC60S, 76 S2MPS11_IRQ_RTC60S,
77 S2MPS11_IRQ_RTCA0,
27 S2MPS11_IRQ_RTCA1, 78 S2MPS11_IRQ_RTCA1,
28 S2MPS11_IRQ_RTCA2,
29 S2MPS11_IRQ_SMPL, 79 S2MPS11_IRQ_SMPL,
30 S2MPS11_IRQ_RTC1S, 80 S2MPS11_IRQ_RTC1S,
31 S2MPS11_IRQ_WTSR, 81 S2MPS11_IRQ_WTSR,
@@ -47,7 +97,7 @@ enum s2mps11_irq {
47 97
48#define S2MPS11_IRQ_RTC60S_MASK (1 << 0) 98#define S2MPS11_IRQ_RTC60S_MASK (1 << 0)
49#define S2MPS11_IRQ_RTCA1_MASK (1 << 1) 99#define S2MPS11_IRQ_RTCA1_MASK (1 << 1)
50#define S2MPS11_IRQ_RTCA2_MASK (1 << 2) 100#define S2MPS11_IRQ_RTCA0_MASK (1 << 2)
51#define S2MPS11_IRQ_SMPL_MASK (1 << 3) 101#define S2MPS11_IRQ_SMPL_MASK (1 << 3)
52#define S2MPS11_IRQ_RTC1S_MASK (1 << 4) 102#define S2MPS11_IRQ_RTC1S_MASK (1 << 4)
53#define S2MPS11_IRQ_WTSR_MASK (1 << 5) 103#define S2MPS11_IRQ_WTSR_MASK (1 << 5)
@@ -55,6 +105,33 @@ enum s2mps11_irq {
55#define S2MPS11_IRQ_INT120C_MASK (1 << 0) 105#define S2MPS11_IRQ_INT120C_MASK (1 << 0)
56#define S2MPS11_IRQ_INT140C_MASK (1 << 1) 106#define S2MPS11_IRQ_INT140C_MASK (1 << 1)
57 107
108enum s2mps14_irq {
109 S2MPS14_IRQ_PWRONF,
110 S2MPS14_IRQ_PWRONR,
111 S2MPS14_IRQ_JIGONBF,
112 S2MPS14_IRQ_JIGONBR,
113 S2MPS14_IRQ_ACOKBF,
114 S2MPS14_IRQ_ACOKBR,
115 S2MPS14_IRQ_PWRON1S,
116 S2MPS14_IRQ_MRB,
117
118 S2MPS14_IRQ_RTC60S,
119 S2MPS14_IRQ_RTCA1,
120 S2MPS14_IRQ_RTCA0,
121 S2MPS14_IRQ_SMPL,
122 S2MPS14_IRQ_RTC1S,
123 S2MPS14_IRQ_WTSR,
124
125 S2MPS14_IRQ_INT120C,
126 S2MPS14_IRQ_INT140C,
127 S2MPS14_IRQ_TSD,
128
129 S2MPS14_IRQ_NR,
130};
131
132/* Masks for interrupts are the same as in s2mps11 */
133#define S2MPS14_IRQ_TSD_MASK (1 << 2)
134
58enum s5m8767_irq { 135enum s5m8767_irq {
59 S5M8767_IRQ_PWRR, 136 S5M8767_IRQ_PWRR,
60 S5M8767_IRQ_PWRF, 137 S5M8767_IRQ_PWRF,
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h
index 94b7cd6d8891..3e02b768d537 100644
--- a/include/linux/mfd/samsung/rtc.h
+++ b/include/linux/mfd/samsung/rtc.h
@@ -1,12 +1,17 @@
1/* rtc.h 1/* rtc.h
2 * 2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd 3 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd
4 * http://www.samsung.com 4 * http://www.samsung.com
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 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 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 8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. 9 * 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.
10 * 15 *
11 */ 16 */
12 17
@@ -43,6 +48,39 @@ enum sec_rtc_reg {
43 SEC_RTC_STATUS, 48 SEC_RTC_STATUS,
44 SEC_WTSR_SMPL_CNTL, 49 SEC_WTSR_SMPL_CNTL,
45 SEC_RTC_UDR_CON, 50 SEC_RTC_UDR_CON,
51
52 SEC_RTC_REG_MAX,
53};
54
55enum s2mps_rtc_reg {
56 S2MPS_RTC_CTRL,
57 S2MPS_WTSR_SMPL_CNTL,
58 S2MPS_RTC_UDR_CON,
59 S2MPS_RSVD,
60 S2MPS_RTC_SEC,
61 S2MPS_RTC_MIN,
62 S2MPS_RTC_HOUR,
63 S2MPS_RTC_WEEKDAY,
64 S2MPS_RTC_DATE,
65 S2MPS_RTC_MONTH,
66 S2MPS_RTC_YEAR,
67 S2MPS_ALARM0_SEC,
68 S2MPS_ALARM0_MIN,
69 S2MPS_ALARM0_HOUR,
70 S2MPS_ALARM0_WEEKDAY,
71 S2MPS_ALARM0_DATE,
72 S2MPS_ALARM0_MONTH,
73 S2MPS_ALARM0_YEAR,
74 S2MPS_ALARM1_SEC,
75 S2MPS_ALARM1_MIN,
76 S2MPS_ALARM1_HOUR,
77 S2MPS_ALARM1_WEEKDAY,
78 S2MPS_ALARM1_DATE,
79 S2MPS_ALARM1_MONTH,
80 S2MPS_ALARM1_YEAR,
81 S2MPS_OFFSRC,
82
83 S2MPS_RTC_REG_MAX,
46}; 84};
47 85
48#define RTC_I2C_ADDR (0x0C >> 1) 86#define RTC_I2C_ADDR (0x0C >> 1)
@@ -54,6 +92,9 @@ enum sec_rtc_reg {
54#define ALARM1_STATUS (1 << 2) 92#define ALARM1_STATUS (1 << 2)
55#define UPDATE_AD (1 << 0) 93#define UPDATE_AD (1 << 0)
56 94
95#define S2MPS_ALARM0_STATUS (1 << 2)
96#define S2MPS_ALARM1_STATUS (1 << 1)
97
57/* RTC Control Register */ 98/* RTC Control Register */
58#define BCD_EN_SHIFT 0 99#define BCD_EN_SHIFT 0
59#define BCD_EN_MASK (1 << BCD_EN_SHIFT) 100#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
@@ -62,6 +103,10 @@ enum sec_rtc_reg {
62/* RTC Update Register1 */ 103/* RTC Update Register1 */
63#define RTC_UDR_SHIFT 0 104#define RTC_UDR_SHIFT 0
64#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT) 105#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
106#define S2MPS_RTC_WUDR_SHIFT 4
107#define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT)
108#define S2MPS_RTC_RUDR_SHIFT 0
109#define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT)
65#define RTC_TCON_SHIFT 1 110#define RTC_TCON_SHIFT 1
66#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT) 111#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
67#define RTC_TIME_EN_SHIFT 3 112#define RTC_TIME_EN_SHIFT 3
diff --git a/include/linux/mfd/samsung/s2mpa01.h b/include/linux/mfd/samsung/s2mpa01.h
new file mode 100644
index 000000000000..fbc63bc0d6a2
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mpa01.h
@@ -0,0 +1,192 @@
1/*
2 * Copyright (c) 2013 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
12#ifndef __LINUX_MFD_S2MPA01_H
13#define __LINUX_MFD_S2MPA01_H
14
15/* S2MPA01 registers */
16enum s2mpa01_reg {
17 S2MPA01_REG_ID,
18 S2MPA01_REG_INT1,
19 S2MPA01_REG_INT2,
20 S2MPA01_REG_INT3,
21 S2MPA01_REG_INT1M,
22 S2MPA01_REG_INT2M,
23 S2MPA01_REG_INT3M,
24 S2MPA01_REG_ST1,
25 S2MPA01_REG_ST2,
26 S2MPA01_REG_PWRONSRC,
27 S2MPA01_REG_OFFSRC,
28 S2MPA01_REG_RTC_BUF,
29 S2MPA01_REG_CTRL1,
30 S2MPA01_REG_ETC_TEST,
31 S2MPA01_REG_RSVD1,
32 S2MPA01_REG_BU_CHG,
33 S2MPA01_REG_RAMP1,
34 S2MPA01_REG_RAMP2,
35 S2MPA01_REG_LDO_DSCH1,
36 S2MPA01_REG_LDO_DSCH2,
37 S2MPA01_REG_LDO_DSCH3,
38 S2MPA01_REG_LDO_DSCH4,
39 S2MPA01_REG_OTP_ADRL,
40 S2MPA01_REG_OTP_ADRH,
41 S2MPA01_REG_OTP_DATA,
42 S2MPA01_REG_MON1SEL,
43 S2MPA01_REG_MON2SEL,
44 S2MPA01_REG_LEE,
45 S2MPA01_REG_RSVD2,
46 S2MPA01_REG_RSVD3,
47 S2MPA01_REG_RSVD4,
48 S2MPA01_REG_RSVD5,
49 S2MPA01_REG_RSVD6,
50 S2MPA01_REG_TOP_RSVD,
51 S2MPA01_REG_DVS_SEL,
52 S2MPA01_REG_DVS_PTR,
53 S2MPA01_REG_DVS_DATA,
54 S2MPA01_REG_RSVD_NO,
55 S2MPA01_REG_UVLO,
56 S2MPA01_REG_LEE_NO,
57 S2MPA01_REG_B1CTRL1,
58 S2MPA01_REG_B1CTRL2,
59 S2MPA01_REG_B2CTRL1,
60 S2MPA01_REG_B2CTRL2,
61 S2MPA01_REG_B3CTRL1,
62 S2MPA01_REG_B3CTRL2,
63 S2MPA01_REG_B4CTRL1,
64 S2MPA01_REG_B4CTRL2,
65 S2MPA01_REG_B5CTRL1,
66 S2MPA01_REG_B5CTRL2,
67 S2MPA01_REG_B5CTRL3,
68 S2MPA01_REG_B5CTRL4,
69 S2MPA01_REG_B5CTRL5,
70 S2MPA01_REG_B5CTRL6,
71 S2MPA01_REG_B6CTRL1,
72 S2MPA01_REG_B6CTRL2,
73 S2MPA01_REG_B7CTRL1,
74 S2MPA01_REG_B7CTRL2,
75 S2MPA01_REG_B8CTRL1,
76 S2MPA01_REG_B8CTRL2,
77 S2MPA01_REG_B9CTRL1,
78 S2MPA01_REG_B9CTRL2,
79 S2MPA01_REG_B10CTRL1,
80 S2MPA01_REG_B10CTRL2,
81 S2MPA01_REG_L1CTRL,
82 S2MPA01_REG_L2CTRL,
83 S2MPA01_REG_L3CTRL,
84 S2MPA01_REG_L4CTRL,
85 S2MPA01_REG_L5CTRL,
86 S2MPA01_REG_L6CTRL,
87 S2MPA01_REG_L7CTRL,
88 S2MPA01_REG_L8CTRL,
89 S2MPA01_REG_L9CTRL,
90 S2MPA01_REG_L10CTRL,
91 S2MPA01_REG_L11CTRL,
92 S2MPA01_REG_L12CTRL,
93 S2MPA01_REG_L13CTRL,
94 S2MPA01_REG_L14CTRL,
95 S2MPA01_REG_L15CTRL,
96 S2MPA01_REG_L16CTRL,
97 S2MPA01_REG_L17CTRL,
98 S2MPA01_REG_L18CTRL,
99 S2MPA01_REG_L19CTRL,
100 S2MPA01_REG_L20CTRL,
101 S2MPA01_REG_L21CTRL,
102 S2MPA01_REG_L22CTRL,
103 S2MPA01_REG_L23CTRL,
104 S2MPA01_REG_L24CTRL,
105 S2MPA01_REG_L25CTRL,
106 S2MPA01_REG_L26CTRL,
107
108 S2MPA01_REG_LDO_OVCB1,
109 S2MPA01_REG_LDO_OVCB2,
110 S2MPA01_REG_LDO_OVCB3,
111 S2MPA01_REG_LDO_OVCB4,
112
113};
114
115/* S2MPA01 regulator ids */
116enum s2mpa01_regulators {
117 S2MPA01_LDO1,
118 S2MPA01_LDO2,
119 S2MPA01_LDO3,
120 S2MPA01_LDO4,
121 S2MPA01_LDO5,
122 S2MPA01_LDO6,
123 S2MPA01_LDO7,
124 S2MPA01_LDO8,
125 S2MPA01_LDO9,
126 S2MPA01_LDO10,
127 S2MPA01_LDO11,
128 S2MPA01_LDO12,
129 S2MPA01_LDO13,
130 S2MPA01_LDO14,
131 S2MPA01_LDO15,
132 S2MPA01_LDO16,
133 S2MPA01_LDO17,
134 S2MPA01_LDO18,
135 S2MPA01_LDO19,
136 S2MPA01_LDO20,
137 S2MPA01_LDO21,
138 S2MPA01_LDO22,
139 S2MPA01_LDO23,
140 S2MPA01_LDO24,
141 S2MPA01_LDO25,
142 S2MPA01_LDO26,
143
144 S2MPA01_BUCK1,
145 S2MPA01_BUCK2,
146 S2MPA01_BUCK3,
147 S2MPA01_BUCK4,
148 S2MPA01_BUCK5,
149 S2MPA01_BUCK6,
150 S2MPA01_BUCK7,
151 S2MPA01_BUCK8,
152 S2MPA01_BUCK9,
153 S2MPA01_BUCK10,
154
155 S2MPA01_REGULATOR_MAX,
156};
157
158#define S2MPA01_BUCK_MIN1 600000
159#define S2MPA01_BUCK_MIN2 800000
160#define S2MPA01_BUCK_MIN3 1000000
161#define S2MPA01_BUCK_MIN4 1500000
162#define S2MPA01_LDO_MIN 800000
163
164#define S2MPA01_BUCK_STEP1 6250
165#define S2MPA01_BUCK_STEP2 12500
166
167#define S2MPA01_LDO_STEP1 50000
168#define S2MPA01_LDO_STEP2 25000
169
170#define S2MPA01_LDO_VSEL_MASK 0x3F
171#define S2MPA01_BUCK_VSEL_MASK 0xFF
172#define S2MPA01_ENABLE_MASK (0x03 << S2MPA01_ENABLE_SHIFT)
173#define S2MPA01_ENABLE_SHIFT 0x06
174#define S2MPA01_LDO_N_VOLTAGES (S2MPA01_LDO_VSEL_MASK + 1)
175#define S2MPA01_BUCK_N_VOLTAGES (S2MPA01_BUCK_VSEL_MASK + 1)
176
177#define S2MPA01_RAMP_DELAY 12500 /* uV/us */
178
179#define S2MPA01_BUCK16_RAMP_SHIFT 4
180#define S2MPA01_BUCK24_RAMP_SHIFT 6
181#define S2MPA01_BUCK3_RAMP_SHIFT 4
182#define S2MPA01_BUCK5_RAMP_SHIFT 6
183#define S2MPA01_BUCK7_RAMP_SHIFT 2
184#define S2MPA01_BUCK8910_RAMP_SHIFT 0
185
186#define S2MPA01_BUCK1_RAMP_EN_SHIFT 3
187#define S2MPA01_BUCK2_RAMP_EN_SHIFT 2
188#define S2MPA01_BUCK3_RAMP_EN_SHIFT 1
189#define S2MPA01_BUCK4_RAMP_EN_SHIFT 0
190#define S2MPA01_PMIC_EN_SHIFT 6
191
192#endif /*__LINUX_MFD_S2MPA01_H */
diff --git a/include/linux/mfd/samsung/s2mps14.h b/include/linux/mfd/samsung/s2mps14.h
new file mode 100644
index 000000000000..4b449b8ac548
--- /dev/null
+++ b/include/linux/mfd/samsung/s2mps14.h
@@ -0,0 +1,154 @@
1/*
2 * s2mps14.h
3 *
4 * Copyright (c) 2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * 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 __LINUX_MFD_S2MPS14_H
20#define __LINUX_MFD_S2MPS14_H
21
22/* S2MPS14 registers */
23enum s2mps14_reg {
24 S2MPS14_REG_ID,
25 S2MPS14_REG_INT1,
26 S2MPS14_REG_INT2,
27 S2MPS14_REG_INT3,
28 S2MPS14_REG_INT1M,
29 S2MPS14_REG_INT2M,
30 S2MPS14_REG_INT3M,
31 S2MPS14_REG_ST1,
32 S2MPS14_REG_ST2,
33 S2MPS14_REG_PWRONSRC,
34 S2MPS14_REG_OFFSRC,
35 S2MPS14_REG_BU_CHG,
36 S2MPS14_REG_RTCCTRL,
37 S2MPS14_REG_CTRL1,
38 S2MPS14_REG_CTRL2,
39 S2MPS14_REG_RSVD1,
40 S2MPS14_REG_RSVD2,
41 S2MPS14_REG_RSVD3,
42 S2MPS14_REG_RSVD4,
43 S2MPS14_REG_RSVD5,
44 S2MPS14_REG_RSVD6,
45 S2MPS14_REG_CTRL3,
46 S2MPS14_REG_RSVD7,
47 S2MPS14_REG_RSVD8,
48 S2MPS14_REG_WRSTBI,
49 S2MPS14_REG_B1CTRL1,
50 S2MPS14_REG_B1CTRL2,
51 S2MPS14_REG_B2CTRL1,
52 S2MPS14_REG_B2CTRL2,
53 S2MPS14_REG_B3CTRL1,
54 S2MPS14_REG_B3CTRL2,
55 S2MPS14_REG_B4CTRL1,
56 S2MPS14_REG_B4CTRL2,
57 S2MPS14_REG_B5CTRL1,
58 S2MPS14_REG_B5CTRL2,
59 S2MPS14_REG_L1CTRL,
60 S2MPS14_REG_L2CTRL,
61 S2MPS14_REG_L3CTRL,
62 S2MPS14_REG_L4CTRL,
63 S2MPS14_REG_L5CTRL,
64 S2MPS14_REG_L6CTRL,
65 S2MPS14_REG_L7CTRL,
66 S2MPS14_REG_L8CTRL,
67 S2MPS14_REG_L9CTRL,
68 S2MPS14_REG_L10CTRL,
69 S2MPS14_REG_L11CTRL,
70 S2MPS14_REG_L12CTRL,
71 S2MPS14_REG_L13CTRL,
72 S2MPS14_REG_L14CTRL,
73 S2MPS14_REG_L15CTRL,
74 S2MPS14_REG_L16CTRL,
75 S2MPS14_REG_L17CTRL,
76 S2MPS14_REG_L18CTRL,
77 S2MPS14_REG_L19CTRL,
78 S2MPS14_REG_L20CTRL,
79 S2MPS14_REG_L21CTRL,
80 S2MPS14_REG_L22CTRL,
81 S2MPS14_REG_L23CTRL,
82 S2MPS14_REG_L24CTRL,
83 S2MPS14_REG_L25CTRL,
84 S2MPS14_REG_LDODSCH1,
85 S2MPS14_REG_LDODSCH2,
86 S2MPS14_REG_LDODSCH3,
87};
88
89/* S2MPS14 regulator ids */
90enum s2mps14_regulators {
91 S2MPS14_LDO1,
92 S2MPS14_LDO2,
93 S2MPS14_LDO3,
94 S2MPS14_LDO4,
95 S2MPS14_LDO5,
96 S2MPS14_LDO6,
97 S2MPS14_LDO7,
98 S2MPS14_LDO8,
99 S2MPS14_LDO9,
100 S2MPS14_LDO10,
101 S2MPS14_LDO11,
102 S2MPS14_LDO12,
103 S2MPS14_LDO13,
104 S2MPS14_LDO14,
105 S2MPS14_LDO15,
106 S2MPS14_LDO16,
107 S2MPS14_LDO17,
108 S2MPS14_LDO18,
109 S2MPS14_LDO19,
110 S2MPS14_LDO20,
111 S2MPS14_LDO21,
112 S2MPS14_LDO22,
113 S2MPS14_LDO23,
114 S2MPS14_LDO24,
115 S2MPS14_LDO25,
116 S2MPS14_BUCK1,
117 S2MPS14_BUCK2,
118 S2MPS14_BUCK3,
119 S2MPS14_BUCK4,
120 S2MPS14_BUCK5,
121
122 S2MPS14_REGULATOR_MAX,
123};
124
125/* Regulator constraints for BUCKx */
126#define S2MPS14_BUCK1235_MIN_600MV 600000
127#define S2MPS14_BUCK4_MIN_1400MV 1400000
128#define S2MPS14_BUCK1235_STEP_6_25MV 6250
129#define S2MPS14_BUCK4_STEP_12_5MV 12500
130#define S2MPS14_BUCK1235_START_SEL 0x20
131#define S2MPS14_BUCK4_START_SEL 0x40
132/*
133 * Default ramp delay in uv/us. Datasheet says that ramp delay can be
134 * controlled however it does not specify which register is used for that.
135 * Let's assume that default value will be set.
136 */
137#define S2MPS14_BUCK_RAMP_DELAY 12500
138
139/* Regulator constraints for different types of LDOx */
140#define S2MPS14_LDO_MIN_800MV 800000
141#define S2MPS14_LDO_MIN_1800MV 1800000
142#define S2MPS14_LDO_STEP_12_5MV 12500
143#define S2MPS14_LDO_STEP_25MV 25000
144
145#define S2MPS14_LDO_VSEL_MASK 0x3F
146#define S2MPS14_BUCK_VSEL_MASK 0xFF
147#define S2MPS14_ENABLE_MASK (0x03 << S2MPS14_ENABLE_SHIFT)
148#define S2MPS14_ENABLE_SHIFT 6
149/* On/Off controlled by PWREN */
150#define S2MPS14_ENABLE_SUSPEND (0x01 << S2MPS14_ENABLE_SHIFT)
151#define S2MPS14_LDO_N_VOLTAGES (S2MPS14_LDO_VSEL_MASK + 1)
152#define S2MPS14_BUCK_N_VOLTAGES (S2MPS14_BUCK_VSEL_MASK + 1)
153
154#endif /* __LINUX_MFD_S2MPS14_H */
diff --git a/include/linux/mfd/samsung/s5m8767.h b/include/linux/mfd/samsung/s5m8767.h
index 2ab0b0f03641..243b58fec33d 100644
--- a/include/linux/mfd/samsung/s5m8767.h
+++ b/include/linux/mfd/samsung/s5m8767.h
@@ -183,10 +183,17 @@ enum s5m8767_regulators {
183 S5M8767_REG_MAX, 183 S5M8767_REG_MAX,
184}; 184};
185 185
186/* LDO_EN/BUCK_EN field in registers */
186#define S5M8767_ENCTRL_SHIFT 6 187#define S5M8767_ENCTRL_SHIFT 6
187#define S5M8767_ENCTRL_MASK (0x3 << S5M8767_ENCTRL_SHIFT) 188#define S5M8767_ENCTRL_MASK (0x3 << S5M8767_ENCTRL_SHIFT)
188 189
189/* 190/*
191 * LDO_EN/BUCK_EN register value for controlling this Buck or LDO
192 * by GPIO (PWREN, BUCKEN).
193 */
194#define S5M8767_ENCTRL_USE_GPIO 0x1
195
196/*
190 * Values for BUCK_RAMP field in DVS_RAMP register, matching raw values 197 * Values for BUCK_RAMP field in DVS_RAMP register, matching raw values
191 * in mV/us. 198 * in mV/us.
192 */ 199 */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index 866e355fa409..ff44374a1a4e 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -242,6 +242,24 @@
242 242
243#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) 243#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
244 244
245#define IMX6Q_GPR6_IPU1_ID00_WR_QOS_MASK (0xf << 0)
246#define IMX6Q_GPR6_IPU1_ID01_WR_QOS_MASK (0xf << 4)
247#define IMX6Q_GPR6_IPU1_ID10_WR_QOS_MASK (0xf << 8)
248#define IMX6Q_GPR6_IPU1_ID11_WR_QOS_MASK (0xf << 12)
249#define IMX6Q_GPR6_IPU1_ID00_RD_QOS_MASK (0xf << 16)
250#define IMX6Q_GPR6_IPU1_ID01_RD_QOS_MASK (0xf << 20)
251#define IMX6Q_GPR6_IPU1_ID10_RD_QOS_MASK (0xf << 24)
252#define IMX6Q_GPR6_IPU1_ID11_RD_QOS_MASK (0xf << 28)
253
254#define IMX6Q_GPR7_IPU2_ID00_WR_QOS_MASK (0xf << 0)
255#define IMX6Q_GPR7_IPU2_ID01_WR_QOS_MASK (0xf << 4)
256#define IMX6Q_GPR7_IPU2_ID10_WR_QOS_MASK (0xf << 8)
257#define IMX6Q_GPR7_IPU2_ID11_WR_QOS_MASK (0xf << 12)
258#define IMX6Q_GPR7_IPU2_ID00_RD_QOS_MASK (0xf << 16)
259#define IMX6Q_GPR7_IPU2_ID01_RD_QOS_MASK (0xf << 20)
260#define IMX6Q_GPR7_IPU2_ID10_RD_QOS_MASK (0xf << 24)
261#define IMX6Q_GPR7_IPU2_ID11_RD_QOS_MASK (0xf << 28)
262
245#define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25) 263#define IMX6Q_GPR8_TX_SWING_LOW (0x7f << 25)
246#define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18) 264#define IMX6Q_GPR8_TX_SWING_FULL (0x7f << 18)
247#define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12) 265#define IMX6Q_GPR8_TX_DEEMPH_GEN2_6DB (0x3f << 12)
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
new file mode 100644
index 000000000000..d2e357df5a0e
--- /dev/null
+++ b/include/linux/mfd/tps65218.h
@@ -0,0 +1,284 @@
1/*
2 * linux/mfd/tps65218.h
3 *
4 * Functions to access TPS65219 power management chip.
5 *
6 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
13 * kind, whether expressed or implied; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License version 2 for more details.
16 */
17
18#ifndef __LINUX_MFD_TPS65218_H
19#define __LINUX_MFD_TPS65218_H
20
21#include <linux/i2c.h>
22#include <linux/regulator/driver.h>
23#include <linux/regulator/machine.h>
24#include <linux/bitops.h>
25
26/* TPS chip id list */
27#define TPS65218 0xF0
28
29/* I2C ID for TPS65218 part */
30#define TPS65218_I2C_ID 0x24
31
32/* All register addresses */
33#define TPS65218_REG_CHIPID 0x00
34#define TPS65218_REG_INT1 0x01
35#define TPS65218_REG_INT2 0x02
36#define TPS65218_REG_INT_MASK1 0x03
37#define TPS65218_REG_INT_MASK2 0x04
38#define TPS65218_REG_STATUS 0x05
39#define TPS65218_REG_CONTROL 0x06
40#define TPS65218_REG_FLAG 0x07
41
42#define TPS65218_REG_PASSWORD 0x10
43#define TPS65218_REG_ENABLE1 0x11
44#define TPS65218_REG_ENABLE2 0x12
45#define TPS65218_REG_CONFIG1 0x13
46#define TPS65218_REG_CONFIG2 0x14
47#define TPS65218_REG_CONFIG3 0x15
48#define TPS65218_REG_CONTROL_DCDC1 0x16
49#define TPS65218_REG_CONTROL_DCDC2 0x17
50#define TPS65218_REG_CONTROL_DCDC3 0x18
51#define TPS65218_REG_CONTROL_DCDC4 0x19
52#define TPS65218_REG_CONTRL_SLEW_RATE 0x1A
53#define TPS65218_REG_CONTROL_LDO1 0x1B
54#define TPS65218_REG_SEQ1 0x20
55#define TPS65218_REG_SEQ2 0x21
56#define TPS65218_REG_SEQ3 0x22
57#define TPS65218_REG_SEQ4 0x23
58#define TPS65218_REG_SEQ5 0x24
59#define TPS65218_REG_SEQ6 0x25
60#define TPS65218_REG_SEQ7 0x26
61
62/* Register field definitions */
63#define TPS65218_CHIPID_CHIP_MASK 0xF8
64#define TPS65218_CHIPID_REV_MASK 0x07
65
66#define TPS65218_INT1_VPRG BIT(5)
67#define TPS65218_INT1_AC BIT(4)
68#define TPS65218_INT1_PB BIT(3)
69#define TPS65218_INT1_HOT BIT(2)
70#define TPS65218_INT1_CC_AQC BIT(1)
71#define TPS65218_INT1_PRGC BIT(0)
72
73#define TPS65218_INT2_LS3_F BIT(5)
74#define TPS65218_INT2_LS2_F BIT(4)
75#define TPS65218_INT2_LS1_F BIT(3)
76#define TPS65218_INT2_LS3_I BIT(2)
77#define TPS65218_INT2_LS2_I BIT(1)
78#define TPS65218_INT2_LS1_I BIT(0)
79
80#define TPS65218_INT_MASK1_VPRG BIT(5)
81#define TPS65218_INT_MASK1_AC BIT(4)
82#define TPS65218_INT_MASK1_PB BIT(3)
83#define TPS65218_INT_MASK1_HOT BIT(2)
84#define TPS65218_INT_MASK1_CC_AQC BIT(1)
85#define TPS65218_INT_MASK1_PRGC BIT(0)
86
87#define TPS65218_INT_MASK2_LS3_F BIT(5)
88#define TPS65218_INT_MASK2_LS2_F BIT(4)
89#define TPS65218_INT_MASK2_LS1_F BIT(3)
90#define TPS65218_INT_MASK2_LS3_I BIT(2)
91#define TPS65218_INT_MASK2_LS2_I BIT(1)
92#define TPS65218_INT_MASK2_LS1_I BIT(0)
93
94#define TPS65218_STATUS_FSEAL BIT(7)
95#define TPS65218_STATUS_EE BIT(6)
96#define TPS65218_STATUS_AC_STATE BIT(5)
97#define TPS65218_STATUS_PB_STATE BIT(4)
98#define TPS65218_STATUS_STATE_MASK 0xC
99#define TPS65218_STATUS_CC_STAT 0x3
100
101#define TPS65218_CONTROL_OFFNPFO BIT(1)
102#define TPS65218_CONTROL_CC_AQ BIT(0)
103
104#define TPS65218_FLAG_GPO3_FLG BIT(7)
105#define TPS65218_FLAG_GPO2_FLG BIT(6)
106#define TPS65218_FLAG_GPO1_FLG BIT(5)
107#define TPS65218_FLAG_LDO1_FLG BIT(4)
108#define TPS65218_FLAG_DC4_FLG BIT(3)
109#define TPS65218_FLAG_DC3_FLG BIT(2)
110#define TPS65218_FLAG_DC2_FLG BIT(1)
111#define TPS65218_FLAG_DC1_FLG BIT(0)
112
113#define TPS65218_ENABLE1_DC6_EN BIT(5)
114#define TPS65218_ENABLE1_DC5_EN BIT(4)
115#define TPS65218_ENABLE1_DC4_EN BIT(3)
116#define TPS65218_ENABLE1_DC3_EN BIT(2)
117#define TPS65218_ENABLE1_DC2_EN BIT(1)
118#define TPS65218_ENABLE1_DC1_EN BIT(0)
119
120#define TPS65218_ENABLE2_GPIO3 BIT(6)
121#define TPS65218_ENABLE2_GPIO2 BIT(5)
122#define TPS65218_ENABLE2_GPIO1 BIT(4)
123#define TPS65218_ENABLE2_LS3_EN BIT(3)
124#define TPS65218_ENABLE2_LS2_EN BIT(2)
125#define TPS65218_ENABLE2_LS1_EN BIT(1)
126#define TPS65218_ENABLE2_LDO1_EN BIT(0)
127
128
129#define TPS65218_CONFIG1_TRST BIT(7)
130#define TPS65218_CONFIG1_GPO2_BUF BIT(6)
131#define TPS65218_CONFIG1_IO1_SEL BIT(5)
132#define TPS65218_CONFIG1_PGDLY_MASK 0x18
133#define TPS65218_CONFIG1_STRICT BIT(2)
134#define TPS65218_CONFIG1_UVLO_MASK 0x3
135
136#define TPS65218_CONFIG2_DC12_RST BIT(7)
137#define TPS65218_CONFIG2_UVLOHYS BIT(6)
138#define TPS65218_CONFIG2_LS3ILIM_MASK 0xC
139#define TPS65218_CONFIG2_LS2ILIM_MASK 0x3
140
141#define TPS65218_CONFIG3_LS3NPFO BIT(5)
142#define TPS65218_CONFIG3_LS2NPFO BIT(4)
143#define TPS65218_CONFIG3_LS1NPFO BIT(3)
144#define TPS65218_CONFIG3_LS3DCHRG BIT(2)
145#define TPS65218_CONFIG3_LS2DCHRG BIT(1)
146#define TPS65218_CONFIG3_LS1DCHRG BIT(0)
147
148#define TPS65218_CONTROL_DCDC1_PFM BIT(7)
149#define TPS65218_CONTROL_DCDC1_MASK 0x7F
150
151#define TPS65218_CONTROL_DCDC2_PFM BIT(7)
152#define TPS65218_CONTROL_DCDC2_MASK 0x3F
153
154#define TPS65218_CONTROL_DCDC3_PFM BIT(7)
155#define TPS65218_CONTROL_DCDC3_MASK 0x3F
156
157#define TPS65218_CONTROL_DCDC4_PFM BIT(7)
158#define TPS65218_CONTROL_DCDC4_MASK 0x3F
159
160#define TPS65218_SLEW_RATE_GO BIT(7)
161#define TPS65218_SLEW_RATE_GODSBL BIT(6)
162#define TPS65218_SLEW_RATE_SLEW_MASK 0x7
163
164#define TPS65218_CONTROL_LDO1_MASK 0x3F
165
166#define TPS65218_SEQ1_DLY8 BIT(7)
167#define TPS65218_SEQ1_DLY7 BIT(6)
168#define TPS65218_SEQ1_DLY6 BIT(5)
169#define TPS65218_SEQ1_DLY5 BIT(4)
170#define TPS65218_SEQ1_DLY4 BIT(3)
171#define TPS65218_SEQ1_DLY3 BIT(2)
172#define TPS65218_SEQ1_DLY2 BIT(1)
173#define TPS65218_SEQ1_DLY1 BIT(0)
174
175#define TPS65218_SEQ2_DLYFCTR BIT(7)
176#define TPS65218_SEQ2_DLY9 BIT(0)
177
178#define TPS65218_SEQ3_DC2_SEQ_MASK 0xF0
179#define TPS65218_SEQ3_DC1_SEQ_MASK 0xF
180
181#define TPS65218_SEQ4_DC4_SEQ_MASK 0xF0
182#define TPS65218_SEQ4_DC3_SEQ_MASK 0xF
183
184#define TPS65218_SEQ5_DC6_SEQ_MASK 0xF0
185#define TPS65218_SEQ5_DC5_SEQ_MASK 0xF
186
187#define TPS65218_SEQ6_LS1_SEQ_MASK 0xF0
188#define TPS65218_SEQ6_LDO1_SEQ_MASK 0xF
189
190#define TPS65218_SEQ7_GPO3_SEQ_MASK 0xF0
191#define TPS65218_SEQ7_GPO1_SEQ_MASK 0xF
192#define TPS65218_PROTECT_NONE 0
193#define TPS65218_PROTECT_L1 1
194
195enum tps65218_regulator_id {
196 /* DCDC's */
197 TPS65218_DCDC_1,
198 TPS65218_DCDC_2,
199 TPS65218_DCDC_3,
200 TPS65218_DCDC_4,
201 TPS65218_DCDC_5,
202 TPS65218_DCDC_6,
203 /* LDOs */
204 TPS65218_LDO_1,
205};
206
207#define TPS65218_MAX_REG_ID TPS65218_LDO_1
208
209/* Number of step-down converters available */
210#define TPS65218_NUM_DCDC 6
211/* Number of LDO voltage regulators available */
212#define TPS65218_NUM_LDO 1
213/* Number of total regulators available */
214#define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO)
215
216/* Define the TPS65218 IRQ numbers */
217enum tps65218_irqs {
218 /* INT1 registers */
219 TPS65218_PRGC_IRQ,
220 TPS65218_CC_AQC_IRQ,
221 TPS65218_HOT_IRQ,
222 TPS65218_PB_IRQ,
223 TPS65218_AC_IRQ,
224 TPS65218_VPRG_IRQ,
225 TPS65218_INVALID1_IRQ,
226 TPS65218_INVALID2_IRQ,
227 /* INT2 registers */
228 TPS65218_LS1_I_IRQ,
229 TPS65218_LS2_I_IRQ,
230 TPS65218_LS3_I_IRQ,
231 TPS65218_LS1_F_IRQ,
232 TPS65218_LS2_F_IRQ,
233 TPS65218_LS3_F_IRQ,
234 TPS65218_INVALID3_IRQ,
235 TPS65218_INVALID4_IRQ,
236};
237
238/**
239 * struct tps_info - packages regulator constraints
240 * @id: Id of the regulator
241 * @name: Voltage regulator name
242 * @min_uV: minimum micro volts
243 * @max_uV: minimum micro volts
244 *
245 * This data is used to check the regualtor voltage limits while setting.
246 */
247struct tps_info {
248 int id;
249 const char *name;
250 int min_uV;
251 int max_uV;
252};
253
254/**
255 * struct tps65218 - tps65218 sub-driver chip access routines
256 *
257 * Device data may be used to access the TPS65218 chip
258 */
259
260struct tps65218 {
261 struct device *dev;
262 unsigned int id;
263
264 struct mutex tps_lock; /* lock guarding the data structure */
265 /* IRQ Data */
266 int irq;
267 u32 irq_mask;
268 struct regmap_irq_chip_data *irq_data;
269 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
270 struct regulator_dev *rdev[TPS65218_NUM_REGULATOR];
271 struct tps_info *info[TPS65218_NUM_REGULATOR];
272 struct regmap *regmap;
273};
274
275int tps65218_reg_read(struct tps65218 *tps, unsigned int reg,
276 unsigned int *val);
277int tps65218_reg_write(struct tps65218 *tps, unsigned int reg,
278 unsigned int val, unsigned int level);
279int tps65218_set_bits(struct tps65218 *tps, unsigned int reg,
280 unsigned int mask, unsigned int val, unsigned int level);
281int tps65218_clear_bits(struct tps65218 *tps, unsigned int reg,
282 unsigned int mask, unsigned int level);
283
284#endif /* __LINUX_MFD_TPS65218_H */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 3737f7218f51..51e26f3cd3b3 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -11,23 +11,24 @@
11 */ 11 */
12 12
13#define PSMOUSE_MINOR 1 13#define PSMOUSE_MINOR 1
14#define MS_BUSMOUSE_MINOR 2 14#define MS_BUSMOUSE_MINOR 2 /* unused */
15#define ATIXL_BUSMOUSE_MINOR 3 15#define ATIXL_BUSMOUSE_MINOR 3 /* unused */
16/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */ 16/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
17#define ATARIMOUSE_MINOR 5 17#define ATARIMOUSE_MINOR 5 /* unused */
18#define SUN_MOUSE_MINOR 6 18#define SUN_MOUSE_MINOR 6 /* unused */
19#define APOLLO_MOUSE_MINOR 7 19#define APOLLO_MOUSE_MINOR 7 /* unused */
20#define PC110PAD_MINOR 9 20#define PC110PAD_MINOR 9 /* unused */
21/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ 21/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
22#define WATCHDOG_MINOR 130 /* Watchdog timer */ 22#define WATCHDOG_MINOR 130 /* Watchdog timer */
23#define TEMP_MINOR 131 /* Temperature Sensor */ 23#define TEMP_MINOR 131 /* Temperature Sensor */
24#define RTC_MINOR 135 24#define RTC_MINOR 135
25#define EFI_RTC_MINOR 136 /* EFI Time services */ 25#define EFI_RTC_MINOR 136 /* EFI Time services */
26#define VHCI_MINOR 137
26#define SUN_OPENPROM_MINOR 139 27#define SUN_OPENPROM_MINOR 139
27#define DMAPI_MINOR 140 /* DMAPI */ 28#define DMAPI_MINOR 140 /* unused */
28#define NVRAM_MINOR 144 29#define NVRAM_MINOR 144
29#define SGI_MMTIMER 153 30#define SGI_MMTIMER 153
30#define STORE_QUEUE_MINOR 155 31#define STORE_QUEUE_MINOR 155 /* unused */
31#define I2O_MINOR 166 32#define I2O_MINOR 166
32#define MICROCODE_MINOR 184 33#define MICROCODE_MINOR 184
33#define VFIO_MINOR 196 34#define VFIO_MINOR 196
diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h
index 79a347238168..c8450366c130 100644
--- a/include/linux/mlx4/cmd.h
+++ b/include/linux/mlx4/cmd.h
@@ -125,6 +125,7 @@ enum {
125 /* miscellaneous commands */ 125 /* miscellaneous commands */
126 MLX4_CMD_DIAG_RPRT = 0x30, 126 MLX4_CMD_DIAG_RPRT = 0x30,
127 MLX4_CMD_NOP = 0x31, 127 MLX4_CMD_NOP = 0x31,
128 MLX4_CMD_CONFIG_DEV = 0x3a,
128 MLX4_CMD_ACCESS_MEM = 0x2e, 129 MLX4_CMD_ACCESS_MEM = 0x2e,
129 MLX4_CMD_SET_VEP = 0x52, 130 MLX4_CMD_SET_VEP = 0x52,
130 131
@@ -240,6 +241,13 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos);
240int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); 241int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting);
241int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); 242int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf);
242int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state); 243int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_state);
244/*
245 * mlx4_get_slave_default_vlan -
246 * return true if VST ( default vlan)
247 * if VST, will return vlan & qos (if not NULL)
248 */
249bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave,
250 u16 *vlan, u8 *qos);
243 251
244#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) 252#define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8)
245 253
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 5edd2c68274d..ba87bd21295a 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -48,6 +48,9 @@
48#define MSIX_LEGACY_SZ 4 48#define MSIX_LEGACY_SZ 4
49#define MIN_MSIX_P_PORT 5 49#define MIN_MSIX_P_PORT 5
50 50
51#define MLX4_ROCE_MAX_GIDS 128
52#define MLX4_ROCE_PF_GIDS 16
53
51enum { 54enum {
52 MLX4_FLAG_MSI_X = 1 << 0, 55 MLX4_FLAG_MSI_X = 1 << 0,
53 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1, 56 MLX4_FLAG_OLD_PORT_CMDS = 1 << 1,
@@ -81,6 +84,7 @@ enum {
81enum { 84enum {
82 MLX4_MAX_NUM_PF = 16, 85 MLX4_MAX_NUM_PF = 16,
83 MLX4_MAX_NUM_VF = 64, 86 MLX4_MAX_NUM_VF = 64,
87 MLX4_MAX_NUM_VF_P_PORT = 64,
84 MLX4_MFUNC_MAX = 80, 88 MLX4_MFUNC_MAX = 80,
85 MLX4_MAX_EQ_NUM = 1024, 89 MLX4_MAX_EQ_NUM = 1024,
86 MLX4_MFUNC_EQ_NUM = 4, 90 MLX4_MFUNC_EQ_NUM = 4,
@@ -629,7 +633,8 @@ struct mlx4_eth_av {
629 u8 hop_limit; 633 u8 hop_limit;
630 __be32 sl_tclass_flowlabel; 634 __be32 sl_tclass_flowlabel;
631 u8 dgid[16]; 635 u8 dgid[16];
632 u32 reserved4[2]; 636 u8 s_mac[6];
637 u8 reserved4[2];
633 __be16 vlan; 638 __be16 vlan;
634 u8 mac[ETH_ALEN]; 639 u8 mac[ETH_ALEN];
635}; 640};
@@ -660,6 +665,11 @@ struct mlx4_quotas {
660 int xrcd; 665 int xrcd;
661}; 666};
662 667
668struct mlx4_vf_dev {
669 u8 min_port;
670 u8 n_ports;
671};
672
663struct mlx4_dev { 673struct mlx4_dev {
664 struct pci_dev *pdev; 674 struct pci_dev *pdev;
665 unsigned long flags; 675 unsigned long flags;
@@ -675,6 +685,7 @@ struct mlx4_dev {
675 int oper_log_mgm_entry_size; 685 int oper_log_mgm_entry_size;
676 u64 regid_promisc_array[MLX4_MAX_PORTS + 1]; 686 u64 regid_promisc_array[MLX4_MAX_PORTS + 1];
677 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1]; 687 u64 regid_allmulti_array[MLX4_MAX_PORTS + 1];
688 struct mlx4_vf_dev *dev_vfs;
678}; 689};
679 690
680struct mlx4_eqe { 691struct mlx4_eqe {
@@ -1131,7 +1142,7 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
1131int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc); 1142int mlx4_SET_PORT_PRIO2TC(struct mlx4_dev *dev, u8 port, u8 *prio2tc);
1132int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw, 1143int mlx4_SET_PORT_SCHEDULER(struct mlx4_dev *dev, u8 port, u8 *tc_tx_bw,
1133 u8 *pg, u16 *ratelimit); 1144 u8 *pg, u16 *ratelimit);
1134int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering); 1145int mlx4_SET_PORT_VXLAN(struct mlx4_dev *dev, u8 port, u8 steering, int enable);
1135int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx); 1146int mlx4_find_cached_mac(struct mlx4_dev *dev, u8 port, u64 mac, int *idx);
1136int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx); 1147int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx);
1137int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index); 1148int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index);
@@ -1183,9 +1194,44 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int
1183void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid); 1194void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);
1184__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); 1195__be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave);
1185 1196
1197int mlx4_get_slave_from_roce_gid(struct mlx4_dev *dev, int port, u8 *gid,
1198 int *slave_id);
1199int mlx4_get_roce_gid_from_slave(struct mlx4_dev *dev, int port, int slave_id,
1200 u8 *gid);
1201
1186int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, 1202int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn,
1187 u32 max_range_qpn); 1203 u32 max_range_qpn);
1188 1204
1189cycle_t mlx4_read_clock(struct mlx4_dev *dev); 1205cycle_t mlx4_read_clock(struct mlx4_dev *dev);
1190 1206
1207struct mlx4_active_ports {
1208 DECLARE_BITMAP(ports, MLX4_MAX_PORTS);
1209};
1210/* Returns a bitmap of the physical ports which are assigned to slave */
1211struct mlx4_active_ports mlx4_get_active_ports(struct mlx4_dev *dev, int slave);
1212
1213/* Returns the physical port that represents the virtual port of the slave, */
1214/* or a value < 0 in case of an error. If a slave has 2 ports, the identity */
1215/* mapping is returned. */
1216int mlx4_slave_convert_port(struct mlx4_dev *dev, int slave, int port);
1217
1218struct mlx4_slaves_pport {
1219 DECLARE_BITMAP(slaves, MLX4_MFUNC_MAX);
1220};
1221/* Returns a bitmap of all slaves that are assigned to port. */
1222struct mlx4_slaves_pport mlx4_phys_to_slaves_pport(struct mlx4_dev *dev,
1223 int port);
1224
1225/* Returns a bitmap of all slaves that are assigned exactly to all the */
1226/* the ports that are set in crit_ports. */
1227struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv(
1228 struct mlx4_dev *dev,
1229 const struct mlx4_active_ports *crit_ports);
1230
1231/* Returns the slave's virtual port that represents the physical port. */
1232int mlx4_phys_to_slave_port(struct mlx4_dev *dev, int slave, int port);
1233
1234int mlx4_get_base_gid_ix(struct mlx4_dev *dev, int slave, int port);
1235
1236int mlx4_config_vxlan_port(struct mlx4_dev *dev, __be16 udp_port);
1191#endif /* MLX4_DEVICE_H */ 1237#endif /* MLX4_DEVICE_H */
diff --git a/include/linux/mlx4/driver.h b/include/linux/mlx4/driver.h
index c257e1b211be..022055c8fb26 100644
--- a/include/linux/mlx4/driver.h
+++ b/include/linux/mlx4/driver.h
@@ -64,4 +64,16 @@ void mlx4_unregister_interface(struct mlx4_interface *intf);
64 64
65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port); 65void *mlx4_get_protocol_dev(struct mlx4_dev *dev, enum mlx4_protocol proto, int port);
66 66
67static inline u64 mlx4_mac_to_u64(u8 *addr)
68{
69 u64 mac = 0;
70 int i;
71
72 for (i = 0; i < ETH_ALEN; i++) {
73 mac <<= 8;
74 mac |= addr[i];
75 }
76 return mac;
77}
78
67#endif /* MLX4_DRIVER_H */ 79#endif /* MLX4_DRIVER_H */
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index 59f8ba84568b..b66e7610d4ee 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -270,9 +270,14 @@ enum {
270 270
271struct mlx4_wqe_ctrl_seg { 271struct mlx4_wqe_ctrl_seg {
272 __be32 owner_opcode; 272 __be32 owner_opcode;
273 __be16 vlan_tag; 273 union {
274 u8 ins_vlan; 274 struct {
275 u8 fence_size; 275 __be16 vlan_tag;
276 u8 ins_vlan;
277 u8 fence_size;
278 };
279 __be32 bf_qpn;
280 };
276 /* 281 /*
277 * High 24 bits are SRC remote buffer; low 8 bits are flags: 282 * High 24 bits are SRC remote buffer; low 8 bits are flags:
278 * [7] SO (strong ordering) 283 * [7] SO (strong ordering)
diff --git a/include/linux/mlx5/cq.h b/include/linux/mlx5/cq.h
index 2202c7f72b75..f6b17ac601bd 100644
--- a/include/linux/mlx5/cq.h
+++ b/include/linux/mlx5/cq.h
@@ -80,6 +80,7 @@ enum {
80 MLX5_CQE_RESP_SEND_IMM = 3, 80 MLX5_CQE_RESP_SEND_IMM = 3,
81 MLX5_CQE_RESP_SEND_INV = 4, 81 MLX5_CQE_RESP_SEND_INV = 4,
82 MLX5_CQE_RESIZE_CQ = 5, 82 MLX5_CQE_RESIZE_CQ = 5,
83 MLX5_CQE_SIG_ERR = 12,
83 MLX5_CQE_REQ_ERR = 13, 84 MLX5_CQE_REQ_ERR = 13,
84 MLX5_CQE_RESP_ERR = 14, 85 MLX5_CQE_RESP_ERR = 14,
85 MLX5_CQE_INVALID = 15, 86 MLX5_CQE_INVALID = 15,
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 817a6fae6d2c..407bdb67fd4f 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -48,6 +48,8 @@ enum {
48 MLX5_MAX_COMMANDS = 32, 48 MLX5_MAX_COMMANDS = 32,
49 MLX5_CMD_DATA_BLOCK_SIZE = 512, 49 MLX5_CMD_DATA_BLOCK_SIZE = 512,
50 MLX5_PCI_CMD_XPORT = 7, 50 MLX5_PCI_CMD_XPORT = 7,
51 MLX5_MKEY_BSF_OCTO_SIZE = 4,
52 MLX5_MAX_PSVS = 4,
51}; 53};
52 54
53enum { 55enum {
@@ -116,6 +118,7 @@ enum {
116 MLX5_MKEY_MASK_START_ADDR = 1ull << 6, 118 MLX5_MKEY_MASK_START_ADDR = 1ull << 6,
117 MLX5_MKEY_MASK_PD = 1ull << 7, 119 MLX5_MKEY_MASK_PD = 1ull << 7,
118 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8, 120 MLX5_MKEY_MASK_EN_RINVAL = 1ull << 8,
121 MLX5_MKEY_MASK_EN_SIGERR = 1ull << 9,
119 MLX5_MKEY_MASK_BSF_EN = 1ull << 12, 122 MLX5_MKEY_MASK_BSF_EN = 1ull << 12,
120 MLX5_MKEY_MASK_KEY = 1ull << 13, 123 MLX5_MKEY_MASK_KEY = 1ull << 13,
121 MLX5_MKEY_MASK_QPN = 1ull << 14, 124 MLX5_MKEY_MASK_QPN = 1ull << 14,
@@ -555,6 +558,23 @@ struct mlx5_cqe64 {
555 u8 op_own; 558 u8 op_own;
556}; 559};
557 560
561struct mlx5_sig_err_cqe {
562 u8 rsvd0[16];
563 __be32 expected_trans_sig;
564 __be32 actual_trans_sig;
565 __be32 expected_reftag;
566 __be32 actual_reftag;
567 __be16 syndrome;
568 u8 rsvd22[2];
569 __be32 mkey;
570 __be64 err_offset;
571 u8 rsvd30[8];
572 __be32 qpn;
573 u8 rsvd38[2];
574 u8 signature;
575 u8 op_own;
576};
577
558struct mlx5_wqe_srq_next_seg { 578struct mlx5_wqe_srq_next_seg {
559 u8 rsvd0[2]; 579 u8 rsvd0[2];
560 __be16 next_wqe_index; 580 __be16 next_wqe_index;
@@ -936,4 +956,27 @@ enum {
936 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0 956 MLX_EXT_PORT_CAP_FLAG_EXTENDED_PORT_INFO = 1 << 0
937}; 957};
938 958
959struct mlx5_allocate_psv_in {
960 struct mlx5_inbox_hdr hdr;
961 __be32 npsv_pd;
962 __be32 rsvd_psv0;
963};
964
965struct mlx5_allocate_psv_out {
966 struct mlx5_outbox_hdr hdr;
967 u8 rsvd[8];
968 __be32 psv_idx[4];
969};
970
971struct mlx5_destroy_psv_in {
972 struct mlx5_inbox_hdr hdr;
973 __be32 psv_number;
974 u8 rsvd[4];
975};
976
977struct mlx5_destroy_psv_out {
978 struct mlx5_outbox_hdr hdr;
979 u8 rsvd[8];
980};
981
939#endif /* MLX5_DEVICE_H */ 982#endif /* MLX5_DEVICE_H */
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 130bc8d77fa5..93cef6313e72 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -401,6 +401,26 @@ struct mlx5_eq {
401 struct mlx5_rsc_debug *dbg; 401 struct mlx5_rsc_debug *dbg;
402}; 402};
403 403
404struct mlx5_core_psv {
405 u32 psv_idx;
406 struct psv_layout {
407 u32 pd;
408 u16 syndrome;
409 u16 reserved;
410 u16 bg;
411 u16 app_tag;
412 u32 ref_tag;
413 } psv;
414};
415
416struct mlx5_core_sig_ctx {
417 struct mlx5_core_psv psv_memory;
418 struct mlx5_core_psv psv_wire;
419 struct ib_sig_err err_item;
420 bool sig_status_checked;
421 bool sig_err_exists;
422 u32 sigerr_count;
423};
404 424
405struct mlx5_core_mr { 425struct mlx5_core_mr {
406 u64 iova; 426 u64 iova;
@@ -475,6 +495,13 @@ struct mlx5_srq_table {
475 struct radix_tree_root tree; 495 struct radix_tree_root tree;
476}; 496};
477 497
498struct mlx5_mr_table {
499 /* protect radix tree
500 */
501 rwlock_t lock;
502 struct radix_tree_root tree;
503};
504
478struct mlx5_priv { 505struct mlx5_priv {
479 char name[MLX5_MAX_NAME_LEN]; 506 char name[MLX5_MAX_NAME_LEN];
480 struct mlx5_eq_table eq_table; 507 struct mlx5_eq_table eq_table;
@@ -504,6 +531,10 @@ struct mlx5_priv {
504 struct mlx5_cq_table cq_table; 531 struct mlx5_cq_table cq_table;
505 /* end: cq staff */ 532 /* end: cq staff */
506 533
534 /* start: mr staff */
535 struct mlx5_mr_table mr_table;
536 /* end: mr staff */
537
507 /* start: alloc staff */ 538 /* start: alloc staff */
508 struct mutex pgdir_mutex; 539 struct mutex pgdir_mutex;
509 struct list_head pgdir_list; 540 struct list_head pgdir_list;
@@ -651,6 +682,11 @@ static inline void mlx5_vfree(const void *addr)
651 kfree(addr); 682 kfree(addr);
652} 683}
653 684
685static inline u32 mlx5_base_mkey(const u32 key)
686{
687 return key & 0xffffff00u;
688}
689
654int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev); 690int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev);
655void mlx5_dev_cleanup(struct mlx5_core_dev *dev); 691void mlx5_dev_cleanup(struct mlx5_core_dev *dev);
656int mlx5_cmd_init(struct mlx5_core_dev *dev); 692int mlx5_cmd_init(struct mlx5_core_dev *dev);
@@ -685,6 +721,8 @@ int mlx5_core_query_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
685 struct mlx5_query_srq_mbox_out *out); 721 struct mlx5_query_srq_mbox_out *out);
686int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq, 722int mlx5_core_arm_srq(struct mlx5_core_dev *dev, struct mlx5_core_srq *srq,
687 u16 lwm, int is_srq); 723 u16 lwm, int is_srq);
724void mlx5_init_mr_table(struct mlx5_core_dev *dev);
725void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev);
688int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr, 726int mlx5_core_create_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mr,
689 struct mlx5_create_mkey_mbox_in *in, int inlen, 727 struct mlx5_create_mkey_mbox_in *in, int inlen,
690 mlx5_cmd_cbk_t callback, void *context, 728 mlx5_cmd_cbk_t callback, void *context,
@@ -746,6 +784,9 @@ void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db);
746const char *mlx5_command_str(int command); 784const char *mlx5_command_str(int command);
747int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); 785int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev);
748void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); 786void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev);
787int mlx5_core_create_psv(struct mlx5_core_dev *dev, u32 pdn,
788 int npsvs, u32 *sig_index);
789int mlx5_core_destroy_psv(struct mlx5_core_dev *dev, int psv_num);
749 790
750static inline u32 mlx5_mkey_to_idx(u32 mkey) 791static inline u32 mlx5_mkey_to_idx(u32 mkey)
751{ 792{
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index d51eff713549..f829ad80ff28 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -37,6 +37,9 @@
37#include <linux/mlx5/driver.h> 37#include <linux/mlx5/driver.h>
38 38
39#define MLX5_INVALID_LKEY 0x100 39#define MLX5_INVALID_LKEY 0x100
40#define MLX5_SIG_WQE_SIZE (MLX5_SEND_WQE_BB * 5)
41#define MLX5_DIF_SIZE 8
42#define MLX5_STRIDE_BLOCK_OP 0x400
40 43
41enum mlx5_qp_optpar { 44enum mlx5_qp_optpar {
42 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0, 45 MLX5_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
@@ -151,6 +154,11 @@ enum {
151 MLX5_SND_DBR = 1, 154 MLX5_SND_DBR = 1,
152}; 155};
153 156
157enum {
158 MLX5_FLAGS_INLINE = 1<<7,
159 MLX5_FLAGS_CHECK_FREE = 1<<5,
160};
161
154struct mlx5_wqe_fmr_seg { 162struct mlx5_wqe_fmr_seg {
155 __be32 flags; 163 __be32 flags;
156 __be32 mem_key; 164 __be32 mem_key;
@@ -278,6 +286,60 @@ struct mlx5_wqe_inline_seg {
278 __be32 byte_count; 286 __be32 byte_count;
279}; 287};
280 288
289struct mlx5_bsf {
290 struct mlx5_bsf_basic {
291 u8 bsf_size_sbs;
292 u8 check_byte_mask;
293 union {
294 u8 copy_byte_mask;
295 u8 bs_selector;
296 u8 rsvd_wflags;
297 } wire;
298 union {
299 u8 bs_selector;
300 u8 rsvd_mflags;
301 } mem;
302 __be32 raw_data_size;
303 __be32 w_bfs_psv;
304 __be32 m_bfs_psv;
305 } basic;
306 struct mlx5_bsf_ext {
307 __be32 t_init_gen_pro_size;
308 __be32 rsvd_epi_size;
309 __be32 w_tfs_psv;
310 __be32 m_tfs_psv;
311 } ext;
312 struct mlx5_bsf_inl {
313 __be32 w_inl_vld;
314 __be32 w_rsvd;
315 __be64 w_block_format;
316 __be32 m_inl_vld;
317 __be32 m_rsvd;
318 __be64 m_block_format;
319 } inl;
320};
321
322struct mlx5_klm {
323 __be32 bcount;
324 __be32 key;
325 __be64 va;
326};
327
328struct mlx5_stride_block_entry {
329 __be16 stride;
330 __be16 bcount;
331 __be32 key;
332 __be64 va;
333};
334
335struct mlx5_stride_block_ctrl_seg {
336 __be32 bcount_per_cycle;
337 __be32 op;
338 __be32 repeat_count;
339 u16 rsvd;
340 __be16 num_entries;
341};
342
281struct mlx5_core_qp { 343struct mlx5_core_qp {
282 void (*event) (struct mlx5_core_qp *, int); 344 void (*event) (struct mlx5_core_qp *, int);
283 int qpn; 345 int qpn;
@@ -444,6 +506,11 @@ static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u
444 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn); 506 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
445} 507}
446 508
509static inline struct mlx5_core_mr *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key)
510{
511 return radix_tree_lookup(&dev->priv.mr_table.tree, key);
512}
513
447int mlx5_core_create_qp(struct mlx5_core_dev *dev, 514int mlx5_core_create_qp(struct mlx5_core_dev *dev,
448 struct mlx5_core_qp *qp, 515 struct mlx5_core_qp *qp,
449 struct mlx5_create_qp_mbox_in *in, 516 struct mlx5_create_qp_mbox_in *in,
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a0df4295e171..bf9811e1321a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -177,6 +177,9 @@ extern unsigned int kobjsize(const void *objp);
177 */ 177 */
178#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP) 178#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP | VM_MIXEDMAP)
179 179
180/* This mask defines which mm->def_flags a process can inherit its parent */
181#define VM_INIT_DEF_MASK VM_NOHUGEPAGE
182
180/* 183/*
181 * mapping from the currently active vm_flags protection bits (the 184 * mapping from the currently active vm_flags protection bits (the
182 * low four bits) to a page protection mask.. 185 * low four bits) to a page protection mask..
@@ -210,6 +213,10 @@ struct vm_fault {
210 * is set (which is also implied by 213 * is set (which is also implied by
211 * VM_FAULT_ERROR). 214 * VM_FAULT_ERROR).
212 */ 215 */
216 /* for ->map_pages() only */
217 pgoff_t max_pgoff; /* map pages for offset from pgoff till
218 * max_pgoff inclusive */
219 pte_t *pte; /* pte entry associated with ->pgoff */
213}; 220};
214 221
215/* 222/*
@@ -221,6 +228,7 @@ struct vm_operations_struct {
221 void (*open)(struct vm_area_struct * area); 228 void (*open)(struct vm_area_struct * area);
222 void (*close)(struct vm_area_struct * area); 229 void (*close)(struct vm_area_struct * area);
223 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 230 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
231 void (*map_pages)(struct vm_area_struct *vma, struct vm_fault *vmf);
224 232
225 /* notification that a previously read-only page is about to become 233 /* notification that a previously read-only page is about to become
226 * writable, if an error is returned it will cause a SIGBUS */ 234 * writable, if an error is returned it will cause a SIGBUS */
@@ -581,6 +589,9 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
581 pte = pte_mkwrite(pte); 589 pte = pte_mkwrite(pte);
582 return pte; 590 return pte;
583} 591}
592
593void do_set_pte(struct vm_area_struct *vma, unsigned long address,
594 struct page *page, pte_t *pte, bool write, bool anon);
584#endif 595#endif
585 596
586/* 597/*
@@ -684,7 +695,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
684#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 695#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
685#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 696#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
686#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 697#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
687#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_WIDTH) - 1) 698#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_SHIFT) - 1)
688#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 699#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
689 700
690static inline enum zone_type page_zonenum(const struct page *page) 701static inline enum zone_type page_zonenum(const struct page *page)
@@ -1041,6 +1052,14 @@ extern void show_free_areas(unsigned int flags);
1041extern bool skip_free_areas_node(unsigned int flags, int nid); 1052extern bool skip_free_areas_node(unsigned int flags, int nid);
1042 1053
1043int shmem_zero_setup(struct vm_area_struct *); 1054int shmem_zero_setup(struct vm_area_struct *);
1055#ifdef CONFIG_SHMEM
1056bool shmem_mapping(struct address_space *mapping);
1057#else
1058static inline bool shmem_mapping(struct address_space *mapping)
1059{
1060 return false;
1061}
1062#endif
1044 1063
1045extern int can_do_mlock(void); 1064extern int can_do_mlock(void);
1046extern int user_shm_lock(size_t, struct user_struct *); 1065extern int user_shm_lock(size_t, struct user_struct *);
@@ -1185,6 +1204,7 @@ void account_page_writeback(struct page *page);
1185int set_page_dirty(struct page *page); 1204int set_page_dirty(struct page *page);
1186int set_page_dirty_lock(struct page *page); 1205int set_page_dirty_lock(struct page *page);
1187int clear_page_dirty_for_io(struct page *page); 1206int clear_page_dirty_for_io(struct page *page);
1207int get_cmdline(struct task_struct *task, char *buffer, int buflen);
1188 1208
1189/* Is the vma a continuation of the stack vma above it? */ 1209/* Is the vma a continuation of the stack vma above it? */
1190static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr) 1210static inline int vma_growsdown(struct vm_area_struct *vma, unsigned long addr)
@@ -1658,10 +1678,8 @@ static inline int __early_pfn_to_nid(unsigned long pfn)
1658#else 1678#else
1659/* please see mm/page_alloc.c */ 1679/* please see mm/page_alloc.c */
1660extern int __meminit early_pfn_to_nid(unsigned long pfn); 1680extern int __meminit early_pfn_to_nid(unsigned long pfn);
1661#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
1662/* there is a per-arch backend function. */ 1681/* there is a per-arch backend function. */
1663extern int __meminit __early_pfn_to_nid(unsigned long pfn); 1682extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1664#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
1665#endif 1683#endif
1666 1684
1667extern void set_dma_reserve(unsigned long new_dma_reserve); 1685extern void set_dma_reserve(unsigned long new_dma_reserve);
@@ -1756,6 +1774,9 @@ extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
1756extern struct file *get_mm_exe_file(struct mm_struct *mm); 1774extern struct file *get_mm_exe_file(struct mm_struct *mm);
1757 1775
1758extern int may_expand_vm(struct mm_struct *mm, unsigned long npages); 1776extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
1777extern struct vm_area_struct *_install_special_mapping(struct mm_struct *mm,
1778 unsigned long addr, unsigned long len,
1779 unsigned long flags, struct page **pages);
1759extern int install_special_mapping(struct mm_struct *mm, 1780extern int install_special_mapping(struct mm_struct *mm,
1760 unsigned long addr, unsigned long len, 1781 unsigned long addr, unsigned long len,
1761 unsigned long flags, struct page **pages); 1782 unsigned long flags, struct page **pages);
@@ -1823,9 +1844,11 @@ vm_unmapped_area(struct vm_unmapped_area_info *info)
1823extern void truncate_inode_pages(struct address_space *, loff_t); 1844extern void truncate_inode_pages(struct address_space *, loff_t);
1824extern void truncate_inode_pages_range(struct address_space *, 1845extern void truncate_inode_pages_range(struct address_space *,
1825 loff_t lstart, loff_t lend); 1846 loff_t lstart, loff_t lend);
1847extern void truncate_inode_pages_final(struct address_space *);
1826 1848
1827/* generic vm_area_ops exported for stackable file systems */ 1849/* generic vm_area_ops exported for stackable file systems */
1828extern int filemap_fault(struct vm_area_struct *, struct vm_fault *); 1850extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
1851extern void filemap_map_pages(struct vm_area_struct *vma, struct vm_fault *vmf);
1829extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); 1852extern int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
1830 1853
1831/* mm/page-writeback.c */ 1854/* mm/page-writeback.c */
@@ -1853,9 +1876,6 @@ void page_cache_async_readahead(struct address_space *mapping,
1853 unsigned long size); 1876 unsigned long size);
1854 1877
1855unsigned long max_sane_readahead(unsigned long nr); 1878unsigned long max_sane_readahead(unsigned long nr);
1856unsigned long ra_submit(struct file_ra_state *ra,
1857 struct address_space *mapping,
1858 struct file *filp);
1859 1879
1860/* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ 1880/* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */
1861extern int expand_stack(struct vm_area_struct *vma, unsigned long address); 1881extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 290901a8c1de..8967e20cbe57 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -124,6 +124,8 @@ struct page {
124 union { 124 union {
125 struct list_head lru; /* Pageout list, eg. active_list 125 struct list_head lru; /* Pageout list, eg. active_list
126 * protected by zone->lru_lock ! 126 * protected by zone->lru_lock !
127 * Can be used as a generic list
128 * by the page owner.
127 */ 129 */
128 struct { /* slub per cpu partial pages */ 130 struct { /* slub per cpu partial pages */
129 struct page *next; /* Next partial slab */ 131 struct page *next; /* Next partial slab */
@@ -136,7 +138,6 @@ struct page {
136#endif 138#endif
137 }; 139 };
138 140
139 struct list_head list; /* slobs list of pages */
140 struct slab *slab_page; /* slab fields */ 141 struct slab *slab_page; /* slab fields */
141 struct rcu_head rcu_head; /* Used by SLAB 142 struct rcu_head rcu_head; /* Used by SLAB
142 * when destroying via RCU 143 * when destroying via RCU
@@ -342,9 +343,9 @@ struct mm_rss_stat {
342 343
343struct kioctx_table; 344struct kioctx_table;
344struct mm_struct { 345struct mm_struct {
345 struct vm_area_struct * mmap; /* list of VMAs */ 346 struct vm_area_struct *mmap; /* list of VMAs */
346 struct rb_root mm_rb; 347 struct rb_root mm_rb;
347 struct vm_area_struct * mmap_cache; /* last find_vma result */ 348 u32 vmacache_seqnum; /* per-thread vmacache */
348#ifdef CONFIG_MMU 349#ifdef CONFIG_MMU
349 unsigned long (*get_unmapped_area) (struct file *filp, 350 unsigned long (*get_unmapped_area) (struct file *filp,
350 unsigned long addr, unsigned long len, 351 unsigned long addr, unsigned long len,
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 87079fc38011..f206e29f94d7 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -95,7 +95,7 @@ struct mmc_command {
95 * actively failing requests 95 * actively failing requests
96 */ 96 */
97 97
98 unsigned int cmd_timeout_ms; /* in milliseconds */ 98 unsigned int busy_timeout; /* busy detect timeout in ms */
99 /* Set this flag only for blocking sanitize request */ 99 /* Set this flag only for blocking sanitize request */
100 bool sanitize_busy; 100 bool sanitize_busy;
101 101
@@ -152,7 +152,7 @@ extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
152 struct mmc_command *, int); 152 struct mmc_command *, int);
153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception); 153extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool, 154extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool,
155 bool); 155 bool, bool);
156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 156extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd); 157extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
158 158
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 99f5709ac343..cb61ea4d6945 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -264,15 +264,12 @@ struct mmc_host {
264 u32 caps2; /* More host capabilities */ 264 u32 caps2; /* More host capabilities */
265 265
266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */ 266#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
267#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
268#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */ 267#define MMC_CAP2_FULL_PWR_CYCLE (1 << 2) /* Can do full power cycle */
269#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */ 268#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
270#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
271#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */ 269#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
272#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 270#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
273#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 271#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
274 MMC_CAP2_HS200_1_2V_SDR) 272 MMC_CAP2_HS200_1_2V_SDR)
275#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
276#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */ 273#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
277#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 274#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
278#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 275#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
@@ -281,7 +278,6 @@ struct mmc_host {
281#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ 278#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
282 MMC_CAP2_PACKED_WR) 279 MMC_CAP2_PACKED_WR)
283#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */ 280#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
284#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
285 281
286 mmc_pm_flag_t pm_caps; /* supported pm features */ 282 mmc_pm_flag_t pm_caps; /* supported pm features */
287 283
@@ -304,7 +300,7 @@ struct mmc_host {
304 unsigned int max_req_size; /* maximum number of bytes in one req */ 300 unsigned int max_req_size; /* maximum number of bytes in one req */
305 unsigned int max_blk_size; /* maximum size of one mmc block */ 301 unsigned int max_blk_size; /* maximum size of one mmc block */
306 unsigned int max_blk_count; /* maximum number of blocks in one req */ 302 unsigned int max_blk_count; /* maximum number of blocks in one req */
307 unsigned int max_discard_to; /* max. discard timeout in ms */ 303 unsigned int max_busy_timeout; /* max busy timeout in ms */
308 304
309 /* private data */ 305 /* private data */
310 spinlock_t lock; /* lock for claim and bus ops */ 306 spinlock_t lock; /* lock for claim and bus ops */
@@ -388,8 +384,6 @@ int mmc_power_restore_host(struct mmc_host *host);
388void mmc_detect_change(struct mmc_host *, unsigned long delay); 384void mmc_detect_change(struct mmc_host *, unsigned long delay);
389void mmc_request_done(struct mmc_host *, struct mmc_request *); 385void mmc_request_done(struct mmc_host *, struct mmc_request *);
390 386
391int mmc_cache_ctrl(struct mmc_host *, u8);
392
393static inline void mmc_signal_sdio_irq(struct mmc_host *host) 387static inline void mmc_signal_sdio_irq(struct mmc_host *host)
394{ 388{
395 host->ops->enable_sdio_irq(host, 0); 389 host->ops->enable_sdio_irq(host, 0);
@@ -424,12 +418,9 @@ static inline int mmc_regulator_get_supply(struct mmc_host *mmc)
424 418
425int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); 419int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *);
426 420
427/* Module parameter */
428extern bool mmc_assume_removable;
429
430static inline int mmc_card_is_removable(struct mmc_host *host) 421static inline int mmc_card_is_removable(struct mmc_host *host)
431{ 422{
432 return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable; 423 return !(host->caps & MMC_CAP_NONREMOVABLE);
433} 424}
434 425
435static inline int mmc_card_keep_power(struct mmc_host *host) 426static inline int mmc_card_keep_power(struct mmc_host *host)
diff --git a/include/linux/mmc/sdhci-spear.h b/include/linux/mmc/sdhci-spear.h
index e78c0e236e9d..8cc095a76cf8 100644
--- a/include/linux/mmc/sdhci-spear.h
+++ b/include/linux/mmc/sdhci-spear.h
@@ -18,17 +18,9 @@
18/* 18/*
19 * struct sdhci_plat_data: spear sdhci platform data structure 19 * struct sdhci_plat_data: spear sdhci platform data structure
20 * 20 *
21 * @card_power_gpio: gpio pin for enabling/disabling power to sdhci socket
22 * @power_active_high: if set, enable power to sdhci socket by setting
23 * card_power_gpio
24 * @power_always_enb: If set, then enable power on probe, otherwise enable only
25 * on card insertion and disable on card removal.
26 * card_int_gpio: gpio pin used for card detection 21 * card_int_gpio: gpio pin used for card detection
27 */ 22 */
28struct sdhci_plat_data { 23struct sdhci_plat_data {
29 int card_power_gpio;
30 int power_active_high;
31 int power_always_enb;
32 int card_int_gpio; 24 int card_int_gpio;
33}; 25};
34 26
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 362927c48f97..7be12b883485 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -100,6 +100,8 @@ struct sdhci_host {
100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5) 100#define SDHCI_QUIRK2_BROKEN_HOST_CONTROL (1<<5)
101/* Controller does not support HS200 */ 101/* Controller does not support HS200 */
102#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) 102#define SDHCI_QUIRK2_BROKEN_HS200 (1<<6)
103/* Controller does not support DDR50 */
104#define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7)
103 105
104 int irq; /* Device IRQ */ 106 int irq; /* Device IRQ */
105 void __iomem *ioaddr; /* Mapped address */ 107 void __iomem *ioaddr; /* Mapped address */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index d8836623f36a..0f01fe065424 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -31,6 +31,7 @@
31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334 31#define SDIO_DEVICE_ID_BROADCOM_4334 0x4334
32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335 32#define SDIO_DEVICE_ID_BROADCOM_4335_4339 0x4335
33#define SDIO_DEVICE_ID_BROADCOM_43362 43362 33#define SDIO_DEVICE_ID_BROADCOM_43362 43362
34#define SDIO_DEVICE_ID_BROADCOM_4354 0x4354
34 35
35#define SDIO_VENDOR_ID_INTEL 0x0089 36#define SDIO_VENDOR_ID_INTEL 0x0089
36#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 37#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402
diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h
index b0c73e4cacea..d2433381e828 100644
--- a/include/linux/mmc/slot-gpio.h
+++ b/include/linux/mmc/slot-gpio.h
@@ -22,4 +22,10 @@ int mmc_gpio_request_cd(struct mmc_host *host, unsigned int gpio,
22 unsigned int debounce); 22 unsigned int debounce);
23void mmc_gpio_free_cd(struct mmc_host *host); 23void mmc_gpio_free_cd(struct mmc_host *host);
24 24
25int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id,
26 unsigned int idx, bool override_active_level,
27 unsigned int debounce);
28void mmc_gpiod_free_cd(struct mmc_host *host);
29void mmc_gpiod_request_cd_irq(struct mmc_host *host);
30
25#endif 31#endif
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
index 5042c036dda9..2d57efa64cc1 100644
--- a/include/linux/mmdebug.h
+++ b/include/linux/mmdebug.h
@@ -3,8 +3,8 @@
3 3
4struct page; 4struct page;
5 5
6extern void dump_page(struct page *page, char *reason); 6extern void dump_page(struct page *page, const char *reason);
7extern void dump_page_badflags(struct page *page, char *reason, 7extern void dump_page_badflags(struct page *page, const char *reason,
8 unsigned long badflags); 8 unsigned long badflags);
9 9
10#ifdef CONFIG_DEBUG_VM 10#ifdef CONFIG_DEBUG_VM
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9b61b9bf81ac..fac5509c18f0 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -142,6 +142,9 @@ enum zone_stat_item {
142 NUMA_LOCAL, /* allocation from local node */ 142 NUMA_LOCAL, /* allocation from local node */
143 NUMA_OTHER, /* allocation from other node */ 143 NUMA_OTHER, /* allocation from other node */
144#endif 144#endif
145 WORKINGSET_REFAULT,
146 WORKINGSET_ACTIVATE,
147 WORKINGSET_NODERECLAIM,
145 NR_ANON_TRANSPARENT_HUGEPAGES, 148 NR_ANON_TRANSPARENT_HUGEPAGES,
146 NR_FREE_CMA_PAGES, 149 NR_FREE_CMA_PAGES,
147 NR_VM_ZONE_STAT_ITEMS }; 150 NR_VM_ZONE_STAT_ITEMS };
@@ -392,6 +395,9 @@ struct zone {
392 spinlock_t lru_lock; 395 spinlock_t lru_lock;
393 struct lruvec lruvec; 396 struct lruvec lruvec;
394 397
398 /* Evictions & activations on the inactive file list */
399 atomic_long_t inactive_age;
400
395 unsigned long pages_scanned; /* since last reclaim */ 401 unsigned long pages_scanned; /* since last reclaim */
396 unsigned long flags; /* zone flags, see below */ 402 unsigned long flags; /* zone flags, see below */
397 403
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 45e921401b06..44eeef0da186 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -432,6 +432,14 @@ struct spi_device_id {
432 kernel_ulong_t driver_data; /* Data private to the driver */ 432 kernel_ulong_t driver_data; /* Data private to the driver */
433}; 433};
434 434
435#define SPMI_NAME_SIZE 32
436#define SPMI_MODULE_PREFIX "spmi:"
437
438struct spmi_device_id {
439 char name[SPMI_NAME_SIZE];
440 kernel_ulong_t driver_data; /* Data private to the driver */
441};
442
435/* dmi */ 443/* dmi */
436enum dmi_field { 444enum dmi_field {
437 DMI_NONE, 445 DMI_NONE,
@@ -548,6 +556,11 @@ struct amba_id {
548 * See documentation of "x86_match_cpu" for details. 556 * See documentation of "x86_match_cpu" for details.
549 */ 557 */
550 558
559/*
560 * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id.
561 * Although gcc seems to ignore this error, clang fails without this define.
562 */
563#define x86cpu_device_id x86_cpu_id
551struct x86_cpu_id { 564struct x86_cpu_id {
552 __u16 vendor; 565 __u16 vendor;
553 __u16 family; 566 __u16 family;
@@ -564,6 +577,15 @@ struct x86_cpu_id {
564#define X86_MODEL_ANY 0 577#define X86_MODEL_ANY 0
565#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */ 578#define X86_FEATURE_ANY 0 /* Same as FPU, you can't test for that */
566 579
580/*
581 * Generic table type for matching CPU features.
582 * @feature: the bit number of the feature (0 - 65535)
583 */
584
585struct cpu_feature {
586 __u16 feature;
587};
588
567#define IPACK_ANY_FORMAT 0xff 589#define IPACK_ANY_FORMAT 0xff
568#define IPACK_ANY_ID (~0) 590#define IPACK_ANY_ID (~0)
569struct ipack_device_id { 591struct ipack_device_id {
@@ -599,4 +621,9 @@ struct rio_device_id {
599 __u16 asm_did, asm_vid; 621 __u16 asm_did, asm_vid;
600}; 622};
601 623
624struct mcb_device_id {
625 __u16 device;
626 kernel_ulong_t driver_data;
627};
628
602#endif /* LINUX_MOD_DEVICETABLE_H */ 629#endif /* LINUX_MOD_DEVICETABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index eaf60ff9ba94..f520a767c86c 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,7 +15,7 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/jump_label.h>
19#include <linux/export.h> 19#include <linux/export.h>
20 20
21#include <linux/percpu.h> 21#include <linux/percpu.h>
@@ -82,15 +82,6 @@ void sort_extable(struct exception_table_entry *start,
82void sort_main_extable(void); 82void sort_main_extable(void);
83void trim_init_extable(struct module *m); 83void trim_init_extable(struct module *m);
84 84
85#ifdef MODULE
86#define MODULE_GENERIC_TABLE(gtype, name) \
87extern const struct gtype##_id __mod_##gtype##_table \
88 __attribute__ ((unused, alias(__stringify(name))))
89
90#else /* !MODULE */
91#define MODULE_GENERIC_TABLE(gtype, name)
92#endif
93
94/* Generic info of form tag = "info" */ 85/* Generic info of form tag = "info" */
95#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) 86#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
96 87
@@ -141,8 +132,14 @@ extern const struct gtype##_id __mod_##gtype##_table \
141/* What your module does. */ 132/* What your module does. */
142#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) 133#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
143 134
144#define MODULE_DEVICE_TABLE(type, name) \ 135#ifdef MODULE
145 MODULE_GENERIC_TABLE(type##_device, name) 136/* Creates an alias so file2alias.c can find device table. */
137#define MODULE_DEVICE_TABLE(type, name) \
138 extern const struct type##_device_id __mod_##type##__##name##_device_table \
139 __attribute__ ((unused, alias(__stringify(name))))
140#else /* !MODULE */
141#define MODULE_DEVICE_TABLE(type, name)
142#endif
146 143
147/* Version of form [<epoch>:]<version>[-<extra-version>]. 144/* Version of form [<epoch>:]<version>[-<extra-version>].
148 * Or for CVS/RCS ID version, everything but the number is stripped. 145 * Or for CVS/RCS ID version, everything but the number is stripped.
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index c3eb102a9cc8..204a67743804 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -186,14 +186,12 @@ struct kparam_array
186 parameters. */ 186 parameters. */
187#define __module_param_call(prefix, name, ops, arg, perm, level) \ 187#define __module_param_call(prefix, name, ops, arg, perm, level) \
188 /* Default value instead of permissions? */ \ 188 /* Default value instead of permissions? */ \
189 static int __param_perm_check_##name __attribute__((unused)) = \ 189 static const char __param_str_##name[] = prefix #name; \
190 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
191 + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \
192 static const char __param_str_##name[] = prefix #name; \
193 static struct kernel_param __moduleparam_const __param_##name \ 190 static struct kernel_param __moduleparam_const __param_##name \
194 __used \ 191 __used \
195 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 192 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
196 = { __param_str_##name, ops, perm, level, { arg } } 193 = { __param_str_##name, ops, VERIFY_OCTAL_PERMISSIONS(perm), \
194 level, { arg } }
197 195
198/* Obsolete - use module_param_cb() */ 196/* Obsolete - use module_param_cb() */
199#define module_param_call(name, set, get, arg, perm) \ 197#define module_param_call(name, set, get, arg, perm) \
@@ -346,7 +344,7 @@ static inline void destroy_params(const struct kernel_param *params,
346/* The macros to do compile-time type checking stolen from Jakub 344/* The macros to do compile-time type checking stolen from Jakub
347 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */ 345 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
348#define __param_check(name, p, type) \ 346#define __param_check(name, p, type) \
349 static inline type *__check_##name(void) { return(p); } 347 static inline type __always_unused *__check_##name(void) { return(p); }
350 348
351extern struct kernel_param_ops param_ops_byte; 349extern struct kernel_param_ops param_ops_byte;
352extern int param_set_byte(const char *val, const struct kernel_param *kp); 350extern int param_set_byte(const char *val, const struct kernel_param *kp);
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 371d346fa270..839bac270904 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -44,6 +44,8 @@ struct mnt_namespace;
44#define MNT_SHARED_MASK (MNT_UNBINDABLE) 44#define MNT_SHARED_MASK (MNT_UNBINDABLE)
45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE) 45#define MNT_PROPAGATION_MASK (MNT_SHARED | MNT_UNBINDABLE)
46 46
47#define MNT_INTERNAL_FLAGS (MNT_SHARED | MNT_WRITE_HOLD | MNT_INTERNAL | \
48 MNT_DOOMED | MNT_SYNC_UMOUNT | MNT_MARKED)
47 49
48#define MNT_INTERNAL 0x4000 50#define MNT_INTERNAL 0x4000
49 51
@@ -51,6 +53,7 @@ struct mnt_namespace;
51#define MNT_LOCKED 0x800000 53#define MNT_LOCKED 0x800000
52#define MNT_DOOMED 0x1000000 54#define MNT_DOOMED 0x1000000
53#define MNT_SYNC_UMOUNT 0x2000000 55#define MNT_SYNC_UMOUNT 0x2000000
56#define MNT_MARKED 0x4000000
54 57
55struct vfsmount { 58struct vfsmount {
56 struct dentry *mnt_root; /* root of the mounted tree */ 59 struct dentry *mnt_root; /* root of the mounted tree */
diff --git a/include/linux/mpls.h b/include/linux/mpls.h
new file mode 100644
index 000000000000..9999145bc190
--- /dev/null
+++ b/include/linux/mpls.h
@@ -0,0 +1,6 @@
1#ifndef _LINUX_MPLS_H
2#define _LINUX_MPLS_H
3
4#include <uapi/linux/mpls.h>
5
6#endif /* _LINUX_MPLS_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8cc0e2fb6894..a1b0b4c8fd79 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -204,12 +204,12 @@ struct mtd_info {
204 struct mtd_oob_ops *ops); 204 struct mtd_oob_ops *ops);
205 int (*_write_oob) (struct mtd_info *mtd, loff_t to, 205 int (*_write_oob) (struct mtd_info *mtd, loff_t to,
206 struct mtd_oob_ops *ops); 206 struct mtd_oob_ops *ops);
207 int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 207 int (*_get_fact_prot_info) (struct mtd_info *mtd, size_t len,
208 size_t len); 208 size_t *retlen, struct otp_info *buf);
209 int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, 209 int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from,
210 size_t len, size_t *retlen, u_char *buf); 210 size_t len, size_t *retlen, u_char *buf);
211 int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, 211 int (*_get_user_prot_info) (struct mtd_info *mtd, size_t len,
212 size_t len); 212 size_t *retlen, struct otp_info *buf);
213 int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, 213 int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from,
214 size_t len, size_t *retlen, u_char *buf); 214 size_t len, size_t *retlen, u_char *buf);
215 int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, 215 int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to,
@@ -278,12 +278,12 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
278 return mtd->_write_oob(mtd, to, ops); 278 return mtd->_write_oob(mtd, to, ops);
279} 279}
280 280
281int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, 281int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
282 size_t len); 282 struct otp_info *buf);
283int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, 283int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
284 size_t *retlen, u_char *buf); 284 size_t *retlen, u_char *buf);
285int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf, 285int mtd_get_user_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen,
286 size_t len); 286 struct otp_info *buf);
287int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, 287int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len,
288 size_t *retlen, u_char *buf); 288 size_t *retlen, u_char *buf);
289int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, 289int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len,
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 32f8612469d8..450d61ec7f06 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -52,14 +52,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
52#define NAND_MAX_CHIPS 8 52#define NAND_MAX_CHIPS 8
53 53
54/* 54/*
55 * This constant declares the max. oobsize / page, which
56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly.
58 */
59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192
61
62/*
63 * Constants for hardware specific CLE/ALE/NCE function 55 * Constants for hardware specific CLE/ALE/NCE function
64 * 56 *
65 * These are bits which can be or'ed to set/clear multiple 57 * These are bits which can be or'ed to set/clear multiple
@@ -350,6 +342,84 @@ struct nand_onfi_vendor_micron {
350 u8 param_revision; 342 u8 param_revision;
351} __packed; 343} __packed;
352 344
345struct jedec_ecc_info {
346 u8 ecc_bits;
347 u8 codeword_size;
348 __le16 bb_per_lun;
349 __le16 block_endurance;
350 u8 reserved[2];
351} __packed;
352
353/* JEDEC features */
354#define JEDEC_FEATURE_16_BIT_BUS (1 << 0)
355
356struct nand_jedec_params {
357 /* rev info and features block */
358 /* 'J' 'E' 'S' 'D' */
359 u8 sig[4];
360 __le16 revision;
361 __le16 features;
362 u8 opt_cmd[3];
363 __le16 sec_cmd;
364 u8 num_of_param_pages;
365 u8 reserved0[18];
366
367 /* manufacturer information block */
368 char manufacturer[12];
369 char model[20];
370 u8 jedec_id[6];
371 u8 reserved1[10];
372
373 /* memory organization block */
374 __le32 byte_per_page;
375 __le16 spare_bytes_per_page;
376 u8 reserved2[6];
377 __le32 pages_per_block;
378 __le32 blocks_per_lun;
379 u8 lun_count;
380 u8 addr_cycles;
381 u8 bits_per_cell;
382 u8 programs_per_page;
383 u8 multi_plane_addr;
384 u8 multi_plane_op_attr;
385 u8 reserved3[38];
386
387 /* electrical parameter block */
388 __le16 async_sdr_speed_grade;
389 __le16 toggle_ddr_speed_grade;
390 __le16 sync_ddr_speed_grade;
391 u8 async_sdr_features;
392 u8 toggle_ddr_features;
393 u8 sync_ddr_features;
394 __le16 t_prog;
395 __le16 t_bers;
396 __le16 t_r;
397 __le16 t_r_multi_plane;
398 __le16 t_ccs;
399 __le16 io_pin_capacitance_typ;
400 __le16 input_pin_capacitance_typ;
401 __le16 clk_pin_capacitance_typ;
402 u8 driver_strength_support;
403 __le16 t_ald;
404 u8 reserved4[36];
405
406 /* ECC and endurance block */
407 u8 guaranteed_good_blocks;
408 __le16 guaranteed_block_endurance;
409 struct jedec_ecc_info ecc_info[4];
410 u8 reserved5[29];
411
412 /* reserved */
413 u8 reserved6[148];
414
415 /* vendor */
416 __le16 vendor_rev_num;
417 u8 reserved7[88];
418
419 /* CRC for Parameter Page */
420 __le16 crc;
421} __packed;
422
353/** 423/**
354 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 424 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
355 * @lock: protection lock 425 * @lock: protection lock
@@ -418,7 +488,7 @@ struct nand_ecc_ctrl {
418 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, 488 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
419 uint8_t *buf, int oob_required, int page); 489 uint8_t *buf, int oob_required, int page);
420 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 490 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
421 uint32_t offs, uint32_t len, uint8_t *buf); 491 uint32_t offs, uint32_t len, uint8_t *buf, int page);
422 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 492 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
423 uint32_t offset, uint32_t data_len, 493 uint32_t offset, uint32_t data_len,
424 const uint8_t *data_buf, int oob_required); 494 const uint8_t *data_buf, int oob_required);
@@ -435,17 +505,17 @@ struct nand_ecc_ctrl {
435 505
436/** 506/**
437 * struct nand_buffers - buffer structure for read/write 507 * struct nand_buffers - buffer structure for read/write
438 * @ecccalc: buffer for calculated ECC 508 * @ecccalc: buffer pointer for calculated ECC, size is oobsize.
439 * @ecccode: buffer for ECC read from flash 509 * @ecccode: buffer pointer for ECC read from flash, size is oobsize.
440 * @databuf: buffer for data - dynamically sized 510 * @databuf: buffer pointer for data, size is (page size + oobsize).
441 * 511 *
442 * Do not change the order of buffers. databuf and oobrbuf must be in 512 * Do not change the order of buffers. databuf and oobrbuf must be in
443 * consecutive order. 513 * consecutive order.
444 */ 514 */
445struct nand_buffers { 515struct nand_buffers {
446 uint8_t ecccalc[NAND_MAX_OOBSIZE]; 516 uint8_t *ecccalc;
447 uint8_t ecccode[NAND_MAX_OOBSIZE]; 517 uint8_t *ecccode;
448 uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE]; 518 uint8_t *databuf;
449}; 519};
450 520
451/** 521/**
@@ -523,8 +593,12 @@ struct nand_buffers {
523 * @subpagesize: [INTERN] holds the subpagesize 593 * @subpagesize: [INTERN] holds the subpagesize
524 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), 594 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded),
525 * non 0 if ONFI supported. 595 * non 0 if ONFI supported.
596 * @jedec_version: [INTERN] holds the chip JEDEC version (BCD encoded),
597 * non 0 if JEDEC supported.
526 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is 598 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
527 * supported, 0 otherwise. 599 * supported, 0 otherwise.
600 * @jedec_params: [INTERN] holds the JEDEC parameter page when JEDEC is
601 * supported, 0 otherwise.
528 * @read_retries: [INTERN] the number of read retry modes supported 602 * @read_retries: [INTERN] the number of read retry modes supported
529 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand 603 * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand
530 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand 604 * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand
@@ -597,7 +671,11 @@ struct nand_chip {
597 int badblockbits; 671 int badblockbits;
598 672
599 int onfi_version; 673 int onfi_version;
600 struct nand_onfi_params onfi_params; 674 int jedec_version;
675 union {
676 struct nand_onfi_params onfi_params;
677 struct nand_jedec_params jedec_params;
678 };
601 679
602 int read_retries; 680 int read_retries;
603 681
@@ -840,4 +918,29 @@ static inline bool nand_is_slc(struct nand_chip *chip)
840{ 918{
841 return chip->bits_per_cell == 1; 919 return chip->bits_per_cell == 1;
842} 920}
921
922/**
923 * Check if the opcode's address should be sent only on the lower 8 bits
924 * @command: opcode to check
925 */
926static inline int nand_opcode_8bits(unsigned int command)
927{
928 switch (command) {
929 case NAND_CMD_READID:
930 case NAND_CMD_PARAM:
931 case NAND_CMD_GET_FEATURES:
932 case NAND_CMD_SET_FEATURES:
933 return 1;
934 default:
935 break;
936 }
937 return 0;
938}
939
940/* return the supported JEDEC features. */
941static inline int jedec_feature(struct nand_chip *chip)
942{
943 return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features)
944 : 0;
945}
843#endif /* __LINUX_MTD_NAND_H */ 946#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index ae4981ebd18e..f62f78aef4ac 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -24,8 +24,7 @@ struct request;
24struct nbd_device { 24struct nbd_device {
25 int flags; 25 int flags;
26 int harderror; /* Code of hard error */ 26 int harderror; /* Code of hard error */
27 struct socket * sock; 27 struct socket * sock; /* If == NULL, device is not ready, yet */
28 struct file * file; /* If == NULL, device is not ready, yet */
29 int magic; 28 int magic;
30 29
31 spinlock_t queue_lock; 30 spinlock_t queue_lock;
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5a09a48f2658..c26d0ec2ef3a 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -63,6 +63,7 @@ enum {
63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */ 63 NETIF_F_HW_VLAN_STAG_RX_BIT, /* Receive VLAN STAG HW acceleration */
64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */ 64 NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */
65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */ 65 NETIF_F_HW_L2FW_DOFFLOAD_BIT, /* Allow L2 Forwarding in Hardware */
66 NETIF_F_BUSY_POLL_BIT, /* Busy poll */
66 67
67 /* 68 /*
68 * Add your fresh new feature above and remember to update 69 * Add your fresh new feature above and remember to update
@@ -118,6 +119,7 @@ enum {
118#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX) 119#define NETIF_F_HW_VLAN_STAG_RX __NETIF_F(HW_VLAN_STAG_RX)
119#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX) 120#define NETIF_F_HW_VLAN_STAG_TX __NETIF_F(HW_VLAN_STAG_TX)
120#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD) 121#define NETIF_F_HW_L2FW_DOFFLOAD __NETIF_F(HW_L2FW_DOFFLOAD)
122#define NETIF_F_BUSY_POLL __NETIF_F(BUSY_POLL)
121 123
122/* Features valid for ethtool to change */ 124/* Features valid for ethtool to change */
123/* = all defined minus driver/device-class-related */ 125/* = all defined minus driver/device-class-related */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index daafd9561cbc..7ed3a3aa6604 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -63,13 +63,6 @@ struct wireless_dev;
63void netdev_set_default_ethtool_ops(struct net_device *dev, 63void netdev_set_default_ethtool_ops(struct net_device *dev,
64 const struct ethtool_ops *ops); 64 const struct ethtool_ops *ops);
65 65
66/* hardware address assignment types */
67#define NET_ADDR_PERM 0 /* address is permanent (default) */
68#define NET_ADDR_RANDOM 1 /* address is generated randomly */
69#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
70#define NET_ADDR_SET 3 /* address is set using
71 * dev_set_mac_address() */
72
73/* Backlog congestion levels */ 66/* Backlog congestion levels */
74#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 67#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
75#define NET_RX_DROP 1 /* packet dropped */ 68#define NET_RX_DROP 1 /* packet dropped */
@@ -526,11 +519,18 @@ enum netdev_queue_state_t {
526 __QUEUE_STATE_DRV_XOFF, 519 __QUEUE_STATE_DRV_XOFF,
527 __QUEUE_STATE_STACK_XOFF, 520 __QUEUE_STATE_STACK_XOFF,
528 __QUEUE_STATE_FROZEN, 521 __QUEUE_STATE_FROZEN,
529#define QUEUE_STATE_ANY_XOFF ((1 << __QUEUE_STATE_DRV_XOFF) | \
530 (1 << __QUEUE_STATE_STACK_XOFF))
531#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
532 (1 << __QUEUE_STATE_FROZEN))
533}; 522};
523
524#define QUEUE_STATE_DRV_XOFF (1 << __QUEUE_STATE_DRV_XOFF)
525#define QUEUE_STATE_STACK_XOFF (1 << __QUEUE_STATE_STACK_XOFF)
526#define QUEUE_STATE_FROZEN (1 << __QUEUE_STATE_FROZEN)
527
528#define QUEUE_STATE_ANY_XOFF (QUEUE_STATE_DRV_XOFF | QUEUE_STATE_STACK_XOFF)
529#define QUEUE_STATE_ANY_XOFF_OR_FROZEN (QUEUE_STATE_ANY_XOFF | \
530 QUEUE_STATE_FROZEN)
531#define QUEUE_STATE_DRV_XOFF_OR_FROZEN (QUEUE_STATE_DRV_XOFF | \
532 QUEUE_STATE_FROZEN)
533
534/* 534/*
535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The 535 * __QUEUE_STATE_DRV_XOFF is used by drivers to stop the transmit queue. The
536 * netif_tx_* functions below are used to manipulate this flag. The 536 * netif_tx_* functions below are used to manipulate this flag. The
@@ -1037,8 +1037,7 @@ struct net_device_ops {
1037#ifdef CONFIG_NET_POLL_CONTROLLER 1037#ifdef CONFIG_NET_POLL_CONTROLLER
1038 void (*ndo_poll_controller)(struct net_device *dev); 1038 void (*ndo_poll_controller)(struct net_device *dev);
1039 int (*ndo_netpoll_setup)(struct net_device *dev, 1039 int (*ndo_netpoll_setup)(struct net_device *dev,
1040 struct netpoll_info *info, 1040 struct netpoll_info *info);
1041 gfp_t gfp);
1042 void (*ndo_netpoll_cleanup)(struct net_device *dev); 1041 void (*ndo_netpoll_cleanup)(struct net_device *dev);
1043#endif 1042#endif
1044#ifdef CONFIG_NET_RX_BUSY_POLL 1043#ifdef CONFIG_NET_RX_BUSY_POLL
@@ -1147,6 +1146,89 @@ struct net_device_ops {
1147 void *priv); 1146 void *priv);
1148}; 1147};
1149 1148
1149/**
1150 * enum net_device_priv_flags - &struct net_device priv_flags
1151 *
1152 * These are the &struct net_device, they are only set internally
1153 * by drivers and used in the kernel. These flags are invisible to
1154 * userspace, this means that the order of these flags can change
1155 * during any kernel release.
1156 *
1157 * You should have a pretty good reason to be extending these flags.
1158 *
1159 * @IFF_802_1Q_VLAN: 802.1Q VLAN device
1160 * @IFF_EBRIDGE: Ethernet bridging device
1161 * @IFF_SLAVE_INACTIVE: bonding slave not the curr. active
1162 * @IFF_MASTER_8023AD: bonding master, 802.3ad
1163 * @IFF_MASTER_ALB: bonding master, balance-alb
1164 * @IFF_BONDING: bonding master or slave
1165 * @IFF_SLAVE_NEEDARP: need ARPs for validation
1166 * @IFF_ISATAP: ISATAP interface (RFC4214)
1167 * @IFF_MASTER_ARPMON: bonding master, ARP mon in use
1168 * @IFF_WAN_HDLC: WAN HDLC device
1169 * @IFF_XMIT_DST_RELEASE: dev_hard_start_xmit() is allowed to
1170 * release skb->dst
1171 * @IFF_DONT_BRIDGE: disallow bridging this ether dev
1172 * @IFF_DISABLE_NETPOLL: disable netpoll at run-time
1173 * @IFF_MACVLAN_PORT: device used as macvlan port
1174 * @IFF_BRIDGE_PORT: device used as bridge port
1175 * @IFF_OVS_DATAPATH: device used as Open vSwitch datapath port
1176 * @IFF_TX_SKB_SHARING: The interface supports sharing skbs on transmit
1177 * @IFF_UNICAST_FLT: Supports unicast filtering
1178 * @IFF_TEAM_PORT: device used as team port
1179 * @IFF_SUPP_NOFCS: device supports sending custom FCS
1180 * @IFF_LIVE_ADDR_CHANGE: device supports hardware address
1181 * change when it's running
1182 * @IFF_MACVLAN: Macvlan device
1183 */
1184enum netdev_priv_flags {
1185 IFF_802_1Q_VLAN = 1<<0,
1186 IFF_EBRIDGE = 1<<1,
1187 IFF_SLAVE_INACTIVE = 1<<2,
1188 IFF_MASTER_8023AD = 1<<3,
1189 IFF_MASTER_ALB = 1<<4,
1190 IFF_BONDING = 1<<5,
1191 IFF_SLAVE_NEEDARP = 1<<6,
1192 IFF_ISATAP = 1<<7,
1193 IFF_MASTER_ARPMON = 1<<8,
1194 IFF_WAN_HDLC = 1<<9,
1195 IFF_XMIT_DST_RELEASE = 1<<10,
1196 IFF_DONT_BRIDGE = 1<<11,
1197 IFF_DISABLE_NETPOLL = 1<<12,
1198 IFF_MACVLAN_PORT = 1<<13,
1199 IFF_BRIDGE_PORT = 1<<14,
1200 IFF_OVS_DATAPATH = 1<<15,
1201 IFF_TX_SKB_SHARING = 1<<16,
1202 IFF_UNICAST_FLT = 1<<17,
1203 IFF_TEAM_PORT = 1<<18,
1204 IFF_SUPP_NOFCS = 1<<19,
1205 IFF_LIVE_ADDR_CHANGE = 1<<20,
1206 IFF_MACVLAN = 1<<21,
1207};
1208
1209#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
1210#define IFF_EBRIDGE IFF_EBRIDGE
1211#define IFF_SLAVE_INACTIVE IFF_SLAVE_INACTIVE
1212#define IFF_MASTER_8023AD IFF_MASTER_8023AD
1213#define IFF_MASTER_ALB IFF_MASTER_ALB
1214#define IFF_BONDING IFF_BONDING
1215#define IFF_SLAVE_NEEDARP IFF_SLAVE_NEEDARP
1216#define IFF_ISATAP IFF_ISATAP
1217#define IFF_MASTER_ARPMON IFF_MASTER_ARPMON
1218#define IFF_WAN_HDLC IFF_WAN_HDLC
1219#define IFF_XMIT_DST_RELEASE IFF_XMIT_DST_RELEASE
1220#define IFF_DONT_BRIDGE IFF_DONT_BRIDGE
1221#define IFF_DISABLE_NETPOLL IFF_DISABLE_NETPOLL
1222#define IFF_MACVLAN_PORT IFF_MACVLAN_PORT
1223#define IFF_BRIDGE_PORT IFF_BRIDGE_PORT
1224#define IFF_OVS_DATAPATH IFF_OVS_DATAPATH
1225#define IFF_TX_SKB_SHARING IFF_TX_SKB_SHARING
1226#define IFF_UNICAST_FLT IFF_UNICAST_FLT
1227#define IFF_TEAM_PORT IFF_TEAM_PORT
1228#define IFF_SUPP_NOFCS IFF_SUPP_NOFCS
1229#define IFF_LIVE_ADDR_CHANGE IFF_LIVE_ADDR_CHANGE
1230#define IFF_MACVLAN IFF_MACVLAN
1231
1150/* 1232/*
1151 * The DEVICE structure. 1233 * The DEVICE structure.
1152 * Actually, this whole structure is a big mistake. It mixes I/O 1234 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -1228,9 +1310,13 @@ struct net_device {
1228 int iflink; 1310 int iflink;
1229 1311
1230 struct net_device_stats stats; 1312 struct net_device_stats stats;
1231 atomic_long_t rx_dropped; /* dropped packets by core network 1313
1232 * Do not use this in drivers. 1314 /* dropped packets by core network, Do not use this in drivers */
1233 */ 1315 atomic_long_t rx_dropped;
1316 atomic_long_t tx_dropped;
1317
1318 /* Stats to monitor carrier on<->off transitions */
1319 atomic_t carrier_changes;
1234 1320
1235#ifdef CONFIG_WIRELESS_EXT 1321#ifdef CONFIG_WIRELESS_EXT
1236 /* List of functions to handle Wireless Extensions (instead of ioctl). 1322 /* List of functions to handle Wireless Extensions (instead of ioctl).
@@ -1279,6 +1365,10 @@ struct net_device {
1279 * that share the same link 1365 * that share the same link
1280 * layer address 1366 * layer address
1281 */ 1367 */
1368 unsigned short dev_port; /* Used to differentiate
1369 * devices that share the same
1370 * function
1371 */
1282 spinlock_t addr_list_lock; 1372 spinlock_t addr_list_lock;
1283 struct netdev_hw_addr_list uc; /* Unicast mac addresses */ 1373 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
1284 struct netdev_hw_addr_list mc; /* Multicast mac addresses */ 1374 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
@@ -1316,13 +1406,7 @@ struct net_device {
1316/* 1406/*
1317 * Cache lines mostly used on receive path (including eth_type_trans()) 1407 * Cache lines mostly used on receive path (including eth_type_trans())
1318 */ 1408 */
1319 unsigned long last_rx; /* Time of last Rx 1409 unsigned long last_rx; /* Time of last Rx */
1320 * This should not be set in
1321 * drivers, unless really needed,
1322 * because network stack (bonding)
1323 * use it if/when necessary, to
1324 * avoid dirtying this cache line.
1325 */
1326 1410
1327 /* Interface address info used in eth_type_trans() */ 1411 /* Interface address info used in eth_type_trans() */
1328 unsigned char *dev_addr; /* hw address, (before bcast 1412 unsigned char *dev_addr; /* hw address, (before bcast
@@ -1729,6 +1813,20 @@ struct pcpu_sw_netstats {
1729 struct u64_stats_sync syncp; 1813 struct u64_stats_sync syncp;
1730}; 1814};
1731 1815
1816#define netdev_alloc_pcpu_stats(type) \
1817({ \
1818 typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
1819 if (pcpu_stats) { \
1820 int i; \
1821 for_each_possible_cpu(i) { \
1822 typeof(type) *stat; \
1823 stat = per_cpu_ptr(pcpu_stats, i); \
1824 u64_stats_init(&stat->syncp); \
1825 } \
1826 } \
1827 pcpu_stats; \
1828})
1829
1732#include <linux/notifier.h> 1830#include <linux/notifier.h>
1733 1831
1734/* netdevice notifier chain. Please remember to update the rtnetlink 1832/* netdevice notifier chain. Please remember to update the rtnetlink
@@ -1884,9 +1982,6 @@ struct net_device *__dev_get_by_index(struct net *net, int ifindex);
1884struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex); 1982struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
1885int netdev_get_name(struct net *net, char *name, int ifindex); 1983int netdev_get_name(struct net *net, char *name, int ifindex);
1886int dev_restart(struct net_device *dev); 1984int dev_restart(struct net_device *dev);
1887#ifdef CONFIG_NETPOLL_TRAP
1888int netpoll_trap(void);
1889#endif
1890int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb); 1985int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1891 1986
1892static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1987static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
@@ -1926,11 +2021,6 @@ static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1926 return skb->data + offset; 2021 return skb->data + offset;
1927} 2022}
1928 2023
1929static inline void *skb_gro_mac_header(struct sk_buff *skb)
1930{
1931 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
1932}
1933
1934static inline void *skb_gro_network_header(struct sk_buff *skb) 2024static inline void *skb_gro_network_header(struct sk_buff *skb)
1935{ 2025{
1936 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) + 2026 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
@@ -2091,12 +2181,6 @@ static inline void netif_tx_start_all_queues(struct net_device *dev)
2091 2181
2092static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue) 2182static inline void netif_tx_wake_queue(struct netdev_queue *dev_queue)
2093{ 2183{
2094#ifdef CONFIG_NETPOLL_TRAP
2095 if (netpoll_trap()) {
2096 netif_tx_start_queue(dev_queue);
2097 return;
2098 }
2099#endif
2100 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state)) 2184 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &dev_queue->state))
2101 __netif_schedule(dev_queue->qdisc); 2185 __netif_schedule(dev_queue->qdisc);
2102} 2186}
@@ -2175,11 +2259,18 @@ static inline bool netif_xmit_stopped(const struct netdev_queue *dev_queue)
2175 return dev_queue->state & QUEUE_STATE_ANY_XOFF; 2259 return dev_queue->state & QUEUE_STATE_ANY_XOFF;
2176} 2260}
2177 2261
2178static inline bool netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue) 2262static inline bool
2263netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_queue)
2179{ 2264{
2180 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN; 2265 return dev_queue->state & QUEUE_STATE_ANY_XOFF_OR_FROZEN;
2181} 2266}
2182 2267
2268static inline bool
2269netif_xmit_frozen_or_drv_stopped(const struct netdev_queue *dev_queue)
2270{
2271 return dev_queue->state & QUEUE_STATE_DRV_XOFF_OR_FROZEN;
2272}
2273
2183static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, 2274static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
2184 unsigned int bytes) 2275 unsigned int bytes)
2185{ 2276{
@@ -2340,10 +2431,6 @@ static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
2340static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index) 2431static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
2341{ 2432{
2342 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2433 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2343#ifdef CONFIG_NETPOLL_TRAP
2344 if (netpoll_trap())
2345 return;
2346#endif
2347 netif_tx_stop_queue(txq); 2434 netif_tx_stop_queue(txq);
2348} 2435}
2349 2436
@@ -2378,10 +2465,6 @@ static inline bool netif_subqueue_stopped(const struct net_device *dev,
2378static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index) 2465static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
2379{ 2466{
2380 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index); 2467 struct netdev_queue *txq = netdev_get_tx_queue(dev, queue_index);
2381#ifdef CONFIG_NETPOLL_TRAP
2382 if (netpoll_trap())
2383 return;
2384#endif
2385 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state)) 2468 if (test_and_clear_bit(__QUEUE_STATE_DRV_XOFF, &txq->state))
2386 __netif_schedule(txq->qdisc); 2469 __netif_schedule(txq->qdisc);
2387} 2470}
@@ -2551,6 +2634,7 @@ int dev_get_phys_port_id(struct net_device *dev,
2551int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, 2634int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2552 struct netdev_queue *txq); 2635 struct netdev_queue *txq);
2553int dev_forward_skb(struct net_device *dev, struct sk_buff *skb); 2636int dev_forward_skb(struct net_device *dev, struct sk_buff *skb);
2637bool is_skb_forwardable(struct net_device *dev, struct sk_buff *skb);
2554 2638
2555extern int netdev_budget; 2639extern int netdev_budget;
2556 2640
@@ -2831,6 +2915,11 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
2831 } \ 2915 } \
2832} 2916}
2833 2917
2918#define HARD_TX_TRYLOCK(dev, txq) \
2919 (((dev->features & NETIF_F_LLTX) == 0) ? \
2920 __netif_tx_trylock(txq) : \
2921 true )
2922
2834#define HARD_TX_UNLOCK(dev, txq) { \ 2923#define HARD_TX_UNLOCK(dev, txq) { \
2835 if ((dev->features & NETIF_F_LLTX) == 0) { \ 2924 if ((dev->features & NETIF_F_LLTX) == 0) { \
2836 __netif_tx_unlock(txq); \ 2925 __netif_tx_unlock(txq); \
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 0c7d01eae56c..96afc29184be 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -39,11 +39,13 @@ enum ip_set_feature {
39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG), 39 IPSET_TYPE_NAME = (1 << IPSET_TYPE_NAME_FLAG),
40 IPSET_TYPE_IFACE_FLAG = 5, 40 IPSET_TYPE_IFACE_FLAG = 5,
41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG), 41 IPSET_TYPE_IFACE = (1 << IPSET_TYPE_IFACE_FLAG),
42 IPSET_TYPE_NOMATCH_FLAG = 6, 42 IPSET_TYPE_MARK_FLAG = 6,
43 IPSET_TYPE_MARK = (1 << IPSET_TYPE_MARK_FLAG),
44 IPSET_TYPE_NOMATCH_FLAG = 7,
43 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG), 45 IPSET_TYPE_NOMATCH = (1 << IPSET_TYPE_NOMATCH_FLAG),
44 /* Strictly speaking not a feature, but a flag for dumping: 46 /* Strictly speaking not a feature, but a flag for dumping:
45 * this settype must be dumped last */ 47 * this settype must be dumped last */
46 IPSET_DUMP_LAST_FLAG = 7, 48 IPSET_DUMP_LAST_FLAG = 8,
47 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG), 49 IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),
48}; 50};
49 51
@@ -63,6 +65,7 @@ enum ip_set_extension {
63#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT) 65#define SET_WITH_TIMEOUT(s) ((s)->extensions & IPSET_EXT_TIMEOUT)
64#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER) 66#define SET_WITH_COUNTER(s) ((s)->extensions & IPSET_EXT_COUNTER)
65#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT) 67#define SET_WITH_COMMENT(s) ((s)->extensions & IPSET_EXT_COMMENT)
68#define SET_WITH_FORCEADD(s) ((s)->flags & IPSET_CREATE_FLAG_FORCEADD)
66 69
67/* Extension id, in size order */ 70/* Extension id, in size order */
68enum ip_set_ext_id { 71enum ip_set_ext_id {
@@ -171,8 +174,6 @@ struct ip_set_type {
171 char name[IPSET_MAXNAMELEN]; 174 char name[IPSET_MAXNAMELEN];
172 /* Protocol version */ 175 /* Protocol version */
173 u8 protocol; 176 u8 protocol;
174 /* Set features to control swapping */
175 u8 features;
176 /* Set type dimension */ 177 /* Set type dimension */
177 u8 dimension; 178 u8 dimension;
178 /* 179 /*
@@ -182,6 +183,8 @@ struct ip_set_type {
182 u8 family; 183 u8 family;
183 /* Type revisions */ 184 /* Type revisions */
184 u8 revision_min, revision_max; 185 u8 revision_min, revision_max;
186 /* Set features to control swapping */
187 u16 features;
185 188
186 /* Create set */ 189 /* Create set */
187 int (*create)(struct net *net, struct ip_set *set, 190 int (*create)(struct net *net, struct ip_set *set,
@@ -217,6 +220,8 @@ struct ip_set {
217 u8 revision; 220 u8 revision;
218 /* Extensions */ 221 /* Extensions */
219 u8 extensions; 222 u8 extensions;
223 /* Create flags */
224 u8 flags;
220 /* Default timeout value, if enabled */ 225 /* Default timeout value, if enabled */
221 u32 timeout; 226 u32 timeout;
222 /* Element data size */ 227 /* Element data size */
@@ -251,6 +256,8 @@ ip_set_put_flags(struct sk_buff *skb, struct ip_set *set)
251 cadt_flags |= IPSET_FLAG_WITH_COUNTERS; 256 cadt_flags |= IPSET_FLAG_WITH_COUNTERS;
252 if (SET_WITH_COMMENT(set)) 257 if (SET_WITH_COMMENT(set))
253 cadt_flags |= IPSET_FLAG_WITH_COMMENT; 258 cadt_flags |= IPSET_FLAG_WITH_COMMENT;
259 if (SET_WITH_FORCEADD(set))
260 cadt_flags |= IPSET_FLAG_WITH_FORCEADD;
254 261
255 if (!cadt_flags) 262 if (!cadt_flags)
256 return 0; 263 return 0;
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 28c74367e900..e955d4730625 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -44,6 +44,27 @@ int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
44 44
45void nfnl_lock(__u8 subsys_id); 45void nfnl_lock(__u8 subsys_id);
46void nfnl_unlock(__u8 subsys_id); 46void nfnl_unlock(__u8 subsys_id);
47#ifdef CONFIG_PROVE_LOCKING
48int lockdep_nfnl_is_held(__u8 subsys_id);
49#else
50static inline int lockdep_nfnl_is_held(__u8 subsys_id)
51{
52 return 1;
53}
54#endif /* CONFIG_PROVE_LOCKING */
55
56/*
57 * nfnl_dereference - fetch RCU pointer when updates are prevented by subsys mutex
58 *
59 * @p: The pointer to read, prior to dereferencing
60 * @ss: The nfnetlink subsystem ID
61 *
62 * Return the value of the specified RCU-protected pointer, but omit
63 * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
64 * caller holds the NFNL subsystem mutex.
65 */
66#define nfnl_dereference(p, ss) \
67 rcu_dereference_protected(p, lockdep_nfnl_is_held(ss))
47 68
48#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 69#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
49 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 70 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index fbfdb9d8d3a7..b25ee9ffdbe6 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,27 +24,20 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
29 27
30 union inet_addr local_ip, remote_ip; 28 union inet_addr local_ip, remote_ip;
31 bool ipv6; 29 bool ipv6;
32 u16 local_port, remote_port; 30 u16 local_port, remote_port;
33 u8 remote_mac[ETH_ALEN]; 31 u8 remote_mac[ETH_ALEN];
34 32
35 struct list_head rx; /* rx_np list element */
36 struct work_struct cleanup_work; 33 struct work_struct cleanup_work;
37}; 34};
38 35
39struct netpoll_info { 36struct netpoll_info {
40 atomic_t refcnt; 37 atomic_t refcnt;
41 38
42 unsigned long rx_flags;
43 spinlock_t rx_lock;
44 struct semaphore dev_lock; 39 struct semaphore dev_lock;
45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
46 40
47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
48 struct sk_buff_head txq; 41 struct sk_buff_head txq;
49 42
50 struct delayed_work tx_work; 43 struct delayed_work tx_work;
@@ -54,24 +47,21 @@ struct netpoll_info {
54}; 47};
55 48
56#ifdef CONFIG_NETPOLL 49#ifdef CONFIG_NETPOLL
57extern void netpoll_rx_disable(struct net_device *dev); 50extern void netpoll_poll_disable(struct net_device *dev);
58extern void netpoll_rx_enable(struct net_device *dev); 51extern void netpoll_poll_enable(struct net_device *dev);
59#else 52#else
60static inline void netpoll_rx_disable(struct net_device *dev) { return; } 53static inline void netpoll_poll_disable(struct net_device *dev) { return; }
61static inline void netpoll_rx_enable(struct net_device *dev) { return; } 54static inline void netpoll_poll_enable(struct net_device *dev) { return; }
62#endif 55#endif
63 56
64void netpoll_send_udp(struct netpoll *np, const char *msg, int len); 57void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
65void netpoll_print_options(struct netpoll *np); 58void netpoll_print_options(struct netpoll *np);
66int netpoll_parse_options(struct netpoll *np, char *opt); 59int netpoll_parse_options(struct netpoll *np, char *opt);
67int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp); 60int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
68int netpoll_setup(struct netpoll *np); 61int netpoll_setup(struct netpoll *np);
69int netpoll_trap(void);
70void netpoll_set_trap(int trap);
71void __netpoll_cleanup(struct netpoll *np); 62void __netpoll_cleanup(struct netpoll *np);
72void __netpoll_free_async(struct netpoll *np); 63void __netpoll_free_async(struct netpoll *np);
73void netpoll_cleanup(struct netpoll *np); 64void netpoll_cleanup(struct netpoll *np);
74int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo);
75void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, 65void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
76 struct net_device *dev); 66 struct net_device *dev);
77static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) 67static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
@@ -82,46 +72,7 @@ static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
82 local_irq_restore(flags); 72 local_irq_restore(flags);
83} 73}
84 74
85
86
87#ifdef CONFIG_NETPOLL 75#ifdef CONFIG_NETPOLL
88static inline bool netpoll_rx_on(struct sk_buff *skb)
89{
90 struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
91
92 return npinfo && (!list_empty(&npinfo->rx_np) || npinfo->rx_flags);
93}
94
95static inline bool netpoll_rx(struct sk_buff *skb)
96{
97 struct netpoll_info *npinfo;
98 unsigned long flags;
99 bool ret = false;
100
101 local_irq_save(flags);
102
103 if (!netpoll_rx_on(skb))
104 goto out;
105
106 npinfo = rcu_dereference_bh(skb->dev->npinfo);
107 spin_lock(&npinfo->rx_lock);
108 /* check rx_flags again with the lock held */
109 if (npinfo->rx_flags && __netpoll_rx(skb, npinfo))
110 ret = true;
111 spin_unlock(&npinfo->rx_lock);
112
113out:
114 local_irq_restore(flags);
115 return ret;
116}
117
118static inline int netpoll_receive_skb(struct sk_buff *skb)
119{
120 if (!list_empty(&skb->dev->napi_list))
121 return netpoll_rx(skb);
122 return 0;
123}
124
125static inline void *netpoll_poll_lock(struct napi_struct *napi) 76static inline void *netpoll_poll_lock(struct napi_struct *napi)
126{ 77{
127 struct net_device *dev = napi->dev; 78 struct net_device *dev = napi->dev;
@@ -150,18 +101,6 @@ static inline bool netpoll_tx_running(struct net_device *dev)
150} 101}
151 102
152#else 103#else
153static inline bool netpoll_rx(struct sk_buff *skb)
154{
155 return false;
156}
157static inline bool netpoll_rx_on(struct sk_buff *skb)
158{
159 return false;
160}
161static inline int netpoll_receive_skb(struct sk_buff *skb)
162{
163 return 0;
164}
165static inline void *netpoll_poll_lock(struct napi_struct *napi) 104static inline void *netpoll_poll_lock(struct napi_struct *napi)
166{ 105{
167 return NULL; 106 return NULL;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 0ae5807480f4..fa6918b0f829 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -92,6 +92,7 @@ struct nfs_open_context {
92}; 92};
93 93
94struct nfs_open_dir_context { 94struct nfs_open_dir_context {
95 struct list_head list;
95 struct rpc_cred *cred; 96 struct rpc_cred *cred;
96 unsigned long attr_gencount; 97 unsigned long attr_gencount;
97 __u64 dir_cookie; 98 __u64 dir_cookie;
@@ -510,7 +511,6 @@ extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
510extern void nfs_wait_on_sillyrename(struct dentry *dentry); 511extern void nfs_wait_on_sillyrename(struct dentry *dentry);
511extern void nfs_block_sillyrename(struct dentry *dentry); 512extern void nfs_block_sillyrename(struct dentry *dentry);
512extern void nfs_unblock_sillyrename(struct dentry *dentry); 513extern void nfs_unblock_sillyrename(struct dentry *dentry);
513extern int nfs_sillyrename(struct inode *dir, struct dentry *dentry);
514 514
515/* 515/*
516 * linux/fs/nfs/write.c 516 * linux/fs/nfs/write.c
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 5624e4e2763c..6fb5b2335b59 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1402,6 +1402,7 @@ struct nfs_renamedata {
1402 struct inode *new_dir; 1402 struct inode *new_dir;
1403 struct dentry *new_dentry; 1403 struct dentry *new_dentry;
1404 struct nfs_fattr new_fattr; 1404 struct nfs_fattr new_fattr;
1405 void (*complete)(struct rpc_task *, struct nfs_renamedata *);
1405}; 1406};
1406 1407
1407struct nfs_access_entry; 1408struct nfs_access_entry;
@@ -1444,8 +1445,6 @@ struct nfs_rpc_ops {
1444 void (*unlink_setup) (struct rpc_message *, struct inode *dir); 1445 void (*unlink_setup) (struct rpc_message *, struct inode *dir);
1445 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *); 1446 void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
1446 int (*unlink_done) (struct rpc_task *, struct inode *); 1447 int (*unlink_done) (struct rpc_task *, struct inode *);
1447 int (*rename) (struct inode *, struct qstr *,
1448 struct inode *, struct qstr *);
1449 void (*rename_setup) (struct rpc_message *msg, struct inode *dir); 1448 void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
1450 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *); 1449 void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
1451 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir); 1450 int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 98755767c7b0..ff3fea3194c6 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -82,6 +82,8 @@ struct nilfs_inode {
82 __le32 i_pad; 82 __le32 i_pad;
83}; 83};
84 84
85#define NILFS_MIN_INODE_SIZE 128
86
85/** 87/**
86 * struct nilfs_super_root - structure of super root 88 * struct nilfs_super_root - structure of super root
87 * @sr_sum: check sum 89 * @sr_sum: check sum
@@ -482,6 +484,8 @@ struct nilfs_dat_entry {
482 __le64 de_rsv; 484 __le64 de_rsv;
483}; 485};
484 486
487#define NILFS_MIN_DAT_ENTRY_SIZE 32
488
485/** 489/**
486 * struct nilfs_snapshot_list - snapshot list 490 * struct nilfs_snapshot_list - snapshot list
487 * @ssl_next: next checkpoint number on snapshot list 491 * @ssl_next: next checkpoint number on snapshot list
@@ -520,6 +524,8 @@ struct nilfs_checkpoint {
520 struct nilfs_inode cp_ifile_inode; 524 struct nilfs_inode cp_ifile_inode;
521}; 525};
522 526
527#define NILFS_MIN_CHECKPOINT_SIZE (64 + NILFS_MIN_INODE_SIZE)
528
523/* checkpoint flags */ 529/* checkpoint flags */
524enum { 530enum {
525 NILFS_CHECKPOINT_SNAPSHOT, 531 NILFS_CHECKPOINT_SNAPSHOT,
@@ -615,6 +621,8 @@ struct nilfs_segment_usage {
615 __le32 su_flags; 621 __le32 su_flags;
616}; 622};
617 623
624#define NILFS_MIN_SEGMENT_USAGE_SIZE 16
625
618/* segment usage flag */ 626/* segment usage flag */
619enum { 627enum {
620 NILFS_SEGMENT_USAGE_ACTIVE, 628 NILFS_SEGMENT_USAGE_ACTIVE,
@@ -710,6 +718,48 @@ static inline int nilfs_suinfo_clean(const struct nilfs_suinfo *si)
710} 718}
711 719
712/* ioctl */ 720/* ioctl */
721/**
722 * nilfs_suinfo_update - segment usage information update
723 * @sup_segnum: segment number
724 * @sup_flags: flags for which fields are active in sup_sui
725 * @sup_reserved: reserved necessary for alignment
726 * @sup_sui: segment usage information
727 */
728struct nilfs_suinfo_update {
729 __u64 sup_segnum;
730 __u32 sup_flags;
731 __u32 sup_reserved;
732 struct nilfs_suinfo sup_sui;
733};
734
735enum {
736 NILFS_SUINFO_UPDATE_LASTMOD,
737 NILFS_SUINFO_UPDATE_NBLOCKS,
738 NILFS_SUINFO_UPDATE_FLAGS,
739 __NR_NILFS_SUINFO_UPDATE_FIELDS,
740};
741
742#define NILFS_SUINFO_UPDATE_FNS(flag, name) \
743static inline void \
744nilfs_suinfo_update_set_##name(struct nilfs_suinfo_update *sup) \
745{ \
746 sup->sup_flags |= 1UL << NILFS_SUINFO_UPDATE_##flag; \
747} \
748static inline void \
749nilfs_suinfo_update_clear_##name(struct nilfs_suinfo_update *sup) \
750{ \
751 sup->sup_flags &= ~(1UL << NILFS_SUINFO_UPDATE_##flag); \
752} \
753static inline int \
754nilfs_suinfo_update_##name(const struct nilfs_suinfo_update *sup) \
755{ \
756 return !!(sup->sup_flags & (1UL << NILFS_SUINFO_UPDATE_##flag));\
757}
758
759NILFS_SUINFO_UPDATE_FNS(LASTMOD, lastmod)
760NILFS_SUINFO_UPDATE_FNS(NBLOCKS, nblocks)
761NILFS_SUINFO_UPDATE_FNS(FLAGS, flags)
762
713enum { 763enum {
714 NILFS_CHECKPOINT, 764 NILFS_CHECKPOINT,
715 NILFS_SNAPSHOT, 765 NILFS_SNAPSHOT,
@@ -863,5 +913,7 @@ struct nilfs_bdesc {
863 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64) 913 _IOW(NILFS_IOCTL_IDENT, 0x8B, __u64)
864#define NILFS_IOCTL_SET_ALLOC_RANGE \ 914#define NILFS_IOCTL_SET_ALLOC_RANGE \
865 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2]) 915 _IOW(NILFS_IOCTL_IDENT, 0x8C, __u64[2])
916#define NILFS_IOCTL_SET_SUINFO \
917 _IOW(NILFS_IOCTL_IDENT, 0x8D, struct nilfs_argv)
866 918
867#endif /* _LINUX_NILFS_FS_H */ 919#endif /* _LINUX_NILFS_FS_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
index fd4f2d1cdf6c..c8d7f3965fff 100644
--- a/include/linux/nl802154.h
+++ b/include/linux/nl802154.h
@@ -70,6 +70,16 @@ enum {
70 IEEE802154_ATTR_PHY_NAME, 70 IEEE802154_ATTR_PHY_NAME,
71 IEEE802154_ATTR_DEV_TYPE, 71 IEEE802154_ATTR_DEV_TYPE,
72 72
73 IEEE802154_ATTR_TXPOWER,
74 IEEE802154_ATTR_LBT_ENABLED,
75 IEEE802154_ATTR_CCA_MODE,
76 IEEE802154_ATTR_CCA_ED_LEVEL,
77 IEEE802154_ATTR_CSMA_RETRIES,
78 IEEE802154_ATTR_CSMA_MIN_BE,
79 IEEE802154_ATTR_CSMA_MAX_BE,
80
81 IEEE802154_ATTR_FRAME_RETRIES,
82
73 __IEEE802154_ATTR_MAX, 83 __IEEE802154_ATTR_MAX,
74}; 84};
75 85
@@ -122,6 +132,8 @@ enum {
122 IEEE802154_ADD_IFACE, 132 IEEE802154_ADD_IFACE,
123 IEEE802154_DEL_IFACE, 133 IEEE802154_DEL_IFACE,
124 134
135 IEEE802154_SET_MACPARAMS,
136
125 __IEEE802154_CMD_MAX, 137 __IEEE802154_CMD_MAX,
126}; 138};
127 139
diff --git a/include/linux/ntb.h b/include/linux/ntb.h
index f6a15205853b..9ac1a62fc6f5 100644
--- a/include/linux/ntb.h
+++ b/include/linux/ntb.h
@@ -50,8 +50,13 @@ struct ntb_transport_qp;
50 50
51struct ntb_client { 51struct ntb_client {
52 struct device_driver driver; 52 struct device_driver driver;
53 int (*probe) (struct pci_dev *pdev); 53 int (*probe)(struct pci_dev *pdev);
54 void (*remove) (struct pci_dev *pdev); 54 void (*remove)(struct pci_dev *pdev);
55};
56
57enum {
58 NTB_LINK_DOWN = 0,
59 NTB_LINK_UP,
55}; 60};
56 61
57int ntb_register_client(struct ntb_client *drvr); 62int ntb_register_client(struct ntb_client *drvr);
@@ -60,11 +65,11 @@ int ntb_register_client_dev(char *device_name);
60void ntb_unregister_client_dev(char *device_name); 65void ntb_unregister_client_dev(char *device_name);
61 66
62struct ntb_queue_handlers { 67struct ntb_queue_handlers {
63 void (*rx_handler) (struct ntb_transport_qp *qp, void *qp_data, 68 void (*rx_handler)(struct ntb_transport_qp *qp, void *qp_data,
64 void *data, int len); 69 void *data, int len);
65 void (*tx_handler) (struct ntb_transport_qp *qp, void *qp_data, 70 void (*tx_handler)(struct ntb_transport_qp *qp, void *qp_data,
66 void *data, int len); 71 void *data, int len);
67 void (*event_handler) (void *data, int status); 72 void (*event_handler)(void *data, int status);
68}; 73};
69 74
70unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp); 75unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index 6b9aafed225f..a50173ca1d72 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -66,20 +66,25 @@ enum {
66 66
67#define NVME_VS(major, minor) (major << 16 | minor) 67#define NVME_VS(major, minor) (major << 16 | minor)
68 68
69#define NVME_IO_TIMEOUT (5 * HZ) 69extern unsigned char io_timeout;
70#define NVME_IO_TIMEOUT (io_timeout * HZ)
70 71
71/* 72/*
72 * Represents an NVM Express device. Each nvme_dev is a PCI function. 73 * Represents an NVM Express device. Each nvme_dev is a PCI function.
73 */ 74 */
74struct nvme_dev { 75struct nvme_dev {
75 struct list_head node; 76 struct list_head node;
76 struct nvme_queue **queues; 77 struct nvme_queue __rcu **queues;
78 unsigned short __percpu *io_queue;
77 u32 __iomem *dbs; 79 u32 __iomem *dbs;
78 struct pci_dev *pci_dev; 80 struct pci_dev *pci_dev;
79 struct dma_pool *prp_page_pool; 81 struct dma_pool *prp_page_pool;
80 struct dma_pool *prp_small_pool; 82 struct dma_pool *prp_small_pool;
81 int instance; 83 int instance;
82 int queue_count; 84 unsigned queue_count;
85 unsigned online_queues;
86 unsigned max_qid;
87 int q_depth;
83 u32 db_stride; 88 u32 db_stride;
84 u32 ctrl_config; 89 u32 ctrl_config;
85 struct msix_entry *entry; 90 struct msix_entry *entry;
@@ -89,6 +94,7 @@ struct nvme_dev {
89 struct miscdevice miscdev; 94 struct miscdevice miscdev;
90 work_func_t reset_workfn; 95 work_func_t reset_workfn;
91 struct work_struct reset_work; 96 struct work_struct reset_work;
97 struct notifier_block nb;
92 char name[12]; 98 char name[12];
93 char serial[20]; 99 char serial[20];
94 char model[40]; 100 char model[40];
@@ -131,6 +137,7 @@ struct nvme_iod {
131 int length; /* Of data, in bytes */ 137 int length; /* Of data, in bytes */
132 unsigned long start_time; 138 unsigned long start_time;
133 dma_addr_t first_dma; 139 dma_addr_t first_dma;
140 struct list_head node;
134 struct scatterlist sg[0]; 141 struct scatterlist sg[0];
135}; 142};
136 143
@@ -146,16 +153,12 @@ static inline u64 nvme_block_nr(struct nvme_ns *ns, sector_t sector)
146 */ 153 */
147void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod); 154void nvme_free_iod(struct nvme_dev *dev, struct nvme_iod *iod);
148 155
149int nvme_setup_prps(struct nvme_dev *dev, struct nvme_common_command *cmd, 156int nvme_setup_prps(struct nvme_dev *, struct nvme_iod *, int , gfp_t);
150 struct nvme_iod *iod, int total_len, gfp_t gfp);
151struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, 157struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write,
152 unsigned long addr, unsigned length); 158 unsigned long addr, unsigned length);
153void nvme_unmap_user_pages(struct nvme_dev *dev, int write, 159void nvme_unmap_user_pages(struct nvme_dev *dev, int write,
154 struct nvme_iod *iod); 160 struct nvme_iod *iod);
155struct nvme_queue *get_nvmeq(struct nvme_dev *dev); 161int nvme_submit_io_cmd(struct nvme_dev *, struct nvme_command *, u32 *);
156void put_nvmeq(struct nvme_queue *nvmeq);
157int nvme_submit_sync_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd,
158 u32 *result, unsigned timeout);
159int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns); 162int nvme_submit_flush_data(struct nvme_queue *nvmeq, struct nvme_ns *ns);
160int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *, 163int nvme_submit_admin_cmd(struct nvme_dev *, struct nvme_command *,
161 u32 *result); 164 u32 *result);
diff --git a/include/linux/of.h b/include/linux/of.h
index 435cb995904d..919bf211877d 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -18,7 +18,7 @@
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/kref.h> 21#include <linux/kobject.h>
22#include <linux/mod_devicetable.h> 22#include <linux/mod_devicetable.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
@@ -37,6 +37,7 @@ struct property {
37 struct property *next; 37 struct property *next;
38 unsigned long _flags; 38 unsigned long _flags;
39 unsigned int unique_id; 39 unsigned int unique_id;
40 struct bin_attribute attr;
40}; 41};
41 42
42#if defined(CONFIG_SPARC) 43#if defined(CONFIG_SPARC)
@@ -56,8 +57,7 @@ struct device_node {
56 struct device_node *sibling; 57 struct device_node *sibling;
57 struct device_node *next; /* next device of same type */ 58 struct device_node *next; /* next device of same type */
58 struct device_node *allnext; /* next in list of all nodes */ 59 struct device_node *allnext; /* next in list of all nodes */
59 struct proc_dir_entry *pde; /* this node's proc directory */ 60 struct kobject kobj;
60 struct kref kref;
61 unsigned long _flags; 61 unsigned long _flags;
62 void *data; 62 void *data;
63#if defined(CONFIG_SPARC) 63#if defined(CONFIG_SPARC)
@@ -67,13 +67,34 @@ struct device_node {
67#endif 67#endif
68}; 68};
69 69
70#define MAX_PHANDLE_ARGS 8 70#define MAX_PHANDLE_ARGS 16
71struct of_phandle_args { 71struct of_phandle_args {
72 struct device_node *np; 72 struct device_node *np;
73 int args_count; 73 int args_count;
74 uint32_t args[MAX_PHANDLE_ARGS]; 74 uint32_t args[MAX_PHANDLE_ARGS];
75}; 75};
76 76
77extern int of_node_add(struct device_node *node);
78
79/* initialize a node */
80extern struct kobj_type of_node_ktype;
81static inline void of_node_init(struct device_node *node)
82{
83 kobject_init(&node->kobj, &of_node_ktype);
84}
85
86/* true when node is initialized */
87static inline int of_node_is_initialized(struct device_node *node)
88{
89 return node && node->kobj.state_initialized;
90}
91
92/* true when node is attached (i.e. present on sysfs) */
93static inline int of_node_is_attached(struct device_node *node)
94{
95 return node && node->kobj.state_in_sysfs;
96}
97
77#ifdef CONFIG_OF_DYNAMIC 98#ifdef CONFIG_OF_DYNAMIC
78extern struct device_node *of_node_get(struct device_node *node); 99extern struct device_node *of_node_get(struct device_node *node);
79extern void of_node_put(struct device_node *node); 100extern void of_node_put(struct device_node *node);
@@ -114,6 +135,26 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
114 set_bit(flag, &n->_flags); 135 set_bit(flag, &n->_flags);
115} 136}
116 137
138static inline void of_node_clear_flag(struct device_node *n, unsigned long flag)
139{
140 clear_bit(flag, &n->_flags);
141}
142
143static inline int of_property_check_flag(struct property *p, unsigned long flag)
144{
145 return test_bit(flag, &p->_flags);
146}
147
148static inline void of_property_set_flag(struct property *p, unsigned long flag)
149{
150 set_bit(flag, &p->_flags);
151}
152
153static inline void of_property_clear_flag(struct property *p, unsigned long flag)
154{
155 clear_bit(flag, &p->_flags);
156}
157
117extern struct device_node *of_find_all_nodes(struct device_node *prev); 158extern struct device_node *of_find_all_nodes(struct device_node *prev);
118 159
119/* 160/*
@@ -167,6 +208,8 @@ static inline const char *of_node_full_name(const struct device_node *np)
167 return np ? np->full_name : "<no-node>"; 208 return np ? np->full_name : "<no-node>";
168} 209}
169 210
211#define for_each_of_allnodes(dn) \
212 for (dn = of_allnodes; dn; dn = dn->allnext)
170extern struct device_node *of_find_node_by_name(struct device_node *from, 213extern struct device_node *of_find_node_by_name(struct device_node *from,
171 const char *name); 214 const char *name);
172extern struct device_node *of_find_node_by_type(struct device_node *from, 215extern struct device_node *of_find_node_by_type(struct device_node *from,
@@ -198,6 +241,8 @@ extern struct device_node *of_find_node_with_property(
198extern struct property *of_find_property(const struct device_node *np, 241extern struct property *of_find_property(const struct device_node *np,
199 const char *name, 242 const char *name,
200 int *lenp); 243 int *lenp);
244extern int of_property_count_elems_of_size(const struct device_node *np,
245 const char *propname, int elem_size);
201extern int of_property_read_u32_index(const struct device_node *np, 246extern int of_property_read_u32_index(const struct device_node *np,
202 const char *propname, 247 const char *propname,
203 u32 index, u32 *out_value); 248 u32 index, u32 *out_value);
@@ -390,6 +435,12 @@ static inline struct device_node *of_find_compatible_node(
390 return NULL; 435 return NULL;
391} 436}
392 437
438static inline int of_property_count_elems_of_size(const struct device_node *np,
439 const char *propname, int elem_size)
440{
441 return -ENOSYS;
442}
443
393static inline int of_property_read_u32_index(const struct device_node *np, 444static inline int of_property_read_u32_index(const struct device_node *np,
394 const char *propname, u32 index, u32 *out_value) 445 const char *propname, u32 index, u32 *out_value)
395{ 446{
@@ -536,6 +587,74 @@ static inline struct device_node *of_find_matching_node(
536} 587}
537 588
538/** 589/**
590 * of_property_count_u8_elems - Count the number of u8 elements in a property
591 *
592 * @np: device node from which the property value is to be read.
593 * @propname: name of the property to be searched.
594 *
595 * Search for a property in a device node and count the number of u8 elements
596 * in it. Returns number of elements on sucess, -EINVAL if the property does
597 * not exist or its length does not match a multiple of u8 and -ENODATA if the
598 * property does not have a value.
599 */
600static inline int of_property_count_u8_elems(const struct device_node *np,
601 const char *propname)
602{
603 return of_property_count_elems_of_size(np, propname, sizeof(u8));
604}
605
606/**
607 * of_property_count_u16_elems - Count the number of u16 elements in a property
608 *
609 * @np: device node from which the property value is to be read.
610 * @propname: name of the property to be searched.
611 *
612 * Search for a property in a device node and count the number of u16 elements
613 * in it. Returns number of elements on sucess, -EINVAL if the property does
614 * not exist or its length does not match a multiple of u16 and -ENODATA if the
615 * property does not have a value.
616 */
617static inline int of_property_count_u16_elems(const struct device_node *np,
618 const char *propname)
619{
620 return of_property_count_elems_of_size(np, propname, sizeof(u16));
621}
622
623/**
624 * of_property_count_u32_elems - Count the number of u32 elements in a property
625 *
626 * @np: device node from which the property value is to be read.
627 * @propname: name of the property to be searched.
628 *
629 * Search for a property in a device node and count the number of u32 elements
630 * in it. Returns number of elements on sucess, -EINVAL if the property does
631 * not exist or its length does not match a multiple of u32 and -ENODATA if the
632 * property does not have a value.
633 */
634static inline int of_property_count_u32_elems(const struct device_node *np,
635 const char *propname)
636{
637 return of_property_count_elems_of_size(np, propname, sizeof(u32));
638}
639
640/**
641 * of_property_count_u64_elems - Count the number of u64 elements in a property
642 *
643 * @np: device node from which the property value is to be read.
644 * @propname: name of the property to be searched.
645 *
646 * Search for a property in a device node and count the number of u64 elements
647 * in it. Returns number of elements on sucess, -EINVAL if the property does
648 * not exist or its length does not match a multiple of u64 and -ENODATA if the
649 * property does not have a value.
650 */
651static inline int of_property_count_u64_elems(const struct device_node *np,
652 const char *propname)
653{
654 return of_property_count_elems_of_size(np, propname, sizeof(u64));
655}
656
657/**
539 * of_property_read_bool - Findfrom a property 658 * of_property_read_bool - Findfrom a property
540 * @np: device node from which the property value is to be read. 659 * @np: device node from which the property value is to be read.
541 * @propname: name of the property to be searched. 660 * @propname: name of the property to be searched.
@@ -633,14 +752,4 @@ static inline int of_get_available_child_count(const struct device_node *np)
633 return num; 752 return num;
634} 753}
635 754
636#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE)
637extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *);
638extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop);
639extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde,
640 struct property *prop);
641extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
642 struct property *newprop,
643 struct property *oldprop);
644#endif
645
646#endif /* _LINUX_OF_H */ 755#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 2b77058a7335..ddd7219af8ac 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -98,7 +98,10 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 98 int depth, void *data);
99extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 99extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
100 int depth, void *data); 100 int depth, void *data);
101extern void early_init_fdt_scan_reserved_mem(void);
101extern void early_init_dt_add_memory_arch(u64 base, u64 size); 102extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
104 bool no_map);
102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 105extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
103extern u64 dt_mem_next_cell(int s, __be32 **cellp); 106extern u64 dt_mem_next_cell(int s, __be32 **cellp);
104 107
@@ -118,6 +121,7 @@ extern void unflatten_and_copy_device_tree(void);
118extern void early_init_devtree(void *); 121extern void early_init_devtree(void *);
119extern void early_get_first_memblock_info(void *, phys_addr_t *); 122extern void early_get_first_memblock_info(void *, phys_addr_t *);
120#else /* CONFIG_OF_FLATTREE */ 123#else /* CONFIG_OF_FLATTREE */
124static inline void early_init_fdt_scan_reserved_mem(void) {}
121static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 125static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
122static inline void unflatten_device_tree(void) {} 126static inline void unflatten_device_tree(void) {}
123static inline void unflatten_and_copy_device_tree(void) {} 127static inline void unflatten_and_copy_device_tree(void) {}
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
new file mode 100644
index 000000000000..befef42e015b
--- /dev/null
+++ b/include/linux/of_graph.h
@@ -0,0 +1,66 @@
1/*
2 * OF graph binding parsing helpers
3 *
4 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
5 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 *
7 * Copyright (C) 2012 Renesas Electronics Corp.
8 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 */
14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H
16
17/**
18 * struct of_endpoint - the OF graph endpoint data structure
19 * @port: identifier (value of reg property) of a port this endpoint belongs to
20 * @id: identifier (value of reg property) of this endpoint
21 * @local_node: pointer to device_node of this endpoint
22 */
23struct of_endpoint {
24 unsigned int port;
25 unsigned int id;
26 const struct device_node *local_node;
27};
28
29#ifdef CONFIG_OF
30int of_graph_parse_endpoint(const struct device_node *node,
31 struct of_endpoint *endpoint);
32struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
33 struct device_node *previous);
34struct device_node *of_graph_get_remote_port_parent(
35 const struct device_node *node);
36struct device_node *of_graph_get_remote_port(const struct device_node *node);
37#else
38
39static inline int of_graph_parse_endpoint(const struct device_node *node,
40 struct of_endpoint *endpoint)
41{
42 return -ENOSYS;
43}
44
45static inline struct device_node *of_graph_get_next_endpoint(
46 const struct device_node *parent,
47 struct device_node *previous)
48{
49 return NULL;
50}
51
52static inline struct device_node *of_graph_get_remote_port_parent(
53 const struct device_node *node)
54{
55 return NULL;
56}
57
58static inline struct device_node *of_graph_get_remote_port(
59 const struct device_node *node)
60{
61 return NULL;
62}
63
64#endif /* CONFIG_OF */
65
66#endif /* __LINUX_OF_GRAPH_H */
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
index cb32d9c1e8dc..e266caa36402 100644
--- a/include/linux/of_mtd.h
+++ b/include/linux/of_mtd.h
@@ -13,6 +13,8 @@
13 13
14#include <linux/of.h> 14#include <linux/of.h>
15int of_get_nand_ecc_mode(struct device_node *np); 15int of_get_nand_ecc_mode(struct device_node *np);
16int of_get_nand_ecc_step_size(struct device_node *np);
17int of_get_nand_ecc_strength(struct device_node *np);
16int of_get_nand_bus_width(struct device_node *np); 18int of_get_nand_bus_width(struct device_node *np);
17bool of_get_nand_on_flash_bbt(struct device_node *np); 19bool of_get_nand_on_flash_bbt(struct device_node *np);
18 20
@@ -23,6 +25,16 @@ static inline int of_get_nand_ecc_mode(struct device_node *np)
23 return -ENOSYS; 25 return -ENOSYS;
24} 26}
25 27
28static inline int of_get_nand_ecc_step_size(struct device_node *np)
29{
30 return -ENOSYS;
31}
32
33static inline int of_get_nand_ecc_strength(struct device_node *np)
34{
35 return -ENOSYS;
36}
37
26static inline int of_get_nand_bus_width(struct device_node *np) 38static inline int of_get_nand_bus_width(struct device_node *np)
27{ 39{
28 return -ENOSYS; 40 return -ENOSYS;
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
new file mode 100644
index 000000000000..9b1fbb7f29fc
--- /dev/null
+++ b/include/linux/of_reserved_mem.h
@@ -0,0 +1,53 @@
1#ifndef __OF_RESERVED_MEM_H
2#define __OF_RESERVED_MEM_H
3
4struct device;
5struct of_phandle_args;
6struct reserved_mem_ops;
7
8struct reserved_mem {
9 const char *name;
10 unsigned long fdt_node;
11 const struct reserved_mem_ops *ops;
12 phys_addr_t base;
13 phys_addr_t size;
14 void *priv;
15};
16
17struct reserved_mem_ops {
18 void (*device_init)(struct reserved_mem *rmem,
19 struct device *dev);
20 void (*device_release)(struct reserved_mem *rmem,
21 struct device *dev);
22};
23
24typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
25 unsigned long node, const char *uname);
26
27#ifdef CONFIG_OF_RESERVED_MEM
28void fdt_init_reserved_mem(void);
29void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
30 phys_addr_t base, phys_addr_t size);
31
32#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
33 static const struct of_device_id __reservedmem_of_table_##name \
34 __used __section(__reservedmem_of_table) \
35 = { .compatible = compat, \
36 .data = (init == (reservedmem_of_init_fn)NULL) ? \
37 init : init }
38
39#else
40static inline void fdt_init_reserved_mem(void) { }
41static inline void fdt_reserved_mem_save_node(unsigned long node,
42 const char *uname, phys_addr_t base, phys_addr_t size) { }
43
44#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
45 static const struct of_device_id __reservedmem_of_table_##name \
46 __attribute__((unused)) \
47 = { .compatible = compat, \
48 .data = (init == (reservedmem_of_init_fn)NULL) ? \
49 init : init }
50
51#endif
52
53#endif /* __OF_RESERVED_MEM_H */
diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h
index 7af25a9c9c51..41a13e70f41f 100644
--- a/include/linux/omap-dma.h
+++ b/include/linux/omap-dma.h
@@ -268,14 +268,27 @@ struct omap_dma_dev_attr {
268 u32 dev_caps; 268 u32 dev_caps;
269 u16 lch_count; 269 u16 lch_count;
270 u16 chan_count; 270 u16 chan_count;
271 struct omap_dma_lch *chan; 271};
272
273enum {
274 OMAP_DMA_REG_NONE,
275 OMAP_DMA_REG_16BIT,
276 OMAP_DMA_REG_2X16BIT,
277 OMAP_DMA_REG_32BIT,
278};
279
280struct omap_dma_reg {
281 u16 offset;
282 u8 stride;
283 u8 type;
272}; 284};
273 285
274/* System DMA platform data structure */ 286/* System DMA platform data structure */
275struct omap_system_dma_plat_info { 287struct omap_system_dma_plat_info {
288 const struct omap_dma_reg *reg_map;
289 unsigned channel_stride;
276 struct omap_dma_dev_attr *dma_attr; 290 struct omap_dma_dev_attr *dma_attr;
277 u32 errata; 291 u32 errata;
278 void (*disable_irq_lch)(int lch);
279 void (*show_dma_caps)(void); 292 void (*show_dma_caps)(void);
280 void (*clear_lch_regs)(int lch); 293 void (*clear_lch_regs)(int lch);
281 void (*clear_dma)(int lch); 294 void (*clear_dma)(int lch);
@@ -289,8 +302,12 @@ struct omap_system_dma_plat_info {
289#define dma_omap2plus() 0 302#define dma_omap2plus() 0
290#endif 303#endif
291#define dma_omap1() (!dma_omap2plus()) 304#define dma_omap1() (!dma_omap2plus())
292#define dma_omap15xx() ((dma_omap1() && (d->dev_caps & ENABLE_1510_MODE))) 305#define __dma_omap15xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_1510_MODE)
293#define dma_omap16xx() ((dma_omap1() && (d->dev_caps & ENABLE_16XX_MODE))) 306#define __dma_omap16xx(d) (dma_omap1() && (d)->dev_caps & ENABLE_16XX_MODE)
307#define dma_omap15xx() __dma_omap15xx(d)
308#define dma_omap16xx() __dma_omap16xx(d)
309
310extern struct omap_system_dma_plat_info *omap_get_plat_info(void);
294 311
295extern void omap_set_dma_priority(int lch, int dst_port, int priority); 312extern void omap_set_dma_priority(int lch, int dst_port, int priority);
296extern int omap_request_dma(int dev_id, const char *dev_name, 313extern int omap_request_dma(int dev_id, const char *dev_name,
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 1710d1b060ba..45598f1e9aa3 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -25,6 +25,7 @@ enum mapping_flags {
25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */ 25 AS_MM_ALL_LOCKS = __GFP_BITS_SHIFT + 2, /* under mm_take_all_locks() */
26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */ 26 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */ 27 AS_BALLOON_MAP = __GFP_BITS_SHIFT + 4, /* balloon page special map */
28 AS_EXITING = __GFP_BITS_SHIFT + 5, /* final truncate in progress */
28}; 29};
29 30
30static inline void mapping_set_error(struct address_space *mapping, int error) 31static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -69,6 +70,16 @@ static inline int mapping_balloon(struct address_space *mapping)
69 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags); 70 return mapping && test_bit(AS_BALLOON_MAP, &mapping->flags);
70} 71}
71 72
73static inline void mapping_set_exiting(struct address_space *mapping)
74{
75 set_bit(AS_EXITING, &mapping->flags);
76}
77
78static inline int mapping_exiting(struct address_space *mapping)
79{
80 return test_bit(AS_EXITING, &mapping->flags);
81}
82
72static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 83static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
73{ 84{
74 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK; 85 return (__force gfp_t)mapping->flags & __GFP_BITS_MASK;
@@ -243,12 +254,20 @@ static inline struct page *page_cache_alloc_readahead(struct address_space *x)
243 254
244typedef int filler_t(void *, struct page *); 255typedef int filler_t(void *, struct page *);
245 256
246extern struct page * find_get_page(struct address_space *mapping, 257pgoff_t page_cache_next_hole(struct address_space *mapping,
247 pgoff_t index); 258 pgoff_t index, unsigned long max_scan);
248extern struct page * find_lock_page(struct address_space *mapping, 259pgoff_t page_cache_prev_hole(struct address_space *mapping,
249 pgoff_t index); 260 pgoff_t index, unsigned long max_scan);
250extern struct page * find_or_create_page(struct address_space *mapping, 261
251 pgoff_t index, gfp_t gfp_mask); 262struct page *find_get_entry(struct address_space *mapping, pgoff_t offset);
263struct page *find_get_page(struct address_space *mapping, pgoff_t offset);
264struct page *find_lock_entry(struct address_space *mapping, pgoff_t offset);
265struct page *find_lock_page(struct address_space *mapping, pgoff_t offset);
266struct page *find_or_create_page(struct address_space *mapping, pgoff_t index,
267 gfp_t gfp_mask);
268unsigned find_get_entries(struct address_space *mapping, pgoff_t start,
269 unsigned int nr_entries, struct page **entries,
270 pgoff_t *indices);
252unsigned find_get_pages(struct address_space *mapping, pgoff_t start, 271unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
253 unsigned int nr_pages, struct page **pages); 272 unsigned int nr_pages, struct page **pages);
254unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start, 273unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
@@ -270,8 +289,6 @@ static inline struct page *grab_cache_page(struct address_space *mapping,
270 289
271extern struct page * grab_cache_page_nowait(struct address_space *mapping, 290extern struct page * grab_cache_page_nowait(struct address_space *mapping,
272 pgoff_t index); 291 pgoff_t index);
273extern struct page * read_cache_page_async(struct address_space *mapping,
274 pgoff_t index, filler_t *filler, void *data);
275extern struct page * read_cache_page(struct address_space *mapping, 292extern struct page * read_cache_page(struct address_space *mapping,
276 pgoff_t index, filler_t *filler, void *data); 293 pgoff_t index, filler_t *filler, void *data);
277extern struct page * read_cache_page_gfp(struct address_space *mapping, 294extern struct page * read_cache_page_gfp(struct address_space *mapping,
@@ -279,14 +296,6 @@ extern struct page * read_cache_page_gfp(struct address_space *mapping,
279extern int read_cache_pages(struct address_space *mapping, 296extern int read_cache_pages(struct address_space *mapping,
280 struct list_head *pages, filler_t *filler, void *data); 297 struct list_head *pages, filler_t *filler, void *data);
281 298
282static inline struct page *read_mapping_page_async(
283 struct address_space *mapping,
284 pgoff_t index, void *data)
285{
286 filler_t *filler = (filler_t *)mapping->a_ops->readpage;
287 return read_cache_page_async(mapping, index, filler, data);
288}
289
290static inline struct page *read_mapping_page(struct address_space *mapping, 299static inline struct page *read_mapping_page(struct address_space *mapping,
291 pgoff_t index, void *data) 300 pgoff_t index, void *data)
292{ 301{
@@ -539,7 +548,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
539int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 548int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
540 pgoff_t index, gfp_t gfp_mask); 549 pgoff_t index, gfp_t gfp_mask);
541extern void delete_from_page_cache(struct page *page); 550extern void delete_from_page_cache(struct page *page);
542extern void __delete_from_page_cache(struct page *page); 551extern void __delete_from_page_cache(struct page *page, void *shadow);
543int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask); 552int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask);
544 553
545/* 554/*
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index e4dbfab37729..b45d391b4540 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -22,6 +22,11 @@ struct pagevec {
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_lru_add(struct pagevec *pvec); 24void __pagevec_lru_add(struct pagevec *pvec);
25unsigned pagevec_lookup_entries(struct pagevec *pvec,
26 struct address_space *mapping,
27 pgoff_t start, unsigned nr_entries,
28 pgoff_t *indices);
29void pagevec_remove_exceptionals(struct pagevec *pvec);
25unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping, 30unsigned pagevec_lookup(struct pagevec *pvec, struct address_space *mapping,
26 pgoff_t start, unsigned nr_pages); 31 pgoff_t start, unsigned nr_pages);
27unsigned pagevec_lookup_tag(struct pagevec *pvec, 32unsigned pagevec_lookup_tag(struct pagevec *pvec,
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 5a462c4e5009..637a608ded0b 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -59,12 +59,12 @@ static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }
59void acpiphp_init(void); 59void acpiphp_init(void);
60void acpiphp_enumerate_slots(struct pci_bus *bus); 60void acpiphp_enumerate_slots(struct pci_bus *bus);
61void acpiphp_remove_slots(struct pci_bus *bus); 61void acpiphp_remove_slots(struct pci_bus *bus);
62void acpiphp_check_host_bridge(acpi_handle handle); 62void acpiphp_check_host_bridge(struct acpi_device *adev);
63#else 63#else
64static inline void acpiphp_init(void) { } 64static inline void acpiphp_init(void) { }
65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } 65static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { }
66static inline void acpiphp_remove_slots(struct pci_bus *bus) { } 66static inline void acpiphp_remove_slots(struct pci_bus *bus) { }
67static inline void acpiphp_check_host_bridge(acpi_handle handle) { } 67static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
68#endif 68#endif
69 69
70#else /* CONFIG_ACPI */ 70#else /* CONFIG_ACPI */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 33aa2caf0f0c..aab57b4abe7f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -29,7 +29,6 @@
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/irqreturn.h>
33#include <uapi/linux/pci.h> 32#include <uapi/linux/pci.h>
34 33
35#include <linux/pci_ids.h> 34#include <linux/pci_ids.h>
@@ -170,6 +169,8 @@ enum pci_dev_flags {
170 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 169 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
171 /* Provide indication device is assigned by a Virtual Machine Manager */ 170 /* Provide indication device is assigned by a Virtual Machine Manager */
172 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4, 171 PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
172 /* Flag for quirk use to store if quirk-specific ACS is enabled */
173 PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = (__force pci_dev_flags_t) 8,
173}; 174};
174 175
175enum pci_irq_reroute_variant { 176enum pci_irq_reroute_variant {
@@ -461,7 +462,6 @@ struct pci_bus {
461 unsigned int is_added:1; 462 unsigned int is_added:1;
462}; 463};
463 464
464#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
465#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 465#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
466 466
467/* 467/*
@@ -1066,7 +1066,7 @@ void pci_bus_remove_resources(struct pci_bus *bus);
1066int __must_check pci_bus_alloc_resource(struct pci_bus *bus, 1066int __must_check pci_bus_alloc_resource(struct pci_bus *bus,
1067 struct resource *res, resource_size_t size, 1067 struct resource *res, resource_size_t size,
1068 resource_size_t align, resource_size_t min, 1068 resource_size_t align, resource_size_t min,
1069 unsigned int type_mask, 1069 unsigned long type_mask,
1070 resource_size_t (*alignf)(void *, 1070 resource_size_t (*alignf)(void *,
1071 const struct resource *, 1071 const struct resource *,
1072 resource_size_t, 1072 resource_size_t,
@@ -1530,6 +1530,7 @@ enum pci_fixup_pass {
1530void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1530void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1531struct pci_dev *pci_get_dma_source(struct pci_dev *dev); 1531struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1532int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1532int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1533void pci_dev_specific_enable_acs(struct pci_dev *dev);
1533#else 1534#else
1534static inline void pci_fixup_device(enum pci_fixup_pass pass, 1535static inline void pci_fixup_device(enum pci_fixup_pass pass,
1535 struct pci_dev *dev) { } 1536 struct pci_dev *dev) { }
@@ -1542,6 +1543,7 @@ static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1542{ 1543{
1543 return -ENOTTY; 1544 return -ENOTTY;
1544} 1545}
1546static inline void pci_dev_specific_enable_acs(struct pci_dev *dev) { }
1545#endif 1547#endif
1546 1548
1547void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1549void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
@@ -1597,7 +1599,6 @@ void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1597#ifdef CONFIG_PCI_IOV 1599#ifdef CONFIG_PCI_IOV
1598int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); 1600int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1599void pci_disable_sriov(struct pci_dev *dev); 1601void pci_disable_sriov(struct pci_dev *dev);
1600irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1601int pci_num_vf(struct pci_dev *dev); 1602int pci_num_vf(struct pci_dev *dev);
1602int pci_vfs_assigned(struct pci_dev *dev); 1603int pci_vfs_assigned(struct pci_dev *dev);
1603int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); 1604int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
@@ -1606,8 +1607,6 @@ int pci_sriov_get_totalvfs(struct pci_dev *dev);
1606static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) 1607static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1607{ return -ENODEV; } 1608{ return -ENODEV; }
1608static inline void pci_disable_sriov(struct pci_dev *dev) { } 1609static inline void pci_disable_sriov(struct pci_dev *dev) { }
1609static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1610{ return IRQ_NONE; }
1611static inline int pci_num_vf(struct pci_dev *dev) { return 0; } 1610static inline int pci_num_vf(struct pci_dev *dev) { return 0; }
1612static inline int pci_vfs_assigned(struct pci_dev *dev) 1611static inline int pci_vfs_assigned(struct pci_dev *dev)
1613{ return 0; } 1612{ return 0; }
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7399e6a3e9a0..d4de24b4d4c6 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -528,6 +528,8 @@
528#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 528#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605
529#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533 529#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533
530#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534 530#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534
531#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F3 0x1583
532#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F4 0x1584
531#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 533#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703
532#define PCI_DEVICE_ID_AMD_LANCE 0x2000 534#define PCI_DEVICE_ID_AMD_LANCE 0x2000
533#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 535#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
@@ -726,6 +728,7 @@
726#define PCI_DEVICE_ID_SI_7018 0x7018 728#define PCI_DEVICE_ID_SI_7018 0x7018
727 729
728#define PCI_VENDOR_ID_HP 0x103c 730#define PCI_VENDOR_ID_HP 0x103c
731#define PCI_VENDOR_ID_HP_3PAR 0x1590
729#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005 732#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005
730#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006 733#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006
731#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008 734#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index e3817d2441b6..e7a0b95ed527 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -173,6 +173,12 @@ extern phys_addr_t per_cpu_ptr_to_phys(void *addr);
173 173
174extern void __bad_size_call_parameter(void); 174extern void __bad_size_call_parameter(void);
175 175
176#ifdef CONFIG_DEBUG_PREEMPT
177extern void __this_cpu_preempt_check(const char *op);
178#else
179static inline void __this_cpu_preempt_check(const char *op) { }
180#endif
181
176#define __pcpu_size_call_return(stem, variable) \ 182#define __pcpu_size_call_return(stem, variable) \
177({ typeof(variable) pscr_ret__; \ 183({ typeof(variable) pscr_ret__; \
178 __verify_pcpu_ptr(&(variable)); \ 184 __verify_pcpu_ptr(&(variable)); \
@@ -243,6 +249,8 @@ do { \
243} while (0) 249} while (0)
244 250
245/* 251/*
252 * this_cpu operations (C) 2008-2013 Christoph Lameter <cl@linux.com>
253 *
246 * Optimized manipulation for memory allocated through the per cpu 254 * Optimized manipulation for memory allocated through the per cpu
247 * allocator or for addresses of per cpu variables. 255 * allocator or for addresses of per cpu variables.
248 * 256 *
@@ -296,7 +304,7 @@ do { \
296do { \ 304do { \
297 unsigned long flags; \ 305 unsigned long flags; \
298 raw_local_irq_save(flags); \ 306 raw_local_irq_save(flags); \
299 *__this_cpu_ptr(&(pcp)) op val; \ 307 *raw_cpu_ptr(&(pcp)) op val; \
300 raw_local_irq_restore(flags); \ 308 raw_local_irq_restore(flags); \
301} while (0) 309} while (0)
302 310
@@ -381,8 +389,8 @@ do { \
381 typeof(pcp) ret__; \ 389 typeof(pcp) ret__; \
382 unsigned long flags; \ 390 unsigned long flags; \
383 raw_local_irq_save(flags); \ 391 raw_local_irq_save(flags); \
384 __this_cpu_add(pcp, val); \ 392 raw_cpu_add(pcp, val); \
385 ret__ = __this_cpu_read(pcp); \ 393 ret__ = raw_cpu_read(pcp); \
386 raw_local_irq_restore(flags); \ 394 raw_local_irq_restore(flags); \
387 ret__; \ 395 ret__; \
388}) 396})
@@ -411,8 +419,8 @@ do { \
411({ typeof(pcp) ret__; \ 419({ typeof(pcp) ret__; \
412 unsigned long flags; \ 420 unsigned long flags; \
413 raw_local_irq_save(flags); \ 421 raw_local_irq_save(flags); \
414 ret__ = __this_cpu_read(pcp); \ 422 ret__ = raw_cpu_read(pcp); \
415 __this_cpu_write(pcp, nval); \ 423 raw_cpu_write(pcp, nval); \
416 raw_local_irq_restore(flags); \ 424 raw_local_irq_restore(flags); \
417 ret__; \ 425 ret__; \
418}) 426})
@@ -439,9 +447,9 @@ do { \
439 typeof(pcp) ret__; \ 447 typeof(pcp) ret__; \
440 unsigned long flags; \ 448 unsigned long flags; \
441 raw_local_irq_save(flags); \ 449 raw_local_irq_save(flags); \
442 ret__ = __this_cpu_read(pcp); \ 450 ret__ = raw_cpu_read(pcp); \
443 if (ret__ == (oval)) \ 451 if (ret__ == (oval)) \
444 __this_cpu_write(pcp, nval); \ 452 raw_cpu_write(pcp, nval); \
445 raw_local_irq_restore(flags); \ 453 raw_local_irq_restore(flags); \
446 ret__; \ 454 ret__; \
447}) 455})
@@ -476,7 +484,7 @@ do { \
476 int ret__; \ 484 int ret__; \
477 unsigned long flags; \ 485 unsigned long flags; \
478 raw_local_irq_save(flags); \ 486 raw_local_irq_save(flags); \
479 ret__ = __this_cpu_generic_cmpxchg_double(pcp1, pcp2, \ 487 ret__ = raw_cpu_generic_cmpxchg_double(pcp1, pcp2, \
480 oval1, oval2, nval1, nval2); \ 488 oval1, oval2, nval1, nval2); \
481 raw_local_irq_restore(flags); \ 489 raw_local_irq_restore(flags); \
482 ret__; \ 490 ret__; \
@@ -504,12 +512,8 @@ do { \
504#endif 512#endif
505 513
506/* 514/*
507 * Generic percpu operations for context that are safe from preemption/interrupts. 515 * Generic percpu operations for contexts where we do not want to do
508 * Either we do not care about races or the caller has the 516 * any checks for preemptiosn.
509 * responsibility of handling preemption/interrupt issues. Arch code can still
510 * override these instructions since the arch per cpu code may be more
511 * efficient and may actually get race freeness for free (that is the
512 * case for x86 for example).
513 * 517 *
514 * If there is no other protection through preempt disable and/or 518 * If there is no other protection through preempt disable and/or
515 * disabling interupts then one of these RMW operations can show unexpected 519 * disabling interupts then one of these RMW operations can show unexpected
@@ -517,211 +521,285 @@ do { \
517 * or an interrupt occurred and the same percpu variable was modified from 521 * or an interrupt occurred and the same percpu variable was modified from
518 * the interrupt context. 522 * the interrupt context.
519 */ 523 */
520#ifndef __this_cpu_read 524#ifndef raw_cpu_read
521# ifndef __this_cpu_read_1 525# ifndef raw_cpu_read_1
522# define __this_cpu_read_1(pcp) (*__this_cpu_ptr(&(pcp))) 526# define raw_cpu_read_1(pcp) (*raw_cpu_ptr(&(pcp)))
523# endif 527# endif
524# ifndef __this_cpu_read_2 528# ifndef raw_cpu_read_2
525# define __this_cpu_read_2(pcp) (*__this_cpu_ptr(&(pcp))) 529# define raw_cpu_read_2(pcp) (*raw_cpu_ptr(&(pcp)))
526# endif 530# endif
527# ifndef __this_cpu_read_4 531# ifndef raw_cpu_read_4
528# define __this_cpu_read_4(pcp) (*__this_cpu_ptr(&(pcp))) 532# define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
529# endif 533# endif
530# ifndef __this_cpu_read_8 534# ifndef raw_cpu_read_8
531# define __this_cpu_read_8(pcp) (*__this_cpu_ptr(&(pcp))) 535# define raw_cpu_read_8(pcp) (*raw_cpu_ptr(&(pcp)))
532# endif 536# endif
533# define __this_cpu_read(pcp) __pcpu_size_call_return(__this_cpu_read_, (pcp)) 537# define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, (pcp))
534#endif 538#endif
535 539
536#define __this_cpu_generic_to_op(pcp, val, op) \ 540#define raw_cpu_generic_to_op(pcp, val, op) \
537do { \ 541do { \
538 *__this_cpu_ptr(&(pcp)) op val; \ 542 *raw_cpu_ptr(&(pcp)) op val; \
539} while (0) 543} while (0)
540 544
541#ifndef __this_cpu_write 545
542# ifndef __this_cpu_write_1 546#ifndef raw_cpu_write
543# define __this_cpu_write_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 547# ifndef raw_cpu_write_1
548# define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
544# endif 549# endif
545# ifndef __this_cpu_write_2 550# ifndef raw_cpu_write_2
546# define __this_cpu_write_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 551# define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
547# endif 552# endif
548# ifndef __this_cpu_write_4 553# ifndef raw_cpu_write_4
549# define __this_cpu_write_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 554# define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
550# endif 555# endif
551# ifndef __this_cpu_write_8 556# ifndef raw_cpu_write_8
552# define __this_cpu_write_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), =) 557# define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), =)
553# endif 558# endif
554# define __this_cpu_write(pcp, val) __pcpu_size_call(__this_cpu_write_, (pcp), (val)) 559# define raw_cpu_write(pcp, val) __pcpu_size_call(raw_cpu_write_, (pcp), (val))
555#endif 560#endif
556 561
557#ifndef __this_cpu_add 562#ifndef raw_cpu_add
558# ifndef __this_cpu_add_1 563# ifndef raw_cpu_add_1
559# define __this_cpu_add_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 564# define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
560# endif 565# endif
561# ifndef __this_cpu_add_2 566# ifndef raw_cpu_add_2
562# define __this_cpu_add_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 567# define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
563# endif 568# endif
564# ifndef __this_cpu_add_4 569# ifndef raw_cpu_add_4
565# define __this_cpu_add_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 570# define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
566# endif 571# endif
567# ifndef __this_cpu_add_8 572# ifndef raw_cpu_add_8
568# define __this_cpu_add_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), +=) 573# define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), +=)
569# endif 574# endif
570# define __this_cpu_add(pcp, val) __pcpu_size_call(__this_cpu_add_, (pcp), (val)) 575# define raw_cpu_add(pcp, val) __pcpu_size_call(raw_cpu_add_, (pcp), (val))
571#endif 576#endif
572 577
573#ifndef __this_cpu_sub 578#ifndef raw_cpu_sub
574# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val)) 579# define raw_cpu_sub(pcp, val) raw_cpu_add((pcp), -(val))
575#endif 580#endif
576 581
577#ifndef __this_cpu_inc 582#ifndef raw_cpu_inc
578# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1) 583# define raw_cpu_inc(pcp) raw_cpu_add((pcp), 1)
579#endif 584#endif
580 585
581#ifndef __this_cpu_dec 586#ifndef raw_cpu_dec
582# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1) 587# define raw_cpu_dec(pcp) raw_cpu_sub((pcp), 1)
583#endif 588#endif
584 589
585#ifndef __this_cpu_and 590#ifndef raw_cpu_and
586# ifndef __this_cpu_and_1 591# ifndef raw_cpu_and_1
587# define __this_cpu_and_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 592# define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
588# endif 593# endif
589# ifndef __this_cpu_and_2 594# ifndef raw_cpu_and_2
590# define __this_cpu_and_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 595# define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
591# endif 596# endif
592# ifndef __this_cpu_and_4 597# ifndef raw_cpu_and_4
593# define __this_cpu_and_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 598# define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
594# endif 599# endif
595# ifndef __this_cpu_and_8 600# ifndef raw_cpu_and_8
596# define __this_cpu_and_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), &=) 601# define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), &=)
597# endif 602# endif
598# define __this_cpu_and(pcp, val) __pcpu_size_call(__this_cpu_and_, (pcp), (val)) 603# define raw_cpu_and(pcp, val) __pcpu_size_call(raw_cpu_and_, (pcp), (val))
599#endif 604#endif
600 605
601#ifndef __this_cpu_or 606#ifndef raw_cpu_or
602# ifndef __this_cpu_or_1 607# ifndef raw_cpu_or_1
603# define __this_cpu_or_1(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 608# define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
604# endif 609# endif
605# ifndef __this_cpu_or_2 610# ifndef raw_cpu_or_2
606# define __this_cpu_or_2(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 611# define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
607# endif 612# endif
608# ifndef __this_cpu_or_4 613# ifndef raw_cpu_or_4
609# define __this_cpu_or_4(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 614# define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
610# endif 615# endif
611# ifndef __this_cpu_or_8 616# ifndef raw_cpu_or_8
612# define __this_cpu_or_8(pcp, val) __this_cpu_generic_to_op((pcp), (val), |=) 617# define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op((pcp), (val), |=)
613# endif 618# endif
614# define __this_cpu_or(pcp, val) __pcpu_size_call(__this_cpu_or_, (pcp), (val)) 619# define raw_cpu_or(pcp, val) __pcpu_size_call(raw_cpu_or_, (pcp), (val))
615#endif 620#endif
616 621
617#define __this_cpu_generic_add_return(pcp, val) \ 622#define raw_cpu_generic_add_return(pcp, val) \
618({ \ 623({ \
619 __this_cpu_add(pcp, val); \ 624 raw_cpu_add(pcp, val); \
620 __this_cpu_read(pcp); \ 625 raw_cpu_read(pcp); \
621}) 626})
622 627
623#ifndef __this_cpu_add_return 628#ifndef raw_cpu_add_return
624# ifndef __this_cpu_add_return_1 629# ifndef raw_cpu_add_return_1
625# define __this_cpu_add_return_1(pcp, val) __this_cpu_generic_add_return(pcp, val) 630# define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
626# endif 631# endif
627# ifndef __this_cpu_add_return_2 632# ifndef raw_cpu_add_return_2
628# define __this_cpu_add_return_2(pcp, val) __this_cpu_generic_add_return(pcp, val) 633# define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
629# endif 634# endif
630# ifndef __this_cpu_add_return_4 635# ifndef raw_cpu_add_return_4
631# define __this_cpu_add_return_4(pcp, val) __this_cpu_generic_add_return(pcp, val) 636# define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
632# endif 637# endif
633# ifndef __this_cpu_add_return_8 638# ifndef raw_cpu_add_return_8
634# define __this_cpu_add_return_8(pcp, val) __this_cpu_generic_add_return(pcp, val) 639# define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
635# endif 640# endif
636# define __this_cpu_add_return(pcp, val) \ 641# define raw_cpu_add_return(pcp, val) \
637 __pcpu_size_call_return2(__this_cpu_add_return_, pcp, val) 642 __pcpu_size_call_return2(raw_add_return_, pcp, val)
638#endif 643#endif
639 644
640#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val)) 645#define raw_cpu_sub_return(pcp, val) raw_cpu_add_return(pcp, -(typeof(pcp))(val))
641#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1) 646#define raw_cpu_inc_return(pcp) raw_cpu_add_return(pcp, 1)
642#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1) 647#define raw_cpu_dec_return(pcp) raw_cpu_add_return(pcp, -1)
643 648
644#define __this_cpu_generic_xchg(pcp, nval) \ 649#define raw_cpu_generic_xchg(pcp, nval) \
645({ typeof(pcp) ret__; \ 650({ typeof(pcp) ret__; \
646 ret__ = __this_cpu_read(pcp); \ 651 ret__ = raw_cpu_read(pcp); \
647 __this_cpu_write(pcp, nval); \ 652 raw_cpu_write(pcp, nval); \
648 ret__; \ 653 ret__; \
649}) 654})
650 655
651#ifndef __this_cpu_xchg 656#ifndef raw_cpu_xchg
652# ifndef __this_cpu_xchg_1 657# ifndef raw_cpu_xchg_1
653# define __this_cpu_xchg_1(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 658# define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
654# endif 659# endif
655# ifndef __this_cpu_xchg_2 660# ifndef raw_cpu_xchg_2
656# define __this_cpu_xchg_2(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 661# define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
657# endif 662# endif
658# ifndef __this_cpu_xchg_4 663# ifndef raw_cpu_xchg_4
659# define __this_cpu_xchg_4(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 664# define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
660# endif 665# endif
661# ifndef __this_cpu_xchg_8 666# ifndef raw_cpu_xchg_8
662# define __this_cpu_xchg_8(pcp, nval) __this_cpu_generic_xchg(pcp, nval) 667# define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
663# endif 668# endif
664# define __this_cpu_xchg(pcp, nval) \ 669# define raw_cpu_xchg(pcp, nval) \
665 __pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval) 670 __pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval)
666#endif 671#endif
667 672
668#define __this_cpu_generic_cmpxchg(pcp, oval, nval) \ 673#define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
669({ \ 674({ \
670 typeof(pcp) ret__; \ 675 typeof(pcp) ret__; \
671 ret__ = __this_cpu_read(pcp); \ 676 ret__ = raw_cpu_read(pcp); \
672 if (ret__ == (oval)) \ 677 if (ret__ == (oval)) \
673 __this_cpu_write(pcp, nval); \ 678 raw_cpu_write(pcp, nval); \
674 ret__; \ 679 ret__; \
675}) 680})
676 681
677#ifndef __this_cpu_cmpxchg 682#ifndef raw_cpu_cmpxchg
678# ifndef __this_cpu_cmpxchg_1 683# ifndef raw_cpu_cmpxchg_1
679# define __this_cpu_cmpxchg_1(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 684# define raw_cpu_cmpxchg_1(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
680# endif 685# endif
681# ifndef __this_cpu_cmpxchg_2 686# ifndef raw_cpu_cmpxchg_2
682# define __this_cpu_cmpxchg_2(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 687# define raw_cpu_cmpxchg_2(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
683# endif 688# endif
684# ifndef __this_cpu_cmpxchg_4 689# ifndef raw_cpu_cmpxchg_4
685# define __this_cpu_cmpxchg_4(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 690# define raw_cpu_cmpxchg_4(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
686# endif 691# endif
687# ifndef __this_cpu_cmpxchg_8 692# ifndef raw_cpu_cmpxchg_8
688# define __this_cpu_cmpxchg_8(pcp, oval, nval) __this_cpu_generic_cmpxchg(pcp, oval, nval) 693# define raw_cpu_cmpxchg_8(pcp, oval, nval) raw_cpu_generic_cmpxchg(pcp, oval, nval)
689# endif 694# endif
690# define __this_cpu_cmpxchg(pcp, oval, nval) \ 695# define raw_cpu_cmpxchg(pcp, oval, nval) \
691 __pcpu_size_call_return2(__this_cpu_cmpxchg_, pcp, oval, nval) 696 __pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval)
692#endif 697#endif
693 698
694#define __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 699#define raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
695({ \ 700({ \
696 int __ret = 0; \ 701 int __ret = 0; \
697 if (__this_cpu_read(pcp1) == (oval1) && \ 702 if (raw_cpu_read(pcp1) == (oval1) && \
698 __this_cpu_read(pcp2) == (oval2)) { \ 703 raw_cpu_read(pcp2) == (oval2)) { \
699 __this_cpu_write(pcp1, (nval1)); \ 704 raw_cpu_write(pcp1, (nval1)); \
700 __this_cpu_write(pcp2, (nval2)); \ 705 raw_cpu_write(pcp2, (nval2)); \
701 __ret = 1; \ 706 __ret = 1; \
702 } \ 707 } \
703 (__ret); \ 708 (__ret); \
704}) 709})
705 710
706#ifndef __this_cpu_cmpxchg_double 711#ifndef raw_cpu_cmpxchg_double
707# ifndef __this_cpu_cmpxchg_double_1 712# ifndef raw_cpu_cmpxchg_double_1
708# define __this_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 713# define raw_cpu_cmpxchg_double_1(pcp1, pcp2, oval1, oval2, nval1, nval2) \
709 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 714 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
710# endif 715# endif
711# ifndef __this_cpu_cmpxchg_double_2 716# ifndef raw_cpu_cmpxchg_double_2
712# define __this_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 717# define raw_cpu_cmpxchg_double_2(pcp1, pcp2, oval1, oval2, nval1, nval2) \
713 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 718 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
714# endif 719# endif
715# ifndef __this_cpu_cmpxchg_double_4 720# ifndef raw_cpu_cmpxchg_double_4
716# define __this_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 721# define raw_cpu_cmpxchg_double_4(pcp1, pcp2, oval1, oval2, nval1, nval2) \
717 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 722 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
718# endif 723# endif
719# ifndef __this_cpu_cmpxchg_double_8 724# ifndef raw_cpu_cmpxchg_double_8
720# define __this_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 725# define raw_cpu_cmpxchg_double_8(pcp1, pcp2, oval1, oval2, nval1, nval2) \
721 __this_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) 726 raw_cpu_generic_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2)
722# endif 727# endif
728# define raw_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
729 __pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2))
730#endif
731
732/*
733 * Generic percpu operations for context that are safe from preemption/interrupts.
734 */
735#ifndef __this_cpu_read
736# define __this_cpu_read(pcp) \
737 (__this_cpu_preempt_check("read"),__pcpu_size_call_return(raw_cpu_read_, (pcp)))
738#endif
739
740#ifndef __this_cpu_write
741# define __this_cpu_write(pcp, val) \
742do { __this_cpu_preempt_check("write"); \
743 __pcpu_size_call(raw_cpu_write_, (pcp), (val)); \
744} while (0)
745#endif
746
747#ifndef __this_cpu_add
748# define __this_cpu_add(pcp, val) \
749do { __this_cpu_preempt_check("add"); \
750 __pcpu_size_call(raw_cpu_add_, (pcp), (val)); \
751} while (0)
752#endif
753
754#ifndef __this_cpu_sub
755# define __this_cpu_sub(pcp, val) __this_cpu_add((pcp), -(typeof(pcp))(val))
756#endif
757
758#ifndef __this_cpu_inc
759# define __this_cpu_inc(pcp) __this_cpu_add((pcp), 1)
760#endif
761
762#ifndef __this_cpu_dec
763# define __this_cpu_dec(pcp) __this_cpu_sub((pcp), 1)
764#endif
765
766#ifndef __this_cpu_and
767# define __this_cpu_and(pcp, val) \
768do { __this_cpu_preempt_check("and"); \
769 __pcpu_size_call(raw_cpu_and_, (pcp), (val)); \
770} while (0)
771
772#endif
773
774#ifndef __this_cpu_or
775# define __this_cpu_or(pcp, val) \
776do { __this_cpu_preempt_check("or"); \
777 __pcpu_size_call(raw_cpu_or_, (pcp), (val)); \
778} while (0)
779#endif
780
781#ifndef __this_cpu_add_return
782# define __this_cpu_add_return(pcp, val) \
783 (__this_cpu_preempt_check("add_return"),__pcpu_size_call_return2(raw_cpu_add_return_, pcp, val))
784#endif
785
786#define __this_cpu_sub_return(pcp, val) __this_cpu_add_return(pcp, -(typeof(pcp))(val))
787#define __this_cpu_inc_return(pcp) __this_cpu_add_return(pcp, 1)
788#define __this_cpu_dec_return(pcp) __this_cpu_add_return(pcp, -1)
789
790#ifndef __this_cpu_xchg
791# define __this_cpu_xchg(pcp, nval) \
792 (__this_cpu_preempt_check("xchg"),__pcpu_size_call_return2(raw_cpu_xchg_, (pcp), nval))
793#endif
794
795#ifndef __this_cpu_cmpxchg
796# define __this_cpu_cmpxchg(pcp, oval, nval) \
797 (__this_cpu_preempt_check("cmpxchg"),__pcpu_size_call_return2(raw_cpu_cmpxchg_, pcp, oval, nval))
798#endif
799
800#ifndef __this_cpu_cmpxchg_double
723# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \ 801# define __this_cpu_cmpxchg_double(pcp1, pcp2, oval1, oval2, nval1, nval2) \
724 __pcpu_double_call_return_bool(__this_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)) 802 (__this_cpu_preempt_check("cmpxchg_double"),__pcpu_double_call_return_bool(raw_cpu_cmpxchg_double_, (pcp1), (pcp2), (oval1), (oval2), (nval1), (nval2)))
725#endif 803#endif
726 804
727#endif /* __LINUX_PERCPU_H */ 805#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e56b07f5c9b6..3356abcfff18 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -835,6 +835,8 @@ do { \
835 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 835 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
836 unsigned long cpu = smp_processor_id(); \ 836 unsigned long cpu = smp_processor_id(); \
837 unsigned long flags; \ 837 unsigned long flags; \
838 \
839 cpu_notifier_register_begin(); \
838 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 840 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
839 (void *)(unsigned long)cpu); \ 841 (void *)(unsigned long)cpu); \
840 local_irq_save(flags); \ 842 local_irq_save(flags); \
@@ -843,9 +845,21 @@ do { \
843 local_irq_restore(flags); \ 845 local_irq_restore(flags); \
844 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ 846 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
845 (void *)(unsigned long)cpu); \ 847 (void *)(unsigned long)cpu); \
846 register_cpu_notifier(&fn##_nb); \ 848 __register_cpu_notifier(&fn##_nb); \
849 cpu_notifier_register_done(); \
847} while (0) 850} while (0)
848 851
852/*
853 * Bare-bones version of perf_cpu_notifier(), which doesn't invoke the
854 * callback for already online CPUs.
855 */
856#define __perf_cpu_notifier(fn) \
857do { \
858 static struct notifier_block fn##_nb = \
859 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
860 \
861 __register_cpu_notifier(&fn##_nb); \
862} while (0)
849 863
850struct perf_pmu_events_attr { 864struct perf_pmu_events_attr {
851 struct device_attribute attr; 865 struct device_attribute attr;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 565188ca328f..24126c4b27b5 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -74,8 +74,53 @@ typedef enum {
74 PHY_INTERFACE_MODE_RTBI, 74 PHY_INTERFACE_MODE_RTBI,
75 PHY_INTERFACE_MODE_SMII, 75 PHY_INTERFACE_MODE_SMII,
76 PHY_INTERFACE_MODE_XGMII, 76 PHY_INTERFACE_MODE_XGMII,
77 PHY_INTERFACE_MODE_MOCA,
78 PHY_INTERFACE_MODE_MAX,
77} phy_interface_t; 79} phy_interface_t;
78 80
81/**
82 * It maps 'enum phy_interface_t' found in include/linux/phy.h
83 * into the device tree binding of 'phy-mode', so that Ethernet
84 * device driver can get phy interface from device tree.
85 */
86static inline const char *phy_modes(phy_interface_t interface)
87{
88 switch (interface) {
89 case PHY_INTERFACE_MODE_NA:
90 return "";
91 case PHY_INTERFACE_MODE_MII:
92 return "mii";
93 case PHY_INTERFACE_MODE_GMII:
94 return "gmii";
95 case PHY_INTERFACE_MODE_SGMII:
96 return "sgmii";
97 case PHY_INTERFACE_MODE_TBI:
98 return "tbi";
99 case PHY_INTERFACE_MODE_REVMII:
100 return "rev-mii";
101 case PHY_INTERFACE_MODE_RMII:
102 return "rmii";
103 case PHY_INTERFACE_MODE_RGMII:
104 return "rgmii";
105 case PHY_INTERFACE_MODE_RGMII_ID:
106 return "rgmii-id";
107 case PHY_INTERFACE_MODE_RGMII_RXID:
108 return "rgmii-rxid";
109 case PHY_INTERFACE_MODE_RGMII_TXID:
110 return "rgmii-txid";
111 case PHY_INTERFACE_MODE_RTBI:
112 return "rtbi";
113 case PHY_INTERFACE_MODE_SMII:
114 return "smii";
115 case PHY_INTERFACE_MODE_XGMII:
116 return "xgmii";
117 case PHY_INTERFACE_MODE_MOCA:
118 return "moca";
119 default:
120 return "unknown";
121 }
122}
123
79 124
80#define PHY_INIT_TIMEOUT 100000 125#define PHY_INIT_TIMEOUT 100000
81#define PHY_STATE_TIME 1 126#define PHY_STATE_TIME 1
@@ -308,6 +353,7 @@ struct phy_device {
308 struct phy_c45_device_ids c45_ids; 353 struct phy_c45_device_ids c45_ids;
309 bool is_c45; 354 bool is_c45;
310 bool is_internal; 355 bool is_internal;
356 bool has_fixups;
311 357
312 enum phy_state state; 358 enum phy_state state;
313 359
@@ -394,6 +440,11 @@ struct phy_driver {
394 u32 flags; 440 u32 flags;
395 441
396 /* 442 /*
443 * Called to issue a PHY software reset
444 */
445 int (*soft_reset)(struct phy_device *phydev);
446
447 /*
397 * Called to initialize the PHY, 448 * Called to initialize the PHY,
398 * including after a reset 449 * including after a reset
399 */ 450 */
@@ -417,6 +468,9 @@ struct phy_driver {
417 */ 468 */
418 int (*config_aneg)(struct phy_device *phydev); 469 int (*config_aneg)(struct phy_device *phydev);
419 470
471 /* Determines the auto negotiation result */
472 int (*aneg_done)(struct phy_device *phydev);
473
420 /* Determines the negotiated speed and duplex */ 474 /* Determines the negotiated speed and duplex */
421 int (*read_status)(struct phy_device *phydev); 475 int (*read_status)(struct phy_device *phydev);
422 476
@@ -612,10 +666,12 @@ static inline int phy_read_status(struct phy_device *phydev)
612int genphy_setup_forced(struct phy_device *phydev); 666int genphy_setup_forced(struct phy_device *phydev);
613int genphy_restart_aneg(struct phy_device *phydev); 667int genphy_restart_aneg(struct phy_device *phydev);
614int genphy_config_aneg(struct phy_device *phydev); 668int genphy_config_aneg(struct phy_device *phydev);
669int genphy_aneg_done(struct phy_device *phydev);
615int genphy_update_link(struct phy_device *phydev); 670int genphy_update_link(struct phy_device *phydev);
616int genphy_read_status(struct phy_device *phydev); 671int genphy_read_status(struct phy_device *phydev);
617int genphy_suspend(struct phy_device *phydev); 672int genphy_suspend(struct phy_device *phydev);
618int genphy_resume(struct phy_device *phydev); 673int genphy_resume(struct phy_device *phydev);
674int genphy_soft_reset(struct phy_device *phydev);
619void phy_driver_unregister(struct phy_driver *drv); 675void phy_driver_unregister(struct phy_driver *drv);
620void phy_drivers_unregister(struct phy_driver *drv, int n); 676void phy_drivers_unregister(struct phy_driver *drv, int n);
621int phy_driver_register(struct phy_driver *new_driver); 677int phy_driver_register(struct phy_driver *new_driver);
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/phy/omap_control_phy.h
index 69ae383ee3cc..5450403c7546 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/phy/omap_control_phy.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * omap_control_usb.h - Header file for the USB part of control module. 2 * omap_control_phy.h - Header file for the PHY part of control module.
3 * 3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com 4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -16,10 +16,10 @@
16 * 16 *
17 */ 17 */
18 18
19#ifndef __OMAP_CONTROL_USB_H__ 19#ifndef __OMAP_CONTROL_PHY_H__
20#define __OMAP_CONTROL_USB_H__ 20#define __OMAP_CONTROL_PHY_H__
21 21
22enum omap_control_usb_type { 22enum omap_control_phy_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ 23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ 24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ 25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
@@ -27,7 +27,7 @@ enum omap_control_usb_type {
27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */ 27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
28}; 28};
29 29
30struct omap_control_usb { 30struct omap_control_phy {
31 struct device *dev; 31 struct device *dev;
32 32
33 u32 __iomem *otghs_control; 33 u32 __iomem *otghs_control;
@@ -36,7 +36,7 @@ struct omap_control_usb {
36 36
37 struct clk *sys_clk; 37 struct clk *sys_clk;
38 38
39 enum omap_control_usb_type type; 39 enum omap_control_phy_type type;
40}; 40};
41 41
42enum omap_control_usb_mode { 42enum omap_control_usb_mode {
@@ -54,14 +54,14 @@ enum omap_control_usb_mode {
54#define OMAP_CTRL_DEV_SESSEND BIT(3) 54#define OMAP_CTRL_DEV_SESSEND BIT(3)
55#define OMAP_CTRL_DEV_IDDIG BIT(4) 55#define OMAP_CTRL_DEV_IDDIG BIT(4)
56 56
57#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000 57#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
58#define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE 58#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
59 59
60#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000 60#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
61#define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16 61#define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
62 62
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 63#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 64#define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
65 65
66#define OMAP_CTRL_USB2_PHY_PD BIT(28) 66#define OMAP_CTRL_USB2_PHY_PD BIT(28)
67 67
@@ -70,13 +70,13 @@ enum omap_control_usb_mode {
70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19) 70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20) 71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
72 72
73#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 73#if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
74extern void omap_control_usb_phy_power(struct device *dev, int on); 74void omap_control_phy_power(struct device *dev, int on);
75extern void omap_control_usb_set_mode(struct device *dev, 75void omap_control_usb_set_mode(struct device *dev,
76 enum omap_control_usb_mode mode); 76 enum omap_control_usb_mode mode);
77#else 77#else
78 78
79static inline void omap_control_usb_phy_power(struct device *dev, int on) 79static inline void omap_control_phy_power(struct device *dev, int on)
80{ 80{
81} 81}
82 82
@@ -86,4 +86,4 @@ static inline void omap_control_usb_set_mode(struct device *dev,
86} 86}
87#endif 87#endif
88 88
89#endif /* __OMAP_CONTROL_USB_H__ */ 89#endif /* __OMAP_CONTROL_PHY_H__ */
diff --git a/include/linux/usb/omap_usb.h b/include/linux/phy/omap_usb.h
index 6ae29360e1d2..dc2c541a619b 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/phy/omap_usb.h
@@ -34,14 +34,24 @@ struct omap_usb {
34 struct usb_phy phy; 34 struct usb_phy phy;
35 struct phy_companion *comparator; 35 struct phy_companion *comparator;
36 void __iomem *pll_ctrl_base; 36 void __iomem *pll_ctrl_base;
37 void __iomem *phy_base;
37 struct device *dev; 38 struct device *dev;
38 struct device *control_dev; 39 struct device *control_dev;
39 struct clk *wkupclk; 40 struct clk *wkupclk;
40 struct clk *sys_clk;
41 struct clk *optclk; 41 struct clk *optclk;
42 u8 is_suspended:1; 42 u8 flags;
43}; 43};
44 44
45struct usb_phy_data {
46 const char *label;
47 u8 flags;
48};
49
50/* Driver Flags */
51#define OMAP_USB2_HAS_START_SRP (1 << 0)
52#define OMAP_USB2_HAS_SET_VBUS (1 << 1)
53#define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT (1 << 2)
54
45#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 55#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
46 56
47#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 57#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 3f83459dbb20..e2f5ca96cddc 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -149,8 +149,11 @@ struct phy *phy_get(struct device *dev, const char *string);
149struct phy *phy_optional_get(struct device *dev, const char *string); 149struct phy *phy_optional_get(struct device *dev, const char *string);
150struct phy *devm_phy_get(struct device *dev, const char *string); 150struct phy *devm_phy_get(struct device *dev, const char *string);
151struct phy *devm_phy_optional_get(struct device *dev, const char *string); 151struct phy *devm_phy_optional_get(struct device *dev, const char *string);
152struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
153 const char *con_id);
152void phy_put(struct phy *phy); 154void phy_put(struct phy *phy);
153void devm_phy_put(struct device *dev, struct phy *phy); 155void devm_phy_put(struct device *dev, struct phy *phy);
156struct phy *of_phy_get(struct device_node *np, const char *con_id);
154struct phy *of_phy_simple_xlate(struct device *dev, 157struct phy *of_phy_simple_xlate(struct device *dev,
155 struct of_phandle_args *args); 158 struct of_phandle_args *args);
156struct phy *phy_create(struct device *dev, const struct phy_ops *ops, 159struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
@@ -251,6 +254,13 @@ static inline struct phy *devm_phy_optional_get(struct device *dev,
251 return ERR_PTR(-ENOSYS); 254 return ERR_PTR(-ENOSYS);
252} 255}
253 256
257static inline struct phy *devm_of_phy_get(struct device *dev,
258 struct device_node *np,
259 const char *con_id)
260{
261 return ERR_PTR(-ENOSYS);
262}
263
254static inline void phy_put(struct phy *phy) 264static inline void phy_put(struct phy *phy)
255{ 265{
256} 266}
@@ -259,6 +269,11 @@ static inline void devm_phy_put(struct device *dev, struct phy *phy)
259{ 269{
260} 270}
261 271
272static inline struct phy *of_phy_get(struct device_node *np, const char *con_id)
273{
274 return ERR_PTR(-ENOSYS);
275}
276
262static inline struct phy *of_phy_simple_xlate(struct device *dev, 277static inline struct phy *of_phy_simple_xlate(struct device *dev,
263 struct of_phandle_args *args) 278 struct of_phandle_args *args)
264{ 279{
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index ab5752692113..eb8b8ac6df3c 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -35,7 +35,7 @@ struct pipe_buffer {
35 * @tmp_page: cached released page 35 * @tmp_page: cached released page
36 * @readers: number of current readers of this pipe 36 * @readers: number of current readers of this pipe
37 * @writers: number of current writers of this pipe 37 * @writers: number of current writers of this pipe
38 * @files: number of struct file refering this pipe (protected by ->i_lock) 38 * @files: number of struct file referring this pipe (protected by ->i_lock)
39 * @waiting_writers: number of writers blocked waiting for room 39 * @waiting_writers: number of writers blocked waiting for room
40 * @r_counter: reader counter 40 * @r_counter: reader counter
41 * @w_counter: writer counter 41 * @w_counter: writer counter
@@ -83,23 +83,6 @@ struct pipe_buf_operations {
83 int can_merge; 83 int can_merge;
84 84
85 /* 85 /*
86 * ->map() returns a virtual address mapping of the pipe buffer.
87 * The last integer flag reflects whether this should be an atomic
88 * mapping or not. The atomic map is faster, however you can't take
89 * page faults before calling ->unmap() again. So if you need to eg
90 * access user data through copy_to/from_user(), then you must get
91 * a non-atomic map. ->map() uses the kmap_atomic slot for
92 * atomic maps, you have to be careful if mapping another page as
93 * source or destination for a copy.
94 */
95 void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int);
96
97 /*
98 * Undoes ->map(), finishes the virtual mapping of the pipe buffer.
99 */
100 void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *);
101
102 /*
103 * ->confirm() verifies that the data in the pipe buffer is there 86 * ->confirm() verifies that the data in the pipe buffer is there
104 * and that the contents are good. If the pages in the pipe belong 87 * and that the contents are good. If the pages in the pipe belong
105 * to a file system, we may need to wait for IO completion in this 88 * to a file system, we may need to wait for IO completion in this
@@ -150,8 +133,6 @@ struct pipe_inode_info *alloc_pipe_info(void);
150void free_pipe_info(struct pipe_inode_info *); 133void free_pipe_info(struct pipe_inode_info *);
151 134
152/* Generic pipe buffer ops functions */ 135/* Generic pipe buffer ops functions */
153void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
154void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *);
155void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); 136void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
156int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); 137int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
157int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 138int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
diff --git a/include/linux/platform_data/adau1977.h b/include/linux/platform_data/adau1977.h
new file mode 100644
index 000000000000..bed11d908f92
--- /dev/null
+++ b/include/linux/platform_data/adau1977.h
@@ -0,0 +1,45 @@
1/*
2 * ADAU1977/ADAU1978/ADAU1979 driver
3 *
4 * Copyright 2014 Analog Devices Inc.
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
6 *
7 * Licensed under the GPL-2.
8 */
9
10#ifndef __LINUX_PLATFORM_DATA_ADAU1977_H__
11#define __LINUX_PLATFORM_DATA_ADAU1977_H__
12
13/**
14 * enum adau1977_micbias - ADAU1977 MICBIAS pin voltage setting
15 * @ADAU1977_MICBIAS_5V0: MICBIAS is set to 5.0 V
16 * @ADAU1977_MICBIAS_5V5: MICBIAS is set to 5.5 V
17 * @ADAU1977_MICBIAS_6V0: MICBIAS is set to 6.0 V
18 * @ADAU1977_MICBIAS_6V5: MICBIAS is set to 6.5 V
19 * @ADAU1977_MICBIAS_7V0: MICBIAS is set to 7.0 V
20 * @ADAU1977_MICBIAS_7V5: MICBIAS is set to 7.5 V
21 * @ADAU1977_MICBIAS_8V0: MICBIAS is set to 8.0 V
22 * @ADAU1977_MICBIAS_8V5: MICBIAS is set to 8.5 V
23 * @ADAU1977_MICBIAS_9V0: MICBIAS is set to 9.0 V
24 */
25enum adau1977_micbias {
26 ADAU1977_MICBIAS_5V0 = 0x0,
27 ADAU1977_MICBIAS_5V5 = 0x1,
28 ADAU1977_MICBIAS_6V0 = 0x2,
29 ADAU1977_MICBIAS_6V5 = 0x3,
30 ADAU1977_MICBIAS_7V0 = 0x4,
31 ADAU1977_MICBIAS_7V5 = 0x5,
32 ADAU1977_MICBIAS_8V0 = 0x6,
33 ADAU1977_MICBIAS_8V5 = 0x7,
34 ADAU1977_MICBIAS_9V0 = 0x8,
35};
36
37/**
38 * struct adau1977_platform_data - Platform configuration data for the ADAU1977
39 * @micbias: Specifies the voltage for the MICBIAS pin
40 */
41struct adau1977_platform_data {
42 enum adau1977_micbias micbias;
43};
44
45#endif
diff --git a/include/linux/platform_data/asoc-s3c.h b/include/linux/platform_data/asoc-s3c.h
index 9efc04dd255a..709c6f7e2f8c 100644
--- a/include/linux/platform_data/asoc-s3c.h
+++ b/include/linux/platform_data/asoc-s3c.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/audio.h 1/*
2 *
3 * Copyright (c) 2009 Samsung Electronics Co. Ltd 2 * Copyright (c) 2009 Samsung Electronics Co. Ltd
4 * Author: Jaswinder Singh <jassi.brar@samsung.com> 3 * Author: Jaswinder Singh <jassi.brar@samsung.com>
5 * 4 *
diff --git a/include/linux/platform_data/asoc-s3c24xx_simtec.h b/include/linux/platform_data/asoc-s3c24xx_simtec.h
index 376af5286a3e..d220e54123aa 100644
--- a/include/linux/platform_data/asoc-s3c24xx_simtec.h
+++ b/include/linux/platform_data/asoc-s3c24xx_simtec.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/audio-simtec.h 1/*
2 *
3 * Copyright 2008 Simtec Electronics 2 * Copyright 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 3 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
diff --git a/include/linux/platform_data/ata-samsung_cf.h b/include/linux/platform_data/ata-samsung_cf.h
index 2a3855a8372a..c2049e3d7444 100644
--- a/include/linux/platform_data/ata-samsung_cf.h
+++ b/include/linux/platform_data/ata-samsung_cf.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/ata.h 1/*
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 2 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
@@ -10,8 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
13#ifndef __ASM_PLAT_ATA_H 12#ifndef __ATA_SAMSUNG_CF_H
14#define __ASM_PLAT_ATA_H __FILE__ 13#define __ATA_SAMSUNG_CF_H __FILE__
15 14
16/** 15/**
17 * struct s3c_ide_platdata - S3C IDE driver platform data. 16 * struct s3c_ide_platdata - S3C IDE driver platform data.
@@ -33,4 +32,4 @@ extern void s3c64xx_ide_setup_gpio(void);
33extern void s5pc100_ide_setup_gpio(void); 32extern void s5pc100_ide_setup_gpio(void);
34extern void s5pv210_ide_setup_gpio(void); 33extern void s5pv210_ide_setup_gpio(void);
35 34
36#endif /*__ASM_PLAT_ATA_H */ 35#endif /*__ATA_SAMSUNG_CF_H */
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index cea9f70133c5..e26b0c14edea 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -84,6 +84,7 @@ struct atmel_uart_data {
84 short use_dma_rx; /* use receive DMA? */ 84 short use_dma_rx; /* use receive DMA? */
85 void __iomem *regs; /* virt. base address, if any */ 85 void __iomem *regs; /* virt. base address, if any */
86 struct serial_rs485 rs485; /* rs485 settings */ 86 struct serial_rs485 rs485; /* rs485 settings */
87 int rts_gpio; /* optional RTS GPIO */
87}; 88};
88 89
89 /* Touchscreen Controller */ 90 /* Touchscreen Controller */
diff --git a/include/linux/platform_data/bt-nokia-h4p.h b/include/linux/platform_data/bt-nokia-h4p.h
new file mode 100644
index 000000000000..30d169dfadf3
--- /dev/null
+++ b/include/linux/platform_data/bt-nokia-h4p.h
@@ -0,0 +1,38 @@
1/*
2 * This file is part of Nokia H4P bluetooth driver
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22
23/**
24 * struct hci_h4p_platform data - hci_h4p Platform data structure
25 */
26struct hci_h4p_platform_data {
27 int chip_type;
28 int bt_sysclk;
29 unsigned int bt_wakeup_gpio;
30 unsigned int host_wakeup_gpio;
31 unsigned int reset_gpio;
32 int reset_gpio_shared;
33 unsigned int uart_irq;
34 phys_addr_t uart_base;
35 const char *uart_iclk;
36 const char *uart_fclk;
37 void (*set_pm_limits)(struct device *dev, bool set);
38};
diff --git a/include/linux/platform_data/clk-integrator.h b/include/linux/platform_data/clk-integrator.h
index 280edac9d0a5..addd48cac625 100644
--- a/include/linux/platform_data/clk-integrator.h
+++ b/include/linux/platform_data/clk-integrator.h
@@ -1,3 +1,2 @@
1void integrator_clk_init(bool is_cp);
2void integrator_impd1_clk_init(void __iomem *base, unsigned int id); 1void integrator_impd1_clk_init(void __iomem *base, unsigned int id);
3void integrator_impd1_clk_exit(unsigned int id); 2void integrator_impd1_clk_exit(unsigned int id);
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
index 5245992b0367..85ad68f9206a 100644
--- a/include/linux/platform_data/davinci_asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -18,7 +18,7 @@
18 18
19#include <linux/genalloc.h> 19#include <linux/genalloc.h>
20 20
21struct snd_platform_data { 21struct davinci_mcasp_pdata {
22 u32 tx_dma_offset; 22 u32 tx_dma_offset;
23 u32 rx_dma_offset; 23 u32 rx_dma_offset;
24 int asp_chan_q; /* event queue number for ASP channel */ 24 int asp_chan_q; /* event queue number for ASP channel */
@@ -87,6 +87,8 @@ struct snd_platform_data {
87 int tx_dma_channel; 87 int tx_dma_channel;
88 int rx_dma_channel; 88 int rx_dma_channel;
89}; 89};
90/* TODO: Fix arch/arm/mach-davinci/ users and remove this define */
91#define snd_platform_data davinci_mcasp_pdata
90 92
91enum { 93enum {
92 MCASP_VERSION_1 = 0, /* DM646x */ 94 MCASP_VERSION_1 = 0, /* DM646x */
diff --git a/include/linux/platform_data/dma-rcar-audmapp.h b/include/linux/platform_data/dma-rcar-audmapp.h
new file mode 100644
index 000000000000..471fffebbeb4
--- /dev/null
+++ b/include/linux/platform_data/dma-rcar-audmapp.h
@@ -0,0 +1,34 @@
1/*
2 * This is for Renesas R-Car Audio-DMAC-peri-peri.
3 *
4 * Copyright (C) 2014 Renesas Electronics Corporation
5 * Copyright (C) 2014 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This file is based on the include/linux/sh_dma.h
8 *
9 * Header for the new SH dmaengine driver
10 *
11 * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de>
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 version 2 as
15 * published by the Free Software Foundation.
16 */
17#ifndef SH_AUDMAPP_H
18#define SH_AUDMAPP_H
19
20#include <linux/dmaengine.h>
21
22struct audmapp_slave_config {
23 int slave_id;
24 dma_addr_t src;
25 dma_addr_t dst;
26 u32 chcr;
27};
28
29struct audmapp_pdata {
30 struct audmapp_slave_config *slave;
31 int slave_num;
32};
33
34#endif /* SH_AUDMAPP_H */
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h
index bf0a83b7ed9d..4edb40676b3f 100644
--- a/include/linux/platform_data/elm.h
+++ b/include/linux/platform_data/elm.h
@@ -26,13 +26,6 @@ enum bch_ecc {
26/* ELM support 8 error syndrome process */ 26/* ELM support 8 error syndrome process */
27#define ERROR_VECTOR_MAX 8 27#define ERROR_VECTOR_MAX 8
28 28
29#define BCH8_ECC_OOB_BYTES 13
30#define BCH4_ECC_OOB_BYTES 7
31/* RBL requires 14 byte even though BCH8 uses only 13 byte */
32#define BCH8_SIZE (BCH8_ECC_OOB_BYTES + 1)
33/* Uses 1 extra byte to handle erased pages */
34#define BCH4_SIZE (BCH4_ECC_OOB_BYTES + 1)
35
36/** 29/**
37 * struct elm_errorvec - error vector for elm 30 * struct elm_errorvec - error vector for elm
38 * @error_reported: set true for vectors error is reported 31 * @error_reported: set true for vectors error is reported
@@ -50,5 +43,6 @@ struct elm_errorvec {
50 43
51void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, 44void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc,
52 struct elm_errorvec *err_vec); 45 struct elm_errorvec *err_vec);
53int elm_config(struct device *dev, enum bch_ecc bch_type); 46int elm_config(struct device *dev, enum bch_ecc bch_type,
47 int ecc_steps, int ecc_step_size, int ecc_syndrome_size);
54#endif /* __ELM_H */ 48#endif /* __ELM_H */
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
index fbe2f7535741..6ace3fd32b6a 100644
--- a/include/linux/platform_data/gpio-davinci.h
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -21,10 +21,6 @@
21 21
22#include <asm-generic/gpio.h> 22#include <asm-generic/gpio.h>
23 23
24enum davinci_gpio_type {
25 GPIO_TYPE_TNETV107X = 0,
26};
27
28struct davinci_gpio_platform_data { 24struct davinci_gpio_platform_data {
29 u32 ngpio; 25 u32 ngpio;
30 u32 gpio_unbanked; 26 u32 gpio_unbanked;
diff --git a/include/linux/platform_data/i2c-s3c2410.h b/include/linux/platform_data/i2c-s3c2410.h
index 2a50048c1c44..05af66b840b9 100644
--- a/include/linux/platform_data/i2c-s3c2410.h
+++ b/include/linux/platform_data/i2c-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-s3c/include/plat/iic.h 1/*
2 *
3 * Copyright 2004-2009 Simtec Electronics 2 * Copyright 2004-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
@@ -10,8 +9,8 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
13#ifndef __ASM_ARCH_IIC_H 12#ifndef __I2C_S3C2410_H
14#define __ASM_ARCH_IIC_H __FILE__ 13#define __I2C_S3C2410_H __FILE__
15 14
16#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */ 15#define S3C_IICFLG_FILTER (1<<0) /* enable s3c2440 filter */
17 16
@@ -76,4 +75,4 @@ extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
76 75
77extern struct s3c2410_platform_i2c default_i2c_data; 76extern struct s3c2410_platform_i2c default_i2c_data;
78 77
79#endif /* __ASM_ARCH_IIC_H */ 78#endif /* __I2C_S3C2410_H */
diff --git a/include/linux/platform_data/leds-s3c24xx.h b/include/linux/platform_data/leds-s3c24xx.h
index d8a7672519b6..441a6f290649 100644
--- a/include/linux/platform_data/leds-s3c24xx.h
+++ b/include/linux/platform_data/leds-s3c24xx.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/leds-gpio.h 1/*
2 *
3 * Copyright (c) 2006 Simtec Electronics 2 * Copyright (c) 2006 Simtec Electronics
4 * http://armlinux.simtec.co.uk/ 3 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk> 4 * Ben Dooks <ben@simtec.co.uk>
@@ -11,8 +10,8 @@
11 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
12*/ 11*/
13 12
14#ifndef __ASM_ARCH_LEDSGPIO_H 13#ifndef __LEDS_S3C24XX_H
15#define __ASM_ARCH_LEDSGPIO_H "leds-gpio.h" 14#define __LEDS_S3C24XX_H
16 15
17#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */ 16#define S3C24XX_LEDF_ACTLOW (1<<0) /* LED is on when GPIO low */
18#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */ 17#define S3C24XX_LEDF_TRISTATE (1<<1) /* tristate to turn off */
@@ -25,4 +24,4 @@ struct s3c24xx_led_platdata {
25 char *def_trigger; 24 char *def_trigger;
26}; 25};
27 26
28#endif /* __ASM_ARCH_LEDSGPIO_H */ 27#endif /* __LEDS_S3C24XX_H */
diff --git a/include/linux/platform_data/max310x.h b/include/linux/platform_data/max310x.h
deleted file mode 100644
index dd11dcd1a184..000000000000
--- a/include/linux/platform_data/max310x.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Maxim (Dallas) MAX3107/8/9, MAX14830 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 4
41
42/* MAX310X platform data structure */
43struct max310x_pdata {
44 /* Flags global to driver */
45 const u8 driver_flags;
46#define MAX310X_EXT_CLK (0x00000001) /* External clock enable */
47 /* Flags global to UART port */
48 const u8 uart_flags[MAX310X_MAX_UARTS];
49#define MAX310X_LOOPBACK (0x00000001) /* Loopback mode enable */
50#define MAX310X_ECHO_SUPRESS (0x00000002) /* Enable echo supress */
51#define MAX310X_AUTO_DIR_CTRL (0x00000004) /* Enable Auto direction
52 * control (RS-485)
53 */
54 /* Frequency (extrenal clock or crystal) */
55 const int frequency;
56 /* GPIO base number (can be negative) */
57 const int gpio_base;
58 /* Called during startup */
59 void (*init)(void);
60 /* Called before finish */
61 void (*exit)(void);
62};
63
64#endif
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
index ffcd9e3a6a7e..55aa873c9396 100644
--- a/include/linux/platform_data/mmc-msm_sdcc.h
+++ b/include/linux/platform_data/mmc-msm_sdcc.h
@@ -1,8 +1,5 @@
1/* 1#ifndef __MMC_MSM_SDCC_H
2 * arch/arm/include/asm/mach/mmc.h 2#define __MMC_MSM_SDCC_H
3 */
4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H
6 3
7#include <linux/mmc/host.h> 4#include <linux/mmc/host.h>
8#include <linux/mmc/card.h> 5#include <linux/mmc/card.h>
diff --git a/include/linux/platform_data/mmc-mvsdio.h b/include/linux/platform_data/mmc-mvsdio.h
index 1190efedcb94..d02704cd3695 100644
--- a/include/linux/platform_data/mmc-mvsdio.h
+++ b/include/linux/platform_data/mmc-mvsdio.h
@@ -1,13 +1,11 @@
1/* 1/*
2 * arch/arm/plat-orion/include/plat/mvsdio.h
3 *
4 * This file is licensed under the terms of the GNU General Public 2 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any 3 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 4 * warranty of any kind, whether express or implied.
7 */ 5 */
8 6
9#ifndef __MACH_MVSDIO_H 7#ifndef __MMC_MVSDIO_H
10#define __MACH_MVSDIO_H 8#define __MMC_MVSDIO_H
11 9
12#include <linux/mbus.h> 10#include <linux/mbus.h>
13 11
diff --git a/include/linux/platform_data/mtd-davinci-aemif.h b/include/linux/platform_data/mtd-davinci-aemif.h
index 05b293443097..97948ac2bb9b 100644
--- a/include/linux/platform_data/mtd-davinci-aemif.h
+++ b/include/linux/platform_data/mtd-davinci-aemif.h
@@ -10,6 +10,8 @@
10#ifndef _MACH_DAVINCI_AEMIF_H 10#ifndef _MACH_DAVINCI_AEMIF_H
11#define _MACH_DAVINCI_AEMIF_H 11#define _MACH_DAVINCI_AEMIF_H
12 12
13#include <linux/platform_device.h>
14
13#define NRCSR_OFFSET 0x00 15#define NRCSR_OFFSET 0x00
14#define AWCCR_OFFSET 0x04 16#define AWCCR_OFFSET 0x04
15#define A1CR_OFFSET 0x10 17#define A1CR_OFFSET 0x10
@@ -31,6 +33,5 @@ struct davinci_aemif_timing {
31 u8 ta; 33 u8 ta;
32}; 34};
33 35
34int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, 36int davinci_aemif_setup(struct platform_device *pdev);
35 void __iomem *base, unsigned cs);
36#endif 37#endif
diff --git a/include/linux/platform_data/mtd-nand-s3c2410.h b/include/linux/platform_data/mtd-nand-s3c2410.h
index b64115fa93a4..36bb92172f47 100644
--- a/include/linux/platform_data/mtd-nand-s3c2410.h
+++ b/include/linux/platform_data/mtd-nand-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/mach-s3c2410/include/mach/nand.h 1/*
2 *
3 * Copyright (c) 2004 Simtec Electronics 2 * Copyright (c) 2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * 4 *
@@ -10,6 +9,9 @@
10 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
11*/ 10*/
12 11
12#ifndef __MTD_NAND_S3C2410_H
13#define __MTD_NAND_S3C2410_H
14
13/** 15/**
14 * struct s3c2410_nand_set - define a set of one or more nand chips 16 * struct s3c2410_nand_set - define a set of one or more nand chips
15 * @disable_ecc: Entirely disable ECC - Dangerous 17 * @disable_ecc: Entirely disable ECC - Dangerous
@@ -65,3 +67,5 @@ struct s3c2410_platform_nand {
65 * it with the s3c_device_nand. This allows @nand to be __initdata. 67 * it with the s3c_device_nand. This allows @nand to be __initdata.
66*/ 68*/
67extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand); 69extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
70
71#endif /*__MTD_NAND_S3C2410_H */
diff --git a/include/linux/platform_data/serial-imx.h b/include/linux/platform_data/serial-imx.h
index 4adec9b154dd..3cc2e3c40914 100644
--- a/include/linux/platform_data/serial-imx.h
+++ b/include/linux/platform_data/serial-imx.h
@@ -23,8 +23,6 @@
23#define IMXUART_IRDA (1<<1) 23#define IMXUART_IRDA (1<<1)
24 24
25struct imxuart_platform_data { 25struct imxuart_platform_data {
26 int (*init)(struct platform_device *pdev);
27 void (*exit)(struct platform_device *pdev);
28 unsigned int flags; 26 unsigned int flags;
29 void (*irda_enable)(int enable); 27 void (*irda_enable)(int enable);
30 unsigned int irda_inv_rx:1; 28 unsigned int irda_inv_rx:1;
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index 8447f634c7f5..d3889b98a1a1 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h 1/*
2 *
3 * Copyright (C) 2009 Samsung Electronics Ltd. 2 * Copyright (C) 2009 Samsung Electronics Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com> 3 * Jaswinder Singh <jassi.brar@samsung.com>
5 * 4 *
@@ -8,8 +7,8 @@
8 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
9 */ 8 */
10 9
11#ifndef __S3C64XX_PLAT_SPI_H 10#ifndef __SPI_S3C64XX_H
12#define __S3C64XX_PLAT_SPI_H 11#define __SPI_S3C64XX_H
13 12
14#include <linux/dmaengine.h> 13#include <linux/dmaengine.h>
15 14
@@ -68,4 +67,4 @@ extern int s3c64xx_spi2_cfg_gpio(void);
68extern struct s3c64xx_spi_info s3c64xx_spi0_pdata; 67extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
69extern struct s3c64xx_spi_info s3c64xx_spi1_pdata; 68extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
70extern struct s3c64xx_spi_info s3c64xx_spi2_pdata; 69extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
71#endif /* __S3C64XX_PLAT_SPI_H */ 70#endif /*__SPI_S3C64XX_H */
diff --git a/include/linux/platform_data/touchscreen-s3c2410.h b/include/linux/platform_data/touchscreen-s3c2410.h
index 26fdb22e0fc2..58dc7c5ae63b 100644
--- a/include/linux/platform_data/touchscreen-s3c2410.h
+++ b/include/linux/platform_data/touchscreen-s3c2410.h
@@ -1,5 +1,4 @@
1/* arch/arm/plat-samsung/include/plat/ts.h 1/*
2 *
3 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org> 2 * Copyright (c) 2005 Arnaud Patard <arnaud.patard@rtp-net.org>
4 * 3 *
5 * 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
@@ -7,14 +6,14 @@
7 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
8*/ 7*/
9 8
10#ifndef __ASM_ARM_TS_H 9#ifndef __TOUCHSCREEN_S3C2410_H
11#define __ASM_ARM_TS_H 10#define __TOUCHSCREEN_S3C2410_H
12 11
13struct s3c2410_ts_mach_info { 12struct s3c2410_ts_mach_info {
14 int delay; 13 int delay;
15 int presc; 14 int presc;
16 int oversampling_shift; 15 int oversampling_shift;
17 void (*cfg_gpio)(struct platform_device *dev); 16 void (*cfg_gpio)(struct platform_device *dev);
18}; 17};
19 18
20extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *); 19extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
@@ -22,4 +21,4 @@ extern void s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *);
22/* defined by architecture to configure gpio */ 21/* defined by architecture to configure gpio */
23extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev); 22extern void s3c24xx_ts_cfg_gpio(struct platform_device *dev);
24 23
25#endif /* __ASM_ARM_TS_H */ 24#endif /*__TOUCHSCREEN_S3C2410_H */
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index 9de8f062ad5d..18e908324549 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -61,24 +61,12 @@ struct imx_fb_platform_data {
61 struct imx_fb_videomode *mode; 61 struct imx_fb_videomode *mode;
62 int num_modes; 62 int num_modes;
63 63
64 u_int cmap_greyscale:1,
65 cmap_inverse:1,
66 cmap_static:1,
67 unused:29;
68
69 u_int pwmr; 64 u_int pwmr;
70 u_int lscr1; 65 u_int lscr1;
71 u_int dmacr; 66 u_int dmacr;
72 67
73 u_char * fixed_screen_cpu;
74 dma_addr_t fixed_screen_dma;
75
76 int (*init)(struct platform_device *); 68 int (*init)(struct platform_device *);
77 void (*exit)(struct platform_device *); 69 void (*exit)(struct platform_device *);
78
79 void (*lcd_power)(int);
80 void (*backlight_power)(int);
81}; 70};
82 71
83void set_imx_fb_info(struct imx_fb_platform_data *);
84#endif /* ifndef __MACH_IMXFB_H__ */ 72#endif /* ifndef __MACH_IMXFB_H__ */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8c6583a53a06..d915d0345fa1 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -264,9 +264,9 @@ typedef struct pm_message {
264 * registers, so that it is fully operational. 264 * registers, so that it is fully operational.
265 * 265 *
266 * @runtime_idle: Device appears to be inactive and it might be put into a 266 * @runtime_idle: Device appears to be inactive and it might be put into a
267 * low-power state if all of the necessary conditions are satisfied. Check 267 * low-power state if all of the necessary conditions are satisfied.
268 * these conditions and handle the device as appropriate, possibly queueing 268 * Check these conditions, and return 0 if it's appropriate to let the PM
269 * a suspend request for it. The return value is ignored by the PM core. 269 * core queue a suspend request for the device.
270 * 270 *
271 * Refer to Documentation/power/runtime_pm.txt for more information about the 271 * Refer to Documentation/power/runtime_pm.txt for more information about the
272 * role of the above callbacks in device runtime power management. 272 * role of the above callbacks in device runtime power management.
@@ -352,7 +352,7 @@ const struct dev_pm_ops name = { \
352 352
353/* 353/*
354 * Use this for defining a set of PM operations to be used in all situations 354 * Use this for defining a set of PM operations to be used in all situations
355 * (sustem suspend, hibernation or runtime PM). 355 * (system suspend, hibernation or runtime PM).
356 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should 356 * NOTE: In general, system suspend callbacks, .suspend() and .resume(), should
357 * be different from the corresponding runtime PM callbacks, .runtime_suspend(), 357 * be different from the corresponding runtime PM callbacks, .runtime_suspend(),
358 * and .runtime_resume(), because .runtime_suspend() always works on an already 358 * and .runtime_resume(), because .runtime_suspend() always works on an already
@@ -379,7 +379,7 @@ const struct dev_pm_ops name = { \
379 * 379 *
380 * ON No transition. 380 * ON No transition.
381 * 381 *
382 * FREEZE System is going to hibernate, call ->prepare() and ->freeze() 382 * FREEZE System is going to hibernate, call ->prepare() and ->freeze()
383 * for all devices. 383 * for all devices.
384 * 384 *
385 * SUSPEND System is going to suspend, call ->prepare() and ->suspend() 385 * SUSPEND System is going to suspend, call ->prepare() and ->suspend()
@@ -423,7 +423,7 @@ const struct dev_pm_ops name = { \
423 423
424#define PM_EVENT_INVALID (-1) 424#define PM_EVENT_INVALID (-1)
425#define PM_EVENT_ON 0x0000 425#define PM_EVENT_ON 0x0000
426#define PM_EVENT_FREEZE 0x0001 426#define PM_EVENT_FREEZE 0x0001
427#define PM_EVENT_SUSPEND 0x0002 427#define PM_EVENT_SUSPEND 0x0002
428#define PM_EVENT_HIBERNATE 0x0004 428#define PM_EVENT_HIBERNATE 0x0004
429#define PM_EVENT_QUIESCE 0x0008 429#define PM_EVENT_QUIESCE 0x0008
@@ -542,6 +542,8 @@ struct dev_pm_info {
542 unsigned int async_suspend:1; 542 unsigned int async_suspend:1;
543 bool is_prepared:1; /* Owned by the PM core */ 543 bool is_prepared:1; /* Owned by the PM core */
544 bool is_suspended:1; /* Ditto */ 544 bool is_suspended:1; /* Ditto */
545 bool is_noirq_suspended:1;
546 bool is_late_suspended:1;
545 bool ignore_children:1; 547 bool ignore_children:1;
546 bool early_init:1; /* Owned by the PM core */ 548 bool early_init:1; /* Owned by the PM core */
547 spinlock_t lock; 549 spinlock_t lock;
@@ -582,6 +584,7 @@ struct dev_pm_info {
582 unsigned long accounting_timestamp; 584 unsigned long accounting_timestamp;
583#endif 585#endif
584 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ 586 struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */
587 void (*set_latency_tolerance)(struct device *, s32);
585 struct dev_pm_qos *qos; 588 struct dev_pm_qos *qos;
586}; 589};
587 590
@@ -612,11 +615,11 @@ struct dev_pm_domain {
612 * message is implicit: 615 * message is implicit:
613 * 616 *
614 * ON Driver starts working again, responding to hardware events 617 * ON Driver starts working again, responding to hardware events
615 * and software requests. The hardware may have gone through 618 * and software requests. The hardware may have gone through
616 * a power-off reset, or it may have maintained state from the 619 * a power-off reset, or it may have maintained state from the
617 * previous suspend() which the driver will rely on while 620 * previous suspend() which the driver will rely on while
618 * resuming. On most platforms, there are no restrictions on 621 * resuming. On most platforms, there are no restrictions on
619 * availability of resources like clocks during resume(). 622 * availability of resources like clocks during resume().
620 * 623 *
621 * Other transitions are triggered by messages sent using suspend(). All 624 * Other transitions are triggered by messages sent using suspend(). All
622 * these transitions quiesce the driver, so that I/O queues are inactive. 625 * these transitions quiesce the driver, so that I/O queues are inactive.
@@ -626,21 +629,21 @@ struct dev_pm_domain {
626 * differ according to the message: 629 * differ according to the message:
627 * 630 *
628 * SUSPEND Quiesce, enter a low power device state appropriate for 631 * SUSPEND Quiesce, enter a low power device state appropriate for
629 * the upcoming system state (such as PCI_D3hot), and enable 632 * the upcoming system state (such as PCI_D3hot), and enable
630 * wakeup events as appropriate. 633 * wakeup events as appropriate.
631 * 634 *
632 * HIBERNATE Enter a low power device state appropriate for the hibernation 635 * HIBERNATE Enter a low power device state appropriate for the hibernation
633 * state (eg. ACPI S4) and enable wakeup events as appropriate. 636 * state (eg. ACPI S4) and enable wakeup events as appropriate.
634 * 637 *
635 * FREEZE Quiesce operations so that a consistent image can be saved; 638 * FREEZE Quiesce operations so that a consistent image can be saved;
636 * but do NOT otherwise enter a low power device state, and do 639 * but do NOT otherwise enter a low power device state, and do
637 * NOT emit system wakeup events. 640 * NOT emit system wakeup events.
638 * 641 *
639 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring 642 * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
640 * the system from a snapshot taken after an earlier FREEZE. 643 * the system from a snapshot taken after an earlier FREEZE.
641 * Some drivers will need to reset their hardware state instead 644 * Some drivers will need to reset their hardware state instead
642 * of preserving it, to ensure that it's never mistaken for the 645 * of preserving it, to ensure that it's never mistaken for the
643 * state which that earlier snapshot had set up. 646 * state which that earlier snapshot had set up.
644 * 647 *
645 * A minimally power-aware driver treats all messages as SUSPEND, fully 648 * A minimally power-aware driver treats all messages as SUSPEND, fully
646 * reinitializes its device during resume() -- whether or not it was reset 649 * reinitializes its device during resume() -- whether or not it was reset
@@ -717,14 +720,26 @@ static inline void dpm_for_each_dev(void *data, void (*fn)(struct device *, void
717{ 720{
718} 721}
719 722
720#define pm_generic_prepare NULL 723#define pm_generic_prepare NULL
721#define pm_generic_suspend NULL 724#define pm_generic_suspend_late NULL
722#define pm_generic_resume NULL 725#define pm_generic_suspend_noirq NULL
723#define pm_generic_freeze NULL 726#define pm_generic_suspend NULL
724#define pm_generic_thaw NULL 727#define pm_generic_resume_early NULL
725#define pm_generic_restore NULL 728#define pm_generic_resume_noirq NULL
726#define pm_generic_poweroff NULL 729#define pm_generic_resume NULL
727#define pm_generic_complete NULL 730#define pm_generic_freeze_noirq NULL
731#define pm_generic_freeze_late NULL
732#define pm_generic_freeze NULL
733#define pm_generic_thaw_noirq NULL
734#define pm_generic_thaw_early NULL
735#define pm_generic_thaw NULL
736#define pm_generic_restore_noirq NULL
737#define pm_generic_restore_early NULL
738#define pm_generic_restore NULL
739#define pm_generic_poweroff_noirq NULL
740#define pm_generic_poweroff_late NULL
741#define pm_generic_poweroff NULL
742#define pm_generic_complete NULL
728#endif /* !CONFIG_PM_SLEEP */ 743#endif /* !CONFIG_PM_SLEEP */
729 744
730/* How to reorder dpm_list after device_move() */ 745/* How to reorder dpm_list after device_move() */
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
index 5a95013905c8..9ab4bf7c4646 100644
--- a/include/linux/pm_qos.h
+++ b/include/linux/pm_qos.h
@@ -32,7 +32,10 @@ enum pm_qos_flags_status {
32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 32#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) 33#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 34#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
35#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 35#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
36#define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37#define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
38#define PM_QOS_LATENCY_ANY ((s32)(~(__u32)0 >> 1))
36 39
37#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0) 40#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
38#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1) 41#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
@@ -49,7 +52,8 @@ struct pm_qos_flags_request {
49}; 52};
50 53
51enum dev_pm_qos_req_type { 54enum dev_pm_qos_req_type {
52 DEV_PM_QOS_LATENCY = 1, 55 DEV_PM_QOS_RESUME_LATENCY = 1,
56 DEV_PM_QOS_LATENCY_TOLERANCE,
53 DEV_PM_QOS_FLAGS, 57 DEV_PM_QOS_FLAGS,
54}; 58};
55 59
@@ -77,6 +81,7 @@ struct pm_qos_constraints {
77 struct plist_head list; 81 struct plist_head list;
78 s32 target_value; /* Do not change to 64 bit */ 82 s32 target_value; /* Do not change to 64 bit */
79 s32 default_value; 83 s32 default_value;
84 s32 no_constraint_value;
80 enum pm_qos_type type; 85 enum pm_qos_type type;
81 struct blocking_notifier_head *notifiers; 86 struct blocking_notifier_head *notifiers;
82}; 87};
@@ -87,9 +92,11 @@ struct pm_qos_flags {
87}; 92};
88 93
89struct dev_pm_qos { 94struct dev_pm_qos {
90 struct pm_qos_constraints latency; 95 struct pm_qos_constraints resume_latency;
96 struct pm_qos_constraints latency_tolerance;
91 struct pm_qos_flags flags; 97 struct pm_qos_flags flags;
92 struct dev_pm_qos_request *latency_req; 98 struct dev_pm_qos_request *resume_latency_req;
99 struct dev_pm_qos_request *latency_tolerance_req;
93 struct dev_pm_qos_request *flags_req; 100 struct dev_pm_qos_request *flags_req;
94}; 101};
95 102
@@ -142,7 +149,8 @@ int dev_pm_qos_remove_global_notifier(struct notifier_block *notifier);
142void dev_pm_qos_constraints_init(struct device *dev); 149void dev_pm_qos_constraints_init(struct device *dev);
143void dev_pm_qos_constraints_destroy(struct device *dev); 150void dev_pm_qos_constraints_destroy(struct device *dev);
144int dev_pm_qos_add_ancestor_request(struct device *dev, 151int dev_pm_qos_add_ancestor_request(struct device *dev,
145 struct dev_pm_qos_request *req, s32 value); 152 struct dev_pm_qos_request *req,
153 enum dev_pm_qos_req_type type, s32 value);
146#else 154#else
147static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, 155static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
148 s32 mask) 156 s32 mask)
@@ -185,7 +193,9 @@ static inline void dev_pm_qos_constraints_destroy(struct device *dev)
185 dev->power.power_state = PMSG_INVALID; 193 dev->power.power_state = PMSG_INVALID;
186} 194}
187static inline int dev_pm_qos_add_ancestor_request(struct device *dev, 195static inline int dev_pm_qos_add_ancestor_request(struct device *dev,
188 struct dev_pm_qos_request *req, s32 value) 196 struct dev_pm_qos_request *req,
197 enum dev_pm_qos_req_type type,
198 s32 value)
189 { return 0; } 199 { return 0; }
190#endif 200#endif
191 201
@@ -195,10 +205,12 @@ void dev_pm_qos_hide_latency_limit(struct device *dev);
195int dev_pm_qos_expose_flags(struct device *dev, s32 value); 205int dev_pm_qos_expose_flags(struct device *dev, s32 value);
196void dev_pm_qos_hide_flags(struct device *dev); 206void dev_pm_qos_hide_flags(struct device *dev);
197int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set); 207int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
208s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
209int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
198 210
199static inline s32 dev_pm_qos_requested_latency(struct device *dev) 211static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
200{ 212{
201 return dev->power.qos->latency_req->data.pnode.prio; 213 return dev->power.qos->resume_latency_req->data.pnode.prio;
202} 214}
203 215
204static inline s32 dev_pm_qos_requested_flags(struct device *dev) 216static inline s32 dev_pm_qos_requested_flags(struct device *dev)
@@ -214,8 +226,12 @@ static inline int dev_pm_qos_expose_flags(struct device *dev, s32 value)
214static inline void dev_pm_qos_hide_flags(struct device *dev) {} 226static inline void dev_pm_qos_hide_flags(struct device *dev) {}
215static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set) 227static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
216 { return 0; } 228 { return 0; }
229static inline s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev)
230 { return PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT; }
231static inline int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val)
232 { return 0; }
217 233
218static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; } 234static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; }
219static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; } 235static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }
220#endif 236#endif
221 237
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 16c9a62fa1c0..2a5897a4afbc 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -26,9 +26,13 @@
26#ifdef CONFIG_PM 26#ifdef CONFIG_PM
27extern int pm_generic_runtime_suspend(struct device *dev); 27extern int pm_generic_runtime_suspend(struct device *dev);
28extern int pm_generic_runtime_resume(struct device *dev); 28extern int pm_generic_runtime_resume(struct device *dev);
29extern int pm_runtime_force_suspend(struct device *dev);
30extern int pm_runtime_force_resume(struct device *dev);
29#else 31#else
30static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 32static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
31static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 33static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
34static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
35static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
32#endif 36#endif
33 37
34#ifdef CONFIG_PM_RUNTIME 38#ifdef CONFIG_PM_RUNTIME
diff --git a/include/linux/printk.h b/include/linux/printk.h
index fa47e2708c01..8752f7595b27 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -24,13 +24,9 @@ static inline int printk_get_level(const char *buffer)
24 24
25static inline const char *printk_skip_level(const char *buffer) 25static inline const char *printk_skip_level(const char *buffer)
26{ 26{
27 if (printk_get_level(buffer)) { 27 if (printk_get_level(buffer))
28 switch (buffer[1]) { 28 return buffer + 2;
29 case '0' ... '7': 29
30 case 'd': /* KERN_DEFAULT */
31 return buffer + 2;
32 }
33 }
34 return buffer; 30 return buffer;
35} 31}
36 32
@@ -124,9 +120,9 @@ asmlinkage __printf(1, 0)
124int vprintk(const char *fmt, va_list args); 120int vprintk(const char *fmt, va_list args);
125 121
126asmlinkage __printf(5, 6) __cold 122asmlinkage __printf(5, 6) __cold
127asmlinkage int printk_emit(int facility, int level, 123int printk_emit(int facility, int level,
128 const char *dict, size_t dictlen, 124 const char *dict, size_t dictlen,
129 const char *fmt, ...); 125 const char *fmt, ...);
130 126
131asmlinkage __printf(1, 2) __cold 127asmlinkage __printf(1, 2) __cold
132int printk(const char *fmt, ...); 128int printk(const char *fmt, ...);
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
index 1dc420ba213a..7dfed71d76a6 100644
--- a/include/linux/ptp_classify.h
+++ b/include/linux/ptp_classify.h
@@ -23,15 +23,8 @@
23#ifndef _PTP_CLASSIFY_H_ 23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_ 24#define _PTP_CLASSIFY_H_
25 25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/ip.h> 26#include <linux/ip.h>
29#include <linux/filter.h> 27#include <linux/skbuff.h>
30#ifdef __KERNEL__
31#include <linux/in.h>
32#else
33#include <netinet/in.h>
34#endif
35 28
36#define PTP_CLASS_NONE 0x00 /* not a PTP event message */ 29#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
37#define PTP_CLASS_V1 0x01 /* protocol version 1 */ 30#define PTP_CLASS_V1 0x01 /* protocol version 1 */
@@ -44,7 +37,7 @@
44#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */ 37#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
45 38
46#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4) 39#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
47#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/ 40#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /* probably DNE */
48#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4) 41#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
49#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6) 42#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
50#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2) 43#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
@@ -53,88 +46,34 @@
53#define PTP_EV_PORT 319 46#define PTP_EV_PORT 319
54#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */ 47#define PTP_GEN_BIT 0x08 /* indicates general message, if set in message type */
55 48
56#define OFF_ETYPE 12
57#define OFF_IHL 14
58#define OFF_FRAG 20
59#define OFF_PROTO4 23
60#define OFF_NEXT 6
61#define OFF_UDP_DST 2
62
63#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */ 49#define OFF_PTP_SOURCE_UUID 22 /* PTPv1 only */
64#define OFF_PTP_SEQUENCE_ID 30 50#define OFF_PTP_SEQUENCE_ID 30
65#define OFF_PTP_CONTROL 32 /* PTPv1 only */ 51#define OFF_PTP_CONTROL 32 /* PTPv1 only */
66 52
67#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2) 53/* Below defines should actually be removed at some point in time. */
68
69#define IP6_HLEN 40 54#define IP6_HLEN 40
70#define UDP_HLEN 8 55#define UDP_HLEN 8
71 56#define OFF_IHL 14
72#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
73#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
74#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN) 57#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
58#define IPV4_HLEN(data) (((struct iphdr *)(data + OFF_IHL))->ihl << 2)
75 59
76#define OP_AND (BPF_ALU | BPF_AND | BPF_K) 60#if defined(CONFIG_NET_PTP_CLASSIFY)
77#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K) 61/**
78#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K) 62 * ptp_classify_raw - classify a PTP packet
79#define OP_LDB (BPF_LD | BPF_B | BPF_ABS) 63 * @skb: buffer
80#define OP_LDH (BPF_LD | BPF_H | BPF_ABS) 64 *
81#define OP_LDHI (BPF_LD | BPF_H | BPF_IND) 65 * Runs a minimal BPF dissector to classify a network packet to
82#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH) 66 * determine the PTP class. In case the skb does not contain any
83#define OP_OR (BPF_ALU | BPF_OR | BPF_K) 67 * PTP protocol data, PTP_CLASS_NONE will be returned, otherwise
84#define OP_RETA (BPF_RET | BPF_A) 68 * PTP_CLASS_V1_IPV{4,6}, PTP_CLASS_V2_IPV{4,6} or
85#define OP_RETK (BPF_RET | BPF_K) 69 * PTP_CLASS_V2_{L2,VLAN}, depending on the packet content.
70 */
71unsigned int ptp_classify_raw(const struct sk_buff *skb);
86 72
87static inline int ptp_filter_init(struct sock_filter *f, int len) 73void __init ptp_classifier_init(void);
74#else
75static inline void ptp_classifier_init(void)
88{ 76{
89 if (OP_LDH == f[0].code)
90 return sk_chk_filter(f, len);
91 else
92 return 0;
93} 77}
94
95#define PTP_FILTER \
96 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
97 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
98 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
99 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
100 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
101 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
102 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
103 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
104 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
105 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
106 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
107 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
108 {OP_RETA, 0, 0, 0 }, /* */ \
109/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
110/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
111 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
112 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
113 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
114 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
115 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
120/*L40*/ {OP_JEQ, 0, 9, ETH_P_8021Q }, /* f goto L50 */ \
121 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
122 {OP_JEQ, 0, 15, ETH_P_1588 }, /* f goto L60 */ \
123 {OP_LDB, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
124 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
125 {OP_JEQ, 0, 12, 0 }, /* f goto L6x */ \
126 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
127 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
128 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
129 {OP_RETA, 0, 0, 0 }, /* */ \
130/*L50*/ {OP_JEQ, 0, 7, ETH_P_1588 }, /* f goto L61 */ \
131 {OP_LDB, 0, 0, ETH_HLEN }, /* */ \
132 {OP_AND, 0, 0, PTP_GEN_BIT }, /* */ \
133 {OP_JEQ, 0, 4, 0 }, /* f goto L6x */ \
134 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
135 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
136 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
137 {OP_RETA, 0, 0, 0 }, /* */ \
138/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
139
140#endif 78#endif
79#endif /* _PTP_CLASSIFY_H_ */
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index 38a993508327..0d8ff3fb84ba 100644
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -49,7 +49,11 @@ struct ptp_clock_request {
49 * @n_alarm: The number of programmable alarms. 49 * @n_alarm: The number of programmable alarms.
50 * @n_ext_ts: The number of external time stamp channels. 50 * @n_ext_ts: The number of external time stamp channels.
51 * @n_per_out: The number of programmable periodic signals. 51 * @n_per_out: The number of programmable periodic signals.
52 * @n_pins: The number of programmable pins.
52 * @pps: Indicates whether the clock supports a PPS callback. 53 * @pps: Indicates whether the clock supports a PPS callback.
54 * @pin_config: Array of length 'n_pins'. If the number of
55 * programmable pins is nonzero, then drivers must
56 * allocate and initialize this array.
53 * 57 *
54 * clock operations 58 * clock operations
55 * 59 *
@@ -70,6 +74,18 @@ struct ptp_clock_request {
70 * parameter request: Desired resource to enable or disable. 74 * parameter request: Desired resource to enable or disable.
71 * parameter on: Caller passes one to enable or zero to disable. 75 * parameter on: Caller passes one to enable or zero to disable.
72 * 76 *
77 * @verify: Confirm that a pin can perform a given function. The PTP
78 * Hardware Clock subsystem maintains the 'pin_config'
79 * array on behalf of the drivers, but the PHC subsystem
80 * assumes that every pin can perform every function. This
81 * hook gives drivers a way of telling the core about
82 * limitations on specific pins. This function must return
83 * zero if the function can be assigned to this pin, and
84 * nonzero otherwise.
85 * parameter pin: index of the pin in question.
86 * parameter func: the desired function to use.
87 * parameter chan: the function channel index to use.
88 *
73 * Drivers should embed their ptp_clock_info within a private 89 * Drivers should embed their ptp_clock_info within a private
74 * structure, obtaining a reference to it using container_of(). 90 * structure, obtaining a reference to it using container_of().
75 * 91 *
@@ -83,13 +99,17 @@ struct ptp_clock_info {
83 int n_alarm; 99 int n_alarm;
84 int n_ext_ts; 100 int n_ext_ts;
85 int n_per_out; 101 int n_per_out;
102 int n_pins;
86 int pps; 103 int pps;
104 struct ptp_pin_desc *pin_config;
87 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta); 105 int (*adjfreq)(struct ptp_clock_info *ptp, s32 delta);
88 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); 106 int (*adjtime)(struct ptp_clock_info *ptp, s64 delta);
89 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts); 107 int (*gettime)(struct ptp_clock_info *ptp, struct timespec *ts);
90 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts); 108 int (*settime)(struct ptp_clock_info *ptp, const struct timespec *ts);
91 int (*enable)(struct ptp_clock_info *ptp, 109 int (*enable)(struct ptp_clock_info *ptp,
92 struct ptp_clock_request *request, int on); 110 struct ptp_clock_request *request, int on);
111 int (*verify)(struct ptp_clock_info *ptp, unsigned int pin,
112 enum ptp_pin_function func, unsigned int chan);
93}; 113};
94 114
95struct ptp_clock; 115struct ptp_clock;
@@ -156,4 +176,17 @@ extern void ptp_clock_event(struct ptp_clock *ptp,
156 176
157extern int ptp_clock_index(struct ptp_clock *ptp); 177extern int ptp_clock_index(struct ptp_clock *ptp);
158 178
179/**
180 * ptp_find_pin() - obtain the pin index of a given auxiliary function
181 *
182 * @ptp: The clock obtained from ptp_clock_register().
183 * @func: One of the ptp_pin_function enumerated values.
184 * @chan: The particular functional channel to find.
185 * Return: Pin index in the range of zero to ptp_clock_caps.n_pins - 1,
186 * or -1 if the auxiliary function cannot be found.
187 */
188
189int ptp_find_pin(struct ptp_clock *ptp,
190 enum ptp_pin_function func, unsigned int chan);
191
159#endif 192#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index f0feafd184a0..4717f54051cb 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -7,7 +7,7 @@
7struct pwm_device; 7struct pwm_device;
8struct seq_file; 8struct seq_file;
9 9
10#if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM) 10#if IS_ENABLED(CONFIG_PWM)
11/* 11/*
12 * pwm_request - request a PWM device 12 * pwm_request - request a PWM device
13 */ 13 */
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 49444203328a..f2b405116166 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -219,7 +219,7 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)
219 return __raw_readl(dev->mmio_base + reg); 219 return __raw_readl(dev->mmio_base + reg);
220} 220}
221 221
222#ifdef CONFIG_ARCH_PXA 222#if IS_ENABLED(CONFIG_PXA_SSP)
223struct ssp_device *pxa_ssp_request(int port, const char *label); 223struct ssp_device *pxa_ssp_request(int port, const char *label);
224void pxa_ssp_free(struct ssp_device *); 224void pxa_ssp_free(struct ssp_device *);
225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node, 225struct ssp_device *pxa_ssp_request_of(const struct device_node *of_node,
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 6965fe394c3b..1d3eee594cd6 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -46,6 +46,14 @@ void inode_reclaim_rsv_space(struct inode *inode, qsize_t number);
46void dquot_initialize(struct inode *inode); 46void dquot_initialize(struct inode *inode);
47void dquot_drop(struct inode *inode); 47void dquot_drop(struct inode *inode);
48struct dquot *dqget(struct super_block *sb, struct kqid qid); 48struct dquot *dqget(struct super_block *sb, struct kqid qid);
49static inline struct dquot *dqgrab(struct dquot *dquot)
50{
51 /* Make sure someone else has active reference to dquot */
52 WARN_ON_ONCE(!atomic_read(&dquot->dq_count));
53 WARN_ON_ONCE(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags));
54 atomic_inc(&dquot->dq_count);
55 return dquot;
56}
49void dqput(struct dquot *dquot); 57void dqput(struct dquot *dquot);
50int dquot_scan_active(struct super_block *sb, 58int dquot_scan_active(struct super_block *sb,
51 int (*fn)(struct dquot *dquot, unsigned long priv), 59 int (*fn)(struct dquot *dquot, unsigned long priv),
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 403940787be1..33170dbd9db4 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -60,6 +60,49 @@ static inline int radix_tree_is_indirect_ptr(void *ptr)
60 60
61#define RADIX_TREE_MAX_TAGS 3 61#define RADIX_TREE_MAX_TAGS 3
62 62
63#ifdef __KERNEL__
64#define RADIX_TREE_MAP_SHIFT (CONFIG_BASE_SMALL ? 4 : 6)
65#else
66#define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */
67#endif
68
69#define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT)
70#define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1)
71
72#define RADIX_TREE_TAG_LONGS \
73 ((RADIX_TREE_MAP_SIZE + BITS_PER_LONG - 1) / BITS_PER_LONG)
74
75#define RADIX_TREE_INDEX_BITS (8 /* CHAR_BIT */ * sizeof(unsigned long))
76#define RADIX_TREE_MAX_PATH (DIV_ROUND_UP(RADIX_TREE_INDEX_BITS, \
77 RADIX_TREE_MAP_SHIFT))
78
79/* Height component in node->path */
80#define RADIX_TREE_HEIGHT_SHIFT (RADIX_TREE_MAX_PATH + 1)
81#define RADIX_TREE_HEIGHT_MASK ((1UL << RADIX_TREE_HEIGHT_SHIFT) - 1)
82
83/* Internally used bits of node->count */
84#define RADIX_TREE_COUNT_SHIFT (RADIX_TREE_MAP_SHIFT + 1)
85#define RADIX_TREE_COUNT_MASK ((1UL << RADIX_TREE_COUNT_SHIFT) - 1)
86
87struct radix_tree_node {
88 unsigned int path; /* Offset in parent & height from the bottom */
89 unsigned int count;
90 union {
91 struct {
92 /* Used when ascending tree */
93 struct radix_tree_node *parent;
94 /* For tree user */
95 void *private_data;
96 };
97 /* Used when freeing node */
98 struct rcu_head rcu_head;
99 };
100 /* For tree user */
101 struct list_head private_list;
102 void __rcu *slots[RADIX_TREE_MAP_SIZE];
103 unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS];
104};
105
63/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */ 106/* root tags are stored in gfp_mask, shifted by __GFP_BITS_SHIFT */
64struct radix_tree_root { 107struct radix_tree_root {
65 unsigned int height; 108 unsigned int height;
@@ -101,6 +144,7 @@ do { \
101 * concurrently with other readers. 144 * concurrently with other readers.
102 * 145 *
103 * The notable exceptions to this rule are the following functions: 146 * The notable exceptions to this rule are the following functions:
147 * __radix_tree_lookup
104 * radix_tree_lookup 148 * radix_tree_lookup
105 * radix_tree_lookup_slot 149 * radix_tree_lookup_slot
106 * radix_tree_tag_get 150 * radix_tree_tag_get
@@ -216,9 +260,16 @@ static inline void radix_tree_replace_slot(void **pslot, void *item)
216 rcu_assign_pointer(*pslot, item); 260 rcu_assign_pointer(*pslot, item);
217} 261}
218 262
263int __radix_tree_create(struct radix_tree_root *root, unsigned long index,
264 struct radix_tree_node **nodep, void ***slotp);
219int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 265int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
266void *__radix_tree_lookup(struct radix_tree_root *root, unsigned long index,
267 struct radix_tree_node **nodep, void ***slotp);
220void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 268void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
221void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); 269void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
270bool __radix_tree_delete_node(struct radix_tree_root *root,
271 struct radix_tree_node *node);
272void *radix_tree_delete_item(struct radix_tree_root *, unsigned long, void *);
222void *radix_tree_delete(struct radix_tree_root *, unsigned long); 273void *radix_tree_delete(struct radix_tree_root *, unsigned long);
223unsigned int 274unsigned int
224radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 275radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
@@ -226,10 +277,6 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
226unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root, 277unsigned int radix_tree_gang_lookup_slot(struct radix_tree_root *root,
227 void ***results, unsigned long *indices, 278 void ***results, unsigned long *indices,
228 unsigned long first_index, unsigned int max_items); 279 unsigned long first_index, unsigned int max_items);
229unsigned long radix_tree_next_hole(struct radix_tree_root *root,
230 unsigned long index, unsigned long max_scan);
231unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
232 unsigned long index, unsigned long max_scan);
233int radix_tree_preload(gfp_t gfp_mask); 280int radix_tree_preload(gfp_t gfp_mask);
234int radix_tree_maybe_preload(gfp_t gfp_mask); 281int radix_tree_maybe_preload(gfp_t gfp_mask);
235void radix_tree_init(void); 282void radix_tree_init(void);
diff --git a/include/linux/random.h b/include/linux/random.h
index 1cfce0e24dbd..57fbbffd77a0 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -88,6 +88,22 @@ static inline int arch_get_random_int(unsigned int *v)
88{ 88{
89 return 0; 89 return 0;
90} 90}
91static inline int arch_has_random(void)
92{
93 return 0;
94}
95static inline int arch_get_random_seed_long(unsigned long *v)
96{
97 return 0;
98}
99static inline int arch_get_random_seed_int(unsigned int *v)
100{
101 return 0;
102}
103static inline int arch_has_random_seed(void)
104{
105 return 0;
106}
91#endif 107#endif
92 108
93/* Pseudo random number generator from numerical recipes. */ 109/* Pseudo random number generator from numerical recipes. */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 4149f1a9b003..85691b9b4fa7 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -164,6 +164,9 @@ typedef void (*regmap_unlock)(void *);
164 * @use_single_rw: If set, converts the bulk read and write operations into 164 * @use_single_rw: If set, converts the bulk read and write operations into
165 * a series of single read and write operations. This is useful 165 * a series of single read and write operations. This is useful
166 * for device that does not support bulk read and write. 166 * for device that does not support bulk read and write.
167 * @can_multi_write: If set, the device supports the multi write mode of bulk
168 * write operations, if clear multi write requests will be
169 * split into individual write operations
167 * 170 *
168 * @cache_type: The actual cache type. 171 * @cache_type: The actual cache type.
169 * @reg_defaults_raw: Power on reset values for registers (for use with 172 * @reg_defaults_raw: Power on reset values for registers (for use with
@@ -215,6 +218,7 @@ struct regmap_config {
215 u8 write_flag_mask; 218 u8 write_flag_mask;
216 219
217 bool use_single_rw; 220 bool use_single_rw;
221 bool can_multi_write;
218 222
219 enum regmap_endian reg_format_endian; 223 enum regmap_endian reg_format_endian;
220 enum regmap_endian val_format_endian; 224 enum regmap_endian val_format_endian;
@@ -317,12 +321,16 @@ struct regmap *regmap_init(struct device *dev,
317 const struct regmap_bus *bus, 321 const struct regmap_bus *bus,
318 void *bus_context, 322 void *bus_context,
319 const struct regmap_config *config); 323 const struct regmap_config *config);
324int regmap_attach_dev(struct device *dev, struct regmap *map,
325 const struct regmap_config *config);
320struct regmap *regmap_init_i2c(struct i2c_client *i2c, 326struct regmap *regmap_init_i2c(struct i2c_client *i2c,
321 const struct regmap_config *config); 327 const struct regmap_config *config);
322struct regmap *regmap_init_spi(struct spi_device *dev, 328struct regmap *regmap_init_spi(struct spi_device *dev,
323 const struct regmap_config *config); 329 const struct regmap_config *config);
324struct regmap *regmap_init_spmi(struct spmi_device *dev, 330struct regmap *regmap_init_spmi_base(struct spmi_device *dev,
325 const struct regmap_config *config); 331 const struct regmap_config *config);
332struct regmap *regmap_init_spmi_ext(struct spmi_device *dev,
333 const struct regmap_config *config);
326struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 334struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
327 void __iomem *regs, 335 void __iomem *regs,
328 const struct regmap_config *config); 336 const struct regmap_config *config);
@@ -335,8 +343,10 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
335 const struct regmap_config *config); 343 const struct regmap_config *config);
336struct regmap *devm_regmap_init_spi(struct spi_device *dev, 344struct regmap *devm_regmap_init_spi(struct spi_device *dev,
337 const struct regmap_config *config); 345 const struct regmap_config *config);
338struct regmap *devm_regmap_init_spmi(struct spmi_device *dev, 346struct regmap *devm_regmap_init_spmi_base(struct spmi_device *dev,
339 const struct regmap_config *config); 347 const struct regmap_config *config);
348struct regmap *devm_regmap_init_spmi_ext(struct spmi_device *dev,
349 const struct regmap_config *config);
340struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 350struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
341 void __iomem *regs, 351 void __iomem *regs,
342 const struct regmap_config *config); 352 const struct regmap_config *config);
@@ -386,8 +396,11 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
386 const void *val, size_t val_len); 396 const void *val, size_t val_len);
387int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 397int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
388 size_t val_count); 398 size_t val_count);
389int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs, 399int regmap_multi_reg_write(struct regmap *map, const struct reg_default *regs,
390 int num_regs); 400 int num_regs);
401int regmap_multi_reg_write_bypassed(struct regmap *map,
402 const struct reg_default *regs,
403 int num_regs);
391int regmap_raw_write_async(struct regmap *map, unsigned int reg, 404int regmap_raw_write_async(struct regmap *map, unsigned int reg,
392 const void *val, size_t val_len); 405 const void *val, size_t val_len);
393int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 406int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
@@ -423,6 +436,8 @@ bool regmap_check_range_table(struct regmap *map, unsigned int reg,
423 436
424int regmap_register_patch(struct regmap *map, const struct reg_default *regs, 437int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
425 int num_regs); 438 int num_regs);
439int regmap_parse_val(struct regmap *map, const void *buf,
440 unsigned int *val);
426 441
427static inline bool regmap_reg_in_range(unsigned int reg, 442static inline bool regmap_reg_in_range(unsigned int reg,
428 const struct regmap_range *range) 443 const struct regmap_range *range)
@@ -695,6 +710,13 @@ static inline int regmap_register_patch(struct regmap *map,
695 return -EINVAL; 710 return -EINVAL;
696} 711}
697 712
713static inline int regmap_parse_val(struct regmap *map, const void *buf,
714 unsigned int *val)
715{
716 WARN_ONCE(1, "regmap API is disabled");
717 return -EINVAL;
718}
719
698static inline struct regmap *dev_get_regmap(struct device *dev, 720static inline struct regmap *dev_get_regmap(struct device *dev,
699 const char *name) 721 const char *name)
700{ 722{
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 9370e65348a4..bbe03a1924c0 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -228,10 +228,14 @@ enum regulator_type {
228 * output when using regulator_set_voltage_sel_regmap 228 * output when using regulator_set_voltage_sel_regmap
229 * @enable_reg: Register for control when using regmap enable/disable ops 229 * @enable_reg: Register for control when using regmap enable/disable ops
230 * @enable_mask: Mask for control when using regmap enable/disable ops 230 * @enable_mask: Mask for control when using regmap enable/disable ops
231 * @enable_val: Enabling value for control when using regmap enable/disable ops
232 * @disable_val: Disabling value for control when using regmap enable/disable ops
231 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable 233 * @enable_is_inverted: A flag to indicate set enable_mask bits to disable
232 * when using regulator_enable_regmap and friends APIs. 234 * when using regulator_enable_regmap and friends APIs.
233 * @bypass_reg: Register for control when using regmap set_bypass 235 * @bypass_reg: Register for control when using regmap set_bypass
234 * @bypass_mask: Mask for control when using regmap set_bypass 236 * @bypass_mask: Mask for control when using regmap set_bypass
237 * @bypass_val_on: Enabling value for control when using regmap set_bypass
238 * @bypass_val_off: Disabling value for control when using regmap set_bypass
235 * 239 *
236 * @enable_time: Time taken for initial enable of regulator (in uS). 240 * @enable_time: Time taken for initial enable of regulator (in uS).
237 */ 241 */
@@ -263,9 +267,13 @@ struct regulator_desc {
263 unsigned int apply_bit; 267 unsigned int apply_bit;
264 unsigned int enable_reg; 268 unsigned int enable_reg;
265 unsigned int enable_mask; 269 unsigned int enable_mask;
270 unsigned int enable_val;
271 unsigned int disable_val;
266 bool enable_is_inverted; 272 bool enable_is_inverted;
267 unsigned int bypass_reg; 273 unsigned int bypass_reg;
268 unsigned int bypass_mask; 274 unsigned int bypass_mask;
275 unsigned int bypass_val_on;
276 unsigned int bypass_val_off;
269 277
270 unsigned int enable_time; 278 unsigned int enable_time;
271}; 279};
diff --git a/include/linux/regulator/pfuze100.h b/include/linux/regulator/pfuze100.h
index 65d550bf3954..364f7a7c43db 100644
--- a/include/linux/regulator/pfuze100.h
+++ b/include/linux/regulator/pfuze100.h
@@ -35,6 +35,20 @@
35#define PFUZE100_VGEN6 14 35#define PFUZE100_VGEN6 14
36#define PFUZE100_MAX_REGULATOR 15 36#define PFUZE100_MAX_REGULATOR 15
37 37
38#define PFUZE200_SW1AB 0
39#define PFUZE200_SW2 1
40#define PFUZE200_SW3A 2
41#define PFUZE200_SW3B 3
42#define PFUZE200_SWBST 4
43#define PFUZE200_VSNVS 5
44#define PFUZE200_VREFDDR 6
45#define PFUZE200_VGEN1 7
46#define PFUZE200_VGEN2 8
47#define PFUZE200_VGEN3 9
48#define PFUZE200_VGEN4 10
49#define PFUZE200_VGEN5 11
50#define PFUZE200_VGEN6 12
51
38struct regulator_init_data; 52struct regulator_init_data;
39 53
40struct pfuze_regulator_platform_data { 54struct pfuze_regulator_platform_data {
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 201a69749659..56b7bc32db4f 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -104,15 +104,13 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent);
104 * units, e.g. numbers, bytes, Kbytes, etc 104 * units, e.g. numbers, bytes, Kbytes, etc
105 * 105 *
106 * returns 0 on success and <0 if the counter->usage will exceed the 106 * returns 0 on success and <0 if the counter->usage will exceed the
107 * counter->limit _locked call expects the counter->lock to be taken 107 * counter->limit
108 * 108 *
109 * charge_nofail works the same, except that it charges the resource 109 * charge_nofail works the same, except that it charges the resource
110 * counter unconditionally, and returns < 0 if the after the current 110 * counter unconditionally, and returns < 0 if the after the current
111 * charge we are over limit. 111 * charge we are over limit.
112 */ 112 */
113 113
114int __must_check res_counter_charge_locked(struct res_counter *counter,
115 unsigned long val, bool force);
116int __must_check res_counter_charge(struct res_counter *counter, 114int __must_check res_counter_charge(struct res_counter *counter,
117 unsigned long val, struct res_counter **limit_fail_at); 115 unsigned long val, struct res_counter **limit_fail_at);
118int res_counter_charge_nofail(struct res_counter *counter, 116int res_counter_charge_nofail(struct res_counter *counter,
@@ -125,12 +123,10 @@ int res_counter_charge_nofail(struct res_counter *counter,
125 * @val: the amount of the resource 123 * @val: the amount of the resource
126 * 124 *
127 * these calls check for usage underflow and show a warning on the console 125 * these calls check for usage underflow and show a warning on the console
128 * _locked call expects the counter->lock to be taken
129 * 126 *
130 * returns the total charges still present in @counter. 127 * returns the total charges still present in @counter.
131 */ 128 */
132 129
133u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val);
134u64 res_counter_uncharge(struct res_counter *counter, unsigned long val); 130u64 res_counter_uncharge(struct res_counter *counter, unsigned long val);
135 131
136u64 res_counter_uncharge_until(struct res_counter *counter, 132u64 res_counter_uncharge_until(struct res_counter *counter,
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 6082247feab1..c0eda5023d74 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -4,6 +4,8 @@
4struct device; 4struct device;
5struct reset_control; 5struct reset_control;
6 6
7#ifdef CONFIG_RESET_CONTROLLER
8
7int reset_control_reset(struct reset_control *rstc); 9int reset_control_reset(struct reset_control *rstc);
8int reset_control_assert(struct reset_control *rstc); 10int reset_control_assert(struct reset_control *rstc);
9int reset_control_deassert(struct reset_control *rstc); 11int reset_control_deassert(struct reset_control *rstc);
@@ -12,6 +14,67 @@ struct reset_control *reset_control_get(struct device *dev, const char *id);
12void reset_control_put(struct reset_control *rstc); 14void reset_control_put(struct reset_control *rstc);
13struct reset_control *devm_reset_control_get(struct device *dev, const char *id); 15struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
14 16
15int device_reset(struct device *dev); 17int __must_check device_reset(struct device *dev);
18
19static inline int device_reset_optional(struct device *dev)
20{
21 return device_reset(dev);
22}
23
24static inline struct reset_control *reset_control_get_optional(
25 struct device *dev, const char *id)
26{
27 return reset_control_get(dev, id);
28}
29
30static inline struct reset_control *devm_reset_control_get_optional(
31 struct device *dev, const char *id)
32{
33 return devm_reset_control_get(dev, id);
34}
35
36#else
37
38static inline int reset_control_reset(struct reset_control *rstc)
39{
40 WARN_ON(1);
41 return 0;
42}
43
44static inline int reset_control_assert(struct reset_control *rstc)
45{
46 WARN_ON(1);
47 return 0;
48}
49
50static inline int reset_control_deassert(struct reset_control *rstc)
51{
52 WARN_ON(1);
53 return 0;
54}
55
56static inline void reset_control_put(struct reset_control *rstc)
57{
58 WARN_ON(1);
59}
60
61static inline int device_reset_optional(struct device *dev)
62{
63 return -ENOSYS;
64}
65
66static inline struct reset_control *reset_control_get_optional(
67 struct device *dev, const char *id)
68{
69 return ERR_PTR(-ENOSYS);
70}
71
72static inline struct reset_control *devm_reset_control_get_optional(
73 struct device *dev, const char *id)
74{
75 return ERR_PTR(-ENOSYS);
76}
77
78#endif /* CONFIG_RESET_CONTROLLER */
16 79
17#endif 80#endif
diff --git a/include/linux/rio.h b/include/linux/rio.h
index b71d5738e683..6bda06f21930 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -83,7 +83,7 @@
83#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */ 83#define RIO_CTAG_UDEVID 0x0001ffff /* Unique device identifier */
84 84
85extern struct bus_type rio_bus_type; 85extern struct bus_type rio_bus_type;
86extern struct device rio_bus; 86extern struct class rio_mport_class;
87 87
88struct rio_mport; 88struct rio_mport;
89struct rio_dev; 89struct rio_dev;
@@ -201,6 +201,7 @@ struct rio_dev {
201#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list) 201#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
202#define to_rio_dev(n) container_of(n, struct rio_dev, dev) 202#define to_rio_dev(n) container_of(n, struct rio_dev, dev)
203#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0]) 203#define sw_to_rio_dev(n) container_of(n, struct rio_dev, rswitch[0])
204#define to_rio_mport(n) container_of(n, struct rio_mport, dev)
204 205
205/** 206/**
206 * struct rio_msg - RIO message event 207 * struct rio_msg - RIO message event
@@ -248,6 +249,7 @@ enum rio_phy_type {
248 * @phy_type: RapidIO phy type 249 * @phy_type: RapidIO phy type
249 * @phys_efptr: RIO port extended features pointer 250 * @phys_efptr: RIO port extended features pointer
250 * @name: Port name string 251 * @name: Port name string
252 * @dev: device structure associated with an mport
251 * @priv: Master port private data 253 * @priv: Master port private data
252 * @dma: DMA device associated with mport 254 * @dma: DMA device associated with mport
253 * @nscan: RapidIO network enumeration/discovery operations 255 * @nscan: RapidIO network enumeration/discovery operations
@@ -272,6 +274,7 @@ struct rio_mport {
272 enum rio_phy_type phy_type; /* RapidIO phy type */ 274 enum rio_phy_type phy_type; /* RapidIO phy type */
273 u32 phys_efptr; 275 u32 phys_efptr;
274 unsigned char name[RIO_MAX_MPORT_NAME]; 276 unsigned char name[RIO_MAX_MPORT_NAME];
277 struct device dev;
275 void *priv; /* Master port private data */ 278 void *priv; /* Master port private data */
276#ifdef CONFIG_RAPIDIO_DMA_ENGINE 279#ifdef CONFIG_RAPIDIO_DMA_ENGINE
277 struct dma_device dma; 280 struct dma_device dma;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7cb07fd26680..25f54c79f757 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -132,6 +132,10 @@ struct perf_event_context;
132struct blk_plug; 132struct blk_plug;
133struct filename; 133struct filename;
134 134
135#define VMACACHE_BITS 2
136#define VMACACHE_SIZE (1U << VMACACHE_BITS)
137#define VMACACHE_MASK (VMACACHE_SIZE - 1)
138
135/* 139/*
136 * List of flags we want to share for kernel threads, 140 * List of flags we want to share for kernel threads,
137 * if only because they are not used by them anyway. 141 * if only because they are not used by them anyway.
@@ -206,8 +210,9 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
206#define __TASK_STOPPED 4 210#define __TASK_STOPPED 4
207#define __TASK_TRACED 8 211#define __TASK_TRACED 8
208/* in tsk->exit_state */ 212/* in tsk->exit_state */
209#define EXIT_ZOMBIE 16 213#define EXIT_DEAD 16
210#define EXIT_DEAD 32 214#define EXIT_ZOMBIE 32
215#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
211/* in tsk->state again */ 216/* in tsk->state again */
212#define TASK_DEAD 64 217#define TASK_DEAD 64
213#define TASK_WAKEKILL 128 218#define TASK_WAKEKILL 128
@@ -1235,6 +1240,9 @@ struct task_struct {
1235#ifdef CONFIG_COMPAT_BRK 1240#ifdef CONFIG_COMPAT_BRK
1236 unsigned brk_randomized:1; 1241 unsigned brk_randomized:1;
1237#endif 1242#endif
1243 /* per-thread vma caching */
1244 u32 vmacache_seqnum;
1245 struct vm_area_struct *vmacache[VMACACHE_SIZE];
1238#if defined(SPLIT_RSS_COUNTING) 1246#if defined(SPLIT_RSS_COUNTING)
1239 struct task_rss_stat rss_stat; 1247 struct task_rss_stat rss_stat;
1240#endif 1248#endif
@@ -1711,6 +1719,24 @@ static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1711} 1719}
1712 1720
1713 1721
1722static inline int pid_alive(const struct task_struct *p);
1723static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1724{
1725 pid_t pid = 0;
1726
1727 rcu_read_lock();
1728 if (pid_alive(tsk))
1729 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1730 rcu_read_unlock();
1731
1732 return pid;
1733}
1734
1735static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1736{
1737 return task_ppid_nr_ns(tsk, &init_pid_ns);
1738}
1739
1714static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, 1740static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1715 struct pid_namespace *ns) 1741 struct pid_namespace *ns)
1716{ 1742{
@@ -1750,7 +1776,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1750 * 1776 *
1751 * Return: 1 if the process is alive. 0 otherwise. 1777 * Return: 1 if the process is alive. 0 otherwise.
1752 */ 1778 */
1753static inline int pid_alive(struct task_struct *p) 1779static inline int pid_alive(const struct task_struct *p)
1754{ 1780{
1755 return p->pids[PIDTYPE_PID].pid != NULL; 1781 return p->pids[PIDTYPE_PID].pid != NULL;
1756} 1782}
@@ -1844,7 +1870,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,
1844#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */ 1870#define PF_SPREAD_SLAB 0x02000000 /* Spread some slab caches over cpuset */
1845#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */ 1871#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_allowed */
1846#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */ 1872#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */
1847#define PF_MEMPOLICY 0x10000000 /* Non-default NUMA mempolicy */
1848#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */ 1873#define PF_MUTEX_TESTER 0x20000000 /* Thread belongs to the rt mutex tester */
1849#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */ 1874#define PF_FREEZER_SKIP 0x40000000 /* Freezer should not count it as freezable */
1850#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */ 1875#define PF_SUSPEND_TASK 0x80000000 /* this thread called freeze_processes and should not be frozen */
@@ -2351,7 +2376,7 @@ extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, i
2351struct task_struct *fork_idle(int); 2376struct task_struct *fork_idle(int);
2352extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); 2377extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2353 2378
2354extern void set_task_comm(struct task_struct *tsk, char *from); 2379extern void set_task_comm(struct task_struct *tsk, const char *from);
2355extern char *get_task_comm(char *to, struct task_struct *tsk); 2380extern char *get_task_comm(char *to, struct task_struct *tsk);
2356 2381
2357#ifdef CONFIG_SMP 2382#ifdef CONFIG_SMP
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 6f19cfd1840e..4054b0994071 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -76,7 +76,6 @@ static inline int seccomp_mode(struct seccomp *s)
76#ifdef CONFIG_SECCOMP_FILTER 76#ifdef CONFIG_SECCOMP_FILTER
77extern void put_seccomp_filter(struct task_struct *tsk); 77extern void put_seccomp_filter(struct task_struct *tsk);
78extern void get_seccomp_filter(struct task_struct *tsk); 78extern void get_seccomp_filter(struct task_struct *tsk);
79extern u32 seccomp_bpf_load(int off);
80#else /* CONFIG_SECCOMP_FILTER */ 79#else /* CONFIG_SECCOMP_FILTER */
81static inline void put_seccomp_filter(struct task_struct *tsk) 80static inline void put_seccomp_filter(struct task_struct *tsk)
82{ 81{
diff --git a/include/linux/security.h b/include/linux/security.h
index 2fc42d191f79..6478ce3252c7 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1793,7 +1793,8 @@ int security_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
1793int security_inode_rmdir(struct inode *dir, struct dentry *dentry); 1793int security_inode_rmdir(struct inode *dir, struct dentry *dentry);
1794int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev); 1794int security_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev);
1795int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry, 1795int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1796 struct inode *new_dir, struct dentry *new_dentry); 1796 struct inode *new_dir, struct dentry *new_dentry,
1797 unsigned int flags);
1797int security_inode_readlink(struct dentry *dentry); 1798int security_inode_readlink(struct dentry *dentry);
1798int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1799int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1799int security_inode_permission(struct inode *inode, int mask); 1800int security_inode_permission(struct inode *inode, int mask);
@@ -2161,7 +2162,8 @@ static inline int security_inode_mknod(struct inode *dir,
2161static inline int security_inode_rename(struct inode *old_dir, 2162static inline int security_inode_rename(struct inode *old_dir,
2162 struct dentry *old_dentry, 2163 struct dentry *old_dentry,
2163 struct inode *new_dir, 2164 struct inode *new_dir,
2164 struct dentry *new_dentry) 2165 struct dentry *new_dentry,
2166 unsigned int flags)
2165{ 2167{
2166 return 0; 2168 return 0;
2167} 2169}
@@ -2955,7 +2957,8 @@ int security_path_symlink(struct path *dir, struct dentry *dentry,
2955int security_path_link(struct dentry *old_dentry, struct path *new_dir, 2957int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2956 struct dentry *new_dentry); 2958 struct dentry *new_dentry);
2957int security_path_rename(struct path *old_dir, struct dentry *old_dentry, 2959int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2958 struct path *new_dir, struct dentry *new_dentry); 2960 struct path *new_dir, struct dentry *new_dentry,
2961 unsigned int flags);
2959int security_path_chmod(struct path *path, umode_t mode); 2962int security_path_chmod(struct path *path, umode_t mode);
2960int security_path_chown(struct path *path, kuid_t uid, kgid_t gid); 2963int security_path_chown(struct path *path, kuid_t uid, kgid_t gid);
2961int security_path_chroot(struct path *path); 2964int security_path_chroot(struct path *path);
@@ -3003,7 +3006,8 @@ static inline int security_path_link(struct dentry *old_dentry,
3003static inline int security_path_rename(struct path *old_dir, 3006static inline int security_path_rename(struct path *old_dir,
3004 struct dentry *old_dentry, 3007 struct dentry *old_dentry,
3005 struct path *new_dir, 3008 struct path *new_dir,
3006 struct dentry *new_dentry) 3009 struct dentry *new_dentry,
3010 unsigned int flags)
3007{ 3011{
3008 return 0; 3012 return 0;
3009} 3013}
diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h
index 570e964dc899..a80aa1a5bee2 100644
--- a/include/linux/serial_bcm63xx.h
+++ b/include/linux/serial_bcm63xx.h
@@ -116,4 +116,6 @@
116 UART_FIFO_PARERR_MASK | \ 116 UART_FIFO_PARERR_MASK | \
117 UART_FIFO_BRKDET_MASK) 117 UART_FIFO_BRKDET_MASK)
118 118
119#define UART_REG_SIZE 24
120
119#endif /* _LINUX_SERIAL_BCM63XX_H */ 121#endif /* _LINUX_SERIAL_BCM63XX_H */
diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h
index 907d9d1d56cf..e6fc9567690b 100644
--- a/include/linux/serial_s3c.h
+++ b/include/linux/serial_s3c.h
@@ -233,6 +233,8 @@
233 233
234#ifndef __ASSEMBLY__ 234#ifndef __ASSEMBLY__
235 235
236#include <linux/serial_core.h>
237
236/* configuration structure for per-machine configurations for the 238/* configuration structure for per-machine configurations for the
237 * serial port 239 * serial port
238 * 240 *
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 22b3640c9424..6c5e3bb282b0 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -10,45 +10,59 @@
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
12 12
13#define SCSCR_TIE (1 << 7) 13/* SCSMR (Serial Mode Register) */
14#define SCSCR_RIE (1 << 6) 14#define SCSMR_CHR (1 << 6) /* 7-bit Character Length */
15#define SCSCR_TE (1 << 5) 15#define SCSMR_PE (1 << 5) /* Parity Enable */
16#define SCSCR_RE (1 << 4) 16#define SCSMR_ODD (1 << 4) /* Odd Parity */
17#define SCSCR_REIE (1 << 3) /* not supported by all parts */ 17#define SCSMR_STOP (1 << 3) /* Stop Bit Length */
18#define SCSCR_TOIE (1 << 2) /* not supported by all parts */ 18#define SCSMR_CKS 0x0003 /* Clock Select */
19#define SCSCR_CKE1 (1 << 1) 19
20#define SCSCR_CKE0 (1 << 0) 20/* Serial Control Register (@ = not supported by all parts) */
21 21#define SCSCR_TIE (1 << 7) /* Transmit Interrupt Enable */
22/* SCxSR SCI */ 22#define SCSCR_RIE (1 << 6) /* Receive Interrupt Enable */
23#define SCI_TDRE 0x80 23#define SCSCR_TE (1 << 5) /* Transmit Enable */
24#define SCI_RDRF 0x40 24#define SCSCR_RE (1 << 4) /* Receive Enable */
25#define SCI_ORER 0x20 25#define SCSCR_REIE (1 << 3) /* Receive Error Interrupt Enable @ */
26#define SCI_FER 0x10 26#define SCSCR_TOIE (1 << 2) /* Timeout Interrupt Enable @ */
27#define SCI_PER 0x08 27#define SCSCR_CKE1 (1 << 1) /* Clock Enable 1 */
28#define SCI_TEND 0x04 28#define SCSCR_CKE0 (1 << 0) /* Clock Enable 0 */
29/* SCIFA/SCIFB only */
30#define SCSCR_TDRQE (1 << 15) /* Tx Data Transfer Request Enable */
31#define SCSCR_RDRQE (1 << 14) /* Rx Data Transfer Request Enable */
32
33/* SCxSR (Serial Status Register) on SCI */
34#define SCI_TDRE 0x80 /* Transmit Data Register Empty */
35#define SCI_RDRF 0x40 /* Receive Data Register Full */
36#define SCI_ORER 0x20 /* Overrun Error */
37#define SCI_FER 0x10 /* Framing Error */
38#define SCI_PER 0x08 /* Parity Error */
39#define SCI_TEND 0x04 /* Transmit End */
29 40
30#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER) 41#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)
31 42
32/* SCxSR SCIF, HSCIF */ 43/* SCxSR (Serial Status Register) on SCIF, HSCIF */
33#define SCIF_ER 0x0080 44#define SCIF_ER 0x0080 /* Receive Error */
34#define SCIF_TEND 0x0040 45#define SCIF_TEND 0x0040 /* Transmission End */
35#define SCIF_TDFE 0x0020 46#define SCIF_TDFE 0x0020 /* Transmit FIFO Data Empty */
36#define SCIF_BRK 0x0010 47#define SCIF_BRK 0x0010 /* Break Detect */
37#define SCIF_FER 0x0008 48#define SCIF_FER 0x0008 /* Framing Error */
38#define SCIF_PER 0x0004 49#define SCIF_PER 0x0004 /* Parity Error */
39#define SCIF_RDF 0x0002 50#define SCIF_RDF 0x0002 /* Receive FIFO Data Full */
40#define SCIF_DR 0x0001 51#define SCIF_DR 0x0001 /* Receive Data Ready */
41 52
42#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK) 53#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
43 54
44/* SCSPTR, optional */ 55/* SCFCR (FIFO Control Register) */
45#define SCSPTR_RTSIO (1 << 7) 56#define SCFCR_LOOP (1 << 0) /* Loopback Test */
46#define SCSPTR_CTSIO (1 << 5) 57
47#define SCSPTR_SPB2IO (1 << 1) 58/* SCSPTR (Serial Port Register), optional */
48#define SCSPTR_SPB2DT (1 << 0) 59#define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */
60#define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */
61#define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */
62#define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */
49 63
50/* HSSRR HSCIF */ 64/* HSSRR HSCIF */
51#define HSCIF_SRE 0x8000 65#define HSCIF_SRE 0x8000 /* Sampling Rate Register Enable */
52 66
53enum { 67enum {
54 SCIx_PROBE_REGTYPE, 68 SCIx_PROBE_REGTYPE,
@@ -73,10 +87,19 @@ enum {
73 * Not all registers will exist on all parts. 87 * Not all registers will exist on all parts.
74 */ 88 */
75enum { 89enum {
76 SCSMR, SCBRR, SCSCR, SCxSR, 90 SCSMR, /* Serial Mode Register */
77 SCFCR, SCFDR, SCxTDR, SCxRDR, 91 SCBRR, /* Bit Rate Register */
78 SCLSR, SCTFDR, SCRFDR, SCSPTR, 92 SCSCR, /* Serial Control Register */
79 HSSRR, 93 SCxSR, /* Serial Status Register */
94 SCFCR, /* FIFO Control Register */
95 SCFDR, /* FIFO Data Count Register */
96 SCxTDR, /* Transmit (FIFO) Data Register */
97 SCxRDR, /* Receive (FIFO) Data Register */
98 SCLSR, /* Line Status Register */
99 SCTFDR, /* Transmit FIFO Data Count Register */
100 SCRFDR, /* Receive FIFO Data Count Register */
101 SCSPTR, /* Serial Port Register */
102 HSSRR, /* Sampling Rate Register */
80 103
81 SCIx_NR_REGS, 104 SCIx_NR_REGS,
82}; 105};
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 60c72395ec6b..1f208b2a1ed6 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -52,6 +52,7 @@ struct clk {
52 unsigned long flags; 52 unsigned long flags;
53 53
54 void __iomem *enable_reg; 54 void __iomem *enable_reg;
55 void __iomem *status_reg;
55 unsigned int enable_bit; 56 unsigned int enable_bit;
56 void __iomem *mapped_reg; 57 void __iomem *mapped_reg;
57 58
@@ -116,22 +117,26 @@ long clk_round_parent(struct clk *clk, unsigned long target,
116 unsigned long *best_freq, unsigned long *parent_freq, 117 unsigned long *best_freq, unsigned long *parent_freq,
117 unsigned int div_min, unsigned int div_max); 118 unsigned int div_min, unsigned int div_max);
118 119
119#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _flags) \ 120#define SH_CLK_MSTP(_parent, _enable_reg, _enable_bit, _status_reg, _flags) \
120{ \ 121{ \
121 .parent = _parent, \ 122 .parent = _parent, \
122 .enable_reg = (void __iomem *)_enable_reg, \ 123 .enable_reg = (void __iomem *)_enable_reg, \
123 .enable_bit = _enable_bit, \ 124 .enable_bit = _enable_bit, \
125 .status_reg = _status_reg, \
124 .flags = _flags, \ 126 .flags = _flags, \
125} 127}
126 128
127#define SH_CLK_MSTP32(_p, _r, _b, _f) \ 129#define SH_CLK_MSTP32(_p, _r, _b, _f) \
128 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_32BIT) 130 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_32BIT)
129 131
130#define SH_CLK_MSTP16(_p, _r, _b, _f) \ 132#define SH_CLK_MSTP32_STS(_p, _r, _b, _s, _f) \
131 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_16BIT) 133 SH_CLK_MSTP(_p, _r, _b, _s, _f | CLK_ENABLE_REG_32BIT)
132 134
133#define SH_CLK_MSTP8(_p, _r, _b, _f) \ 135#define SH_CLK_MSTP16(_p, _r, _b, _f) \
134 SH_CLK_MSTP(_p, _r, _b, _f | CLK_ENABLE_REG_8BIT) 136 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_16BIT)
137
138#define SH_CLK_MSTP8(_p, _r, _b, _f) \
139 SH_CLK_MSTP(_p, _r, _b, 0, _f | CLK_ENABLE_REG_8BIT)
135 140
136int sh_clk_mstp_register(struct clk *clks, int nr); 141int sh_clk_mstp_register(struct clk *clks, int nr);
137 142
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 9d55438bc4ad..4d1771c2d29f 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -51,6 +51,7 @@ extern struct file *shmem_kernel_file_setup(const char *name, loff_t size,
51 unsigned long flags); 51 unsigned long flags);
52extern int shmem_zero_setup(struct vm_area_struct *); 52extern int shmem_zero_setup(struct vm_area_struct *);
53extern int shmem_lock(struct file *file, int lock, struct user_struct *user); 53extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
54extern bool shmem_mapping(struct address_space *mapping);
54extern void shmem_unlock_mapping(struct address_space *mapping); 55extern void shmem_unlock_mapping(struct address_space *mapping);
55extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping, 56extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
56 pgoff_t index, gfp_t gfp_mask); 57 pgoff_t index, gfp_t gfp_mask);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 15ede6a823a6..08074a810164 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -32,6 +32,7 @@
32#include <linux/hrtimer.h> 32#include <linux/hrtimer.h>
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/netdev_features.h> 34#include <linux/netdev_features.h>
35#include <linux/sched.h>
35#include <net/flow_keys.h> 36#include <net/flow_keys.h>
36 37
37/* A. Checksumming of received packets by device. 38/* A. Checksumming of received packets by device.
@@ -356,11 +357,62 @@ typedef unsigned int sk_buff_data_t;
356typedef unsigned char *sk_buff_data_t; 357typedef unsigned char *sk_buff_data_t;
357#endif 358#endif
358 359
360/**
361 * struct skb_mstamp - multi resolution time stamps
362 * @stamp_us: timestamp in us resolution
363 * @stamp_jiffies: timestamp in jiffies
364 */
365struct skb_mstamp {
366 union {
367 u64 v64;
368 struct {
369 u32 stamp_us;
370 u32 stamp_jiffies;
371 };
372 };
373};
374
375/**
376 * skb_mstamp_get - get current timestamp
377 * @cl: place to store timestamps
378 */
379static inline void skb_mstamp_get(struct skb_mstamp *cl)
380{
381 u64 val = local_clock();
382
383 do_div(val, NSEC_PER_USEC);
384 cl->stamp_us = (u32)val;
385 cl->stamp_jiffies = (u32)jiffies;
386}
387
388/**
389 * skb_mstamp_delta - compute the difference in usec between two skb_mstamp
390 * @t1: pointer to newest sample
391 * @t0: pointer to oldest sample
392 */
393static inline u32 skb_mstamp_us_delta(const struct skb_mstamp *t1,
394 const struct skb_mstamp *t0)
395{
396 s32 delta_us = t1->stamp_us - t0->stamp_us;
397 u32 delta_jiffies = t1->stamp_jiffies - t0->stamp_jiffies;
398
399 /* If delta_us is negative, this might be because interval is too big,
400 * or local_clock() drift is too big : fallback using jiffies.
401 */
402 if (delta_us <= 0 ||
403 delta_jiffies >= (INT_MAX / (USEC_PER_SEC / HZ)))
404
405 delta_us = jiffies_to_usecs(delta_jiffies);
406
407 return delta_us;
408}
409
410
359/** 411/**
360 * struct sk_buff - socket buffer 412 * struct sk_buff - socket buffer
361 * @next: Next buffer in list 413 * @next: Next buffer in list
362 * @prev: Previous buffer in list 414 * @prev: Previous buffer in list
363 * @tstamp: Time we arrived 415 * @tstamp: Time we arrived/left
364 * @sk: Socket we are owned by 416 * @sk: Socket we are owned by
365 * @dev: Device we arrived on/are leaving by 417 * @dev: Device we arrived on/are leaving by
366 * @cb: Control buffer. Free for use by every layer. Put private vars here 418 * @cb: Control buffer. Free for use by every layer. Put private vars here
@@ -392,11 +444,11 @@ typedef unsigned char *sk_buff_data_t;
392 * @skb_iif: ifindex of device we arrived on 444 * @skb_iif: ifindex of device we arrived on
393 * @tc_index: Traffic control index 445 * @tc_index: Traffic control index
394 * @tc_verd: traffic control verdict 446 * @tc_verd: traffic control verdict
395 * @rxhash: the packet hash computed on receive 447 * @hash: the packet hash
396 * @queue_mapping: Queue mapping for multiqueue devices 448 * @queue_mapping: Queue mapping for multiqueue devices
397 * @ndisc_nodetype: router type (from link layer) 449 * @ndisc_nodetype: router type (from link layer)
398 * @ooo_okay: allow the mapping of a socket to a queue to be changed 450 * @ooo_okay: allow the mapping of a socket to a queue to be changed
399 * @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport 451 * @l4_hash: indicate hash is a canonical 4-tuple hash over transport
400 * ports. 452 * ports.
401 * @wifi_acked_valid: wifi_acked was set 453 * @wifi_acked_valid: wifi_acked was set
402 * @wifi_acked: whether frame was acked on wifi or not 454 * @wifi_acked: whether frame was acked on wifi or not
@@ -429,7 +481,10 @@ struct sk_buff {
429 struct sk_buff *next; 481 struct sk_buff *next;
430 struct sk_buff *prev; 482 struct sk_buff *prev;
431 483
432 ktime_t tstamp; 484 union {
485 ktime_t tstamp;
486 struct skb_mstamp skb_mstamp;
487 };
433 488
434 struct sock *sk; 489 struct sock *sk;
435 struct net_device *dev; 490 struct net_device *dev;
@@ -482,7 +537,7 @@ struct sk_buff {
482 537
483 int skb_iif; 538 int skb_iif;
484 539
485 __u32 rxhash; 540 __u32 hash;
486 541
487 __be16 vlan_proto; 542 __be16 vlan_proto;
488 __u16 vlan_tci; 543 __u16 vlan_tci;
@@ -501,7 +556,7 @@ struct sk_buff {
501#endif 556#endif
502 __u8 pfmemalloc:1; 557 __u8 pfmemalloc:1;
503 __u8 ooo_okay:1; 558 __u8 ooo_okay:1;
504 __u8 l4_rxhash:1; 559 __u8 l4_hash:1;
505 __u8 wifi_acked_valid:1; 560 __u8 wifi_acked_valid:1;
506 __u8 wifi_acked:1; 561 __u8 wifi_acked:1;
507 __u8 no_fcs:1; 562 __u8 no_fcs:1;
@@ -691,6 +746,8 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb,
691 unsigned int headroom); 746 unsigned int headroom);
692struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom, 747struct sk_buff *skb_copy_expand(const struct sk_buff *skb, int newheadroom,
693 int newtailroom, gfp_t priority); 748 int newtailroom, gfp_t priority);
749int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
750 int offset, int len);
694int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, 751int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset,
695 int len); 752 int len);
696int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer); 753int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer);
@@ -758,40 +815,40 @@ enum pkt_hash_types {
758static inline void 815static inline void
759skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type) 816skb_set_hash(struct sk_buff *skb, __u32 hash, enum pkt_hash_types type)
760{ 817{
761 skb->l4_rxhash = (type == PKT_HASH_TYPE_L4); 818 skb->l4_hash = (type == PKT_HASH_TYPE_L4);
762 skb->rxhash = hash; 819 skb->hash = hash;
763} 820}
764 821
765void __skb_get_hash(struct sk_buff *skb); 822void __skb_get_hash(struct sk_buff *skb);
766static inline __u32 skb_get_hash(struct sk_buff *skb) 823static inline __u32 skb_get_hash(struct sk_buff *skb)
767{ 824{
768 if (!skb->l4_rxhash) 825 if (!skb->l4_hash)
769 __skb_get_hash(skb); 826 __skb_get_hash(skb);
770 827
771 return skb->rxhash; 828 return skb->hash;
772} 829}
773 830
774static inline __u32 skb_get_hash_raw(const struct sk_buff *skb) 831static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
775{ 832{
776 return skb->rxhash; 833 return skb->hash;
777} 834}
778 835
779static inline void skb_clear_hash(struct sk_buff *skb) 836static inline void skb_clear_hash(struct sk_buff *skb)
780{ 837{
781 skb->rxhash = 0; 838 skb->hash = 0;
782 skb->l4_rxhash = 0; 839 skb->l4_hash = 0;
783} 840}
784 841
785static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb) 842static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
786{ 843{
787 if (!skb->l4_rxhash) 844 if (!skb->l4_hash)
788 skb_clear_hash(skb); 845 skb_clear_hash(skb);
789} 846}
790 847
791static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from) 848static inline void skb_copy_hash(struct sk_buff *to, const struct sk_buff *from)
792{ 849{
793 to->rxhash = from->rxhash; 850 to->hash = from->hash;
794 to->l4_rxhash = from->l4_rxhash; 851 to->l4_hash = from->l4_hash;
795}; 852};
796 853
797#ifdef NET_SKBUFF_DATA_USES_OFFSET 854#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -2038,7 +2095,7 @@ static inline void skb_propagate_pfmemalloc(struct page *page,
2038} 2095}
2039 2096
2040/** 2097/**
2041 * skb_frag_page - retrieve the page refered to by a paged fragment 2098 * skb_frag_page - retrieve the page referred to by a paged fragment
2042 * @frag: the paged fragment 2099 * @frag: the paged fragment
2043 * 2100 *
2044 * Returns the &struct page associated with @frag. 2101 * Returns the &struct page associated with @frag.
@@ -2573,8 +2630,6 @@ static inline ktime_t net_invalid_timestamp(void)
2573 return ktime_set(0, 0); 2630 return ktime_set(0, 0);
2574} 2631}
2575 2632
2576void skb_timestamping_init(void);
2577
2578#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING 2633#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
2579 2634
2580void skb_clone_tx_timestamp(struct sk_buff *skb); 2635void skb_clone_tx_timestamp(struct sk_buff *skb);
@@ -2776,6 +2831,19 @@ static inline void skb_init_secmark(struct sk_buff *skb)
2776{ } 2831{ }
2777#endif 2832#endif
2778 2833
2834static inline bool skb_irq_freeable(const struct sk_buff *skb)
2835{
2836 return !skb->destructor &&
2837#if IS_ENABLED(CONFIG_XFRM)
2838 !skb->sp &&
2839#endif
2840#if IS_ENABLED(CONFIG_NF_CONNTRACK)
2841 !skb->nfct &&
2842#endif
2843 !skb->_skb_refdst &&
2844 !skb_has_frag_list(skb);
2845}
2846
2779static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) 2847static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping)
2780{ 2848{
2781 skb->queue_mapping = queue_mapping; 2849 skb->queue_mapping = queue_mapping;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index b5b2df60299e..307bfbe62387 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -115,9 +115,9 @@ int slab_is_available(void);
115struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 115struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
116 unsigned long, 116 unsigned long,
117 void (*)(void *)); 117 void (*)(void *));
118struct kmem_cache * 118#ifdef CONFIG_MEMCG_KMEM
119kmem_cache_create_memcg(struct mem_cgroup *, const char *, size_t, size_t, 119void kmem_cache_create_memcg(struct mem_cgroup *, struct kmem_cache *);
120 unsigned long, void (*)(void *), struct kmem_cache *); 120#endif
121void kmem_cache_destroy(struct kmem_cache *); 121void kmem_cache_destroy(struct kmem_cache *);
122int kmem_cache_shrink(struct kmem_cache *); 122int kmem_cache_shrink(struct kmem_cache *);
123void kmem_cache_free(struct kmem_cache *, void *); 123void kmem_cache_free(struct kmem_cache *, void *);
@@ -242,6 +242,17 @@ struct kmem_cache {
242#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW) 242#define KMALLOC_MIN_SIZE (1 << KMALLOC_SHIFT_LOW)
243#endif 243#endif
244 244
245/*
246 * This restriction comes from byte sized index implementation.
247 * Page size is normally 2^12 bytes and, in this case, if we want to use
248 * byte sized index which can represent 2^8 entries, the size of the object
249 * should be equal or greater to 2^12 / 2^8 = 2^4 = 16.
250 * If minimum size of kmalloc is less than 16, we use it as minimum object
251 * size and give up to use byte sized index.
252 */
253#define SLAB_OBJ_MIN_SIZE (KMALLOC_MIN_SIZE < 16 ? \
254 (KMALLOC_MIN_SIZE) : 16)
255
245#ifndef CONFIG_SLOB 256#ifndef CONFIG_SLOB
246extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1]; 257extern struct kmem_cache *kmalloc_caches[KMALLOC_SHIFT_HIGH + 1];
247#ifdef CONFIG_ZONE_DMA 258#ifdef CONFIG_ZONE_DMA
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index f56bfa9e4526..f2f7398848cf 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -87,6 +87,9 @@ struct kmem_cache {
87#ifdef CONFIG_MEMCG_KMEM 87#ifdef CONFIG_MEMCG_KMEM
88 struct memcg_cache_params *memcg_params; 88 struct memcg_cache_params *memcg_params;
89 int max_attr_size; /* for propagation, maximum size of a stored attr */ 89 int max_attr_size; /* for propagation, maximum size of a stored attr */
90#ifdef CONFIG_SYSFS
91 struct kset *memcg_kset;
92#endif
90#endif 93#endif
91 94
92#ifdef CONFIG_NUMA 95#ifdef CONFIG_NUMA
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6ae004e437ea..633f5edd7470 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -17,10 +17,7 @@ extern void cpu_idle(void);
17 17
18typedef void (*smp_call_func_t)(void *info); 18typedef void (*smp_call_func_t)(void *info);
19struct call_single_data { 19struct call_single_data {
20 union { 20 struct llist_node llist;
21 struct list_head list;
22 struct llist_node llist;
23 };
24 smp_call_func_t func; 21 smp_call_func_t func;
25 void *info; 22 void *info;
26 u16 flags; 23 u16 flags;
@@ -53,8 +50,7 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
53 smp_call_func_t func, void *info, bool wait, 50 smp_call_func_t func, void *info, bool wait,
54 gfp_t gfp_flags); 51 gfp_t gfp_flags);
55 52
56void __smp_call_function_single(int cpuid, struct call_single_data *data, 53int smp_call_function_single_async(int cpu, struct call_single_data *csd);
57 int wait);
58 54
59#ifdef CONFIG_SMP 55#ifdef CONFIG_SMP
60 56
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4203c66d8803..e713543336f1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -24,6 +24,9 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/scatterlist.h>
28
29struct dma_chan;
27 30
28/* 31/*
29 * INTERFACES between SPI master-side drivers and SPI infrastructure. 32 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -234,7 +237,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
234 * @mode_bits: flags understood by this controller driver 237 * @mode_bits: flags understood by this controller driver
235 * @bits_per_word_mask: A mask indicating which values of bits_per_word are 238 * @bits_per_word_mask: A mask indicating which values of bits_per_word are
236 * supported by the driver. Bit n indicates that a bits_per_word n+1 is 239 * supported by the driver. Bit n indicates that a bits_per_word n+1 is
237 * suported. If set, the SPI core will reject any transfer with an 240 * supported. If set, the SPI core will reject any transfer with an
238 * unsupported bits_per_word. If not set, this value is simply ignored, 241 * unsupported bits_per_word. If not set, this value is simply ignored,
239 * and it's up to the individual driver to perform any validation. 242 * and it's up to the individual driver to perform any validation.
240 * @min_speed_hz: Lowest supported transfer speed 243 * @min_speed_hz: Lowest supported transfer speed
@@ -259,13 +262,14 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
259 * @cur_msg: the currently in-flight message 262 * @cur_msg: the currently in-flight message
260 * @cur_msg_prepared: spi_prepare_message was called for the currently 263 * @cur_msg_prepared: spi_prepare_message was called for the currently
261 * in-flight message 264 * in-flight message
262 * @xfer_completion: used by core tranfer_one_message() 265 * @xfer_completion: used by core transfer_one_message()
263 * @busy: message pump is busy 266 * @busy: message pump is busy
264 * @running: message pump is running 267 * @running: message pump is running
265 * @rt: whether this queue is set to run as a realtime task 268 * @rt: whether this queue is set to run as a realtime task
266 * @auto_runtime_pm: the core should ensure a runtime PM reference is held 269 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
267 * while the hardware is prepared, using the parent 270 * while the hardware is prepared, using the parent
268 * device for the spidev 271 * device for the spidev
272 * @max_dma_len: Maximum length of a DMA transfer for the device.
269 * @prepare_transfer_hardware: a message will soon arrive from the queue 273 * @prepare_transfer_hardware: a message will soon arrive from the queue
270 * so the subsystem requests the driver to prepare the transfer hardware 274 * so the subsystem requests the driver to prepare the transfer hardware
271 * by issuing this call 275 * by issuing this call
@@ -348,6 +352,8 @@ struct spi_master {
348#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 352#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
349#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ 353#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
350#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ 354#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
355#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */
356#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */
351 357
352 /* lock and mutex for SPI bus locking */ 358 /* lock and mutex for SPI bus locking */
353 spinlock_t bus_lock_spinlock; 359 spinlock_t bus_lock_spinlock;
@@ -390,6 +396,17 @@ struct spi_master {
390 void (*cleanup)(struct spi_device *spi); 396 void (*cleanup)(struct spi_device *spi);
391 397
392 /* 398 /*
399 * Used to enable core support for DMA handling, if can_dma()
400 * exists and returns true then the transfer will be mapped
401 * prior to transfer_one() being called. The driver should
402 * not modify or store xfer and dma_tx and dma_rx must be set
403 * while the device is prepared.
404 */
405 bool (*can_dma)(struct spi_master *master,
406 struct spi_device *spi,
407 struct spi_transfer *xfer);
408
409 /*
393 * These hooks are for drivers that want to use the generic 410 * These hooks are for drivers that want to use the generic
394 * master transfer queueing mechanism. If these are used, the 411 * master transfer queueing mechanism. If these are used, the
395 * transfer() function above must NOT be specified by the driver. 412 * transfer() function above must NOT be specified by the driver.
@@ -407,7 +424,9 @@ struct spi_master {
407 bool rt; 424 bool rt;
408 bool auto_runtime_pm; 425 bool auto_runtime_pm;
409 bool cur_msg_prepared; 426 bool cur_msg_prepared;
427 bool cur_msg_mapped;
410 struct completion xfer_completion; 428 struct completion xfer_completion;
429 size_t max_dma_len;
411 430
412 int (*prepare_transfer_hardware)(struct spi_master *master); 431 int (*prepare_transfer_hardware)(struct spi_master *master);
413 int (*transfer_one_message)(struct spi_master *master, 432 int (*transfer_one_message)(struct spi_master *master,
@@ -428,6 +447,14 @@ struct spi_master {
428 447
429 /* gpio chip select */ 448 /* gpio chip select */
430 int *cs_gpios; 449 int *cs_gpios;
450
451 /* DMA channels for use with core dmaengine helpers */
452 struct dma_chan *dma_tx;
453 struct dma_chan *dma_rx;
454
455 /* dummy data for full duplex devices */
456 void *dummy_rx;
457 void *dummy_tx;
431}; 458};
432 459
433static inline void *spi_master_get_devdata(struct spi_master *master) 460static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -498,7 +525,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
498 * @rx_buf: data to be read (dma-safe memory), or NULL 525 * @rx_buf: data to be read (dma-safe memory), or NULL
499 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 526 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
500 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 527 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
501 * @tx_nbits: number of bits used for writting. If 0 the default 528 * @tx_nbits: number of bits used for writing. If 0 the default
502 * (SPI_NBITS_SINGLE) is used. 529 * (SPI_NBITS_SINGLE) is used.
503 * @rx_nbits: number of bits used for reading. If 0 the default 530 * @rx_nbits: number of bits used for reading. If 0 the default
504 * (SPI_NBITS_SINGLE) is used. 531 * (SPI_NBITS_SINGLE) is used.
@@ -512,6 +539,8 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
512 * (optionally) changing the chipselect status, then starting 539 * (optionally) changing the chipselect status, then starting
513 * the next transfer or completing this @spi_message. 540 * the next transfer or completing this @spi_message.
514 * @transfer_list: transfers are sequenced through @spi_message.transfers 541 * @transfer_list: transfers are sequenced through @spi_message.transfers
542 * @tx_sg: Scatterlist for transmit, currently not for client use
543 * @rx_sg: Scatterlist for receive, currently not for client use
515 * 544 *
516 * SPI transfers always write the same number of bytes as they read. 545 * SPI transfers always write the same number of bytes as they read.
517 * Protocol drivers should always provide @rx_buf and/or @tx_buf. 546 * Protocol drivers should always provide @rx_buf and/or @tx_buf.
@@ -556,7 +585,7 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
556 * by the results of previous messages and where the whole transaction 585 * by the results of previous messages and where the whole transaction
557 * ends when the chipselect goes intactive. 586 * ends when the chipselect goes intactive.
558 * 587 *
559 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information 588 * When SPI can transfer in 1x,2x or 4x. It can get this transfer information
560 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these 589 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
561 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x) 590 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
562 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer. 591 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
@@ -579,6 +608,8 @@ struct spi_transfer {
579 608
580 dma_addr_t tx_dma; 609 dma_addr_t tx_dma;
581 dma_addr_t rx_dma; 610 dma_addr_t rx_dma;
611 struct sg_table tx_sg;
612 struct sg_table rx_sg;
582 613
583 unsigned cs_change:1; 614 unsigned cs_change:1;
584 unsigned tx_nbits:3; 615 unsigned tx_nbits:3;
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index daebaba886aa..85578d4be034 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -42,6 +42,6 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi,
42 42
43/* start or stop queue processing */ 43/* start or stop queue processing */
44extern int spi_bitbang_start(struct spi_bitbang *spi); 44extern int spi_bitbang_start(struct spi_bitbang *spi);
45extern int spi_bitbang_stop(struct spi_bitbang *spi); 45extern void spi_bitbang_stop(struct spi_bitbang *spi);
46 46
47#endif /* __SPI_BITBANG_H */ 47#endif /* __SPI_BITBANG_H */
diff --git a/include/linux/spmi.h b/include/linux/spmi.h
new file mode 100644
index 000000000000..91f5eab9e428
--- /dev/null
+++ b/include/linux/spmi.h
@@ -0,0 +1,191 @@
1/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
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 version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#ifndef _LINUX_SPMI_H
13#define _LINUX_SPMI_H
14
15#include <linux/types.h>
16#include <linux/device.h>
17#include <linux/mod_devicetable.h>
18
19/* Maximum slave identifier */
20#define SPMI_MAX_SLAVE_ID 16
21
22/* SPMI Commands */
23#define SPMI_CMD_EXT_WRITE 0x00
24#define SPMI_CMD_RESET 0x10
25#define SPMI_CMD_SLEEP 0x11
26#define SPMI_CMD_SHUTDOWN 0x12
27#define SPMI_CMD_WAKEUP 0x13
28#define SPMI_CMD_AUTHENTICATE 0x14
29#define SPMI_CMD_MSTR_READ 0x15
30#define SPMI_CMD_MSTR_WRITE 0x16
31#define SPMI_CMD_TRANSFER_BUS_OWNERSHIP 0x1A
32#define SPMI_CMD_DDB_MASTER_READ 0x1B
33#define SPMI_CMD_DDB_SLAVE_READ 0x1C
34#define SPMI_CMD_EXT_READ 0x20
35#define SPMI_CMD_EXT_WRITEL 0x30
36#define SPMI_CMD_EXT_READL 0x38
37#define SPMI_CMD_WRITE 0x40
38#define SPMI_CMD_READ 0x60
39#define SPMI_CMD_ZERO_WRITE 0x80
40
41/**
42 * struct spmi_device - Basic representation of an SPMI device
43 * @dev: Driver model representation of the device.
44 * @ctrl: SPMI controller managing the bus hosting this device.
45 * @usid: This devices' Unique Slave IDentifier.
46 */
47struct spmi_device {
48 struct device dev;
49 struct spmi_controller *ctrl;
50 u8 usid;
51};
52
53static inline struct spmi_device *to_spmi_device(struct device *d)
54{
55 return container_of(d, struct spmi_device, dev);
56}
57
58static inline void *spmi_device_get_drvdata(const struct spmi_device *sdev)
59{
60 return dev_get_drvdata(&sdev->dev);
61}
62
63static inline void spmi_device_set_drvdata(struct spmi_device *sdev, void *data)
64{
65 dev_set_drvdata(&sdev->dev, data);
66}
67
68struct spmi_device *spmi_device_alloc(struct spmi_controller *ctrl);
69
70static inline void spmi_device_put(struct spmi_device *sdev)
71{
72 if (sdev)
73 put_device(&sdev->dev);
74}
75
76int spmi_device_add(struct spmi_device *sdev);
77
78void spmi_device_remove(struct spmi_device *sdev);
79
80/**
81 * struct spmi_controller - interface to the SPMI master controller
82 * @dev: Driver model representation of the device.
83 * @nr: board-specific number identifier for this controller/bus
84 * @cmd: sends a non-data command sequence on the SPMI bus.
85 * @read_cmd: sends a register read command sequence on the SPMI bus.
86 * @write_cmd: sends a register write command sequence on the SPMI bus.
87 */
88struct spmi_controller {
89 struct device dev;
90 unsigned int nr;
91 int (*cmd)(struct spmi_controller *ctrl, u8 opcode, u8 sid);
92 int (*read_cmd)(struct spmi_controller *ctrl, u8 opcode,
93 u8 sid, u16 addr, u8 *buf, size_t len);
94 int (*write_cmd)(struct spmi_controller *ctrl, u8 opcode,
95 u8 sid, u16 addr, const u8 *buf, size_t len);
96};
97
98static inline struct spmi_controller *to_spmi_controller(struct device *d)
99{
100 return container_of(d, struct spmi_controller, dev);
101}
102
103static inline
104void *spmi_controller_get_drvdata(const struct spmi_controller *ctrl)
105{
106 return dev_get_drvdata(&ctrl->dev);
107}
108
109static inline void spmi_controller_set_drvdata(struct spmi_controller *ctrl,
110 void *data)
111{
112 dev_set_drvdata(&ctrl->dev, data);
113}
114
115struct spmi_controller *spmi_controller_alloc(struct device *parent,
116 size_t size);
117
118/**
119 * spmi_controller_put() - decrement controller refcount
120 * @ctrl SPMI controller.
121 */
122static inline void spmi_controller_put(struct spmi_controller *ctrl)
123{
124 if (ctrl)
125 put_device(&ctrl->dev);
126}
127
128int spmi_controller_add(struct spmi_controller *ctrl);
129void spmi_controller_remove(struct spmi_controller *ctrl);
130
131/**
132 * struct spmi_driver - SPMI slave device driver
133 * @driver: SPMI device drivers should initialize name and owner field of
134 * this structure.
135 * @probe: binds this driver to a SPMI device.
136 * @remove: unbinds this driver from the SPMI device.
137 * @shutdown: standard shutdown callback used during powerdown/halt.
138 * @suspend: standard suspend callback used during system suspend.
139 * @resume: standard resume callback used during system resume.
140 *
141 * If PM runtime support is desired for a slave, a device driver can call
142 * pm_runtime_put() from their probe() routine (and a balancing
143 * pm_runtime_get() in remove()). PM runtime support for a slave is
144 * implemented by issuing a SLEEP command to the slave on runtime_suspend(),
145 * transitioning the slave into the SLEEP state. On runtime_resume(), a WAKEUP
146 * command is sent to the slave to bring it back to ACTIVE.
147 */
148struct spmi_driver {
149 struct device_driver driver;
150 int (*probe)(struct spmi_device *sdev);
151 void (*remove)(struct spmi_device *sdev);
152};
153
154static inline struct spmi_driver *to_spmi_driver(struct device_driver *d)
155{
156 return container_of(d, struct spmi_driver, driver);
157}
158
159int spmi_driver_register(struct spmi_driver *sdrv);
160
161/**
162 * spmi_driver_unregister() - unregister an SPMI client driver
163 * @sdrv: the driver to unregister
164 */
165static inline void spmi_driver_unregister(struct spmi_driver *sdrv)
166{
167 if (sdrv)
168 driver_unregister(&sdrv->driver);
169}
170
171#define module_spmi_driver(__spmi_driver) \
172 module_driver(__spmi_driver, spmi_driver_register, \
173 spmi_driver_unregister)
174
175int spmi_register_read(struct spmi_device *sdev, u8 addr, u8 *buf);
176int spmi_ext_register_read(struct spmi_device *sdev, u8 addr, u8 *buf,
177 size_t len);
178int spmi_ext_register_readl(struct spmi_device *sdev, u16 addr, u8 *buf,
179 size_t len);
180int spmi_register_write(struct spmi_device *sdev, u8 addr, u8 data);
181int spmi_register_zero_write(struct spmi_device *sdev, u8 data);
182int spmi_ext_register_write(struct spmi_device *sdev, u8 addr,
183 const u8 *buf, size_t len);
184int spmi_ext_register_writel(struct spmi_device *sdev, u16 addr,
185 const u8 *buf, size_t len);
186int spmi_command_reset(struct spmi_device *sdev);
187int spmi_command_sleep(struct spmi_device *sdev);
188int spmi_command_wakeup(struct spmi_device *sdev);
189int spmi_command_shutdown(struct spmi_device *sdev);
190
191#endif
diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h
index bcbb642a7641..087b08a4d333 100644
--- a/include/linux/ssbi.h
+++ b/include/linux/ssbi.h
@@ -20,4 +20,24 @@
20int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len); 20int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len);
21int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); 21int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
22 22
23static inline int
24ssbi_reg_read(void *context, unsigned int reg, unsigned int *val)
25{
26 int ret;
27 u8 v;
28
29 ret = ssbi_read(context, reg, &v, 1);
30 if (!ret)
31 *val = v;
32
33 return ret;
34}
35
36static inline int
37ssbi_reg_write(void *context, unsigned int reg, unsigned int val)
38{
39 u8 v = val;
40 return ssbi_write(context, reg, &v, 1);
41}
42
23#endif 43#endif
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
index 969c0a671dbf..2ca67b55e0fe 100644
--- a/include/linux/sunrpc/bc_xprt.h
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -32,7 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#include <linux/sunrpc/sched.h> 32#include <linux/sunrpc/sched.h>
33 33
34#ifdef CONFIG_SUNRPC_BACKCHANNEL 34#ifdef CONFIG_SUNRPC_BACKCHANNEL
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); 35struct rpc_rqst *xprt_lookup_bc_request(struct rpc_xprt *xprt, __be32 xid);
36void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied);
36void xprt_free_bc_request(struct rpc_rqst *req); 37void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 38int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs); 39void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 8af2804bab16..70736b98c721 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -130,6 +130,8 @@ struct rpc_create_args {
130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9) 130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
131 131
132struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132struct rpc_clnt *rpc_create(struct rpc_create_args *args);
133struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
134 struct rpc_xprt *xprt);
133struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 135struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
134 const struct rpc_program *, u32); 136 const struct rpc_program *, u32);
135void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); 137void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 62fd1b756e99..2e780134f449 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -22,7 +22,7 @@ struct svc_sock {
22 22
23 /* We keep the old state_change and data_ready CB's here */ 23 /* We keep the old state_change and data_ready CB's here */
24 void (*sk_ostate)(struct sock *); 24 void (*sk_ostate)(struct sock *);
25 void (*sk_odata)(struct sock *, int bytes); 25 void (*sk_odata)(struct sock *);
26 void (*sk_owspace)(struct sock *); 26 void (*sk_owspace)(struct sock *);
27 27
28 /* private TCP part */ 28 /* private TCP part */
@@ -56,6 +56,7 @@ int svc_recv(struct svc_rqst *, long);
56int svc_send(struct svc_rqst *); 56int svc_send(struct svc_rqst *);
57void svc_drop(struct svc_rqst *); 57void svc_drop(struct svc_rqst *);
58void svc_sock_update_bufs(struct svc_serv *serv); 58void svc_sock_update_bufs(struct svc_serv *serv);
59bool svc_alien_sock(struct net *net, int fd);
59int svc_addsock(struct svc_serv *serv, const int fd, 60int svc_addsock(struct svc_serv *serv, const int fd,
60 char *name_return, const size_t len); 61 char *name_return, const size_t len);
61void svc_init_xprt_sock(void); 62void svc_init_xprt_sock(void);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 8097b9df6773..3e5efb2b236e 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -295,13 +295,24 @@ int xprt_adjust_timeout(struct rpc_rqst *req);
295void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); 295void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
296void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 296void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
297void xprt_release(struct rpc_task *task); 297void xprt_release(struct rpc_task *task);
298struct rpc_xprt * xprt_get(struct rpc_xprt *xprt);
299void xprt_put(struct rpc_xprt *xprt); 298void xprt_put(struct rpc_xprt *xprt);
300struct rpc_xprt * xprt_alloc(struct net *net, size_t size, 299struct rpc_xprt * xprt_alloc(struct net *net, size_t size,
301 unsigned int num_prealloc, 300 unsigned int num_prealloc,
302 unsigned int max_req); 301 unsigned int max_req);
303void xprt_free(struct rpc_xprt *); 302void xprt_free(struct rpc_xprt *);
304 303
304/**
305 * xprt_get - return a reference to an RPC transport.
306 * @xprt: pointer to the transport
307 *
308 */
309static inline struct rpc_xprt *xprt_get(struct rpc_xprt *xprt)
310{
311 if (atomic_inc_not_zero(&xprt->count))
312 return xprt;
313 return NULL;
314}
315
305static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p) 316static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *p)
306{ 317{
307 return p + xprt->tsh_size; 318 return p + xprt->tsh_size;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 46ba0c6c219f..350711560753 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -260,6 +260,42 @@ struct swap_list_t {
260 int next; /* swapfile to be used next */ 260 int next; /* swapfile to be used next */
261}; 261};
262 262
263/* linux/mm/workingset.c */
264void *workingset_eviction(struct address_space *mapping, struct page *page);
265bool workingset_refault(void *shadow);
266void workingset_activation(struct page *page);
267extern struct list_lru workingset_shadow_nodes;
268
269static inline unsigned int workingset_node_pages(struct radix_tree_node *node)
270{
271 return node->count & RADIX_TREE_COUNT_MASK;
272}
273
274static inline void workingset_node_pages_inc(struct radix_tree_node *node)
275{
276 node->count++;
277}
278
279static inline void workingset_node_pages_dec(struct radix_tree_node *node)
280{
281 node->count--;
282}
283
284static inline unsigned int workingset_node_shadows(struct radix_tree_node *node)
285{
286 return node->count >> RADIX_TREE_COUNT_SHIFT;
287}
288
289static inline void workingset_node_shadows_inc(struct radix_tree_node *node)
290{
291 node->count += 1U << RADIX_TREE_COUNT_SHIFT;
292}
293
294static inline void workingset_node_shadows_dec(struct radix_tree_node *node)
295{
296 node->count -= 1U << RADIX_TREE_COUNT_SHIFT;
297}
298
263/* linux/mm/page_alloc.c */ 299/* linux/mm/page_alloc.c */
264extern unsigned long totalram_pages; 300extern unsigned long totalram_pages;
265extern unsigned long totalreserve_pages; 301extern unsigned long totalreserve_pages;
diff --git a/include/linux/sxgbe_platform.h b/include/linux/sxgbe_platform.h
new file mode 100644
index 000000000000..a62442cf0037
--- /dev/null
+++ b/include/linux/sxgbe_platform.h
@@ -0,0 +1,54 @@
1/*
2 * 10G controller driver for Samsung EXYNOS SoCs
3 *
4 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * Author: Siva Reddy Kallam <siva.kallam@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#ifndef __SXGBE_PLATFORM_H__
14#define __SXGBE_PLATFORM_H__
15
16/* MDC Clock Selection define*/
17#define SXGBE_CSR_100_150M 0x0 /* MDC = clk_scr_i/62 */
18#define SXGBE_CSR_150_250M 0x1 /* MDC = clk_scr_i/102 */
19#define SXGBE_CSR_250_300M 0x2 /* MDC = clk_scr_i/122 */
20#define SXGBE_CSR_300_350M 0x3 /* MDC = clk_scr_i/142 */
21#define SXGBE_CSR_350_400M 0x4 /* MDC = clk_scr_i/162 */
22#define SXGBE_CSR_400_500M 0x5 /* MDC = clk_scr_i/202 */
23
24/* Platfrom data for platform device structure's
25 * platform_data field
26 */
27struct sxgbe_mdio_bus_data {
28 unsigned int phy_mask;
29 int *irqs;
30 int probed_phy_irq;
31};
32
33struct sxgbe_dma_cfg {
34 int pbl;
35 int fixed_burst;
36 int burst_map;
37 int adv_addr_mode;
38};
39
40struct sxgbe_plat_data {
41 char *phy_bus_name;
42 int bus_id;
43 int phy_addr;
44 int interface;
45 struct sxgbe_mdio_bus_data *mdio_bus_data;
46 struct sxgbe_dma_cfg *dma_cfg;
47 int clk_csr;
48 int pmt;
49 int force_sf_dma_mode;
50 int force_thresh_dma_mode;
51 int riwt_off;
52};
53
54#endif /* __SXGBE_PLATFORM_H__ */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 1e67b7a5968c..a4a0588c5397 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -119,8 +119,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
119 static struct syscall_metadata __syscall_meta_##sname; \ 119 static struct syscall_metadata __syscall_meta_##sname; \
120 static struct ftrace_event_call __used \ 120 static struct ftrace_event_call __used \
121 event_enter_##sname = { \ 121 event_enter_##sname = { \
122 .name = "sys_enter"#sname, \
123 .class = &event_class_syscall_enter, \ 122 .class = &event_class_syscall_enter, \
123 { \
124 .name = "sys_enter"#sname, \
125 }, \
124 .event.funcs = &enter_syscall_print_funcs, \ 126 .event.funcs = &enter_syscall_print_funcs, \
125 .data = (void *)&__syscall_meta_##sname,\ 127 .data = (void *)&__syscall_meta_##sname,\
126 .flags = TRACE_EVENT_FL_CAP_ANY, \ 128 .flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -133,8 +135,10 @@ extern struct trace_event_functions exit_syscall_print_funcs;
133 static struct syscall_metadata __syscall_meta_##sname; \ 135 static struct syscall_metadata __syscall_meta_##sname; \
134 static struct ftrace_event_call __used \ 136 static struct ftrace_event_call __used \
135 event_exit_##sname = { \ 137 event_exit_##sname = { \
136 .name = "sys_exit"#sname, \
137 .class = &event_class_syscall_exit, \ 138 .class = &event_class_syscall_exit, \
139 { \
140 .name = "sys_exit"#sname, \
141 }, \
138 .event.funcs = &exit_syscall_print_funcs, \ 142 .event.funcs = &exit_syscall_print_funcs, \
139 .data = (void *)&__syscall_meta_##sname,\ 143 .data = (void *)&__syscall_meta_##sname,\
140 .flags = TRACE_EVENT_FL_CAP_ANY, \ 144 .flags = TRACE_EVENT_FL_CAP_ANY, \
@@ -200,6 +204,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;
200 } \ 204 } \
201 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 205 static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))
202 206
207asmlinkage long sys32_quotactl(unsigned int cmd, const char __user *special,
208 qid_t id, void __user *addr);
203asmlinkage long sys_time(time_t __user *tloc); 209asmlinkage long sys_time(time_t __user *tloc);
204asmlinkage long sys_stime(time_t __user *tptr); 210asmlinkage long sys_stime(time_t __user *tptr);
205asmlinkage long sys_gettimeofday(struct timeval __user *tv, 211asmlinkage long sys_gettimeofday(struct timeval __user *tv,
@@ -746,6 +752,9 @@ asmlinkage long sys_linkat(int olddfd, const char __user *oldname,
746 int newdfd, const char __user *newname, int flags); 752 int newdfd, const char __user *newname, int flags);
747asmlinkage long sys_renameat(int olddfd, const char __user * oldname, 753asmlinkage long sys_renameat(int olddfd, const char __user * oldname,
748 int newdfd, const char __user * newname); 754 int newdfd, const char __user * newname);
755asmlinkage long sys_renameat2(int olddfd, const char __user *oldname,
756 int newdfd, const char __user *newname,
757 unsigned int flags);
749asmlinkage long sys_futimesat(int dfd, const char __user *filename, 758asmlinkage long sys_futimesat(int dfd, const char __user *filename,
750 struct timeval __user *utimes); 759 struct timeval __user *utimes);
751asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode); 760asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 30b2ebee6439..084354b0e814 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -71,7 +71,8 @@ struct attribute_group {
71 */ 71 */
72 72
73#define __ATTR(_name, _mode, _show, _store) { \ 73#define __ATTR(_name, _mode, _show, _store) { \
74 .attr = {.name = __stringify(_name), .mode = _mode }, \ 74 .attr = {.name = __stringify(_name), \
75 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
75 .show = _show, \ 76 .show = _show, \
76 .store = _store, \ 77 .store = _store, \
77} 78}
@@ -198,6 +199,7 @@ int __must_check sysfs_chmod_file(struct kobject *kobj,
198 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
199void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr, 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
200 const void *ns); 201 const void *ns);
202bool sysfs_remove_file_self(struct kobject *kobj, const struct attribute *attr);
201void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 203void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
202 204
203int __must_check sysfs_create_bin_file(struct kobject *kobj, 205int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -246,6 +248,11 @@ void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
246 248
247int __must_check sysfs_init(void); 249int __must_check sysfs_init(void);
248 250
251static inline void sysfs_enable_ns(struct kernfs_node *kn)
252{
253 return kernfs_enable_ns(kn);
254}
255
249#else /* CONFIG_SYSFS */ 256#else /* CONFIG_SYSFS */
250 257
251static inline int sysfs_schedule_callback(struct kobject *kobj, 258static inline int sysfs_schedule_callback(struct kobject *kobj,
@@ -301,6 +308,12 @@ static inline void sysfs_remove_file_ns(struct kobject *kobj,
301{ 308{
302} 309}
303 310
311static inline bool sysfs_remove_file_self(struct kobject *kobj,
312 const struct attribute *attr)
313{
314 return false;
315}
316
304static inline void sysfs_remove_files(struct kobject *kobj, 317static inline void sysfs_remove_files(struct kobject *kobj,
305 const struct attribute **attr) 318 const struct attribute **attr)
306{ 319{
@@ -418,6 +431,10 @@ static inline int __must_check sysfs_init(void)
418 return 0; 431 return 0;
419} 432}
420 433
434static inline void sysfs_enable_ns(struct kernfs_node *kn)
435{
436}
437
421#endif /* CONFIG_SYSFS */ 438#endif /* CONFIG_SYSFS */
422 439
423static inline int __must_check sysfs_create_file(struct kobject *kobj, 440static inline int __must_check sysfs_create_file(struct kobject *kobj,
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 4ad0706d40eb..239946868142 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -201,10 +201,10 @@ struct tcp_sock {
201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */ 201 u32 tlp_high_seq; /* snd_nxt at the time of TLP retransmit. */
202 202
203/* RTT measurement */ 203/* RTT measurement */
204 u32 srtt; /* smoothed round trip time << 3 */ 204 u32 srtt_us; /* smoothed round trip time << 3 in usecs */
205 u32 mdev; /* medium deviation */ 205 u32 mdev_us; /* medium deviation */
206 u32 mdev_max; /* maximal mdev for the last rtt period */ 206 u32 mdev_max_us; /* maximal mdev for the last rtt period */
207 u32 rttvar; /* smoothed mdev_max */ 207 u32 rttvar_us; /* smoothed mdev_max */
208 u32 rtt_seq; /* sequence number to update rttvar */ 208 u32 rtt_seq; /* sequence number to update rttvar */
209 209
210 u32 packets_out; /* Packets which are "in flight" */ 210 u32 packets_out; /* Packets which are "in flight" */
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 12ae6ce997d6..7062330a1329 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -188,7 +188,7 @@ DECLARE_PER_CPU(int, numa_node);
188/* Returns the number of the current Node. */ 188/* Returns the number of the current Node. */
189static inline int numa_node_id(void) 189static inline int numa_node_id(void)
190{ 190{
191 return __this_cpu_read(numa_node); 191 return raw_cpu_read(numa_node);
192} 192}
193#endif 193#endif
194 194
@@ -245,7 +245,7 @@ static inline void set_numa_mem(int node)
245/* Returns the number of the nearest Node with memory */ 245/* Returns the number of the nearest Node with memory */
246static inline int numa_mem_id(void) 246static inline int numa_mem_id(void)
247{ 247{
248 return __this_cpu_read(_numa_mem_); 248 return raw_cpu_read(_numa_mem_);
249} 249}
250#endif 250#endif
251 251
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 7159a0a933df..9d30ee469c2a 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * See Documentation/trace/tracepoints.txt. 7 * See Documentation/trace/tracepoints.txt.
8 * 8 *
9 * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> 9 * Copyright (C) 2008-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 * 10 *
11 * Heavily inspired from the Linux Kernel Markers. 11 * Heavily inspired from the Linux Kernel Markers.
12 * 12 *
@@ -21,6 +21,7 @@
21 21
22struct module; 22struct module;
23struct tracepoint; 23struct tracepoint;
24struct notifier_block;
24 25
25struct tracepoint_func { 26struct tracepoint_func {
26 void *func; 27 void *func;
@@ -35,51 +36,40 @@ struct tracepoint {
35 struct tracepoint_func __rcu *funcs; 36 struct tracepoint_func __rcu *funcs;
36}; 37};
37 38
38/*
39 * Connect a probe to a tracepoint.
40 * Internal API, should not be used directly.
41 */
42extern int tracepoint_probe_register(const char *name, void *probe, void *data);
43
44/*
45 * Disconnect a probe from a tracepoint.
46 * Internal API, should not be used directly.
47 */
48extern int 39extern int
49tracepoint_probe_unregister(const char *name, void *probe, void *data); 40tracepoint_probe_register(struct tracepoint *tp, void *probe, void *data);
50 41extern int
51extern int tracepoint_probe_register_noupdate(const char *name, void *probe, 42tracepoint_probe_unregister(struct tracepoint *tp, void *probe, void *data);
52 void *data); 43extern void
53extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe, 44for_each_kernel_tracepoint(void (*fct)(struct tracepoint *tp, void *priv),
54 void *data); 45 void *priv);
55extern void tracepoint_probe_update_all(void);
56 46
57#ifdef CONFIG_MODULES 47#ifdef CONFIG_MODULES
58struct tp_module { 48struct tp_module {
59 struct list_head list; 49 struct list_head list;
60 unsigned int num_tracepoints; 50 struct module *mod;
61 struct tracepoint * const *tracepoints_ptrs;
62}; 51};
52
63bool trace_module_has_bad_taint(struct module *mod); 53bool trace_module_has_bad_taint(struct module *mod);
54extern int register_tracepoint_module_notifier(struct notifier_block *nb);
55extern int unregister_tracepoint_module_notifier(struct notifier_block *nb);
64#else 56#else
65static inline bool trace_module_has_bad_taint(struct module *mod) 57static inline bool trace_module_has_bad_taint(struct module *mod)
66{ 58{
67 return false; 59 return false;
68} 60}
61static inline
62int register_tracepoint_module_notifier(struct notifier_block *nb)
63{
64 return 0;
65}
66static inline
67int unregister_tracepoint_module_notifier(struct notifier_block *nb)
68{
69 return 0;
70}
69#endif /* CONFIG_MODULES */ 71#endif /* CONFIG_MODULES */
70 72
71struct tracepoint_iter {
72#ifdef CONFIG_MODULES
73 struct tp_module *module;
74#endif /* CONFIG_MODULES */
75 struct tracepoint * const *tracepoint;
76};
77
78extern void tracepoint_iter_start(struct tracepoint_iter *iter);
79extern void tracepoint_iter_next(struct tracepoint_iter *iter);
80extern void tracepoint_iter_stop(struct tracepoint_iter *iter);
81extern void tracepoint_iter_reset(struct tracepoint_iter *iter);
82
83/* 73/*
84 * tracepoint_synchronize_unregister must be called between the last tracepoint 74 * tracepoint_synchronize_unregister must be called between the last tracepoint
85 * probe unregistration and the end of module exit to make sure there is no 75 * probe unregistration and the end of module exit to make sure there is no
@@ -90,6 +80,11 @@ static inline void tracepoint_synchronize_unregister(void)
90 synchronize_sched(); 80 synchronize_sched();
91} 81}
92 82
83#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
84extern void syscall_regfunc(void);
85extern void syscall_unregfunc(void);
86#endif /* CONFIG_HAVE_SYSCALL_TRACEPOINTS */
87
93#define PARAMS(args...) args 88#define PARAMS(args...) args
94 89
95#endif /* _LINUX_TRACEPOINT_H */ 90#endif /* _LINUX_TRACEPOINT_H */
@@ -178,14 +173,14 @@ static inline void tracepoint_synchronize_unregister(void)
178 static inline int \ 173 static inline int \
179 register_trace_##name(void (*probe)(data_proto), void *data) \ 174 register_trace_##name(void (*probe)(data_proto), void *data) \
180 { \ 175 { \
181 return tracepoint_probe_register(#name, (void *)probe, \ 176 return tracepoint_probe_register(&__tracepoint_##name, \
182 data); \ 177 (void *)probe, data); \
183 } \ 178 } \
184 static inline int \ 179 static inline int \
185 unregister_trace_##name(void (*probe)(data_proto), void *data) \ 180 unregister_trace_##name(void (*probe)(data_proto), void *data) \
186 { \ 181 { \
187 return tracepoint_probe_unregister(#name, (void *)probe, \ 182 return tracepoint_probe_unregister(&__tracepoint_##name,\
188 data); \ 183 (void *)probe, data); \
189 } \ 184 } \
190 static inline void \ 185 static inline void \
191 check_trace_callback_type_##name(void (*cb)(data_proto)) \ 186 check_trace_callback_type_##name(void (*cb)(data_proto)) \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 90b4fdc8a61f..1c3316a47d7e 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -208,7 +208,7 @@ struct tty_port {
208 wait_queue_head_t delta_msr_wait; /* Modem status change */ 208 wait_queue_head_t delta_msr_wait; /* Modem status change */
209 unsigned long flags; /* TTY flags ASY_*/ 209 unsigned long flags; /* TTY flags ASY_*/
210 unsigned char console:1, /* port is a console */ 210 unsigned char console:1, /* port is a console */
211 low_latency:1; /* direct buffer flush */ 211 low_latency:1; /* optional: tune for latency */
212 struct mutex mutex; /* Locking */ 212 struct mutex mutex; /* Locking */
213 struct mutex buf_mutex; /* Buffer alloc lock */ 213 struct mutex buf_mutex; /* Buffer alloc lock */
214 unsigned char *xmit_buf; /* Optional buffer */ 214 unsigned char *xmit_buf; /* Optional buffer */
@@ -518,9 +518,9 @@ extern void tty_port_put(struct tty_port *port);
518 518
519static inline struct tty_port *tty_port_get(struct tty_port *port) 519static inline struct tty_port *tty_port_get(struct tty_port *port)
520{ 520{
521 if (port) 521 if (port && kref_get_unless_zero(&port->kref))
522 kref_get(&port->kref); 522 return port;
523 return port; 523 return NULL;
524} 524}
525 525
526/* If the cts flow control is enabled, return true. */ 526/* If the cts flow control is enabled, return true. */
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index b8347c207cb8..add26da2faeb 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -126,7 +126,6 @@
126 126
127#include <linux/fs.h> 127#include <linux/fs.h>
128#include <linux/wait.h> 128#include <linux/wait.h>
129#include <linux/wait.h>
130 129
131 130
132/* 131/*
diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h
index 7bfabd20204c..4b4439e75f45 100644
--- a/include/linux/u64_stats_sync.h
+++ b/include/linux/u64_stats_sync.h
@@ -27,8 +27,8 @@
27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could 27 * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
28 * read partial values) 28 * read partial values)
29 * 29 *
30 * 7) For softirq uses, readers can use u64_stats_fetch_begin_bh() and 30 * 7) For irq and softirq uses, readers can use u64_stats_fetch_begin_irq() and
31 * u64_stats_fetch_retry_bh() helpers 31 * u64_stats_fetch_retry_irq() helpers
32 * 32 *
33 * Usage : 33 * Usage :
34 * 34 *
@@ -114,31 +114,31 @@ static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
114} 114}
115 115
116/* 116/*
117 * In case softirq handlers can update u64 counters, readers can use following helpers 117 * In case irq handlers can update u64 counters, readers can use following helpers
118 * - SMP 32bit arches use seqcount protection, irq safe. 118 * - SMP 32bit arches use seqcount protection, irq safe.
119 * - UP 32bit must disable BH. 119 * - UP 32bit must disable irqs.
120 * - 64bit have no problem atomically reading u64 values, irq safe. 120 * - 64bit have no problem atomically reading u64 values, irq safe.
121 */ 121 */
122static inline unsigned int u64_stats_fetch_begin_bh(const struct u64_stats_sync *syncp) 122static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
123{ 123{
124#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 124#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
125 return read_seqcount_begin(&syncp->seq); 125 return read_seqcount_begin(&syncp->seq);
126#else 126#else
127#if BITS_PER_LONG==32 127#if BITS_PER_LONG==32
128 local_bh_disable(); 128 local_irq_disable();
129#endif 129#endif
130 return 0; 130 return 0;
131#endif 131#endif
132} 132}
133 133
134static inline bool u64_stats_fetch_retry_bh(const struct u64_stats_sync *syncp, 134static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
135 unsigned int start) 135 unsigned int start)
136{ 136{
137#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 137#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
138 return read_seqcount_retry(&syncp->seq, start); 138 return read_seqcount_retry(&syncp->seq, start);
139#else 139#else
140#if BITS_PER_LONG==32 140#if BITS_PER_LONG==32
141 local_bh_enable(); 141 local_irq_enable();
142#endif 142#endif
143 return false; 143 return false;
144#endif 144#endif
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index 0a4487d3fb1e..0994c0d01a09 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -20,6 +20,8 @@
20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> 20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
21 * 21 *
22 * Changes/Revisions: 22 * Changes/Revisions:
23 * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
24 * - add UI_GET_SYSNAME ioctl
23 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) 25 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
24 * - update ff support for the changes in kernel interface 26 * - update ff support for the changes in kernel interface
25 * - add UINPUT_VERSION 27 * - add UINPUT_VERSION
diff --git a/include/linux/uio.h b/include/linux/uio.h
index c55ce243cc09..199bcc34241b 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -9,14 +9,23 @@
9#ifndef __LINUX_UIO_H 9#ifndef __LINUX_UIO_H
10#define __LINUX_UIO_H 10#define __LINUX_UIO_H
11 11
12#include <linux/kernel.h>
12#include <uapi/linux/uio.h> 13#include <uapi/linux/uio.h>
13 14
15struct page;
14 16
15struct kvec { 17struct kvec {
16 void *iov_base; /* and that should *never* hold a userland pointer */ 18 void *iov_base; /* and that should *never* hold a userland pointer */
17 size_t iov_len; 19 size_t iov_len;
18}; 20};
19 21
22struct iov_iter {
23 const struct iovec *iov;
24 unsigned long nr_segs;
25 size_t iov_offset;
26 size_t count;
27};
28
20/* 29/*
21 * Total number of bytes covered by an iovec. 30 * Total number of bytes covered by an iovec.
22 * 31 *
@@ -34,8 +43,51 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
34 return ret; 43 return ret;
35} 44}
36 45
46static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
47{
48 return (struct iovec) {
49 .iov_base = iter->iov->iov_base + iter->iov_offset,
50 .iov_len = min(iter->count,
51 iter->iov->iov_len - iter->iov_offset),
52 };
53}
54
55#define iov_for_each(iov, iter, start) \
56 for (iter = (start); \
57 (iter).count && \
58 ((iov = iov_iter_iovec(&(iter))), 1); \
59 iov_iter_advance(&(iter), (iov).iov_len))
60
37unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); 61unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
38 62
63size_t iov_iter_copy_from_user_atomic(struct page *page,
64 struct iov_iter *i, unsigned long offset, size_t bytes);
65size_t iov_iter_copy_from_user(struct page *page,
66 struct iov_iter *i, unsigned long offset, size_t bytes);
67void iov_iter_advance(struct iov_iter *i, size_t bytes);
68int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes);
69size_t iov_iter_single_seg_count(const struct iov_iter *i);
70size_t copy_page_to_iter(struct page *page, size_t offset, size_t bytes,
71 struct iov_iter *i);
72
73static inline void iov_iter_init(struct iov_iter *i,
74 const struct iovec *iov, unsigned long nr_segs,
75 size_t count, size_t written)
76{
77 i->iov = iov;
78 i->nr_segs = nr_segs;
79 i->iov_offset = 0;
80 i->count = count + written;
81
82 iov_iter_advance(i, written);
83}
84
85static inline size_t iov_iter_count(struct iov_iter *i)
86{
87 return i->count;
88}
89
39int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 90int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
40int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len); 91int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len);
92
41#endif 93#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index e32251e00e62..edff2b97b864 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -126,6 +126,7 @@ extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
126extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data); 126extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs); 127extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs); 128extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
129extern bool __weak arch_uprobe_ignore(struct arch_uprobe *aup, struct pt_regs *regs);
129#else /* !CONFIG_UPROBES */ 130#else /* !CONFIG_UPROBES */
130struct uprobes_state { 131struct uprobes_state {
131}; 132};
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 7f6eb859873e..6b7ec376fb4d 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -57,6 +57,7 @@ struct ep_device;
57 * @extra: descriptors following this endpoint in the configuration 57 * @extra: descriptors following this endpoint in the configuration
58 * @extralen: how many bytes of "extra" are valid 58 * @extralen: how many bytes of "extra" are valid
59 * @enabled: URBs may be submitted to this endpoint 59 * @enabled: URBs may be submitted to this endpoint
60 * @streams: number of USB-3 streams allocated on the endpoint
60 * 61 *
61 * USB requests are always queued to a given endpoint, identified by a 62 * USB requests are always queued to a given endpoint, identified by a
62 * descriptor within an active interface in a given USB configuration. 63 * descriptor within an active interface in a given USB configuration.
@@ -71,6 +72,7 @@ struct usb_host_endpoint {
71 unsigned char *extra; /* Extra descriptors */ 72 unsigned char *extra; /* Extra descriptors */
72 int extralen; 73 int extralen;
73 int enabled; 74 int enabled;
75 int streams;
74}; 76};
75 77
76/* host-side wrapper for one interface setting's parsed descriptors */ 78/* host-side wrapper for one interface setting's parsed descriptors */
@@ -202,6 +204,8 @@ static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
202struct usb_interface *usb_get_intf(struct usb_interface *intf); 204struct usb_interface *usb_get_intf(struct usb_interface *intf);
203void usb_put_intf(struct usb_interface *intf); 205void usb_put_intf(struct usb_interface *intf);
204 206
207/* Hard limit */
208#define USB_MAXENDPOINTS 30
205/* this maximum is arbitrary */ 209/* this maximum is arbitrary */
206#define USB_MAXINTERFACES 32 210#define USB_MAXINTERFACES 32
207#define USB_MAXIADS (USB_MAXINTERFACES/2) 211#define USB_MAXIADS (USB_MAXINTERFACES/2)
@@ -366,6 +370,8 @@ struct usb_bus {
366#endif 370#endif
367}; 371};
368 372
373struct usb_dev_state;
374
369/* ----------------------------------------------------------------------- */ 375/* ----------------------------------------------------------------------- */
370 376
371struct usb_tt; 377struct usb_tt;
@@ -749,6 +755,11 @@ extern struct usb_host_interface *usb_find_alt_setting(
749 unsigned int iface_num, 755 unsigned int iface_num,
750 unsigned int alt_num); 756 unsigned int alt_num);
751 757
758/* port claiming functions */
759int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
760 struct usb_dev_state *owner);
761int usb_hub_release_port(struct usb_device *hdev, unsigned port1,
762 struct usb_dev_state *owner);
752 763
753/** 764/**
754 * usb_make_path - returns stable device path in the usb tree 765 * usb_make_path - returns stable device path in the usb tree
@@ -1666,6 +1677,10 @@ extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr);
1666/* this request isn't really synchronous, but it belongs with the others */ 1677/* this request isn't really synchronous, but it belongs with the others */
1667extern int usb_driver_set_configuration(struct usb_device *udev, int config); 1678extern int usb_driver_set_configuration(struct usb_device *udev, int config);
1668 1679
1680/* choose and set configuration for device */
1681extern int usb_choose_configuration(struct usb_device *udev);
1682extern int usb_set_configuration(struct usb_device *dev, int configuration);
1683
1669/* 1684/*
1670 * timeouts, in milliseconds, used for sending/receiving control messages 1685 * timeouts, in milliseconds, used for sending/receiving control messages
1671 * they typically complete within a few frames (msec) after they're issued 1686 * they typically complete within a few frames (msec) after they're issued
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h
index 2c14d9cdd57a..44b38b92236a 100644
--- a/include/linux/usb/cdc_ncm.h
+++ b/include/linux/usb/cdc_ncm.h
@@ -94,6 +94,7 @@ struct cdc_ncm_ctx {
94 94
95 const struct usb_cdc_ncm_desc *func_desc; 95 const struct usb_cdc_ncm_desc *func_desc;
96 const struct usb_cdc_mbim_desc *mbim_desc; 96 const struct usb_cdc_mbim_desc *mbim_desc;
97 const struct usb_cdc_mbim_extended_desc *mbim_extended_desc;
97 const struct usb_cdc_ether_desc *ether_desc; 98 const struct usb_cdc_ether_desc *ether_desc;
98 99
99 struct usb_interface *control; 100 struct usb_interface *control;
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 708bd119627f..bbe779f640be 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -25,6 +25,7 @@ struct ci_hdrc_platform_data {
25 */ 25 */
26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
27#define CI_HDRC_IMX28_WRITE_FIX BIT(5) 27#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
28#define CI_HDRC_FORCE_FULLSPEED BIT(6)
28 enum usb_dr_mode dr_mode; 29 enum usb_dr_mode dr_mode;
29#define CI_HDRC_CONTROLLER_RESET_EVENT 0 30#define CI_HDRC_CONTROLLER_RESET_EVENT 0
30#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 31#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index dba63f53906c..d3ca3b53837c 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -92,7 +92,7 @@ struct usb_configuration;
92 * @suspend: Notifies functions when the host stops sending USB traffic. 92 * @suspend: Notifies functions when the host stops sending USB traffic.
93 * @resume: Notifies functions when the host restarts USB traffic. 93 * @resume: Notifies functions when the host restarts USB traffic.
94 * @get_status: Returns function status as a reply to 94 * @get_status: Returns function status as a reply to
95 * GetStatus() request when the recepient is Interface. 95 * GetStatus() request when the recipient is Interface.
96 * @func_suspend: callback to be called when 96 * @func_suspend: callback to be called when
97 * SetFeature(FUNCTION_SUSPEND) is reseived 97 * SetFeature(FUNCTION_SUSPEND) is reseived
98 * 98 *
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index efe8d8a7c7ad..485cd5e2100c 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -143,6 +143,7 @@ struct usb_hcd {
143 unsigned authorized_default:1; 143 unsigned authorized_default:1;
144 unsigned has_tt:1; /* Integrated TT in root hub */ 144 unsigned has_tt:1; /* Integrated TT in root hub */
145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ 145 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
146 unsigned can_do_streams:1; /* HC supports streams */
146 147
147 unsigned int irq; /* irq allocated */ 148 unsigned int irq; /* irq allocated */
148 void __iomem *regs; /* device memory/io */ 149 void __iomem *regs; /* device memory/io */
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h
index 6c0b1c513db7..353053a33f21 100644
--- a/include/linux/usb/phy.h
+++ b/include/linux/usb/phy.h
@@ -111,6 +111,13 @@ struct usb_phy {
111 int (*set_suspend)(struct usb_phy *x, 111 int (*set_suspend)(struct usb_phy *x,
112 int suspend); 112 int suspend);
113 113
114 /*
115 * Set wakeup enable for PHY, in that case, the PHY can be
116 * woken up from suspend status due to external events,
117 * like vbus change, dp/dm change and id.
118 */
119 int (*set_wakeup)(struct usb_phy *x, bool enabled);
120
114 /* notify phy connect status change */ 121 /* notify phy connect status change */
115 int (*notify_connect)(struct usb_phy *x, 122 int (*notify_connect)(struct usb_phy *x,
116 enum usb_device_speed speed); 123 enum usb_device_speed speed);
@@ -265,6 +272,15 @@ usb_phy_set_suspend(struct usb_phy *x, int suspend)
265} 272}
266 273
267static inline int 274static inline int
275usb_phy_set_wakeup(struct usb_phy *x, bool enabled)
276{
277 if (x && x->set_wakeup)
278 return x->set_wakeup(x, enabled);
279 else
280 return 0;
281}
282
283static inline int
268usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed) 284usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
269{ 285{
270 if (x && x->notify_connect) 286 if (x && x->notify_connect)
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 704a1ab8240c..9bb547c7bce7 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -190,7 +190,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
190 * @num_ports: the number of different ports this device will have. 190 * @num_ports: the number of different ports this device will have.
191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer 191 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
192 * (0 = end-point size) 192 * (0 = end-point size)
193 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 193 * @bulk_out_size: minimum number of bytes to allocate for bulk-out buffer
194 * (0 = end-point size)
194 * @calc_num_ports: pointer to a function to determine how many ports this 195 * @calc_num_ports: pointer to a function to determine how many ports this
195 * device has dynamically. It will be called after the probe() 196 * device has dynamically. It will be called after the probe()
196 * callback is called, but before attach() 197 * callback is called, but before attach()
diff --git a/include/linux/usb/uas.h b/include/linux/usb/uas.h
index 5499ab5c94bd..3fc8e8b9f043 100644
--- a/include/linux/usb/uas.h
+++ b/include/linux/usb/uas.h
@@ -9,7 +9,7 @@ struct iu {
9 __u8 iu_id; 9 __u8 iu_id;
10 __u8 rsvd1; 10 __u8 rsvd1;
11 __be16 tag; 11 __be16 tag;
12}; 12} __attribute__((__packed__));
13 13
14enum { 14enum {
15 IU_ID_COMMAND = 0x01, 15 IU_ID_COMMAND = 0x01,
@@ -52,7 +52,7 @@ struct command_iu {
52 __u8 rsvd7; 52 __u8 rsvd7;
53 struct scsi_lun lun; 53 struct scsi_lun lun;
54 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */ 54 __u8 cdb[16]; /* XXX: Overflow-checking tools may misunderstand */
55}; 55} __attribute__((__packed__));
56 56
57struct task_mgmt_iu { 57struct task_mgmt_iu {
58 __u8 iu_id; 58 __u8 iu_id;
@@ -62,7 +62,7 @@ struct task_mgmt_iu {
62 __u8 rsvd2; 62 __u8 rsvd2;
63 __be16 task_tag; 63 __be16 task_tag;
64 struct scsi_lun lun; 64 struct scsi_lun lun;
65}; 65} __attribute__((__packed__));
66 66
67/* 67/*
68 * Also used for the Read Ready and Write Ready IUs since they have the 68 * Also used for the Read Ready and Write Ready IUs since they have the
@@ -77,15 +77,15 @@ struct sense_iu {
77 __u8 rsvd7[7]; 77 __u8 rsvd7[7];
78 __be16 len; 78 __be16 len;
79 __u8 sense[SCSI_SENSE_BUFFERSIZE]; 79 __u8 sense[SCSI_SENSE_BUFFERSIZE];
80}; 80} __attribute__((__packed__));
81 81
82struct response_ui { 82struct response_iu {
83 __u8 iu_id; 83 __u8 iu_id;
84 __u8 rsvd1; 84 __u8 rsvd1;
85 __be16 tag; 85 __be16 tag;
86 __be16 add_response_info; 86 __u8 add_response_info[3];
87 __u8 response_code; 87 __u8 response_code;
88}; 88} __attribute__((__packed__));
89 89
90struct usb_pipe_usage_descriptor { 90struct usb_pipe_usage_descriptor {
91 __u8 bLength; 91 __u8 bLength;
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 630356866030..1a64b26046ed 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -67,8 +67,10 @@
67 /* Initial READ(10) (and others) must be retried */ \ 67 /* Initial READ(10) (and others) must be retried */ \
68 US_FLAG(WRITE_CACHE, 0x00200000) \ 68 US_FLAG(WRITE_CACHE, 0x00200000) \
69 /* Write Cache status is not available */ \ 69 /* Write Cache status is not available */ \
70 US_FLAG(NEEDS_CAP16, 0x00400000) 70 US_FLAG(NEEDS_CAP16, 0x00400000) \
71 /* cannot handle READ_CAPACITY_10 */ 71 /* cannot handle READ_CAPACITY_10 */ \
72 US_FLAG(IGNORE_UAS, 0x00800000) \
73 /* Device advertises UAS but it is broken */
72 74
73#define US_FLAG(name, value) US_FL_##name = value , 75#define US_FLAG(name, value) US_FL_##name = value ,
74enum { US_DO_ALL_FLAGS }; 76enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 24579a0312a0..81022a52bc34 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -96,5 +96,7 @@ extern void vfio_unregister_iommu_driver(
96extern struct vfio_group *vfio_group_get_external_user(struct file *filep); 96extern struct vfio_group *vfio_group_get_external_user(struct file *filep);
97extern void vfio_group_put_external_user(struct vfio_group *group); 97extern void vfio_group_put_external_user(struct vfio_group *group);
98extern int vfio_external_user_iommu_id(struct vfio_group *group); 98extern int vfio_external_user_iommu_id(struct vfio_group *group);
99extern long vfio_external_check_extension(struct vfio_group *group,
100 unsigned long arg);
99 101
100#endif /* VFIO_H */ 102#endif /* VFIO_H */
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
deleted file mode 100644
index ed5cdeb3604d..000000000000
--- a/include/linux/video_output.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 *
3 * Copyright (C) 2006 Luming Yu <luming.yu@intel.com>
4 *
5 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 (at
10 * your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23#ifndef _LINUX_VIDEO_OUTPUT_H
24#define _LINUX_VIDEO_OUTPUT_H
25#include <linux/device.h>
26#include <linux/err.h>
27struct output_device;
28struct output_properties {
29 int (*set_state)(struct output_device *);
30 int (*get_status)(struct output_device *);
31};
32struct output_device {
33 int request_state;
34 struct output_properties *props;
35 struct device dev;
36};
37#define to_output_device(obj) container_of(obj, struct output_device, dev)
38#if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE)
39struct output_device *video_output_register(const char *name,
40 struct device *dev,
41 void *devdata,
42 struct output_properties *op);
43void video_output_unregister(struct output_device *dev);
44#else
45static struct output_device *video_output_register(const char *name,
46 struct device *dev,
47 void *devdata,
48 struct output_properties *op)
49{
50 return ERR_PTR(-ENODEV);
51}
52static void video_output_unregister(struct output_device *dev)
53{
54 return;
55}
56#endif
57#endif
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 3a712e2e7d76..486c3972c0be 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -37,6 +37,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL, 37 PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY, 38 KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 39 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
40 DROP_PAGECACHE, DROP_SLAB,
40#ifdef CONFIG_NUMA_BALANCING 41#ifdef CONFIG_NUMA_BALANCING
41 NUMA_PTE_UPDATES, 42 NUMA_PTE_UPDATES,
42 NUMA_HUGE_PTE_UPDATES, 43 NUMA_HUGE_PTE_UPDATES,
diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h
new file mode 100644
index 000000000000..c3fa0fd43949
--- /dev/null
+++ b/include/linux/vmacache.h
@@ -0,0 +1,38 @@
1#ifndef __LINUX_VMACACHE_H
2#define __LINUX_VMACACHE_H
3
4#include <linux/sched.h>
5#include <linux/mm.h>
6
7/*
8 * Hash based on the page number. Provides a good hit rate for
9 * workloads with good locality and those with random accesses as well.
10 */
11#define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK)
12
13static inline void vmacache_flush(struct task_struct *tsk)
14{
15 memset(tsk->vmacache, 0, sizeof(tsk->vmacache));
16}
17
18extern void vmacache_flush_all(struct mm_struct *mm);
19extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma);
20extern struct vm_area_struct *vmacache_find(struct mm_struct *mm,
21 unsigned long addr);
22
23#ifndef CONFIG_MMU
24extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,
25 unsigned long start,
26 unsigned long end);
27#endif
28
29static inline void vmacache_invalidate(struct mm_struct *mm)
30{
31 mm->vmacache_seqnum++;
32
33 /* deal with overflows */
34 if (unlikely(mm->vmacache_seqnum == 0))
35 vmacache_flush_all(mm);
36}
37
38#endif /* __LINUX_VMACACHE_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 67ce70c8279b..45c9cd1daf7a 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -27,9 +27,13 @@ struct vm_event_state {
27 27
28DECLARE_PER_CPU(struct vm_event_state, vm_event_states); 28DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
29 29
30/*
31 * vm counters are allowed to be racy. Use raw_cpu_ops to avoid the
32 * local_irq_disable overhead.
33 */
30static inline void __count_vm_event(enum vm_event_item item) 34static inline void __count_vm_event(enum vm_event_item item)
31{ 35{
32 __this_cpu_inc(vm_event_states.event[item]); 36 raw_cpu_inc(vm_event_states.event[item]);
33} 37}
34 38
35static inline void count_vm_event(enum vm_event_item item) 39static inline void count_vm_event(enum vm_event_item item)
@@ -39,7 +43,7 @@ static inline void count_vm_event(enum vm_event_item item)
39 43
40static inline void __count_vm_events(enum vm_event_item item, long delta) 44static inline void __count_vm_events(enum vm_event_item item, long delta)
41{ 45{
42 __this_cpu_add(vm_event_states.event[item], delta); 46 raw_cpu_add(vm_event_states.event[item], delta);
43} 47}
44 48
45static inline void count_vm_events(enum vm_event_item item, long delta) 49static inline void count_vm_events(enum vm_event_item item, long delta)
@@ -187,8 +191,6 @@ extern void zone_statistics(struct zone *, struct zone *, gfp_t gfp);
187#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d) 191#define add_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, __d)
188#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d)) 192#define sub_zone_page_state(__z, __i, __d) mod_zone_page_state(__z, __i, -(__d))
189 193
190extern void inc_zone_state(struct zone *, enum zone_stat_item);
191
192#ifdef CONFIG_SMP 194#ifdef CONFIG_SMP
193void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int); 195void __mod_zone_page_state(struct zone *, enum zone_stat_item item, int);
194void __inc_zone_page_state(struct page *, enum zone_stat_item); 196void __inc_zone_page_state(struct page *, enum zone_stat_item);
@@ -230,18 +232,18 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
230 atomic_long_inc(&vm_stat[item]); 232 atomic_long_inc(&vm_stat[item]);
231} 233}
232 234
233static inline void __inc_zone_page_state(struct page *page,
234 enum zone_stat_item item)
235{
236 __inc_zone_state(page_zone(page), item);
237}
238
239static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item) 235static inline void __dec_zone_state(struct zone *zone, enum zone_stat_item item)
240{ 236{
241 atomic_long_dec(&zone->vm_stat[item]); 237 atomic_long_dec(&zone->vm_stat[item]);
242 atomic_long_dec(&vm_stat[item]); 238 atomic_long_dec(&vm_stat[item]);
243} 239}
244 240
241static inline void __inc_zone_page_state(struct page *page,
242 enum zone_stat_item item)
243{
244 __inc_zone_state(page_zone(page), item);
245}
246
245static inline void __dec_zone_page_state(struct page *page, 247static inline void __dec_zone_page_state(struct page *page,
246 enum zone_stat_item item) 248 enum zone_stat_item item)
247{ 249{
@@ -256,6 +258,9 @@ static inline void __dec_zone_page_state(struct page *page,
256#define dec_zone_page_state __dec_zone_page_state 258#define dec_zone_page_state __dec_zone_page_state
257#define mod_zone_page_state __mod_zone_page_state 259#define mod_zone_page_state __mod_zone_page_state
258 260
261#define inc_zone_state __inc_zone_state
262#define dec_zone_state __dec_zone_state
263
259#define set_pgdat_percpu_threshold(pgdat, callback) { } 264#define set_pgdat_percpu_threshold(pgdat, callback) { }
260 265
261static inline void refresh_cpu_vm_stats(int cpu) { } 266static inline void refresh_cpu_vm_stats(int cpu) { }
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 559044c79232..e7d9d9ed14f5 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -803,17 +803,6 @@ do { \
803 __ret; \ 803 __ret; \
804}) 804})
805 805
806
807/*
808 * These are the old interfaces to sleep waiting for an event.
809 * They are racy. DO NOT use them, use the wait_event* interfaces above.
810 * We plan to remove these interfaces.
811 */
812extern void sleep_on(wait_queue_head_t *q);
813extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
814extern void interruptible_sleep_on(wait_queue_head_t *q);
815extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
816
817/* 806/*
818 * Waitqueues which are removed from the waitqueue_head at wakeup time 807 * Waitqueues which are removed from the waitqueue_head at wakeup time
819 */ 808 */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82e704b..a9c723be1acf 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ 48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49}; 49};
50 50
51struct wl12xx_platform_data { 51struct wl1251_platform_data {
52 void (*set_power)(bool enable); 52 int power_gpio;
53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
54 int irq; 54 int irq;
55 bool use_eeprom; 55 bool use_eeprom;
56};
57
58struct wl12xx_platform_data {
59 int irq;
56 int board_ref_clock; 60 int board_ref_clock;
57 int board_tcxo_clock; 61 int board_tcxo_clock;
58 unsigned long platform_quirks; 62 unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 72
69struct wl12xx_platform_data *wl12xx_get_platform_data(void); 73struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70 74
75int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76
77struct wl1251_platform_data *wl1251_get_platform_data(void);
78
71#else 79#else
72 80
73static inline 81static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
82 return ERR_PTR(-ENODATA); 90 return ERR_PTR(-ENODATA);
83} 91}
84 92
93static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{
96 return -ENOSYS;
97}
98
99static inline
100struct wl1251_platform_data *wl1251_get_platform_data(void)
101{
102 return ERR_PTR(-ENODATA);
103}
104
85#endif 105#endif
86 106
87#endif 107#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 021b8a319b9e..5777c13849ba 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -178,7 +178,7 @@ int write_cache_pages(struct address_space *mapping,
178 struct writeback_control *wbc, writepage_t writepage, 178 struct writeback_control *wbc, writepage_t writepage,
179 void *data); 179 void *data);
180int do_writepages(struct address_space *mapping, struct writeback_control *wbc); 180int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
181void set_page_dirty_balance(struct page *page, int page_mkwrite); 181void set_page_dirty_balance(struct page *page);
182void writeback_set_ratelimit(void); 182void writeback_set_ratelimit(void);
183void tag_pages_for_writeback(struct address_space *mapping, 183void tag_pages_for_writeback(struct address_space *mapping,
184 pgoff_t start, pgoff_t end); 184 pgoff_t start, pgoff_t end);
diff --git a/include/linux/xilinxfb.h b/include/linux/xilinxfb.h
deleted file mode 100644
index 5a155a968054..000000000000
--- a/include/linux/xilinxfb.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Platform device data for Xilinx Framebuffer device
3 *
4 * Copyright 2007 Secret Lab Technologies Ltd.
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 __XILINXFB_H__
12#define __XILINXFB_H__
13
14#include <linux/types.h>
15
16/* ML300/403 reference design framebuffer driver platform data struct */
17struct xilinxfb_platform_data {
18 u32 rotate_screen; /* Flag to rotate display 180 degrees */
19 u32 screen_height_mm; /* Physical dimensions of screen in mm */
20 u32 screen_width_mm;
21 u32 xres, yres; /* resolution of screen in pixels */
22 u32 xvirt, yvirt; /* resolution of memory buffer */
23
24 /* Physical address of framebuffer memory; If non-zero, driver
25 * will use provided memory address instead of allocating one from
26 * the consistent pool. */
27 u32 fb_phys;
28};
29
30#endif /* __XILINXFB_H__ */
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index 39322091e8b0..924cbb8d004a 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -220,6 +220,9 @@ struct adv7842_platform_data {
220 unsigned sdp_free_run_cbar_en:1; 220 unsigned sdp_free_run_cbar_en:1;
221 unsigned sdp_free_run_force:1; 221 unsigned sdp_free_run_force:1;
222 222
223 /* HPA manual (0) or auto (1), affects HDMI register 0x69 */
224 unsigned hpa_auto:1;
225
223 struct adv7842_sdp_csc_coeff sdp_csc_coeff; 226 struct adv7842_sdp_csc_coeff sdp_csc_coeff;
224 227
225 struct adv7842_sdp_io_sync_adjustment sdp_io_sync_625; 228 struct adv7842_sdp_io_sync_adjustment sdp_io_sync_625;
diff --git a/include/media/lm3646.h b/include/media/lm3646.h
new file mode 100644
index 000000000000..c6acf5a1d640
--- /dev/null
+++ b/include/media/lm3646.h
@@ -0,0 +1,87 @@
1/*
2 * include/media/lm3646.h
3 *
4 * Copyright (C) 2014 Texas Instruments
5 *
6 * Contact: Daniel Jeong <gshark.jeong@gmail.com>
7 * Ldd-Mlp <ldd-mlp@list.ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 */
13
14#ifndef __LM3646_H__
15#define __LM3646_H__
16
17#include <media/v4l2-subdev.h>
18
19#define LM3646_NAME "lm3646"
20#define LM3646_I2C_ADDR_REV1 (0x67)
21#define LM3646_I2C_ADDR_REV0 (0x63)
22
23/* TOTAL FLASH Brightness Max
24 * min 93350uA, step 93750uA, max 1499600uA
25 */
26#define LM3646_TOTAL_FLASH_BRT_MIN 93350
27#define LM3646_TOTAL_FLASH_BRT_STEP 93750
28#define LM3646_TOTAL_FLASH_BRT_MAX 1499600
29#define LM3646_TOTAL_FLASH_BRT_uA_TO_REG(a) \
30 ((a) < LM3646_TOTAL_FLASH_BRT_MIN ? 0 : \
31 ((((a) - LM3646_TOTAL_FLASH_BRT_MIN) / LM3646_TOTAL_FLASH_BRT_STEP)))
32
33/* TOTAL TORCH Brightness Max
34 * min 23040uA, step 23430uA, max 187100uA
35 */
36#define LM3646_TOTAL_TORCH_BRT_MIN 23040
37#define LM3646_TOTAL_TORCH_BRT_STEP 23430
38#define LM3646_TOTAL_TORCH_BRT_MAX 187100
39#define LM3646_TOTAL_TORCH_BRT_uA_TO_REG(a) \
40 ((a) < LM3646_TOTAL_TORCH_BRT_MIN ? 0 : \
41 ((((a) - LM3646_TOTAL_TORCH_BRT_MIN) / LM3646_TOTAL_TORCH_BRT_STEP)))
42
43/* LED1 FLASH Brightness
44 * min 23040uA, step 11718uA, max 1499600uA
45 */
46#define LM3646_LED1_FLASH_BRT_MIN 23040
47#define LM3646_LED1_FLASH_BRT_STEP 11718
48#define LM3646_LED1_FLASH_BRT_MAX 1499600
49#define LM3646_LED1_FLASH_BRT_uA_TO_REG(a) \
50 ((a) <= LM3646_LED1_FLASH_BRT_MIN ? 0 : \
51 ((((a) - LM3646_LED1_FLASH_BRT_MIN) / LM3646_LED1_FLASH_BRT_STEP))+1)
52
53/* LED1 TORCH Brightness
54 * min 2530uA, step 1460uA, max 187100uA
55 */
56#define LM3646_LED1_TORCH_BRT_MIN 2530
57#define LM3646_LED1_TORCH_BRT_STEP 1460
58#define LM3646_LED1_TORCH_BRT_MAX 187100
59#define LM3646_LED1_TORCH_BRT_uA_TO_REG(a) \
60 ((a) <= LM3646_LED1_TORCH_BRT_MIN ? 0 : \
61 ((((a) - LM3646_LED1_TORCH_BRT_MIN) / LM3646_LED1_TORCH_BRT_STEP))+1)
62
63/* FLASH TIMEOUT DURATION
64 * min 50ms, step 50ms, max 400ms
65 */
66#define LM3646_FLASH_TOUT_MIN 50
67#define LM3646_FLASH_TOUT_STEP 50
68#define LM3646_FLASH_TOUT_MAX 400
69#define LM3646_FLASH_TOUT_ms_TO_REG(a) \
70 ((a) <= LM3646_FLASH_TOUT_MIN ? 0 : \
71 (((a) - LM3646_FLASH_TOUT_MIN) / LM3646_FLASH_TOUT_STEP))
72
73/* struct lm3646_platform_data
74 *
75 * @flash_timeout: flash timeout
76 * @led1_flash_brt: led1 flash mode brightness, uA
77 * @led1_torch_brt: led1 torch mode brightness, uA
78 */
79struct lm3646_platform_data {
80
81 u32 flash_timeout;
82
83 u32 led1_flash_brt;
84 u32 led1_torch_brt;
85};
86
87#endif /* __LM3646_H__ */
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 2f6f1f78d958..fde142e5f25a 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Remote Controller core header 2 * Remote Controller core header
3 * 3 *
4 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 4 * Copyright (C) 2009-2010 by Mauro Carvalho Chehab
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
@@ -35,8 +35,32 @@ enum rc_driver_type {
35}; 35};
36 36
37/** 37/**
38 * struct rc_scancode_filter - Filter scan codes.
39 * @data: Scancode data to match.
40 * @mask: Mask of bits of scancode to compare.
41 */
42struct rc_scancode_filter {
43 u32 data;
44 u32 mask;
45};
46
47/**
48 * enum rc_filter_type - Filter type constants.
49 * @RC_FILTER_NORMAL: Filter for normal operation.
50 * @RC_FILTER_WAKEUP: Filter for waking from suspend.
51 * @RC_FILTER_MAX: Number of filter types.
52 */
53enum rc_filter_type {
54 RC_FILTER_NORMAL = 0,
55 RC_FILTER_WAKEUP,
56
57 RC_FILTER_MAX
58};
59
60/**
38 * struct rc_dev - represents a remote control device 61 * struct rc_dev - represents a remote control device
39 * @dev: driver model's view of this device 62 * @dev: driver model's view of this device
63 * @sysfs_groups: sysfs attribute groups
40 * @input_name: name of the input child device 64 * @input_name: name of the input child device
41 * @input_phys: physical path to the input child device 65 * @input_phys: physical path to the input child device
42 * @input_id: id of the input child device (struct input_id) 66 * @input_id: id of the input child device (struct input_id)
@@ -50,8 +74,10 @@ enum rc_driver_type {
50 * @input_dev: the input child device used to communicate events to userspace 74 * @input_dev: the input child device used to communicate events to userspace
51 * @driver_type: specifies if protocol decoding is done in hardware or software 75 * @driver_type: specifies if protocol decoding is done in hardware or software
52 * @idle: used to keep track of RX state 76 * @idle: used to keep track of RX state
53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols 77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each
54 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols 78 * filter type
79 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each
80 * filter type
55 * @scanmask: some hardware decoders are not capable of providing the full 81 * @scanmask: some hardware decoders are not capable of providing the full
56 * scancode to the application. As this is a hardware limit, we can't do 82 * scancode to the application. As this is a hardware limit, we can't do
57 * anything with it. Yet, as the same keycode table can be used with other 83 * anything with it. Yet, as the same keycode table can be used with other
@@ -70,7 +96,10 @@ enum rc_driver_type {
70 * @max_timeout: maximum timeout supported by device 96 * @max_timeout: maximum timeout supported by device
71 * @rx_resolution : resolution (in ns) of input sampler 97 * @rx_resolution : resolution (in ns) of input sampler
72 * @tx_resolution: resolution (in ns) of output sampler 98 * @tx_resolution: resolution (in ns) of output sampler
99 * @scancode_filters: scancode filters (indexed by enum rc_filter_type)
73 * @change_protocol: allow changing the protocol used on hardware decoders 100 * @change_protocol: allow changing the protocol used on hardware decoders
101 * @change_wakeup_protocol: allow changing the protocol used for wakeup
102 * filtering
74 * @open: callback to allow drivers to enable polling/irq when IR input device 103 * @open: callback to allow drivers to enable polling/irq when IR input device
75 * is opened. 104 * is opened.
76 * @close: callback to allow drivers to disable polling/irq when IR input device 105 * @close: callback to allow drivers to disable polling/irq when IR input device
@@ -84,9 +113,12 @@ enum rc_driver_type {
84 * device doesn't interrupt host until it sees IR pulses 113 * device doesn't interrupt host until it sees IR pulses
85 * @s_learning_mode: enable wide band receiver used for learning 114 * @s_learning_mode: enable wide band receiver used for learning
86 * @s_carrier_report: enable carrier reports 115 * @s_carrier_report: enable carrier reports
116 * @s_filter: set the scancode filter
117 * @s_wakeup_filter: set the wakeup scancode filter
87 */ 118 */
88struct rc_dev { 119struct rc_dev {
89 struct device dev; 120 struct device dev;
121 const struct attribute_group *sysfs_groups[5];
90 const char *input_name; 122 const char *input_name;
91 const char *input_phys; 123 const char *input_phys;
92 struct input_id input_id; 124 struct input_id input_id;
@@ -99,8 +131,8 @@ struct rc_dev {
99 struct input_dev *input_dev; 131 struct input_dev *input_dev;
100 enum rc_driver_type driver_type; 132 enum rc_driver_type driver_type;
101 bool idle; 133 bool idle;
102 u64 allowed_protos; 134 u64 allowed_protocols[RC_FILTER_MAX];
103 u64 enabled_protocols; 135 u64 enabled_protocols[RC_FILTER_MAX];
104 u32 users; 136 u32 users;
105 u32 scanmask; 137 u32 scanmask;
106 void *priv; 138 void *priv;
@@ -116,7 +148,9 @@ struct rc_dev {
116 u32 max_timeout; 148 u32 max_timeout;
117 u32 rx_resolution; 149 u32 rx_resolution;
118 u32 tx_resolution; 150 u32 tx_resolution;
151 struct rc_scancode_filter scancode_filters[RC_FILTER_MAX];
119 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); 152 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
153 int (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type);
120 int (*open)(struct rc_dev *dev); 154 int (*open)(struct rc_dev *dev);
121 void (*close)(struct rc_dev *dev); 155 void (*close)(struct rc_dev *dev);
122 int (*s_tx_mask)(struct rc_dev *dev, u32 mask); 156 int (*s_tx_mask)(struct rc_dev *dev, u32 mask);
@@ -127,10 +161,50 @@ struct rc_dev {
127 void (*s_idle)(struct rc_dev *dev, bool enable); 161 void (*s_idle)(struct rc_dev *dev, bool enable);
128 int (*s_learning_mode)(struct rc_dev *dev, int enable); 162 int (*s_learning_mode)(struct rc_dev *dev, int enable);
129 int (*s_carrier_report) (struct rc_dev *dev, int enable); 163 int (*s_carrier_report) (struct rc_dev *dev, int enable);
164 int (*s_filter)(struct rc_dev *dev,
165 struct rc_scancode_filter *filter);
166 int (*s_wakeup_filter)(struct rc_dev *dev,
167 struct rc_scancode_filter *filter);
130}; 168};
131 169
132#define to_rc_dev(d) container_of(d, struct rc_dev, dev) 170#define to_rc_dev(d) container_of(d, struct rc_dev, dev)
133 171
172static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
173{
174 return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
175}
176
177/* should be called prior to registration or with mutex held */
178static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
179{
180 rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
181}
182
183static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
184{
185 return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
186}
187
188/* should be called prior to registration or with mutex held */
189static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
190{
191 rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
192}
193
194/* should be called prior to registration or with mutex held */
195static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
196 u64 protos)
197{
198 rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
199}
200
201/* should be called prior to registration or with mutex held */
202static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
203 u64 protos)
204{
205 rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
206}
207
134/* 208/*
135 * From rc-main.c 209 * From rc-main.c
136 * Those functions can be used on any type of Remote Controller. They 210 * Those functions can be used on any type of Remote Controller. They
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index a20ed97d7d8a..e5aa2409c0ea 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * rc-map.h - define RC map names used by RC drivers 2 * rc-map.h - define RC map names used by RC drivers
3 * 3 *
4 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 4 * Copyright (c) 2010 by Mauro Carvalho Chehab
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
@@ -30,6 +30,7 @@ enum rc_type {
30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */ 30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */ 31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */ 32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */
33 RC_TYPE_SHARP = 18, /* Sharp protocol */
33}; 34};
34 35
35#define RC_BIT_NONE 0 36#define RC_BIT_NONE 0
@@ -51,6 +52,7 @@ enum rc_type {
51#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24) 52#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24)
52#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32) 53#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32)
53#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE) 54#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE)
55#define RC_BIT_SHARP (1 << RC_TYPE_SHARP)
54 56
55#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \ 57#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
56 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ 58 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
@@ -58,7 +60,7 @@ enum rc_type {
58 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ 60 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
59 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ 61 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \
60 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ 62 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
61 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE) 63 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP)
62 64
63struct rc_map_table { 65struct rc_map_table {
64 u32 scancode; 66 u32 scancode;
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index c768c9f8abc2..eec6e460f649 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -24,7 +24,8 @@
24#define VFL_TYPE_VBI 1 24#define VFL_TYPE_VBI 1
25#define VFL_TYPE_RADIO 2 25#define VFL_TYPE_RADIO 2
26#define VFL_TYPE_SUBDEV 3 26#define VFL_TYPE_SUBDEV 3
27#define VFL_TYPE_MAX 4 27#define VFL_TYPE_SDR 4
28#define VFL_TYPE_MAX 5
28 29
29/* Is this a receiver, transmitter or mem-to-mem? */ 30/* Is this a receiver, transmitter or mem-to-mem? */
30/* Ignored for VFL_TYPE_SUBDEV. */ 31/* Ignored for VFL_TYPE_SUBDEV. */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e0b74a430b3a..50cf7c110a70 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -40,6 +40,8 @@ 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_sdr_cap) (struct file *file, void *fh,
44 struct v4l2_fmtdesc *f);
43 45
44 /* VIDIOC_G_FMT handlers */ 46 /* VIDIOC_G_FMT handlers */
45 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, 47 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
@@ -62,6 +64,8 @@ struct v4l2_ioctl_ops {
62 struct v4l2_format *f); 64 struct v4l2_format *f);
63 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, 65 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
64 struct v4l2_format *f); 66 struct v4l2_format *f);
67 int (*vidioc_g_fmt_sdr_cap) (struct file *file, void *fh,
68 struct v4l2_format *f);
65 69
66 /* VIDIOC_S_FMT handlers */ 70 /* VIDIOC_S_FMT handlers */
67 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, 71 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
@@ -84,6 +88,8 @@ struct v4l2_ioctl_ops {
84 struct v4l2_format *f); 88 struct v4l2_format *f);
85 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, 89 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
86 struct v4l2_format *f); 90 struct v4l2_format *f);
91 int (*vidioc_s_fmt_sdr_cap) (struct file *file, void *fh,
92 struct v4l2_format *f);
87 93
88 /* VIDIOC_TRY_FMT handlers */ 94 /* VIDIOC_TRY_FMT handlers */
89 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, 95 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
@@ -106,6 +112,8 @@ struct v4l2_ioctl_ops {
106 struct v4l2_format *f); 112 struct v4l2_format *f);
107 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, 113 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
108 struct v4l2_format *f); 114 struct v4l2_format *f);
115 int (*vidioc_try_fmt_sdr_cap) (struct file *file, void *fh,
116 struct v4l2_format *f);
109 117
110 /* Buffer handlers */ 118 /* Buffer handlers */
111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); 119 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
@@ -265,6 +273,8 @@ struct v4l2_ioctl_ops {
265 struct v4l2_enum_dv_timings *timings); 273 struct v4l2_enum_dv_timings *timings);
266 int (*vidioc_dv_timings_cap) (struct file *file, void *fh, 274 int (*vidioc_dv_timings_cap) (struct file *file, void *fh,
267 struct v4l2_dv_timings_cap *cap); 275 struct v4l2_dv_timings_cap *cap);
276 int (*vidioc_g_edid) (struct file *file, void *fh, struct v4l2_edid *edid);
277 int (*vidioc_s_edid) (struct file *file, void *fh, struct v4l2_edid *edid);
268 278
269 int (*vidioc_subscribe_event) (struct v4l2_fh *fh, 279 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
270 const struct v4l2_event_subscription *sub); 280 const struct v4l2_event_subscription *sub);
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index 541cea4122e9..70fa7b7b0487 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -17,6 +17,7 @@
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/of_graph.h>
20 21
21#include <media/v4l2-mediabus.h> 22#include <media/v4l2-mediabus.h>
22 23
@@ -50,17 +51,13 @@ struct v4l2_of_bus_parallel {
50 51
51/** 52/**
52 * struct v4l2_of_endpoint - the endpoint data structure 53 * struct v4l2_of_endpoint - the endpoint data structure
53 * @port: identifier (value of reg property) of a port this endpoint belongs to 54 * @base: struct of_endpoint containing port, id, and local of_node
54 * @id: identifier (value of reg property) of this endpoint
55 * @local_node: pointer to device_node of this endpoint
56 * @bus_type: bus type 55 * @bus_type: bus type
57 * @bus: bus configuration data structure 56 * @bus: bus configuration data structure
58 * @head: list head for this structure 57 * @head: list head for this structure
59 */ 58 */
60struct v4l2_of_endpoint { 59struct v4l2_of_endpoint {
61 unsigned int port; 60 struct of_endpoint base;
62 unsigned int id;
63 const struct device_node *local_node;
64 enum v4l2_mbus_type bus_type; 61 enum v4l2_mbus_type bus_type;
65 union { 62 union {
66 struct v4l2_of_bus_parallel parallel; 63 struct v4l2_of_bus_parallel parallel;
@@ -72,11 +69,6 @@ struct v4l2_of_endpoint {
72#ifdef CONFIG_OF 69#ifdef CONFIG_OF
73int v4l2_of_parse_endpoint(const struct device_node *node, 70int v4l2_of_parse_endpoint(const struct device_node *node,
74 struct v4l2_of_endpoint *endpoint); 71 struct v4l2_of_endpoint *endpoint);
75struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent,
76 struct device_node *previous);
77struct device_node *v4l2_of_get_remote_port_parent(
78 const struct device_node *node);
79struct device_node *v4l2_of_get_remote_port(const struct device_node *node);
80#else /* CONFIG_OF */ 72#else /* CONFIG_OF */
81 73
82static inline int v4l2_of_parse_endpoint(const struct device_node *node, 74static inline int v4l2_of_parse_endpoint(const struct device_node *node,
@@ -85,25 +77,6 @@ static inline int v4l2_of_parse_endpoint(const struct device_node *node,
85 return -ENOSYS; 77 return -ENOSYS;
86} 78}
87 79
88static inline struct device_node *v4l2_of_get_next_endpoint(
89 const struct device_node *parent,
90 struct device_node *previous)
91{
92 return NULL;
93}
94
95static inline struct device_node *v4l2_of_get_remote_port_parent(
96 const struct device_node *node)
97{
98 return NULL;
99}
100
101static inline struct device_node *v4l2_of_get_remote_port(
102 const struct device_node *node)
103{
104 return NULL;
105}
106
107#endif /* CONFIG_OF */ 80#endif /* CONFIG_OF */
108 81
109#endif /* _V4L2_OF_H */ 82#endif /* _V4L2_OF_H */
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d67210a37ef3..28f4d8c3cf7d 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -162,6 +162,10 @@ struct v4l2_subdev_core_ops {
162 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm); 162 int (*g_std)(struct v4l2_subdev *sd, v4l2_std_id *norm);
163 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm); 163 int (*s_std)(struct v4l2_subdev *sd, v4l2_std_id norm);
164 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 164 long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);
165#ifdef CONFIG_COMPAT
166 long (*compat_ioctl32)(struct v4l2_subdev *sd, unsigned int cmd,
167 unsigned long arg);
168#endif
165#ifdef CONFIG_VIDEO_ADV_DEBUG 169#ifdef CONFIG_VIDEO_ADV_DEBUG
166 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 170 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
167 int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg); 171 int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);
@@ -192,6 +196,7 @@ struct v4l2_subdev_tuner_ops {
192 int (*s_radio)(struct v4l2_subdev *sd); 196 int (*s_radio)(struct v4l2_subdev *sd);
193 int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq); 197 int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);
194 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); 198 int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
199 int (*enum_freq_bands)(struct v4l2_subdev *sd, struct v4l2_frequency_band *band);
195 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 200 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
196 int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt); 201 int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
197 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 202 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
@@ -503,8 +508,8 @@ struct v4l2_subdev_pad_ops {
503 struct v4l2_subdev_selection *sel); 508 struct v4l2_subdev_selection *sel);
504 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 509 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
505 struct v4l2_subdev_selection *sel); 510 struct v4l2_subdev_selection *sel);
506 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid); 511 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
507 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid); 512 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
508#ifdef CONFIG_MEDIA_CONTROLLER 513#ifdef CONFIG_MEDIA_CONTROLLER
509 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, 514 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
510 struct v4l2_subdev_format *source_fmt, 515 struct v4l2_subdev_format *source_fmt,
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index bef53ce555d2..af4621109726 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -34,49 +34,49 @@ struct vb2_fileio_data;
34 * usually will result in the allocator freeing the buffer (if 34 * usually will result in the allocator freeing the buffer (if
35 * no other users of this buffer are present); the buf_priv 35 * no other users of this buffer are present); the buf_priv
36 * argument is the allocator private per-buffer structure 36 * argument is the allocator private per-buffer structure
37 * previously returned from the alloc callback 37 * previously returned from the alloc callback.
38 * @get_userptr: acquire userspace memory for a hardware operation; used for 38 * @get_userptr: acquire userspace memory for a hardware operation; used for
39 * USERPTR memory types; vaddr is the address passed to the 39 * USERPTR memory types; vaddr is the address passed to the
40 * videobuf layer when queuing a video buffer of USERPTR type; 40 * videobuf layer when queuing a video buffer of USERPTR type;
41 * should return an allocator private per-buffer structure 41 * should return an allocator private per-buffer structure
42 * associated with the buffer on success, NULL on failure; 42 * associated with the buffer on success, NULL on failure;
43 * the returned private structure will then be passed as buf_priv 43 * the returned private structure will then be passed as buf_priv
44 * argument to other ops in this structure 44 * argument to other ops in this structure.
45 * @put_userptr: inform the allocator that a USERPTR buffer will no longer 45 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
46 * be used 46 * be used.
47 * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; 47 * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation;
48 * used for DMABUF memory types; alloc_ctx is the alloc context 48 * used for DMABUF memory types; alloc_ctx is the alloc context
49 * dbuf is the shared dma_buf; returns NULL on failure; 49 * dbuf is the shared dma_buf; returns NULL on failure;
50 * allocator private per-buffer structure on success; 50 * allocator private per-buffer structure on success;
51 * this needs to be used for further accesses to the buffer 51 * this needs to be used for further accesses to the buffer.
52 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF 52 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF
53 * buffer is no longer used; the buf_priv argument is the 53 * buffer is no longer used; the buf_priv argument is the
54 * allocator private per-buffer structure previously returned 54 * allocator private per-buffer structure previously returned
55 * from the attach_dmabuf callback 55 * from the attach_dmabuf callback.
56 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator 56 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator
57 * of dmabuf is informed that this driver is going to use the 57 * of dmabuf is informed that this driver is going to use the
58 * dmabuf 58 * dmabuf.
59 * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified 59 * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified
60 * that this driver is done using the dmabuf for now 60 * that this driver is done using the dmabuf for now.
61 * @prepare: called every time the buffer is passed from userspace to the 61 * @prepare: called every time the buffer is passed from userspace to the
62 * driver, useful for cache synchronisation, optional 62 * driver, useful for cache synchronisation, optional.
63 * @finish: called every time the buffer is passed back from the driver 63 * @finish: called every time the buffer is passed back from the driver
64 * to the userspace, also optional 64 * to the userspace, also optional.
65 * @vaddr: return a kernel virtual address to a given memory buffer 65 * @vaddr: return a kernel virtual address to a given memory buffer
66 * associated with the passed private structure or NULL if no 66 * associated with the passed private structure or NULL if no
67 * such mapping exists 67 * such mapping exists.
68 * @cookie: return allocator specific cookie for a given memory buffer 68 * @cookie: return allocator specific cookie for a given memory buffer
69 * associated with the passed private structure or NULL if not 69 * associated with the passed private structure or NULL if not
70 * available 70 * available.
71 * @num_users: return the current number of users of a memory buffer; 71 * @num_users: return the current number of users of a memory buffer;
72 * return 1 if the videobuf layer (or actually the driver using 72 * return 1 if the videobuf layer (or actually the driver using
73 * it) is the only user 73 * it) is the only user.
74 * @mmap: setup a userspace mapping for a given memory buffer under 74 * @mmap: setup a userspace mapping for a given memory buffer under
75 * the provided virtual memory region 75 * the provided virtual memory region.
76 * 76 *
77 * Required ops for USERPTR types: get_userptr, put_userptr. 77 * Required ops for USERPTR types: get_userptr, put_userptr.
78 * Required ops for MMAP types: alloc, put, num_users, mmap. 78 * Required ops for MMAP types: alloc, put, num_users, mmap.
79 * Required ops for read/write access types: alloc, put, num_users, vaddr 79 * Required ops for read/write access types: alloc, put, num_users, vaddr.
80 * Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf, 80 * Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf,
81 * unmap_dmabuf. 81 * unmap_dmabuf.
82 */ 82 */
@@ -203,6 +203,37 @@ struct vb2_buffer {
203 struct list_head done_entry; 203 struct list_head done_entry;
204 204
205 struct vb2_plane planes[VIDEO_MAX_PLANES]; 205 struct vb2_plane planes[VIDEO_MAX_PLANES];
206
207#ifdef CONFIG_VIDEO_ADV_DEBUG
208 /*
209 * Counters for how often these buffer-related ops are
210 * called. Used to check for unbalanced ops.
211 */
212 u32 cnt_mem_alloc;
213 u32 cnt_mem_put;
214 u32 cnt_mem_get_dmabuf;
215 u32 cnt_mem_get_userptr;
216 u32 cnt_mem_put_userptr;
217 u32 cnt_mem_prepare;
218 u32 cnt_mem_finish;
219 u32 cnt_mem_attach_dmabuf;
220 u32 cnt_mem_detach_dmabuf;
221 u32 cnt_mem_map_dmabuf;
222 u32 cnt_mem_unmap_dmabuf;
223 u32 cnt_mem_vaddr;
224 u32 cnt_mem_cookie;
225 u32 cnt_mem_num_users;
226 u32 cnt_mem_mmap;
227
228 u32 cnt_buf_init;
229 u32 cnt_buf_prepare;
230 u32 cnt_buf_finish;
231 u32 cnt_buf_cleanup;
232 u32 cnt_buf_queue;
233
234 /* This counts the number of calls to vb2_buffer_done() */
235 u32 cnt_buf_done;
236#endif
206}; 237};
207 238
208/** 239/**
@@ -227,27 +258,35 @@ struct vb2_buffer {
227 * @wait_prepare: release any locks taken while calling vb2 functions; 258 * @wait_prepare: release any locks taken while calling vb2 functions;
228 * it is called before an ioctl needs to wait for a new 259 * it is called before an ioctl needs to wait for a new
229 * buffer to arrive; required to avoid a deadlock in 260 * buffer to arrive; required to avoid a deadlock in
230 * blocking access type 261 * blocking access type.
231 * @wait_finish: reacquire all locks released in the previous callback; 262 * @wait_finish: reacquire all locks released in the previous callback;
232 * required to continue operation after sleeping while 263 * required to continue operation after sleeping while
233 * waiting for a new buffer to arrive 264 * waiting for a new buffer to arrive.
234 * @buf_init: called once after allocating a buffer (in MMAP case) 265 * @buf_init: called once after allocating a buffer (in MMAP case)
235 * or after acquiring a new USERPTR buffer; drivers may 266 * or after acquiring a new USERPTR buffer; drivers may
236 * perform additional buffer-related initialization; 267 * perform additional buffer-related initialization;
237 * initialization failure (return != 0) will prevent 268 * initialization failure (return != 0) will prevent
238 * queue setup from completing successfully; optional 269 * queue setup from completing successfully; optional.
239 * @buf_prepare: called every time the buffer is queued from userspace 270 * @buf_prepare: called every time the buffer is queued from userspace
240 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may 271 * and from the VIDIOC_PREPARE_BUF ioctl; drivers may
241 * perform any initialization required before each hardware 272 * perform any initialization required before each hardware
242 * operation in this callback; drivers that support 273 * operation in this callback; drivers that support
243 * VIDIOC_CREATE_BUFS must also validate the buffer size; 274 * VIDIOC_CREATE_BUFS must also validate the buffer size;
244 * if an error is returned, the buffer will not be queued 275 * if an error is returned, the buffer will not be queued
245 * in driver; optional 276 * in driver; optional.
246 * @buf_finish: called before every dequeue of the buffer back to 277 * @buf_finish: called before every dequeue of the buffer back to
247 * userspace; drivers may perform any operations required 278 * userspace; drivers may perform any operations required
248 * before userspace accesses the buffer; optional 279 * before userspace accesses the buffer; optional. The
280 * buffer state can be one of the following: DONE and
281 * ERROR occur while streaming is in progress, and the
282 * PREPARED state occurs when the queue has been canceled
283 * and all pending buffers are being returned to their
284 * default DEQUEUED state. Typically you only have to do
285 * something if the state is VB2_BUF_STATE_DONE, since in
286 * all other cases the buffer contents will be ignored
287 * anyway.
249 * @buf_cleanup: called once before the buffer is freed; drivers may 288 * @buf_cleanup: called once before the buffer is freed; drivers may
250 * perform any additional cleanup; optional 289 * perform any additional cleanup; optional.
251 * @start_streaming: called once to enter 'streaming' state; the driver may 290 * @start_streaming: called once to enter 'streaming' state; the driver may
252 * receive buffers with @buf_queue callback before 291 * receive buffers with @buf_queue callback before
253 * @start_streaming is called; the driver gets the number 292 * @start_streaming is called; the driver gets the number
@@ -268,7 +307,7 @@ struct vb2_buffer {
268 * the buffer back by calling vb2_buffer_done() function; 307 * the buffer back by calling vb2_buffer_done() function;
269 * it is allways called after calling STREAMON ioctl; 308 * it is allways called after calling STREAMON ioctl;
270 * might be called before start_streaming callback if user 309 * might be called before start_streaming callback if user
271 * pre-queued buffers before calling STREAMON 310 * pre-queued buffers before calling STREAMON.
272 */ 311 */
273struct vb2_ops { 312struct vb2_ops {
274 int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt, 313 int (*queue_setup)(struct vb2_queue *q, const struct v4l2_format *fmt,
@@ -280,7 +319,7 @@ struct vb2_ops {
280 319
281 int (*buf_init)(struct vb2_buffer *vb); 320 int (*buf_init)(struct vb2_buffer *vb);
282 int (*buf_prepare)(struct vb2_buffer *vb); 321 int (*buf_prepare)(struct vb2_buffer *vb);
283 int (*buf_finish)(struct vb2_buffer *vb); 322 void (*buf_finish)(struct vb2_buffer *vb);
284 void (*buf_cleanup)(struct vb2_buffer *vb); 323 void (*buf_cleanup)(struct vb2_buffer *vb);
285 324
286 int (*start_streaming)(struct vb2_queue *q, unsigned int count); 325 int (*start_streaming)(struct vb2_queue *q, unsigned int count);
@@ -312,23 +351,29 @@ struct v4l2_fh;
312 * @buf_struct_size: size of the driver-specific buffer structure; 351 * @buf_struct_size: size of the driver-specific buffer structure;
313 * "0" indicates the driver doesn't want to use a custom buffer 352 * "0" indicates the driver doesn't want to use a custom buffer
314 * structure type, so sizeof(struct vb2_buffer) will is used 353 * structure type, so sizeof(struct vb2_buffer) will is used
354 * @timestamp_flags: Timestamp flags; V4L2_BUF_FLAGS_TIMESTAMP_* and
355 * V4L2_BUF_FLAGS_TSTAMP_SRC_*
315 * @gfp_flags: additional gfp flags used when allocating the buffers. 356 * @gfp_flags: additional gfp flags used when allocating the buffers.
316 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 357 * Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32
317 * to force the buffer allocation to a specific memory zone. 358 * to force the buffer allocation to a specific memory zone.
359 * @min_buffers_needed: the minimum number of buffers needed before
360 * start_streaming() can be called. Used when a DMA engine
361 * cannot be started unless at least this number of buffers
362 * have been queued into the driver.
318 * 363 *
319 * @memory: current memory type used 364 * @memory: current memory type used
320 * @bufs: videobuf buffer structures 365 * @bufs: videobuf buffer structures
321 * @num_buffers: number of allocated/used buffers 366 * @num_buffers: number of allocated/used buffers
322 * @queued_list: list of buffers currently queued from userspace 367 * @queued_list: list of buffers currently queued from userspace
323 * @queued_count: number of buffers owned by the driver 368 * @queued_count: number of buffers queued and ready for streaming.
369 * @owned_by_drv_count: number of buffers owned by the driver
324 * @done_list: list of buffers ready to be dequeued to userspace 370 * @done_list: list of buffers ready to be dequeued to userspace
325 * @done_lock: lock to protect done_list list 371 * @done_lock: lock to protect done_list list
326 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued 372 * @done_wq: waitqueue for processes waiting for buffers ready to be dequeued
327 * @alloc_ctx: memory type/allocator-specific contexts for each plane 373 * @alloc_ctx: memory type/allocator-specific contexts for each plane
328 * @streaming: current streaming state 374 * @streaming: current streaming state
329 * @retry_start_streaming: start_streaming() was called, but there were not enough 375 * @start_streaming_called: start_streaming() was called successfully and we
330 * buffers queued. If set, then retry calling start_streaming when 376 * started streaming.
331 * queuing a new buffer.
332 * @fileio: file io emulator internal data, used only if emulator is active 377 * @fileio: file io emulator internal data, used only if emulator is active
333 */ 378 */
334struct vb2_queue { 379struct vb2_queue {
@@ -342,8 +387,9 @@ struct vb2_queue {
342 const struct vb2_mem_ops *mem_ops; 387 const struct vb2_mem_ops *mem_ops;
343 void *drv_priv; 388 void *drv_priv;
344 unsigned int buf_struct_size; 389 unsigned int buf_struct_size;
345 u32 timestamp_type; 390 u32 timestamp_flags;
346 gfp_t gfp_flags; 391 gfp_t gfp_flags;
392 u32 min_buffers_needed;
347 393
348/* private: internal use only */ 394/* private: internal use only */
349 enum v4l2_memory memory; 395 enum v4l2_memory memory;
@@ -351,8 +397,9 @@ struct vb2_queue {
351 unsigned int num_buffers; 397 unsigned int num_buffers;
352 398
353 struct list_head queued_list; 399 struct list_head queued_list;
400 unsigned int queued_count;
354 401
355 atomic_t queued_count; 402 atomic_t owned_by_drv_count;
356 struct list_head done_list; 403 struct list_head done_list;
357 spinlock_t done_lock; 404 spinlock_t done_lock;
358 wait_queue_head_t done_wq; 405 wait_queue_head_t done_wq;
@@ -361,9 +408,21 @@ struct vb2_queue {
361 unsigned int plane_sizes[VIDEO_MAX_PLANES]; 408 unsigned int plane_sizes[VIDEO_MAX_PLANES];
362 409
363 unsigned int streaming:1; 410 unsigned int streaming:1;
364 unsigned int retry_start_streaming:1; 411 unsigned int start_streaming_called:1;
365 412
366 struct vb2_fileio_data *fileio; 413 struct vb2_fileio_data *fileio;
414
415#ifdef CONFIG_VIDEO_ADV_DEBUG
416 /*
417 * Counters for how often these queue-related ops are
418 * called. Used to check for unbalanced ops.
419 */
420 u32 cnt_queue_setup;
421 u32 cnt_wait_prepare;
422 u32 cnt_wait_finish;
423 u32 cnt_start_streaming;
424 u32 cnt_stop_streaming;
425#endif
367}; 426};
368 427
369void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no); 428void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no);
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
new file mode 100644
index 000000000000..f7d372b7d4ff
--- /dev/null
+++ b/include/net/6lowpan.h
@@ -0,0 +1,434 @@
1/*
2 * Copyright 2011, Siemens AG
3 * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
4 */
5
6/*
7 * Based on patches from Jon Smirl <jonsmirl@gmail.com>
8 * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com>
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
12 * as published by the Free Software Foundation.
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/* Jon's code is based on 6lowpan implementation for Contiki which is:
25 * Copyright (c) 2008, Swedish Institute of Computer Science.
26 * All rights reserved.
27 *
28 * Redistribution and use in source and binary forms, with or without
29 * modification, are permitted provided that the following conditions
30 * are met:
31 * 1. Redistributions of source code must retain the above copyright
32 * notice, this list of conditions and the following disclaimer.
33 * 2. Redistributions in binary form must reproduce the above copyright
34 * notice, this list of conditions and the following disclaimer in the
35 * documentation and/or other materials provided with the distribution.
36 * 3. Neither the name of the Institute nor the names of its contributors
37 * may be used to endorse or promote products derived from this software
38 * without specific prior written permission.
39 *
40 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
41 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
44 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 */
52
53#ifndef __6LOWPAN_H__
54#define __6LOWPAN_H__
55
56#include <net/ipv6.h>
57
58#define UIP_802154_SHORTADDR_LEN 2 /* compressed ipv6 address length */
59#define UIP_IPH_LEN 40 /* ipv6 fixed header size */
60#define UIP_PROTO_UDP 17 /* ipv6 next header value for UDP */
61#define UIP_FRAGH_LEN 8 /* ipv6 fragment header size */
62
63/*
64 * ipv6 address based on mac
65 * second bit-flip (Universe/Local) is done according RFC2464
66 */
67#define is_addr_mac_addr_based(a, m) \
68 ((((a)->s6_addr[8]) == (((m)[0]) ^ 0x02)) && \
69 (((a)->s6_addr[9]) == (m)[1]) && \
70 (((a)->s6_addr[10]) == (m)[2]) && \
71 (((a)->s6_addr[11]) == (m)[3]) && \
72 (((a)->s6_addr[12]) == (m)[4]) && \
73 (((a)->s6_addr[13]) == (m)[5]) && \
74 (((a)->s6_addr[14]) == (m)[6]) && \
75 (((a)->s6_addr[15]) == (m)[7]))
76
77/* ipv6 address is unspecified */
78#define is_addr_unspecified(a) \
79 ((((a)->s6_addr32[0]) == 0) && \
80 (((a)->s6_addr32[1]) == 0) && \
81 (((a)->s6_addr32[2]) == 0) && \
82 (((a)->s6_addr32[3]) == 0))
83
84/* compare ipv6 addresses prefixes */
85#define ipaddr_prefixcmp(addr1, addr2, length) \
86 (memcmp(addr1, addr2, length >> 3) == 0)
87
88/* local link, i.e. FE80::/10 */
89#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
90
91/*
92 * check whether we can compress the IID to 16 bits,
93 * it's possible for unicast adresses with first 49 bits are zero only.
94 */
95#define lowpan_is_iid_16_bit_compressable(a) \
96 ((((a)->s6_addr16[4]) == 0) && \
97 (((a)->s6_addr[10]) == 0) && \
98 (((a)->s6_addr[11]) == 0xff) && \
99 (((a)->s6_addr[12]) == 0xfe) && \
100 (((a)->s6_addr[13]) == 0))
101
102/* multicast address */
103#define is_addr_mcast(a) (((a)->s6_addr[0]) == 0xFF)
104
105/* check whether the 112-bit gid of the multicast address is mappable to: */
106
107/* 9 bits, for FF02::1 (all nodes) and FF02::2 (all routers) addresses only. */
108#define lowpan_is_mcast_addr_compressable(a) \
109 ((((a)->s6_addr16[1]) == 0) && \
110 (((a)->s6_addr16[2]) == 0) && \
111 (((a)->s6_addr16[3]) == 0) && \
112 (((a)->s6_addr16[4]) == 0) && \
113 (((a)->s6_addr16[5]) == 0) && \
114 (((a)->s6_addr16[6]) == 0) && \
115 (((a)->s6_addr[14]) == 0) && \
116 ((((a)->s6_addr[15]) == 1) || (((a)->s6_addr[15]) == 2)))
117
118/* 48 bits, FFXX::00XX:XXXX:XXXX */
119#define lowpan_is_mcast_addr_compressable48(a) \
120 ((((a)->s6_addr16[1]) == 0) && \
121 (((a)->s6_addr16[2]) == 0) && \
122 (((a)->s6_addr16[3]) == 0) && \
123 (((a)->s6_addr16[4]) == 0) && \
124 (((a)->s6_addr[10]) == 0))
125
126/* 32 bits, FFXX::00XX:XXXX */
127#define lowpan_is_mcast_addr_compressable32(a) \
128 ((((a)->s6_addr16[1]) == 0) && \
129 (((a)->s6_addr16[2]) == 0) && \
130 (((a)->s6_addr16[3]) == 0) && \
131 (((a)->s6_addr16[4]) == 0) && \
132 (((a)->s6_addr16[5]) == 0) && \
133 (((a)->s6_addr[12]) == 0))
134
135/* 8 bits, FF02::00XX */
136#define lowpan_is_mcast_addr_compressable8(a) \
137 ((((a)->s6_addr[1]) == 2) && \
138 (((a)->s6_addr16[1]) == 0) && \
139 (((a)->s6_addr16[2]) == 0) && \
140 (((a)->s6_addr16[3]) == 0) && \
141 (((a)->s6_addr16[4]) == 0) && \
142 (((a)->s6_addr16[5]) == 0) && \
143 (((a)->s6_addr16[6]) == 0) && \
144 (((a)->s6_addr[14]) == 0))
145
146#define lowpan_is_addr_broadcast(a) \
147 ((((a)[0]) == 0xFF) && \
148 (((a)[1]) == 0xFF) && \
149 (((a)[2]) == 0xFF) && \
150 (((a)[3]) == 0xFF) && \
151 (((a)[4]) == 0xFF) && \
152 (((a)[5]) == 0xFF) && \
153 (((a)[6]) == 0xFF) && \
154 (((a)[7]) == 0xFF))
155
156#define LOWPAN_DISPATCH_IPV6 0x41 /* 01000001 = 65 */
157#define LOWPAN_DISPATCH_HC1 0x42 /* 01000010 = 66 */
158#define LOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx = ... */
159#define LOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx */
160#define LOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx */
161
162#define LOWPAN_DISPATCH_MASK 0xf8 /* 11111000 */
163
164#define LOWPAN_FRAG_TIMEOUT (HZ * 60) /* time-out 60 sec */
165
166#define LOWPAN_FRAG1_HEAD_SIZE 0x4
167#define LOWPAN_FRAGN_HEAD_SIZE 0x5
168
169/*
170 * According IEEE802.15.4 standard:
171 * - MTU is 127 octets
172 * - maximum MHR size is 37 octets
173 * - MFR size is 2 octets
174 *
175 * so minimal payload size that we may guarantee is:
176 * MTU - MHR - MFR = 88 octets
177 */
178#define LOWPAN_FRAG_SIZE 88
179
180/*
181 * Values of fields within the IPHC encoding first byte
182 * (C stands for compressed and I for inline)
183 */
184#define LOWPAN_IPHC_TF 0x18
185
186#define LOWPAN_IPHC_FL_C 0x10
187#define LOWPAN_IPHC_TC_C 0x08
188#define LOWPAN_IPHC_NH_C 0x04
189#define LOWPAN_IPHC_TTL_1 0x01
190#define LOWPAN_IPHC_TTL_64 0x02
191#define LOWPAN_IPHC_TTL_255 0x03
192#define LOWPAN_IPHC_TTL_I 0x00
193
194
195/* Values of fields within the IPHC encoding second byte */
196#define LOWPAN_IPHC_CID 0x80
197
198#define LOWPAN_IPHC_ADDR_00 0x00
199#define LOWPAN_IPHC_ADDR_01 0x01
200#define LOWPAN_IPHC_ADDR_02 0x02
201#define LOWPAN_IPHC_ADDR_03 0x03
202
203#define LOWPAN_IPHC_SAC 0x40
204#define LOWPAN_IPHC_SAM 0x30
205
206#define LOWPAN_IPHC_SAM_BIT 4
207
208#define LOWPAN_IPHC_M 0x08
209#define LOWPAN_IPHC_DAC 0x04
210#define LOWPAN_IPHC_DAM_00 0x00
211#define LOWPAN_IPHC_DAM_01 0x01
212#define LOWPAN_IPHC_DAM_10 0x02
213#define LOWPAN_IPHC_DAM_11 0x03
214
215#define LOWPAN_IPHC_DAM_BIT 0
216/*
217 * LOWPAN_UDP encoding (works together with IPHC)
218 */
219#define LOWPAN_NHC_UDP_MASK 0xF8
220#define LOWPAN_NHC_UDP_ID 0xF0
221#define LOWPAN_NHC_UDP_CHECKSUMC 0x04
222#define LOWPAN_NHC_UDP_CHECKSUMI 0x00
223
224#define LOWPAN_NHC_UDP_4BIT_PORT 0xF0B0
225#define LOWPAN_NHC_UDP_4BIT_MASK 0xFFF0
226#define LOWPAN_NHC_UDP_8BIT_PORT 0xF000
227#define LOWPAN_NHC_UDP_8BIT_MASK 0xFF00
228
229/* values for port compression, _with checksum_ ie bit 5 set to 0 */
230#define LOWPAN_NHC_UDP_CS_P_00 0xF0 /* all inline */
231#define LOWPAN_NHC_UDP_CS_P_01 0xF1 /* source 16bit inline,
232 dest = 0xF0 + 8 bit inline */
233#define LOWPAN_NHC_UDP_CS_P_10 0xF2 /* source = 0xF0 + 8bit inline,
234 dest = 16 bit inline */
235#define LOWPAN_NHC_UDP_CS_P_11 0xF3 /* source & dest = 0xF0B + 4bit inline */
236#define LOWPAN_NHC_UDP_CS_C 0x04 /* checksum elided */
237
238#ifdef DEBUG
239/* print data in line */
240static inline void raw_dump_inline(const char *caller, char *msg,
241 unsigned char *buf, int len)
242{
243 if (msg)
244 pr_debug("%s():%s: ", caller, msg);
245
246 print_hex_dump_debug("", DUMP_PREFIX_NONE, 16, 1, buf, len, false);
247}
248
249/* print data in a table format:
250 *
251 * addr: xx xx xx xx xx xx
252 * addr: xx xx xx xx xx xx
253 * ...
254 */
255static inline void raw_dump_table(const char *caller, char *msg,
256 unsigned char *buf, int len)
257{
258 if (msg)
259 pr_debug("%s():%s:\n", caller, msg);
260
261 print_hex_dump_debug("\t", DUMP_PREFIX_OFFSET, 16, 1, buf, len, false);
262}
263#else
264static inline void raw_dump_table(const char *caller, char *msg,
265 unsigned char *buf, int len) { }
266static inline void raw_dump_inline(const char *caller, char *msg,
267 unsigned char *buf, int len) { }
268#endif
269
270static inline int lowpan_fetch_skb_u8(struct sk_buff *skb, u8 *val)
271{
272 if (unlikely(!pskb_may_pull(skb, 1)))
273 return -EINVAL;
274
275 *val = skb->data[0];
276 skb_pull(skb, 1);
277
278 return 0;
279}
280
281static inline int lowpan_fetch_skb_u16(struct sk_buff *skb, u16 *val)
282{
283 if (unlikely(!pskb_may_pull(skb, 2)))
284 return -EINVAL;
285
286 *val = (skb->data[0] << 8) | skb->data[1];
287 skb_pull(skb, 2);
288
289 return 0;
290}
291
292static inline bool lowpan_fetch_skb(struct sk_buff *skb,
293 void *data, const unsigned int len)
294{
295 if (unlikely(!pskb_may_pull(skb, len)))
296 return true;
297
298 skb_copy_from_linear_data(skb, data, len);
299 skb_pull(skb, len);
300
301 return false;
302}
303
304static inline void lowpan_push_hc_data(u8 **hc_ptr, const void *data,
305 const size_t len)
306{
307 memcpy(*hc_ptr, data, len);
308 *hc_ptr += len;
309}
310
311static inline u8 lowpan_addr_mode_size(const u8 addr_mode)
312{
313 static const u8 addr_sizes[] = {
314 [LOWPAN_IPHC_ADDR_00] = 16,
315 [LOWPAN_IPHC_ADDR_01] = 8,
316 [LOWPAN_IPHC_ADDR_02] = 2,
317 [LOWPAN_IPHC_ADDR_03] = 0,
318 };
319 return addr_sizes[addr_mode];
320}
321
322static inline u8 lowpan_next_hdr_size(const u8 h_enc, u16 *uncomp_header)
323{
324 u8 ret = 1;
325
326 if ((h_enc & LOWPAN_NHC_UDP_MASK) == LOWPAN_NHC_UDP_ID) {
327 *uncomp_header += sizeof(struct udphdr);
328
329 switch (h_enc & LOWPAN_NHC_UDP_CS_P_11) {
330 case LOWPAN_NHC_UDP_CS_P_00:
331 ret += 4;
332 break;
333 case LOWPAN_NHC_UDP_CS_P_01:
334 case LOWPAN_NHC_UDP_CS_P_10:
335 ret += 3;
336 break;
337 case LOWPAN_NHC_UDP_CS_P_11:
338 ret++;
339 break;
340 default:
341 break;
342 }
343
344 if (!(h_enc & LOWPAN_NHC_UDP_CS_C))
345 ret += 2;
346 }
347
348 return ret;
349}
350
351/**
352 * lowpan_uncompress_size - returns skb->len size with uncompressed header
353 * @skb: sk_buff with 6lowpan header inside
354 * @datagram_offset: optional to get the datagram_offset value
355 *
356 * Returns the skb->len with uncompressed header
357 */
358static inline u16
359lowpan_uncompress_size(const struct sk_buff *skb, u16 *dgram_offset)
360{
361 u16 ret = 2, uncomp_header = sizeof(struct ipv6hdr);
362 u8 iphc0, iphc1, h_enc;
363
364 iphc0 = skb_network_header(skb)[0];
365 iphc1 = skb_network_header(skb)[1];
366
367 switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) {
368 case 0:
369 ret += 4;
370 break;
371 case 1:
372 ret += 3;
373 break;
374 case 2:
375 ret++;
376 break;
377 default:
378 break;
379 }
380
381 if (!(iphc0 & LOWPAN_IPHC_NH_C))
382 ret++;
383
384 if (!(iphc0 & 0x03))
385 ret++;
386
387 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_SAM) >>
388 LOWPAN_IPHC_SAM_BIT);
389
390 if (iphc1 & LOWPAN_IPHC_M) {
391 switch ((iphc1 & LOWPAN_IPHC_DAM_11) >>
392 LOWPAN_IPHC_DAM_BIT) {
393 case LOWPAN_IPHC_DAM_00:
394 ret += 16;
395 break;
396 case LOWPAN_IPHC_DAM_01:
397 ret += 6;
398 break;
399 case LOWPAN_IPHC_DAM_10:
400 ret += 4;
401 break;
402 case LOWPAN_IPHC_DAM_11:
403 ret++;
404 break;
405 default:
406 break;
407 }
408 } else {
409 ret += lowpan_addr_mode_size((iphc1 & LOWPAN_IPHC_DAM_11) >>
410 LOWPAN_IPHC_DAM_BIT);
411 }
412
413 if (iphc0 & LOWPAN_IPHC_NH_C) {
414 h_enc = skb_network_header(skb)[ret];
415 ret += lowpan_next_hdr_size(h_enc, &uncomp_header);
416 }
417
418 if (dgram_offset)
419 *dgram_offset = uncomp_header;
420
421 return skb->len + uncomp_header - ret;
422}
423
424typedef int (*skb_delivery_cb)(struct sk_buff *skb, struct net_device *dev);
425
426int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
427 const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
428 const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
429 u8 iphc0, u8 iphc1, skb_delivery_cb skb_deliver);
430int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
431 unsigned short type, const void *_daddr,
432 const void *_saddr, unsigned int len);
433
434#endif /* __6LOWPAN_H__ */
diff --git a/include/net/9p/client.h b/include/net/9p/client.h
index c38a005bd0cf..6fab66c5c5af 100644
--- a/include/net/9p/client.h
+++ b/include/net/9p/client.h
@@ -67,7 +67,6 @@ enum p9_trans_status {
67 * @REQ_STATUS_ALLOC: request has been allocated but not sent 67 * @REQ_STATUS_ALLOC: request has been allocated but not sent
68 * @REQ_STATUS_UNSENT: request waiting to be sent 68 * @REQ_STATUS_UNSENT: request waiting to be sent
69 * @REQ_STATUS_SENT: request sent to server 69 * @REQ_STATUS_SENT: request sent to server
70 * @REQ_STATUS_FLSH: a flush has been sent for this request
71 * @REQ_STATUS_RCVD: response received from server 70 * @REQ_STATUS_RCVD: response received from server
72 * @REQ_STATUS_FLSHD: request has been flushed 71 * @REQ_STATUS_FLSHD: request has been flushed
73 * @REQ_STATUS_ERROR: request encountered an error on the client side 72 * @REQ_STATUS_ERROR: request encountered an error on the client side
@@ -83,7 +82,6 @@ enum p9_req_status_t {
83 REQ_STATUS_ALLOC, 82 REQ_STATUS_ALLOC,
84 REQ_STATUS_UNSENT, 83 REQ_STATUS_UNSENT,
85 REQ_STATUS_SENT, 84 REQ_STATUS_SENT,
86 REQ_STATUS_FLSH,
87 REQ_STATUS_RCVD, 85 REQ_STATUS_RCVD,
88 REQ_STATUS_FLSHD, 86 REQ_STATUS_FLSHD,
89 REQ_STATUS_ERROR, 87 REQ_STATUS_ERROR,
@@ -130,7 +128,6 @@ struct p9_req_t {
130 * @proto_version: 9P protocol version to use 128 * @proto_version: 9P protocol version to use
131 * @trans_mod: module API instantiated with this client 129 * @trans_mod: module API instantiated with this client
132 * @trans: tranport instance state and API 130 * @trans: tranport instance state and API
133 * @conn: connection state information used by trans_fd
134 * @fidpool: fid handle accounting for session 131 * @fidpool: fid handle accounting for session
135 * @fidlist: List of active fid handles 132 * @fidlist: List of active fid handles
136 * @tagpool - transaction id accounting for session 133 * @tagpool - transaction id accounting for session
@@ -159,7 +156,6 @@ struct p9_client {
159 struct p9_trans_module *trans_mod; 156 struct p9_trans_module *trans_mod;
160 enum p9_trans_status status; 157 enum p9_trans_status status;
161 void *trans; 158 void *trans;
162 struct p9_conn *conn;
163 159
164 struct p9_idpool *fidpool; 160 struct p9_idpool *fidpool;
165 struct list_head fidlist; 161 struct list_head fidlist;
@@ -261,7 +257,7 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode,
261int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status); 257int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status);
262int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl); 258int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl);
263struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); 259struct p9_req_t *p9_tag_lookup(struct p9_client *, u16);
264void p9_client_cb(struct p9_client *c, struct p9_req_t *req); 260void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status);
265 261
266int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int); 262int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int);
267int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *); 263int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *);
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 9a36d9297114..d9fa68f26c41 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -40,6 +40,8 @@
40 * @close: member function to discard a connection on this transport 40 * @close: member function to discard a connection on this transport
41 * @request: member function to issue a request to the transport 41 * @request: member function to issue a request to the transport
42 * @cancel: member function to cancel a request (if it hasn't been sent) 42 * @cancel: member function to cancel a request (if it hasn't been sent)
43 * @cancelled: member function to notify that a cancelled request will not
44 * not receive a reply
43 * 45 *
44 * This is the basic API for a transport module which is registered by the 46 * This is the basic API for a transport module which is registered by the
45 * transport module with the 9P core network module and used by the client 47 * transport module with the 9P core network module and used by the client
@@ -58,6 +60,7 @@ struct p9_trans_module {
58 void (*close) (struct p9_client *); 60 void (*close) (struct p9_client *);
59 int (*request) (struct p9_client *, struct p9_req_t *req); 61 int (*request) (struct p9_client *, struct p9_req_t *req);
60 int (*cancel) (struct p9_client *, struct p9_req_t *req); 62 int (*cancel) (struct p9_client *, struct p9_req_t *req);
63 int (*cancelled)(struct p9_client *, struct p9_req_t *req);
61 int (*zc_request)(struct p9_client *, struct p9_req_t *, 64 int (*zc_request)(struct p9_client *, struct p9_req_t *,
62 char *, char *, int , int, int, int); 65 char *, char *, int , int, int, int);
63}; 66};
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 788d8378e587..3ee4c92afd1b 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -89,7 +89,7 @@ struct tc_action_ops {
89 struct module *owner; 89 struct module *owner;
90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); 90 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
92 int (*cleanup)(struct tc_action *, int bind); 92 void (*cleanup)(struct tc_action *, int bind);
93 int (*lookup)(struct tc_action *, u32); 93 int (*lookup)(struct tc_action *, u32);
94 int (*init)(struct net *net, struct nlattr *nla, 94 int (*init)(struct net *net, struct nlattr *nla,
95 struct nlattr *est, struct tc_action *act, int ovr, 95 struct nlattr *est, struct tc_action *act, int ovr,
@@ -98,20 +98,18 @@ struct tc_action_ops {
98}; 98};
99 99
100int tcf_hash_search(struct tc_action *a, u32 index); 100int tcf_hash_search(struct tc_action *a, u32 index);
101void tcf_hash_destroy(struct tcf_common *p, struct tcf_hashinfo *hinfo); 101void tcf_hash_destroy(struct tc_action *a);
102int tcf_hash_release(struct tcf_common *p, int bind, 102int tcf_hash_release(struct tc_action *a, int bind);
103 struct tcf_hashinfo *hinfo);
104u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo); 103u32 tcf_hash_new_index(struct tcf_hashinfo *hinfo);
105struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, 104int tcf_hash_check(u32 index, struct tc_action *a, int bind);
106 int bind); 105int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a,
107struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, 106 int size, int bind);
108 struct tc_action *a, int size, 107void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est);
109 int bind); 108void tcf_hash_insert(struct tc_action *a);
110void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
111 109
112int tcf_register_action(struct tc_action_ops *a); 110int tcf_register_action(struct tc_action_ops *a, unsigned int mask);
113int tcf_unregister_action(struct tc_action_ops *a); 111int tcf_unregister_action(struct tc_action_ops *a);
114void tcf_action_destroy(struct list_head *actions, int bind); 112int tcf_action_destroy(struct list_head *actions, int bind);
115int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions, 113int tcf_action_exec(struct sk_buff *skb, const struct list_head *actions,
116 struct tcf_result *res); 114 struct tcf_result *res);
117int tcf_action_init(struct net *net, struct nlattr *nla, 115int tcf_action_init(struct net *net, struct nlattr *nla,
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 50e39a8822b4..933a9f22a05f 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -314,7 +314,7 @@ static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 314static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
315{ 315{
316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 316#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
317 __u64 *p = (__u64 *)addr; 317 __be64 *p = (__be64 *)addr;
318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL; 318 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(1))) == 0UL;
319#else 319#else
320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 320 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -326,7 +326,7 @@ static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 326static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
327{ 327{
328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 328#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
329 __u64 *p = (__u64 *)addr; 329 __be64 *p = (__be64 *)addr;
330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL; 330 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | (p[1] ^ cpu_to_be64(2))) == 0UL;
331#else 331#else
332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | 332 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
@@ -343,7 +343,7 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)
343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) 343static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr)
344{ 344{
345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 345#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
346 __u64 *p = (__u64 *)addr; 346 __be64 *p = (__be64 *)addr;
347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | 347 return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) |
348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) & 348 ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) &
349 cpu_to_be64(0xffffffffff000000UL))) == 0UL; 349 cpu_to_be64(0xffffffffff000000UL))) == 0UL;
diff --git a/include/net/af_ieee802154.h b/include/net/af_ieee802154.h
index 75e64c7a2960..f79ae2aa76d6 100644
--- a/include/net/af_ieee802154.h
+++ b/include/net/af_ieee802154.h
@@ -36,7 +36,7 @@ enum {
36/* address length, octets */ 36/* address length, octets */
37#define IEEE802154_ADDR_LEN 8 37#define IEEE802154_ADDR_LEN 8
38 38
39struct ieee802154_addr { 39struct ieee802154_addr_sa {
40 int addr_type; 40 int addr_type;
41 u16 pan_id; 41 u16 pan_id;
42 union { 42 union {
@@ -51,7 +51,7 @@ struct ieee802154_addr {
51 51
52struct sockaddr_ieee802154 { 52struct sockaddr_ieee802154 {
53 sa_family_t family; /* AF_IEEE802154 */ 53 sa_family_t family; /* AF_IEEE802154 */
54 struct ieee802154_addr addr; 54 struct ieee802154_addr_sa addr;
55}; 55};
56 56
57/* get/setsockopt */ 57/* get/setsockopt */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index f4f9ee466791..904777c1cd24 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -65,6 +65,7 @@ struct bt_security {
65#define BT_SECURITY_LOW 1 65#define BT_SECURITY_LOW 1
66#define BT_SECURITY_MEDIUM 2 66#define BT_SECURITY_MEDIUM 2
67#define BT_SECURITY_HIGH 3 67#define BT_SECURITY_HIGH 3
68#define BT_SECURITY_FIPS 4
68 69
69#define BT_DEFER_SETUP 7 70#define BT_DEFER_SETUP 7
70 71
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 66c1cd87bfe7..be150cf8cd43 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -117,11 +117,18 @@ enum {
117 HCI_SERVICE_CACHE, 117 HCI_SERVICE_CACHE,
118 HCI_DEBUG_KEYS, 118 HCI_DEBUG_KEYS,
119 HCI_DUT_MODE, 119 HCI_DUT_MODE,
120 HCI_FORCE_SC,
121 HCI_FORCE_STATIC_ADDR,
120 HCI_UNREGISTER, 122 HCI_UNREGISTER,
121 HCI_USER_CHANNEL, 123 HCI_USER_CHANNEL,
122 124
123 HCI_LE_SCAN, 125 HCI_LE_SCAN,
124 HCI_SSP_ENABLED, 126 HCI_SSP_ENABLED,
127 HCI_SC_ENABLED,
128 HCI_SC_ONLY,
129 HCI_PRIVACY,
130 HCI_RPA_EXPIRED,
131 HCI_RPA_RESOLVING,
125 HCI_HS_ENABLED, 132 HCI_HS_ENABLED,
126 HCI_LE_ENABLED, 133 HCI_LE_ENABLED,
127 HCI_ADVERTISING, 134 HCI_ADVERTISING,
@@ -133,6 +140,7 @@ enum {
133 HCI_FAST_CONNECTABLE, 140 HCI_FAST_CONNECTABLE,
134 HCI_BREDR_ENABLED, 141 HCI_BREDR_ENABLED,
135 HCI_6LOWPAN_ENABLED, 142 HCI_6LOWPAN_ENABLED,
143 HCI_LE_SCAN_INTERRUPTED,
136}; 144};
137 145
138/* A mask for the flags that are supposed to remain when a reset happens 146/* A mask for the flags that are supposed to remain when a reset happens
@@ -175,6 +183,8 @@ enum {
175#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 183#define HCI_CMD_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
176#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */ 184#define HCI_ACL_TX_TIMEOUT msecs_to_jiffies(45000) /* 45 seconds */
177#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */ 185#define HCI_AUTO_OFF_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */
186#define HCI_POWER_OFF_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */
187#define HCI_LE_CONN_TIMEOUT msecs_to_jiffies(20000) /* 20 seconds */
178 188
179/* HCI data types */ 189/* HCI data types */
180#define HCI_COMMAND_PKT 0x01 190#define HCI_COMMAND_PKT 0x01
@@ -282,10 +292,14 @@ enum {
282#define LMP_SYNC_TRAIN 0x04 292#define LMP_SYNC_TRAIN 0x04
283#define LMP_SYNC_SCAN 0x08 293#define LMP_SYNC_SCAN 0x08
284 294
295#define LMP_SC 0x01
296#define LMP_PING 0x02
297
285/* Host features */ 298/* Host features */
286#define LMP_HOST_SSP 0x01 299#define LMP_HOST_SSP 0x01
287#define LMP_HOST_LE 0x02 300#define LMP_HOST_LE 0x02
288#define LMP_HOST_LE_BREDR 0x04 301#define LMP_HOST_LE_BREDR 0x04
302#define LMP_HOST_SC 0x08
289 303
290/* Connection modes */ 304/* Connection modes */
291#define HCI_CM_ACTIVE 0x0000 305#define HCI_CM_ACTIVE 0x0000
@@ -307,6 +321,7 @@ enum {
307#define HCI_LM_TRUSTED 0x0008 321#define HCI_LM_TRUSTED 0x0008
308#define HCI_LM_RELIABLE 0x0010 322#define HCI_LM_RELIABLE 0x0010
309#define HCI_LM_SECURE 0x0020 323#define HCI_LM_SECURE 0x0020
324#define HCI_LM_FIPS 0x0040
310 325
311/* Authentication types */ 326/* Authentication types */
312#define HCI_AT_NO_BONDING 0x00 327#define HCI_AT_NO_BONDING 0x00
@@ -327,17 +342,24 @@ enum {
327#define HCI_LK_LOCAL_UNIT 0x01 342#define HCI_LK_LOCAL_UNIT 0x01
328#define HCI_LK_REMOTE_UNIT 0x02 343#define HCI_LK_REMOTE_UNIT 0x02
329#define HCI_LK_DEBUG_COMBINATION 0x03 344#define HCI_LK_DEBUG_COMBINATION 0x03
330#define HCI_LK_UNAUTH_COMBINATION 0x04 345#define HCI_LK_UNAUTH_COMBINATION_P192 0x04
331#define HCI_LK_AUTH_COMBINATION 0x05 346#define HCI_LK_AUTH_COMBINATION_P192 0x05
332#define HCI_LK_CHANGED_COMBINATION 0x06 347#define HCI_LK_CHANGED_COMBINATION 0x06
348#define HCI_LK_UNAUTH_COMBINATION_P256 0x07
349#define HCI_LK_AUTH_COMBINATION_P256 0x08
333/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */ 350/* The spec doesn't define types for SMP keys, the _MASTER suffix is implied */
334#define HCI_SMP_STK 0x80 351#define HCI_SMP_STK 0x80
335#define HCI_SMP_STK_SLAVE 0x81 352#define HCI_SMP_STK_SLAVE 0x81
336#define HCI_SMP_LTK 0x82 353#define HCI_SMP_LTK 0x82
337#define HCI_SMP_LTK_SLAVE 0x83 354#define HCI_SMP_LTK_SLAVE 0x83
338 355
356/* Long Term Key types */
357#define HCI_LTK_UNAUTH 0x00
358#define HCI_LTK_AUTH 0x01
359
339/* ---- HCI Error Codes ---- */ 360/* ---- HCI Error Codes ---- */
340#define HCI_ERROR_AUTH_FAILURE 0x05 361#define HCI_ERROR_AUTH_FAILURE 0x05
362#define HCI_ERROR_MEMORY_EXCEEDED 0x07
341#define HCI_ERROR_CONNECTION_TIMEOUT 0x08 363#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
342#define HCI_ERROR_REJ_BAD_ADDR 0x0f 364#define HCI_ERROR_REJ_BAD_ADDR 0x0f
343#define HCI_ERROR_REMOTE_USER_TERM 0x13 365#define HCI_ERROR_REMOTE_USER_TERM 0x13
@@ -660,6 +682,15 @@ struct hci_rp_set_csb {
660 682
661#define HCI_OP_START_SYNC_TRAIN 0x0443 683#define HCI_OP_START_SYNC_TRAIN 0x0443
662 684
685#define HCI_OP_REMOTE_OOB_EXT_DATA_REPLY 0x0445
686struct hci_cp_remote_oob_ext_data_reply {
687 bdaddr_t bdaddr;
688 __u8 hash192[16];
689 __u8 randomizer192[16];
690 __u8 hash256[16];
691 __u8 randomizer256[16];
692} __packed;
693
663#define HCI_OP_SNIFF_MODE 0x0803 694#define HCI_OP_SNIFF_MODE 0x0803
664struct hci_cp_sniff_mode { 695struct hci_cp_sniff_mode {
665 __le16 handle; 696 __le16 handle;
@@ -933,6 +964,26 @@ struct hci_rp_write_sync_train_params {
933 __le16 sync_train_int; 964 __le16 sync_train_int;
934} __packed; 965} __packed;
935 966
967#define HCI_OP_READ_SC_SUPPORT 0x0c79
968struct hci_rp_read_sc_support {
969 __u8 status;
970 __u8 support;
971} __packed;
972
973#define HCI_OP_WRITE_SC_SUPPORT 0x0c7a
974struct hci_cp_write_sc_support {
975 __u8 support;
976} __packed;
977
978#define HCI_OP_READ_LOCAL_OOB_EXT_DATA 0x0c7d
979struct hci_rp_read_local_oob_ext_data {
980 __u8 status;
981 __u8 hash192[16];
982 __u8 randomizer192[16];
983 __u8 hash256[16];
984 __u8 randomizer256[16];
985} __packed;
986
936#define HCI_OP_READ_LOCAL_VERSION 0x1001 987#define HCI_OP_READ_LOCAL_VERSION 0x1001
937struct hci_rp_read_local_version { 988struct hci_rp_read_local_version {
938 __u8 status; 989 __u8 status;
@@ -1133,6 +1184,9 @@ struct hci_cp_le_set_scan_enable {
1133 __u8 filter_dup; 1184 __u8 filter_dup;
1134} __packed; 1185} __packed;
1135 1186
1187#define HCI_LE_USE_PEER_ADDR 0x00
1188#define HCI_LE_USE_WHITELIST 0x01
1189
1136#define HCI_OP_LE_CREATE_CONN 0x200d 1190#define HCI_OP_LE_CREATE_CONN 0x200d
1137struct hci_cp_le_create_conn { 1191struct hci_cp_le_create_conn {
1138 __le16 scan_interval; 1192 __le16 scan_interval;
@@ -1157,6 +1211,20 @@ struct hci_rp_le_read_white_list_size {
1157 __u8 size; 1211 __u8 size;
1158} __packed; 1212} __packed;
1159 1213
1214#define HCI_OP_LE_CLEAR_WHITE_LIST 0x2010
1215
1216#define HCI_OP_LE_ADD_TO_WHITE_LIST 0x2011
1217struct hci_cp_le_add_to_white_list {
1218 __u8 bdaddr_type;
1219 bdaddr_t bdaddr;
1220} __packed;
1221
1222#define HCI_OP_LE_DEL_FROM_WHITE_LIST 0x2012
1223struct hci_cp_le_del_from_white_list {
1224 __u8 bdaddr_type;
1225 bdaddr_t bdaddr;
1226} __packed;
1227
1160#define HCI_OP_LE_CONN_UPDATE 0x2013 1228#define HCI_OP_LE_CONN_UPDATE 0x2013
1161struct hci_cp_le_conn_update { 1229struct hci_cp_le_conn_update {
1162 __le16 handle; 1230 __le16 handle;
@@ -1171,7 +1239,7 @@ struct hci_cp_le_conn_update {
1171#define HCI_OP_LE_START_ENC 0x2019 1239#define HCI_OP_LE_START_ENC 0x2019
1172struct hci_cp_le_start_enc { 1240struct hci_cp_le_start_enc {
1173 __le16 handle; 1241 __le16 handle;
1174 __u8 rand[8]; 1242 __le64 rand;
1175 __le16 ediv; 1243 __le16 ediv;
1176 __u8 ltk[16]; 1244 __u8 ltk[16];
1177} __packed; 1245} __packed;
@@ -1583,7 +1651,7 @@ struct hci_ev_le_conn_complete {
1583#define HCI_EV_LE_LTK_REQ 0x05 1651#define HCI_EV_LE_LTK_REQ 0x05
1584struct hci_ev_le_ltk_req { 1652struct hci_ev_le_ltk_req {
1585 __le16 handle; 1653 __le16 handle;
1586 __u8 random[8]; 1654 __le64 rand;
1587 __le16 ediv; 1655 __le16 ediv;
1588} __packed; 1656} __packed;
1589 1657
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index f2f0cf5865c4..5f8bc05694ac 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -91,6 +91,13 @@ struct bt_uuid {
91 u8 svc_hint; 91 u8 svc_hint;
92}; 92};
93 93
94struct smp_csrk {
95 bdaddr_t bdaddr;
96 u8 bdaddr_type;
97 u8 master;
98 u8 val[16];
99};
100
94struct smp_ltk { 101struct smp_ltk {
95 struct list_head list; 102 struct list_head list;
96 bdaddr_t bdaddr; 103 bdaddr_t bdaddr;
@@ -99,9 +106,17 @@ struct smp_ltk {
99 u8 type; 106 u8 type;
100 u8 enc_size; 107 u8 enc_size;
101 __le16 ediv; 108 __le16 ediv;
102 u8 rand[8]; 109 __le64 rand;
103 u8 val[16]; 110 u8 val[16];
104} __packed; 111};
112
113struct smp_irk {
114 struct list_head list;
115 bdaddr_t rpa;
116 bdaddr_t bdaddr;
117 u8 addr_type;
118 u8 val[16];
119};
105 120
106struct link_key { 121struct link_key {
107 struct list_head list; 122 struct list_head list;
@@ -114,12 +129,17 @@ struct link_key {
114struct oob_data { 129struct oob_data {
115 struct list_head list; 130 struct list_head list;
116 bdaddr_t bdaddr; 131 bdaddr_t bdaddr;
117 u8 hash[16]; 132 u8 hash192[16];
118 u8 randomizer[16]; 133 u8 randomizer192[16];
134 u8 hash256[16];
135 u8 randomizer256[16];
119}; 136};
120 137
121#define HCI_MAX_SHORT_NAME_LENGTH 10 138#define HCI_MAX_SHORT_NAME_LENGTH 10
122 139
140/* Default LE RPA expiry time, 15 minutes */
141#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
142
123struct amp_assoc { 143struct amp_assoc {
124 __u16 len; 144 __u16 len;
125 __u16 offset; 145 __u16 offset;
@@ -141,8 +161,9 @@ struct hci_dev {
141 __u8 bus; 161 __u8 bus;
142 __u8 dev_type; 162 __u8 dev_type;
143 bdaddr_t bdaddr; 163 bdaddr_t bdaddr;
164 bdaddr_t random_addr;
144 bdaddr_t static_addr; 165 bdaddr_t static_addr;
145 __u8 own_addr_type; 166 __u8 adv_addr_type;
146 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 167 __u8 dev_name[HCI_MAX_NAME_LENGTH];
147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 168 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
148 __u8 eir[HCI_MAX_EIR_LENGTH]; 169 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -167,6 +188,8 @@ struct hci_dev {
167 __u16 page_scan_interval; 188 __u16 page_scan_interval;
168 __u16 page_scan_window; 189 __u16 page_scan_window;
169 __u8 page_scan_type; 190 __u8 page_scan_type;
191 __u8 le_adv_channel_map;
192 __u8 le_scan_type;
170 __u16 le_scan_interval; 193 __u16 le_scan_interval;
171 __u16 le_scan_window; 194 __u16 le_scan_window;
172 __u16 le_conn_min_interval; 195 __u16 le_conn_min_interval;
@@ -257,19 +280,21 @@ struct hci_dev {
257 __u32 req_status; 280 __u32 req_status;
258 __u32 req_result; 281 __u32 req_result;
259 282
260 struct list_head mgmt_pending; 283 struct crypto_blkcipher *tfm_aes;
261 284
262 struct discovery_state discovery; 285 struct discovery_state discovery;
263 struct hci_conn_hash conn_hash; 286 struct hci_conn_hash conn_hash;
264 struct list_head blacklist;
265 287
288 struct list_head mgmt_pending;
289 struct list_head blacklist;
266 struct list_head uuids; 290 struct list_head uuids;
267
268 struct list_head link_keys; 291 struct list_head link_keys;
269
270 struct list_head long_term_keys; 292 struct list_head long_term_keys;
271 293 struct list_head identity_resolving_keys;
272 struct list_head remote_oob_data; 294 struct list_head remote_oob_data;
295 struct list_head le_white_list;
296 struct list_head le_conn_params;
297 struct list_head pend_le_conns;
273 298
274 struct hci_dev_stats stat; 299 struct hci_dev_stats stat;
275 300
@@ -291,6 +316,11 @@ struct hci_dev {
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; 316 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len; 317 __u8 scan_rsp_data_len;
293 318
319 __u8 irk[16];
320 __u32 rpa_timeout;
321 struct delayed_work rpa_expired;
322 bdaddr_t rpa;
323
294 int (*open)(struct hci_dev *hdev); 324 int (*open)(struct hci_dev *hdev);
295 int (*close)(struct hci_dev *hdev); 325 int (*close)(struct hci_dev *hdev);
296 int (*flush)(struct hci_dev *hdev); 326 int (*flush)(struct hci_dev *hdev);
@@ -310,6 +340,10 @@ struct hci_conn {
310 __u8 dst_type; 340 __u8 dst_type;
311 bdaddr_t src; 341 bdaddr_t src;
312 __u8 src_type; 342 __u8 src_type;
343 bdaddr_t init_addr;
344 __u8 init_addr_type;
345 bdaddr_t resp_addr;
346 __u8 resp_addr_type;
313 __u16 handle; 347 __u16 handle;
314 __u16 state; 348 __u16 state;
315 __u8 mode; 349 __u8 mode;
@@ -332,6 +366,8 @@ struct hci_conn {
332 __u8 passkey_entered; 366 __u8 passkey_entered;
333 __u16 disc_timeout; 367 __u16 disc_timeout;
334 __u16 setting; 368 __u16 setting;
369 __u16 le_conn_min_interval;
370 __u16 le_conn_max_interval;
335 unsigned long flags; 371 unsigned long flags;
336 372
337 __u8 remote_cap; 373 __u8 remote_cap;
@@ -347,6 +383,7 @@ struct hci_conn {
347 struct delayed_work disc_work; 383 struct delayed_work disc_work;
348 struct delayed_work auto_accept_work; 384 struct delayed_work auto_accept_work;
349 struct delayed_work idle_work; 385 struct delayed_work idle_work;
386 struct delayed_work le_conn_timeout;
350 387
351 struct device dev; 388 struct device dev;
352 389
@@ -372,6 +409,22 @@ struct hci_chan {
372 __u8 state; 409 __u8 state;
373}; 410};
374 411
412struct hci_conn_params {
413 struct list_head list;
414
415 bdaddr_t addr;
416 u8 addr_type;
417
418 u16 conn_min_interval;
419 u16 conn_max_interval;
420
421 enum {
422 HCI_AUTO_CONN_DISABLED,
423 HCI_AUTO_CONN_ALWAYS,
424 HCI_AUTO_CONN_LINK_LOSS,
425 } auto_connect;
426};
427
375extern struct list_head hci_dev_list; 428extern struct list_head hci_dev_list;
376extern struct list_head hci_cb_list; 429extern struct list_head hci_cb_list;
377extern rwlock_t hci_dev_list_lock; 430extern rwlock_t hci_dev_list_lock;
@@ -446,6 +499,8 @@ enum {
446 HCI_CONN_LE_SMP_PEND, 499 HCI_CONN_LE_SMP_PEND,
447 HCI_CONN_MGMT_CONNECTED, 500 HCI_CONN_MGMT_CONNECTED,
448 HCI_CONN_SSP_ENABLED, 501 HCI_CONN_SSP_ENABLED,
502 HCI_CONN_SC_ENABLED,
503 HCI_CONN_AES_CCM,
449 HCI_CONN_POWER_SAVE, 504 HCI_CONN_POWER_SAVE,
450 HCI_CONN_REMOTE_OOB, 505 HCI_CONN_REMOTE_OOB,
451 HCI_CONN_6LOWPAN, 506 HCI_CONN_6LOWPAN,
@@ -458,6 +513,13 @@ static inline bool hci_conn_ssp_enabled(struct hci_conn *conn)
458 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags); 513 test_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
459} 514}
460 515
516static inline bool hci_conn_sc_enabled(struct hci_conn *conn)
517{
518 struct hci_dev *hdev = conn->hdev;
519 return test_bit(HCI_SC_ENABLED, &hdev->dev_flags) &&
520 test_bit(HCI_CONN_SC_ENABLED, &conn->flags);
521}
522
461static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c) 523static inline void hci_conn_hash_add(struct hci_dev *hdev, struct hci_conn *c)
462{ 524{
463 struct hci_conn_hash *h = &hdev->conn_hash; 525 struct hci_conn_hash *h = &hdev->conn_hash;
@@ -521,6 +583,13 @@ static inline unsigned int hci_conn_num(struct hci_dev *hdev, __u8 type)
521 } 583 }
522} 584}
523 585
586static inline unsigned int hci_conn_count(struct hci_dev *hdev)
587{
588 struct hci_conn_hash *c = &hdev->conn_hash;
589
590 return c->acl_num + c->amp_num + c->sco_num + c->le_num;
591}
592
524static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev, 593static inline struct hci_conn *hci_conn_hash_lookup_handle(struct hci_dev *hdev,
525 __u16 handle) 594 __u16 handle)
526{ 595{
@@ -594,8 +663,10 @@ void hci_chan_del(struct hci_chan *chan);
594void hci_chan_list_flush(struct hci_conn *conn); 663void hci_chan_list_flush(struct hci_conn *conn);
595struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); 664struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
596 665
597struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, 666struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
598 __u8 dst_type, __u8 sec_level, __u8 auth_type); 667 u8 dst_type, u8 sec_level, u8 auth_type);
668struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
669 u8 sec_level, u8 auth_type);
599struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst, 670struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
600 __u16 setting); 671 __u16 setting);
601int hci_conn_check_link_mode(struct hci_conn *conn); 672int hci_conn_check_link_mode(struct hci_conn *conn);
@@ -606,6 +677,8 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
606 677
607void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); 678void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
608 679
680void hci_le_conn_failed(struct hci_conn *conn, u8 status);
681
609/* 682/*
610 * hci_conn_get() and hci_conn_put() are used to control the life-time of an 683 * hci_conn_get() and hci_conn_put() are used to control the life-time of an
611 * "hci_conn" object. They do not guarantee that the hci_conn object is running, 684 * "hci_conn" object. They do not guarantee that the hci_conn object is running,
@@ -737,31 +810,64 @@ int hci_inquiry(void __user *arg);
737 810
738struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 811struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
739 bdaddr_t *bdaddr, u8 type); 812 bdaddr_t *bdaddr, u8 type);
740int hci_blacklist_clear(struct hci_dev *hdev);
741int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 813int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 814int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
743 815
744int hci_uuids_clear(struct hci_dev *hdev); 816struct bdaddr_list *hci_white_list_lookup(struct hci_dev *hdev,
817 bdaddr_t *bdaddr, u8 type);
818void hci_white_list_clear(struct hci_dev *hdev);
819int hci_white_list_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
820int hci_white_list_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
821
822struct hci_conn_params *hci_conn_params_lookup(struct hci_dev *hdev,
823 bdaddr_t *addr, u8 addr_type);
824int hci_conn_params_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
825 u8 auto_connect, u16 conn_min_interval,
826 u16 conn_max_interval);
827void hci_conn_params_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
828void hci_conn_params_clear(struct hci_dev *hdev);
829
830struct bdaddr_list *hci_pend_le_conn_lookup(struct hci_dev *hdev,
831 bdaddr_t *addr, u8 addr_type);
832void hci_pend_le_conn_add(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
833void hci_pend_le_conn_del(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type);
834void hci_pend_le_conns_clear(struct hci_dev *hdev);
835
836void hci_update_background_scan(struct hci_dev *hdev);
745 837
746int hci_link_keys_clear(struct hci_dev *hdev); 838void hci_uuids_clear(struct hci_dev *hdev);
839
840void hci_link_keys_clear(struct hci_dev *hdev);
747struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 841struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
748int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, 842int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key,
749 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); 843 bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len);
750struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, u8 rand[8]); 844struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, __le16 ediv, __le64 rand,
751int hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type, u8 type, 845 bool master);
752 int new_key, u8 authenticated, u8 tk[16], u8 enc_size, 846struct smp_ltk *hci_add_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
753 __le16 ediv, u8 rand[8]); 847 u8 addr_type, u8 type, u8 authenticated,
848 u8 tk[16], u8 enc_size, __le16 ediv, __le64 rand);
754struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr, 849struct smp_ltk *hci_find_ltk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
755 u8 addr_type); 850 u8 addr_type, bool master);
756int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr); 851int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type);
757int hci_smp_ltks_clear(struct hci_dev *hdev); 852void hci_smp_ltks_clear(struct hci_dev *hdev);
758int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); 853int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr);
759 854
760int hci_remote_oob_data_clear(struct hci_dev *hdev); 855struct smp_irk *hci_find_irk_by_rpa(struct hci_dev *hdev, bdaddr_t *rpa);
856struct smp_irk *hci_find_irk_by_addr(struct hci_dev *hdev, bdaddr_t *bdaddr,
857 u8 addr_type);
858struct smp_irk *hci_add_irk(struct hci_dev *hdev, bdaddr_t *bdaddr,
859 u8 addr_type, u8 val[16], bdaddr_t *rpa);
860void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type);
861void hci_smp_irks_clear(struct hci_dev *hdev);
862
863void hci_remote_oob_data_clear(struct hci_dev *hdev);
761struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 864struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
762 bdaddr_t *bdaddr); 865 bdaddr_t *bdaddr);
763int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, 866int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
764 u8 *randomizer); 867 u8 *hash, u8 *randomizer);
868int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
869 u8 *hash192, u8 *randomizer192,
870 u8 *hash256, u8 *randomizer256);
765int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 871int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
766 872
767void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 873void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
@@ -803,9 +909,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
803#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE) 909#define lmp_csb_slave_capable(dev) ((dev)->features[2][0] & LMP_CSB_SLAVE)
804#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN) 910#define lmp_sync_train_capable(dev) ((dev)->features[2][0] & LMP_SYNC_TRAIN)
805#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN) 911#define lmp_sync_scan_capable(dev) ((dev)->features[2][0] & LMP_SYNC_SCAN)
912#define lmp_sc_capable(dev) ((dev)->features[2][1] & LMP_SC)
913#define lmp_ping_capable(dev) ((dev)->features[2][1] & LMP_PING)
806 914
807/* ----- Host capabilities ----- */ 915/* ----- Host capabilities ----- */
808#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP) 916#define lmp_host_ssp_capable(dev) ((dev)->features[1][0] & LMP_HOST_SSP)
917#define lmp_host_sc_capable(dev) ((dev)->features[1][0] & LMP_HOST_SC)
809#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 918#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
810#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 919#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
811 920
@@ -1019,6 +1128,26 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1019 return false; 1128 return false;
1020} 1129}
1021 1130
1131static inline bool hci_bdaddr_is_rpa(bdaddr_t *bdaddr, u8 addr_type)
1132{
1133 if (addr_type != 0x01)
1134 return false;
1135
1136 if ((bdaddr->b[5] & 0xc0) == 0x40)
1137 return true;
1138
1139 return false;
1140}
1141
1142static inline struct smp_irk *hci_get_irk(struct hci_dev *hdev,
1143 bdaddr_t *bdaddr, u8 addr_type)
1144{
1145 if (!hci_bdaddr_is_rpa(bdaddr, addr_type))
1146 return NULL;
1147
1148 return hci_find_irk_by_rpa(hdev, bdaddr);
1149}
1150
1022int hci_register_cb(struct hci_cb *hcb); 1151int hci_register_cb(struct hci_cb *hcb);
1023int hci_unregister_cb(struct hci_cb *hcb); 1152int hci_unregister_cb(struct hci_cb *hcb);
1024 1153
@@ -1040,6 +1169,9 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen,
1040 const void *param, u8 event); 1169 const void *param, u8 event);
1041void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); 1170void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status);
1042 1171
1172void hci_req_add_le_scan_disable(struct hci_request *req);
1173void hci_req_add_le_passive_scan(struct hci_request *req);
1174
1043struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, 1175struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen,
1044 const void *param, u32 timeout); 1176 const void *param, u32 timeout);
1045struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, 1177struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen,
@@ -1085,6 +1217,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered);
1085void mgmt_discoverable_timeout(struct hci_dev *hdev); 1217void mgmt_discoverable_timeout(struct hci_dev *hdev);
1086void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1218void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1087void mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1219void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1220void mgmt_advertising(struct hci_dev *hdev, u8 advertising);
1088void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1221void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1089void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1222void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1090 bool persistent); 1223 bool persistent);
@@ -1092,7 +1225,8 @@ void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1092 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1225 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1093 u8 *dev_class); 1226 u8 *dev_class);
1094void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1227void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1095 u8 link_type, u8 addr_type, u8 reason); 1228 u8 link_type, u8 addr_type, u8 reason,
1229 bool mgmt_connected);
1096void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1230void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 link_type, u8 addr_type, u8 status); 1231 u8 link_type, u8 addr_type, u8 status);
1098void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1232void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
@@ -1103,7 +1237,7 @@ void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1103void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1237void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1104 u8 status); 1238 u8 status);
1105int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1239int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1106 u8 link_type, u8 addr_type, __le32 value, 1240 u8 link_type, u8 addr_type, u32 value,
1107 u8 confirm_hint); 1241 u8 confirm_hint);
1108int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1242int mgmt_user_confirm_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1109 u8 link_type, u8 addr_type, u8 status); 1243 u8 link_type, u8 addr_type, u8 status);
@@ -1122,11 +1256,13 @@ void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1122 u8 addr_type, u8 status); 1256 u8 addr_type, u8 status);
1123void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1257void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1124void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1258void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1259void mgmt_sc_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1125void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1260void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1126 u8 status); 1261 u8 status);
1127void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1262void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1128void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1263void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1129 u8 *randomizer, u8 status); 1264 u8 *randomizer192, u8 *hash256,
1265 u8 *randomizer256, u8 status);
1130void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1266void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1131 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1267 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1132 u8 ssp, u8 *eir, u16 eir_len); 1268 u8 ssp, u8 *eir, u16 eir_len);
@@ -1135,8 +1271,12 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1135void mgmt_discovering(struct hci_dev *hdev, u8 discovering); 1271void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1136int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1272int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1137int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1273int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1138void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1274void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, bool persistent);
1275void mgmt_new_irk(struct hci_dev *hdev, struct smp_irk *irk);
1276void mgmt_new_csrk(struct hci_dev *hdev, struct smp_csrk *csrk,
1277 bool persistent);
1139void mgmt_reenable_advertising(struct hci_dev *hdev); 1278void mgmt_reenable_advertising(struct hci_dev *hdev);
1279void mgmt_smp_complete(struct hci_conn *conn, bool complete);
1140 1280
1141/* HCI info for socket */ 1281/* HCI info for socket */
1142#define hci_pi(sk) ((struct hci_pinfo *) sk) 1282#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1168,9 +1308,14 @@ struct hci_sec_filter {
1168 1308
1169void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1309void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1170 u16 latency, u16 to_multiplier); 1310 u16 latency, u16 to_multiplier);
1171void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1311void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __le64 rand,
1172 __u8 ltk[16]); 1312 __u8 ltk[16]);
1173 1313
1314int hci_update_random_address(struct hci_request *req, bool require_privacy,
1315 u8 *own_addr_type);
1316void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
1317 u8 *bdaddr_type);
1318
1174#define SCO_AIRMODE_MASK 0x0003 1319#define SCO_AIRMODE_MASK 0x0003
1175#define SCO_AIRMODE_CVSD 0x0000 1320#define SCO_AIRMODE_CVSD 0x0000
1176#define SCO_AIRMODE_TRANSP 0x0003 1321#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index dbc4a89984ca..4abdcb220e3a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -91,6 +91,7 @@ struct l2cap_conninfo {
91#define L2CAP_LM_TRUSTED 0x0008 91#define L2CAP_LM_TRUSTED 0x0008
92#define L2CAP_LM_RELIABLE 0x0010 92#define L2CAP_LM_RELIABLE 0x0010
93#define L2CAP_LM_SECURE 0x0020 93#define L2CAP_LM_SECURE 0x0020
94#define L2CAP_LM_FIPS 0x0040
94 95
95/* L2CAP command codes */ 96/* L2CAP command codes */
96#define L2CAP_COMMAND_REJ 0x01 97#define L2CAP_COMMAND_REJ 0x01
@@ -623,6 +624,9 @@ struct l2cap_conn {
623 __u32 rx_len; 624 __u32 rx_len;
624 __u8 tx_ident; 625 __u8 tx_ident;
625 626
627 struct sk_buff_head pending_rx;
628 struct work_struct pending_rx_work;
629
626 __u8 disc_reason; 630 __u8 disc_reason;
627 631
628 struct delayed_work security_timer; 632 struct delayed_work security_timer;
@@ -647,7 +651,7 @@ struct l2cap_user {
647#define L2CAP_CHAN_RAW 1 651#define L2CAP_CHAN_RAW 1
648#define L2CAP_CHAN_CONN_LESS 2 652#define L2CAP_CHAN_CONN_LESS 2
649#define L2CAP_CHAN_CONN_ORIENTED 3 653#define L2CAP_CHAN_CONN_ORIENTED 3
650#define L2CAP_CHAN_CONN_FIX_A2MP 4 654#define L2CAP_CHAN_FIXED 4
651 655
652/* ----- L2CAP socket info ----- */ 656/* ----- L2CAP socket info ----- */
653#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) 657#define l2cap_pi(sk) ((struct l2cap_pinfo *) sk)
@@ -853,7 +857,6 @@ static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
853} 857}
854 858
855extern bool disable_ertm; 859extern bool disable_ertm;
856extern bool enable_lecoc;
857 860
858int l2cap_init_sockets(void); 861int l2cap_init_sockets(void);
859void l2cap_cleanup_sockets(void); 862void l2cap_cleanup_sockets(void);
@@ -878,6 +881,7 @@ int l2cap_ertm_init(struct l2cap_chan *chan);
878void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 881void l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
879void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan); 882void __l2cap_chan_add(struct l2cap_conn *conn, struct l2cap_chan *chan);
880void l2cap_chan_del(struct l2cap_chan *chan, int err); 883void l2cap_chan_del(struct l2cap_chan *chan, int err);
884void l2cap_conn_update_id_addr(struct hci_conn *hcon);
881void l2cap_send_conn_req(struct l2cap_chan *chan); 885void l2cap_send_conn_req(struct l2cap_chan *chan);
882void l2cap_move_start(struct l2cap_chan *chan); 886void l2cap_move_start(struct l2cap_chan *chan);
883void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, 887void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 518c5c84e39a..d4b571c2f9fd 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -94,6 +94,9 @@ struct mgmt_rp_read_index_list {
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400 96#define MGMT_SETTING_ADVERTISING 0x00000400
97#define MGMT_SETTING_SECURE_CONN 0x00000800
98#define MGMT_SETTING_DEBUG_KEYS 0x00001000
99#define MGMT_SETTING_PRIVACY 0x00002000
97 100
98#define MGMT_OP_READ_INFO 0x0004 101#define MGMT_OP_READ_INFO 0x0004
99#define MGMT_READ_INFO_SIZE 0 102#define MGMT_READ_INFO_SIZE 0
@@ -180,11 +183,11 @@ struct mgmt_cp_load_link_keys {
180 183
181struct mgmt_ltk_info { 184struct mgmt_ltk_info {
182 struct mgmt_addr_info addr; 185 struct mgmt_addr_info addr;
183 __u8 authenticated; 186 __u8 type;
184 __u8 master; 187 __u8 master;
185 __u8 enc_size; 188 __u8 enc_size;
186 __le16 ediv; 189 __le16 ediv;
187 __u8 rand[8]; 190 __le64 rand;
188 __u8 val[16]; 191 __u8 val[16];
189} __packed; 192} __packed;
190 193
@@ -294,6 +297,12 @@ struct mgmt_rp_read_local_oob_data {
294 __u8 hash[16]; 297 __u8 hash[16];
295 __u8 randomizer[16]; 298 __u8 randomizer[16];
296} __packed; 299} __packed;
300struct mgmt_rp_read_local_oob_ext_data {
301 __u8 hash192[16];
302 __u8 randomizer192[16];
303 __u8 hash256[16];
304 __u8 randomizer256[16];
305} __packed;
297 306
298#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 307#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
299struct mgmt_cp_add_remote_oob_data { 308struct mgmt_cp_add_remote_oob_data {
@@ -302,6 +311,14 @@ struct mgmt_cp_add_remote_oob_data {
302 __u8 randomizer[16]; 311 __u8 randomizer[16];
303} __packed; 312} __packed;
304#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) 313#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
314struct mgmt_cp_add_remote_oob_ext_data {
315 struct mgmt_addr_info addr;
316 __u8 hash192[16];
317 __u8 randomizer192[16];
318 __u8 hash256[16];
319 __u8 randomizer256[16];
320} __packed;
321#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
305 322
306#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022 323#define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x0022
307struct mgmt_cp_remove_remote_oob_data { 324struct mgmt_cp_remove_remote_oob_data {
@@ -369,6 +386,29 @@ struct mgmt_cp_set_scan_params {
369} __packed; 386} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4 387#define MGMT_SET_SCAN_PARAMS_SIZE 4
371 388
389#define MGMT_OP_SET_SECURE_CONN 0x002D
390
391#define MGMT_OP_SET_DEBUG_KEYS 0x002E
392
393#define MGMT_OP_SET_PRIVACY 0x002F
394struct mgmt_cp_set_privacy {
395 __u8 privacy;
396 __u8 irk[16];
397} __packed;
398#define MGMT_SET_PRIVACY_SIZE 17
399
400struct mgmt_irk_info {
401 struct mgmt_addr_info addr;
402 __u8 val[16];
403} __packed;
404
405#define MGMT_OP_LOAD_IRKS 0x0030
406struct mgmt_cp_load_irks {
407 __le16 irk_count;
408 struct mgmt_irk_info irks[0];
409} __packed;
410#define MGMT_LOAD_IRKS_SIZE 2
411
372#define MGMT_EV_CMD_COMPLETE 0x0001 412#define MGMT_EV_CMD_COMPLETE 0x0001
373struct mgmt_ev_cmd_complete { 413struct mgmt_ev_cmd_complete {
374 __le16 opcode; 414 __le16 opcode;
@@ -504,3 +544,22 @@ struct mgmt_ev_passkey_notify {
504 __le32 passkey; 544 __le32 passkey;
505 __u8 entered; 545 __u8 entered;
506} __packed; 546} __packed;
547
548#define MGMT_EV_NEW_IRK 0x0018
549struct mgmt_ev_new_irk {
550 __u8 store_hint;
551 bdaddr_t rpa;
552 struct mgmt_irk_info irk;
553} __packed;
554
555struct mgmt_csrk_info {
556 struct mgmt_addr_info addr;
557 __u8 master;
558 __u8 val[16];
559} __packed;
560
561#define MGMT_EV_NEW_CSRK 0x0019
562struct mgmt_ev_new_csrk {
563 __u8 store_hint;
564 struct mgmt_csrk_info key;
565} __packed;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 486213a1aed8..2611cc389d7d 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -238,9 +238,11 @@ int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
238 u8 channel); 238 u8 channel);
239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason); 239int rfcomm_dlc_close(struct rfcomm_dlc *d, int reason);
240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb); 240int rfcomm_dlc_send(struct rfcomm_dlc *d, struct sk_buff *skb);
241void rfcomm_dlc_send_noerror(struct rfcomm_dlc *d, struct sk_buff *skb);
241int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig); 242int rfcomm_dlc_set_modem_status(struct rfcomm_dlc *d, u8 v24_sig);
242int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig); 243int rfcomm_dlc_get_modem_status(struct rfcomm_dlc *d, u8 *v24_sig);
243void rfcomm_dlc_accept(struct rfcomm_dlc *d); 244void rfcomm_dlc_accept(struct rfcomm_dlc *d);
245struct rfcomm_dlc *rfcomm_dlc_exists(bdaddr_t *src, bdaddr_t *dst, u8 channel);
244 246
245#define rfcomm_dlc_lock(d) spin_lock(&d->lock) 247#define rfcomm_dlc_lock(d) spin_lock(&d->lock)
246#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock) 248#define rfcomm_dlc_unlock(d) spin_unlock(&d->lock)
@@ -295,6 +297,7 @@ struct rfcomm_conninfo {
295#define RFCOMM_LM_TRUSTED 0x0008 297#define RFCOMM_LM_TRUSTED 0x0008
296#define RFCOMM_LM_RELIABLE 0x0010 298#define RFCOMM_LM_RELIABLE 0x0010
297#define RFCOMM_LM_SECURE 0x0020 299#define RFCOMM_LM_SECURE 0x0020
300#define RFCOMM_LM_FIPS 0x0040
298 301
299#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk) 302#define rfcomm_pi(sk) ((struct rfcomm_pinfo *) sk)
300 303
@@ -323,11 +326,16 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel,
323#define RFCOMMGETDEVINFO _IOR('R', 211, int) 326#define RFCOMMGETDEVINFO _IOR('R', 211, int)
324#define RFCOMMSTEALDLC _IOW('R', 220, int) 327#define RFCOMMSTEALDLC _IOW('R', 220, int)
325 328
329/* rfcomm_dev.flags bit definitions */
326#define RFCOMM_REUSE_DLC 0 330#define RFCOMM_REUSE_DLC 0
327#define RFCOMM_RELEASE_ONHUP 1 331#define RFCOMM_RELEASE_ONHUP 1
328#define RFCOMM_HANGUP_NOW 2 332#define RFCOMM_HANGUP_NOW 2
329#define RFCOMM_TTY_ATTACHED 3 333#define RFCOMM_TTY_ATTACHED 3
330#define RFCOMM_TTY_RELEASED 4 334#define RFCOMM_DEFUNCT_BIT4 4 /* don't reuse this bit - userspace visible */
335
336/* rfcomm_dev.status bit definitions */
337#define RFCOMM_DEV_RELEASED 0
338#define RFCOMM_TTY_OWNED 1
331 339
332struct rfcomm_dev_req { 340struct rfcomm_dev_req {
333 s16 dev_id; 341 s16 dev_id;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b1f84b05c67e..f3539a15c411 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -151,6 +151,7 @@ enum ieee80211_channel_flags {
151 * @dfs_state: current state of this channel. Only relevant if radar is required 151 * @dfs_state: current state of this channel. Only relevant if radar is required
152 * on this channel. 152 * on this channel.
153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered. 153 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
154 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
154 */ 155 */
155struct ieee80211_channel { 156struct ieee80211_channel {
156 enum ieee80211_band band; 157 enum ieee80211_band band;
@@ -165,6 +166,7 @@ struct ieee80211_channel {
165 int orig_mag, orig_mpwr; 166 int orig_mag, orig_mpwr;
166 enum nl80211_dfs_state dfs_state; 167 enum nl80211_dfs_state dfs_state;
167 unsigned long dfs_state_entered; 168 unsigned long dfs_state_entered;
169 unsigned int dfs_cac_ms;
168}; 170};
169 171
170/** 172/**
@@ -1394,10 +1396,12 @@ struct cfg80211_scan_request {
1394/** 1396/**
1395 * struct cfg80211_match_set - sets of attributes to match 1397 * struct cfg80211_match_set - sets of attributes to match
1396 * 1398 *
1397 * @ssid: SSID to be matched 1399 * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1400 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1398 */ 1401 */
1399struct cfg80211_match_set { 1402struct cfg80211_match_set {
1400 struct cfg80211_ssid ssid; 1403 struct cfg80211_ssid ssid;
1404 s32 rssi_thold;
1401}; 1405};
1402 1406
1403/** 1407/**
@@ -1420,7 +1424,8 @@ struct cfg80211_match_set {
1420 * @dev: the interface 1424 * @dev: the interface
1421 * @scan_start: start time of the scheduled scan 1425 * @scan_start: start time of the scheduled scan
1422 * @channels: channels to scan 1426 * @channels: channels to scan
1423 * @rssi_thold: don't report scan results below this threshold (in s32 dBm) 1427 * @min_rssi_thold: for drivers only supporting a single threshold, this
1428 * contains the minimum over all matchsets
1424 */ 1429 */
1425struct cfg80211_sched_scan_request { 1430struct cfg80211_sched_scan_request {
1426 struct cfg80211_ssid *ssids; 1431 struct cfg80211_ssid *ssids;
@@ -1433,7 +1438,7 @@ struct cfg80211_sched_scan_request {
1433 u32 flags; 1438 u32 flags;
1434 struct cfg80211_match_set *match_sets; 1439 struct cfg80211_match_set *match_sets;
1435 int n_match_sets; 1440 int n_match_sets;
1436 s32 rssi_thold; 1441 s32 min_rssi_thold;
1437 1442
1438 /* internal */ 1443 /* internal */
1439 struct wiphy *wiphy; 1444 struct wiphy *wiphy;
@@ -1701,8 +1706,14 @@ struct cfg80211_ibss_params {
1701 * 1706 *
1702 * @channel: The channel to use or %NULL if not specified (auto-select based 1707 * @channel: The channel to use or %NULL if not specified (auto-select based
1703 * on scan results) 1708 * on scan results)
1709 * @channel_hint: The channel of the recommended BSS for initial connection or
1710 * %NULL if not specified
1704 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan 1711 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
1705 * results) 1712 * results)
1713 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
1714 * %NULL if not specified. Unlike the @bssid parameter, the driver is
1715 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
1716 * to use.
1706 * @ssid: SSID 1717 * @ssid: SSID
1707 * @ssid_len: Length of ssid in octets 1718 * @ssid_len: Length of ssid in octets
1708 * @auth_type: Authentication type (algorithm) 1719 * @auth_type: Authentication type (algorithm)
@@ -1725,11 +1736,13 @@ struct cfg80211_ibss_params {
1725 */ 1736 */
1726struct cfg80211_connect_params { 1737struct cfg80211_connect_params {
1727 struct ieee80211_channel *channel; 1738 struct ieee80211_channel *channel;
1728 u8 *bssid; 1739 struct ieee80211_channel *channel_hint;
1729 u8 *ssid; 1740 const u8 *bssid;
1741 const u8 *bssid_hint;
1742 const u8 *ssid;
1730 size_t ssid_len; 1743 size_t ssid_len;
1731 enum nl80211_auth_type auth_type; 1744 enum nl80211_auth_type auth_type;
1732 u8 *ie; 1745 const u8 *ie;
1733 size_t ie_len; 1746 size_t ie_len;
1734 bool privacy; 1747 bool privacy;
1735 enum nl80211_mfp mfp; 1748 enum nl80211_mfp mfp;
@@ -1768,6 +1781,7 @@ struct cfg80211_bitrate_mask {
1768 u32 legacy; 1781 u32 legacy;
1769 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 1782 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
1770 u16 vht_mcs[NL80211_VHT_NSS_MAX]; 1783 u16 vht_mcs[NL80211_VHT_NSS_MAX];
1784 enum nl80211_txrate_gi gi;
1771 } control[IEEE80211_NUM_BANDS]; 1785 } control[IEEE80211_NUM_BANDS];
1772}; 1786};
1773/** 1787/**
@@ -2194,7 +2208,12 @@ struct cfg80211_qos_map {
2194 * @set_cqm_txe_config: Configure connection quality monitor TX error 2208 * @set_cqm_txe_config: Configure connection quality monitor TX error
2195 * thresholds. 2209 * thresholds.
2196 * @sched_scan_start: Tell the driver to start a scheduled scan. 2210 * @sched_scan_start: Tell the driver to start a scheduled scan.
2197 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. 2211 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2212 * call must stop the scheduled scan and be ready for starting a new one
2213 * before it returns, i.e. @sched_scan_start may be called immediately
2214 * after that again and should not fail in that case. The driver should
2215 * not call cfg80211_sched_scan_stopped() for a requested stop (when this
2216 * method returns 0.)
2198 * 2217 *
2199 * @mgmt_frame_register: Notify driver that a management frame type was 2218 * @mgmt_frame_register: Notify driver that a management frame type was
2200 * registered. Note that this callback may not sleep, and cannot run 2219 * registered. Note that this callback may not sleep, and cannot run
@@ -2453,7 +2472,8 @@ struct cfg80211_ops {
2453 2472
2454 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, 2473 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2455 u8 *peer, u8 action_code, u8 dialog_token, 2474 u8 *peer, u8 action_code, u8 dialog_token,
2456 u16 status_code, const u8 *buf, size_t len); 2475 u16 status_code, u32 peer_capability,
2476 const u8 *buf, size_t len);
2457 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, 2477 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2458 u8 *peer, enum nl80211_tdls_operation oper); 2478 u8 *peer, enum nl80211_tdls_operation oper);
2459 2479
@@ -2485,7 +2505,8 @@ struct cfg80211_ops {
2485 2505
2486 int (*start_radar_detection)(struct wiphy *wiphy, 2506 int (*start_radar_detection)(struct wiphy *wiphy,
2487 struct net_device *dev, 2507 struct net_device *dev,
2488 struct cfg80211_chan_def *chandef); 2508 struct cfg80211_chan_def *chandef,
2509 u32 cac_time_ms);
2489 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, 2510 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2490 struct cfg80211_update_ft_ies_params *ftie); 2511 struct cfg80211_update_ft_ies_params *ftie);
2491 int (*crit_proto_start)(struct wiphy *wiphy, 2512 int (*crit_proto_start)(struct wiphy *wiphy,
@@ -2598,9 +2619,12 @@ struct ieee80211_iface_limit {
2598 * only in special cases. 2619 * only in special cases.
2599 * @radar_detect_widths: bitmap of channel widths supported for radar detection 2620 * @radar_detect_widths: bitmap of channel widths supported for radar detection
2600 * 2621 *
2601 * These examples can be expressed as follows: 2622 * With this structure the driver can describe which interface
2623 * combinations it supports concurrently.
2624 *
2625 * Examples:
2602 * 2626 *
2603 * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: 2627 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
2604 * 2628 *
2605 * struct ieee80211_iface_limit limits1[] = { 2629 * struct ieee80211_iface_limit limits1[] = {
2606 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, 2630 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
@@ -2614,7 +2638,7 @@ struct ieee80211_iface_limit {
2614 * }; 2638 * };
2615 * 2639 *
2616 * 2640 *
2617 * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: 2641 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
2618 * 2642 *
2619 * struct ieee80211_iface_limit limits2[] = { 2643 * struct ieee80211_iface_limit limits2[] = {
2620 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | 2644 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
@@ -2628,7 +2652,8 @@ struct ieee80211_iface_limit {
2628 * }; 2652 * };
2629 * 2653 *
2630 * 2654 *
2631 * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. 2655 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
2656 *
2632 * This allows for an infrastructure connection and three P2P connections. 2657 * This allows for an infrastructure connection and three P2P connections.
2633 * 2658 *
2634 * struct ieee80211_iface_limit limits3[] = { 2659 * struct ieee80211_iface_limit limits3[] = {
@@ -2778,7 +2803,7 @@ struct wiphy_vendor_command {
2778 * @perm_addr: permanent MAC address of this device 2803 * @perm_addr: permanent MAC address of this device
2779 * @addr_mask: If the device supports multiple MAC addresses by masking, 2804 * @addr_mask: If the device supports multiple MAC addresses by masking,
2780 * set this to a mask with variable bits set to 1, e.g. if the last 2805 * set this to a mask with variable bits set to 1, e.g. if the last
2781 * four bits are variable then set it to 00:...:00:0f. The actual 2806 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
2782 * variable bits shall be determined by the interfaces added, with 2807 * variable bits shall be determined by the interfaces added, with
2783 * interfaces not matching the mask being rejected to be brought up. 2808 * interfaces not matching the mask being rejected to be brought up.
2784 * @n_addresses: number of addresses in @addresses. 2809 * @n_addresses: number of addresses in @addresses.
@@ -2875,6 +2900,11 @@ struct wiphy_vendor_command {
2875 * @n_vendor_commands: number of vendor commands 2900 * @n_vendor_commands: number of vendor commands
2876 * @vendor_events: array of vendor events supported by the hardware 2901 * @vendor_events: array of vendor events supported by the hardware
2877 * @n_vendor_events: number of vendor events 2902 * @n_vendor_events: number of vendor events
2903 *
2904 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
2905 * (including P2P GO) or 0 to indicate no such limit is advertised. The
2906 * driver is allowed to advertise a theoretical limit that it can reach in
2907 * some cases, but may not always reach.
2878 */ 2908 */
2879struct wiphy { 2909struct wiphy {
2880 /* assign these fields before you register the wiphy */ 2910 /* assign these fields before you register the wiphy */
@@ -2990,6 +3020,8 @@ struct wiphy {
2990 const struct nl80211_vendor_cmd_info *vendor_events; 3020 const struct nl80211_vendor_cmd_info *vendor_events;
2991 int n_vendor_commands, n_vendor_events; 3021 int n_vendor_commands, n_vendor_events;
2992 3022
3023 u16 max_ap_assoc_sta;
3024
2993 char priv[0] __aligned(NETDEV_ALIGN); 3025 char priv[0] __aligned(NETDEV_ALIGN);
2994}; 3026};
2995 3027
@@ -3127,8 +3159,8 @@ struct cfg80211_cached_keys;
3127 * @identifier: (private) Identifier used in nl80211 to identify this 3159 * @identifier: (private) Identifier used in nl80211 to identify this
3128 * wireless device if it has no netdev 3160 * wireless device if it has no netdev
3129 * @current_bss: (private) Used by the internal configuration code 3161 * @current_bss: (private) Used by the internal configuration code
3130 * @channel: (private) Used by the internal configuration code to track 3162 * @chandef: (private) Used by the internal configuration code to track
3131 * the user-set AP, monitor and WDS channel 3163 * the user-set channel definition.
3132 * @preset_chandef: (private) Used by the internal configuration code to 3164 * @preset_chandef: (private) Used by the internal configuration code to
3133 * track the channel to be used for AP later 3165 * track the channel to be used for AP later
3134 * @bssid: (private) Used by the internal configuration code 3166 * @bssid: (private) Used by the internal configuration code
@@ -3151,6 +3183,7 @@ struct cfg80211_cached_keys;
3151 * @p2p_started: true if this is a P2P Device that has been started 3183 * @p2p_started: true if this is a P2P Device that has been started
3152 * @cac_started: true if DFS channel availability check has been started 3184 * @cac_started: true if DFS channel availability check has been started
3153 * @cac_start_time: timestamp (jiffies) when the dfs state was entered. 3185 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3186 * @cac_time_ms: CAC time in ms
3154 * @ps: powersave mode is enabled 3187 * @ps: powersave mode is enabled
3155 * @ps_timeout: dynamic powersave timeout 3188 * @ps_timeout: dynamic powersave timeout
3156 * @ap_unexpected_nlportid: (private) netlink port ID of application 3189 * @ap_unexpected_nlportid: (private) netlink port ID of application
@@ -3192,9 +3225,7 @@ struct wireless_dev {
3192 3225
3193 struct cfg80211_internal_bss *current_bss; /* associated / joined */ 3226 struct cfg80211_internal_bss *current_bss; /* associated / joined */
3194 struct cfg80211_chan_def preset_chandef; 3227 struct cfg80211_chan_def preset_chandef;
3195 3228 struct cfg80211_chan_def chandef;
3196 /* for AP and mesh channel tracking */
3197 struct ieee80211_channel *channel;
3198 3229
3199 bool ibss_fixed; 3230 bool ibss_fixed;
3200 bool ibss_dfs_possible; 3231 bool ibss_dfs_possible;
@@ -3208,6 +3239,7 @@ struct wireless_dev {
3208 3239
3209 bool cac_started; 3240 bool cac_started;
3210 unsigned long cac_start_time; 3241 unsigned long cac_start_time;
3242 unsigned int cac_time_ms;
3211 3243
3212#ifdef CONFIG_CFG80211_WEXT 3244#ifdef CONFIG_CFG80211_WEXT
3213 /* wext data */ 3245 /* wext data */
@@ -3640,7 +3672,7 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3640 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame 3672 * cfg80211_inform_bss_width_frame - inform cfg80211 of a received BSS frame
3641 * 3673 *
3642 * @wiphy: the wiphy reporting the BSS 3674 * @wiphy: the wiphy reporting the BSS
3643 * @channel: The channel the frame was received on 3675 * @rx_channel: The channel the frame was received on
3644 * @scan_width: width of the control channel 3676 * @scan_width: width of the control channel
3645 * @mgmt: the management frame (probe response or beacon) 3677 * @mgmt: the management frame (probe response or beacon)
3646 * @len: length of the management frame 3678 * @len: length of the management frame
@@ -3655,18 +3687,18 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
3655 */ 3687 */
3656struct cfg80211_bss * __must_check 3688struct cfg80211_bss * __must_check
3657cfg80211_inform_bss_width_frame(struct wiphy *wiphy, 3689cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3658 struct ieee80211_channel *channel, 3690 struct ieee80211_channel *rx_channel,
3659 enum nl80211_bss_scan_width scan_width, 3691 enum nl80211_bss_scan_width scan_width,
3660 struct ieee80211_mgmt *mgmt, size_t len, 3692 struct ieee80211_mgmt *mgmt, size_t len,
3661 s32 signal, gfp_t gfp); 3693 s32 signal, gfp_t gfp);
3662 3694
3663static inline struct cfg80211_bss * __must_check 3695static inline struct cfg80211_bss * __must_check
3664cfg80211_inform_bss_frame(struct wiphy *wiphy, 3696cfg80211_inform_bss_frame(struct wiphy *wiphy,
3665 struct ieee80211_channel *channel, 3697 struct ieee80211_channel *rx_channel,
3666 struct ieee80211_mgmt *mgmt, size_t len, 3698 struct ieee80211_mgmt *mgmt, size_t len,
3667 s32 signal, gfp_t gfp) 3699 s32 signal, gfp_t gfp)
3668{ 3700{
3669 return cfg80211_inform_bss_width_frame(wiphy, channel, 3701 return cfg80211_inform_bss_width_frame(wiphy, rx_channel,
3670 NL80211_BSS_CHAN_WIDTH_20, 3702 NL80211_BSS_CHAN_WIDTH_20,
3671 mgmt, len, signal, gfp); 3703 mgmt, len, signal, gfp);
3672} 3704}
@@ -3675,7 +3707,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3675 * cfg80211_inform_bss - inform cfg80211 of a new BSS 3707 * cfg80211_inform_bss - inform cfg80211 of a new BSS
3676 * 3708 *
3677 * @wiphy: the wiphy reporting the BSS 3709 * @wiphy: the wiphy reporting the BSS
3678 * @channel: The channel the frame was received on 3710 * @rx_channel: The channel the frame was received on
3679 * @scan_width: width of the control channel 3711 * @scan_width: width of the control channel
3680 * @bssid: the BSSID of the BSS 3712 * @bssid: the BSSID of the BSS
3681 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) 3713 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
@@ -3694,7 +3726,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
3694 */ 3726 */
3695struct cfg80211_bss * __must_check 3727struct cfg80211_bss * __must_check
3696cfg80211_inform_bss_width(struct wiphy *wiphy, 3728cfg80211_inform_bss_width(struct wiphy *wiphy,
3697 struct ieee80211_channel *channel, 3729 struct ieee80211_channel *rx_channel,
3698 enum nl80211_bss_scan_width scan_width, 3730 enum nl80211_bss_scan_width scan_width,
3699 const u8 *bssid, u64 tsf, u16 capability, 3731 const u8 *bssid, u64 tsf, u16 capability,
3700 u16 beacon_interval, const u8 *ie, size_t ielen, 3732 u16 beacon_interval, const u8 *ie, size_t ielen,
@@ -3702,12 +3734,12 @@ cfg80211_inform_bss_width(struct wiphy *wiphy,
3702 3734
3703static inline struct cfg80211_bss * __must_check 3735static inline struct cfg80211_bss * __must_check
3704cfg80211_inform_bss(struct wiphy *wiphy, 3736cfg80211_inform_bss(struct wiphy *wiphy,
3705 struct ieee80211_channel *channel, 3737 struct ieee80211_channel *rx_channel,
3706 const u8 *bssid, u64 tsf, u16 capability, 3738 const u8 *bssid, u64 tsf, u16 capability,
3707 u16 beacon_interval, const u8 *ie, size_t ielen, 3739 u16 beacon_interval, const u8 *ie, size_t ielen,
3708 s32 signal, gfp_t gfp) 3740 s32 signal, gfp_t gfp)
3709{ 3741{
3710 return cfg80211_inform_bss_width(wiphy, channel, 3742 return cfg80211_inform_bss_width(wiphy, rx_channel,
3711 NL80211_BSS_CHAN_WIDTH_20, 3743 NL80211_BSS_CHAN_WIDTH_20,
3712 bssid, tsf, capability, 3744 bssid, tsf, capability,
3713 beacon_interval, ie, ielen, signal, 3745 beacon_interval, ie, ielen, signal,
@@ -3876,6 +3908,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3876 * 3908 *
3877 * @dev: network device 3909 * @dev: network device
3878 * @bssid: the BSSID of the IBSS joined 3910 * @bssid: the BSSID of the IBSS joined
3911 * @channel: the channel of the IBSS joined
3879 * @gfp: allocation flags 3912 * @gfp: allocation flags
3880 * 3913 *
3881 * This function notifies cfg80211 that the device joined an IBSS or 3914 * This function notifies cfg80211 that the device joined an IBSS or
@@ -3885,7 +3918,8 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
3885 * with the locally generated beacon -- this guarantees that there is 3918 * with the locally generated beacon -- this guarantees that there is
3886 * always a scan result for this IBSS. cfg80211 will handle the rest. 3919 * always a scan result for this IBSS. cfg80211 will handle the rest.
3887 */ 3920 */
3888void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); 3921void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
3922 struct ieee80211_channel *channel, gfp_t gfp);
3889 3923
3890/** 3924/**
3891 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate 3925 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 37a0e24adbe7..a28f4e0f6251 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -69,6 +69,19 @@ static inline __wsum csum_sub(__wsum csum, __wsum addend)
69 return csum_add(csum, ~addend); 69 return csum_add(csum, ~addend);
70} 70}
71 71
72static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
73{
74 u16 res = (__force u16)csum;
75
76 res += (__force u16)addend;
77 return (__force __sum16)(res + (res < (__force u16)addend));
78}
79
80static inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
81{
82 return csum16_add(csum, ~addend);
83}
84
72static inline __wsum 85static inline __wsum
73csum_block_add(__wsum csum, __wsum csum2, int offset) 86csum_block_add(__wsum csum, __wsum csum2, int offset)
74{ 87{
@@ -112,9 +125,15 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
112 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum))); 125 *sum = csum_fold(csum_partial(diff, sizeof(diff), ~csum_unfold(*sum)));
113} 126}
114 127
115static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) 128/* Implements RFC 1624 (Incremental Internet Checksum)
129 * 3. Discussion states :
130 * HC' = ~(~HC + ~m + m')
131 * m : old value of a 16bit field
132 * m' : new value of a 16bit field
133 */
134static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
116{ 135{
117 csum_replace4(sum, (__force __be32)from, (__force __be32)to); 136 *sum = ~csum16_add(csum16_sub(~(*sum), old), new);
118} 137}
119 138
120struct sk_buff; 139struct sk_buff;
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 9cf2d5ef38d9..c15d39456e14 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -34,7 +34,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
34 return 0; 34 return 0;
35 35
36 rcu_read_lock(); 36 rcu_read_lock();
37 classid = container_of(task_css(p, net_cls_subsys_id), 37 classid = container_of(task_css(p, net_cls_cgrp_id),
38 struct cgroup_cls_state, css)->classid; 38 struct cgroup_cls_state, css)->classid;
39 rcu_read_unlock(); 39 rcu_read_unlock();
40 40
diff --git a/include/net/dst.h b/include/net/dst.h
index 77eb53fabfb0..46ed958e0c6e 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -54,10 +54,9 @@ struct dst_entry {
54#define DST_NOHASH 0x0008 54#define DST_NOHASH 0x0008
55#define DST_NOCACHE 0x0010 55#define DST_NOCACHE 0x0010
56#define DST_NOCOUNT 0x0020 56#define DST_NOCOUNT 0x0020
57#define DST_NOPEER 0x0040 57#define DST_FAKE_RTABLE 0x0040
58#define DST_FAKE_RTABLE 0x0080 58#define DST_XFRM_TUNNEL 0x0080
59#define DST_XFRM_TUNNEL 0x0100 59#define DST_XFRM_QUEUE 0x0100
60#define DST_XFRM_QUEUE 0x0200
61 60
62 unsigned short pending_confirm; 61 unsigned short pending_confirm;
63 62
@@ -109,9 +108,11 @@ struct dst_entry {
109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 108u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 109extern const u32 dst_default_metrics[];
111 110
112#define DST_METRICS_READ_ONLY 0x1UL 111#define DST_METRICS_READ_ONLY 0x1UL
112#define DST_METRICS_FORCE_OVERWRITE 0x2UL
113#define DST_METRICS_FLAGS 0x3UL
113#define __DST_METRICS_PTR(Y) \ 114#define __DST_METRICS_PTR(Y) \
114 ((u32 *)((Y) & ~DST_METRICS_READ_ONLY)) 115 ((u32 *)((Y) & ~DST_METRICS_FLAGS))
115#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics) 116#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
116 117
117static inline bool dst_metrics_read_only(const struct dst_entry *dst) 118static inline bool dst_metrics_read_only(const struct dst_entry *dst)
@@ -119,6 +120,11 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 120 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 121}
121 122
123static inline void dst_metrics_set_force_overwrite(struct dst_entry *dst)
124{
125 dst->_metrics |= DST_METRICS_FORCE_OVERWRITE;
126}
127
122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 128void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 129
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 130static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
diff --git a/include/net/flow.h b/include/net/flow.h
index d23e7fa2042e..64fd24836650 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -218,9 +218,11 @@ struct flow_cache_object *flow_cache_lookup(struct net *net,
218 const struct flowi *key, u16 family, 218 const struct flowi *key, u16 family,
219 u8 dir, flow_resolve_t resolver, 219 u8 dir, flow_resolve_t resolver,
220 void *ctx); 220 void *ctx);
221int flow_cache_init(struct net *net);
222void flow_cache_fini(struct net *net);
221 223
222void flow_cache_flush(void); 224void flow_cache_flush(struct net *net);
223void flow_cache_flush_deferred(void); 225void flow_cache_flush_deferred(struct net *net);
224extern atomic_t flow_cache_genid; 226extern atomic_t flow_cache_genid;
225 227
226#endif 228#endif
diff --git a/include/net/flowcache.h b/include/net/flowcache.h
new file mode 100644
index 000000000000..c8f665ec6e0d
--- /dev/null
+++ b/include/net/flowcache.h
@@ -0,0 +1,25 @@
1#ifndef _NET_FLOWCACHE_H
2#define _NET_FLOWCACHE_H
3
4#include <linux/interrupt.h>
5#include <linux/types.h>
6#include <linux/timer.h>
7#include <linux/notifier.h>
8
9struct flow_cache_percpu {
10 struct hlist_head *hash_table;
11 int hash_count;
12 u32 hash_rnd;
13 int hash_rnd_recalc;
14 struct tasklet_struct flush_tasklet;
15};
16
17struct flow_cache {
18 u32 hash_shift;
19 struct flow_cache_percpu __percpu *percpu;
20 struct notifier_block hotcpu_notifier;
21 int low_watermark;
22 int high_watermark;
23 struct timer_list rnd_timer;
24};
25#endif /* _NET_FLOWCACHE_H */
diff --git a/include/net/ieee80211_radiotap.h b/include/net/ieee80211_radiotap.h
index 8b5b71433297..b0fd9476c538 100644
--- a/include/net/ieee80211_radiotap.h
+++ b/include/net/ieee80211_radiotap.h
@@ -316,6 +316,10 @@ enum ieee80211_radiotap_type {
316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10 316#define IEEE80211_RADIOTAP_VHT_FLAG_LDPC_EXTRA_OFDM_SYM 0x10
317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20 317#define IEEE80211_RADIOTAP_VHT_FLAG_BEAMFORMED 0x20
318 318
319#define IEEE80211_RADIOTAP_CODING_LDPC_USER0 0x01
320#define IEEE80211_RADIOTAP_CODING_LDPC_USER1 0x02
321#define IEEE80211_RADIOTAP_CODING_LDPC_USER2 0x04
322#define IEEE80211_RADIOTAP_CODING_LDPC_USER3 0x08
319 323
320/* helpers */ 324/* helpers */
321static inline int ieee80211_get_radiotap_len(unsigned char *data) 325static inline int ieee80211_get_radiotap_len(unsigned char *data)
diff --git a/include/net/ieee802154.h b/include/net/ieee802154.h
index ee59f8b188dd..c7ae0ac528dc 100644
--- a/include/net/ieee802154.h
+++ b/include/net/ieee802154.h
@@ -42,22 +42,42 @@
42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \ 42 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
43 } while (0) 43 } while (0)
44 44
45#define IEEE802154_FC_SECEN (1 << 3) 45#define IEEE802154_FC_SECEN_SHIFT 3
46#define IEEE802154_FC_FRPEND (1 << 4) 46#define IEEE802154_FC_SECEN (1 << IEEE802154_FC_SECEN_SHIFT)
47#define IEEE802154_FC_ACK_REQ (1 << 5) 47#define IEEE802154_FC_FRPEND_SHIFT 4
48#define IEEE802154_FC_INTRA_PAN (1 << 6) 48#define IEEE802154_FC_FRPEND (1 << IEEE802154_FC_FRPEND_SHIFT)
49#define IEEE802154_FC_ACK_REQ_SHIFT 5
50#define IEEE802154_FC_ACK_REQ (1 << IEEE802154_FC_ACK_REQ_SHIFT)
51#define IEEE802154_FC_INTRA_PAN_SHIFT 6
52#define IEEE802154_FC_INTRA_PAN (1 << IEEE802154_FC_INTRA_PAN_SHIFT)
49 53
50#define IEEE802154_FC_SAMODE_SHIFT 14 54#define IEEE802154_FC_SAMODE_SHIFT 14
51#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT) 55#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
52#define IEEE802154_FC_DAMODE_SHIFT 10 56#define IEEE802154_FC_DAMODE_SHIFT 10
53#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT) 57#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
54 58
59#define IEEE802154_FC_VERSION_SHIFT 12
60#define IEEE802154_FC_VERSION_MASK (3 << IEEE802154_FC_VERSION_SHIFT)
61#define IEEE802154_FC_VERSION(x) ((x & IEEE802154_FC_VERSION_MASK) >> IEEE802154_FC_VERSION_SHIFT)
62
55#define IEEE802154_FC_SAMODE(x) \ 63#define IEEE802154_FC_SAMODE(x) \
56 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT) 64 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
57 65
58#define IEEE802154_FC_DAMODE(x) \ 66#define IEEE802154_FC_DAMODE(x) \
59 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT) 67 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
60 68
69#define IEEE802154_SCF_SECLEVEL_MASK 7
70#define IEEE802154_SCF_SECLEVEL_SHIFT 0
71#define IEEE802154_SCF_SECLEVEL(x) (x & IEEE802154_SCF_SECLEVEL_MASK)
72#define IEEE802154_SCF_KEY_ID_MODE_SHIFT 3
73#define IEEE802154_SCF_KEY_ID_MODE_MASK (3 << IEEE802154_SCF_KEY_ID_MODE_SHIFT)
74#define IEEE802154_SCF_KEY_ID_MODE(x) \
75 ((x & IEEE802154_SCF_KEY_ID_MODE_MASK) >> IEEE802154_SCF_KEY_ID_MODE_SHIFT)
76
77#define IEEE802154_SCF_KEY_IMPLICIT 0
78#define IEEE802154_SCF_KEY_INDEX 1
79#define IEEE802154_SCF_KEY_SHORT_INDEX 2
80#define IEEE802154_SCF_KEY_HW_INDEX 3
61 81
62/* MAC footer size */ 82/* MAC footer size */
63#define IEEE802154_MFR_SIZE 2 /* 2 octets */ 83#define IEEE802154_MFR_SIZE 2 /* 2 octets */
diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h
index 8196d5d40359..5a719ca892f4 100644
--- a/include/net/ieee802154_netdev.h
+++ b/include/net/ieee802154_netdev.h
@@ -28,6 +28,164 @@
28#define IEEE802154_NETDEVICE_H 28#define IEEE802154_NETDEVICE_H
29 29
30#include <net/af_ieee802154.h> 30#include <net/af_ieee802154.h>
31#include <linux/netdevice.h>
32#include <linux/skbuff.h>
33
34struct ieee802154_sechdr {
35#if defined(__LITTLE_ENDIAN_BITFIELD)
36 u8 level:3,
37 key_id_mode:2,
38 reserved:3;
39#elif defined(__BIG_ENDIAN_BITFIELD)
40 u8 reserved:3,
41 key_id_mode:2,
42 level:3;
43#else
44#error "Please fix <asm/byteorder.h>"
45#endif
46 u8 key_id;
47 __le32 frame_counter;
48 union {
49 __le32 short_src;
50 __le64 extended_src;
51 };
52};
53
54struct ieee802154_addr {
55 u8 mode;
56 __le16 pan_id;
57 union {
58 __le16 short_addr;
59 __le64 extended_addr;
60 };
61};
62
63struct ieee802154_hdr_fc {
64#if defined(__LITTLE_ENDIAN_BITFIELD)
65 u16 type:3,
66 security_enabled:1,
67 frame_pending:1,
68 ack_request:1,
69 intra_pan:1,
70 reserved:3,
71 dest_addr_mode:2,
72 version:2,
73 source_addr_mode:2;
74#elif defined(__BIG_ENDIAN_BITFIELD)
75 u16 reserved:1,
76 intra_pan:1,
77 ack_request:1,
78 frame_pending:1,
79 security_enabled:1,
80 type:3,
81 source_addr_mode:2,
82 version:2,
83 dest_addr_mode:2,
84 reserved2:2;
85#else
86#error "Please fix <asm/byteorder.h>"
87#endif
88};
89
90struct ieee802154_hdr {
91 struct ieee802154_hdr_fc fc;
92 u8 seq;
93 struct ieee802154_addr source;
94 struct ieee802154_addr dest;
95 struct ieee802154_sechdr sec;
96};
97
98/* pushes hdr onto the skb. fields of hdr->fc that can be calculated from
99 * the contents of hdr will be, and the actual value of those bits in
100 * hdr->fc will be ignored. this includes the INTRA_PAN bit and the frame
101 * version, if SECEN is set.
102 */
103int ieee802154_hdr_push(struct sk_buff *skb, const struct ieee802154_hdr *hdr);
104
105/* pulls the entire 802.15.4 header off of the skb, including the security
106 * header, and performs pan id decompression
107 */
108int ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr);
109
110/* parses the frame control, sequence number of address fields in a given skb
111 * and stores them into hdr, performing pan id decompression and length checks
112 * to be suitable for use in header_ops.parse
113 */
114int ieee802154_hdr_peek_addrs(const struct sk_buff *skb,
115 struct ieee802154_hdr *hdr);
116
117static inline int ieee802154_hdr_length(struct sk_buff *skb)
118{
119 struct ieee802154_hdr hdr;
120 int len = ieee802154_hdr_pull(skb, &hdr);
121
122 if (len > 0)
123 skb_push(skb, len);
124
125 return len;
126}
127
128static inline bool ieee802154_addr_equal(const struct ieee802154_addr *a1,
129 const struct ieee802154_addr *a2)
130{
131 if (a1->pan_id != a2->pan_id || a1->mode != a2->mode)
132 return false;
133
134 if ((a1->mode == IEEE802154_ADDR_LONG &&
135 a1->extended_addr != a2->extended_addr) ||
136 (a1->mode == IEEE802154_ADDR_SHORT &&
137 a1->short_addr != a2->short_addr))
138 return false;
139
140 return true;
141}
142
143static inline __le64 ieee802154_devaddr_from_raw(const void *raw)
144{
145 u64 temp;
146
147 memcpy(&temp, raw, IEEE802154_ADDR_LEN);
148 return (__force __le64)swab64(temp);
149}
150
151static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr)
152{
153 u64 temp = swab64((__force u64)addr);
154
155 memcpy(raw, &temp, IEEE802154_ADDR_LEN);
156}
157
158static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
159 const struct ieee802154_addr_sa *sa)
160{
161 a->mode = sa->addr_type;
162 a->pan_id = cpu_to_le16(sa->pan_id);
163
164 switch (a->mode) {
165 case IEEE802154_ADDR_SHORT:
166 a->short_addr = cpu_to_le16(sa->short_addr);
167 break;
168 case IEEE802154_ADDR_LONG:
169 a->extended_addr = ieee802154_devaddr_from_raw(sa->hwaddr);
170 break;
171 }
172}
173
174static inline void ieee802154_addr_to_sa(struct ieee802154_addr_sa *sa,
175 const struct ieee802154_addr *a)
176{
177 sa->addr_type = a->mode;
178 sa->pan_id = le16_to_cpu(a->pan_id);
179
180 switch (a->mode) {
181 case IEEE802154_ADDR_SHORT:
182 sa->short_addr = le16_to_cpu(a->short_addr);
183 break;
184 case IEEE802154_ADDR_LONG:
185 ieee802154_devaddr_to_raw(sa->hwaddr, a->extended_addr);
186 break;
187 }
188}
31 189
32/* 190/*
33 * A control block of skb passed between the ARPHRD_IEEE802154 device 191 * A control block of skb passed between the ARPHRD_IEEE802154 device
@@ -35,10 +193,10 @@
35 */ 193 */
36struct ieee802154_mac_cb { 194struct ieee802154_mac_cb {
37 u8 lqi; 195 u8 lqi;
38 struct ieee802154_addr sa;
39 struct ieee802154_addr da;
40 u8 flags; 196 u8 flags;
41 u8 seq; 197 u8 seq;
198 struct ieee802154_addr source;
199 struct ieee802154_addr dest;
42}; 200};
43 201
44static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb) 202static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
@@ -50,23 +208,17 @@ static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
50 208
51#define MAC_CB_FLAG_ACKREQ (1 << 3) 209#define MAC_CB_FLAG_ACKREQ (1 << 3)
52#define MAC_CB_FLAG_SECEN (1 << 4) 210#define MAC_CB_FLAG_SECEN (1 << 4)
53#define MAC_CB_FLAG_INTRAPAN (1 << 5)
54 211
55static inline int mac_cb_is_ackreq(struct sk_buff *skb) 212static inline bool mac_cb_is_ackreq(struct sk_buff *skb)
56{ 213{
57 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ; 214 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
58} 215}
59 216
60static inline int mac_cb_is_secen(struct sk_buff *skb) 217static inline bool mac_cb_is_secen(struct sk_buff *skb)
61{ 218{
62 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN; 219 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
63} 220}
64 221
65static inline int mac_cb_is_intrapan(struct sk_buff *skb)
66{
67 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
68}
69
70static inline int mac_cb_type(struct sk_buff *skb) 222static inline int mac_cb_type(struct sk_buff *skb)
71{ 223{
72 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK; 224 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
@@ -77,6 +229,18 @@ static inline int mac_cb_type(struct sk_buff *skb)
77#define IEEE802154_MAC_SCAN_PASSIVE 2 229#define IEEE802154_MAC_SCAN_PASSIVE 2
78#define IEEE802154_MAC_SCAN_ORPHAN 3 230#define IEEE802154_MAC_SCAN_ORPHAN 3
79 231
232struct ieee802154_mac_params {
233 s8 transmit_power;
234 u8 min_be;
235 u8 max_be;
236 u8 csma_retries;
237 s8 frame_retries;
238
239 bool lbt;
240 u8 cca_mode;
241 s32 cca_ed_level;
242};
243
80struct wpan_phy; 244struct wpan_phy;
81/* 245/*
82 * This should be located at net_device->ml_priv 246 * This should be located at net_device->ml_priv
@@ -92,7 +256,7 @@ struct ieee802154_mlme_ops {
92 u8 channel, u8 page, u8 cap); 256 u8 channel, u8 page, u8 cap);
93 int (*assoc_resp)(struct net_device *dev, 257 int (*assoc_resp)(struct net_device *dev,
94 struct ieee802154_addr *addr, 258 struct ieee802154_addr *addr,
95 u16 short_addr, u8 status); 259 __le16 short_addr, u8 status);
96 int (*disassoc_req)(struct net_device *dev, 260 int (*disassoc_req)(struct net_device *dev,
97 struct ieee802154_addr *addr, 261 struct ieee802154_addr *addr,
98 u8 reason); 262 u8 reason);
@@ -103,6 +267,11 @@ struct ieee802154_mlme_ops {
103 int (*scan_req)(struct net_device *dev, 267 int (*scan_req)(struct net_device *dev,
104 u8 type, u32 channels, u8 page, u8 duration); 268 u8 type, u32 channels, u8 page, u8 duration);
105 269
270 int (*set_mac_params)(struct net_device *dev,
271 const struct ieee802154_mac_params *params);
272 void (*get_mac_params)(struct net_device *dev,
273 struct ieee802154_mac_params *params);
274
106 /* The fields below are required. */ 275 /* The fields below are required. */
107 276
108 struct wpan_phy *(*get_phy)(const struct net_device *dev); 277 struct wpan_phy *(*get_phy)(const struct net_device *dev);
@@ -111,8 +280,8 @@ struct ieee802154_mlme_ops {
111 * FIXME: these should become the part of PIB/MIB interface. 280 * FIXME: these should become the part of PIB/MIB interface.
112 * However we still don't have IB interface of any kind 281 * However we still don't have IB interface of any kind
113 */ 282 */
114 u16 (*get_pan_id)(const struct net_device *dev); 283 __le16 (*get_pan_id)(const struct net_device *dev);
115 u16 (*get_short_addr)(const struct net_device *dev); 284 __le16 (*get_short_addr)(const struct net_device *dev);
116 u8 (*get_dsn)(const struct net_device *dev); 285 u8 (*get_dsn)(const struct net_device *dev);
117}; 286};
118 287
diff --git a/include/net/ip.h b/include/net/ip.h
index 23be0fd37937..25064c28e059 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -187,6 +187,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
187#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 187#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
188#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 188#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
189#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 189#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
190#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
190#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 191#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
191#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 192#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
192 193
@@ -266,7 +267,8 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
266 267
267static inline bool ip_sk_accept_pmtu(const struct sock *sk) 268static inline bool ip_sk_accept_pmtu(const struct sock *sk)
268{ 269{
269 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE; 270 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE &&
271 inet_sk(sk)->pmtudisc != IP_PMTUDISC_OMIT;
270} 272}
271 273
272static inline bool ip_sk_use_pmtu(const struct sock *sk) 274static inline bool ip_sk_use_pmtu(const struct sock *sk)
@@ -274,6 +276,12 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk)
274 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; 276 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
275} 277}
276 278
279static inline bool ip_sk_local_df(const struct sock *sk)
280{
281 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO ||
282 inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT;
283}
284
277static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, 285static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
278 bool forwarding) 286 bool forwarding)
279{ 287{
@@ -489,7 +497,8 @@ int ip_options_rcv_srr(struct sk_buff *skb);
489 497
490void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb); 498void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
491void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 499void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
492int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc); 500int ip_cmsg_send(struct net *net, struct msghdr *msg,
501 struct ipcm_cookie *ipc, bool allow_ipv6);
493int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, 502int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
494 unsigned int optlen); 503 unsigned int optlen);
495int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, 504int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index aca0c2709fd6..9bcb220bd4ad 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -284,7 +284,8 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg), 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 void *arg); 285 void *arg);
286 286
287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info); 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info,
288 struct nlattr *mx, int mx_len);
288 289
289int fib6_del(struct rt6_info *rt, struct nl_info *info); 290int fib6_del(struct rt6_info *rt, struct nl_info *info);
290 291
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 017badb1aec7..3c3bb184eb8f 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,6 +51,11 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 51 return (flags >> 3) & 7;
52} 52}
53 53
54static inline bool rt6_need_strict(const struct in6_addr *daddr)
55{
56 return ipv6_addr_type(daddr) &
57 (IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
58}
54 59
55void ip6_route_input(struct sk_buff *skb); 60void ip6_route_input(struct sk_buff *skb);
56 61
@@ -171,7 +176,14 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
171 176
172static inline bool ip6_sk_accept_pmtu(const struct sock *sk) 177static inline bool ip6_sk_accept_pmtu(const struct sock *sk)
173{ 178{
174 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE; 179 return inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_INTERFACE &&
180 inet6_sk(sk)->pmtudisc != IPV6_PMTUDISC_OMIT;
181}
182
183static inline bool ip6_sk_local_df(const struct sock *sk)
184{
185 return inet6_sk(sk)->pmtudisc < IPV6_PMTUDISC_DO ||
186 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
175} 187}
176 188
177static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt) 189static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index f4ab2fb4d50c..8248e3909fdf 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -66,10 +66,6 @@
66 * 66 *
67 * Secondly, when the hardware handles fragmentation, the frame handed to 67 * Secondly, when the hardware handles fragmentation, the frame handed to
68 * the driver from mac80211 is the MSDU, not the MPDU. 68 * the driver from mac80211 is the MSDU, not the MPDU.
69 *
70 * Finally, for received frames, the driver is able to indicate that it has
71 * filled a radiotap header and put that in front of the frame; if it does
72 * not do so then mac80211 may add this under certain circumstances.
73 */ 69 */
74 70
75/** 71/**
@@ -701,11 +697,11 @@ struct ieee80211_tx_info {
701 } control; 697 } control;
702 struct { 698 struct {
703 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; 699 struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
704 int ack_signal; 700 s32 ack_signal;
705 u8 ampdu_ack_len; 701 u8 ampdu_ack_len;
706 u8 ampdu_len; 702 u8 ampdu_len;
707 u8 antenna; 703 u8 antenna;
708 /* 21 bytes free */ 704 void *status_driver_data[21 / sizeof(void *)];
709 } status; 705 } status;
710 struct { 706 struct {
711 struct ieee80211_tx_rate driver_rates[ 707 struct ieee80211_tx_rate driver_rates[
@@ -808,9 +804,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
808 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index 804 * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index
809 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index 805 * @RX_FLAG_VHT: VHT MCS was used and rate_index is MCS index
810 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used 806 * @RX_FLAG_40MHZ: HT40 (40 MHz) was used
811 * @RX_FLAG_80MHZ: 80 MHz was used
812 * @RX_FLAG_80P80MHZ: 80+80 MHz was used
813 * @RX_FLAG_160MHZ: 160 MHz was used
814 * @RX_FLAG_SHORT_GI: Short guard interval was used 807 * @RX_FLAG_SHORT_GI: Short guard interval was used
815 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. 808 * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
816 * Valid only for data frames (mainly A-MPDU) 809 * Valid only for data frames (mainly A-MPDU)
@@ -830,6 +823,7 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
830 * on this subframe 823 * on this subframe
831 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC 824 * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
832 * is stored in the @ampdu_delimiter_crc field) 825 * is stored in the @ampdu_delimiter_crc field)
826 * @RX_FLAG_LDPC: LDPC was used
833 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 827 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
834 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 828 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
835 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 829 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -866,9 +860,7 @@ enum mac80211_rx_flags {
866 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20), 860 RX_FLAG_AMPDU_DELIM_CRC_KNOWN = BIT(20),
867 RX_FLAG_MACTIME_END = BIT(21), 861 RX_FLAG_MACTIME_END = BIT(21),
868 RX_FLAG_VHT = BIT(22), 862 RX_FLAG_VHT = BIT(22),
869 RX_FLAG_80MHZ = BIT(23), 863 RX_FLAG_LDPC = BIT(23),
870 RX_FLAG_80P80MHZ = BIT(24),
871 RX_FLAG_160MHZ = BIT(25),
872 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 864 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
873 RX_FLAG_10MHZ = BIT(28), 865 RX_FLAG_10MHZ = BIT(28),
874 RX_FLAG_5MHZ = BIT(29), 866 RX_FLAG_5MHZ = BIT(29),
@@ -878,6 +870,23 @@ enum mac80211_rx_flags {
878#define RX_FLAG_STBC_SHIFT 26 870#define RX_FLAG_STBC_SHIFT 26
879 871
880/** 872/**
873 * enum mac80211_rx_vht_flags - receive VHT flags
874 *
875 * These flags are used with the @vht_flag member of
876 * &struct ieee80211_rx_status.
877 * @RX_VHT_FLAG_80MHZ: 80 MHz was used
878 * @RX_VHT_FLAG_80P80MHZ: 80+80 MHz was used
879 * @RX_VHT_FLAG_160MHZ: 160 MHz was used
880 * @RX_VHT_FLAG_BF: packet was beamformed
881 */
882enum mac80211_rx_vht_flags {
883 RX_VHT_FLAG_80MHZ = BIT(0),
884 RX_VHT_FLAG_80P80MHZ = BIT(1),
885 RX_VHT_FLAG_160MHZ = BIT(2),
886 RX_VHT_FLAG_BF = BIT(3),
887};
888
889/**
881 * struct ieee80211_rx_status - receive status 890 * struct ieee80211_rx_status - receive status
882 * 891 *
883 * The low-level driver should provide this information (the subset 892 * The low-level driver should provide this information (the subset
@@ -902,26 +911,19 @@ enum mac80211_rx_flags {
902 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT) 911 * HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
903 * @vht_nss: number of streams (VHT only) 912 * @vht_nss: number of streams (VHT only)
904 * @flag: %RX_FLAG_* 913 * @flag: %RX_FLAG_*
914 * @vht_flag: %RX_VHT_FLAG_*
905 * @rx_flags: internal RX flags for mac80211 915 * @rx_flags: internal RX flags for mac80211
906 * @ampdu_reference: A-MPDU reference number, must be a different value for 916 * @ampdu_reference: A-MPDU reference number, must be a different value for
907 * each A-MPDU but the same for each subframe within one A-MPDU 917 * each A-MPDU but the same for each subframe within one A-MPDU
908 * @ampdu_delimiter_crc: A-MPDU delimiter CRC 918 * @ampdu_delimiter_crc: A-MPDU delimiter CRC
909 * @vendor_radiotap_bitmap: radiotap vendor namespace presence bitmap
910 * @vendor_radiotap_len: radiotap vendor namespace length
911 * @vendor_radiotap_align: radiotap vendor namespace alignment. Note
912 * that the actual data must be at the start of the SKB data
913 * already.
914 * @vendor_radiotap_oui: radiotap vendor namespace OUI
915 * @vendor_radiotap_subns: radiotap vendor sub namespace
916 */ 919 */
917struct ieee80211_rx_status { 920struct ieee80211_rx_status {
918 u64 mactime; 921 u64 mactime;
919 u32 device_timestamp; 922 u32 device_timestamp;
920 u32 ampdu_reference; 923 u32 ampdu_reference;
921 u32 flag; 924 u32 flag;
922 u32 vendor_radiotap_bitmap;
923 u16 vendor_radiotap_len;
924 u16 freq; 925 u16 freq;
926 u8 vht_flag;
925 u8 rate_idx; 927 u8 rate_idx;
926 u8 vht_nss; 928 u8 vht_nss;
927 u8 rx_flags; 929 u8 rx_flags;
@@ -931,9 +933,6 @@ struct ieee80211_rx_status {
931 u8 chains; 933 u8 chains;
932 s8 chain_signal[IEEE80211_MAX_CHAINS]; 934 s8 chain_signal[IEEE80211_MAX_CHAINS];
933 u8 ampdu_delimiter_crc; 935 u8 ampdu_delimiter_crc;
934 u8 vendor_radiotap_align;
935 u8 vendor_radiotap_oui[3];
936 u8 vendor_radiotap_subns;
937}; 936};
938 937
939/** 938/**
@@ -1506,8 +1505,6 @@ struct ieee80211_tx_control {
1506 * @IEEE80211_HW_CONNECTION_MONITOR: 1505 * @IEEE80211_HW_CONNECTION_MONITOR:
1507 * The hardware performs its own connection monitoring, including 1506 * The hardware performs its own connection monitoring, including
1508 * periodic keep-alives to the AP and probing the AP on beacon loss. 1507 * periodic keep-alives to the AP and probing the AP on beacon loss.
1509 * When this flag is set, signaling beacon-loss will cause an immediate
1510 * change to disassociated state.
1511 * 1508 *
1512 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC: 1509 * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
1513 * This device needs to get data from beacon before association (i.e. 1510 * This device needs to get data from beacon before association (i.e.
@@ -1643,10 +1640,6 @@ enum ieee80211_hw_flags {
1643 * the hw can report back. 1640 * the hw can report back.
1644 * @max_rate_tries: maximum number of tries for each stage 1641 * @max_rate_tries: maximum number of tries for each stage
1645 * 1642 *
1646 * @napi_weight: weight used for NAPI polling. You must specify an
1647 * appropriate value here if a napi_poll operation is provided
1648 * by your driver.
1649 *
1650 * @max_rx_aggregation_subframes: maximum buffer size (number of 1643 * @max_rx_aggregation_subframes: maximum buffer size (number of
1651 * sub-frames) to be used for A-MPDU block ack receiver 1644 * sub-frames) to be used for A-MPDU block ack receiver
1652 * aggregation. 1645 * aggregation.
@@ -1700,7 +1693,6 @@ struct ieee80211_hw {
1700 int vif_data_size; 1693 int vif_data_size;
1701 int sta_data_size; 1694 int sta_data_size;
1702 int chanctx_data_size; 1695 int chanctx_data_size;
1703 int napi_weight;
1704 u16 queues; 1696 u16 queues;
1705 u16 max_listen_interval; 1697 u16 max_listen_interval;
1706 s8 max_signal; 1698 s8 max_signal;
@@ -1895,7 +1887,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
1895 * 1887 *
1896 * Driver informs U-APSD client support by enabling 1888 * Driver informs U-APSD client support by enabling
1897 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the 1889 * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the
1898 * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS 1890 * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS
1899 * Nullfunc frames and stay awake until the service period has ended. To 1891 * Nullfunc frames and stay awake until the service period has ended. To
1900 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames 1892 * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
1901 * from that AC are transmitted with powersave enabled. 1893 * from that AC are transmitted with powersave enabled.
@@ -2101,7 +2093,7 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
2101 * with the number of frames to be released and which TIDs they are 2093 * with the number of frames to be released and which TIDs they are
2102 * to come from. In this case, the driver is responsible for setting 2094 * to come from. In this case, the driver is responsible for setting
2103 * the EOSP (for uAPSD) and MORE_DATA bits in the released frames, 2095 * the EOSP (for uAPSD) and MORE_DATA bits in the released frames,
2104 * to help the @more_data paramter is passed to tell the driver if 2096 * to help the @more_data parameter is passed to tell the driver if
2105 * there is more data on other TIDs -- the TIDs to release frames 2097 * there is more data on other TIDs -- the TIDs to release frames
2106 * from are ignored since mac80211 doesn't know how many frames the 2098 * from are ignored since mac80211 doesn't know how many frames the
2107 * buffers for those TIDs contain. 2099 * buffers for those TIDs contain.
@@ -2470,6 +2462,7 @@ enum ieee80211_roc_type {
2470 * This process will continue until sched_scan_stop is called. 2462 * This process will continue until sched_scan_stop is called.
2471 * 2463 *
2472 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. 2464 * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
2465 * In this case, ieee80211_sched_scan_stopped() must not be called.
2473 * 2466 *
2474 * @sw_scan_start: Notifier function that is called just before a software scan 2467 * @sw_scan_start: Notifier function that is called just before a software scan
2475 * is started. Can be NULL, if the driver doesn't need this notification. 2468 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -2623,8 +2616,6 @@ enum ieee80211_roc_type {
2623 * callback. They must then call ieee80211_chswitch_done() to indicate 2616 * callback. They must then call ieee80211_chswitch_done() to indicate
2624 * completion of the channel switch. 2617 * completion of the channel switch.
2625 * 2618 *
2626 * @napi_poll: Poll Rx queue for incoming data frames.
2627 *
2628 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. 2619 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2629 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may 2620 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2630 * reject TX/RX mask combinations they cannot support by returning -EINVAL 2621 * reject TX/RX mask combinations they cannot support by returning -EINVAL
@@ -2662,7 +2653,7 @@ enum ieee80211_roc_type {
2662 * parameters. In the case where the driver buffers some frames for 2653 * parameters. In the case where the driver buffers some frames for
2663 * sleeping stations mac80211 will use this callback to tell the driver 2654 * sleeping stations mac80211 will use this callback to tell the driver
2664 * to release some frames, either for PS-poll or uAPSD. 2655 * to release some frames, either for PS-poll or uAPSD.
2665 * Note that if the @more_data paramter is %false the driver must check 2656 * Note that if the @more_data parameter is %false the driver must check
2666 * if there are more frames on the given TIDs, and if there are more than 2657 * if there are more frames on the given TIDs, and if there are more than
2667 * the frames being released then it must still set the more-data bit in 2658 * the frames being released then it must still set the more-data bit in
2668 * the frame. If the @more_data parameter is %true, then of course the 2659 * the frame. If the @more_data parameter is %true, then of course the
@@ -2750,11 +2741,13 @@ enum ieee80211_roc_type {
2750 * @channel_switch_beacon: Starts a channel switch to a new channel. 2741 * @channel_switch_beacon: Starts a channel switch to a new channel.
2751 * Beacons are modified to include CSA or ECSA IEs before calling this 2742 * Beacons are modified to include CSA or ECSA IEs before calling this
2752 * function. The corresponding count fields in these IEs must be 2743 * function. The corresponding count fields in these IEs must be
2753 * decremented, and when they reach zero the driver must call 2744 * decremented, and when they reach 1 the driver must call
2754 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get() 2745 * ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
2755 * get the csa counter decremented by mac80211, but must check if it is 2746 * get the csa counter decremented by mac80211, but must check if it is
2756 * zero using ieee80211_csa_is_complete() after the beacon has been 2747 * 1 using ieee80211_csa_is_complete() after the beacon has been
2757 * transmitted and then call ieee80211_csa_finish(). 2748 * transmitted and then call ieee80211_csa_finish().
2749 * If the CSA count starts as zero or 1, this function will not be called,
2750 * since there won't be any time to beacon before the switch anyway.
2758 * 2751 *
2759 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all 2752 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2760 * information in bss_conf is set up and the beacon can be retrieved. A 2753 * information in bss_conf is set up and the beacon can be retrieved. A
@@ -2817,7 +2810,7 @@ struct ieee80211_ops {
2817 struct ieee80211_vif *vif, 2810 struct ieee80211_vif *vif,
2818 struct cfg80211_sched_scan_request *req, 2811 struct cfg80211_sched_scan_request *req,
2819 struct ieee80211_sched_scan_ies *ies); 2812 struct ieee80211_sched_scan_ies *ies);
2820 void (*sched_scan_stop)(struct ieee80211_hw *hw, 2813 int (*sched_scan_stop)(struct ieee80211_hw *hw,
2821 struct ieee80211_vif *vif); 2814 struct ieee80211_vif *vif);
2822 void (*sw_scan_start)(struct ieee80211_hw *hw); 2815 void (*sw_scan_start)(struct ieee80211_hw *hw);
2823 void (*sw_scan_complete)(struct ieee80211_hw *hw); 2816 void (*sw_scan_complete)(struct ieee80211_hw *hw);
@@ -2881,7 +2874,6 @@ struct ieee80211_ops {
2881 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop); 2874 void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
2882 void (*channel_switch)(struct ieee80211_hw *hw, 2875 void (*channel_switch)(struct ieee80211_hw *hw,
2883 struct ieee80211_channel_switch *ch_switch); 2876 struct ieee80211_channel_switch *ch_switch);
2884 int (*napi_poll)(struct ieee80211_hw *hw, int budget);
2885 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); 2877 int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
2886 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); 2878 int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
2887 2879
@@ -3163,21 +3155,21 @@ void ieee80211_free_hw(struct ieee80211_hw *hw);
3163 */ 3155 */
3164void ieee80211_restart_hw(struct ieee80211_hw *hw); 3156void ieee80211_restart_hw(struct ieee80211_hw *hw);
3165 3157
3166/** ieee80211_napi_schedule - schedule NAPI poll 3158/**
3167 * 3159 * ieee80211_napi_add - initialize mac80211 NAPI context
3168 * Use this function to schedule NAPI polling on a device. 3160 * @hw: the hardware to initialize the NAPI context on
3169 * 3161 * @napi: the NAPI context to initialize
3170 * @hw: the hardware to start polling 3162 * @napi_dev: dummy NAPI netdevice, here to not waste the space if the
3171 */ 3163 * driver doesn't use NAPI
3172void ieee80211_napi_schedule(struct ieee80211_hw *hw); 3164 * @poll: poll function
3173 3165 * @weight: default weight
3174/** ieee80211_napi_complete - complete NAPI polling
3175 *
3176 * Use this function to finish NAPI polling on a device.
3177 * 3166 *
3178 * @hw: the hardware to stop polling 3167 * See also netif_napi_add().
3179 */ 3168 */
3180void ieee80211_napi_complete(struct ieee80211_hw *hw); 3169void ieee80211_napi_add(struct ieee80211_hw *hw, struct napi_struct *napi,
3170 struct net_device *napi_dev,
3171 int (*poll)(struct napi_struct *, int),
3172 int weight);
3181 3173
3182/** 3174/**
3183 * ieee80211_rx - receive frame 3175 * ieee80211_rx - receive frame
@@ -3452,13 +3444,13 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
3452 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3444 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3453 * 3445 *
3454 * After a channel switch announcement was scheduled and the counter in this 3446 * After a channel switch announcement was scheduled and the counter in this
3455 * announcement hit zero, this function must be called by the driver to 3447 * announcement hits 1, this function must be called by the driver to
3456 * notify mac80211 that the channel can be changed. 3448 * notify mac80211 that the channel can be changed.
3457 */ 3449 */
3458void ieee80211_csa_finish(struct ieee80211_vif *vif); 3450void ieee80211_csa_finish(struct ieee80211_vif *vif);
3459 3451
3460/** 3452/**
3461 * ieee80211_csa_is_complete - find out if counters reached zero 3453 * ieee80211_csa_is_complete - find out if counters reached 1
3462 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3454 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3463 * 3455 *
3464 * This function returns whether the channel switch counters reached zero. 3456 * This function returns whether the channel switch counters reached zero.
@@ -4451,7 +4443,6 @@ struct ieee80211_tx_rate_control {
4451}; 4443};
4452 4444
4453struct rate_control_ops { 4445struct rate_control_ops {
4454 struct module *module;
4455 const char *name; 4446 const char *name;
4456 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); 4447 void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir);
4457 void (*free)(void *priv); 4448 void (*free)(void *priv);
@@ -4553,8 +4544,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
4553 struct ieee80211_sta *pubsta, 4544 struct ieee80211_sta *pubsta,
4554 struct ieee80211_sta_rates *rates); 4545 struct ieee80211_sta_rates *rates);
4555 4546
4556int ieee80211_rate_control_register(struct rate_control_ops *ops); 4547int ieee80211_rate_control_register(const struct rate_control_ops *ops);
4557void ieee80211_rate_control_unregister(struct rate_control_ops *ops); 4548void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
4558 4549
4559static inline bool 4550static inline bool
4560conf_is_ht20(struct ieee80211_conf *conf) 4551conf_is_ht20(struct ieee80211_conf *conf)
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 807d6b7a943f..a591053cae63 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -20,6 +20,7 @@
20#define NET_MAC802154_H 20#define NET_MAC802154_H
21 21
22#include <net/af_ieee802154.h> 22#include <net/af_ieee802154.h>
23#include <linux/skbuff.h>
23 24
24/* General MAC frame format: 25/* General MAC frame format:
25 * 2 bytes: Frame Control 26 * 2 bytes: Frame Control
@@ -50,7 +51,7 @@ struct ieee802154_hw_addr_filt {
50 * devices across independent networks. 51 * devices across independent networks.
51 */ 52 */
52 __le16 short_addr; 53 __le16 short_addr;
53 u8 ieee_addr[IEEE802154_ADDR_LEN]; 54 __le64 ieee_addr;
54 u8 pan_coord; 55 u8 pan_coord;
55}; 56};
56 57
@@ -113,6 +114,32 @@ struct ieee802154_dev {
113 * Set radio for listening on specific address. 114 * Set radio for listening on specific address.
114 * Set the device for listening on specified address. 115 * Set the device for listening on specified address.
115 * Returns either zero, or negative errno. 116 * Returns either zero, or negative errno.
117 *
118 * set_txpower:
119 * Set radio transmit power in dB. Called with pib_lock held.
120 * Returns either zero, or negative errno.
121 *
122 * set_lbt
123 * Enables or disables listen before talk on the device. Called with
124 * pib_lock held.
125 * Returns either zero, or negative errno.
126 *
127 * set_cca_mode
128 * Sets the CCA mode used by the device. Called with pib_lock held.
129 * Returns either zero, or negative errno.
130 *
131 * set_cca_ed_level
132 * Sets the CCA energy detection threshold in dBm. Called with pib_lock
133 * held.
134 * Returns either zero, or negative errno.
135 *
136 * set_csma_params
137 * Sets the CSMA parameter set for the PHY. Called with pib_lock held.
138 * Returns either zero, or negative errno.
139 *
140 * set_frame_retries
141 * Sets the retransmission attempt limit. Called with pib_lock held.
142 * Returns either zero, or negative errno.
116 */ 143 */
117struct ieee802154_ops { 144struct ieee802154_ops {
118 struct module *owner; 145 struct module *owner;
@@ -127,8 +154,16 @@ struct ieee802154_ops {
127 int (*set_hw_addr_filt)(struct ieee802154_dev *dev, 154 int (*set_hw_addr_filt)(struct ieee802154_dev *dev,
128 struct ieee802154_hw_addr_filt *filt, 155 struct ieee802154_hw_addr_filt *filt,
129 unsigned long changed); 156 unsigned long changed);
130 int (*ieee_addr)(struct ieee802154_dev *dev, 157 int (*ieee_addr)(struct ieee802154_dev *dev, __le64 addr);
131 u8 addr[IEEE802154_ADDR_LEN]); 158 int (*set_txpower)(struct ieee802154_dev *dev, int db);
159 int (*set_lbt)(struct ieee802154_dev *dev, bool on);
160 int (*set_cca_mode)(struct ieee802154_dev *dev, u8 mode);
161 int (*set_cca_ed_level)(struct ieee802154_dev *dev,
162 s32 level);
163 int (*set_csma_params)(struct ieee802154_dev *dev,
164 u8 min_be, u8 max_be, u8 retries);
165 int (*set_frame_retries)(struct ieee802154_dev *dev,
166 s8 retries);
132}; 167};
133 168
134/* Basic interface to register ieee802154 device */ 169/* Basic interface to register ieee802154 device */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 991dcd94cbbf..79387f73f875 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/ieee802154_6lowpan.h>
18#include <net/netns/sctp.h> 19#include <net/netns/sctp.h>
19#include <net/netns/dccp.h> 20#include <net/netns/dccp.h>
20#include <net/netns/netfilter.h> 21#include <net/netns/netfilter.h>
@@ -90,6 +91,9 @@ struct net {
90#if IS_ENABLED(CONFIG_IPV6) 91#if IS_ENABLED(CONFIG_IPV6)
91 struct netns_ipv6 ipv6; 92 struct netns_ipv6 ipv6;
92#endif 93#endif
94#if IS_ENABLED(CONFIG_IEEE802154_6LOWPAN)
95 struct netns_ieee802154_lowpan ieee802154_lowpan;
96#endif
93#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE) 97#if defined(CONFIG_IP_SCTP) || defined(CONFIG_IP_SCTP_MODULE)
94 struct netns_sctp sctp; 98 struct netns_sctp sctp;
95#endif 99#endif
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index b2ac6246b7e0..37252f71a380 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -73,10 +73,17 @@ struct nf_conn_help {
73 73
74struct nf_conn { 74struct nf_conn {
75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb, 75 /* Usage count in here is 1 for hash table/destruct timer, 1 per skb,
76 plus 1 for any connection(s) we are `master' for */ 76 * plus 1 for any connection(s) we are `master' for
77 *
78 * Hint, SKB address this struct and refcnt via skb->nfct and
79 * helpers nf_conntrack_get() and nf_conntrack_put().
80 * Helper nf_ct_put() equals nf_conntrack_put() by dec refcnt,
81 * beware nf_ct_get() is different and don't inc refcnt.
82 */
77 struct nf_conntrack ct_general; 83 struct nf_conntrack ct_general;
78 84
79 spinlock_t lock; 85 spinlock_t lock;
86 u16 cpu;
80 87
81 /* XXX should I move this to the tail ? - Y.K */ 88 /* XXX should I move this to the tail ? - Y.K */
82 /* These are my tuples; original and reply */ 89 /* These are my tuples; original and reply */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 15308b8eb5b5..cc0c18827602 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -77,6 +77,13 @@ print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
77 const struct nf_conntrack_l3proto *l3proto, 77 const struct nf_conntrack_l3proto *l3proto,
78 const struct nf_conntrack_l4proto *proto); 78 const struct nf_conntrack_l4proto *proto);
79 79
80extern spinlock_t nf_conntrack_lock ; 80#ifdef CONFIG_LOCKDEP
81# define CONNTRACK_LOCKS 8
82#else
83# define CONNTRACK_LOCKS 1024
84#endif
85extern spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS];
86
87extern spinlock_t nf_conntrack_expect_lock;
81 88
82#endif /* _NF_CONNTRACK_CORE_H */ 89#endif /* _NF_CONNTRACK_CORE_H */
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 956b175523ff..55d15049ab2f 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -47,8 +47,8 @@ enum nf_ct_ext_id {
47/* Extensions: optional stuff which isn't permanently in struct. */ 47/* Extensions: optional stuff which isn't permanently in struct. */
48struct nf_ct_ext { 48struct nf_ct_ext {
49 struct rcu_head rcu; 49 struct rcu_head rcu;
50 u8 offset[NF_CT_EXT_NUM]; 50 u16 offset[NF_CT_EXT_NUM];
51 u8 len; 51 u16 len;
52 char data[0]; 52 char data[0];
53}; 53};
54 54
diff --git a/include/net/netfilter/nf_conntrack_labels.h b/include/net/netfilter/nf_conntrack_labels.h
index c985695283b3..dec6336bf850 100644
--- a/include/net/netfilter/nf_conntrack_labels.h
+++ b/include/net/netfilter/nf_conntrack_labels.h
@@ -7,6 +7,8 @@
7 7
8#include <uapi/linux/netfilter/xt_connlabel.h> 8#include <uapi/linux/netfilter/xt_connlabel.h>
9 9
10#define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE)
11
10struct nf_conn_labels { 12struct nf_conn_labels {
11 u8 words; 13 u8 words;
12 unsigned long bits[]; 14 unsigned long bits[];
@@ -29,7 +31,7 @@ static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
29 u8 words; 31 u8 words;
30 32
31 words = ACCESS_ONCE(net->ct.label_words); 33 words = ACCESS_ONCE(net->ct.label_words);
32 if (words == 0 || WARN_ON_ONCE(words > 8)) 34 if (words == 0)
33 return NULL; 35 return NULL;
34 36
35 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS, 37 cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
index e7e14ffe0f6a..e6bc14d8fa9a 100644
--- a/include/net/netfilter/nf_tables.h
+++ b/include/net/netfilter/nf_tables.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/netfilter.h> 5#include <linux/netfilter.h>
6#include <linux/netfilter/nfnetlink.h>
6#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h> 8#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h> 9#include <net/netlink.h>
@@ -288,7 +289,8 @@ struct nft_expr_ops {
288 int (*init)(const struct nft_ctx *ctx, 289 int (*init)(const struct nft_ctx *ctx,
289 const struct nft_expr *expr, 290 const struct nft_expr *expr,
290 const struct nlattr * const tb[]); 291 const struct nlattr * const tb[]);
291 void (*destroy)(const struct nft_expr *expr); 292 void (*destroy)(const struct nft_ctx *ctx,
293 const struct nft_expr *expr);
292 int (*dump)(struct sk_buff *skb, 294 int (*dump)(struct sk_buff *skb,
293 const struct nft_expr *expr); 295 const struct nft_expr *expr);
294 int (*validate)(const struct nft_ctx *ctx, 296 int (*validate)(const struct nft_ctx *ctx,
@@ -325,13 +327,15 @@ static inline void *nft_expr_priv(const struct nft_expr *expr)
325 * @handle: rule handle 327 * @handle: rule handle
326 * @genmask: generation mask 328 * @genmask: generation mask
327 * @dlen: length of expression data 329 * @dlen: length of expression data
330 * @ulen: length of user data (used for comments)
328 * @data: expression data 331 * @data: expression data
329 */ 332 */
330struct nft_rule { 333struct nft_rule {
331 struct list_head list; 334 struct list_head list;
332 u64 handle:46, 335 u64 handle:42,
333 genmask:2, 336 genmask:2,
334 dlen:16; 337 dlen:12,
338 ulen:8;
335 unsigned char data[] 339 unsigned char data[]
336 __attribute__((aligned(__alignof__(struct nft_expr)))); 340 __attribute__((aligned(__alignof__(struct nft_expr))));
337}; 341};
@@ -340,19 +344,13 @@ struct nft_rule {
340 * struct nft_rule_trans - nf_tables rule update in transaction 344 * struct nft_rule_trans - nf_tables rule update in transaction
341 * 345 *
342 * @list: used internally 346 * @list: used internally
347 * @ctx: rule context
343 * @rule: rule that needs to be updated 348 * @rule: rule that needs to be updated
344 * @chain: chain that this rule belongs to
345 * @table: table for which this chain applies
346 * @nlh: netlink header of the message that contain this update
347 * @family: family expressesed as AF_*
348 */ 349 */
349struct nft_rule_trans { 350struct nft_rule_trans {
350 struct list_head list; 351 struct list_head list;
352 struct nft_ctx ctx;
351 struct nft_rule *rule; 353 struct nft_rule *rule;
352 const struct nft_chain *chain;
353 const struct nft_table *table;
354 const struct nlmsghdr *nlh;
355 u8 family;
356}; 354};
357 355
358static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule) 356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
@@ -370,6 +368,11 @@ static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
370 return (struct nft_expr *)&rule->data[rule->dlen]; 368 return (struct nft_expr *)&rule->data[rule->dlen];
371} 369}
372 370
371static inline void *nft_userdata(const struct nft_rule *rule)
372{
373 return (void *)&rule->data[rule->dlen];
374}
375
373/* 376/*
374 * The last pointer isn't really necessary, but the compiler isn't able to 377 * The last pointer isn't really necessary, but the compiler isn't able to
375 * determine that the result of nft_expr_last() is always the same since it 378 * determine that the result of nft_expr_last() is always the same since it
@@ -521,6 +524,9 @@ void nft_unregister_chain_type(const struct nf_chain_type *);
521int nft_register_expr(struct nft_expr_type *); 524int nft_register_expr(struct nft_expr_type *);
522void nft_unregister_expr(struct nft_expr_type *); 525void nft_unregister_expr(struct nft_expr_type *);
523 526
527#define nft_dereference(p) \
528 nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)
529
524#define MODULE_ALIAS_NFT_FAMILY(family) \ 530#define MODULE_ALIAS_NFT_FAMILY(family) \
525 MODULE_ALIAS("nft-afinfo-" __stringify(family)) 531 MODULE_ALIAS("nft-afinfo-" __stringify(family))
526 532
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index fbcc7fa536dc..773cce308bc6 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -5,6 +5,7 @@
5#include <linux/list_nulls.h> 5#include <linux/list_nulls.h>
6#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <linux/netfilter/nf_conntrack_tcp.h> 7#include <linux/netfilter/nf_conntrack_tcp.h>
8#include <linux/seqlock.h>
8 9
9struct ctl_table_header; 10struct ctl_table_header;
10struct nf_conntrack_ecache; 11struct nf_conntrack_ecache;
@@ -62,6 +63,13 @@ struct nf_ip_net {
62#endif 63#endif
63}; 64};
64 65
66struct ct_pcpu {
67 spinlock_t lock;
68 struct hlist_nulls_head unconfirmed;
69 struct hlist_nulls_head dying;
70 struct hlist_nulls_head tmpl;
71};
72
65struct netns_ct { 73struct netns_ct {
66 atomic_t count; 74 atomic_t count;
67 unsigned int expect_count; 75 unsigned int expect_count;
@@ -83,12 +91,11 @@ struct netns_ct {
83 int sysctl_checksum; 91 int sysctl_checksum;
84 92
85 unsigned int htable_size; 93 unsigned int htable_size;
94 seqcount_t generation;
86 struct kmem_cache *nf_conntrack_cachep; 95 struct kmem_cache *nf_conntrack_cachep;
87 struct hlist_nulls_head *hash; 96 struct hlist_nulls_head *hash;
88 struct hlist_head *expect_hash; 97 struct hlist_head *expect_hash;
89 struct hlist_nulls_head unconfirmed; 98 struct ct_pcpu __percpu *pcpu_lists;
90 struct hlist_nulls_head dying;
91 struct hlist_nulls_head tmpl;
92 struct ip_conntrack_stat __percpu *stat; 99 struct ip_conntrack_stat __percpu *stat;
93 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb; 100 struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
94 struct nf_exp_event_notifier __rcu *nf_expect_event_cb; 101 struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
diff --git a/include/net/netns/ieee802154_6lowpan.h b/include/net/netns/ieee802154_6lowpan.h
new file mode 100644
index 000000000000..079030c853d8
--- /dev/null
+++ b/include/net/netns/ieee802154_6lowpan.h
@@ -0,0 +1,22 @@
1/*
2 * ieee802154 6lowpan in net namespaces
3 */
4
5#include <net/inet_frag.h>
6
7#ifndef __NETNS_IEEE802154_6LOWPAN_H__
8#define __NETNS_IEEE802154_6LOWPAN_H__
9
10struct netns_sysctl_lowpan {
11#ifdef CONFIG_SYSCTL
12 struct ctl_table_header *frags_hdr;
13#endif
14};
15
16struct netns_ieee802154_lowpan {
17 struct netns_sysctl_lowpan sysctl;
18 struct netns_frags frags;
19 u16 max_dsize;
20};
21
22#endif
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 1006a265beb3..3492434baf88 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -6,6 +6,7 @@
6#include <linux/workqueue.h> 6#include <linux/workqueue.h>
7#include <linux/xfrm.h> 7#include <linux/xfrm.h>
8#include <net/dst_ops.h> 8#include <net/dst_ops.h>
9#include <net/flowcache.h>
9 10
10struct ctl_table_header; 11struct ctl_table_header;
11 12
@@ -58,9 +59,17 @@ struct netns_xfrm {
58 struct dst_ops xfrm6_dst_ops; 59 struct dst_ops xfrm6_dst_ops;
59#endif 60#endif
60 spinlock_t xfrm_state_lock; 61 spinlock_t xfrm_state_lock;
61 spinlock_t xfrm_policy_sk_bundle_lock;
62 rwlock_t xfrm_policy_lock; 62 rwlock_t xfrm_policy_lock;
63 struct mutex xfrm_cfg_mutex; 63 struct mutex xfrm_cfg_mutex;
64
65 /* flow cache part */
66 struct flow_cache flow_cache_global;
67 atomic_t flow_cache_genid;
68 struct list_head flow_cache_gc_list;
69 spinlock_t flow_cache_gc_lock;
70 struct work_struct flow_cache_gc_work;
71 struct work_struct flow_cache_flush_work;
72 struct mutex flow_flush_sem;
64}; 73};
65 74
66#endif 75#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index dafc09f0fdbc..f2a9597ff53c 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -27,32 +27,17 @@ struct netprio_map {
27 27
28void sock_update_netprioidx(struct sock *sk); 28void sock_update_netprioidx(struct sock *sk);
29 29
30#if IS_BUILTIN(CONFIG_CGROUP_NET_PRIO)
31static inline u32 task_netprioidx(struct task_struct *p) 30static inline u32 task_netprioidx(struct task_struct *p)
32{ 31{
33 struct cgroup_subsys_state *css; 32 struct cgroup_subsys_state *css;
34 u32 idx; 33 u32 idx;
35 34
36 rcu_read_lock(); 35 rcu_read_lock();
37 css = task_css(p, net_prio_subsys_id); 36 css = task_css(p, net_prio_cgrp_id);
38 idx = css->cgroup->id; 37 idx = css->cgroup->id;
39 rcu_read_unlock(); 38 rcu_read_unlock();
40 return idx; 39 return idx;
41} 40}
42#elif IS_MODULE(CONFIG_CGROUP_NET_PRIO)
43static inline u32 task_netprioidx(struct task_struct *p)
44{
45 struct cgroup_subsys_state *css;
46 u32 idx = 0;
47
48 rcu_read_lock();
49 css = task_css(p, net_prio_subsys_id);
50 if (css)
51 idx = css->cgroup->id;
52 rcu_read_unlock();
53 return idx;
54}
55#endif
56#else /* !CONFIG_CGROUP_NET_PRIO */ 41#else /* !CONFIG_CGROUP_NET_PRIO */
57static inline u32 task_netprioidx(struct task_struct *p) 42static inline u32 task_netprioidx(struct task_struct *p)
58{ 43{
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
index 81af21e9bcd4..7655cfe27c34 100644
--- a/include/net/nfc/digital.h
+++ b/include/net/nfc/digital.h
@@ -35,6 +35,7 @@ enum {
35 NFC_DIGITAL_RF_TECH_106A = 0, 35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F, 36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F, 37 NFC_DIGITAL_RF_TECH_424F,
38 NFC_DIGITAL_RF_TECH_ISO15693,
38 39
39 NFC_DIGITAL_RF_TECH_LAST, 40 NFC_DIGITAL_RF_TECH_LAST,
40}; 41};
@@ -50,6 +51,7 @@ enum {
50 51
51 NFC_DIGITAL_FRAMING_NFCA_T1T, 52 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T, 53 NFC_DIGITAL_FRAMING_NFCA_T2T,
54 NFC_DIGITAL_FRAMING_NFCA_T4T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP, 55 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54 56
55 NFC_DIGITAL_FRAMING_NFCF, 57 NFC_DIGITAL_FRAMING_NFCF,
@@ -57,6 +59,9 @@ enum {
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP, 59 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED, 60 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59 61
62 NFC_DIGITAL_FRAMING_ISO15693_INVENTORY,
63 NFC_DIGITAL_FRAMING_ISO15693_T5T,
64
60 NFC_DIGITAL_FRAMING_LAST, 65 NFC_DIGITAL_FRAMING_LAST,
61}; 66};
62 67
@@ -204,6 +209,8 @@ struct nfc_digital_dev {
204 u8 curr_rf_tech; 209 u8 curr_rf_tech;
205 u8 curr_nfc_dep_pni; 210 u8 curr_nfc_dep_pni;
206 211
212 u16 target_fsc;
213
207 int (*skb_check_crc)(struct sk_buff *skb); 214 int (*skb_check_crc)(struct sk_buff *skb);
208 void (*skb_add_crc)(struct sk_buff *skb); 215 void (*skb_add_crc)(struct sk_buff *skb);
209}; 216};
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index e80894bca1d0..2e8b40c16274 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -111,6 +111,9 @@ struct nfc_target {
111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE]; 111 u8 sensf_res[NFC_SENSF_RES_MAXSIZE];
112 u8 hci_reader_gate; 112 u8 hci_reader_gate;
113 u8 logical_idx; 113 u8 logical_idx;
114 u8 is_iso15693;
115 u8 iso15693_dsfid;
116 u8 iso15693_uid[NFC_ISO15693_UID_MAXSIZE];
114}; 117};
115 118
116/** 119/**
diff --git a/include/net/nl802154.h b/include/net/nl802154.h
index 99d2ba1c7e03..b23548e04098 100644
--- a/include/net/nl802154.h
+++ b/include/net/nl802154.h
@@ -52,7 +52,7 @@ int ieee802154_nl_assoc_indic(struct net_device *dev,
52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document. 52 * Note: This is in section 7.3.2 of the IEEE 802.15.4 document.
53 */ 53 */
54int ieee802154_nl_assoc_confirm(struct net_device *dev, 54int ieee802154_nl_assoc_confirm(struct net_device *dev,
55 u16 short_addr, u8 status); 55 __le16 short_addr, u8 status);
56 56
57/** 57/**
58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation. 58 * ieee802154_nl_disassoc_indic - Notify userland of disassociation.
@@ -111,8 +111,8 @@ int ieee802154_nl_scan_confirm(struct net_device *dev,
111 * Note: This API cannot indicate a beacon frame for a coordinator 111 * Note: This API cannot indicate a beacon frame for a coordinator
112 * operating in long addressing mode. 112 * operating in long addressing mode.
113 */ 113 */
114int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid, 114int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
115 u16 coord_addr); 115 __le16 coord_addr);
116 116
117/** 117/**
118 * ieee802154_nl_start_confirm - Notify userland of completion of start. 118 * ieee802154_nl_start_confirm - Notify userland of completion of start.
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index b07cdc9fa454..75fc1f5a948d 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -155,6 +155,7 @@ struct ieee80211_reg_rule {
155 struct ieee80211_freq_range freq_range; 155 struct ieee80211_freq_range freq_range;
156 struct ieee80211_power_rule power_rule; 156 struct ieee80211_power_rule power_rule;
157 u32 flags; 157 u32 flags;
158 u32 dfs_cac_ms;
158}; 159};
159 160
160struct ieee80211_regdomain { 161struct ieee80211_regdomain {
@@ -172,14 +173,18 @@ struct ieee80211_regdomain {
172#define DBM_TO_MBM(gain) ((gain) * 100) 173#define DBM_TO_MBM(gain) ((gain) * 100)
173#define MBM_TO_DBM(gain) ((gain) / 100) 174#define MBM_TO_DBM(gain) ((gain) / 100)
174 175
175#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ 176#define REG_RULE_EXT(start, end, bw, gain, eirp, dfs_cac, reg_flags) \
176{ \ 177{ \
177 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ 178 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
178 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ 179 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
179 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ 180 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
180 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ 181 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
181 .power_rule.max_eirp = DBM_TO_MBM(eirp), \ 182 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
182 .flags = reg_flags, \ 183 .flags = reg_flags, \
184 .dfs_cac_ms = dfs_cac, \
183} 185}
184 186
187#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
188 REG_RULE_EXT(start, end, bw, gain, eirp, 0, reg_flags)
189
185#endif 190#endif
diff --git a/include/net/route.h b/include/net/route.h
index 9d1f423d5944..b17cf28f996e 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -191,7 +191,6 @@ unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
191void ip_rt_multicast_event(struct in_device *); 191void ip_rt_multicast_event(struct in_device *);
192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 192int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 193void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
194int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
195 194
196struct in_ifaddr; 195struct in_ifaddr;
197void fib_add_ifaddr(struct in_ifaddr *); 196void fib_add_ifaddr(struct in_ifaddr *);
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 661e45d38051..72240e5ac2c4 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -140,7 +140,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
140 struct nlattr *tb[]); 140 struct nlattr *tb[]);
141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm); 141int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
142 142
143extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 143int rtnl_nla_parse_ifla(struct nlattr **tb, const struct nlattr *head, int len);
144 144
145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 145#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
146 146
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index a3353f45ef94..8e4de46c052e 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -101,7 +101,7 @@ void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
101int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 101int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
102int sctp_inet_listen(struct socket *sock, int backlog); 102int sctp_inet_listen(struct socket *sock, int backlog);
103void sctp_write_space(struct sock *sk); 103void sctp_write_space(struct sock *sk);
104void sctp_data_ready(struct sock *sk, int len); 104void sctp_data_ready(struct sock *sk);
105unsigned int sctp_poll(struct file *file, struct socket *sock, 105unsigned int sctp_poll(struct file *file, struct socket *sock,
106 poll_table *wait); 106 poll_table *wait);
107void sctp_sock_rfree(struct sk_buff *skb); 107void sctp_sock_rfree(struct sk_buff *skb);
diff --git a/include/net/sock.h b/include/net/sock.h
index b9586a137cad..8338a14e4805 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -418,7 +418,7 @@ struct sock {
418 u32 sk_classid; 418 u32 sk_classid;
419 struct cg_proto *sk_cgrp; 419 struct cg_proto *sk_cgrp;
420 void (*sk_state_change)(struct sock *sk); 420 void (*sk_state_change)(struct sock *sk);
421 void (*sk_data_ready)(struct sock *sk, int bytes); 421 void (*sk_data_ready)(struct sock *sk);
422 void (*sk_write_space)(struct sock *sk); 422 void (*sk_write_space)(struct sock *sk);
423 void (*sk_error_report)(struct sock *sk); 423 void (*sk_error_report)(struct sock *sk);
424 int (*sk_backlog_rcv)(struct sock *sk, 424 int (*sk_backlog_rcv)(struct sock *sk,
@@ -862,9 +862,9 @@ static inline void sock_rps_save_rxhash(struct sock *sk,
862 const struct sk_buff *skb) 862 const struct sk_buff *skb)
863{ 863{
864#ifdef CONFIG_RPS 864#ifdef CONFIG_RPS
865 if (unlikely(sk->sk_rxhash != skb->rxhash)) { 865 if (unlikely(sk->sk_rxhash != skb->hash)) {
866 sock_rps_reset_flow(sk); 866 sock_rps_reset_flow(sk);
867 sk->sk_rxhash = skb->rxhash; 867 sk->sk_rxhash = skb->hash;
868 } 868 }
869#endif 869#endif
870} 870}
@@ -1621,33 +1621,6 @@ void sk_common_release(struct sock *sk);
1621/* Initialise core socket variables */ 1621/* Initialise core socket variables */
1622void sock_init_data(struct socket *sock, struct sock *sk); 1622void sock_init_data(struct socket *sock, struct sock *sk);
1623 1623
1624void sk_filter_release_rcu(struct rcu_head *rcu);
1625
1626/**
1627 * sk_filter_release - release a socket filter
1628 * @fp: filter to remove
1629 *
1630 * Remove a filter from a socket and release its resources.
1631 */
1632
1633static inline void sk_filter_release(struct sk_filter *fp)
1634{
1635 if (atomic_dec_and_test(&fp->refcnt))
1636 call_rcu(&fp->rcu, sk_filter_release_rcu);
1637}
1638
1639static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
1640{
1641 atomic_sub(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1642 sk_filter_release(fp);
1643}
1644
1645static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
1646{
1647 atomic_inc(&fp->refcnt);
1648 atomic_add(sk_filter_size(fp->len), &sk->sk_omem_alloc);
1649}
1650
1651/* 1624/*
1652 * Socket reference counting postulates. 1625 * Socket reference counting postulates.
1653 * 1626 *
@@ -2256,8 +2229,12 @@ void sock_net_set(struct sock *sk, struct net *net)
2256 */ 2229 */
2257static inline void sk_change_net(struct sock *sk, struct net *net) 2230static inline void sk_change_net(struct sock *sk, struct net *net)
2258{ 2231{
2259 put_net(sock_net(sk)); 2232 struct net *current_net = sock_net(sk);
2260 sock_net_set(sk, hold_net(net)); 2233
2234 if (!net_eq(current_net, net)) {
2235 put_net(current_net);
2236 sock_net_set(sk, hold_net(net));
2237 }
2261} 2238}
2262 2239
2263static inline struct sock *skb_steal_sock(struct sk_buff *skb) 2240static inline struct sock *skb_steal_sock(struct sk_buff *skb)
diff --git a/include/net/tc_act/tc_csum.h b/include/net/tc_act/tc_csum.h
index 9e8710be7a04..fa8f5fac65e9 100644
--- a/include/net/tc_act/tc_csum.h
+++ b/include/net/tc_act/tc_csum.h
@@ -9,7 +9,7 @@ struct tcf_csum {
9 9
10 u32 update_flags; 10 u32 update_flags;
11}; 11};
12#define to_tcf_csum(pc) \ 12#define to_tcf_csum(a) \
13 container_of(pc,struct tcf_csum,common) 13 container_of(a->priv,struct tcf_csum,common)
14 14
15#endif /* __NET_TC_CSUM_H */ 15#endif /* __NET_TC_CSUM_H */
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
index 65f024b80958..9763dcbb9bc3 100644
--- a/include/net/tc_act/tc_defact.h
+++ b/include/net/tc_act/tc_defact.h
@@ -8,7 +8,7 @@ struct tcf_defact {
8 u32 tcfd_datalen; 8 u32 tcfd_datalen;
9 void *tcfd_defdata; 9 void *tcfd_defdata;
10}; 10};
11#define to_defact(pc) \ 11#define to_defact(a) \
12 container_of(pc, struct tcf_defact, common) 12 container_of(a->priv, struct tcf_defact, common)
13 13
14#endif /* __NET_TC_DEF_H */ 14#endif /* __NET_TC_DEF_H */
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 9e3f6767b80e..9fc9b578908a 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -11,7 +11,7 @@ struct tcf_gact {
11 int tcfg_paction; 11 int tcfg_paction;
12#endif 12#endif
13}; 13};
14#define to_gact(pc) \ 14#define to_gact(a) \
15 container_of(pc, struct tcf_gact, common) 15 container_of(a->priv, struct tcf_gact, common)
16 16
17#endif /* __NET_TC_GACT_H */ 17#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index f7d25dfcc4b7..c0f4193f432c 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -11,7 +11,7 @@ struct tcf_ipt {
11 char *tcfi_tname; 11 char *tcfi_tname;
12 struct xt_entry_target *tcfi_t; 12 struct xt_entry_target *tcfi_t;
13}; 13};
14#define to_ipt(pc) \ 14#define to_ipt(a) \
15 container_of(pc, struct tcf_ipt, common) 15 container_of(a->priv, struct tcf_ipt, common)
16 16
17#endif /* __NET_TC_IPT_H */ 17#endif /* __NET_TC_IPT_H */
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index cfe2943690ff..4dd77a1c106b 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -11,7 +11,7 @@ struct tcf_mirred {
11 struct net_device *tcfm_dev; 11 struct net_device *tcfm_dev;
12 struct list_head tcfm_list; 12 struct list_head tcfm_list;
13}; 13};
14#define to_mirred(pc) \ 14#define to_mirred(a) \
15 container_of(pc, struct tcf_mirred, common) 15 container_of(a->priv, struct tcf_mirred, common)
16 16
17#endif /* __NET_TC_MIR_H */ 17#endif /* __NET_TC_MIR_H */
diff --git a/include/net/tc_act/tc_nat.h b/include/net/tc_act/tc_nat.h
index 4a691f34d703..63d8e9ca9d99 100644
--- a/include/net/tc_act/tc_nat.h
+++ b/include/net/tc_act/tc_nat.h
@@ -13,9 +13,9 @@ struct tcf_nat {
13 u32 flags; 13 u32 flags;
14}; 14};
15 15
16static inline struct tcf_nat *to_tcf_nat(struct tcf_common *pc) 16static inline struct tcf_nat *to_tcf_nat(struct tc_action *a)
17{ 17{
18 return container_of(pc, struct tcf_nat, common); 18 return container_of(a->priv, struct tcf_nat, common);
19} 19}
20 20
21#endif /* __NET_TC_NAT_H */ 21#endif /* __NET_TC_NAT_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index e6f6e15956f5..5b80998879c7 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -9,7 +9,7 @@ struct tcf_pedit {
9 unsigned char tcfp_flags; 9 unsigned char tcfp_flags;
10 struct tc_pedit_key *tcfp_keys; 10 struct tc_pedit_key *tcfp_keys;
11}; 11};
12#define to_pedit(pc) \ 12#define to_pedit(a) \
13 container_of(pc, struct tcf_pedit, common) 13 container_of(a->priv, struct tcf_pedit, common)
14 14
15#endif /* __NET_TC_PED_H */ 15#endif /* __NET_TC_PED_H */
diff --git a/include/net/tc_act/tc_skbedit.h b/include/net/tc_act/tc_skbedit.h
index dd5d86fab030..0df9a0db4a8e 100644
--- a/include/net/tc_act/tc_skbedit.h
+++ b/include/net/tc_act/tc_skbedit.h
@@ -29,7 +29,7 @@ struct tcf_skbedit {
29 u16 queue_mapping; 29 u16 queue_mapping;
30 /* XXX: 16-bit pad here? */ 30 /* XXX: 16-bit pad here? */
31}; 31};
32#define to_skbedit(pc) \ 32#define to_skbedit(a) \
33 container_of(pc, struct tcf_skbedit, common) 33 container_of(a->priv, struct tcf_skbedit, common)
34 34
35#endif /* __NET_TC_SKBEDIT_H */ 35#endif /* __NET_TC_SKBEDIT_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 743accec6c76..87d877408188 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -31,6 +31,7 @@
31#include <linux/crypto.h> 31#include <linux/crypto.h>
32#include <linux/cryptohash.h> 32#include <linux/cryptohash.h>
33#include <linux/kref.h> 33#include <linux/kref.h>
34#include <linux/ktime.h>
34 35
35#include <net/inet_connection_sock.h> 36#include <net/inet_connection_sock.h>
36#include <net/inet_timewait_sock.h> 37#include <net/inet_timewait_sock.h>
@@ -478,7 +479,6 @@ int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
478struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 479struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
479 struct ip_options *opt); 480 struct ip_options *opt);
480#ifdef CONFIG_SYN_COOKIES 481#ifdef CONFIG_SYN_COOKIES
481#include <linux/ktime.h>
482 482
483/* Syncookies use a monotonic timer which increments every 60 seconds. 483/* Syncookies use a monotonic timer which increments every 60 seconds.
484 * This counter is used both as a hash input and partially encoded into 484 * This counter is used both as a hash input and partially encoded into
@@ -620,7 +620,7 @@ static inline void tcp_bound_rto(const struct sock *sk)
620 620
621static inline u32 __tcp_set_rto(const struct tcp_sock *tp) 621static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
622{ 622{
623 return (tp->srtt >> 3) + tp->rttvar; 623 return usecs_to_jiffies((tp->srtt_us >> 3) + tp->rttvar_us);
624} 624}
625 625
626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 626static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
@@ -657,6 +657,11 @@ static inline u32 tcp_rto_min(struct sock *sk)
657 return rto_min; 657 return rto_min;
658} 658}
659 659
660static inline u32 tcp_rto_min_us(struct sock *sk)
661{
662 return jiffies_to_usecs(tcp_rto_min(sk));
663}
664
660/* Compute the actual receive window we are currently advertising. 665/* Compute the actual receive window we are currently advertising.
661 * Rcv_nxt can be after the window if our peer push more data 666 * Rcv_nxt can be after the window if our peer push more data
662 * than the offered window. 667 * than the offered window.
@@ -779,7 +784,6 @@ enum tcp_ca_event {
779#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX) 784#define TCP_CA_BUF_MAX (TCP_CA_NAME_MAX*TCP_CA_MAX)
780 785
781#define TCP_CONG_NON_RESTRICTED 0x1 786#define TCP_CONG_NON_RESTRICTED 0x1
782#define TCP_CONG_RTT_STAMP 0x2
783 787
784struct tcp_congestion_ops { 788struct tcp_congestion_ops {
785 struct list_head list; 789 struct list_head list;
@@ -792,8 +796,6 @@ struct tcp_congestion_ops {
792 796
793 /* return slow start threshold (required) */ 797 /* return slow start threshold (required) */
794 u32 (*ssthresh)(struct sock *sk); 798 u32 (*ssthresh)(struct sock *sk);
795 /* lower bound for congestion window (optional) */
796 u32 (*min_cwnd)(const struct sock *sk);
797 /* do new cwnd calculation (required) */ 799 /* do new cwnd calculation (required) */
798 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 800 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
799 /* call before changing ca_state (optional) */ 801 /* call before changing ca_state (optional) */
@@ -828,7 +830,6 @@ void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
828extern struct tcp_congestion_ops tcp_init_congestion_ops; 830extern struct tcp_congestion_ops tcp_init_congestion_ops;
829u32 tcp_reno_ssthresh(struct sock *sk); 831u32 tcp_reno_ssthresh(struct sock *sk);
830void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight); 832void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
831u32 tcp_reno_min_cwnd(const struct sock *sk);
832extern struct tcp_congestion_ops tcp_reno; 833extern struct tcp_congestion_ops tcp_reno;
833 834
834static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
diff --git a/include/net/wpan-phy.h b/include/net/wpan-phy.h
index b52bda8d13b1..10ab0fc6d4f7 100644
--- a/include/net/wpan-phy.h
+++ b/include/net/wpan-phy.h
@@ -37,15 +37,22 @@ struct wpan_phy {
37 struct mutex pib_lock; 37 struct mutex pib_lock;
38 38
39 /* 39 /*
40 * This is a PIB according to 802.15.4-2006. 40 * This is a PIB according to 802.15.4-2011.
41 * We do not provide timing-related variables, as they 41 * We do not provide timing-related variables, as they
42 * aren't used outside of driver 42 * aren't used outside of driver
43 */ 43 */
44 u8 current_channel; 44 u8 current_channel;
45 u8 current_page; 45 u8 current_page;
46 u32 channels_supported[32]; 46 u32 channels_supported[32];
47 u8 transmit_power; 47 s8 transmit_power;
48 u8 cca_mode; 48 u8 cca_mode;
49 u8 min_be;
50 u8 max_be;
51 u8 csma_retries;
52 s8 frame_retries;
53
54 bool lbt;
55 s32 cca_ed_level;
49 56
50 struct device dev; 57 struct device dev;
51 int idx; 58 int idx;
@@ -54,6 +61,14 @@ struct wpan_phy {
54 const char *name, int type); 61 const char *name, int type);
55 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); 62 void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
56 63
64 int (*set_txpower)(struct wpan_phy *phy, int db);
65 int (*set_lbt)(struct wpan_phy *phy, bool on);
66 int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode);
67 int (*set_cca_ed_level)(struct wpan_phy *phy, int level);
68 int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be,
69 u8 retries);
70 int (*set_frame_retries)(struct wpan_phy *phy, s8 retries);
71
57 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); 72 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
58}; 73};
59 74
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index fb5654a8ca3c..32682ae47b3f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -118,11 +118,10 @@
118struct xfrm_state_walk { 118struct xfrm_state_walk {
119 struct list_head all; 119 struct list_head all;
120 u8 state; 120 u8 state;
121 union { 121 u8 dying;
122 u8 dying; 122 u8 proto;
123 u8 proto;
124 };
125 u32 seq; 123 u32 seq;
124 struct xfrm_address_filter *filter;
126}; 125};
127 126
128/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
@@ -350,6 +349,16 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
350struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 349struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
351void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 350void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
352 351
352struct xfrm_input_afinfo {
353 unsigned int family;
354 struct module *owner;
355 int (*callback)(struct sk_buff *skb, u8 protocol,
356 int err);
357};
358
359int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo);
360int xfrm_input_unregister_afinfo(struct xfrm_input_afinfo *afinfo);
361
353void xfrm_state_delete_tunnel(struct xfrm_state *x); 362void xfrm_state_delete_tunnel(struct xfrm_state *x);
354 363
355struct xfrm_type { 364struct xfrm_type {
@@ -594,21 +603,33 @@ struct xfrm_mgr {
594 const struct xfrm_migrate *m, 603 const struct xfrm_migrate *m,
595 int num_bundles, 604 int num_bundles,
596 const struct xfrm_kmaddress *k); 605 const struct xfrm_kmaddress *k);
606 bool (*is_alive)(const struct km_event *c);
597}; 607};
598 608
599int xfrm_register_km(struct xfrm_mgr *km); 609int xfrm_register_km(struct xfrm_mgr *km);
600int xfrm_unregister_km(struct xfrm_mgr *km); 610int xfrm_unregister_km(struct xfrm_mgr *km);
601 611
612struct xfrm_tunnel_skb_cb {
613 union {
614 struct inet_skb_parm h4;
615 struct inet6_skb_parm h6;
616 } header;
617
618 union {
619 struct ip_tunnel *ip4;
620 struct ip6_tnl *ip6;
621 } tunnel;
622};
623
624#define XFRM_TUNNEL_SKB_CB(__skb) ((struct xfrm_tunnel_skb_cb *)&((__skb)->cb[0]))
625
602/* 626/*
603 * This structure is used for the duration where packets are being 627 * This structure is used for the duration where packets are being
604 * transformed by IPsec. As soon as the packet leaves IPsec the 628 * transformed by IPsec. As soon as the packet leaves IPsec the
605 * area beyond the generic IP part may be overwritten. 629 * area beyond the generic IP part may be overwritten.
606 */ 630 */
607struct xfrm_skb_cb { 631struct xfrm_skb_cb {
608 union { 632 struct xfrm_tunnel_skb_cb header;
609 struct inet_skb_parm h4;
610 struct inet6_skb_parm h6;
611 } header;
612 633
613 /* Sequence number for replay protection. */ 634 /* Sequence number for replay protection. */
614 union { 635 union {
@@ -630,10 +651,7 @@ struct xfrm_skb_cb {
630 * to transmit header information to the mode input/output functions. 651 * to transmit header information to the mode input/output functions.
631 */ 652 */
632struct xfrm_mode_skb_cb { 653struct xfrm_mode_skb_cb {
633 union { 654 struct xfrm_tunnel_skb_cb header;
634 struct inet_skb_parm h4;
635 struct inet6_skb_parm h6;
636 } header;
637 655
638 /* Copied from header for IPv4, always set to zero and DF for IPv6. */ 656 /* Copied from header for IPv4, always set to zero and DF for IPv6. */
639 __be16 id; 657 __be16 id;
@@ -665,10 +683,7 @@ struct xfrm_mode_skb_cb {
665 * related information. 683 * related information.
666 */ 684 */
667struct xfrm_spi_skb_cb { 685struct xfrm_spi_skb_cb {
668 union { 686 struct xfrm_tunnel_skb_cb header;
669 struct inet_skb_parm h4;
670 struct inet6_skb_parm h6;
671 } header;
672 687
673 unsigned int daddroff; 688 unsigned int daddroff;
674 unsigned int family; 689 unsigned int family;
@@ -1347,18 +1362,34 @@ struct xfrm_algo_desc {
1347 struct sadb_alg desc; 1362 struct sadb_alg desc;
1348}; 1363};
1349 1364
1350/* XFRM tunnel handlers. */ 1365/* XFRM protocol handlers. */
1351struct xfrm_tunnel { 1366struct xfrm4_protocol {
1352 int (*handler)(struct sk_buff *skb); 1367 int (*handler)(struct sk_buff *skb);
1368 int (*input_handler)(struct sk_buff *skb, int nexthdr, __be32 spi,
1369 int encap_type);
1370 int (*cb_handler)(struct sk_buff *skb, int err);
1353 int (*err_handler)(struct sk_buff *skb, u32 info); 1371 int (*err_handler)(struct sk_buff *skb, u32 info);
1354 1372
1355 struct xfrm_tunnel __rcu *next; 1373 struct xfrm4_protocol __rcu *next;
1374 int priority;
1375};
1376
1377struct xfrm6_protocol {
1378 int (*handler)(struct sk_buff *skb);
1379 int (*cb_handler)(struct sk_buff *skb, int err);
1380 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
1381 u8 type, u8 code, int offset, __be32 info);
1382
1383 struct xfrm6_protocol __rcu *next;
1356 int priority; 1384 int priority;
1357}; 1385};
1358 1386
1359struct xfrm_tunnel_notifier { 1387/* XFRM tunnel handlers. */
1388struct xfrm_tunnel {
1360 int (*handler)(struct sk_buff *skb); 1389 int (*handler)(struct sk_buff *skb);
1361 struct xfrm_tunnel_notifier __rcu *next; 1390 int (*err_handler)(struct sk_buff *skb, u32 info);
1391
1392 struct xfrm_tunnel __rcu *next;
1362 int priority; 1393 int priority;
1363}; 1394};
1364 1395
@@ -1375,11 +1406,14 @@ void xfrm4_init(void);
1375int xfrm_state_init(struct net *net); 1406int xfrm_state_init(struct net *net);
1376void xfrm_state_fini(struct net *net); 1407void xfrm_state_fini(struct net *net);
1377void xfrm4_state_init(void); 1408void xfrm4_state_init(void);
1409void xfrm4_protocol_init(void);
1378#ifdef CONFIG_XFRM 1410#ifdef CONFIG_XFRM
1379int xfrm6_init(void); 1411int xfrm6_init(void);
1380void xfrm6_fini(void); 1412void xfrm6_fini(void);
1381int xfrm6_state_init(void); 1413int xfrm6_state_init(void);
1382void xfrm6_state_fini(void); 1414void xfrm6_state_fini(void);
1415int xfrm6_protocol_init(void);
1416void xfrm6_protocol_fini(void);
1383#else 1417#else
1384static inline int xfrm6_init(void) 1418static inline int xfrm6_init(void)
1385{ 1419{
@@ -1405,7 +1439,8 @@ static inline void xfrm_sysctl_fini(struct net *net)
1405} 1439}
1406#endif 1440#endif
1407 1441
1408void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1442void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto,
1443 struct xfrm_address_filter *filter);
1409int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1444int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1410 int (*func)(struct xfrm_state *, int, void*), void *); 1445 int (*func)(struct xfrm_state *, int, void*), void *);
1411void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net); 1446void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net);
@@ -1497,20 +1532,22 @@ int xfrm4_rcv(struct sk_buff *skb);
1497 1532
1498static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1533static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1499{ 1534{
1500 return xfrm4_rcv_encap(skb, nexthdr, spi, 0); 1535 XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = NULL;
1536 XFRM_SPI_SKB_CB(skb)->family = AF_INET;
1537 XFRM_SPI_SKB_CB(skb)->daddroff = offsetof(struct iphdr, daddr);
1538 return xfrm_input(skb, nexthdr, spi, 0);
1501} 1539}
1502 1540
1503int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1541int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1504int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1542int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1505int xfrm4_output(struct sk_buff *skb); 1543int xfrm4_output(struct sk_buff *skb);
1506int xfrm4_output_finish(struct sk_buff *skb); 1544int xfrm4_output_finish(struct sk_buff *skb);
1545int xfrm4_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1546int xfrm4_protocol_register(struct xfrm4_protocol *handler, unsigned char protocol);
1547int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char protocol);
1507int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1548int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1508int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1549int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1509void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1550void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1510int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1511int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1512int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1513int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1514int xfrm6_extract_header(struct sk_buff *skb); 1551int xfrm6_extract_header(struct sk_buff *skb);
1515int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1552int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1516int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1553int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
@@ -1519,6 +1556,9 @@ int xfrm6_rcv(struct sk_buff *skb);
1519int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1556int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1520 xfrm_address_t *saddr, u8 proto); 1557 xfrm_address_t *saddr, u8 proto);
1521void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1558void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1559int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1560int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
1561int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
1522int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1562int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1523int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1563int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1524__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1564__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
@@ -1646,6 +1686,20 @@ static inline int xfrm_aevent_is_on(struct net *net)
1646 rcu_read_unlock(); 1686 rcu_read_unlock();
1647 return ret; 1687 return ret;
1648} 1688}
1689
1690static inline int xfrm_acquire_is_on(struct net *net)
1691{
1692 struct sock *nlsk;
1693 int ret = 0;
1694
1695 rcu_read_lock();
1696 nlsk = rcu_dereference(net->xfrm.nlsk);
1697 if (nlsk)
1698 ret = netlink_has_listeners(nlsk, XFRMNLGRP_ACQUIRE);
1699 rcu_read_unlock();
1700
1701 return ret;
1702}
1649#endif 1703#endif
1650 1704
1651static inline int aead_len(struct xfrm_algo_aead *alg) 1705static inline int aead_len(struct xfrm_algo_aead *alg)
@@ -1748,4 +1802,24 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1748 return ret; 1802 return ret;
1749} 1803}
1750 1804
1805static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
1806 unsigned int family)
1807{
1808 bool tunnel = false;
1809
1810 switch(family) {
1811 case AF_INET:
1812 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4)
1813 tunnel = true;
1814 break;
1815 case AF_INET6:
1816 if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6)
1817 tunnel = true;
1818 break;
1819 }
1820 if (tunnel && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL))
1821 return -EINVAL;
1822
1823 return 0;
1824}
1751#endif /* _NET_XFRM_H */ 1825#endif /* _NET_XFRM_H */
diff --git a/include/rdma/ib_cm.h b/include/rdma/ib_cm.h
index f29e3a27c2cc..0e3ff30647d5 100644
--- a/include/rdma/ib_cm.h
+++ b/include/rdma/ib_cm.h
@@ -601,5 +601,4 @@ struct ib_cm_sidr_rep_param {
601int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, 601int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
602 struct ib_cm_sidr_rep_param *param); 602 struct ib_cm_sidr_rep_param *param);
603 603
604int ib_update_cm_av(struct ib_cm_id *id, const u8 *smac, const u8 *alt_smac);
605#endif /* IB_CM_H */ 604#endif /* IB_CM_H */
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index 9ee0d2e51b16..1ea0b65c4cfb 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -46,17 +46,12 @@ struct ib_umem {
46 int page_size; 46 int page_size;
47 int writable; 47 int writable;
48 int hugetlb; 48 int hugetlb;
49 struct list_head chunk_list;
50 struct work_struct work; 49 struct work_struct work;
51 struct mm_struct *mm; 50 struct mm_struct *mm;
52 unsigned long diff; 51 unsigned long diff;
53}; 52 struct sg_table sg_head;
54 53 int nmap;
55struct ib_umem_chunk { 54 int npages;
56 struct list_head list;
57 int nents;
58 int nmap;
59 struct scatterlist page_list[0];
60}; 55};
61 56
62#ifdef CONFIG_INFINIBAND_USER_MEM 57#ifdef CONFIG_INFINIBAND_USER_MEM
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 6793f32ccb58..acd825182977 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -122,7 +122,19 @@ enum ib_device_cap_flags {
122 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22), 122 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22),
123 IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23), 123 IB_DEVICE_MEM_WINDOW_TYPE_2A = (1<<23),
124 IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24), 124 IB_DEVICE_MEM_WINDOW_TYPE_2B = (1<<24),
125 IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29) 125 IB_DEVICE_MANAGED_FLOW_STEERING = (1<<29),
126 IB_DEVICE_SIGNATURE_HANDOVER = (1<<30)
127};
128
129enum ib_signature_prot_cap {
130 IB_PROT_T10DIF_TYPE_1 = 1,
131 IB_PROT_T10DIF_TYPE_2 = 1 << 1,
132 IB_PROT_T10DIF_TYPE_3 = 1 << 2,
133};
134
135enum ib_signature_guard_cap {
136 IB_GUARD_T10DIF_CRC = 1,
137 IB_GUARD_T10DIF_CSUM = 1 << 1,
126}; 138};
127 139
128enum ib_atomic_cap { 140enum ib_atomic_cap {
@@ -172,6 +184,8 @@ struct ib_device_attr {
172 unsigned int max_fast_reg_page_list_len; 184 unsigned int max_fast_reg_page_list_len;
173 u16 max_pkeys; 185 u16 max_pkeys;
174 u8 local_ca_ack_delay; 186 u8 local_ca_ack_delay;
187 int sig_prot_cap;
188 int sig_guard_cap;
175}; 189};
176 190
177enum ib_mtu { 191enum ib_mtu {
@@ -461,6 +475,130 @@ int ib_rate_to_mult(enum ib_rate rate) __attribute_const__;
461 */ 475 */
462int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__; 476int ib_rate_to_mbps(enum ib_rate rate) __attribute_const__;
463 477
478enum ib_mr_create_flags {
479 IB_MR_SIGNATURE_EN = 1,
480};
481
482/**
483 * ib_mr_init_attr - Memory region init attributes passed to routine
484 * ib_create_mr.
485 * @max_reg_descriptors: max number of registration descriptors that
486 * may be used with registration work requests.
487 * @flags: MR creation flags bit mask.
488 */
489struct ib_mr_init_attr {
490 int max_reg_descriptors;
491 u32 flags;
492};
493
494enum ib_signature_type {
495 IB_SIG_TYPE_T10_DIF,
496};
497
498/**
499 * T10-DIF Signature types
500 * T10-DIF types are defined by SCSI
501 * specifications.
502 */
503enum ib_t10_dif_type {
504 IB_T10DIF_NONE,
505 IB_T10DIF_TYPE1,
506 IB_T10DIF_TYPE2,
507 IB_T10DIF_TYPE3
508};
509
510/**
511 * Signature T10-DIF block-guard types
512 * IB_T10DIF_CRC: Corresponds to T10-PI mandated CRC checksum rules.
513 * IB_T10DIF_CSUM: Corresponds to IP checksum rules.
514 */
515enum ib_t10_dif_bg_type {
516 IB_T10DIF_CRC,
517 IB_T10DIF_CSUM
518};
519
520/**
521 * struct ib_t10_dif_domain - Parameters specific for T10-DIF
522 * domain.
523 * @type: T10-DIF type (0|1|2|3)
524 * @bg_type: T10-DIF block guard type (CRC|CSUM)
525 * @pi_interval: protection information interval.
526 * @bg: seed of guard computation.
527 * @app_tag: application tag of guard block
528 * @ref_tag: initial guard block reference tag.
529 * @type3_inc_reftag: T10-DIF type 3 does not state
530 * about the reference tag, it is the user
531 * choice to increment it or not.
532 */
533struct ib_t10_dif_domain {
534 enum ib_t10_dif_type type;
535 enum ib_t10_dif_bg_type bg_type;
536 u16 pi_interval;
537 u16 bg;
538 u16 app_tag;
539 u32 ref_tag;
540 bool type3_inc_reftag;
541};
542
543/**
544 * struct ib_sig_domain - Parameters for signature domain
545 * @sig_type: specific signauture type
546 * @sig: union of all signature domain attributes that may
547 * be used to set domain layout.
548 */
549struct ib_sig_domain {
550 enum ib_signature_type sig_type;
551 union {
552 struct ib_t10_dif_domain dif;
553 } sig;
554};
555
556/**
557 * struct ib_sig_attrs - Parameters for signature handover operation
558 * @check_mask: bitmask for signature byte check (8 bytes)
559 * @mem: memory domain layout desciptor.
560 * @wire: wire domain layout desciptor.
561 */
562struct ib_sig_attrs {
563 u8 check_mask;
564 struct ib_sig_domain mem;
565 struct ib_sig_domain wire;
566};
567
568enum ib_sig_err_type {
569 IB_SIG_BAD_GUARD,
570 IB_SIG_BAD_REFTAG,
571 IB_SIG_BAD_APPTAG,
572};
573
574/**
575 * struct ib_sig_err - signature error descriptor
576 */
577struct ib_sig_err {
578 enum ib_sig_err_type err_type;
579 u32 expected;
580 u32 actual;
581 u64 sig_err_offset;
582 u32 key;
583};
584
585enum ib_mr_status_check {
586 IB_MR_CHECK_SIG_STATUS = 1,
587};
588
589/**
590 * struct ib_mr_status - Memory region status container
591 *
592 * @fail_status: Bitmask of MR checks status. For each
593 * failed check a corresponding status bit is set.
594 * @sig_err: Additional info for IB_MR_CEHCK_SIG_STATUS
595 * failure.
596 */
597struct ib_mr_status {
598 u32 fail_status;
599 struct ib_sig_err sig_err;
600};
601
464/** 602/**
465 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate 603 * mult_to_ib_rate - Convert a multiple of 2.5 Gbit/sec to an IB rate
466 * enum. 604 * enum.
@@ -644,6 +782,7 @@ enum ib_qp_create_flags {
644 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0, 782 IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0,
645 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, 783 IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
646 IB_QP_CREATE_NETIF_QP = 1 << 5, 784 IB_QP_CREATE_NETIF_QP = 1 << 5,
785 IB_QP_CREATE_SIGNATURE_EN = 1 << 6,
647 /* reserve bits 26-31 for low level drivers' internal use */ 786 /* reserve bits 26-31 for low level drivers' internal use */
648 IB_QP_CREATE_RESERVED_START = 1 << 26, 787 IB_QP_CREATE_RESERVED_START = 1 << 26,
649 IB_QP_CREATE_RESERVED_END = 1 << 31, 788 IB_QP_CREATE_RESERVED_END = 1 << 31,
@@ -808,6 +947,7 @@ enum ib_wr_opcode {
808 IB_WR_MASKED_ATOMIC_CMP_AND_SWP, 947 IB_WR_MASKED_ATOMIC_CMP_AND_SWP,
809 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD, 948 IB_WR_MASKED_ATOMIC_FETCH_AND_ADD,
810 IB_WR_BIND_MW, 949 IB_WR_BIND_MW,
950 IB_WR_REG_SIG_MR,
811 /* reserve values for low level drivers' internal use. 951 /* reserve values for low level drivers' internal use.
812 * These values will not be used at all in the ib core layer. 952 * These values will not be used at all in the ib core layer.
813 */ 953 */
@@ -913,6 +1053,12 @@ struct ib_send_wr {
913 u32 rkey; 1053 u32 rkey;
914 struct ib_mw_bind_info bind_info; 1054 struct ib_mw_bind_info bind_info;
915 } bind_mw; 1055 } bind_mw;
1056 struct {
1057 struct ib_sig_attrs *sig_attrs;
1058 struct ib_mr *sig_mr;
1059 int access_flags;
1060 struct ib_sge *prot;
1061 } sig_handover;
916 } wr; 1062 } wr;
917 u32 xrc_remote_srq_num; /* XRC TGT QPs only */ 1063 u32 xrc_remote_srq_num; /* XRC TGT QPs only */
918}; 1064};
@@ -1266,10 +1412,6 @@ struct ib_dma_mapping_ops {
1266 void (*unmap_sg)(struct ib_device *dev, 1412 void (*unmap_sg)(struct ib_device *dev,
1267 struct scatterlist *sg, int nents, 1413 struct scatterlist *sg, int nents,
1268 enum dma_data_direction direction); 1414 enum dma_data_direction direction);
1269 u64 (*dma_address)(struct ib_device *dev,
1270 struct scatterlist *sg);
1271 unsigned int (*dma_len)(struct ib_device *dev,
1272 struct scatterlist *sg);
1273 void (*sync_single_for_cpu)(struct ib_device *dev, 1415 void (*sync_single_for_cpu)(struct ib_device *dev,
1274 u64 dma_handle, 1416 u64 dma_handle,
1275 size_t size, 1417 size_t size,
@@ -1407,6 +1549,9 @@ struct ib_device {
1407 int (*query_mr)(struct ib_mr *mr, 1549 int (*query_mr)(struct ib_mr *mr,
1408 struct ib_mr_attr *mr_attr); 1550 struct ib_mr_attr *mr_attr);
1409 int (*dereg_mr)(struct ib_mr *mr); 1551 int (*dereg_mr)(struct ib_mr *mr);
1552 int (*destroy_mr)(struct ib_mr *mr);
1553 struct ib_mr * (*create_mr)(struct ib_pd *pd,
1554 struct ib_mr_init_attr *mr_init_attr);
1410 struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd, 1555 struct ib_mr * (*alloc_fast_reg_mr)(struct ib_pd *pd,
1411 int max_page_list_len); 1556 int max_page_list_len);
1412 struct ib_fast_reg_page_list * (*alloc_fast_reg_page_list)(struct ib_device *device, 1557 struct ib_fast_reg_page_list * (*alloc_fast_reg_page_list)(struct ib_device *device,
@@ -1455,6 +1600,8 @@ struct ib_device {
1455 *flow_attr, 1600 *flow_attr,
1456 int domain); 1601 int domain);
1457 int (*destroy_flow)(struct ib_flow *flow_id); 1602 int (*destroy_flow)(struct ib_flow *flow_id);
1603 int (*check_mr_status)(struct ib_mr *mr, u32 check_mask,
1604 struct ib_mr_status *mr_status);
1458 1605
1459 struct ib_dma_mapping_ops *dma_ops; 1606 struct ib_dma_mapping_ops *dma_ops;
1460 1607
@@ -2089,12 +2236,13 @@ static inline void ib_dma_unmap_sg_attrs(struct ib_device *dev,
2089 * ib_sg_dma_address - Return the DMA address from a scatter/gather entry 2236 * ib_sg_dma_address - Return the DMA address from a scatter/gather entry
2090 * @dev: The device for which the DMA addresses were created 2237 * @dev: The device for which the DMA addresses were created
2091 * @sg: The scatter/gather entry 2238 * @sg: The scatter/gather entry
2239 *
2240 * Note: this function is obsolete. To do: change all occurrences of
2241 * ib_sg_dma_address() into sg_dma_address().
2092 */ 2242 */
2093static inline u64 ib_sg_dma_address(struct ib_device *dev, 2243static inline u64 ib_sg_dma_address(struct ib_device *dev,
2094 struct scatterlist *sg) 2244 struct scatterlist *sg)
2095{ 2245{
2096 if (dev->dma_ops)
2097 return dev->dma_ops->dma_address(dev, sg);
2098 return sg_dma_address(sg); 2246 return sg_dma_address(sg);
2099} 2247}
2100 2248
@@ -2102,12 +2250,13 @@ static inline u64 ib_sg_dma_address(struct ib_device *dev,
2102 * ib_sg_dma_len - Return the DMA length from a scatter/gather entry 2250 * ib_sg_dma_len - Return the DMA length from a scatter/gather entry
2103 * @dev: The device for which the DMA addresses were created 2251 * @dev: The device for which the DMA addresses were created
2104 * @sg: The scatter/gather entry 2252 * @sg: The scatter/gather entry
2253 *
2254 * Note: this function is obsolete. To do: change all occurrences of
2255 * ib_sg_dma_len() into sg_dma_len().
2105 */ 2256 */
2106static inline unsigned int ib_sg_dma_len(struct ib_device *dev, 2257static inline unsigned int ib_sg_dma_len(struct ib_device *dev,
2107 struct scatterlist *sg) 2258 struct scatterlist *sg)
2108{ 2259{
2109 if (dev->dma_ops)
2110 return dev->dma_ops->dma_len(dev, sg);
2111 return sg_dma_len(sg); 2260 return sg_dma_len(sg);
2112} 2261}
2113 2262
@@ -2250,6 +2399,25 @@ int ib_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
2250 */ 2399 */
2251int ib_dereg_mr(struct ib_mr *mr); 2400int ib_dereg_mr(struct ib_mr *mr);
2252 2401
2402
2403/**
2404 * ib_create_mr - Allocates a memory region that may be used for
2405 * signature handover operations.
2406 * @pd: The protection domain associated with the region.
2407 * @mr_init_attr: memory region init attributes.
2408 */
2409struct ib_mr *ib_create_mr(struct ib_pd *pd,
2410 struct ib_mr_init_attr *mr_init_attr);
2411
2412/**
2413 * ib_destroy_mr - Destroys a memory region that was created using
2414 * ib_create_mr and removes it from HW translation tables.
2415 * @mr: The memory region to destroy.
2416 *
2417 * This function can fail, if the memory region has memory windows bound to it.
2418 */
2419int ib_destroy_mr(struct ib_mr *mr);
2420
2253/** 2421/**
2254 * ib_alloc_fast_reg_mr - Allocates memory region usable with the 2422 * ib_alloc_fast_reg_mr - Allocates memory region usable with the
2255 * IB_WR_FAST_REG_MR send work request. 2423 * IB_WR_FAST_REG_MR send work request.
@@ -2435,4 +2603,19 @@ static inline int ib_check_mr_access(int flags)
2435 return 0; 2603 return 0;
2436} 2604}
2437 2605
2606/**
2607 * ib_check_mr_status: lightweight check of MR status.
2608 * This routine may provide status checks on a selected
2609 * ib_mr. first use is for signature status check.
2610 *
2611 * @mr: A memory region.
2612 * @check_mask: Bitmask of which checks to perform from
2613 * ib_mr_status_check enumeration.
2614 * @mr_status: The container of relevant status checks.
2615 * failed checks will be indicated in the status bitmask
2616 * and the relevant info shall be in the error item.
2617 */
2618int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
2619 struct ib_mr_status *mr_status);
2620
2438#endif /* IB_VERBS_H */ 2621#endif /* IB_VERBS_H */
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 309f51336fb9..728c9ad9feb0 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -133,6 +133,10 @@ struct iscsi_task {
133 unsigned long last_xfer; 133 unsigned long last_xfer;
134 unsigned long last_timeout; 134 unsigned long last_timeout;
135 bool have_checked_conn; 135 bool have_checked_conn;
136
137 /* T10 protection information */
138 bool protected;
139
136 /* state set/tested under session->lock */ 140 /* state set/tested under session->lock */
137 int state; 141 int state;
138 atomic_t refcount; 142 atomic_t refcount;
@@ -327,12 +331,19 @@ struct iscsi_session {
327 struct iscsi_transport *tt; 331 struct iscsi_transport *tt;
328 struct Scsi_Host *host; 332 struct Scsi_Host *host;
329 struct iscsi_conn *leadconn; /* leading connection */ 333 struct iscsi_conn *leadconn; /* leading connection */
330 spinlock_t lock; /* protects session state, * 334 /* Between the forward and the backward locks exists a strict locking
331 * sequence numbers, * 335 * hierarchy. The mutual exclusion zone protected by the forward lock
336 * can enclose the mutual exclusion zone protected by the backward lock
337 * but not vice versa.
338 */
339 spinlock_t frwd_lock; /* protects session state, *
340 * cmdsn, queued_cmdsn *
332 * session resources: * 341 * session resources: *
333 * - cmdpool, * 342 * - cmdpool kfifo_out , *
334 * - mgmtpool, * 343 * - mgmtpool, */
335 * - r2tpool */ 344 spinlock_t back_lock; /* protects cmdsn_exp *
345 * cmdsn_max, *
346 * cmdpool kfifo_in */
336 int state; /* session state */ 347 int state; /* session state */
337 int age; /* counts session re-opens */ 348 int age; /* counts session re-opens */
338 349
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 215469a9b801..2a7aa75dd009 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -83,6 +83,8 @@ struct iscsi_tcp_task {
83 struct iscsi_pool r2tpool; 83 struct iscsi_pool r2tpool;
84 struct kfifo r2tqueue; 84 struct kfifo r2tqueue;
85 void *dd_data; 85 void *dd_data;
86 spinlock_t pool2queue;
87 spinlock_t queue2pool;
86}; 88};
87 89
88enum { 90enum {
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 91558a1f97f4..dd7c998221b3 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -142,8 +142,7 @@ static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
142extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 142extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
143extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t); 143extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
144extern void scsi_put_command(struct scsi_cmnd *); 144extern void scsi_put_command(struct scsi_cmnd *);
145extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *, 145extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *);
146 struct device *);
147extern void scsi_finish_command(struct scsi_cmnd *cmd); 146extern void scsi_finish_command(struct scsi_cmnd *cmd);
148 147
149extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count, 148extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,
@@ -156,9 +155,6 @@ extern void scsi_release_buffers(struct scsi_cmnd *cmd);
156extern int scsi_dma_map(struct scsi_cmnd *cmd); 155extern int scsi_dma_map(struct scsi_cmnd *cmd);
157extern void scsi_dma_unmap(struct scsi_cmnd *cmd); 156extern void scsi_dma_unmap(struct scsi_cmnd *cmd);
158 157
159struct scsi_cmnd *scsi_allocate_command(gfp_t gfp_mask);
160void scsi_free_command(gfp_t gfp_mask, struct scsi_cmnd *cmd);
161
162static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd) 158static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
163{ 159{
164 return cmd->sdb.table.nents; 160 return cmd->sdb.table.nents;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index d65fbec2533d..5853c913d2b0 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -113,6 +113,12 @@ struct scsi_device {
113 const char * vendor; /* [back_compat] point into 'inquiry' ... */ 113 const char * vendor; /* [back_compat] point into 'inquiry' ... */
114 const char * model; /* ... after scan; point to static string */ 114 const char * model; /* ... after scan; point to static string */
115 const char * rev; /* ... "nullnullnullnull" before scan */ 115 const char * rev; /* ... "nullnullnullnull" before scan */
116
117#define SCSI_VPD_PG_LEN 255
118 int vpd_pg83_len;
119 unsigned char *vpd_pg83;
120 int vpd_pg80_len;
121 unsigned char *vpd_pg80;
116 unsigned char current_tag; /* current tag */ 122 unsigned char current_tag; /* current tag */
117 struct scsi_target *sdev_target; /* used only for single_lun */ 123 struct scsi_target *sdev_target; /* used only for single_lun */
118 124
@@ -235,12 +241,24 @@ struct scsi_dh_data {
235#define sdev_printk(prefix, sdev, fmt, a...) \ 241#define sdev_printk(prefix, sdev, fmt, a...) \
236 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a) 242 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
237 243
244#define sdev_dbg(sdev, fmt, a...) \
245 dev_dbg(&(sdev)->sdev_gendev, fmt, ##a)
246
238#define scmd_printk(prefix, scmd, fmt, a...) \ 247#define scmd_printk(prefix, scmd, fmt, a...) \
239 (scmd)->request->rq_disk ? \ 248 (scmd)->request->rq_disk ? \
240 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \ 249 sdev_printk(prefix, (scmd)->device, "[%s] " fmt, \
241 (scmd)->request->rq_disk->disk_name, ##a) : \ 250 (scmd)->request->rq_disk->disk_name, ##a) : \
242 sdev_printk(prefix, (scmd)->device, fmt, ##a) 251 sdev_printk(prefix, (scmd)->device, fmt, ##a)
243 252
253#define scmd_dbg(scmd, fmt, a...) \
254 do { \
255 if ((scmd)->request->rq_disk) \
256 sdev_dbg((scmd)->device, "[%s] " fmt, \
257 (scmd)->request->rq_disk->disk_name, ##a);\
258 else \
259 sdev_dbg((scmd)->device, fmt, ##a); \
260 } while (0)
261
244enum scsi_target_state { 262enum scsi_target_state {
245 STARGET_CREATED = 1, 263 STARGET_CREATED = 1,
246 STARGET_RUNNING, 264 STARGET_RUNNING,
@@ -257,7 +275,7 @@ struct scsi_target {
257 struct list_head siblings; 275 struct list_head siblings;
258 struct list_head devices; 276 struct list_head devices;
259 struct device dev; 277 struct device dev;
260 unsigned int reap_ref; /* protected by the host lock */ 278 struct kref reap_ref; /* last put renders target invisible */
261 unsigned int channel; 279 unsigned int channel;
262 unsigned int id; /* target id ... replace 280 unsigned int id; /* target id ... replace
263 * scsi_device.id eventually */ 281 * scsi_device.id eventually */
@@ -284,7 +302,6 @@ struct scsi_target {
284#define SCSI_DEFAULT_TARGET_BLOCKED 3 302#define SCSI_DEFAULT_TARGET_BLOCKED 3
285 303
286 char scsi_level; 304 char scsi_level;
287 struct execute_work ew;
288 enum scsi_target_state state; 305 enum scsi_target_state state;
289 void *hostdata; /* available to low-level driver */ 306 void *hostdata; /* available to low-level driver */
290 unsigned long starget_data[0]; /* for the transport */ 307 unsigned long starget_data[0]; /* for the transport */
@@ -309,6 +326,7 @@ extern int scsi_add_device(struct Scsi_Host *host, uint channel,
309extern int scsi_register_device_handler(struct scsi_device_handler *scsi_dh); 326extern int scsi_register_device_handler(struct scsi_device_handler *scsi_dh);
310extern void scsi_remove_device(struct scsi_device *); 327extern void scsi_remove_device(struct scsi_device *);
311extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh); 328extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh);
329void scsi_attach_vpd(struct scsi_device *sdev);
312 330
313extern int scsi_device_get(struct scsi_device *); 331extern int scsi_device_get(struct scsi_device *);
314extern void scsi_device_put(struct scsi_device *); 332extern void scsi_device_put(struct scsi_device *);
@@ -405,11 +423,11 @@ extern int scsi_is_target_device(const struct device *);
405extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd, 423extern int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
406 int data_direction, void *buffer, unsigned bufflen, 424 int data_direction, void *buffer, unsigned bufflen,
407 unsigned char *sense, int timeout, int retries, 425 unsigned char *sense, int timeout, int retries,
408 int flag, int *resid); 426 u64 flags, int *resid);
409extern int scsi_execute_req_flags(struct scsi_device *sdev, 427extern int scsi_execute_req_flags(struct scsi_device *sdev,
410 const unsigned char *cmd, int data_direction, void *buffer, 428 const unsigned char *cmd, int data_direction, void *buffer,
411 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, 429 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
412 int retries, int *resid, int flags); 430 int retries, int *resid, u64 flags);
413static inline int scsi_execute_req(struct scsi_device *sdev, 431static inline int scsi_execute_req(struct scsi_device *sdev,
414 const unsigned char *cmd, int data_direction, void *buffer, 432 const unsigned char *cmd, int data_direction, void *buffer,
415 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout, 433 unsigned bufflen, struct scsi_sense_hdr *sshdr, int timeout,
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 53075e5039e6..94844fc77b97 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -15,6 +15,7 @@ struct completion;
15struct module; 15struct module;
16struct scsi_cmnd; 16struct scsi_cmnd;
17struct scsi_device; 17struct scsi_device;
18struct scsi_host_cmd_pool;
18struct scsi_target; 19struct scsi_target;
19struct Scsi_Host; 20struct Scsi_Host;
20struct scsi_host_cmd_pool; 21struct scsi_host_cmd_pool;
@@ -524,6 +525,12 @@ struct scsi_host_template {
524 * scsi_netlink.h 525 * scsi_netlink.h
525 */ 526 */
526 u64 vendor_id; 527 u64 vendor_id;
528
529 /*
530 * Additional per-command data allocated for the driver.
531 */
532 unsigned int cmd_size;
533 struct scsi_host_cmd_pool *cmd_pool;
527}; 534};
528 535
529/* 536/*
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index b797e8fad669..8c79980dc8f2 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -130,6 +130,7 @@ enum fc_vport_state {
130#define FC_PORTSPEED_4GBIT 8 130#define FC_PORTSPEED_4GBIT 8
131#define FC_PORTSPEED_8GBIT 0x10 131#define FC_PORTSPEED_8GBIT 0x10
132#define FC_PORTSPEED_16GBIT 0x20 132#define FC_PORTSPEED_16GBIT 0x20
133#define FC_PORTSPEED_32GBIT 0x40
133#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */ 134#define FC_PORTSPEED_NOT_NEGOTIATED (1 << 15) /* Speed not established */
134 135
135/* 136/*
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 88640a47216c..2555ee5343fd 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -167,6 +167,7 @@ struct iscsi_transport {
167 struct iscsi_bus_flash_conn *fnode_conn); 167 struct iscsi_bus_flash_conn *fnode_conn);
168 int (*logout_flashnode_sid) (struct iscsi_cls_session *cls_sess); 168 int (*logout_flashnode_sid) (struct iscsi_cls_session *cls_sess);
169 int (*get_host_stats) (struct Scsi_Host *shost, char *buf, int len); 169 int (*get_host_stats) (struct Scsi_Host *shost, char *buf, int len);
170 u8 (*check_protection)(struct iscsi_task *task, sector_t *sector);
170}; 171};
171 172
172/* 173/*
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
index b11da5c1331e..cdb05dd1d440 100644
--- a/include/scsi/scsi_transport_srp.h
+++ b/include/scsi/scsi_transport_srp.h
@@ -41,7 +41,6 @@ enum srp_rport_state {
41 * @mutex: Protects against concurrent rport reconnect / 41 * @mutex: Protects against concurrent rport reconnect /
42 * fast_io_fail / dev_loss_tmo activity. 42 * fast_io_fail / dev_loss_tmo activity.
43 * @state: rport state. 43 * @state: rport state.
44 * @deleted: Whether or not srp_rport_del() has already been invoked.
45 * @reconnect_delay: Reconnect delay in seconds. 44 * @reconnect_delay: Reconnect delay in seconds.
46 * @failed_reconnects: Number of failed reconnect attempts. 45 * @failed_reconnects: Number of failed reconnect attempts.
47 * @reconnect_work: Work structure used for scheduling reconnect attempts. 46 * @reconnect_work: Work structure used for scheduling reconnect attempts.
diff --git a/include/sound/core.h b/include/sound/core.h
index 2a14f1f02d4f..d3f5f818e0b9 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -22,6 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/device.h>
25#include <linux/sched.h> /* wake_up() */ 26#include <linux/sched.h> /* wake_up() */
26#include <linux/mutex.h> /* struct mutex */ 27#include <linux/mutex.h> /* struct mutex */
27#include <linux/rwsem.h> /* struct rw_semaphore */ 28#include <linux/rwsem.h> /* struct rw_semaphore */
@@ -41,39 +42,33 @@
41/* forward declarations */ 42/* forward declarations */
42struct pci_dev; 43struct pci_dev;
43struct module; 44struct module;
44struct device; 45struct completion;
45struct device_attribute;
46 46
47/* device allocation stuff */ 47/* device allocation stuff */
48 48
49#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 49/* type of the object used in snd_device_*()
50 50 * this also defines the calling order
51typedef int __bitwise snd_device_type_t; 51 */
52#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0) 52enum snd_device_type {
53#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) 53 SNDRV_DEV_LOWLEVEL,
54#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2) 54 SNDRV_DEV_CONTROL,
55#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000) 55 SNDRV_DEV_INFO,
56#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001) 56 SNDRV_DEV_BUS,
57#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002) 57 SNDRV_DEV_CODEC,
58#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003) 58 SNDRV_DEV_PCM,
59#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004) 59 SNDRV_DEV_COMPRESS,
60#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005) 60 SNDRV_DEV_RAWMIDI,
61#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 61 SNDRV_DEV_TIMER,
62#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 62 SNDRV_DEV_SEQUENCER,
63#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 63 SNDRV_DEV_HWDEP,
64#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 64 SNDRV_DEV_JACK,
65#define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A) 65};
66#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 66
67 67enum snd_device_state {
68typedef int __bitwise snd_device_state_t; 68 SNDRV_DEV_BUILD,
69#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0) 69 SNDRV_DEV_REGISTERED,
70#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1) 70 SNDRV_DEV_DISCONNECTED,
71#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2) 71};
72
73typedef int __bitwise snd_device_cmd_t;
74#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
75#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
76#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
77 72
78struct snd_device; 73struct snd_device;
79 74
@@ -86,8 +81,8 @@ struct snd_device_ops {
86struct snd_device { 81struct snd_device {
87 struct list_head list; /* list of registered devices */ 82 struct list_head list; /* list of registered devices */
88 struct snd_card *card; /* card which holds this device */ 83 struct snd_card *card; /* card which holds this device */
89 snd_device_state_t state; /* state of the device */ 84 enum snd_device_state state; /* state of the device */
90 snd_device_type_t type; /* device type */ 85 enum snd_device_type type; /* device type */
91 void *device_data; /* device structure */ 86 void *device_data; /* device structure */
92 struct snd_device_ops *ops; /* operations */ 87 struct snd_device_ops *ops; /* operations */
93}; 88};
@@ -131,11 +126,10 @@ struct snd_card {
131 state */ 126 state */
132 spinlock_t files_lock; /* lock the files for this card */ 127 spinlock_t files_lock; /* lock the files for this card */
133 int shutdown; /* this card is going down */ 128 int shutdown; /* this card is going down */
134 int free_on_last_close; /* free in context of file_release */ 129 struct completion *release_completion;
135 wait_queue_head_t shutdown_sleep;
136 atomic_t refcount; /* refcount for disconnection */
137 struct device *dev; /* device assigned to this card */ 130 struct device *dev; /* device assigned to this card */
138 struct device *card_dev; /* cardX object for sysfs */ 131 struct device card_dev; /* cardX object for sysfs */
132 bool registered; /* card_dev is registered? */
139 133
140#ifdef CONFIG_PM 134#ifdef CONFIG_PM
141 unsigned int power_state; /* power state */ 135 unsigned int power_state; /* power state */
@@ -149,6 +143,8 @@ struct snd_card {
149#endif 143#endif
150}; 144};
151 145
146#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
147
152#ifdef CONFIG_PM 148#ifdef CONFIG_PM
153static inline void snd_power_lock(struct snd_card *card) 149static inline void snd_power_lock(struct snd_card *card)
154{ 150{
@@ -197,7 +193,7 @@ struct snd_minor {
197/* return a device pointer linked to each sound device as a parent */ 193/* return a device pointer linked to each sound device as a parent */
198static inline struct device *snd_card_get_device_link(struct snd_card *card) 194static inline struct device *snd_card_get_device_link(struct snd_card *card)
199{ 195{
200 return card ? card->card_dev : NULL; 196 return card ? &card->card_dev : NULL;
201} 197}
202 198
203/* sound.c */ 199/* sound.c */
@@ -244,13 +240,11 @@ static inline int snd_register_device(int type, struct snd_card *card, int dev,
244 240
245int snd_unregister_device(int type, struct snd_card *card, int dev); 241int snd_unregister_device(int type, struct snd_card *card, int dev);
246void *snd_lookup_minor_data(unsigned int minor, int type); 242void *snd_lookup_minor_data(unsigned int minor, int type);
247int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, 243struct device *snd_get_device(int type, struct snd_card *card, int dev);
248 struct device_attribute *attr);
249 244
250#ifdef CONFIG_SND_OSSEMUL 245#ifdef CONFIG_SND_OSSEMUL
251int snd_register_oss_device(int type, struct snd_card *card, int dev, 246int snd_register_oss_device(int type, struct snd_card *card, int dev,
252 const struct file_operations *f_ops, void *private_data, 247 const struct file_operations *f_ops, void *private_data);
253 const char *name);
254int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 248int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
255void *snd_lookup_oss_minor_data(unsigned int minor, int type); 249void *snd_lookup_oss_minor_data(unsigned int minor, int type);
256#endif 250#endif
@@ -284,9 +278,16 @@ int snd_card_locked(int card);
284extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); 278extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
285#endif 279#endif
286 280
287int snd_card_create(int idx, const char *id, 281int snd_card_new(struct device *parent, int idx, const char *xid,
288 struct module *module, int extra_size, 282 struct module *module, int extra_size,
289 struct snd_card **card_ret); 283 struct snd_card **card_ret);
284
285static inline int __deprecated
286snd_card_create(int idx, const char *id, struct module *module, int extra_size,
287 struct snd_card **ret)
288{
289 return snd_card_new(NULL, idx, id, module, extra_size, ret);
290}
290 291
291int snd_card_disconnect(struct snd_card *card); 292int snd_card_disconnect(struct snd_card *card);
292int snd_card_free(struct snd_card *card); 293int snd_card_free(struct snd_card *card);
@@ -298,20 +299,19 @@ int snd_card_info_done(void);
298int snd_component_add(struct snd_card *card, const char *component); 299int snd_component_add(struct snd_card *card, const char *component);
299int snd_card_file_add(struct snd_card *card, struct file *file); 300int snd_card_file_add(struct snd_card *card, struct file *file);
300int snd_card_file_remove(struct snd_card *card, struct file *file); 301int snd_card_file_remove(struct snd_card *card, struct file *file);
301void snd_card_unref(struct snd_card *card); 302#define snd_card_unref(card) put_device(&(card)->card_dev)
302 303
303#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) 304#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
304 305
305/* device.c */ 306/* device.c */
306 307
307int snd_device_new(struct snd_card *card, snd_device_type_t type, 308int snd_device_new(struct snd_card *card, enum snd_device_type type,
308 void *device_data, struct snd_device_ops *ops); 309 void *device_data, struct snd_device_ops *ops);
309int snd_device_register(struct snd_card *card, void *device_data); 310int snd_device_register(struct snd_card *card, void *device_data);
310int snd_device_register_all(struct snd_card *card); 311int snd_device_register_all(struct snd_card *card);
311int snd_device_disconnect(struct snd_card *card, void *device_data);
312int snd_device_disconnect_all(struct snd_card *card); 312int snd_device_disconnect_all(struct snd_card *card);
313int snd_device_free(struct snd_card *card, void *device_data); 313void snd_device_free(struct snd_card *card, void *device_data);
314int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd); 314void snd_device_free_all(struct snd_card *card);
315 315
316/* isadma.c */ 316/* isadma.c */
317 317
@@ -433,7 +433,6 @@ static inline void snd_printdd(const char *format, ...) {}
433#define gameport_get_port_data(gp) (gp)->port_data 433#define gameport_get_port_data(gp) (gp)->port_data
434#endif 434#endif
435 435
436#ifdef CONFIG_PCI
437/* PCI quirk list helper */ 436/* PCI quirk list helper */
438struct snd_pci_quirk { 437struct snd_pci_quirk {
439 unsigned short subvendor; /* PCI subvendor ID */ 438 unsigned short subvendor; /* PCI subvendor ID */
@@ -469,12 +468,26 @@ struct snd_pci_quirk {
469#define snd_pci_quirk_name(q) "" 468#define snd_pci_quirk_name(q) ""
470#endif 469#endif
471 470
471#ifdef CONFIG_PCI
472const struct snd_pci_quirk * 472const struct snd_pci_quirk *
473snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); 473snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
474 474
475const struct snd_pci_quirk * 475const struct snd_pci_quirk *
476snd_pci_quirk_lookup_id(u16 vendor, u16 device, 476snd_pci_quirk_lookup_id(u16 vendor, u16 device,
477 const struct snd_pci_quirk *list); 477 const struct snd_pci_quirk *list);
478#else
479static inline const struct snd_pci_quirk *
480snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
481{
482 return NULL;
483}
484
485static inline const struct snd_pci_quirk *
486snd_pci_quirk_lookup_id(u16 vendor, u16 device,
487 const struct snd_pci_quirk *list)
488{
489 return NULL;
490}
478#endif 491#endif
479 492
480#endif /* __SOUND_CORE_H */ 493#endif /* __SOUND_CORE_H */
diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h
index f862cfff5f6a..0b6a1876639b 100644
--- a/include/sound/cs8427.h
+++ b/include/sound/cs8427.h
@@ -188,6 +188,7 @@
188 188
189struct snd_pcm_substream; 189struct snd_pcm_substream;
190 190
191int snd_cs8427_init(struct snd_i2c_bus *bus, struct snd_i2c_device *device);
191int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr, 192int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
192 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427); 193 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
193int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, 194int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index dfb42ca6d043..c46908c1bb3f 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -436,8 +436,6 @@
436#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */ 436#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */
437#define CCCA_CURRADDR 0x18000008 437#define CCCA_CURRADDR 0x18000008
438 438
439/* undefine CCR to avoid conflict with the definition for SH */
440#undef CCR
441#define CCR 0x09 /* Cache control register */ 439#define CCR 0x09 /* Cache control register */
442#define CCR_CACHEINVALIDSIZE 0x07190009 440#define CCR_CACHEINVALIDSIZE 0x07190009
443#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */ 441#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */
diff --git a/include/sound/hwdep.h b/include/sound/hwdep.h
index 8c05e47a4090..ae04a3ec9c77 100644
--- a/include/sound/hwdep.h
+++ b/include/sound/hwdep.h
@@ -60,7 +60,6 @@ struct snd_hwdep {
60 int iface; 60 int iface;
61 61
62#ifdef CONFIG_SND_OSSEMUL 62#ifdef CONFIG_SND_OSSEMUL
63 char oss_dev[32];
64 int oss_type; 63 int oss_type;
65 int ossreg; 64 int ossreg;
66#endif 65#endif
@@ -69,6 +68,8 @@ struct snd_hwdep {
69 wait_queue_head_t open_wait; 68 wait_queue_head_t open_wait;
70 void *private_data; 69 void *private_data;
71 void (*private_free) (struct snd_hwdep *hwdep); 70 void (*private_free) (struct snd_hwdep *hwdep);
71 struct device *dev;
72 const struct attribute_group **groups;
72 73
73 struct mutex open_mutex; 74 struct mutex open_mutex;
74 int used; /* reference counter */ 75 int used; /* reference counter */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 4883499ab38b..b4d6697085fe 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -1141,4 +1141,12 @@ static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
1141 return 1ULL << (__force int) pcm_format; 1141 return 1ULL << (__force int) pcm_format;
1142} 1142}
1143 1143
1144/* printk helpers */
1145#define pcm_err(pcm, fmt, args...) \
1146 dev_err((pcm)->card->dev, fmt, ##args)
1147#define pcm_warn(pcm, fmt, args...) \
1148 dev_warn((pcm)->card->dev, fmt, ##args)
1149#define pcm_dbg(pcm, fmt, args...) \
1150 dev_dbg((pcm)->card->dev, fmt, ##args)
1151
1144#endif /* __SOUND_PCM_H */ 1152#endif /* __SOUND_PCM_H */
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index adf0885153f3..311dafe6cc4b 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -157,10 +157,8 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
157 157
158/* callbacks */ 158/* callbacks */
159 159
160void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
161int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, 160int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
162 const unsigned char *buffer, int count); 161 const unsigned char *buffer, int count);
163void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
164int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream); 162int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
165int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, 163int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
166 unsigned char *buffer, int count); 164 unsigned char *buffer, int count);
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index 6add6ccc811e..34a3c02a4576 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -34,17 +34,17 @@
34 * B : SSI direction 34 * B : SSI direction
35 */ 35 */
36#define RSND_SSI_CLK_PIN_SHARE (1 << 31) 36#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
37#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
38
39#define RSND_SSI_PLAY (1 << 24) 37#define RSND_SSI_PLAY (1 << 24)
40 38
39#define RSND_SSI(_dma_id, _pio_irq, _flags) \
40{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
41#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \ 41#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
42{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags } 42{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
43#define RSND_SSI_UNUSED \ 43#define RSND_SSI_UNUSED \
44{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 } 44{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
45 45
46struct rsnd_ssi_platform_info { 46struct rsnd_ssi_platform_info {
47 int dai_id; 47 int dai_id; /* will be removed */
48 int dma_id; 48 int dma_id;
49 int pio_irq; 49 int pio_irq;
50 u32 flags; 50 u32 flags;
@@ -55,9 +55,31 @@ struct rsnd_ssi_platform_info {
55 */ 55 */
56#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */ 56#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
57 57
58struct rsnd_scu_platform_info { 58#define RSND_SRC(rate, _dma_id) \
59{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
60#define RSND_SRC_SET(rate, _dma_id) \
61 { .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
62#define RSND_SRC_UNUSED \
63 { .flags = 0, .convert_rate = 0, .dma_id = 0, }
64
65#define rsnd_scu_platform_info rsnd_src_platform_info
66#define src_info scu_info
67#define src_info_nr scu_info_nr
68
69struct rsnd_src_platform_info {
59 u32 flags; 70 u32 flags;
60 u32 convert_rate; /* sampling rate convert */ 71 u32 convert_rate; /* sampling rate convert */
72 int dma_id; /* for Gen2 SCU */
73};
74
75struct rsnd_dai_path_info {
76 struct rsnd_ssi_platform_info *ssi;
77 struct rsnd_src_platform_info *src;
78};
79
80struct rsnd_dai_platform_info {
81 struct rsnd_dai_path_info playback;
82 struct rsnd_dai_path_info capture;
61}; 83};
62 84
63/* 85/*
@@ -75,8 +97,10 @@ struct rcar_snd_info {
75 u32 flags; 97 u32 flags;
76 struct rsnd_ssi_platform_info *ssi_info; 98 struct rsnd_ssi_platform_info *ssi_info;
77 int ssi_info_nr; 99 int ssi_info_nr;
78 struct rsnd_scu_platform_info *scu_info; 100 struct rsnd_src_platform_info *src_info;
79 int scu_info_nr; 101 int src_info_nr;
102 struct rsnd_dai_platform_info *dai_info;
103 int dai_info_nr;
80 int (*start)(int id); 104 int (*start)(int id);
81 int (*stop)(int id); 105 int (*stop)(int id);
82}; 106};
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 6c74527d4926..9b0ac77177b6 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -18,6 +18,8 @@ struct asoc_simple_dai {
18 const char *name; 18 const char *name;
19 unsigned int fmt; 19 unsigned int fmt;
20 unsigned int sysclk; 20 unsigned int sysclk;
21 int slots;
22 int slot_width;
21}; 23};
22 24
23struct asoc_simple_card_info { 25struct asoc_simple_card_info {
@@ -29,10 +31,6 @@ struct asoc_simple_card_info {
29 unsigned int daifmt; 31 unsigned int daifmt;
30 struct asoc_simple_dai cpu_dai; 32 struct asoc_simple_dai cpu_dai;
31 struct asoc_simple_dai codec_dai; 33 struct asoc_simple_dai codec_dai;
32
33 /* used in simple-card.c */
34 struct snd_soc_dai_link snd_link;
35 struct snd_soc_card snd_card;
36}; 34};
37 35
38#endif /* __SIMPLE_CARD_H */ 36#endif /* __SIMPLE_CARD_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 71f27c403194..fad76769f153 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -142,6 +142,8 @@ struct snd_soc_dai_ops {
142 * Called by soc_card drivers, normally in their hw_params. 142 * Called by soc_card drivers, normally in their hw_params.
143 */ 143 */
144 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); 144 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
145 int (*xlate_tdm_slot_mask)(unsigned int slots,
146 unsigned int *tx_mask, unsigned int *rx_mask);
145 int (*set_tdm_slot)(struct snd_soc_dai *dai, 147 int (*set_tdm_slot)(struct snd_soc_dai *dai,
146 unsigned int tx_mask, unsigned int rx_mask, 148 unsigned int tx_mask, unsigned int rx_mask,
147 int slots, int slot_width); 149 int slots, int slot_width);
@@ -270,6 +272,7 @@ struct snd_soc_dai {
270 /* parent platform/codec */ 272 /* parent platform/codec */
271 struct snd_soc_platform *platform; 273 struct snd_soc_platform *platform;
272 struct snd_soc_codec *codec; 274 struct snd_soc_codec *codec;
275 struct snd_soc_component *component;
273 276
274 struct snd_soc_card *card; 277 struct snd_soc_card *card;
275 278
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 6e89ef6c11c1..ef78f562f4a8 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -108,13 +108,9 @@ struct device;
108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 108 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
109 .kcontrol_news = wcontrols, .num_kcontrols = 1} 109 .kcontrol_news = wcontrols, .num_kcontrols = 1}
110#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ 110#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
111{ .id = snd_soc_dapm_virt_mux, .name = wname, \ 111 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
112 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
113 .kcontrol_news = wcontrols, .num_kcontrols = 1}
114#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ 112#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
115{ .id = snd_soc_dapm_value_mux, .name = wname, \ 113 SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
116 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
117 .kcontrol_news = wcontrols, .num_kcontrols = 1}
118 114
119/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 115/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
120#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 116#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
@@ -172,10 +168,8 @@ struct device;
172 .event = wevent, .event_flags = wflags} 168 .event = wevent, .event_flags = wflags}
173#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ 169#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
174 wevent, wflags) \ 170 wevent, wflags) \
175{ .id = snd_soc_dapm_virt_mux, .name = wname, \ 171 SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \
176 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 172 wflags)
177 .kcontrol_news = wcontrols, .num_kcontrols = 1, \
178 .event = wevent, .event_flags = wflags}
179 173
180/* additional sequencing control within an event type */ 174/* additional sequencing control within an event type */
181#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ 175#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
@@ -311,12 +305,8 @@ struct device;
311 .get = snd_soc_dapm_get_enum_double, \ 305 .get = snd_soc_dapm_get_enum_double, \
312 .put = snd_soc_dapm_put_enum_double, \ 306 .put = snd_soc_dapm_put_enum_double, \
313 .private_value = (unsigned long)&xenum } 307 .private_value = (unsigned long)&xenum }
314#define SOC_DAPM_ENUM_VIRT(xname, xenum) \ 308#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
315{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 309 SOC_DAPM_ENUM(xname, xenum)
316 .info = snd_soc_info_enum_double, \
317 .get = snd_soc_dapm_get_enum_virt, \
318 .put = snd_soc_dapm_put_enum_virt, \
319 .private_value = (unsigned long)&xenum }
320#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ 310#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
321{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 311{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
322 .info = snd_soc_info_enum_double, \ 312 .info = snd_soc_info_enum_double, \
@@ -324,11 +314,7 @@ struct device;
324 .put = xput, \ 314 .put = xput, \
325 .private_value = (unsigned long)&xenum } 315 .private_value = (unsigned long)&xenum }
326#define SOC_DAPM_VALUE_ENUM(xname, xenum) \ 316#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
327{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 317 SOC_DAPM_ENUM(xname, xenum)
328 .info = snd_soc_info_enum_double, \
329 .get = snd_soc_dapm_get_value_enum_double, \
330 .put = snd_soc_dapm_put_value_enum_double, \
331 .private_value = (unsigned long)&xenum }
332#define SOC_DAPM_PIN_SWITCH(xname) \ 318#define SOC_DAPM_PIN_SWITCH(xname) \
333{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \ 319{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
334 .info = snd_soc_dapm_info_pin_switch, \ 320 .info = snd_soc_dapm_info_pin_switch, \
@@ -392,14 +378,6 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
392 struct snd_ctl_elem_value *ucontrol); 378 struct snd_ctl_elem_value *ucontrol);
393int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, 379int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
394 struct snd_ctl_elem_value *ucontrol); 380 struct snd_ctl_elem_value *ucontrol);
395int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,
396 struct snd_ctl_elem_value *ucontrol);
397int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
398 struct snd_ctl_elem_value *ucontrol);
399int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
400 struct snd_ctl_elem_value *ucontrol);
401int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
402 struct snd_ctl_elem_value *ucontrol);
403int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, 381int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_info *uinfo); 382 struct snd_ctl_elem_info *uinfo);
405int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol, 383int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
@@ -461,6 +439,7 @@ int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
461int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, 439int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
462 const char *pin); 440 const char *pin);
463int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); 441int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
442int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
464int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, 443int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
465 const char *pin); 444 const char *pin);
466int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, 445int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
@@ -470,7 +449,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
470void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec); 449void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
471 450
472/* Mostly internal - should not normally be used */ 451/* Mostly internal - should not normally be used */
473void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
474void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm); 452void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
475 453
476/* dapm path query */ 454/* dapm path query */
@@ -484,8 +462,6 @@ enum snd_soc_dapm_type {
484 snd_soc_dapm_input = 0, /* input pin */ 462 snd_soc_dapm_input = 0, /* input pin */
485 snd_soc_dapm_output, /* output pin */ 463 snd_soc_dapm_output, /* output pin */
486 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 464 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
487 snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */
488 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
489 snd_soc_dapm_mixer, /* mixes several analog signals together */ 465 snd_soc_dapm_mixer, /* mixes several analog signals together */
490 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ 466 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
491 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 467 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9a001472b96a..0b83168d8ff4 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -45,6 +45,11 @@
45 ((unsigned long)&(struct soc_mixer_control) \ 45 ((unsigned long)&(struct soc_mixer_control) \
46 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 46 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
47 .max = xmax, .platform_max = xmax, .invert = xinvert}) 47 .max = xmax, .platform_max = xmax, .invert = xinvert})
48#define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
49 ((unsigned long)&(struct soc_mixer_control) \
50 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
51 .max = xmax, .min = xmin, .platform_max = xmax, .sign_bit = xsign_bit, \
52 .invert = xinvert})
48#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ 53#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
49 ((unsigned long)&(struct soc_mixer_control) \ 54 ((unsigned long)&(struct soc_mixer_control) \
50 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 55 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
@@ -152,6 +157,15 @@
152 {.reg = xreg, .rreg = xrreg, \ 157 {.reg = xreg, .rreg = xrreg, \
153 .shift = xshift, .rshift = xshift, \ 158 .shift = xshift, .rshift = xshift, \
154 .max = xmax, .min = xmin} } 159 .max = xmax, .min = xmin} }
160#define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
161{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
162 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
163 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
164 .tlv.p = (tlv_array), \
165 .info = snd_soc_info_volsw, \
166 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
167 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
168 xmin, xmax, xsign_bit, xinvert) }
155#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 169#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
156{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 170{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
157 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 171 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
@@ -162,30 +176,28 @@
162 .private_value = (unsigned long)&(struct soc_mixer_control) \ 176 .private_value = (unsigned long)&(struct soc_mixer_control) \
163 {.reg = xreg, .min = xmin, .max = xmax, \ 177 {.reg = xreg, .min = xmin, .max = xmax, \
164 .platform_max = xmax} } 178 .platform_max = xmax} }
165#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 179#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
166{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 180{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
167 .max = xmax, .texts = xtexts, \ 181 .items = xitems, .texts = xtexts, \
168 .mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0} 182 .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
169#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ 183#define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
170 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 184 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
171#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 185#define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
172{ .max = xmax, .texts = xtexts } 186{ .items = xitems, .texts = xtexts }
173#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \ 187#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
174{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 188{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
175 .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues} 189 .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
176#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \ 190#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
177 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues) 191 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues)
192#define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
193 SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
178#define SOC_ENUM(xname, xenum) \ 194#define SOC_ENUM(xname, xenum) \
179{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 195{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
180 .info = snd_soc_info_enum_double, \ 196 .info = snd_soc_info_enum_double, \
181 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 197 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
182 .private_value = (unsigned long)&xenum } 198 .private_value = (unsigned long)&xenum }
183#define SOC_VALUE_ENUM(xname, xenum) \ 199#define SOC_VALUE_ENUM(xname, xenum) \
184{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 200 SOC_ENUM(xname, xenum)
185 .info = snd_soc_info_enum_double, \
186 .get = snd_soc_get_value_enum_double, \
187 .put = snd_soc_put_value_enum_double, \
188 .private_value = (unsigned long)&xenum }
189#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ 201#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
190 xhandler_get, xhandler_put) \ 202 xhandler_get, xhandler_put) \
191{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 203{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -272,17 +284,19 @@
272 * ARRAY_SIZE internally 284 * ARRAY_SIZE internally
273 */ 285 */
274#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ 286#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
275 struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ 287 const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
276 ARRAY_SIZE(xtexts), xtexts) 288 ARRAY_SIZE(xtexts), xtexts)
277#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ 289#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
278 SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) 290 SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
279#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ 291#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
280 struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) 292 const struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
281#define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ 293#define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
282 struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ 294 const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
283 ARRAY_SIZE(xtexts), xtexts, xvalues) 295 ARRAY_SIZE(xtexts), xtexts, xvalues)
284#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ 296#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
285 SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) 297 SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
298#define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
299 const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
286 300
287/* 301/*
288 * Component probe and remove ordering levels for components with runtime 302 * Component probe and remove ordering levels for components with runtime
@@ -340,12 +354,6 @@ typedef int (*hw_write_t)(void *,const char* ,int);
340 354
341extern struct snd_ac97_bus_ops *soc_ac97_ops; 355extern struct snd_ac97_bus_ops *soc_ac97_ops;
342 356
343enum snd_soc_control_type {
344 SND_SOC_I2C = 1,
345 SND_SOC_SPI,
346 SND_SOC_REGMAP,
347};
348
349enum snd_soc_pcm_subclass { 357enum snd_soc_pcm_subclass {
350 SND_SOC_PCM_CLASS_PCM = 0, 358 SND_SOC_PCM_CLASS_PCM = 0,
351 SND_SOC_PCM_CLASS_BE = 1, 359 SND_SOC_PCM_CLASS_BE = 1,
@@ -392,8 +400,7 @@ int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
392int snd_soc_codec_writable_register(struct snd_soc_codec *codec, 400int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
393 unsigned int reg); 401 unsigned int reg);
394int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 402int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
395 int addr_bits, int data_bits, 403 struct regmap *regmap);
396 enum snd_soc_control_type control);
397int snd_soc_cache_sync(struct snd_soc_codec *codec); 404int snd_soc_cache_sync(struct snd_soc_codec *codec);
398int snd_soc_cache_init(struct snd_soc_codec *codec); 405int snd_soc_cache_init(struct snd_soc_codec *codec);
399int snd_soc_cache_exit(struct snd_soc_codec *codec); 406int snd_soc_cache_exit(struct snd_soc_codec *codec);
@@ -413,6 +420,10 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
413struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, 420struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
414 const char *dai_link); 421 const char *dai_link);
415 422
423bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
424void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream);
425void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);
426
416/* Utility functions to get clock rates from various things */ 427/* Utility functions to get clock rates from various things */
417int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 428int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
418int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 429int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@ -496,10 +507,6 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
496 struct snd_ctl_elem_value *ucontrol); 507 struct snd_ctl_elem_value *ucontrol);
497int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, 508int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
498 struct snd_ctl_elem_value *ucontrol); 509 struct snd_ctl_elem_value *ucontrol);
499int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
500 struct snd_ctl_elem_value *ucontrol);
501int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
502 struct snd_ctl_elem_value *ucontrol);
503int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, 510int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
504 struct snd_ctl_elem_info *uinfo); 511 struct snd_ctl_elem_info *uinfo);
505#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info 512#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
@@ -600,7 +607,8 @@ struct snd_soc_jack_gpio {
600 struct snd_soc_jack *jack; 607 struct snd_soc_jack *jack;
601 struct delayed_work work; 608 struct delayed_work work;
602 609
603 int (*jack_status_check)(void); 610 void *data;
611 int (*jack_status_check)(void *data);
604}; 612};
605 613
606struct snd_soc_jack { 614struct snd_soc_jack {
@@ -656,12 +664,19 @@ struct snd_soc_component {
656 const char *name; 664 const char *name;
657 int id; 665 int id;
658 struct device *dev; 666 struct device *dev;
667
668 unsigned int active;
669
670 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
671
659 struct list_head list; 672 struct list_head list;
660 673
661 struct snd_soc_dai_driver *dai_drv; 674 struct snd_soc_dai_driver *dai_drv;
662 int num_dai; 675 int num_dai;
663 676
664 const struct snd_soc_component_driver *driver; 677 const struct snd_soc_component_driver *driver;
678
679 struct list_head dai_list;
665}; 680};
666 681
667/* SoC Audio Codec device */ 682/* SoC Audio Codec device */
@@ -683,7 +698,6 @@ struct snd_soc_codec {
683 698
684 /* runtime */ 699 /* runtime */
685 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 700 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
686 unsigned int active;
687 unsigned int cache_bypass:1; /* Suppress access to the cache */ 701 unsigned int cache_bypass:1; /* Suppress access to the cache */
688 unsigned int suspended:1; /* Codec is in suspend PM state */ 702 unsigned int suspended:1; /* Codec is in suspend PM state */
689 unsigned int probed:1; /* Codec has been probed */ 703 unsigned int probed:1; /* Codec has been probed */
@@ -697,7 +711,6 @@ struct snd_soc_codec {
697 /* codec IO */ 711 /* codec IO */
698 void *control_data; /* codec control (i2c/3wire) data */ 712 void *control_data; /* codec control (i2c/3wire) data */
699 hw_write_t hw_write; 713 hw_write_t hw_write;
700 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
701 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 714 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
702 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 715 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
703 void *reg_cache; 716 void *reg_cache;
@@ -709,7 +722,6 @@ struct snd_soc_codec {
709 722
710 /* dapm */ 723 /* dapm */
711 struct snd_soc_dapm_context dapm; 724 struct snd_soc_dapm_context dapm;
712 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
713 725
714#ifdef CONFIG_DEBUG_FS 726#ifdef CONFIG_DEBUG_FS
715 struct dentry *debugfs_codec_root; 727 struct dentry *debugfs_codec_root;
@@ -1067,6 +1079,7 @@ struct soc_mixer_control {
1067 int min, max, platform_max; 1079 int min, max, platform_max;
1068 int reg, rreg; 1080 int reg, rreg;
1069 unsigned int shift, rshift; 1081 unsigned int shift, rshift;
1082 unsigned int sign_bit;
1070 unsigned int invert:1; 1083 unsigned int invert:1;
1071 unsigned int autodisable:1; 1084 unsigned int autodisable:1;
1072}; 1085};
@@ -1085,16 +1098,28 @@ struct soc_mreg_control {
1085 1098
1086/* enumerated kcontrol */ 1099/* enumerated kcontrol */
1087struct soc_enum { 1100struct soc_enum {
1088 unsigned short reg; 1101 int reg;
1089 unsigned short reg2;
1090 unsigned char shift_l; 1102 unsigned char shift_l;
1091 unsigned char shift_r; 1103 unsigned char shift_r;
1092 unsigned int max; 1104 unsigned int items;
1093 unsigned int mask; 1105 unsigned int mask;
1094 const char * const *texts; 1106 const char * const *texts;
1095 const unsigned int *values; 1107 const unsigned int *values;
1096}; 1108};
1097 1109
1110/**
1111 * snd_soc_component_to_codec() - Casts a component to the CODEC it is embedded in
1112 * @component: The component to cast to a CODEC
1113 *
1114 * This function must only be used on components that are known to be CODECs.
1115 * Otherwise the behavior is undefined.
1116 */
1117static inline struct snd_soc_codec *snd_soc_component_to_codec(
1118 struct snd_soc_component *component)
1119{
1120 return container_of(component, struct snd_soc_codec, component);
1121}
1122
1098/* codec IO */ 1123/* codec IO */
1099unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1124unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1100unsigned int snd_soc_write(struct snd_soc_codec *codec, 1125unsigned int snd_soc_write(struct snd_soc_codec *codec,
@@ -1168,11 +1193,51 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
1168 return 1; 1193 return 1;
1169} 1194}
1170 1195
1196static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e,
1197 unsigned int val)
1198{
1199 unsigned int i;
1200
1201 if (!e->values)
1202 return val;
1203
1204 for (i = 0; i < e->items; i++)
1205 if (val == e->values[i])
1206 return i;
1207
1208 return 0;
1209}
1210
1211static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e,
1212 unsigned int item)
1213{
1214 if (!e->values)
1215 return item;
1216
1217 return e->values[item];
1218}
1219
1220static inline bool snd_soc_component_is_active(
1221 struct snd_soc_component *component)
1222{
1223 return component->active != 0;
1224}
1225
1226static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1227{
1228 return snd_soc_component_is_active(&codec->component);
1229}
1230
1171int snd_soc_util_init(void); 1231int snd_soc_util_init(void);
1172void snd_soc_util_exit(void); 1232void snd_soc_util_exit(void);
1173 1233
1174int snd_soc_of_parse_card_name(struct snd_soc_card *card, 1234int snd_soc_of_parse_card_name(struct snd_soc_card *card,
1175 const char *propname); 1235 const char *propname);
1236int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
1237 const char *propname);
1238int snd_soc_of_parse_tdm_slot(struct device_node *np,
1239 unsigned int *slots,
1240 unsigned int *slot_width);
1176int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, 1241int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
1177 const char *propname); 1242 const char *propname);
1178unsigned int snd_soc_of_parse_daifmt(struct device_node *np, 1243unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
@@ -1188,4 +1253,15 @@ extern struct dentry *snd_soc_debugfs_root;
1188 1253
1189extern const struct dev_pm_ops snd_soc_pm_ops; 1254extern const struct dev_pm_ops snd_soc_pm_ops;
1190 1255
1256/* Helper functions */
1257static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
1258{
1259 mutex_lock(&dapm->card->dapm_mutex);
1260}
1261
1262static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
1263{
1264 mutex_unlock(&dapm->card->dapm_mutex);
1265}
1266
1191#endif 1267#endif
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index 4483fadfa68d..33b487b5da92 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -21,6 +21,8 @@ struct iscsit_transport {
21 int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool); 21 int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool);
22 int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *); 22 int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *);
23 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *); 23 int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *);
24 void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *);
25 enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *);
24}; 26};
25 27
26static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd) 28static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd)
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 7020e33e742e..3a1c1eea1fff 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -73,10 +73,12 @@ sense_reason_t sbc_execute_unmap(struct se_cmd *cmd,
73 sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv, 73 sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv,
74 sector_t lba, sector_t nolb), 74 sector_t lba, sector_t nolb),
75 void *priv); 75 void *priv);
76void sbc_dif_generate(struct se_cmd *);
76sense_reason_t sbc_dif_verify_write(struct se_cmd *, sector_t, unsigned int, 77sense_reason_t sbc_dif_verify_write(struct se_cmd *, sector_t, unsigned int,
77 unsigned int, struct scatterlist *, int); 78 unsigned int, struct scatterlist *, int);
78sense_reason_t sbc_dif_verify_read(struct se_cmd *, sector_t, unsigned int, 79sense_reason_t sbc_dif_verify_read(struct se_cmd *, sector_t, unsigned int,
79 unsigned int, struct scatterlist *, int); 80 unsigned int, struct scatterlist *, int);
81sense_reason_t sbc_dif_read_strip(struct se_cmd *);
80 82
81void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 83void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
82int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 84int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 1772fadcff62..9ec9864ecf38 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -162,7 +162,7 @@ enum se_cmd_flags_table {
162 SCF_SENT_CHECK_CONDITION = 0x00000800, 162 SCF_SENT_CHECK_CONDITION = 0x00000800,
163 SCF_OVERFLOW_BIT = 0x00001000, 163 SCF_OVERFLOW_BIT = 0x00001000,
164 SCF_UNDERFLOW_BIT = 0x00002000, 164 SCF_UNDERFLOW_BIT = 0x00002000,
165 SCF_SENT_DELAYED_TAS = 0x00004000, 165 SCF_SEND_DELAYED_TAS = 0x00004000,
166 SCF_ALUA_NON_OPTIMIZED = 0x00008000, 166 SCF_ALUA_NON_OPTIMIZED = 0x00008000,
167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, 167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000,
168 SCF_ACK_KREF = 0x00040000, 168 SCF_ACK_KREF = 0x00040000,
@@ -442,19 +442,18 @@ struct se_tmr_req {
442}; 442};
443 443
444enum target_prot_op { 444enum target_prot_op {
445 TARGET_PROT_NORMAL = 0, 445 TARGET_PROT_NORMAL = 0,
446 TARGET_PROT_DIN_INSERT, 446 TARGET_PROT_DIN_INSERT = (1 << 0),
447 TARGET_PROT_DOUT_INSERT, 447 TARGET_PROT_DOUT_INSERT = (1 << 1),
448 TARGET_PROT_DIN_STRIP, 448 TARGET_PROT_DIN_STRIP = (1 << 2),
449 TARGET_PROT_DOUT_STRIP, 449 TARGET_PROT_DOUT_STRIP = (1 << 3),
450 TARGET_PROT_DIN_PASS, 450 TARGET_PROT_DIN_PASS = (1 << 4),
451 TARGET_PROT_DOUT_PASS, 451 TARGET_PROT_DOUT_PASS = (1 << 5),
452}; 452};
453 453
454enum target_prot_ho { 454#define TARGET_PROT_ALL TARGET_PROT_DIN_INSERT | TARGET_PROT_DOUT_INSERT | \
455 PROT_SEPERATED, 455 TARGET_PROT_DIN_STRIP | TARGET_PROT_DOUT_STRIP | \
456 PROT_INTERLEAVED, 456 TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS
457};
458 457
459enum target_prot_type { 458enum target_prot_type {
460 TARGET_DIF_TYPE0_PROT, 459 TARGET_DIF_TYPE0_PROT,
@@ -463,6 +462,12 @@ enum target_prot_type {
463 TARGET_DIF_TYPE3_PROT, 462 TARGET_DIF_TYPE3_PROT,
464}; 463};
465 464
465enum target_core_dif_check {
466 TARGET_DIF_CHECK_GUARD = 0x1 << 0,
467 TARGET_DIF_CHECK_APPTAG = 0x1 << 1,
468 TARGET_DIF_CHECK_REFTAG = 0x1 << 2,
469};
470
466struct se_dif_v1_tuple { 471struct se_dif_v1_tuple {
467 __be16 guard_tag; 472 __be16 guard_tag;
468 __be16 app_tag; 473 __be16 app_tag;
@@ -556,13 +561,14 @@ struct se_cmd {
556 /* DIF related members */ 561 /* DIF related members */
557 enum target_prot_op prot_op; 562 enum target_prot_op prot_op;
558 enum target_prot_type prot_type; 563 enum target_prot_type prot_type;
564 u8 prot_checks;
559 u32 prot_length; 565 u32 prot_length;
560 u32 reftag_seed; 566 u32 reftag_seed;
561 struct scatterlist *t_prot_sg; 567 struct scatterlist *t_prot_sg;
562 unsigned int t_prot_nents; 568 unsigned int t_prot_nents;
563 enum target_prot_ho prot_handover;
564 sense_reason_t pi_err; 569 sense_reason_t pi_err;
565 sector_t bad_sector; 570 sector_t bad_sector;
571 bool prot_pto;
566}; 572};
567 573
568struct se_ua { 574struct se_ua {
@@ -603,6 +609,7 @@ struct se_node_acl {
603struct se_session { 609struct se_session {
604 unsigned sess_tearing_down:1; 610 unsigned sess_tearing_down:1;
605 u64 sess_bin_isid; 611 u64 sess_bin_isid;
612 enum target_prot_op sup_prot_ops;
606 struct se_node_acl *se_node_acl; 613 struct se_node_acl *se_node_acl;
607 struct se_portal_group *se_tpg; 614 struct se_portal_group *se_tpg;
608 void *fabric_sess_ptr; 615 void *fabric_sess_ptr;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 0218d689b3d7..22a4e98eec80 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -62,6 +62,7 @@ struct target_core_fabric_ops {
62 int (*queue_data_in)(struct se_cmd *); 62 int (*queue_data_in)(struct se_cmd *);
63 int (*queue_status)(struct se_cmd *); 63 int (*queue_status)(struct se_cmd *);
64 void (*queue_tm_rsp)(struct se_cmd *); 64 void (*queue_tm_rsp)(struct se_cmd *);
65 void (*aborted_task)(struct se_cmd *);
65 /* 66 /*
66 * fabric module calls for target_core_fabric_configfs.c 67 * fabric module calls for target_core_fabric_configfs.c
67 */ 68 */
@@ -83,10 +84,11 @@ struct target_core_fabric_ops {
83 void (*fabric_drop_nodeacl)(struct se_node_acl *); 84 void (*fabric_drop_nodeacl)(struct se_node_acl *);
84}; 85};
85 86
86struct se_session *transport_init_session(void); 87struct se_session *transport_init_session(enum target_prot_op);
87int transport_alloc_session_tags(struct se_session *, unsigned int, 88int transport_alloc_session_tags(struct se_session *, unsigned int,
88 unsigned int); 89 unsigned int);
89struct se_session *transport_init_session_tags(unsigned int, unsigned int); 90struct se_session *transport_init_session_tags(unsigned int, unsigned int,
91 enum target_prot_op);
90void __transport_register_session(struct se_portal_group *, 92void __transport_register_session(struct se_portal_group *,
91 struct se_node_acl *, struct se_session *, void *); 93 struct se_node_acl *, struct se_session *, void *);
92void transport_register_session(struct se_portal_group *, 94void transport_register_session(struct se_portal_group *,
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h
index 7110897c3dfa..c9c3c044b32f 100644
--- a/include/trace/events/bcache.h
+++ b/include/trace/events/bcache.h
@@ -399,26 +399,43 @@ TRACE_EVENT(bcache_keyscan,
399 399
400/* Allocator */ 400/* Allocator */
401 401
402TRACE_EVENT(bcache_alloc_invalidate, 402TRACE_EVENT(bcache_invalidate,
403 TP_PROTO(struct cache *ca), 403 TP_PROTO(struct cache *ca, size_t bucket),
404 TP_ARGS(ca), 404 TP_ARGS(ca, bucket),
405 405
406 TP_STRUCT__entry( 406 TP_STRUCT__entry(
407 __field(unsigned, free ) 407 __field(unsigned, sectors )
408 __field(unsigned, free_inc ) 408 __field(dev_t, dev )
409 __field(unsigned, free_inc_size ) 409 __field(__u64, offset )
410 __field(unsigned, unused )
411 ), 410 ),
412 411
413 TP_fast_assign( 412 TP_fast_assign(
414 __entry->free = fifo_used(&ca->free[RESERVE_NONE]); 413 __entry->dev = ca->bdev->bd_dev;
415 __entry->free_inc = fifo_used(&ca->free_inc); 414 __entry->offset = bucket << ca->set->bucket_bits;
416 __entry->free_inc_size = ca->free_inc.size; 415 __entry->sectors = GC_SECTORS_USED(&ca->buckets[bucket]);
417 __entry->unused = fifo_used(&ca->unused);
418 ), 416 ),
419 417
420 TP_printk("free %u free_inc %u/%u unused %u", __entry->free, 418 TP_printk("invalidated %u sectors at %d,%d sector=%llu",
421 __entry->free_inc, __entry->free_inc_size, __entry->unused) 419 __entry->sectors, MAJOR(__entry->dev),
420 MINOR(__entry->dev), __entry->offset)
421);
422
423TRACE_EVENT(bcache_alloc,
424 TP_PROTO(struct cache *ca, size_t bucket),
425 TP_ARGS(ca, bucket),
426
427 TP_STRUCT__entry(
428 __field(dev_t, dev )
429 __field(__u64, offset )
430 ),
431
432 TP_fast_assign(
433 __entry->dev = ca->bdev->bd_dev;
434 __entry->offset = bucket << ca->set->bucket_bits;
435 ),
436
437 TP_printk("allocated %d,%d sector=%llu", MAJOR(__entry->dev),
438 MINOR(__entry->dev), __entry->offset)
422); 439);
423 440
424TRACE_EVENT(bcache_alloc_fail, 441TRACE_EVENT(bcache_alloc_fail,
@@ -426,21 +443,22 @@ TRACE_EVENT(bcache_alloc_fail,
426 TP_ARGS(ca, reserve), 443 TP_ARGS(ca, reserve),
427 444
428 TP_STRUCT__entry( 445 TP_STRUCT__entry(
446 __field(dev_t, dev )
429 __field(unsigned, free ) 447 __field(unsigned, free )
430 __field(unsigned, free_inc ) 448 __field(unsigned, free_inc )
431 __field(unsigned, unused )
432 __field(unsigned, blocked ) 449 __field(unsigned, blocked )
433 ), 450 ),
434 451
435 TP_fast_assign( 452 TP_fast_assign(
453 __entry->dev = ca->bdev->bd_dev;
436 __entry->free = fifo_used(&ca->free[reserve]); 454 __entry->free = fifo_used(&ca->free[reserve]);
437 __entry->free_inc = fifo_used(&ca->free_inc); 455 __entry->free_inc = fifo_used(&ca->free_inc);
438 __entry->unused = fifo_used(&ca->unused);
439 __entry->blocked = atomic_read(&ca->set->prio_blocked); 456 __entry->blocked = atomic_read(&ca->set->prio_blocked);
440 ), 457 ),
441 458
442 TP_printk("free %u free_inc %u unused %u blocked %u", __entry->free, 459 TP_printk("alloc fail %d,%d free %u free_inc %u blocked %u",
443 __entry->free_inc, __entry->unused, __entry->blocked) 460 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->free,
461 __entry->free_inc, __entry->blocked)
444); 462);
445 463
446/* Background writeback */ 464/* Background writeback */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
index e76ae19a8d6f..e8a5eca1dbe5 100644
--- a/include/trace/events/block.h
+++ b/include/trace/events/block.h
@@ -132,6 +132,7 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
132 * block_rq_complete - block IO operation completed by device driver 132 * block_rq_complete - block IO operation completed by device driver
133 * @q: queue containing the block operation request 133 * @q: queue containing the block operation request
134 * @rq: block operations request 134 * @rq: block operations request
135 * @nr_bytes: number of completed bytes
135 * 136 *
136 * The block_rq_complete tracepoint event indicates that some portion 137 * The block_rq_complete tracepoint event indicates that some portion
137 * of operation request has been completed by the device driver. If 138 * of operation request has been completed by the device driver. If
@@ -139,11 +140,37 @@ DEFINE_EVENT(block_rq_with_error, block_rq_requeue,
139 * do for the request. If @rq->bio is non-NULL then there is 140 * do for the request. If @rq->bio is non-NULL then there is
140 * additional work required to complete the request. 141 * additional work required to complete the request.
141 */ 142 */
142DEFINE_EVENT(block_rq_with_error, block_rq_complete, 143TRACE_EVENT(block_rq_complete,
143 144
144 TP_PROTO(struct request_queue *q, struct request *rq), 145 TP_PROTO(struct request_queue *q, struct request *rq,
146 unsigned int nr_bytes),
145 147
146 TP_ARGS(q, rq) 148 TP_ARGS(q, rq, nr_bytes),
149
150 TP_STRUCT__entry(
151 __field( dev_t, dev )
152 __field( sector_t, sector )
153 __field( unsigned int, nr_sector )
154 __field( int, errors )
155 __array( char, rwbs, RWBS_LEN )
156 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
157 ),
158
159 TP_fast_assign(
160 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
161 __entry->sector = blk_rq_pos(rq);
162 __entry->nr_sector = nr_bytes >> 9;
163 __entry->errors = rq->errors;
164
165 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, nr_bytes);
166 blk_dump_cmd(__get_str(cmd), rq);
167 ),
168
169 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
170 MAJOR(__entry->dev), MINOR(__entry->dev),
171 __entry->rwbs, __get_str(cmd),
172 (unsigned long long)__entry->sector,
173 __entry->nr_sector, __entry->errors)
147); 174);
148 175
149DECLARE_EVENT_CLASS(block_rq, 176DECLARE_EVENT_CLASS(block_rq,
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 3176cdc32937..4ee4e30d26d9 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -21,6 +21,8 @@ struct btrfs_block_group_cache;
21struct btrfs_free_cluster; 21struct btrfs_free_cluster;
22struct map_lookup; 22struct map_lookup;
23struct extent_buffer; 23struct extent_buffer;
24struct btrfs_work;
25struct __btrfs_workqueue;
24 26
25#define show_ref_type(type) \ 27#define show_ref_type(type) \
26 __print_symbolic(type, \ 28 __print_symbolic(type, \
@@ -982,6 +984,141 @@ TRACE_EVENT(free_extent_state,
982 (void *)__entry->ip) 984 (void *)__entry->ip)
983); 985);
984 986
987DECLARE_EVENT_CLASS(btrfs__work,
988
989 TP_PROTO(struct btrfs_work *work),
990
991 TP_ARGS(work),
992
993 TP_STRUCT__entry(
994 __field( void *, work )
995 __field( void *, wq )
996 __field( void *, func )
997 __field( void *, ordered_func )
998 __field( void *, ordered_free )
999 ),
1000
1001 TP_fast_assign(
1002 __entry->work = work;
1003 __entry->wq = work->wq;
1004 __entry->func = work->func;
1005 __entry->ordered_func = work->ordered_func;
1006 __entry->ordered_free = work->ordered_free;
1007 ),
1008
1009 TP_printk("work=%p, wq=%p, func=%p, ordered_func=%p, ordered_free=%p",
1010 __entry->work, __entry->wq, __entry->func,
1011 __entry->ordered_func, __entry->ordered_free)
1012);
1013
1014/* For situiations that the work is freed */
1015DECLARE_EVENT_CLASS(btrfs__work__done,
1016
1017 TP_PROTO(struct btrfs_work *work),
1018
1019 TP_ARGS(work),
1020
1021 TP_STRUCT__entry(
1022 __field( void *, work )
1023 ),
1024
1025 TP_fast_assign(
1026 __entry->work = work;
1027 ),
1028
1029 TP_printk("work->%p", __entry->work)
1030);
1031
1032DEFINE_EVENT(btrfs__work, btrfs_work_queued,
1033
1034 TP_PROTO(struct btrfs_work *work),
1035
1036 TP_ARGS(work)
1037);
1038
1039DEFINE_EVENT(btrfs__work, btrfs_work_sched,
1040
1041 TP_PROTO(struct btrfs_work *work),
1042
1043 TP_ARGS(work)
1044);
1045
1046DEFINE_EVENT(btrfs__work, btrfs_normal_work_done,
1047
1048 TP_PROTO(struct btrfs_work *work),
1049
1050 TP_ARGS(work)
1051);
1052
1053DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done,
1054
1055 TP_PROTO(struct btrfs_work *work),
1056
1057 TP_ARGS(work)
1058);
1059
1060DEFINE_EVENT(btrfs__work, btrfs_ordered_sched,
1061
1062 TP_PROTO(struct btrfs_work *work),
1063
1064 TP_ARGS(work)
1065);
1066
1067DECLARE_EVENT_CLASS(btrfs__workqueue,
1068
1069 TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high),
1070
1071 TP_ARGS(wq, name, high),
1072
1073 TP_STRUCT__entry(
1074 __field( void *, wq )
1075 __string( name, name )
1076 __field( int , high )
1077 ),
1078
1079 TP_fast_assign(
1080 __entry->wq = wq;
1081 __assign_str(name, name);
1082 __entry->high = high;
1083 ),
1084
1085 TP_printk("name=%s%s, wq=%p", __get_str(name),
1086 __print_flags(__entry->high, "",
1087 {(WQ_HIGHPRI), "-high"}),
1088 __entry->wq)
1089);
1090
1091DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc,
1092
1093 TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high),
1094
1095 TP_ARGS(wq, name, high)
1096);
1097
1098DECLARE_EVENT_CLASS(btrfs__workqueue_done,
1099
1100 TP_PROTO(struct __btrfs_workqueue *wq),
1101
1102 TP_ARGS(wq),
1103
1104 TP_STRUCT__entry(
1105 __field( void *, wq )
1106 ),
1107
1108 TP_fast_assign(
1109 __entry->wq = wq;
1110 ),
1111
1112 TP_printk("wq=%p", __entry->wq)
1113);
1114
1115DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy,
1116
1117 TP_PROTO(struct __btrfs_workqueue *wq),
1118
1119 TP_ARGS(wq)
1120);
1121
985#endif /* _TRACE_BTRFS_H */ 1122#endif /* _TRACE_BTRFS_H */
986 1123
987/* This part must be outside protection */ 1124/* This part must be outside protection */
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 197d3125df2a..010ea89eeb0e 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -16,6 +16,15 @@ struct mpage_da_data;
16struct ext4_map_blocks; 16struct ext4_map_blocks;
17struct extent_status; 17struct extent_status;
18 18
19/* shim until we merge in the xfs_collapse_range branch */
20#ifndef FALLOC_FL_COLLAPSE_RANGE
21#define FALLOC_FL_COLLAPSE_RANGE 0x08
22#endif
23
24#ifndef FALLOC_FL_ZERO_RANGE
25#define FALLOC_FL_ZERO_RANGE 0x10
26#endif
27
19#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode)) 28#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
20 29
21#define show_mballoc_flags(flags) __print_flags(flags, "|", \ 30#define show_mballoc_flags(flags) __print_flags(flags, "|", \
@@ -68,6 +77,13 @@ struct extent_status;
68 { EXTENT_STATUS_DELAYED, "D" }, \ 77 { EXTENT_STATUS_DELAYED, "D" }, \
69 { EXTENT_STATUS_HOLE, "H" }) 78 { EXTENT_STATUS_HOLE, "H" })
70 79
80#define show_falloc_mode(mode) __print_flags(mode, "|", \
81 { FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \
82 { FALLOC_FL_PUNCH_HOLE, "PUNCH_HOLE"}, \
83 { FALLOC_FL_NO_HIDE_STALE, "NO_HIDE_STALE"}, \
84 { FALLOC_FL_COLLAPSE_RANGE, "COLLAPSE_RANGE"}, \
85 { FALLOC_FL_ZERO_RANGE, "ZERO_RANGE"})
86
71 87
72TRACE_EVENT(ext4_free_inode, 88TRACE_EVENT(ext4_free_inode,
73 TP_PROTO(struct inode *inode), 89 TP_PROTO(struct inode *inode),
@@ -1328,7 +1344,7 @@ TRACE_EVENT(ext4_direct_IO_exit,
1328 __entry->rw, __entry->ret) 1344 __entry->rw, __entry->ret)
1329); 1345);
1330 1346
1331TRACE_EVENT(ext4_fallocate_enter, 1347DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1332 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode), 1348 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1333 1349
1334 TP_ARGS(inode, offset, len, mode), 1350 TP_ARGS(inode, offset, len, mode),
@@ -1336,23 +1352,45 @@ TRACE_EVENT(ext4_fallocate_enter,
1336 TP_STRUCT__entry( 1352 TP_STRUCT__entry(
1337 __field( dev_t, dev ) 1353 __field( dev_t, dev )
1338 __field( ino_t, ino ) 1354 __field( ino_t, ino )
1339 __field( loff_t, pos ) 1355 __field( loff_t, offset )
1340 __field( loff_t, len ) 1356 __field( loff_t, len )
1341 __field( int, mode ) 1357 __field( int, mode )
1342 ), 1358 ),
1343 1359
1344 TP_fast_assign( 1360 TP_fast_assign(
1345 __entry->dev = inode->i_sb->s_dev; 1361 __entry->dev = inode->i_sb->s_dev;
1346 __entry->ino = inode->i_ino; 1362 __entry->ino = inode->i_ino;
1347 __entry->pos = offset; 1363 __entry->offset = offset;
1348 __entry->len = len; 1364 __entry->len = len;
1349 __entry->mode = mode; 1365 __entry->mode = mode;
1350 ), 1366 ),
1351 1367
1352 TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d", 1368 TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1353 MAJOR(__entry->dev), MINOR(__entry->dev), 1369 MAJOR(__entry->dev), MINOR(__entry->dev),
1354 (unsigned long) __entry->ino, __entry->pos, 1370 (unsigned long) __entry->ino,
1355 __entry->len, __entry->mode) 1371 __entry->offset, __entry->len,
1372 show_falloc_mode(__entry->mode))
1373);
1374
1375DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1376
1377 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1378
1379 TP_ARGS(inode, offset, len, mode)
1380);
1381
1382DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1383
1384 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1385
1386 TP_ARGS(inode, offset, len, mode)
1387);
1388
1389DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1390
1391 TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1392
1393 TP_ARGS(inode, offset, len, mode)
1356); 1394);
1357 1395
1358TRACE_EVENT(ext4_fallocate_exit, 1396TRACE_EVENT(ext4_fallocate_exit,
@@ -1384,31 +1422,6 @@ TRACE_EVENT(ext4_fallocate_exit,
1384 __entry->ret) 1422 __entry->ret)
1385); 1423);
1386 1424
1387TRACE_EVENT(ext4_punch_hole,
1388 TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
1389
1390 TP_ARGS(inode, offset, len),
1391
1392 TP_STRUCT__entry(
1393 __field( dev_t, dev )
1394 __field( ino_t, ino )
1395 __field( loff_t, offset )
1396 __field( loff_t, len )
1397 ),
1398
1399 TP_fast_assign(
1400 __entry->dev = inode->i_sb->s_dev;
1401 __entry->ino = inode->i_ino;
1402 __entry->offset = offset;
1403 __entry->len = len;
1404 ),
1405
1406 TP_printk("dev %d,%d ino %lu offset %lld len %lld",
1407 MAJOR(__entry->dev), MINOR(__entry->dev),
1408 (unsigned long) __entry->ino,
1409 __entry->offset, __entry->len)
1410);
1411
1412TRACE_EVENT(ext4_unlink_enter, 1425TRACE_EVENT(ext4_unlink_enter,
1413 TP_PROTO(struct inode *parent, struct dentry *dentry), 1426 TP_PROTO(struct inode *parent, struct dentry *dentry),
1414 1427
@@ -2410,6 +2423,31 @@ TRACE_EVENT(ext4_es_shrink_exit,
2410 __entry->shrunk_nr, __entry->cache_cnt) 2423 __entry->shrunk_nr, __entry->cache_cnt)
2411); 2424);
2412 2425
2426TRACE_EVENT(ext4_collapse_range,
2427 TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2428
2429 TP_ARGS(inode, offset, len),
2430
2431 TP_STRUCT__entry(
2432 __field(dev_t, dev)
2433 __field(ino_t, ino)
2434 __field(loff_t, offset)
2435 __field(loff_t, len)
2436 ),
2437
2438 TP_fast_assign(
2439 __entry->dev = inode->i_sb->s_dev;
2440 __entry->ino = inode->i_ino;
2441 __entry->offset = offset;
2442 __entry->len = len;
2443 ),
2444
2445 TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2446 MAJOR(__entry->dev), MINOR(__entry->dev),
2447 (unsigned long) __entry->ino,
2448 __entry->offset, __entry->len)
2449);
2450
2413#endif /* _TRACE_EXT4_H */ 2451#endif /* _TRACE_EXT4_H */
2414 2452
2415/* This part must be outside protection */ 2453/* This part must be outside protection */
diff --git a/include/trace/events/hswadsp.h b/include/trace/events/hswadsp.h
new file mode 100644
index 000000000000..0f78bbb02002
--- /dev/null
+++ b/include/trace/events/hswadsp.h
@@ -0,0 +1,384 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM hswadsp
3
4#if !defined(_TRACE_HSWADSP_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_HSWADSP_H
6
7#include <linux/types.h>
8#include <linux/ktime.h>
9#include <linux/tracepoint.h>
10
11struct sst_hsw;
12struct sst_hsw_stream;
13struct sst_hsw_ipc_stream_free_req;
14struct sst_hsw_ipc_volume_req;
15struct sst_hsw_ipc_stream_alloc_req;
16struct sst_hsw_audio_data_format_ipc;
17struct sst_hsw_ipc_stream_info_reply;
18struct sst_hsw_ipc_device_config_req;
19
20DECLARE_EVENT_CLASS(sst_irq,
21
22 TP_PROTO(uint32_t status, uint32_t mask),
23
24 TP_ARGS(status, mask),
25
26 TP_STRUCT__entry(
27 __field( unsigned int, status )
28 __field( unsigned int, mask )
29 ),
30
31 TP_fast_assign(
32 __entry->status = status;
33 __entry->mask = mask;
34 ),
35
36 TP_printk("status 0x%8.8x mask 0x%8.8x",
37 (unsigned int)__entry->status, (unsigned int)__entry->mask)
38);
39
40DEFINE_EVENT(sst_irq, sst_irq_busy,
41
42 TP_PROTO(unsigned int status, unsigned int mask),
43
44 TP_ARGS(status, mask)
45
46);
47
48DEFINE_EVENT(sst_irq, sst_irq_done,
49
50 TP_PROTO(unsigned int status, unsigned int mask),
51
52 TP_ARGS(status, mask)
53
54);
55
56DECLARE_EVENT_CLASS(ipc,
57
58 TP_PROTO(const char *name, int val),
59
60 TP_ARGS(name, val),
61
62 TP_STRUCT__entry(
63 __string( name, name )
64 __field( unsigned int, val )
65 ),
66
67 TP_fast_assign(
68 __assign_str(name, name);
69 __entry->val = val;
70 ),
71
72 TP_printk("%s 0x%8.8x", __get_str(name), (unsigned int)__entry->val)
73
74);
75
76DEFINE_EVENT(ipc, ipc_request,
77
78 TP_PROTO(const char *name, int val),
79
80 TP_ARGS(name, val)
81
82);
83
84DEFINE_EVENT(ipc, ipc_reply,
85
86 TP_PROTO(const char *name, int val),
87
88 TP_ARGS(name, val)
89
90);
91
92DEFINE_EVENT(ipc, ipc_pending_reply,
93
94 TP_PROTO(const char *name, int val),
95
96 TP_ARGS(name, val)
97
98);
99
100DEFINE_EVENT(ipc, ipc_notification,
101
102 TP_PROTO(const char *name, int val),
103
104 TP_ARGS(name, val)
105
106);
107
108DEFINE_EVENT(ipc, ipc_error,
109
110 TP_PROTO(const char *name, int val),
111
112 TP_ARGS(name, val)
113
114);
115
116DECLARE_EVENT_CLASS(stream_position,
117
118 TP_PROTO(unsigned int id, unsigned int pos),
119
120 TP_ARGS(id, pos),
121
122 TP_STRUCT__entry(
123 __field( unsigned int, id )
124 __field( unsigned int, pos )
125 ),
126
127 TP_fast_assign(
128 __entry->id = id;
129 __entry->pos = pos;
130 ),
131
132 TP_printk("id %d position 0x%x",
133 (unsigned int)__entry->id, (unsigned int)__entry->pos)
134);
135
136DEFINE_EVENT(stream_position, stream_read_position,
137
138 TP_PROTO(unsigned int id, unsigned int pos),
139
140 TP_ARGS(id, pos)
141
142);
143
144DEFINE_EVENT(stream_position, stream_write_position,
145
146 TP_PROTO(unsigned int id, unsigned int pos),
147
148 TP_ARGS(id, pos)
149
150);
151
152TRACE_EVENT(hsw_stream_buffer,
153
154 TP_PROTO(struct sst_hsw_stream *stream),
155
156 TP_ARGS(stream),
157
158 TP_STRUCT__entry(
159 __field( int, id )
160 __field( int, pt_addr )
161 __field( int, num_pages )
162 __field( int, ring_size )
163 __field( int, ring_offset )
164 __field( int, first_pfn )
165 ),
166
167 TP_fast_assign(
168 __entry->id = stream->host_id;
169 __entry->pt_addr = stream->request.ringinfo.ring_pt_address;
170 __entry->num_pages = stream->request.ringinfo.num_pages;
171 __entry->ring_size = stream->request.ringinfo.ring_size;
172 __entry->ring_offset = stream->request.ringinfo.ring_offset;
173 __entry->first_pfn = stream->request.ringinfo.ring_first_pfn;
174 ),
175
176 TP_printk("stream %d ring addr 0x%x pages %d size 0x%x offset 0x%x PFN 0x%x",
177 (int) __entry->id, (int)__entry->pt_addr,
178 (int)__entry->num_pages, (int)__entry->ring_size,
179 (int)__entry->ring_offset, (int)__entry->first_pfn)
180);
181
182TRACE_EVENT(hsw_stream_alloc_reply,
183
184 TP_PROTO(struct sst_hsw_stream *stream),
185
186 TP_ARGS(stream),
187
188 TP_STRUCT__entry(
189 __field( int, id )
190 __field( int, stream_id )
191 __field( int, mixer_id )
192 __field( int, peak0 )
193 __field( int, peak1 )
194 __field( int, vol0 )
195 __field( int, vol1 )
196 ),
197
198 TP_fast_assign(
199 __entry->id = stream->host_id;
200 __entry->stream_id = stream->reply.stream_hw_id;
201 __entry->mixer_id = stream->reply.mixer_hw_id;
202 __entry->peak0 = stream->reply.peak_meter_register_address[0];
203 __entry->peak1 = stream->reply.peak_meter_register_address[1];
204 __entry->vol0 = stream->reply.volume_register_address[0];
205 __entry->vol1 = stream->reply.volume_register_address[1];
206 ),
207
208 TP_printk("stream %d hw id %d mixer %d peak 0x%x:0x%x vol 0x%x,0x%x",
209 (int) __entry->id, (int) __entry->stream_id, (int)__entry->mixer_id,
210 (int)__entry->peak0, (int)__entry->peak1,
211 (int)__entry->vol0, (int)__entry->vol1)
212);
213
214TRACE_EVENT(hsw_mixer_info_reply,
215
216 TP_PROTO(struct sst_hsw_ipc_stream_info_reply *reply),
217
218 TP_ARGS(reply),
219
220 TP_STRUCT__entry(
221 __field( int, mixer_id )
222 __field( int, peak0 )
223 __field( int, peak1 )
224 __field( int, vol0 )
225 __field( int, vol1 )
226 ),
227
228 TP_fast_assign(
229 __entry->mixer_id = reply->mixer_hw_id;
230 __entry->peak0 = reply->peak_meter_register_address[0];
231 __entry->peak1 = reply->peak_meter_register_address[1];
232 __entry->vol0 = reply->volume_register_address[0];
233 __entry->vol1 = reply->volume_register_address[1];
234 ),
235
236 TP_printk("mixer id %d peak 0x%x:0x%x vol 0x%x,0x%x",
237 (int)__entry->mixer_id,
238 (int)__entry->peak0, (int)__entry->peak1,
239 (int)__entry->vol0, (int)__entry->vol1)
240);
241
242TRACE_EVENT(hsw_stream_data_format,
243
244 TP_PROTO(struct sst_hsw_stream *stream,
245 struct sst_hsw_audio_data_format_ipc *req),
246
247 TP_ARGS(stream, req),
248
249 TP_STRUCT__entry(
250 __field( uint32_t, id )
251 __field( uint32_t, frequency )
252 __field( uint32_t, bitdepth )
253 __field( uint32_t, map )
254 __field( uint32_t, config )
255 __field( uint32_t, style )
256 __field( uint8_t, ch_num )
257 __field( uint8_t, valid_bit )
258 ),
259
260 TP_fast_assign(
261 __entry->id = stream->host_id;
262 __entry->frequency = req->frequency;
263 __entry->bitdepth = req->bitdepth;
264 __entry->map = req->map;
265 __entry->config = req->config;
266 __entry->style = req->style;
267 __entry->ch_num = req->ch_num;
268 __entry->valid_bit = req->valid_bit;
269 ),
270
271 TP_printk("stream %d freq %d depth %d map 0x%x config 0x%x style 0x%x ch %d bits %d",
272 (int) __entry->id, (uint32_t)__entry->frequency,
273 (uint32_t)__entry->bitdepth, (uint32_t)__entry->map,
274 (uint32_t)__entry->config, (uint32_t)__entry->style,
275 (uint8_t)__entry->ch_num, (uint8_t)__entry->valid_bit)
276);
277
278TRACE_EVENT(hsw_stream_alloc_request,
279
280 TP_PROTO(struct sst_hsw_stream *stream,
281 struct sst_hsw_ipc_stream_alloc_req *req),
282
283 TP_ARGS(stream, req),
284
285 TP_STRUCT__entry(
286 __field( uint32_t, id )
287 __field( uint8_t, path_id )
288 __field( uint8_t, stream_type )
289 __field( uint8_t, format_id )
290 ),
291
292 TP_fast_assign(
293 __entry->id = stream->host_id;
294 __entry->path_id = req->path_id;
295 __entry->stream_type = req->stream_type;
296 __entry->format_id = req->format_id;
297 ),
298
299 TP_printk("stream %d path %d type %d format %d",
300 (int) __entry->id, (uint8_t)__entry->path_id,
301 (uint8_t)__entry->stream_type, (uint8_t)__entry->format_id)
302);
303
304TRACE_EVENT(hsw_stream_free_req,
305
306 TP_PROTO(struct sst_hsw_stream *stream,
307 struct sst_hsw_ipc_stream_free_req *req),
308
309 TP_ARGS(stream, req),
310
311 TP_STRUCT__entry(
312 __field( int, id )
313 __field( int, stream_id )
314 ),
315
316 TP_fast_assign(
317 __entry->id = stream->host_id;
318 __entry->stream_id = req->stream_id;
319 ),
320
321 TP_printk("stream %d hw id %d",
322 (int) __entry->id, (int) __entry->stream_id)
323);
324
325TRACE_EVENT(hsw_volume_req,
326
327 TP_PROTO(struct sst_hsw_stream *stream,
328 struct sst_hsw_ipc_volume_req *req),
329
330 TP_ARGS(stream, req),
331
332 TP_STRUCT__entry(
333 __field( int, id )
334 __field( uint32_t, channel )
335 __field( uint32_t, target_volume )
336 __field( uint64_t, curve_duration )
337 __field( uint32_t, curve_type )
338 ),
339
340 TP_fast_assign(
341 __entry->id = stream->host_id;
342 __entry->channel = req->channel;
343 __entry->target_volume = req->target_volume;
344 __entry->curve_duration = req->curve_duration;
345 __entry->curve_type = req->curve_type;
346 ),
347
348 TP_printk("stream %d chan 0x%x vol %d duration %llu type %d",
349 (int) __entry->id, (uint32_t) __entry->channel,
350 (uint32_t)__entry->target_volume,
351 (uint64_t)__entry->curve_duration,
352 (uint32_t)__entry->curve_type)
353);
354
355TRACE_EVENT(hsw_device_config_req,
356
357 TP_PROTO(struct sst_hsw_ipc_device_config_req *req),
358
359 TP_ARGS(req),
360
361 TP_STRUCT__entry(
362 __field( uint32_t, ssp )
363 __field( uint32_t, clock_freq )
364 __field( uint32_t, mode )
365 __field( uint16_t, clock_divider )
366 ),
367
368 TP_fast_assign(
369 __entry->ssp = req->ssp_interface;
370 __entry->clock_freq = req->clock_frequency;
371 __entry->mode = req->mode;
372 __entry->clock_divider = req->clock_divider;
373 ),
374
375 TP_printk("SSP %d Freq %d mode %d div %d",
376 (uint32_t)__entry->ssp,
377 (uint32_t)__entry->clock_freq, (uint32_t)__entry->mode,
378 (uint32_t)__entry->clock_divider)
379);
380
381#endif /* _TRACE_HSWADSP_H */
382
383/* This part must be outside protection */
384#include <trace/define_trace.h>
diff --git a/include/trace/events/i2c.h b/include/trace/events/i2c.h
new file mode 100644
index 000000000000..fe17187df65d
--- /dev/null
+++ b/include/trace/events/i2c.h
@@ -0,0 +1,372 @@
1/* I2C and SMBUS message transfer tracepoints
2 *
3 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#undef TRACE_SYSTEM
12#define TRACE_SYSTEM i2c
13
14#if !defined(_TRACE_I2C_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _TRACE_I2C_H
16
17#include <linux/i2c.h>
18#include <linux/tracepoint.h>
19
20/*
21 * drivers/i2c/i2c-core.c
22 */
23extern void i2c_transfer_trace_reg(void);
24extern void i2c_transfer_trace_unreg(void);
25
26/*
27 * __i2c_transfer() write request
28 */
29TRACE_EVENT_FN(i2c_write,
30 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
31 int num),
32 TP_ARGS(adap, msg, num),
33 TP_STRUCT__entry(
34 __field(int, adapter_nr )
35 __field(__u16, msg_nr )
36 __field(__u16, addr )
37 __field(__u16, flags )
38 __field(__u16, len )
39 __dynamic_array(__u8, buf, msg->len) ),
40 TP_fast_assign(
41 __entry->adapter_nr = adap->nr;
42 __entry->msg_nr = num;
43 __entry->addr = msg->addr;
44 __entry->flags = msg->flags;
45 __entry->len = msg->len;
46 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
47 ),
48 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
49 __entry->adapter_nr,
50 __entry->msg_nr,
51 __entry->addr,
52 __entry->flags,
53 __entry->len,
54 __entry->len, __get_dynamic_array(buf)
55 ),
56 i2c_transfer_trace_reg,
57 i2c_transfer_trace_unreg);
58
59/*
60 * __i2c_transfer() read request
61 */
62TRACE_EVENT_FN(i2c_read,
63 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
64 int num),
65 TP_ARGS(adap, msg, num),
66 TP_STRUCT__entry(
67 __field(int, adapter_nr )
68 __field(__u16, msg_nr )
69 __field(__u16, addr )
70 __field(__u16, flags )
71 __field(__u16, len )
72 ),
73 TP_fast_assign(
74 __entry->adapter_nr = adap->nr;
75 __entry->msg_nr = num;
76 __entry->addr = msg->addr;
77 __entry->flags = msg->flags;
78 __entry->len = msg->len;
79 ),
80 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u",
81 __entry->adapter_nr,
82 __entry->msg_nr,
83 __entry->addr,
84 __entry->flags,
85 __entry->len
86 ),
87 i2c_transfer_trace_reg,
88 i2c_transfer_trace_unreg);
89
90/*
91 * __i2c_transfer() read reply
92 */
93TRACE_EVENT_FN(i2c_reply,
94 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
95 int num),
96 TP_ARGS(adap, msg, num),
97 TP_STRUCT__entry(
98 __field(int, adapter_nr )
99 __field(__u16, msg_nr )
100 __field(__u16, addr )
101 __field(__u16, flags )
102 __field(__u16, len )
103 __dynamic_array(__u8, buf, msg->len) ),
104 TP_fast_assign(
105 __entry->adapter_nr = adap->nr;
106 __entry->msg_nr = num;
107 __entry->addr = msg->addr;
108 __entry->flags = msg->flags;
109 __entry->len = msg->len;
110 memcpy(__get_dynamic_array(buf), msg->buf, msg->len);
111 ),
112 TP_printk("i2c-%d #%u a=%03x f=%04x l=%u [%*phD]",
113 __entry->adapter_nr,
114 __entry->msg_nr,
115 __entry->addr,
116 __entry->flags,
117 __entry->len,
118 __entry->len, __get_dynamic_array(buf)
119 ),
120 i2c_transfer_trace_reg,
121 i2c_transfer_trace_unreg);
122
123/*
124 * __i2c_transfer() result
125 */
126TRACE_EVENT_FN(i2c_result,
127 TP_PROTO(const struct i2c_adapter *adap, int num, int ret),
128 TP_ARGS(adap, num, ret),
129 TP_STRUCT__entry(
130 __field(int, adapter_nr )
131 __field(__u16, nr_msgs )
132 __field(__s16, ret )
133 ),
134 TP_fast_assign(
135 __entry->adapter_nr = adap->nr;
136 __entry->nr_msgs = num;
137 __entry->ret = ret;
138 ),
139 TP_printk("i2c-%d n=%u ret=%d",
140 __entry->adapter_nr,
141 __entry->nr_msgs,
142 __entry->ret
143 ),
144 i2c_transfer_trace_reg,
145 i2c_transfer_trace_unreg);
146
147/*
148 * i2c_smbus_xfer() write data or procedure call request
149 */
150TRACE_EVENT_CONDITION(smbus_write,
151 TP_PROTO(const struct i2c_adapter *adap,
152 u16 addr, unsigned short flags,
153 char read_write, u8 command, int protocol,
154 const union i2c_smbus_data *data),
155 TP_ARGS(adap, addr, flags, read_write, command, protocol, data),
156 TP_CONDITION(read_write == I2C_SMBUS_WRITE ||
157 protocol == I2C_SMBUS_PROC_CALL ||
158 protocol == I2C_SMBUS_BLOCK_PROC_CALL),
159 TP_STRUCT__entry(
160 __field(int, adapter_nr )
161 __field(__u16, addr )
162 __field(__u16, flags )
163 __field(__u8, command )
164 __field(__u8, len )
165 __field(__u32, protocol )
166 __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ),
167 TP_fast_assign(
168 __entry->adapter_nr = adap->nr;
169 __entry->addr = addr;
170 __entry->flags = flags;
171 __entry->command = command;
172 __entry->protocol = protocol;
173
174 switch (protocol) {
175 case I2C_SMBUS_BYTE_DATA:
176 __entry->len = 1;
177 goto copy;
178 case I2C_SMBUS_WORD_DATA:
179 case I2C_SMBUS_PROC_CALL:
180 __entry->len = 2;
181 goto copy;
182 case I2C_SMBUS_BLOCK_DATA:
183 case I2C_SMBUS_BLOCK_PROC_CALL:
184 case I2C_SMBUS_I2C_BLOCK_DATA:
185 __entry->len = data->block[0] + 1;
186 copy:
187 memcpy(__entry->buf, data->block, __entry->len);
188 break;
189 case I2C_SMBUS_QUICK:
190 case I2C_SMBUS_BYTE:
191 case I2C_SMBUS_I2C_BLOCK_BROKEN:
192 default:
193 __entry->len = 0;
194 }
195 ),
196 TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]",
197 __entry->adapter_nr,
198 __entry->addr,
199 __entry->flags,
200 __entry->command,
201 __print_symbolic(__entry->protocol,
202 { I2C_SMBUS_QUICK, "QUICK" },
203 { I2C_SMBUS_BYTE, "BYTE" },
204 { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" },
205 { I2C_SMBUS_WORD_DATA, "WORD_DATA" },
206 { I2C_SMBUS_PROC_CALL, "PROC_CALL" },
207 { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" },
208 { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" },
209 { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" },
210 { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }),
211 __entry->len,
212 __entry->len, __entry->buf
213 ));
214
215/*
216 * i2c_smbus_xfer() read data request
217 */
218TRACE_EVENT_CONDITION(smbus_read,
219 TP_PROTO(const struct i2c_adapter *adap,
220 u16 addr, unsigned short flags,
221 char read_write, u8 command, int protocol),
222 TP_ARGS(adap, addr, flags, read_write, command, protocol),
223 TP_CONDITION(!(read_write == I2C_SMBUS_WRITE ||
224 protocol == I2C_SMBUS_PROC_CALL ||
225 protocol == I2C_SMBUS_BLOCK_PROC_CALL)),
226 TP_STRUCT__entry(
227 __field(int, adapter_nr )
228 __field(__u16, flags )
229 __field(__u16, addr )
230 __field(__u8, command )
231 __field(__u32, protocol )
232 __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ),
233 TP_fast_assign(
234 __entry->adapter_nr = adap->nr;
235 __entry->addr = addr;
236 __entry->flags = flags;
237 __entry->command = command;
238 __entry->protocol = protocol;
239 ),
240 TP_printk("i2c-%d a=%03x f=%04x c=%x %s",
241 __entry->adapter_nr,
242 __entry->addr,
243 __entry->flags,
244 __entry->command,
245 __print_symbolic(__entry->protocol,
246 { I2C_SMBUS_QUICK, "QUICK" },
247 { I2C_SMBUS_BYTE, "BYTE" },
248 { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" },
249 { I2C_SMBUS_WORD_DATA, "WORD_DATA" },
250 { I2C_SMBUS_PROC_CALL, "PROC_CALL" },
251 { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" },
252 { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" },
253 { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" },
254 { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" })
255 ));
256
257/*
258 * i2c_smbus_xfer() read data or procedure call reply
259 */
260TRACE_EVENT_CONDITION(smbus_reply,
261 TP_PROTO(const struct i2c_adapter *adap,
262 u16 addr, unsigned short flags,
263 char read_write, u8 command, int protocol,
264 const union i2c_smbus_data *data),
265 TP_ARGS(adap, addr, flags, read_write, command, protocol, data),
266 TP_CONDITION(read_write == I2C_SMBUS_READ),
267 TP_STRUCT__entry(
268 __field(int, adapter_nr )
269 __field(__u16, addr )
270 __field(__u16, flags )
271 __field(__u8, command )
272 __field(__u8, len )
273 __field(__u32, protocol )
274 __array(__u8, buf, I2C_SMBUS_BLOCK_MAX + 2) ),
275 TP_fast_assign(
276 __entry->adapter_nr = adap->nr;
277 __entry->addr = addr;
278 __entry->flags = flags;
279 __entry->command = command;
280 __entry->protocol = protocol;
281
282 switch (protocol) {
283 case I2C_SMBUS_BYTE:
284 case I2C_SMBUS_BYTE_DATA:
285 __entry->len = 1;
286 goto copy;
287 case I2C_SMBUS_WORD_DATA:
288 case I2C_SMBUS_PROC_CALL:
289 __entry->len = 2;
290 goto copy;
291 case I2C_SMBUS_BLOCK_DATA:
292 case I2C_SMBUS_BLOCK_PROC_CALL:
293 case I2C_SMBUS_I2C_BLOCK_DATA:
294 __entry->len = data->block[0] + 1;
295 copy:
296 memcpy(__entry->buf, data->block, __entry->len);
297 break;
298 case I2C_SMBUS_QUICK:
299 case I2C_SMBUS_I2C_BLOCK_BROKEN:
300 default:
301 __entry->len = 0;
302 }
303 ),
304 TP_printk("i2c-%d a=%03x f=%04x c=%x %s l=%u [%*phD]",
305 __entry->adapter_nr,
306 __entry->addr,
307 __entry->flags,
308 __entry->command,
309 __print_symbolic(__entry->protocol,
310 { I2C_SMBUS_QUICK, "QUICK" },
311 { I2C_SMBUS_BYTE, "BYTE" },
312 { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" },
313 { I2C_SMBUS_WORD_DATA, "WORD_DATA" },
314 { I2C_SMBUS_PROC_CALL, "PROC_CALL" },
315 { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" },
316 { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" },
317 { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" },
318 { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }),
319 __entry->len,
320 __entry->len, __entry->buf
321 ));
322
323/*
324 * i2c_smbus_xfer() result
325 */
326TRACE_EVENT(smbus_result,
327 TP_PROTO(const struct i2c_adapter *adap,
328 u16 addr, unsigned short flags,
329 char read_write, u8 command, int protocol,
330 int res),
331 TP_ARGS(adap, addr, flags, read_write, command, protocol, res),
332 TP_STRUCT__entry(
333 __field(int, adapter_nr )
334 __field(__u16, addr )
335 __field(__u16, flags )
336 __field(__u8, read_write )
337 __field(__u8, command )
338 __field(__s16, res )
339 __field(__u32, protocol )
340 ),
341 TP_fast_assign(
342 __entry->adapter_nr = adap->nr;
343 __entry->addr = addr;
344 __entry->flags = flags;
345 __entry->read_write = read_write;
346 __entry->command = command;
347 __entry->protocol = protocol;
348 __entry->res = res;
349 ),
350 TP_printk("i2c-%d a=%03x f=%04x c=%x %s %s res=%d",
351 __entry->adapter_nr,
352 __entry->addr,
353 __entry->flags,
354 __entry->command,
355 __print_symbolic(__entry->protocol,
356 { I2C_SMBUS_QUICK, "QUICK" },
357 { I2C_SMBUS_BYTE, "BYTE" },
358 { I2C_SMBUS_BYTE_DATA, "BYTE_DATA" },
359 { I2C_SMBUS_WORD_DATA, "WORD_DATA" },
360 { I2C_SMBUS_PROC_CALL, "PROC_CALL" },
361 { I2C_SMBUS_BLOCK_DATA, "BLOCK_DATA" },
362 { I2C_SMBUS_I2C_BLOCK_BROKEN, "I2C_BLOCK_BROKEN" },
363 { I2C_SMBUS_BLOCK_PROC_CALL, "BLOCK_PROC_CALL" },
364 { I2C_SMBUS_I2C_BLOCK_DATA, "I2C_BLOCK_DATA" }),
365 __entry->read_write == I2C_SMBUS_WRITE ? "wr" : "rd",
366 __entry->res
367 ));
368
369#endif /* _TRACE_I2C_H */
370
371/* This part must be outside protection */
372#include <trace/define_trace.h>
diff --git a/include/trace/events/intel-sst.h b/include/trace/events/intel-sst.h
new file mode 100644
index 000000000000..76c72d3f1902
--- /dev/null
+++ b/include/trace/events/intel-sst.h
@@ -0,0 +1,148 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM intel-sst
3
4#if !defined(_TRACE_INTEL_SST_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_INTEL_SST_H
6
7#include <linux/types.h>
8#include <linux/ktime.h>
9#include <linux/tracepoint.h>
10
11DECLARE_EVENT_CLASS(sst_ipc_msg,
12
13 TP_PROTO(unsigned int val),
14
15 TP_ARGS(val),
16
17 TP_STRUCT__entry(
18 __field( unsigned int, val )
19 ),
20
21 TP_fast_assign(
22 __entry->val = val;
23 ),
24
25 TP_printk("0x%8.8x", (unsigned int)__entry->val)
26);
27
28DEFINE_EVENT(sst_ipc_msg, sst_ipc_msg_tx,
29
30 TP_PROTO(unsigned int val),
31
32 TP_ARGS(val)
33
34);
35
36DEFINE_EVENT(sst_ipc_msg, sst_ipc_msg_rx,
37
38 TP_PROTO(unsigned int val),
39
40 TP_ARGS(val)
41
42);
43
44DECLARE_EVENT_CLASS(sst_ipc_mailbox,
45
46 TP_PROTO(unsigned int offset, unsigned int val),
47
48 TP_ARGS(offset, val),
49
50 TP_STRUCT__entry(
51 __field( unsigned int, offset )
52 __field( unsigned int, val )
53 ),
54
55 TP_fast_assign(
56 __entry->offset = offset;
57 __entry->val = val;
58 ),
59
60 TP_printk(" 0x%4.4x = 0x%8.8x",
61 (unsigned int)__entry->offset, (unsigned int)__entry->val)
62);
63
64DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_inbox_rdata,
65
66 TP_PROTO(unsigned int offset, unsigned int val),
67
68 TP_ARGS(offset, val)
69
70);
71
72DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_inbox_wdata,
73
74 TP_PROTO(unsigned int offset, unsigned int val),
75
76 TP_ARGS(offset, val)
77
78);
79
80DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_outbox_rdata,
81
82 TP_PROTO(unsigned int offset, unsigned int val),
83
84 TP_ARGS(offset, val)
85
86);
87
88DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_outbox_wdata,
89
90 TP_PROTO(unsigned int offset, unsigned int val),
91
92 TP_ARGS(offset, val)
93
94);
95
96DECLARE_EVENT_CLASS(sst_ipc_mailbox_info,
97
98 TP_PROTO(unsigned int size),
99
100 TP_ARGS(size),
101
102 TP_STRUCT__entry(
103 __field( unsigned int, size )
104 ),
105
106 TP_fast_assign(
107 __entry->size = size;
108 ),
109
110 TP_printk("Mailbox bytes 0x%8.8x", (unsigned int)__entry->size)
111);
112
113DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_inbox_read,
114
115 TP_PROTO(unsigned int size),
116
117 TP_ARGS(size)
118
119);
120
121DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_inbox_write,
122
123 TP_PROTO(unsigned int size),
124
125 TP_ARGS(size)
126
127);
128
129DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_outbox_read,
130
131 TP_PROTO(unsigned int size),
132
133 TP_ARGS(size)
134
135);
136
137DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_outbox_write,
138
139 TP_PROTO(unsigned int size),
140
141 TP_ARGS(size)
142
143);
144
145#endif /* _TRACE_SST_H */
146
147/* This part must be outside protection */
148#include <trace/define_trace.h>
diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h
index 3075ffbb9a83..4e4f2f8b1ac2 100644
--- a/include/trace/events/migrate.h
+++ b/include/trace/events/migrate.h
@@ -4,6 +4,8 @@
4#if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ) 4#if !defined(_TRACE_MIGRATE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_MIGRATE_H 5#define _TRACE_MIGRATE_H
6 6
7#include <linux/tracepoint.h>
8
7#define MIGRATE_MODE \ 9#define MIGRATE_MODE \
8 {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \ 10 {MIGRATE_ASYNC, "MIGRATE_ASYNC"}, \
9 {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \ 11 {MIGRATE_SYNC_LIGHT, "MIGRATE_SYNC_LIGHT"}, \
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 161932737416..11fd51b413de 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -22,8 +22,10 @@ struct module;
22 22
23#define show_module_flags(flags) __print_flags(flags, "", \ 23#define show_module_flags(flags) __print_flags(flags, "", \
24 { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \ 24 { (1UL << TAINT_PROPRIETARY_MODULE), "P" }, \
25 { (1UL << TAINT_OOT_MODULE), "O" }, \
25 { (1UL << TAINT_FORCED_MODULE), "F" }, \ 26 { (1UL << TAINT_FORCED_MODULE), "F" }, \
26 { (1UL << TAINT_CRAP), "C" }) 27 { (1UL << TAINT_CRAP), "C" }, \
28 { (1UL << TAINT_UNSIGNED_MODULE), "X" })
27 29
28TRACE_EVENT(module_load, 30TRACE_EVENT(module_load,
29 31
diff --git a/include/trace/events/net.h b/include/trace/events/net.h
index a34f27b2e394..1de256b35807 100644
--- a/include/trace/events/net.h
+++ b/include/trace/events/net.h
@@ -153,8 +153,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
153 __field( u16, vlan_tci ) 153 __field( u16, vlan_tci )
154 __field( u16, protocol ) 154 __field( u16, protocol )
155 __field( u8, ip_summed ) 155 __field( u8, ip_summed )
156 __field( u32, rxhash ) 156 __field( u32, hash )
157 __field( bool, l4_rxhash ) 157 __field( bool, l4_hash )
158 __field( unsigned int, len ) 158 __field( unsigned int, len )
159 __field( unsigned int, data_len ) 159 __field( unsigned int, data_len )
160 __field( unsigned int, truesize ) 160 __field( unsigned int, truesize )
@@ -179,8 +179,8 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
179 __entry->vlan_tci = vlan_tx_tag_get(skb); 179 __entry->vlan_tci = vlan_tx_tag_get(skb);
180 __entry->protocol = ntohs(skb->protocol); 180 __entry->protocol = ntohs(skb->protocol);
181 __entry->ip_summed = skb->ip_summed; 181 __entry->ip_summed = skb->ip_summed;
182 __entry->rxhash = skb->rxhash; 182 __entry->hash = skb->hash;
183 __entry->l4_rxhash = skb->l4_rxhash; 183 __entry->l4_hash = skb->l4_hash;
184 __entry->len = skb->len; 184 __entry->len = skb->len;
185 __entry->data_len = skb->data_len; 185 __entry->data_len = skb->data_len;
186 __entry->truesize = skb->truesize; 186 __entry->truesize = skb->truesize;
@@ -191,11 +191,11 @@ DECLARE_EVENT_CLASS(net_dev_rx_verbose_template,
191 __entry->gso_type = skb_shinfo(skb)->gso_type; 191 __entry->gso_type = skb_shinfo(skb)->gso_type;
192 ), 192 ),
193 193
194 TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d rxhash=0x%08x l4_rxhash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x", 194 TP_printk("dev=%s napi_id=%#x queue_mapping=%u skbaddr=%p vlan_tagged=%d vlan_proto=0x%04x vlan_tci=0x%04x protocol=0x%04x ip_summed=%d hash=0x%08x l4_hash=%d len=%u data_len=%u truesize=%u mac_header_valid=%d mac_header=%d nr_frags=%d gso_size=%d gso_type=%#x",
195 __get_str(name), __entry->napi_id, __entry->queue_mapping, 195 __get_str(name), __entry->napi_id, __entry->queue_mapping,
196 __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto, 196 __entry->skbaddr, __entry->vlan_tagged, __entry->vlan_proto,
197 __entry->vlan_tci, __entry->protocol, __entry->ip_summed, 197 __entry->vlan_tci, __entry->protocol, __entry->ip_summed,
198 __entry->rxhash, __entry->l4_rxhash, __entry->len, 198 __entry->hash, __entry->l4_hash, __entry->len,
199 __entry->data_len, __entry->truesize, 199 __entry->data_len, __entry->truesize,
200 __entry->mac_header_valid, __entry->mac_header, 200 __entry->mac_header_valid, __entry->mac_header,
201 __entry->nr_frags, __entry->gso_size, __entry->gso_type) 201 __entry->nr_frags, __entry->gso_size, __entry->gso_type)
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index e5bf9a76f169..9a7e08d61258 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -407,8 +407,8 @@ DECLARE_EVENT_CLASS(dev_pm_qos_request,
407 TP_printk("device=%s type=%s new_value=%d", 407 TP_printk("device=%s type=%s new_value=%d",
408 __get_str(name), 408 __get_str(name),
409 __print_symbolic(__entry->type, 409 __print_symbolic(__entry->type,
410 { DEV_PM_QOS_LATENCY, "DEV_PM_QOS_LATENCY" }, 410 { DEV_PM_QOS_RESUME_LATENCY, "DEV_PM_QOS_RESUME_LATENCY" },
411 { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }), 411 { DEV_PM_QOS_FLAGS, "DEV_PM_QOS_FLAGS" }),
412 __entry->new_value) 412 __entry->new_value)
413); 413);
414 414
diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
index 5a4c04a75b3d..14e49c798135 100644
--- a/include/trace/events/syscalls.h
+++ b/include/trace/events/syscalls.h
@@ -13,9 +13,6 @@
13 13
14#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS 14#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
15 15
16extern void syscall_regfunc(void);
17extern void syscall_unregfunc(void);
18
19TRACE_EVENT_FN(sys_enter, 16TRACE_EVENT_FN(sys_enter,
20 17
21 TP_PROTO(struct pt_regs *regs, long id), 18 TP_PROTO(struct pt_regs *regs, long id),
diff --git a/include/trace/events/task.h b/include/trace/events/task.h
index 102a646e1996..dee3bb1d5a6b 100644
--- a/include/trace/events/task.h
+++ b/include/trace/events/task.h
@@ -32,7 +32,7 @@ TRACE_EVENT(task_newtask,
32 32
33TRACE_EVENT(task_rename, 33TRACE_EVENT(task_rename,
34 34
35 TP_PROTO(struct task_struct *task, char *comm), 35 TP_PROTO(struct task_struct *task, const char *comm),
36 36
37 TP_ARGS(task, comm), 37 TP_ARGS(task, comm),
38 38
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index ef94ecad1c94..b9bb1f204693 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -18,6 +18,7 @@
18 { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\ 18 { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\
19 { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\ 19 { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\
20 { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \ 20 { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \
21 { V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" }, \
21 { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" }) 22 { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" })
22 23
23#define show_field(field) \ 24#define show_field(field) \
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
index 464ea82e10db..cee02d65ab3f 100644
--- a/include/trace/events/writeback.h
+++ b/include/trace/events/writeback.h
@@ -4,6 +4,7 @@
4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) 4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WRITEBACK_H 5#define _TRACE_WRITEBACK_H
6 6
7#include <linux/tracepoint.h>
7#include <linux/backing-dev.h> 8#include <linux/backing-dev.h>
8#include <linux/writeback.h> 9#include <linux/writeback.h>
9 10
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1ee19a24cc5f..0a1a4f7caf09 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -265,11 +265,9 @@ static notrace enum print_line_t \
265ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \ 265ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
266 struct trace_event *event) \ 266 struct trace_event *event) \
267{ \ 267{ \
268 struct trace_seq *s = &iter->seq; \
269 struct ftrace_raw_##template *field; \ 268 struct ftrace_raw_##template *field; \
270 struct trace_entry *entry; \ 269 struct trace_entry *entry; \
271 struct trace_seq *p = &iter->tmp_seq; \ 270 struct trace_seq *p = &iter->tmp_seq; \
272 int ret; \
273 \ 271 \
274 entry = iter->ent; \ 272 entry = iter->ent; \
275 \ 273 \
@@ -281,13 +279,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
281 field = (typeof(field))entry; \ 279 field = (typeof(field))entry; \
282 \ 280 \
283 trace_seq_init(p); \ 281 trace_seq_init(p); \
284 ret = trace_seq_printf(s, "%s: ", #call); \ 282 return ftrace_output_call(iter, #call, print); \
285 if (ret) \
286 ret = trace_seq_printf(s, print); \
287 if (!ret) \
288 return TRACE_TYPE_PARTIAL_LINE; \
289 \
290 return TRACE_TYPE_HANDLED; \
291} \ 283} \
292static struct trace_event_functions ftrace_event_type_funcs_##call = { \ 284static struct trace_event_functions ftrace_event_type_funcs_##call = { \
293 .trace = ftrace_raw_output_##call, \ 285 .trace = ftrace_raw_output_##call, \
@@ -370,10 +362,11 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
370 362
371#undef __dynamic_array 363#undef __dynamic_array
372#define __dynamic_array(type, item, len) \ 364#define __dynamic_array(type, item, len) \
365 __item_length = (len) * sizeof(type); \
373 __data_offsets->item = __data_size + \ 366 __data_offsets->item = __data_size + \
374 offsetof(typeof(*entry), __data); \ 367 offsetof(typeof(*entry), __data); \
375 __data_offsets->item |= (len * sizeof(type)) << 16; \ 368 __data_offsets->item |= __item_length << 16; \
376 __data_size += (len) * sizeof(type); 369 __data_size += __item_length;
377 370
378#undef __string 371#undef __string
379#define __string(item, src) __dynamic_array(char, item, \ 372#define __string(item, src) __dynamic_array(char, item, \
@@ -385,6 +378,7 @@ static inline notrace int ftrace_get_offsets_##call( \
385 struct ftrace_data_offsets_##call *__data_offsets, proto) \ 378 struct ftrace_data_offsets_##call *__data_offsets, proto) \
386{ \ 379{ \
387 int __data_size = 0; \ 380 int __data_size = 0; \
381 int __maybe_unused __item_length; \
388 struct ftrace_raw_##call __maybe_unused *entry; \ 382 struct ftrace_raw_##call __maybe_unused *entry; \
389 \ 383 \
390 tstruct; \ 384 tstruct; \
@@ -476,10 +470,13 @@ static inline notrace int ftrace_get_offsets_##call( \
476 * }; 470 * };
477 * 471 *
478 * static struct ftrace_event_call event_<call> = { 472 * static struct ftrace_event_call event_<call> = {
479 * .name = "<call>",
480 * .class = event_class_<template>, 473 * .class = event_class_<template>,
474 * {
475 * .tp = &__tracepoint_<call>,
476 * },
481 * .event = &ftrace_event_type_<call>, 477 * .event = &ftrace_event_type_<call>,
482 * .print_fmt = print_fmt_<call>, 478 * .print_fmt = print_fmt_<call>,
479 * .flags = TRACE_EVENT_FL_TRACEPOINT,
483 * }; 480 * };
484 * // its only safe to use pointers when doing linker tricks to 481 * // its only safe to use pointers when doing linker tricks to
485 * // create an array. 482 * // create an array.
@@ -541,37 +538,27 @@ static notrace void \
541ftrace_raw_event_##call(void *__data, proto) \ 538ftrace_raw_event_##call(void *__data, proto) \
542{ \ 539{ \
543 struct ftrace_event_file *ftrace_file = __data; \ 540 struct ftrace_event_file *ftrace_file = __data; \
544 struct ftrace_event_call *event_call = ftrace_file->event_call; \
545 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ 541 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
546 struct ring_buffer_event *event; \ 542 struct ftrace_event_buffer fbuffer; \
547 struct ftrace_raw_##call *entry; \ 543 struct ftrace_raw_##call *entry; \
548 struct ring_buffer *buffer; \
549 unsigned long irq_flags; \
550 int __data_size; \ 544 int __data_size; \
551 int pc; \
552 \ 545 \
553 if (ftrace_trigger_soft_disabled(ftrace_file)) \ 546 if (ftrace_trigger_soft_disabled(ftrace_file)) \
554 return; \ 547 return; \
555 \ 548 \
556 local_save_flags(irq_flags); \
557 pc = preempt_count(); \
558 \
559 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 549 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
560 \ 550 \
561 event = trace_event_buffer_lock_reserve(&buffer, ftrace_file, \ 551 entry = ftrace_event_buffer_reserve(&fbuffer, ftrace_file, \
562 event_call->event.type, \ 552 sizeof(*entry) + __data_size); \
563 sizeof(*entry) + __data_size, \ 553 \
564 irq_flags, pc); \ 554 if (!entry) \
565 if (!event) \
566 return; \ 555 return; \
567 entry = ring_buffer_event_data(event); \
568 \ 556 \
569 tstruct \ 557 tstruct \
570 \ 558 \
571 { assign; } \ 559 { assign; } \
572 \ 560 \
573 event_trigger_unlock_commit(ftrace_file, buffer, event, entry, \ 561 ftrace_event_buffer_commit(&fbuffer); \
574 irq_flags, pc); \
575} 562}
576/* 563/*
577 * The ftrace_test_probe is compiled out, it is only here as a build time check 564 * The ftrace_test_probe is compiled out, it is only here as a build time check
@@ -621,10 +608,13 @@ static struct ftrace_event_class __used __refdata event_class_##call = { \
621#define DEFINE_EVENT(template, call, proto, args) \ 608#define DEFINE_EVENT(template, call, proto, args) \
622 \ 609 \
623static struct ftrace_event_call __used event_##call = { \ 610static struct ftrace_event_call __used event_##call = { \
624 .name = #call, \
625 .class = &event_class_##template, \ 611 .class = &event_class_##template, \
612 { \
613 .tp = &__tracepoint_##call, \
614 }, \
626 .event.funcs = &ftrace_event_type_funcs_##template, \ 615 .event.funcs = &ftrace_event_type_funcs_##template, \
627 .print_fmt = print_fmt_##template, \ 616 .print_fmt = print_fmt_##template, \
617 .flags = TRACE_EVENT_FL_TRACEPOINT, \
628}; \ 618}; \
629static struct ftrace_event_call __used \ 619static struct ftrace_event_call __used \
630__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call 620__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
@@ -635,10 +625,13 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
635static const char print_fmt_##call[] = print; \ 625static const char print_fmt_##call[] = print; \
636 \ 626 \
637static struct ftrace_event_call __used event_##call = { \ 627static struct ftrace_event_call __used event_##call = { \
638 .name = #call, \
639 .class = &event_class_##template, \ 628 .class = &event_class_##template, \
629 { \
630 .tp = &__tracepoint_##call, \
631 }, \
640 .event.funcs = &ftrace_event_type_funcs_##call, \ 632 .event.funcs = &ftrace_event_type_funcs_##call, \
641 .print_fmt = print_fmt_##call, \ 633 .print_fmt = print_fmt_##call, \
634 .flags = TRACE_EVENT_FL_TRACEPOINT, \
642}; \ 635}; \
643static struct ftrace_event_call __used \ 636static struct ftrace_event_call __used \
644__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call 637__attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index 95e46c8e05f9..a9b13f8b3595 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -132,6 +132,22 @@
132#define F_GETOWNER_UIDS 17 132#define F_GETOWNER_UIDS 17
133#endif 133#endif
134 134
135/*
136 * fd "private" POSIX locks.
137 *
138 * Usually POSIX locks held by a process are released on *any* close and are
139 * not inherited across a fork().
140 *
141 * These cmd values will set locks that conflict with normal POSIX locks, but
142 * are "owned" by the opened file, not the process. This means that they are
143 * inherited across fork() like BSD (flock) locks, and they are only released
144 * automatically when the last reference to the the open file against which
145 * they were acquired is put.
146 */
147#define F_GETLKP 36
148#define F_SETLKP 37
149#define F_SETLKPW 38
150
135#define F_OWNER_TID 0 151#define F_OWNER_TID 0
136#define F_OWNER_PID 1 152#define F_OWNER_PID 1
137#define F_OWNER_PGRP 2 153#define F_OWNER_PGRP 2
@@ -186,8 +202,6 @@ struct flock {
186}; 202};
187#endif 203#endif
188 204
189#ifndef CONFIG_64BIT
190
191#ifndef HAVE_ARCH_STRUCT_FLOCK64 205#ifndef HAVE_ARCH_STRUCT_FLOCK64
192#ifndef __ARCH_FLOCK64_PAD 206#ifndef __ARCH_FLOCK64_PAD
193#define __ARCH_FLOCK64_PAD 207#define __ARCH_FLOCK64_PAD
@@ -202,6 +216,5 @@ struct flock64 {
202 __ARCH_FLOCK64_PAD 216 __ARCH_FLOCK64_PAD
203}; 217};
204#endif 218#endif
205#endif /* !CONFIG_64BIT */
206 219
207#endif /* _ASM_GENERIC_FCNTL_H */ 220#endif /* _ASM_GENERIC_FCNTL_H */
diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index 4164529a94f9..ddc3b36f1046 100644
--- a/include/uapi/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
@@ -50,7 +50,7 @@
50 50
51#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump, 51#define MADV_DONTDUMP 16 /* Explicity exclude from the core dump,
52 overrides the coredump filter bits */ 52 overrides the coredump filter bits */
53#define MADV_DODUMP 17 /* Clear the MADV_NODUMP flag */ 53#define MADV_DODUMP 17 /* Clear the MADV_DONTDUMP flag */
54 54
55/* compatibility flags */ 55/* compatibility flags */
56#define MAP_FILE 0 56#define MAP_FILE 0
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index b06c8ed68707..9abbeb924cbb 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -619,6 +619,15 @@ struct drm_gem_open {
619#define DRM_PRIME_CAP_EXPORT 0x2 619#define DRM_PRIME_CAP_EXPORT 0x2
620#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6 620#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
621#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 621#define DRM_CAP_ASYNC_PAGE_FLIP 0x7
622/*
623 * The CURSOR_WIDTH and CURSOR_HEIGHT capabilities return a valid widthxheight
624 * combination for the hardware cursor. The intention is that a hardware
625 * agnostic userspace can query a cursor plane size to use.
626 *
627 * Note that the cross-driver contract is to merely return a valid size;
628 * drivers are free to attach another meaning on top, eg. i915 returns the
629 * maximum plane size.
630 */
622#define DRM_CAP_CURSOR_WIDTH 0x8 631#define DRM_CAP_CURSOR_WIDTH 0x8
623#define DRM_CAP_CURSOR_HEIGHT 0x9 632#define DRM_CAP_CURSOR_HEIGHT 0x9
624 633
@@ -637,6 +646,14 @@ struct drm_get_cap {
637 */ 646 */
638#define DRM_CLIENT_CAP_STEREO_3D 1 647#define DRM_CLIENT_CAP_STEREO_3D 1
639 648
649/**
650 * DRM_CLIENT_CAP_UNIVERSAL_PLANES
651 *
652 * If set to 1, the DRM core will expose all planes (overlay, primary, and
653 * cursor) to userspace.
654 */
655#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2
656
640/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 657/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
641struct drm_set_client_cap { 658struct drm_set_client_cap {
642 __u64 capability; 659 __u64 capability;
diff --git a/include/uapi/drm/msm_drm.h b/include/uapi/drm/msm_drm.h
index d3c62074016d..0664c31f010c 100644
--- a/include/uapi/drm/msm_drm.h
+++ b/include/uapi/drm/msm_drm.h
@@ -50,6 +50,7 @@ struct drm_msm_timespec {
50 50
51#define MSM_PARAM_GPU_ID 0x01 51#define MSM_PARAM_GPU_ID 0x01
52#define MSM_PARAM_GMEM_SIZE 0x02 52#define MSM_PARAM_GMEM_SIZE 0x02
53#define MSM_PARAM_CHIP_ID 0x03
53 54
54struct drm_msm_param { 55struct drm_msm_param {
55 uint32_t pipe; /* in, MSM_PIPE_x */ 56 uint32_t pipe; /* in, MSM_PIPE_x */
@@ -69,6 +70,12 @@ struct drm_msm_param {
69#define MSM_BO_WC 0x00020000 70#define MSM_BO_WC 0x00020000
70#define MSM_BO_UNCACHED 0x00040000 71#define MSM_BO_UNCACHED 0x00040000
71 72
73#define MSM_BO_FLAGS (MSM_BO_SCANOUT | \
74 MSM_BO_GPU_READONLY | \
75 MSM_BO_CACHED | \
76 MSM_BO_WC | \
77 MSM_BO_UNCACHED)
78
72struct drm_msm_gem_new { 79struct drm_msm_gem_new {
73 uint64_t size; /* in */ 80 uint64_t size; /* in */
74 uint32_t flags; /* in, mask of MSM_BO_x */ 81 uint32_t flags; /* in, mask of MSM_BO_x */
@@ -85,6 +92,8 @@ struct drm_msm_gem_info {
85#define MSM_PREP_WRITE 0x02 92#define MSM_PREP_WRITE 0x02
86#define MSM_PREP_NOSYNC 0x04 93#define MSM_PREP_NOSYNC 0x04
87 94
95#define MSM_PREP_FLAGS (MSM_PREP_READ | MSM_PREP_WRITE | MSM_PREP_NOSYNC)
96
88struct drm_msm_gem_cpu_prep { 97struct drm_msm_gem_cpu_prep {
89 uint32_t handle; /* in */ 98 uint32_t handle; /* in */
90 uint32_t op; /* in, mask of MSM_PREP_x */ 99 uint32_t op; /* in, mask of MSM_PREP_x */
@@ -152,6 +161,9 @@ struct drm_msm_gem_submit_cmd {
152 */ 161 */
153#define MSM_SUBMIT_BO_READ 0x0001 162#define MSM_SUBMIT_BO_READ 0x0001
154#define MSM_SUBMIT_BO_WRITE 0x0002 163#define MSM_SUBMIT_BO_WRITE 0x0002
164
165#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE)
166
155struct drm_msm_gem_submit_bo { 167struct drm_msm_gem_submit_bo {
156 uint32_t flags; /* in, mask of MSM_SUBMIT_BO_x */ 168 uint32_t flags; /* in, mask of MSM_SUBMIT_BO_x */
157 uint32_t handle; /* in, GEM handle */ 169 uint32_t handle; /* in, GEM handle */
diff --git a/include/uapi/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index d9ea3a73afe2..aefa2f6afa3b 100644
--- a/include/uapi/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
@@ -510,6 +510,7 @@ typedef struct {
510#define DRM_RADEON_GEM_GET_TILING 0x29 510#define DRM_RADEON_GEM_GET_TILING 0x29
511#define DRM_RADEON_GEM_BUSY 0x2a 511#define DRM_RADEON_GEM_BUSY 0x2a
512#define DRM_RADEON_GEM_VA 0x2b 512#define DRM_RADEON_GEM_VA 0x2b
513#define DRM_RADEON_GEM_OP 0x2c
513 514
514#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 515#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
515#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 516#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -552,6 +553,7 @@ typedef struct {
552#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling) 553#define DRM_IOCTL_RADEON_GEM_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
553#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy) 554#define DRM_IOCTL_RADEON_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
554#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va) 555#define DRM_IOCTL_RADEON_GEM_VA DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
556#define DRM_IOCTL_RADEON_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_OP, struct drm_radeon_gem_op)
555 557
556typedef struct drm_radeon_init { 558typedef struct drm_radeon_init {
557 enum { 559 enum {
@@ -884,6 +886,16 @@ struct drm_radeon_gem_pwrite {
884 uint64_t data_ptr; 886 uint64_t data_ptr;
885}; 887};
886 888
889/* Sets or returns a value associated with a buffer. */
890struct drm_radeon_gem_op {
891 uint32_t handle; /* buffer */
892 uint32_t op; /* RADEON_GEM_OP_* */
893 uint64_t value; /* input or return value */
894};
895
896#define RADEON_GEM_OP_GET_INITIAL_DOMAIN 0
897#define RADEON_GEM_OP_SET_INITIAL_DOMAIN 1
898
887#define RADEON_VA_MAP 1 899#define RADEON_VA_MAP 1
888#define RADEON_VA_UNMAP 2 900#define RADEON_VA_UNMAP 2
889 901
@@ -919,6 +931,7 @@ struct drm_radeon_gem_va {
919#define RADEON_CS_RING_COMPUTE 1 931#define RADEON_CS_RING_COMPUTE 1
920#define RADEON_CS_RING_DMA 2 932#define RADEON_CS_RING_DMA 2
921#define RADEON_CS_RING_UVD 3 933#define RADEON_CS_RING_UVD 3
934#define RADEON_CS_RING_VCE 4
922/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */ 935/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
923/* 0 = normal, + = higher priority, - = lower priority */ 936/* 0 = normal, + = higher priority, - = lower priority */
924 937
@@ -987,6 +1000,13 @@ struct drm_radeon_cs {
987#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19 1000#define RADEON_INFO_SI_BACKEND_ENABLED_MASK 0x19
988/* max engine clock - needed for OpenCL */ 1001/* max engine clock - needed for OpenCL */
989#define RADEON_INFO_MAX_SCLK 0x1a 1002#define RADEON_INFO_MAX_SCLK 0x1a
1003/* version of VCE firmware */
1004#define RADEON_INFO_VCE_FW_VERSION 0x1b
1005/* version of VCE feedback */
1006#define RADEON_INFO_VCE_FB_VERSION 0x1c
1007#define RADEON_INFO_NUM_BYTES_MOVED 0x1d
1008#define RADEON_INFO_VRAM_USAGE 0x1e
1009#define RADEON_INFO_GTT_USAGE 0x1f
990 1010
991 1011
992struct drm_radeon_info { 1012struct drm_radeon_info {
diff --git a/include/uapi/drm/tegra_drm.h b/include/uapi/drm/tegra_drm.h
index 5e1ab552cbed..b042b48495d9 100644
--- a/include/uapi/drm/tegra_drm.h
+++ b/include/uapi/drm/tegra_drm.h
@@ -1,17 +1,23 @@
1/* 1/*
2 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * under the terms and conditions of the GNU General Public License, 5 * copy of this software and associated documentation files (the "Software"),
6 * version 2, as published by the Free Software Foundation. 6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
7 * 10 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 11 * The above copyright notice and this permission notice shall be included in
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * all copies or substantial portions of the Software.
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 * 13 *
13 * You should have received a copy of the GNU General Public License 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
15 */ 21 */
16 22
17#ifndef _UAPI_TEGRA_DRM_H_ 23#ifndef _UAPI_TEGRA_DRM_H_
diff --git a/include/uapi/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index 87792a5fee3b..4fc66f6b12ce 100644
--- a/include/uapi/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
@@ -90,6 +90,15 @@
90#define DRM_VMW_PARAM_MAX_MOB_SIZE 10 90#define DRM_VMW_PARAM_MAX_MOB_SIZE 10
91 91
92/** 92/**
93 * enum drm_vmw_handle_type - handle type for ref ioctls
94 *
95 */
96enum drm_vmw_handle_type {
97 DRM_VMW_HANDLE_LEGACY = 0,
98 DRM_VMW_HANDLE_PRIME = 1
99};
100
101/**
93 * struct drm_vmw_getparam_arg 102 * struct drm_vmw_getparam_arg
94 * 103 *
95 * @value: Returned value. //Out 104 * @value: Returned value. //Out
@@ -177,6 +186,7 @@ struct drm_vmw_surface_create_req {
177 * struct drm_wmv_surface_arg 186 * struct drm_wmv_surface_arg
178 * 187 *
179 * @sid: Surface id of created surface or surface to destroy or reference. 188 * @sid: Surface id of created surface or surface to destroy or reference.
189 * @handle_type: Handle type for DRM_VMW_REF_SURFACE Ioctl.
180 * 190 *
181 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. 191 * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
182 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. 192 * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
@@ -185,7 +195,7 @@ struct drm_vmw_surface_create_req {
185 195
186struct drm_vmw_surface_arg { 196struct drm_vmw_surface_arg {
187 int32_t sid; 197 int32_t sid;
188 uint32_t pad64; 198 enum drm_vmw_handle_type handle_type;
189}; 199};
190 200
191/** 201/**
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 3ce25b5d75a9..6929571b79b0 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -139,6 +139,7 @@ header-y += hid.h
139header-y += hiddev.h 139header-y += hiddev.h
140header-y += hidraw.h 140header-y += hidraw.h
141header-y += hpet.h 141header-y += hpet.h
142header-y += hyperv.h
142header-y += hysdn_if.h 143header-y += hysdn_if.h
143header-y += i2c-dev.h 144header-y += i2c-dev.h
144header-y += i2c.h 145header-y += i2c.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 2d48fe1274ca..11917f747cb4 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -70,7 +70,6 @@
70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */ 70#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
71#define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */ 71#define AUDIT_SET_FEATURE 1018 /* Turn an audit feature on or off */
72#define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */ 72#define AUDIT_GET_FEATURE 1019 /* Get which features are enabled */
73#define AUDIT_FEATURE_CHANGE 1020 /* audit log listing feature changes */
74 73
75#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */ 74#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
76#define AUDIT_USER_AVC 1107 /* We filter this differently */ 75#define AUDIT_USER_AVC 1107 /* We filter this differently */
@@ -109,6 +108,8 @@
109#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ 108#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
110#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ 109#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
111#define AUDIT_SECCOMP 1326 /* Secure Computing event */ 110#define AUDIT_SECCOMP 1326 /* Secure Computing event */
111#define AUDIT_PROCTITLE 1327 /* Proctitle emit event */
112#define AUDIT_FEATURE_CHANGE 1328 /* audit log listing feature changes */
112 113
113#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 114#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
114#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 115#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
diff --git a/include/uapi/linux/can.h b/include/uapi/linux/can.h
index e52958d7c2d1..5d9d1d140718 100644
--- a/include/uapi/linux/can.h
+++ b/include/uapi/linux/can.h
@@ -8,6 +8,38 @@
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved. 9 * All rights reserved.
10 * 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 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of Volkswagen nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * Alternatively, provided that this notice is retained in full, this
24 * software may be distributed under the terms of the GNU General
25 * Public License ("GPL") version 2, in which case the provisions of the
26 * GPL apply INSTEAD OF those given above.
27 *
28 * The provided data structures and external interfaces from this code
29 * are not restricted to be used by modules with a GPL compatible license.
30 *
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 MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
37 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
38 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
39 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
41 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
42 * DAMAGE.
11 */ 43 */
12 44
13#ifndef CAN_H 45#ifndef CAN_H
diff --git a/include/uapi/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index df944ed206a8..7e2e1863db16 100644
--- a/include/uapi/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
@@ -96,6 +96,7 @@ struct can_ctrlmode {
96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */ 96#define CAN_CTRLMODE_3_SAMPLES 0x04 /* Triple sampling mode */
97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */ 97#define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */ 98#define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
99#define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
99 100
100/* 101/*
101 * CAN device statistics 102 * CAN device statistics
@@ -122,6 +123,8 @@ enum {
122 IFLA_CAN_RESTART_MS, 123 IFLA_CAN_RESTART_MS,
123 IFLA_CAN_RESTART, 124 IFLA_CAN_RESTART,
124 IFLA_CAN_BERR_COUNTER, 125 IFLA_CAN_BERR_COUNTER,
126 IFLA_CAN_DATA_BITTIMING,
127 IFLA_CAN_DATA_BITTIMING_CONST,
125 __IFLA_CAN_MAX 128 __IFLA_CAN_MAX
126}; 129};
127 130
diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h
index ba478fa3012e..154dd6d3c8fe 100644
--- a/include/uapi/linux/capability.h
+++ b/include/uapi/linux/capability.h
@@ -308,8 +308,12 @@ struct vfs_cap_data {
308 308
309#define CAP_LEASE 28 309#define CAP_LEASE 28
310 310
311/* Allow writing the audit log via unicast netlink socket */
312
311#define CAP_AUDIT_WRITE 29 313#define CAP_AUDIT_WRITE 29
312 314
315/* Allow configuration of audit via unicast netlink socket */
316
313#define CAP_AUDIT_CONTROL 30 317#define CAP_AUDIT_CONTROL 30
314 318
315#define CAP_SETFCAP 31 319#define CAP_SETFCAP 31
diff --git a/include/uapi/linux/capi.h b/include/uapi/linux/capi.h
index 65100d6cb89b..7b145fd7afb6 100644
--- a/include/uapi/linux/capi.h
+++ b/include/uapi/linux/capi.h
@@ -102,7 +102,7 @@ typedef struct capi_manufacturer_cmd {
102 102
103/* 103/*
104 * member contr is input for 104 * member contr is input for
105 * CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL 105 * CAPI_GET_MANUFACTURER, CAPI_GET_VERSION, CAPI_GET_SERIAL
106 * and CAPI_GET_PROFILE 106 * and CAPI_GET_PROFILE
107 */ 107 */
108typedef union capi_ioctl_struct { 108typedef union capi_ioctl_struct {
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 38dbafaa5341..fd161e91b6d7 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -16,37 +16,97 @@
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/if_ether.h> 17#include <linux/if_ether.h>
18 18
19/* This should work for both 32 and 64 bit userland. */ 19/* All structures exposed to userland should be defined such that they
20 * have the same layout for 32-bit and 64-bit userland.
21 */
22
23/**
24 * struct ethtool_cmd - link control and status
25 * @cmd: Command number = %ETHTOOL_GSET or %ETHTOOL_SSET
26 * @supported: Bitmask of %SUPPORTED_* flags for the link modes,
27 * physical connectors and other link features for which the
28 * interface supports autonegotiation or auto-detection.
29 * Read-only.
30 * @advertising: Bitmask of %ADVERTISED_* flags for the link modes,
31 * physical connectors and other link features that are
32 * advertised through autonegotiation or enabled for
33 * auto-detection.
34 * @speed: Low bits of the speed
35 * @duplex: Duplex mode; one of %DUPLEX_*
36 * @port: Physical connector type; one of %PORT_*
37 * @phy_address: MDIO address of PHY (transceiver); 0 or 255 if not
38 * applicable. For clause 45 PHYs this is the PRTAD.
39 * @transceiver: Historically used to distinguish different possible
40 * PHY types, but not in a consistent way. Deprecated.
41 * @autoneg: Enable/disable autonegotiation and auto-detection;
42 * either %AUTONEG_DISABLE or %AUTONEG_ENABLE
43 * @mdio_support: Bitmask of %ETH_MDIO_SUPPORTS_* flags for the MDIO
44 * protocols supported by the interface; 0 if unknown.
45 * Read-only.
46 * @maxtxpkt: Historically used to report TX IRQ coalescing; now
47 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
48 * @maxrxpkt: Historically used to report RX IRQ coalescing; now
49 * obsoleted by &struct ethtool_coalesce. Read-only; deprecated.
50 * @speed_hi: High bits of the speed
51 * @eth_tp_mdix: Ethernet twisted-pair MDI(-X) status; one of
52 * %ETH_TP_MDI_*. If the status is unknown or not applicable, the
53 * value will be %ETH_TP_MDI_INVALID. Read-only.
54 * @eth_tp_mdix_ctrl: Ethernet twisted pair MDI(-X) control; one of
55 * %ETH_TP_MDI_*. If MDI(-X) control is not implemented, reads
56 * yield %ETH_TP_MDI_INVALID and writes may be ignored or rejected.
57 * When written successfully, the link should be renegotiated if
58 * necessary.
59 * @lp_advertising: Bitmask of %ADVERTISED_* flags for the link modes
60 * and other link features that the link partner advertised
61 * through autonegotiation; 0 if unknown or not applicable.
62 * Read-only.
63 *
64 * The link speed in Mbps is split between @speed and @speed_hi. Use
65 * the ethtool_cmd_speed() and ethtool_cmd_speed_set() functions to
66 * access it.
67 *
68 * If autonegotiation is disabled, the speed and @duplex represent the
69 * fixed link mode and are writable if the driver supports multiple
70 * link modes. If it is enabled then they are read-only; if the link
71 * is up they represent the negotiated link mode; if the link is down,
72 * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
73 * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
74 *
75 * Some hardware interfaces may have multiple PHYs and/or physical
76 * connectors fitted or do not allow the driver to detect which are
77 * fitted. For these interfaces @port and/or @phy_address may be
78 * writable, possibly dependent on @autoneg being %AUTONEG_DISABLE.
79 * Otherwise, attempts to write different values may be ignored or
80 * rejected.
81 *
82 * Users should assume that all fields not marked read-only are
83 * writable and subject to validation by the driver. They should use
84 * %ETHTOOL_GSET to get the current values before making specific
85 * changes and then applying them with %ETHTOOL_SSET.
86 *
87 * Drivers that implement set_settings() should validate all fields
88 * other than @cmd that are not described as read-only or deprecated,
89 * and must ignore all fields described as read-only.
90 *
91 * Deprecated fields should be ignored by both users and drivers.
92 */
20struct ethtool_cmd { 93struct ethtool_cmd {
21 __u32 cmd; 94 __u32 cmd;
22 __u32 supported; /* Features this interface supports */ 95 __u32 supported;
23 __u32 advertising; /* Features this interface advertises */ 96 __u32 advertising;
24 __u16 speed; /* The forced speed (lower bits) in 97 __u16 speed;
25 * Mbps. Please use 98 __u8 duplex;
26 * ethtool_cmd_speed()/_set() to 99 __u8 port;
27 * access it */ 100 __u8 phy_address;
28 __u8 duplex; /* Duplex, half or full */ 101 __u8 transceiver;
29 __u8 port; /* Which connector port */ 102 __u8 autoneg;
30 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45). 103 __u8 mdio_support;
31 * May be read-only or read-write 104 __u32 maxtxpkt;
32 * depending on the driver. 105 __u32 maxrxpkt;
33 */ 106 __u16 speed_hi;
34 __u8 transceiver; /* Which transceiver to use */ 107 __u8 eth_tp_mdix;
35 __u8 autoneg; /* Enable or disable autonegotiation */ 108 __u8 eth_tp_mdix_ctrl;
36 __u8 mdio_support; /* MDIO protocols supported. Read-only. 109 __u32 lp_advertising;
37 * Not set by all drivers.
38 */
39 __u32 maxtxpkt; /* Tx pkts before generating tx int */
40 __u32 maxrxpkt; /* Rx pkts before generating rx int */
41 __u16 speed_hi; /* The forced speed (upper
42 * bits) in Mbps. Please use
43 * ethtool_cmd_speed()/_set() to
44 * access it */
45 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
46 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
47 * link should be renegotiated if necessary
48 */
49 __u32 lp_advertising; /* Features the link partner advertises */
50 __u32 reserved[2]; 110 __u32 reserved[2];
51}; 111};
52 112
@@ -79,37 +139,68 @@ static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
79 139
80#define ETHTOOL_FWVERS_LEN 32 140#define ETHTOOL_FWVERS_LEN 32
81#define ETHTOOL_BUSINFO_LEN 32 141#define ETHTOOL_BUSINFO_LEN 32
82/* these strings are set to whatever the driver author decides... */ 142
143/**
144 * struct ethtool_drvinfo - general driver and device information
145 * @cmd: Command number = %ETHTOOL_GDRVINFO
146 * @driver: Driver short name. This should normally match the name
147 * in its bus driver structure (e.g. pci_driver::name). Must
148 * not be an empty string.
149 * @version: Driver version string; may be an empty string
150 * @fw_version: Firmware version string; may be an empty string
151 * @bus_info: Device bus address. This should match the dev_name()
152 * string for the underlying bus device, if there is one. May be
153 * an empty string.
154 * @n_priv_flags: Number of flags valid for %ETHTOOL_GPFLAGS and
155 * %ETHTOOL_SPFLAGS commands; also the number of strings in the
156 * %ETH_SS_PRIV_FLAGS set
157 * @n_stats: Number of u64 statistics returned by the %ETHTOOL_GSTATS
158 * command; also the number of strings in the %ETH_SS_STATS set
159 * @testinfo_len: Number of results returned by the %ETHTOOL_TEST
160 * command; also the number of strings in the %ETH_SS_TEST set
161 * @eedump_len: Size of EEPROM accessible through the %ETHTOOL_GEEPROM
162 * and %ETHTOOL_SEEPROM commands, in bytes
163 * @regdump_len: Size of register dump returned by the %ETHTOOL_GREGS
164 * command, in bytes
165 *
166 * Users can use the %ETHTOOL_GSSET_INFO command to get the number of
167 * strings in any string set (from Linux 2.6.34).
168 *
169 * Drivers should set at most @driver, @version, @fw_version and
170 * @bus_info in their get_drvinfo() implementation. The ethtool
171 * core fills in the other fields using other driver operations.
172 */
83struct ethtool_drvinfo { 173struct ethtool_drvinfo {
84 __u32 cmd; 174 __u32 cmd;
85 char driver[32]; /* driver short name, "tulip", "eepro100" */ 175 char driver[32];
86 char version[32]; /* driver version string */ 176 char version[32];
87 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */ 177 char fw_version[ETHTOOL_FWVERS_LEN];
88 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */ 178 char bus_info[ETHTOOL_BUSINFO_LEN];
89 /* For PCI devices, use pci_name(pci_dev). */
90 char reserved1[32]; 179 char reserved1[32];
91 char reserved2[12]; 180 char reserved2[12];
92 /* 181 __u32 n_priv_flags;
93 * Some struct members below are filled in 182 __u32 n_stats;
94 * using ops->get_sset_count(). Obtaining
95 * this info from ethtool_drvinfo is now
96 * deprecated; Use ETHTOOL_GSSET_INFO
97 * instead.
98 */
99 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
100 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
101 __u32 testinfo_len; 183 __u32 testinfo_len;
102 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */ 184 __u32 eedump_len;
103 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */ 185 __u32 regdump_len;
104}; 186};
105 187
106#define SOPASS_MAX 6 188#define SOPASS_MAX 6
107/* wake-on-lan settings */ 189
190/**
191 * struct ethtool_wolinfo - Wake-On-Lan configuration
192 * @cmd: Command number = %ETHTOOL_GWOL or %ETHTOOL_SWOL
193 * @supported: Bitmask of %WAKE_* flags for supported Wake-On-Lan modes.
194 * Read-only.
195 * @wolopts: Bitmask of %WAKE_* flags for enabled Wake-On-Lan modes.
196 * @sopass: SecureOn(tm) password; meaningful only if %WAKE_MAGICSECURE
197 * is set in @wolopts.
198 */
108struct ethtool_wolinfo { 199struct ethtool_wolinfo {
109 __u32 cmd; 200 __u32 cmd;
110 __u32 supported; 201 __u32 supported;
111 __u32 wolopts; 202 __u32 wolopts;
112 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */ 203 __u8 sopass[SOPASS_MAX];
113}; 204};
114 205
115/* for passing single values */ 206/* for passing single values */
@@ -118,20 +209,51 @@ struct ethtool_value {
118 __u32 data; 209 __u32 data;
119}; 210};
120 211
121/* for passing big chunks of data */ 212/**
213 * struct ethtool_regs - hardware register dump
214 * @cmd: Command number = %ETHTOOL_GREGS
215 * @version: Dump format version. This is driver-specific and may
216 * distinguish different chips/revisions. Drivers must use new
217 * version numbers whenever the dump format changes in an
218 * incompatible way.
219 * @len: On entry, the real length of @data. On return, the number of
220 * bytes used.
221 * @data: Buffer for the register dump
222 *
223 * Users should use %ETHTOOL_GDRVINFO to find the maximum length of
224 * a register dump for the interface. They must allocate the buffer
225 * immediately following this structure.
226 */
122struct ethtool_regs { 227struct ethtool_regs {
123 __u32 cmd; 228 __u32 cmd;
124 __u32 version; /* driver-specific, indicates different chips/revs */ 229 __u32 version;
125 __u32 len; /* bytes */ 230 __u32 len;
126 __u8 data[0]; 231 __u8 data[0];
127}; 232};
128 233
129/* for passing EEPROM chunks */ 234/**
235 * struct ethtool_eeprom - EEPROM dump
236 * @cmd: Command number = %ETHTOOL_GEEPROM, %ETHTOOL_GMODULEEEPROM or
237 * %ETHTOOL_SEEPROM
238 * @magic: A 'magic cookie' value to guard against accidental changes.
239 * The value passed in to %ETHTOOL_SEEPROM must match the value
240 * returned by %ETHTOOL_GEEPROM for the same device. This is
241 * unused when @cmd is %ETHTOOL_GMODULEEEPROM.
242 * @offset: Offset within the EEPROM to begin reading/writing, in bytes
243 * @len: On entry, number of bytes to read/write. On successful
244 * return, number of bytes actually read/written. In case of
245 * error, this may indicate at what point the error occurred.
246 * @data: Buffer to read/write from
247 *
248 * Users may use %ETHTOOL_GDRVINFO or %ETHTOOL_GMODULEINFO to find
249 * the length of an on-board or module EEPROM, respectively. They
250 * must allocate the buffer immediately following this structure.
251 */
130struct ethtool_eeprom { 252struct ethtool_eeprom {
131 __u32 cmd; 253 __u32 cmd;
132 __u32 magic; 254 __u32 magic;
133 __u32 offset; /* in bytes */ 255 __u32 offset;
134 __u32 len; /* in bytes */ 256 __u32 len;
135 __u8 data[0]; 257 __u8 data[0];
136}; 258};
137 259
@@ -229,17 +351,18 @@ struct ethtool_modinfo {
229 * @rate_sample_interval: How often to do adaptive coalescing packet rate 351 * @rate_sample_interval: How often to do adaptive coalescing packet rate
230 * sampling, measured in seconds. Must not be zero. 352 * sampling, measured in seconds. Must not be zero.
231 * 353 *
232 * Each pair of (usecs, max_frames) fields specifies this exit 354 * Each pair of (usecs, max_frames) fields specifies that interrupts
233 * condition for interrupt coalescing: 355 * should be coalesced until
234 * (usecs > 0 && time_since_first_completion >= usecs) || 356 * (usecs > 0 && time_since_first_completion >= usecs) ||
235 * (max_frames > 0 && completed_frames >= max_frames) 357 * (max_frames > 0 && completed_frames >= max_frames)
358 *
236 * It is illegal to set both usecs and max_frames to zero as this 359 * It is illegal to set both usecs and max_frames to zero as this
237 * would cause interrupts to never be generated. To disable 360 * would cause interrupts to never be generated. To disable
238 * coalescing, set usecs = 0 and max_frames = 1. 361 * coalescing, set usecs = 0 and max_frames = 1.
239 * 362 *
240 * Some implementations ignore the value of max_frames and use the 363 * Some implementations ignore the value of max_frames and use the
241 * condition: 364 * condition time_since_first_completion >= usecs
242 * time_since_first_completion >= usecs 365 *
243 * This is deprecated. Drivers for hardware that does not support 366 * This is deprecated. Drivers for hardware that does not support
244 * counting completions should validate that max_frames == !rx_usecs. 367 * counting completions should validate that max_frames == !rx_usecs.
245 * 368 *
@@ -279,22 +402,37 @@ struct ethtool_coalesce {
279 __u32 rate_sample_interval; 402 __u32 rate_sample_interval;
280}; 403};
281 404
282/* for configuring RX/TX ring parameters */ 405/**
406 * struct ethtool_ringparam - RX/TX ring parameters
407 * @cmd: Command number = %ETHTOOL_GRINGPARAM or %ETHTOOL_SRINGPARAM
408 * @rx_max_pending: Maximum supported number of pending entries per
409 * RX ring. Read-only.
410 * @rx_mini_max_pending: Maximum supported number of pending entries
411 * per RX mini ring. Read-only.
412 * @rx_jumbo_max_pending: Maximum supported number of pending entries
413 * per RX jumbo ring. Read-only.
414 * @tx_max_pending: Maximum supported number of pending entries per
415 * TX ring. Read-only.
416 * @rx_pending: Current maximum number of pending entries per RX ring
417 * @rx_mini_pending: Current maximum number of pending entries per RX
418 * mini ring
419 * @rx_jumbo_pending: Current maximum number of pending entries per RX
420 * jumbo ring
421 * @tx_pending: Current maximum supported number of pending entries
422 * per TX ring
423 *
424 * If the interface does not have separate RX mini and/or jumbo rings,
425 * @rx_mini_max_pending and/or @rx_jumbo_max_pending will be 0.
426 *
427 * There may also be driver-dependent minimum values for the number
428 * of entries per ring.
429 */
283struct ethtool_ringparam { 430struct ethtool_ringparam {
284 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */ 431 __u32 cmd;
285
286 /* Read only attributes. These indicate the maximum number
287 * of pending RX/TX ring entries the driver will allow the
288 * user to set.
289 */
290 __u32 rx_max_pending; 432 __u32 rx_max_pending;
291 __u32 rx_mini_max_pending; 433 __u32 rx_mini_max_pending;
292 __u32 rx_jumbo_max_pending; 434 __u32 rx_jumbo_max_pending;
293 __u32 tx_max_pending; 435 __u32 tx_max_pending;
294
295 /* Values changeable by the user. The valid values are
296 * in the range 1 to the "*_max_pending" counterpart above.
297 */
298 __u32 rx_pending; 436 __u32 rx_pending;
299 __u32 rx_mini_pending; 437 __u32 rx_mini_pending;
300 __u32 rx_jumbo_pending; 438 __u32 rx_jumbo_pending;
@@ -329,51 +467,96 @@ struct ethtool_channels {
329 __u32 combined_count; 467 __u32 combined_count;
330}; 468};
331 469
332/* for configuring link flow control parameters */ 470/**
471 * struct ethtool_pauseparam - Ethernet pause (flow control) parameters
472 * @cmd: Command number = %ETHTOOL_GPAUSEPARAM or %ETHTOOL_SPAUSEPARAM
473 * @autoneg: Flag to enable autonegotiation of pause frame use
474 * @rx_pause: Flag to enable reception of pause frames
475 * @tx_pause: Flag to enable transmission of pause frames
476 *
477 * Drivers should reject a non-zero setting of @autoneg when
478 * autoneogotiation is disabled (or not supported) for the link.
479 *
480 * If the link is autonegotiated, drivers should use
481 * mii_advertise_flowctrl() or similar code to set the advertised
482 * pause frame capabilities based on the @rx_pause and @tx_pause flags,
483 * even if @autoneg is zero. They should also allow the advertised
484 * pause frame capabilities to be controlled directly through the
485 * advertising field of &struct ethtool_cmd.
486 *
487 * If @autoneg is non-zero, the MAC is configured to send and/or
488 * receive pause frames according to the result of autonegotiation.
489 * Otherwise, it is configured directly based on the @rx_pause and
490 * @tx_pause flags.
491 */
333struct ethtool_pauseparam { 492struct ethtool_pauseparam {
334 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */ 493 __u32 cmd;
335
336 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
337 * being true) the user may set 'autoneg' here non-zero to have the
338 * pause parameters be auto-negotiated too. In such a case, the
339 * {rx,tx}_pause values below determine what capabilities are
340 * advertised.
341 *
342 * If 'autoneg' is zero or the link is not being auto-negotiated,
343 * then {rx,tx}_pause force the driver to use/not-use pause
344 * flow control.
345 */
346 __u32 autoneg; 494 __u32 autoneg;
347 __u32 rx_pause; 495 __u32 rx_pause;
348 __u32 tx_pause; 496 __u32 tx_pause;
349}; 497};
350 498
351#define ETH_GSTRING_LEN 32 499#define ETH_GSTRING_LEN 32
500
501/**
502 * enum ethtool_stringset - string set ID
503 * @ETH_SS_TEST: Self-test result names, for use with %ETHTOOL_TEST
504 * @ETH_SS_STATS: Statistic names, for use with %ETHTOOL_GSTATS
505 * @ETH_SS_PRIV_FLAGS: Driver private flag names, for use with
506 * %ETHTOOL_GPFLAGS and %ETHTOOL_SPFLAGS
507 * @ETH_SS_NTUPLE_FILTERS: Previously used with %ETHTOOL_GRXNTUPLE;
508 * now deprecated
509 * @ETH_SS_FEATURES: Device feature names
510 */
352enum ethtool_stringset { 511enum ethtool_stringset {
353 ETH_SS_TEST = 0, 512 ETH_SS_TEST = 0,
354 ETH_SS_STATS, 513 ETH_SS_STATS,
355 ETH_SS_PRIV_FLAGS, 514 ETH_SS_PRIV_FLAGS,
356 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */ 515 ETH_SS_NTUPLE_FILTERS,
357 ETH_SS_FEATURES, 516 ETH_SS_FEATURES,
358}; 517};
359 518
360/* for passing string sets for data tagging */ 519/**
520 * struct ethtool_gstrings - string set for data tagging
521 * @cmd: Command number = %ETHTOOL_GSTRINGS
522 * @string_set: String set ID; one of &enum ethtool_stringset
523 * @len: On return, the number of strings in the string set
524 * @data: Buffer for strings. Each string is null-padded to a size of
525 * %ETH_GSTRING_LEN.
526 *
527 * Users must use %ETHTOOL_GSSET_INFO to find the number of strings in
528 * the string set. They must allocate a buffer of the appropriate
529 * size immediately following this structure.
530 */
361struct ethtool_gstrings { 531struct ethtool_gstrings {
362 __u32 cmd; /* ETHTOOL_GSTRINGS */ 532 __u32 cmd;
363 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/ 533 __u32 string_set;
364 __u32 len; /* number of strings in the string set */ 534 __u32 len;
365 __u8 data[0]; 535 __u8 data[0];
366}; 536};
367 537
538/**
539 * struct ethtool_sset_info - string set information
540 * @cmd: Command number = %ETHTOOL_GSSET_INFO
541 * @sset_mask: On entry, a bitmask of string sets to query, with bits
542 * numbered according to &enum ethtool_stringset. On return, a
543 * bitmask of those string sets queried that are supported.
544 * @data: Buffer for string set sizes. On return, this contains the
545 * size of each string set that was queried and supported, in
546 * order of ID.
547 *
548 * Example: The user passes in @sset_mask = 0x7 (sets 0, 1, 2) and on
549 * return @sset_mask == 0x6 (sets 1, 2). Then @data[0] contains the
550 * size of set 1 and @data[1] contains the size of set 2.
551 *
552 * Users must allocate a buffer of the appropriate size (4 * number of
553 * sets queried) immediately following this structure.
554 */
368struct ethtool_sset_info { 555struct ethtool_sset_info {
369 __u32 cmd; /* ETHTOOL_GSSET_INFO */ 556 __u32 cmd;
370 __u32 reserved; 557 __u32 reserved;
371 __u64 sset_mask; /* input: each bit selects an sset to query */ 558 __u64 sset_mask;
372 /* output: each bit a returned sset */ 559 __u32 data[0];
373 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
374 in sset_mask. One bit implies one
375 __u32, two bits implies two
376 __u32's, etc. */
377}; 560};
378 561
379/** 562/**
@@ -393,24 +576,58 @@ enum ethtool_test_flags {
393 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3), 576 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
394}; 577};
395 578
396/* for requesting NIC test and getting results*/ 579/**
580 * struct ethtool_test - device self-test invocation
581 * @cmd: Command number = %ETHTOOL_TEST
582 * @flags: A bitmask of flags from &enum ethtool_test_flags. Some
583 * flags may be set by the user on entry; others may be set by
584 * the driver on return.
585 * @len: On return, the number of test results
586 * @data: Array of test results
587 *
588 * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
589 * number of test results that will be returned. They must allocate a
590 * buffer of the appropriate size (8 * number of results) immediately
591 * following this structure.
592 */
397struct ethtool_test { 593struct ethtool_test {
398 __u32 cmd; /* ETHTOOL_TEST */ 594 __u32 cmd;
399 __u32 flags; /* ETH_TEST_FL_xxx */ 595 __u32 flags;
400 __u32 reserved; 596 __u32 reserved;
401 __u32 len; /* result length, in number of u64 elements */ 597 __u32 len;
402 __u64 data[0]; 598 __u64 data[0];
403}; 599};
404 600
405/* for dumping NIC-specific statistics */ 601/**
602 * struct ethtool_stats - device-specific statistics
603 * @cmd: Command number = %ETHTOOL_GSTATS
604 * @n_stats: On return, the number of statistics
605 * @data: Array of statistics
606 *
607 * Users must use %ETHTOOL_GSSET_INFO or %ETHTOOL_GDRVINFO to find the
608 * number of statistics that will be returned. They must allocate a
609 * buffer of the appropriate size (8 * number of statistics)
610 * immediately following this structure.
611 */
406struct ethtool_stats { 612struct ethtool_stats {
407 __u32 cmd; /* ETHTOOL_GSTATS */ 613 __u32 cmd;
408 __u32 n_stats; /* number of u64's being returned */ 614 __u32 n_stats;
409 __u64 data[0]; 615 __u64 data[0];
410}; 616};
411 617
618/**
619 * struct ethtool_perm_addr - permanent hardware address
620 * @cmd: Command number = %ETHTOOL_GPERMADDR
621 * @size: On entry, the size of the buffer. On return, the size of the
622 * address. The command fails if the buffer is too small.
623 * @data: Buffer for the address
624 *
625 * Users must allocate the buffer immediately following this structure.
626 * A buffer size of %MAX_ADDR_LEN should be sufficient for any address
627 * type.
628 */
412struct ethtool_perm_addr { 629struct ethtool_perm_addr {
413 __u32 cmd; /* ETHTOOL_GPERMADDR */ 630 __u32 cmd;
414 __u32 size; 631 __u32 size;
415 __u8 data[0]; 632 __u8 data[0];
416}; 633};
@@ -593,7 +810,7 @@ struct ethtool_rx_flow_spec {
593 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused 810 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
594 * location, and may remove a rule at a later location (lower 811 * location, and may remove a rule at a later location (lower
595 * priority) that matches exactly the same set of flows. The special 812 * priority) that matches exactly the same set of flows. The special
596 * values are: %RX_CLS_LOC_ANY, selecting any location; 813 * values are %RX_CLS_LOC_ANY, selecting any location;
597 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum 814 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
598 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable 815 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
599 * location (minimum priority). Additional special values may be 816 * location (minimum priority). Additional special values may be
@@ -704,9 +921,6 @@ struct ethtool_flash {
704 * for %ETHTOOL_GET_DUMP_FLAG command 921 * for %ETHTOOL_GET_DUMP_FLAG command
705 * @data: data collected for get dump data operation 922 * @data: data collected for get dump data operation
706 */ 923 */
707
708#define ETH_FW_DUMP_DISABLE 0
709
710struct ethtool_dump { 924struct ethtool_dump {
711 __u32 cmd; 925 __u32 cmd;
712 __u32 version; 926 __u32 version;
@@ -715,6 +929,8 @@ struct ethtool_dump {
715 __u8 data[0]; 929 __u8 data[0];
716}; 930};
717 931
932#define ETH_FW_DUMP_DISABLE 0
933
718/* for returning and changing feature sets */ 934/* for returning and changing feature sets */
719 935
720/** 936/**
@@ -734,8 +950,9 @@ struct ethtool_get_features_block {
734/** 950/**
735 * struct ethtool_gfeatures - command to get state of device's features 951 * struct ethtool_gfeatures - command to get state of device's features
736 * @cmd: command number = %ETHTOOL_GFEATURES 952 * @cmd: command number = %ETHTOOL_GFEATURES
737 * @size: in: number of elements in the features[] array; 953 * @size: On entry, the number of elements in the features[] array;
738 * out: number of elements in features[] needed to hold all features 954 * on return, the number of elements in features[] needed to hold
955 * all features
739 * @features: state of features 956 * @features: state of features
740 */ 957 */
741struct ethtool_gfeatures { 958struct ethtool_gfeatures {
@@ -905,7 +1122,6 @@ enum ethtool_sfeatures_retval_bits {
905#define SPARC_ETH_GSET ETHTOOL_GSET 1122#define SPARC_ETH_GSET ETHTOOL_GSET
906#define SPARC_ETH_SSET ETHTOOL_SSET 1123#define SPARC_ETH_SSET ETHTOOL_SSET
907 1124
908/* Indicates what features are supported by the interface. */
909#define SUPPORTED_10baseT_Half (1 << 0) 1125#define SUPPORTED_10baseT_Half (1 << 0)
910#define SUPPORTED_10baseT_Full (1 << 1) 1126#define SUPPORTED_10baseT_Full (1 << 1)
911#define SUPPORTED_100baseT_Half (1 << 2) 1127#define SUPPORTED_100baseT_Half (1 << 2)
@@ -934,7 +1150,6 @@ enum ethtool_sfeatures_retval_bits {
934#define SUPPORTED_40000baseSR4_Full (1 << 25) 1150#define SUPPORTED_40000baseSR4_Full (1 << 25)
935#define SUPPORTED_40000baseLR4_Full (1 << 26) 1151#define SUPPORTED_40000baseLR4_Full (1 << 26)
936 1152
937/* Indicates what features are advertised by the interface. */
938#define ADVERTISED_10baseT_Half (1 << 0) 1153#define ADVERTISED_10baseT_Half (1 << 0)
939#define ADVERTISED_10baseT_Full (1 << 1) 1154#define ADVERTISED_10baseT_Full (1 << 1)
940#define ADVERTISED_100baseT_Half (1 << 2) 1155#define ADVERTISED_100baseT_Half (1 << 2)
@@ -999,9 +1214,7 @@ enum ethtool_sfeatures_retval_bits {
999#define XCVR_DUMMY2 0x03 1214#define XCVR_DUMMY2 0x03
1000#define XCVR_DUMMY3 0x04 1215#define XCVR_DUMMY3 0x04
1001 1216
1002/* Enable or disable autonegotiation. If this is set to enable, 1217/* Enable or disable autonegotiation. */
1003 * the forced link modes above are completely ignored.
1004 */
1005#define AUTONEG_DISABLE 0x00 1218#define AUTONEG_DISABLE 0x00
1006#define AUTONEG_ENABLE 0x01 1219#define AUTONEG_ENABLE 0x01
1007 1220
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
index 990c4ccf8b61..d1197ae3723c 100644
--- a/include/uapi/linux/falloc.h
+++ b/include/uapi/linux/falloc.h
@@ -5,5 +5,40 @@
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#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */
7 7
8/*
9 * FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file
10 * without leaving a hole in the file. The contents of the file beyond
11 * the range being removed is appended to the start offset of the range
12 * being removed (i.e. the hole that was punched is "collapsed"),
13 * resulting in a file layout that looks like the range that was
14 * removed never existed. As such collapsing a range of a file changes
15 * the size of the file, reducing it by the same length of the range
16 * that has been removed by the operation.
17 *
18 * Different filesystems may implement different limitations on the
19 * granularity of the operation. Most will limit operations to
20 * filesystem block size boundaries, but this boundary may be larger or
21 * smaller depending on the filesystem and/or the configuration of the
22 * filesystem or file.
23 *
24 * Attempting to collapse a range that crosses the end of the file is
25 * considered an illegal operation - just use ftruncate(2) if you need
26 * to collapse a range that crosses EOF.
27 */
28#define FALLOC_FL_COLLAPSE_RANGE 0x08
29
30/*
31 * FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably
32 * without issuing data IO. Blocks should be preallocated for the regions that
33 * span holes in the file, and the entire range is preferable converted to
34 * unwritten extents - even though file system may choose to zero out the
35 * extent or do whatever which will result in reading zeros from the range
36 * while the range remains allocated for the file.
37 *
38 * This can be also used to preallocate blocks past EOF in the same way as
39 * with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode
40 * size to remain the same.
41 */
42#define FALLOC_FL_ZERO_RANGE 0x10
8 43
9#endif /* _UAPI_FALLOC_H_ */ 44#endif /* _UAPI_FALLOC_H_ */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 6c28b61bb690..ca1a11bb4443 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -35,6 +35,9 @@
35#define SEEK_HOLE 4 /* seek to the next hole */ 35#define SEEK_HOLE 4 /* seek to the next hole */
36#define SEEK_MAX SEEK_HOLE 36#define SEEK_MAX SEEK_HOLE
37 37
38#define RENAME_NOREPLACE (1 << 0) /* Don't overwrite target */
39#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
40
38struct fstrim_range { 41struct fstrim_range {
39 __u64 start; 42 __u64 start;
40 __u64 len; 43 __u64 len;
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h
index 60bb2f9f7b74..cf4750e1bb49 100644
--- a/include/uapi/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
@@ -93,6 +93,9 @@
93 * 93 *
94 * 7.22 94 * 7.22
95 * - add FUSE_ASYNC_DIO 95 * - add FUSE_ASYNC_DIO
96 *
97 * 7.23
98 * - add FUSE_WRITEBACK_CACHE
96 */ 99 */
97 100
98#ifndef _LINUX_FUSE_H 101#ifndef _LINUX_FUSE_H
@@ -128,7 +131,7 @@
128#define FUSE_KERNEL_VERSION 7 131#define FUSE_KERNEL_VERSION 7
129 132
130/** Minor version number of this interface */ 133/** Minor version number of this interface */
131#define FUSE_KERNEL_MINOR_VERSION 22 134#define FUSE_KERNEL_MINOR_VERSION 23
132 135
133/** The node ID of the root inode */ 136/** The node ID of the root inode */
134#define FUSE_ROOT_ID 1 137#define FUSE_ROOT_ID 1
@@ -219,6 +222,7 @@ struct fuse_file_lock {
219 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) 222 * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
220 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus 223 * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
221 * FUSE_ASYNC_DIO: asynchronous direct I/O submission 224 * FUSE_ASYNC_DIO: asynchronous direct I/O submission
225 * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
222 */ 226 */
223#define FUSE_ASYNC_READ (1 << 0) 227#define FUSE_ASYNC_READ (1 << 0)
224#define FUSE_POSIX_LOCKS (1 << 1) 228#define FUSE_POSIX_LOCKS (1 << 1)
@@ -236,6 +240,7 @@ struct fuse_file_lock {
236#define FUSE_DO_READDIRPLUS (1 << 13) 240#define FUSE_DO_READDIRPLUS (1 << 13)
237#define FUSE_READDIRPLUS_AUTO (1 << 14) 241#define FUSE_READDIRPLUS_AUTO (1 << 14)
238#define FUSE_ASYNC_DIO (1 << 15) 242#define FUSE_ASYNC_DIO (1 << 15)
243#define FUSE_WRITEBACK_CACHE (1 << 16)
239 244
240/** 245/**
241 * CUSE INIT request/reply flags 246 * CUSE INIT request/reply flags
diff --git a/include/uapi/linux/gfs2_ondisk.h b/include/uapi/linux/gfs2_ondisk.h
index 0f24c07aed51..db3fdd083882 100644
--- a/include/uapi/linux/gfs2_ondisk.h
+++ b/include/uapi/linux/gfs2_ondisk.h
@@ -304,7 +304,13 @@ struct gfs2_dirent {
304 __be16 de_rec_len; 304 __be16 de_rec_len;
305 __be16 de_name_len; 305 __be16 de_name_len;
306 __be16 de_type; 306 __be16 de_type;
307 __u8 __pad[14]; 307 union {
308 __u8 __pad[14];
309 struct {
310 __be16 de_rahead;
311 __u8 pad2[12];
312 };
313 };
308}; 314};
309 315
310/* 316/*
@@ -347,9 +353,9 @@ struct gfs2_leaf {
347 * metadata header. Each inode, if it has extended attributes, will 353 * metadata header. Each inode, if it has extended attributes, will
348 * have either a single block containing the extended attribute headers 354 * have either a single block containing the extended attribute headers
349 * or a single indirect block pointing to blocks containing the 355 * or a single indirect block pointing to blocks containing the
350 * extended attribure headers. 356 * extended attribute headers.
351 * 357 *
352 * The maximim size of the data part of an extended attribute is 64k 358 * The maximum size of the data part of an extended attribute is 64k
353 * so the number of blocks required depends upon block size. Since the 359 * so the number of blocks required depends upon block size. Since the
354 * block size also determines the number of pointers in an indirect 360 * block size also determines the number of pointers in an indirect
355 * block, its a fairly complicated calculation to work out the maximum 361 * block, its a fairly complicated calculation to work out the maximum
diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
new file mode 100644
index 000000000000..9beb7c991638
--- /dev/null
+++ b/include/uapi/linux/hyperv.h
@@ -0,0 +1,390 @@
1/*
2 *
3 * Copyright (c) 2011, Microsoft 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., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * Authors:
19 * Haiyang Zhang <haiyangz@microsoft.com>
20 * Hank Janssen <hjanssen@microsoft.com>
21 * K. Y. Srinivasan <kys@microsoft.com>
22 *
23 */
24
25#ifndef _UAPI_HYPERV_H
26#define _UAPI_HYPERV_H
27
28#include <linux/uuid.h>
29
30/*
31 * Framework version for util services.
32 */
33#define UTIL_FW_MINOR 0
34
35#define UTIL_WS2K8_FW_MAJOR 1
36#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
37
38#define UTIL_FW_MAJOR 3
39#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
40
41
42/*
43 * Implementation of host controlled snapshot of the guest.
44 */
45
46#define VSS_OP_REGISTER 128
47
48enum hv_vss_op {
49 VSS_OP_CREATE = 0,
50 VSS_OP_DELETE,
51 VSS_OP_HOT_BACKUP,
52 VSS_OP_GET_DM_INFO,
53 VSS_OP_BU_COMPLETE,
54 /*
55 * Following operations are only supported with IC version >= 5.0
56 */
57 VSS_OP_FREEZE, /* Freeze the file systems in the VM */
58 VSS_OP_THAW, /* Unfreeze the file systems */
59 VSS_OP_AUTO_RECOVER,
60 VSS_OP_COUNT /* Number of operations, must be last */
61};
62
63
64/*
65 * Header for all VSS messages.
66 */
67struct hv_vss_hdr {
68 __u8 operation;
69 __u8 reserved[7];
70} __attribute__((packed));
71
72
73/*
74 * Flag values for the hv_vss_check_feature. Linux supports only
75 * one value.
76 */
77#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
78
79struct hv_vss_check_feature {
80 __u32 flags;
81} __attribute__((packed));
82
83struct hv_vss_check_dm_info {
84 __u32 flags;
85} __attribute__((packed));
86
87struct hv_vss_msg {
88 union {
89 struct hv_vss_hdr vss_hdr;
90 int error;
91 };
92 union {
93 struct hv_vss_check_feature vss_cf;
94 struct hv_vss_check_dm_info dm_info;
95 };
96} __attribute__((packed));
97
98/*
99 * Implementation of a host to guest copy facility.
100 */
101
102#define FCOPY_VERSION_0 0
103#define FCOPY_CURRENT_VERSION FCOPY_VERSION_0
104#define W_MAX_PATH 260
105
106enum hv_fcopy_op {
107 START_FILE_COPY = 0,
108 WRITE_TO_FILE,
109 COMPLETE_FCOPY,
110 CANCEL_FCOPY,
111};
112
113struct hv_fcopy_hdr {
114 __u32 operation;
115 uuid_le service_id0; /* currently unused */
116 uuid_le service_id1; /* currently unused */
117} __attribute__((packed));
118
119#define OVER_WRITE 0x1
120#define CREATE_PATH 0x2
121
122struct hv_start_fcopy {
123 struct hv_fcopy_hdr hdr;
124 __u16 file_name[W_MAX_PATH];
125 __u16 path_name[W_MAX_PATH];
126 __u32 copy_flags;
127 __u64 file_size;
128} __attribute__((packed));
129
130/*
131 * The file is chunked into fragments.
132 */
133#define DATA_FRAGMENT (6 * 1024)
134
135struct hv_do_fcopy {
136 struct hv_fcopy_hdr hdr;
137 __u64 offset;
138 __u32 size;
139 __u8 data[DATA_FRAGMENT];
140};
141
142/*
143 * An implementation of HyperV key value pair (KVP) functionality for Linux.
144 *
145 *
146 * Copyright (C) 2010, Novell, Inc.
147 * Author : K. Y. Srinivasan <ksrinivasan@novell.com>
148 *
149 */
150
151/*
152 * Maximum value size - used for both key names and value data, and includes
153 * any applicable NULL terminators.
154 *
155 * Note: This limit is somewhat arbitrary, but falls easily within what is
156 * supported for all native guests (back to Win 2000) and what is reasonable
157 * for the IC KVP exchange functionality. Note that Windows Me/98/95 are
158 * limited to 255 character key names.
159 *
160 * MSDN recommends not storing data values larger than 2048 bytes in the
161 * registry.
162 *
163 * Note: This value is used in defining the KVP exchange message - this value
164 * cannot be modified without affecting the message size and compatibility.
165 */
166
167/*
168 * bytes, including any null terminators
169 */
170#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
171
172
173/*
174 * Maximum key size - the registry limit for the length of an entry name
175 * is 256 characters, including the null terminator
176 */
177
178#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
179
180/*
181 * In Linux, we implement the KVP functionality in two components:
182 * 1) The kernel component which is packaged as part of the hv_utils driver
183 * is responsible for communicating with the host and responsible for
184 * implementing the host/guest protocol. 2) A user level daemon that is
185 * responsible for data gathering.
186 *
187 * Host/Guest Protocol: The host iterates over an index and expects the guest
188 * to assign a key name to the index and also return the value corresponding to
189 * the key. The host will have atmost one KVP transaction outstanding at any
190 * given point in time. The host side iteration stops when the guest returns
191 * an error. Microsoft has specified the following mapping of key names to
192 * host specified index:
193 *
194 * Index Key Name
195 * 0 FullyQualifiedDomainName
196 * 1 IntegrationServicesVersion
197 * 2 NetworkAddressIPv4
198 * 3 NetworkAddressIPv6
199 * 4 OSBuildNumber
200 * 5 OSName
201 * 6 OSMajorVersion
202 * 7 OSMinorVersion
203 * 8 OSVersion
204 * 9 ProcessorArchitecture
205 *
206 * The Windows host expects the Key Name and Key Value to be encoded in utf16.
207 *
208 * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
209 * data gathering functionality in a user mode daemon. The user level daemon
210 * is also responsible for binding the key name to the index as well. The
211 * kernel and user-level daemon communicate using a connector channel.
212 *
213 * The user mode component first registers with the
214 * the kernel component. Subsequently, the kernel component requests, data
215 * for the specified keys. In response to this message the user mode component
216 * fills in the value corresponding to the specified key. We overload the
217 * sequence field in the cn_msg header to define our KVP message types.
218 *
219 *
220 * The kernel component simply acts as a conduit for communication between the
221 * Windows host and the user-level daemon. The kernel component passes up the
222 * index received from the Host to the user-level daemon. If the index is
223 * valid (supported), the corresponding key as well as its
224 * value (both are strings) is returned. If the index is invalid
225 * (not supported), a NULL key string is returned.
226 */
227
228
229/*
230 * Registry value types.
231 */
232
233#define REG_SZ 1
234#define REG_U32 4
235#define REG_U64 8
236
237/*
238 * As we look at expanding the KVP functionality to include
239 * IP injection functionality, we need to maintain binary
240 * compatibility with older daemons.
241 *
242 * The KVP opcodes are defined by the host and it was unfortunate
243 * that I chose to treat the registration operation as part of the
244 * KVP operations defined by the host.
245 * Here is the level of compatibility
246 * (between the user level daemon and the kernel KVP driver) that we
247 * will implement:
248 *
249 * An older daemon will always be supported on a newer driver.
250 * A given user level daemon will require a minimal version of the
251 * kernel driver.
252 * If we cannot handle the version differences, we will fail gracefully
253 * (this can happen when we have a user level daemon that is more
254 * advanced than the KVP driver.
255 *
256 * We will use values used in this handshake for determining if we have
257 * workable user level daemon and the kernel driver. We begin by taking the
258 * registration opcode out of the KVP opcode namespace. We will however,
259 * maintain compatibility with the existing user-level daemon code.
260 */
261
262/*
263 * Daemon code not supporting IP injection (legacy daemon).
264 */
265
266#define KVP_OP_REGISTER 4
267
268/*
269 * Daemon code supporting IP injection.
270 * The KVP opcode field is used to communicate the
271 * registration information; so define a namespace that
272 * will be distinct from the host defined KVP opcode.
273 */
274
275#define KVP_OP_REGISTER1 100
276
277enum hv_kvp_exchg_op {
278 KVP_OP_GET = 0,
279 KVP_OP_SET,
280 KVP_OP_DELETE,
281 KVP_OP_ENUMERATE,
282 KVP_OP_GET_IP_INFO,
283 KVP_OP_SET_IP_INFO,
284 KVP_OP_COUNT /* Number of operations, must be last. */
285};
286
287enum hv_kvp_exchg_pool {
288 KVP_POOL_EXTERNAL = 0,
289 KVP_POOL_GUEST,
290 KVP_POOL_AUTO,
291 KVP_POOL_AUTO_EXTERNAL,
292 KVP_POOL_AUTO_INTERNAL,
293 KVP_POOL_COUNT /* Number of pools, must be last. */
294};
295
296/*
297 * Some Hyper-V status codes.
298 */
299
300#define HV_S_OK 0x00000000
301#define HV_E_FAIL 0x80004005
302#define HV_S_CONT 0x80070103
303#define HV_ERROR_NOT_SUPPORTED 0x80070032
304#define HV_ERROR_MACHINE_LOCKED 0x800704F7
305#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
306#define HV_INVALIDARG 0x80070057
307#define HV_GUID_NOTFOUND 0x80041002
308
309#define ADDR_FAMILY_NONE 0x00
310#define ADDR_FAMILY_IPV4 0x01
311#define ADDR_FAMILY_IPV6 0x02
312
313#define MAX_ADAPTER_ID_SIZE 128
314#define MAX_IP_ADDR_SIZE 1024
315#define MAX_GATEWAY_SIZE 512
316
317
318struct hv_kvp_ipaddr_value {
319 __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
320 __u8 addr_family;
321 __u8 dhcp_enabled;
322 __u16 ip_addr[MAX_IP_ADDR_SIZE];
323 __u16 sub_net[MAX_IP_ADDR_SIZE];
324 __u16 gate_way[MAX_GATEWAY_SIZE];
325 __u16 dns_addr[MAX_IP_ADDR_SIZE];
326} __attribute__((packed));
327
328
329struct hv_kvp_hdr {
330 __u8 operation;
331 __u8 pool;
332 __u16 pad;
333} __attribute__((packed));
334
335struct hv_kvp_exchg_msg_value {
336 __u32 value_type;
337 __u32 key_size;
338 __u32 value_size;
339 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
340 union {
341 __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
342 __u32 value_u32;
343 __u64 value_u64;
344 };
345} __attribute__((packed));
346
347struct hv_kvp_msg_enumerate {
348 __u32 index;
349 struct hv_kvp_exchg_msg_value data;
350} __attribute__((packed));
351
352struct hv_kvp_msg_get {
353 struct hv_kvp_exchg_msg_value data;
354};
355
356struct hv_kvp_msg_set {
357 struct hv_kvp_exchg_msg_value data;
358};
359
360struct hv_kvp_msg_delete {
361 __u32 key_size;
362 __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
363};
364
365struct hv_kvp_register {
366 __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
367};
368
369struct hv_kvp_msg {
370 union {
371 struct hv_kvp_hdr kvp_hdr;
372 int error;
373 };
374 union {
375 struct hv_kvp_msg_get kvp_get;
376 struct hv_kvp_msg_set kvp_set;
377 struct hv_kvp_msg_delete kvp_delete;
378 struct hv_kvp_msg_enumerate kvp_enum_data;
379 struct hv_kvp_ipaddr_value kvp_ip_val;
380 struct hv_kvp_register kvp_register;
381 } body;
382} __attribute__((packed));
383
384struct hv_kvp_ip_msg {
385 __u8 operation;
386 __u8 pool;
387 struct hv_kvp_ipaddr_value kvp_ip_val;
388} __attribute__((packed));
389
390#endif /* _UAPI_HYPERV_H */
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index d758163b0e43..9cf2394f0bcf 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -27,65 +27,91 @@
27#define IFALIASZ 256 27#define IFALIASZ 256
28#include <linux/hdlc/ioctl.h> 28#include <linux/hdlc/ioctl.h>
29 29
30/* Standard interface flags (netdevice->flags). */ 30/**
31#define IFF_UP 0x1 /* interface is up */ 31 * enum net_device_flags - &struct net_device flags
32#define IFF_BROADCAST 0x2 /* broadcast address valid */ 32 *
33#define IFF_DEBUG 0x4 /* turn on debugging */ 33 * These are the &struct net_device flags, they can be set by drivers, the
34#define IFF_LOOPBACK 0x8 /* is a loopback net */ 34 * kernel and some can be triggered by userspace. Userspace can query and
35#define IFF_POINTOPOINT 0x10 /* interface is has p-p link */ 35 * set these flags using userspace utilities but there is also a sysfs
36#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 36 * entry available for all dev flags which can be queried and set. These flags
37#define IFF_RUNNING 0x40 /* interface RFC2863 OPER_UP */ 37 * are shared for all types of net_devices. The sysfs entries are available
38#define IFF_NOARP 0x80 /* no ARP protocol */ 38 * via /sys/class/net/<dev>/flags. Flags which can be toggled through sysfs
39#define IFF_PROMISC 0x100 /* receive all packets */ 39 * are annotated below, note that only a few flags can be toggled and some
40#define IFF_ALLMULTI 0x200 /* receive all multicast packets*/ 40 * other flags are always always preserved from the original net_device flags
41 41 * even if you try to set them via sysfs. Flags which are always preserved
42#define IFF_MASTER 0x400 /* master of a load balancer */ 42 * are kept under the flag grouping @IFF_VOLATILE. Flags which are volatile
43#define IFF_SLAVE 0x800 /* slave of a load balancer */ 43 * are annotated below as such.
44 44 *
45#define IFF_MULTICAST 0x1000 /* Supports multicast */ 45 * You should have a pretty good reason to be extending these flags.
46 46 *
47#define IFF_PORTSEL 0x2000 /* can set media type */ 47 * @IFF_UP: interface is up. Can be toggled through sysfs.
48#define IFF_AUTOMEDIA 0x4000 /* auto media select active */ 48 * @IFF_BROADCAST: broadcast address valid. Volatile.
49#define IFF_DYNAMIC 0x8000 /* dialup device with changing addresses*/ 49 * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs.
50 50 * @IFF_LOOPBACK: is a loopback net. Volatile.
51#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ 51 * @IFF_POINTOPOINT: interface is has p-p link. Volatile.
52#define IFF_DORMANT 0x20000 /* driver signals dormant */ 52 * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs.
53 * Volatile.
54 * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile.
55 * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile.
56 * @IFF_PROMISC: receive all packets. Can be toggled through sysfs.
57 * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through
58 * sysfs.
59 * @IFF_MASTER: master of a load balancer. Volatile.
60 * @IFF_SLAVE: slave of a load balancer. Volatile.
61 * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs.
62 * @IFF_PORTSEL: can set media type. Can be toggled through sysfs.
63 * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs.
64 * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled
65 * through sysfs.
66 * @IFF_LOWER_UP: driver signals L1 up. Volatile.
67 * @IFF_DORMANT: driver signals dormant. Volatile.
68 * @IFF_ECHO: echo sent packets. Volatile.
69 */
70enum net_device_flags {
71 IFF_UP = 1<<0, /* sysfs */
72 IFF_BROADCAST = 1<<1, /* volatile */
73 IFF_DEBUG = 1<<2, /* sysfs */
74 IFF_LOOPBACK = 1<<3, /* volatile */
75 IFF_POINTOPOINT = 1<<4, /* volatile */
76 IFF_NOTRAILERS = 1<<5, /* sysfs */
77 IFF_RUNNING = 1<<6, /* volatile */
78 IFF_NOARP = 1<<7, /* sysfs */
79 IFF_PROMISC = 1<<8, /* sysfs */
80 IFF_ALLMULTI = 1<<9, /* sysfs */
81 IFF_MASTER = 1<<10, /* volatile */
82 IFF_SLAVE = 1<<11, /* volatile */
83 IFF_MULTICAST = 1<<12, /* sysfs */
84 IFF_PORTSEL = 1<<13, /* sysfs */
85 IFF_AUTOMEDIA = 1<<14, /* sysfs */
86 IFF_DYNAMIC = 1<<15, /* sysfs */
87 IFF_LOWER_UP = 1<<16, /* volatile */
88 IFF_DORMANT = 1<<17, /* volatile */
89 IFF_ECHO = 1<<18, /* volatile */
90};
53 91
54#define IFF_ECHO 0x40000 /* echo sent packets */ 92#define IFF_UP IFF_UP
93#define IFF_BROADCAST IFF_BROADCAST
94#define IFF_DEBUG IFF_DEBUG
95#define IFF_LOOPBACK IFF_LOOPBACK
96#define IFF_POINTOPOINT IFF_POINTOPOINT
97#define IFF_NOTRAILERS IFF_NOTRAILERS
98#define IFF_RUNNING IFF_RUNNING
99#define IFF_NOARP IFF_NOARP
100#define IFF_PROMISC IFF_PROMISC
101#define IFF_ALLMULTI IFF_ALLMULTI
102#define IFF_MASTER IFF_MASTER
103#define IFF_SLAVE IFF_SLAVE
104#define IFF_MULTICAST IFF_MULTICAST
105#define IFF_PORTSEL IFF_PORTSEL
106#define IFF_AUTOMEDIA IFF_AUTOMEDIA
107#define IFF_DYNAMIC IFF_DYNAMIC
108#define IFF_LOWER_UP IFF_LOWER_UP
109#define IFF_DORMANT IFF_DORMANT
110#define IFF_ECHO IFF_ECHO
55 111
56#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ 112#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
57 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) 113 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
58 114
59/* Private (from user) interface flags (netdevice->priv_flags). */
60#define IFF_802_1Q_VLAN 0x1 /* 802.1Q VLAN device. */
61#define IFF_EBRIDGE 0x2 /* Ethernet bridging device. */
62#define IFF_SLAVE_INACTIVE 0x4 /* bonding slave not the curr. active */
63#define IFF_MASTER_8023AD 0x8 /* bonding master, 802.3ad. */
64#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
69#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
70#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
71 * release skb->dst
72 */
73#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */
74#define IFF_DISABLE_NETPOLL 0x1000 /* disable netpoll at run-time */
75#define IFF_MACVLAN_PORT 0x2000 /* device used as macvlan port */
76#define IFF_BRIDGE_PORT 0x4000 /* device used as bridge port */
77#define IFF_OVS_DATAPATH 0x8000 /* device used as Open vSwitch
78 * datapath port */
79#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing
80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84#define IFF_LIVE_ADDR_CHANGE 0x100000 /* device supports hardware address
85 * change when it's running */
86#define IFF_MACVLAN 0x200000 /* Macvlan device */
87
88
89#define IF_GET_IFACE 0x0001 /* for querying only */ 115#define IF_GET_IFACE 0x0001 /* for querying only */
90#define IF_GET_PROTO 0x0002 116#define IF_GET_PROTO 0x0002
91 117
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
index 2ce0f6a78fa5..0f8210b8e0bc 100644
--- a/include/uapi/linux/if_ether.h
+++ b/include/uapi/linux/if_ether.h
@@ -68,11 +68,11 @@
68#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ 68#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
69#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol 69#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
70 * defined in draft-wilson-wrec-wccp-v2-00.txt */ 70 * defined in draft-wilson-wrec-wccp-v2-00.txt */
71#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
72#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
73#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ 71#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
74#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ 72#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
75#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ 73#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
74#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
75#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
76#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ 76#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
77#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport 77#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
78 * over Ethernet 78 * over Ethernet
@@ -89,6 +89,8 @@
89#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ 89#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
90#define ETH_P_TDLS 0x890D /* TDLS */ 90#define ETH_P_TDLS 0x890D /* TDLS */
91#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ 91#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
92#define ETH_P_80221 0x8917 /* IEEE 802.21 Media Independent Handover Protocol */
93#define ETH_P_LOOPBACK 0x9000 /* Ethernet loopback packet, per IEEE 802.3 */
92#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 94#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
93#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 95#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
94#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */ 96#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index 16410b6e7819..9a7f7ace6649 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -144,6 +144,7 @@ enum {
144 IFLA_NUM_RX_QUEUES, 144 IFLA_NUM_RX_QUEUES,
145 IFLA_CARRIER, 145 IFLA_CARRIER,
146 IFLA_PHYS_PORT_ID, 146 IFLA_PHYS_PORT_ID,
147 IFLA_CARRIER_CHANGES,
147 __IFLA_MAX 148 __IFLA_MAX
148}; 149};
149 150
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 393c5de09d42..c33a65e3d62c 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -120,6 +120,10 @@ struct in_addr {
120 * this socket to prevent accepting spoofed ones. 120 * this socket to prevent accepting spoofed ones.
121 */ 121 */
122#define IP_PMTUDISC_INTERFACE 4 122#define IP_PMTUDISC_INTERFACE 4
123/* weaker version of IP_PMTUDISC_INTERFACE, which allos packets to get
124 * fragmented if they exeed the interface mtu
125 */
126#define IP_PMTUDISC_OMIT 5
123 127
124#define IP_MULTICAST_IF 32 128#define IP_MULTICAST_IF 32
125#define IP_MULTICAST_TTL 33 129#define IP_MULTICAST_TTL 33
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index e9a1d2d973b6..0d8e0f0342dc 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -185,6 +185,10 @@ struct in6_flowlabel_req {
185 * also see comments on IP_PMTUDISC_INTERFACE 185 * also see comments on IP_PMTUDISC_INTERFACE
186 */ 186 */
187#define IPV6_PMTUDISC_INTERFACE 4 187#define IPV6_PMTUDISC_INTERFACE 4
188/* weaker version of IPV6_PMTUDISC_INTERFACE, which allows packets to
189 * get fragmented if they exceed the interface mtu
190 */
191#define IPV6_PMTUDISC_OMIT 5
188 192
189/* Flowlabel */ 193/* Flowlabel */
190#define IPV6_FLOWLABEL_MGR 32 194#define IPV6_FLOWLABEL_MGR 32
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 932d7f2637d6..a8f4ee5d2e82 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -413,6 +413,8 @@ struct kvm_s390_psw {
413#define KVM_S390_PROGRAM_INT 0xfffe0001u 413#define KVM_S390_PROGRAM_INT 0xfffe0001u
414#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u 414#define KVM_S390_SIGP_SET_PREFIX 0xfffe0002u
415#define KVM_S390_RESTART 0xfffe0003u 415#define KVM_S390_RESTART 0xfffe0003u
416#define KVM_S390_INT_PFAULT_INIT 0xfffe0004u
417#define KVM_S390_INT_PFAULT_DONE 0xfffe0005u
416#define KVM_S390_MCHK 0xfffe1000u 418#define KVM_S390_MCHK 0xfffe1000u
417#define KVM_S390_INT_VIRTIO 0xffff2603u 419#define KVM_S390_INT_VIRTIO 0xffff2603u
418#define KVM_S390_INT_SERVICE 0xffff2401u 420#define KVM_S390_INT_SERVICE 0xffff2401u
@@ -434,6 +436,69 @@ struct kvm_s390_interrupt {
434 __u64 parm64; 436 __u64 parm64;
435}; 437};
436 438
439struct kvm_s390_io_info {
440 __u16 subchannel_id;
441 __u16 subchannel_nr;
442 __u32 io_int_parm;
443 __u32 io_int_word;
444};
445
446struct kvm_s390_ext_info {
447 __u32 ext_params;
448 __u32 pad;
449 __u64 ext_params2;
450};
451
452struct kvm_s390_pgm_info {
453 __u64 trans_exc_code;
454 __u64 mon_code;
455 __u64 per_address;
456 __u32 data_exc_code;
457 __u16 code;
458 __u16 mon_class_nr;
459 __u8 per_code;
460 __u8 per_atmid;
461 __u8 exc_access_id;
462 __u8 per_access_id;
463 __u8 op_access_id;
464 __u8 pad[3];
465};
466
467struct kvm_s390_prefix_info {
468 __u32 address;
469};
470
471struct kvm_s390_extcall_info {
472 __u16 code;
473};
474
475struct kvm_s390_emerg_info {
476 __u16 code;
477};
478
479struct kvm_s390_mchk_info {
480 __u64 cr14;
481 __u64 mcic;
482 __u64 failing_storage_address;
483 __u32 ext_damage_code;
484 __u32 pad;
485 __u8 fixed_logout[16];
486};
487
488struct kvm_s390_irq {
489 __u64 type;
490 union {
491 struct kvm_s390_io_info io;
492 struct kvm_s390_ext_info ext;
493 struct kvm_s390_pgm_info pgm;
494 struct kvm_s390_emerg_info emerg;
495 struct kvm_s390_extcall_info extcall;
496 struct kvm_s390_prefix_info prefix;
497 struct kvm_s390_mchk_info mchk;
498 char reserved[64];
499 } u;
500};
501
437/* for KVM_SET_GUEST_DEBUG */ 502/* for KVM_SET_GUEST_DEBUG */
438 503
439#define KVM_GUESTDBG_ENABLE 0x00000001 504#define KVM_GUESTDBG_ENABLE 0x00000001
@@ -675,6 +740,9 @@ struct kvm_ppc_smmu_info {
675#define KVM_CAP_SPAPR_MULTITCE 94 740#define KVM_CAP_SPAPR_MULTITCE 94
676#define KVM_CAP_EXT_EMUL_CPUID 95 741#define KVM_CAP_EXT_EMUL_CPUID 95
677#define KVM_CAP_HYPERV_TIME 96 742#define KVM_CAP_HYPERV_TIME 96
743#define KVM_CAP_IOAPIC_POLARITY_IGNORED 97
744#define KVM_CAP_ENABLE_CAP_VM 98
745#define KVM_CAP_S390_IRQCHIP 99
678 746
679#ifdef KVM_CAP_IRQ_ROUTING 747#ifdef KVM_CAP_IRQ_ROUTING
680 748
@@ -690,9 +758,18 @@ struct kvm_irq_routing_msi {
690 __u32 pad; 758 __u32 pad;
691}; 759};
692 760
761struct kvm_irq_routing_s390_adapter {
762 __u64 ind_addr;
763 __u64 summary_addr;
764 __u64 ind_offset;
765 __u32 summary_offset;
766 __u32 adapter_id;
767};
768
693/* gsi routing entry types */ 769/* gsi routing entry types */
694#define KVM_IRQ_ROUTING_IRQCHIP 1 770#define KVM_IRQ_ROUTING_IRQCHIP 1
695#define KVM_IRQ_ROUTING_MSI 2 771#define KVM_IRQ_ROUTING_MSI 2
772#define KVM_IRQ_ROUTING_S390_ADAPTER 3
696 773
697struct kvm_irq_routing_entry { 774struct kvm_irq_routing_entry {
698 __u32 gsi; 775 __u32 gsi;
@@ -702,6 +779,7 @@ struct kvm_irq_routing_entry {
702 union { 779 union {
703 struct kvm_irq_routing_irqchip irqchip; 780 struct kvm_irq_routing_irqchip irqchip;
704 struct kvm_irq_routing_msi msi; 781 struct kvm_irq_routing_msi msi;
782 struct kvm_irq_routing_s390_adapter adapter;
705 __u32 pad[8]; 783 __u32 pad[8];
706 } u; 784 } u;
707}; 785};
@@ -855,6 +933,7 @@ struct kvm_device_attr {
855#define KVM_DEV_VFIO_GROUP_ADD 1 933#define KVM_DEV_VFIO_GROUP_ADD 1
856#define KVM_DEV_VFIO_GROUP_DEL 2 934#define KVM_DEV_VFIO_GROUP_DEL 2
857#define KVM_DEV_TYPE_ARM_VGIC_V2 5 935#define KVM_DEV_TYPE_ARM_VGIC_V2 5
936#define KVM_DEV_TYPE_FLIC 6
858 937
859/* 938/*
860 * ioctls for VM fds 939 * ioctls for VM fds
@@ -1009,6 +1088,10 @@ struct kvm_s390_ucas_mapping {
1009/* Available with KVM_CAP_DEBUGREGS */ 1088/* Available with KVM_CAP_DEBUGREGS */
1010#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) 1089#define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
1011#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) 1090#define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
1091/*
1092 * vcpu version available with KVM_ENABLE_CAP
1093 * vm version available with KVM_CAP_ENABLE_CAP_VM
1094 */
1012#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) 1095#define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
1013/* Available with KVM_CAP_XSAVE */ 1096/* Available with KVM_CAP_XSAVE */
1014#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave) 1097#define KVM_GET_XSAVE _IOR(KVMIO, 0xa4, struct kvm_xsave)
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 335e8a7cad39..c140620dad92 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -85,6 +85,12 @@
85 85
86#endif /* _NETINET_IN_H */ 86#endif /* _NETINET_IN_H */
87 87
88/* Definitions for xattr.h */
89#if defined(_SYS_XATTR_H)
90#define __UAPI_DEF_XATTR 0
91#else
92#define __UAPI_DEF_XATTR 1
93#endif
88 94
89/* If we did not see any headers from any supported C libraries, 95/* If we did not see any headers from any supported C libraries,
90 * or we are being included in the kernel, then define everything 96 * or we are being included in the kernel, then define everything
@@ -98,6 +104,9 @@
98#define __UAPI_DEF_IPV6_MREQ 1 104#define __UAPI_DEF_IPV6_MREQ 1
99#define __UAPI_DEF_IPPROTO_V6 1 105#define __UAPI_DEF_IPPROTO_V6 1
100 106
107/* Definitions for xattr.h */
108#define __UAPI_DEF_XATTR 1
109
101#endif /* __GLIBC__ */ 110#endif /* __GLIBC__ */
102 111
103#endif /* _UAPI_LIBC_COMPAT_H */ 112#endif /* _UAPI_LIBC_COMPAT_H */
diff --git a/include/uapi/linux/mpls.h b/include/uapi/linux/mpls.h
new file mode 100644
index 000000000000..bc9abfe88c9a
--- /dev/null
+++ b/include/uapi/linux/mpls.h
@@ -0,0 +1,34 @@
1#ifndef _UAPI_MPLS_H
2#define _UAPI_MPLS_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7/* Reference: RFC 5462, RFC 3032
8 *
9 * 0 1 2 3
10 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
11 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
12 * | Label | TC |S| TTL |
13 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
14 *
15 * Label: Label Value, 20 bits
16 * TC: Traffic Class field, 3 bits
17 * S: Bottom of Stack, 1 bit
18 * TTL: Time to Live, 8 bits
19 */
20
21struct mpls_label {
22 __be32 entry;
23};
24
25#define MPLS_LS_LABEL_MASK 0xFFFFF000
26#define MPLS_LS_LABEL_SHIFT 12
27#define MPLS_LS_TC_MASK 0x00000E00
28#define MPLS_LS_TC_SHIFT 9
29#define MPLS_LS_S_MASK 0x00000100
30#define MPLS_LS_S_SHIFT 8
31#define MPLS_LS_TTL_MASK 0x000000FF
32#define MPLS_LS_TTL_SHIFT 0
33
34#endif /* _UAPI_MPLS_H */
diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h
index 6b9500bc2d56..fdfbd1c17065 100644
--- a/include/uapi/linux/netdevice.h
+++ b/include/uapi/linux/netdevice.h
@@ -49,5 +49,11 @@ enum {
49 IF_PORT_100BASEFX 49 IF_PORT_100BASEFX
50}; 50};
51 51
52/* hardware address assignment types */
53#define NET_ADDR_PERM 0 /* address is permanent (default) */
54#define NET_ADDR_RANDOM 1 /* address is generated randomly */
55#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
56#define NET_ADDR_SET 3 /* address is set using
57 * dev_set_mac_address() */
52 58
53#endif /* _UAPI_LINUX_NETDEVICE_H */ 59#endif /* _UAPI_LINUX_NETDEVICE_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
index 25d3b2f79c02..78c2f2e79920 100644
--- a/include/uapi/linux/netfilter/ipset/ip_set.h
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -82,6 +82,8 @@ enum {
82 IPSET_ATTR_PROTO, /* 7 */ 82 IPSET_ATTR_PROTO, /* 7 */
83 IPSET_ATTR_CADT_FLAGS, /* 8 */ 83 IPSET_ATTR_CADT_FLAGS, /* 8 */
84 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */ 84 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
85 IPSET_ATTR_MARK, /* 10 */
86 IPSET_ATTR_MARKMASK, /* 11 */
85 /* Reserve empty slots */ 87 /* Reserve empty slots */
86 IPSET_ATTR_CADT_MAX = 16, 88 IPSET_ATTR_CADT_MAX = 16,
87 /* Create-only specific attributes */ 89 /* Create-only specific attributes */
@@ -144,6 +146,7 @@ enum ipset_errno {
144 IPSET_ERR_IPADDR_IPV6, 146 IPSET_ERR_IPADDR_IPV6,
145 IPSET_ERR_COUNTER, 147 IPSET_ERR_COUNTER,
146 IPSET_ERR_COMMENT, 148 IPSET_ERR_COMMENT,
149 IPSET_ERR_INVALID_MARKMASK,
147 150
148 /* Type specific error codes */ 151 /* Type specific error codes */
149 IPSET_ERR_TYPE_SPECIFIC = 4352, 152 IPSET_ERR_TYPE_SPECIFIC = 4352,
@@ -182,9 +185,18 @@ enum ipset_cadt_flags {
182 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), 185 IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS),
183 IPSET_FLAG_BIT_WITH_COMMENT = 4, 186 IPSET_FLAG_BIT_WITH_COMMENT = 4,
184 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT), 187 IPSET_FLAG_WITH_COMMENT = (1 << IPSET_FLAG_BIT_WITH_COMMENT),
188 IPSET_FLAG_BIT_WITH_FORCEADD = 5,
189 IPSET_FLAG_WITH_FORCEADD = (1 << IPSET_FLAG_BIT_WITH_FORCEADD),
185 IPSET_FLAG_CADT_MAX = 15, 190 IPSET_FLAG_CADT_MAX = 15,
186}; 191};
187 192
193/* The flag bits which correspond to the non-extension create flags */
194enum ipset_create_flags {
195 IPSET_CREATE_FLAG_BIT_FORCEADD = 0,
196 IPSET_CREATE_FLAG_FORCEADD = (1 << IPSET_CREATE_FLAG_BIT_FORCEADD),
197 IPSET_CREATE_FLAG_BIT_MAX = 7,
198};
199
188/* Commands with settype-specific attributes */ 200/* Commands with settype-specific attributes */
189enum ipset_adt { 201enum ipset_adt {
190 IPSET_ADD, 202 IPSET_ADD,
diff --git a/include/uapi/linux/netfilter/nf_tables.h b/include/uapi/linux/netfilter/nf_tables.h
index 83c985a6170b..c88ccbfda5f1 100644
--- a/include/uapi/linux/netfilter/nf_tables.h
+++ b/include/uapi/linux/netfilter/nf_tables.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_NF_TABLES_H 1#ifndef _LINUX_NF_TABLES_H
2#define _LINUX_NF_TABLES_H 2#define _LINUX_NF_TABLES_H
3 3
4#define NFT_CHAIN_MAXNAMELEN 32 4#define NFT_CHAIN_MAXNAMELEN 32
5#define NFT_USERDATA_MAXLEN 256
5 6
6enum nft_registers { 7enum nft_registers {
7 NFT_REG_VERDICT, 8 NFT_REG_VERDICT,
@@ -156,6 +157,7 @@ enum nft_chain_attributes {
156 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes) 157 * @NFTA_RULE_EXPRESSIONS: list of expressions (NLA_NESTED: nft_expr_attributes)
157 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes) 158 * @NFTA_RULE_COMPAT: compatibility specifications of the rule (NLA_NESTED: nft_rule_compat_attributes)
158 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64) 159 * @NFTA_RULE_POSITION: numeric handle of the previous rule (NLA_U64)
160 * @NFTA_RULE_USERDATA: user data (NLA_BINARY, NFT_USERDATA_MAXLEN)
159 */ 161 */
160enum nft_rule_attributes { 162enum nft_rule_attributes {
161 NFTA_RULE_UNSPEC, 163 NFTA_RULE_UNSPEC,
@@ -165,6 +167,7 @@ enum nft_rule_attributes {
165 NFTA_RULE_EXPRESSIONS, 167 NFTA_RULE_EXPRESSIONS,
166 NFTA_RULE_COMPAT, 168 NFTA_RULE_COMPAT,
167 NFTA_RULE_POSITION, 169 NFTA_RULE_POSITION,
170 NFTA_RULE_USERDATA,
168 __NFTA_RULE_MAX 171 __NFTA_RULE_MAX
169}; 172};
170#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1) 173#define NFTA_RULE_MAX (__NFTA_RULE_MAX - 1)
@@ -601,6 +604,7 @@ enum nft_ct_keys {
601 NFT_CT_PROTOCOL, 604 NFT_CT_PROTOCOL,
602 NFT_CT_PROTO_SRC, 605 NFT_CT_PROTO_SRC,
603 NFT_CT_PROTO_DST, 606 NFT_CT_PROTO_DST,
607 NFT_CT_LABELS,
604}; 608};
605 609
606/** 610/**
diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h
index 6ad6cc03ccd3..9789dc95b6a8 100644
--- a/include/uapi/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
@@ -150,6 +150,8 @@ enum nfc_commands {
150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED) 150 * @NFC_ATTR_SE_TYPE: Secure element type (UICC or EMBEDDED)
151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status 151 * @NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS: Firmware download operation status
152 * @NFC_ATTR_APDU: Secure element APDU 152 * @NFC_ATTR_APDU: Secure element APDU
153 * @NFC_ATTR_TARGET_ISO15693_DSFID: ISO 15693 Data Storage Format Identifier
154 * @NFC_ATTR_TARGET_ISO15693_UID: ISO 15693 Unique Identifier
153 */ 155 */
154enum nfc_attrs { 156enum nfc_attrs {
155 NFC_ATTR_UNSPEC, 157 NFC_ATTR_UNSPEC,
@@ -178,6 +180,8 @@ enum nfc_attrs {
178 NFC_ATTR_SE_AID, 180 NFC_ATTR_SE_AID,
179 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS, 181 NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS,
180 NFC_ATTR_SE_APDU, 182 NFC_ATTR_SE_APDU,
183 NFC_ATTR_TARGET_ISO15693_DSFID,
184 NFC_ATTR_TARGET_ISO15693_UID,
181/* private: internal use only */ 185/* private: internal use only */
182 __NFC_ATTR_AFTER_LAST 186 __NFC_ATTR_AFTER_LAST
183}; 187};
@@ -200,6 +204,7 @@ enum nfc_sdp_attr {
200#define NFC_SENSF_RES_MAXSIZE 18 204#define NFC_SENSF_RES_MAXSIZE 18
201#define NFC_GB_MAXSIZE 48 205#define NFC_GB_MAXSIZE 48
202#define NFC_FIRMWARE_NAME_MAXSIZE 32 206#define NFC_FIRMWARE_NAME_MAXSIZE 32
207#define NFC_ISO15693_UID_MAXSIZE 8
203 208
204/* NFC protocols */ 209/* NFC protocols */
205#define NFC_PROTO_JEWEL 1 210#define NFC_PROTO_JEWEL 1
@@ -208,8 +213,9 @@ enum nfc_sdp_attr {
208#define NFC_PROTO_ISO14443 4 213#define NFC_PROTO_ISO14443 4
209#define NFC_PROTO_NFC_DEP 5 214#define NFC_PROTO_NFC_DEP 5
210#define NFC_PROTO_ISO14443_B 6 215#define NFC_PROTO_ISO14443_B 6
216#define NFC_PROTO_ISO15693 7
211 217
212#define NFC_PROTO_MAX 7 218#define NFC_PROTO_MAX 8
213 219
214/* NFC communication modes */ 220/* NFC communication modes */
215#define NFC_COMM_ACTIVE 0 221#define NFC_COMM_ACTIVE 0
@@ -227,6 +233,7 @@ enum nfc_sdp_attr {
227#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) 233#define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443)
228#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) 234#define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP)
229#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B) 235#define NFC_PROTO_ISO14443_B_MASK (1 << NFC_PROTO_ISO14443_B)
236#define NFC_PROTO_ISO15693_MASK (1 << NFC_PROTO_ISO15693)
230 237
231/* NFC Secure Elements */ 238/* NFC Secure Elements */
232#define NFC_SE_UICC 0x1 239#define NFC_SE_UICC 0x1
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 91054fd660e0..1ba9d626aa83 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -303,8 +303,9 @@
303 * passed, all channels allowed for the current regulatory domain 303 * passed, all channels allowed for the current regulatory domain
304 * are used. Extra IEs can also be passed from the userspace by 304 * are used. Extra IEs can also be passed from the userspace by
305 * using the %NL80211_ATTR_IE attribute. 305 * using the %NL80211_ATTR_IE attribute.
306 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT 306 * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
307 * if scheduled scan is not running. 307 * scheduled scan is not running. The caller may assume that as soon
308 * as the call returns, it is safe to start a new scheduled scan again.
308 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan 309 * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
309 * results available. 310 * results available.
310 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has 311 * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
@@ -418,8 +419,18 @@
418 * %NL80211_ATTR_SSID attribute, and can optionally specify the association 419 * %NL80211_ATTR_SSID attribute, and can optionally specify the association
419 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP, 420 * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
420 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, 421 * %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
421 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and 422 * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
422 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. 423 * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, %NL80211_ATTR_MAC_HINT, and
424 * %NL80211_ATTR_WIPHY_FREQ_HINT.
425 * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
426 * restrictions on BSS selection, i.e., they effectively prevent roaming
427 * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT
428 * can be included to provide a recommendation of the initial BSS while
429 * allowing the driver to roam to other BSSes within the ESS and also to
430 * ignore this recommendation if the indicated BSS is not ideal. Only one
431 * set of BSSID,frequency parameters is used (i.e., either the enforcing
432 * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
433 * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
423 * Background scan period can optionally be 434 * Background scan period can optionally be
424 * specified in %NL80211_ATTR_BG_SCAN_PERIOD, 435 * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
425 * if not specified default background scan configuration 436 * if not specified default background scan configuration
@@ -1555,6 +1566,19 @@ enum nl80211_commands {
1555 * data is in the format defined for the payload of the QoS Map Set element 1566 * data is in the format defined for the payload of the QoS Map Set element
1556 * in IEEE Std 802.11-2012, 8.4.2.97. 1567 * in IEEE Std 802.11-2012, 8.4.2.97.
1557 * 1568 *
1569 * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
1570 * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
1571 *
1572 * @NL80211_ATTR_MAX_AP_ASSOC_STA: Device attribute that indicates how many
1573 * associated stations are supported in AP mode (including P2P GO); u32.
1574 * Since drivers may not have a fixed limit on the maximum number (e.g.,
1575 * other concurrent operations may affect this), drivers are allowed to
1576 * advertise values that cannot always be met. In such cases, an attempt
1577 * to add a new station entry with @NL80211_CMD_NEW_STATION may fail.
1578 *
1579 * @NL80211_ATTR_TDLS_PEER_CAPABILITY: flags for TDLS peer capabilities, u32.
1580 * As specified in the &enum nl80211_tdls_peer_capability.
1581 *
1558 * @NL80211_ATTR_MAX: highest attribute number currently defined 1582 * @NL80211_ATTR_MAX: highest attribute number currently defined
1559 * @__NL80211_ATTR_AFTER_LAST: internal use 1583 * @__NL80211_ATTR_AFTER_LAST: internal use
1560 */ 1584 */
@@ -1883,6 +1907,13 @@ enum nl80211_attrs {
1883 1907
1884 NL80211_ATTR_QOS_MAP, 1908 NL80211_ATTR_QOS_MAP,
1885 1909
1910 NL80211_ATTR_MAC_HINT,
1911 NL80211_ATTR_WIPHY_FREQ_HINT,
1912
1913 NL80211_ATTR_MAX_AP_ASSOC_STA,
1914
1915 NL80211_ATTR_TDLS_PEER_CAPABILITY,
1916
1886 /* add attributes here, update the policy in nl80211.c */ 1917 /* add attributes here, update the policy in nl80211.c */
1887 1918
1888 __NL80211_ATTR_AFTER_LAST, 1919 __NL80211_ATTR_AFTER_LAST,
@@ -2304,6 +2335,7 @@ enum nl80211_band_attr {
2304 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel 2335 * @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
2305 * using this channel as the primary or any of the secondary channels 2336 * using this channel as the primary or any of the secondary channels
2306 * isn't possible 2337 * isn't possible
2338 * @NL80211_FREQUENCY_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2307 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number 2339 * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
2308 * currently defined 2340 * currently defined
2309 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use 2341 * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2322,6 +2354,7 @@ enum nl80211_frequency_attr {
2322 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS, 2354 NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
2323 NL80211_FREQUENCY_ATTR_NO_80MHZ, 2355 NL80211_FREQUENCY_ATTR_NO_80MHZ,
2324 NL80211_FREQUENCY_ATTR_NO_160MHZ, 2356 NL80211_FREQUENCY_ATTR_NO_160MHZ,
2357 NL80211_FREQUENCY_ATTR_DFS_CAC_TIME,
2325 2358
2326 /* keep last */ 2359 /* keep last */
2327 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 2360 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -2412,12 +2445,14 @@ enum nl80211_reg_type {
2412 * in KHz. This is not a center a frequency but an actual regulatory 2445 * in KHz. This is not a center a frequency but an actual regulatory
2413 * band edge. 2446 * band edge.
2414 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this 2447 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this
2415 * frequency range, in KHz. 2448 * frequency range, in KHz.
2416 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain 2449 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain
2417 * for a given frequency range. The value is in mBi (100 * dBi). 2450 * for a given frequency range. The value is in mBi (100 * dBi).
2418 * If you don't have one then don't send this. 2451 * If you don't have one then don't send this.
2419 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for 2452 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
2420 * a given frequency range. The value is in mBm (100 * dBm). 2453 * a given frequency range. The value is in mBm (100 * dBm).
2454 * @NL80211_ATTR_DFS_CAC_TIME: DFS CAC time in milliseconds.
2455 * If not present or 0 default CAC time will be used.
2421 * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number 2456 * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
2422 * currently defined 2457 * currently defined
2423 * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use 2458 * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
@@ -2433,6 +2468,8 @@ enum nl80211_reg_rule_attr {
2433 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, 2468 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
2434 NL80211_ATTR_POWER_RULE_MAX_EIRP, 2469 NL80211_ATTR_POWER_RULE_MAX_EIRP,
2435 2470
2471 NL80211_ATTR_DFS_CAC_TIME,
2472
2436 /* keep last */ 2473 /* keep last */
2437 __NL80211_REG_RULE_ATTR_AFTER_LAST, 2474 __NL80211_REG_RULE_ATTR_AFTER_LAST,
2438 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 2475 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
@@ -2442,9 +2479,15 @@ enum nl80211_reg_rule_attr {
2442 * enum nl80211_sched_scan_match_attr - scheduled scan match attributes 2479 * enum nl80211_sched_scan_match_attr - scheduled scan match attributes
2443 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved 2480 * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
2444 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, 2481 * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
2445 * only report BSS with matching SSID. 2482 * only report BSS with matching SSID.
2446 * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a 2483 * @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a
2447 * BSS in scan results. Filtering is turned off if not specified. 2484 * BSS in scan results. Filtering is turned off if not specified. Note that
2485 * if this attribute is in a match set of its own, then it is treated as
2486 * the default value for all matchsets with an SSID, rather than being a
2487 * matchset of its own without an RSSI filter. This is due to problems with
2488 * how this API was implemented in the past. Also, due to the same problem,
2489 * the only way to create a matchset with only an RSSI filter (with this
2490 * attribute) is if there's only a single matchset with the RSSI attribute.
2448 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter 2491 * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
2449 * attribute number currently defined 2492 * attribute number currently defined
2450 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use 2493 * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
@@ -2477,6 +2520,9 @@ enum nl80211_sched_scan_match_attr {
2477 * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed, 2520 * @NL80211_RRF_NO_IR: no mechanisms that initiate radiation are allowed,
2478 * this includes probe requests or modes of operation that require 2521 * this includes probe requests or modes of operation that require
2479 * beaconing. 2522 * beaconing.
2523 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
2524 * base on contiguous rules and wider channels will be allowed to cross
2525 * multiple contiguous/overlapping frequency ranges.
2480 */ 2526 */
2481enum nl80211_reg_rule_flags { 2527enum nl80211_reg_rule_flags {
2482 NL80211_RRF_NO_OFDM = 1<<0, 2528 NL80211_RRF_NO_OFDM = 1<<0,
@@ -2488,6 +2534,7 @@ enum nl80211_reg_rule_flags {
2488 NL80211_RRF_PTMP_ONLY = 1<<6, 2534 NL80211_RRF_PTMP_ONLY = 1<<6,
2489 NL80211_RRF_NO_IR = 1<<7, 2535 NL80211_RRF_NO_IR = 1<<7,
2490 __NL80211_RRF_NO_IBSS = 1<<8, 2536 __NL80211_RRF_NO_IBSS = 1<<8,
2537 NL80211_RRF_AUTO_BW = 1<<11,
2491}; 2538};
2492 2539
2493#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR 2540#define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR
@@ -3131,6 +3178,7 @@ enum nl80211_key_attributes {
3131 * in an array of MCS numbers. 3178 * in an array of MCS numbers.
3132 * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection, 3179 * @NL80211_TXRATE_VHT: VHT rates allowed for TX rate selection,
3133 * see &struct nl80211_txrate_vht 3180 * see &struct nl80211_txrate_vht
3181 * @NL80211_TXRATE_GI: configure GI, see &enum nl80211_txrate_gi
3134 * @__NL80211_TXRATE_AFTER_LAST: internal 3182 * @__NL80211_TXRATE_AFTER_LAST: internal
3135 * @NL80211_TXRATE_MAX: highest TX rate attribute 3183 * @NL80211_TXRATE_MAX: highest TX rate attribute
3136 */ 3184 */
@@ -3139,6 +3187,7 @@ enum nl80211_tx_rate_attributes {
3139 NL80211_TXRATE_LEGACY, 3187 NL80211_TXRATE_LEGACY,
3140 NL80211_TXRATE_HT, 3188 NL80211_TXRATE_HT,
3141 NL80211_TXRATE_VHT, 3189 NL80211_TXRATE_VHT,
3190 NL80211_TXRATE_GI,
3142 3191
3143 /* keep last */ 3192 /* keep last */
3144 __NL80211_TXRATE_AFTER_LAST, 3193 __NL80211_TXRATE_AFTER_LAST,
@@ -3156,6 +3205,12 @@ struct nl80211_txrate_vht {
3156 __u16 mcs[NL80211_VHT_NSS_MAX]; 3205 __u16 mcs[NL80211_VHT_NSS_MAX];
3157}; 3206};
3158 3207
3208enum nl80211_txrate_gi {
3209 NL80211_TXRATE_DEFAULT_GI,
3210 NL80211_TXRATE_FORCE_SGI,
3211 NL80211_TXRATE_FORCE_LGI,
3212};
3213
3159/** 3214/**
3160 * enum nl80211_band - Frequency band 3215 * enum nl80211_band - Frequency band
3161 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band 3216 * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
@@ -3801,11 +3856,6 @@ enum nl80211_ap_sme_features {
3801 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested 3856 * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
3802 * to work properly to suppport receiving regulatory hints from 3857 * to work properly to suppport receiving regulatory hints from
3803 * cellular base stations. 3858 * cellular base stations.
3804 * @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: If this is set, an active
3805 * P2P Device (%NL80211_IFTYPE_P2P_DEVICE) requires its own channel
3806 * in the interface combinations, even when it's only used for scan
3807 * and remain-on-channel. This could be due to, for example, the
3808 * remain-on-channel implementation requiring a channel context.
3809 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of 3859 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
3810 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station 3860 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
3811 * mode 3861 * mode
@@ -3847,7 +3897,7 @@ enum nl80211_feature_flags {
3847 NL80211_FEATURE_HT_IBSS = 1 << 1, 3897 NL80211_FEATURE_HT_IBSS = 1 << 1,
3848 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, 3898 NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
3849 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3899 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3850 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, 3900 /* bit 4 is reserved - don't use */
3851 NL80211_FEATURE_SAE = 1 << 5, 3901 NL80211_FEATURE_SAE = 1 << 5,
3852 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6, 3902 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6,
3853 NL80211_FEATURE_SCAN_FLUSH = 1 << 7, 3903 NL80211_FEATURE_SCAN_FLUSH = 1 << 7,
@@ -4037,4 +4087,20 @@ struct nl80211_vendor_cmd_info {
4037 __u32 subcmd; 4087 __u32 subcmd;
4038}; 4088};
4039 4089
4090/**
4091 * enum nl80211_tdls_peer_capability - TDLS peer flags.
4092 *
4093 * Used by tdls_mgmt() to determine which conditional elements need
4094 * to be added to TDLS Setup frames.
4095 *
4096 * @NL80211_TDLS_PEER_HT: TDLS peer is HT capable.
4097 * @NL80211_TDLS_PEER_VHT: TDLS peer is VHT capable.
4098 * @NL80211_TDLS_PEER_WMM: TDLS peer is WMM capable.
4099 */
4100enum nl80211_tdls_peer_capability {
4101 NL80211_TDLS_PEER_HT = 1<<0,
4102 NL80211_TDLS_PEER_VHT = 1<<1,
4103 NL80211_TDLS_PEER_WMM = 1<<2,
4104};
4105
4040#endif /* __LINUX_NL80211_H */ 4106#endif /* __LINUX_NL80211_H */
diff --git a/include/uapi/linux/nvme.h b/include/uapi/linux/nvme.h
index e5ab62201119..096fe1c6f83d 100644
--- a/include/uapi/linux/nvme.h
+++ b/include/uapi/linux/nvme.h
@@ -434,6 +434,7 @@ enum {
434 NVME_SC_REFTAG_CHECK = 0x284, 434 NVME_SC_REFTAG_CHECK = 0x284,
435 NVME_SC_COMPARE_FAILED = 0x285, 435 NVME_SC_COMPARE_FAILED = 0x285,
436 NVME_SC_ACCESS_DENIED = 0x286, 436 NVME_SC_ACCESS_DENIED = 0x286,
437 NVME_SC_DNR = 0x4000,
437}; 438};
438 439
439struct nvme_completion { 440struct nvme_completion {
diff --git a/include/uapi/linux/pfkeyv2.h b/include/uapi/linux/pfkeyv2.h
index 0b80c806631f..ada7f0171ccc 100644
--- a/include/uapi/linux/pfkeyv2.h
+++ b/include/uapi/linux/pfkeyv2.h
@@ -235,6 +235,18 @@ struct sadb_x_kmaddress {
235} __attribute__((packed)); 235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */ 236/* sizeof(struct sadb_x_kmaddress) == 8 */
237 237
238/* To specify the SA dump filter */
239struct sadb_x_filter {
240 __u16 sadb_x_filter_len;
241 __u16 sadb_x_filter_exttype;
242 __u32 sadb_x_filter_saddr[4];
243 __u32 sadb_x_filter_daddr[4];
244 __u16 sadb_x_filter_family;
245 __u8 sadb_x_filter_splen;
246 __u8 sadb_x_filter_dplen;
247} __attribute__((packed));
248/* sizeof(struct sadb_x_filter) == 40 */
249
238/* Message types */ 250/* Message types */
239#define SADB_RESERVED 0 251#define SADB_RESERVED 0
240#define SADB_GETSPI 1 252#define SADB_GETSPI 1
@@ -358,7 +370,8 @@ struct sadb_x_kmaddress {
358#define SADB_X_EXT_SEC_CTX 24 370#define SADB_X_EXT_SEC_CTX 24
359/* Used with MIGRATE to pass @ to IKE for negotiation */ 371/* Used with MIGRATE to pass @ to IKE for negotiation */
360#define SADB_X_EXT_KMADDRESS 25 372#define SADB_X_EXT_KMADDRESS 25
361#define SADB_EXT_MAX 25 373#define SADB_X_EXT_FILTER 26
374#define SADB_EXT_MAX 26
362 375
363/* Identity Extension values */ 376/* Identity Extension values */
364#define SADB_IDENTTYPE_RESERVED 0 377#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 289760f424aa..58afc04c107e 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -149,4 +149,7 @@
149 149
150#define PR_GET_TID_ADDRESS 40 150#define PR_GET_TID_ADDRESS 40
151 151
152#define PR_SET_THP_DISABLE 41
153#define PR_GET_THP_DISABLE 42
154
152#endif /* _LINUX_PRCTL_H */ 155#endif /* _LINUX_PRCTL_H */
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index b65c834f83e9..f0b7bfe5da92 100644
--- a/include/uapi/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
@@ -50,7 +50,8 @@ struct ptp_clock_caps {
50 int n_ext_ts; /* Number of external time stamp channels. */ 50 int n_ext_ts; /* Number of external time stamp channels. */
51 int n_per_out; /* Number of programmable periodic signals. */ 51 int n_per_out; /* Number of programmable periodic signals. */
52 int pps; /* Whether the clock supports a PPS callback. */ 52 int pps; /* Whether the clock supports a PPS callback. */
53 int rsv[15]; /* Reserved for future use. */ 53 int n_pins; /* Number of input/output pins. */
54 int rsv[14]; /* Reserved for future use. */
54}; 55};
55 56
56struct ptp_extts_request { 57struct ptp_extts_request {
@@ -80,6 +81,40 @@ struct ptp_sys_offset {
80 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; 81 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
81}; 82};
82 83
84enum ptp_pin_function {
85 PTP_PF_NONE,
86 PTP_PF_EXTTS,
87 PTP_PF_PEROUT,
88 PTP_PF_PHYSYNC,
89};
90
91struct ptp_pin_desc {
92 /*
93 * Hardware specific human readable pin name. This field is
94 * set by the kernel during the PTP_PIN_GETFUNC ioctl and is
95 * ignored for the PTP_PIN_SETFUNC ioctl.
96 */
97 char name[64];
98 /*
99 * Pin index in the range of zero to ptp_clock_caps.n_pins - 1.
100 */
101 unsigned int index;
102 /*
103 * Which of the PTP_PF_xxx functions to use on this pin.
104 */
105 unsigned int func;
106 /*
107 * The specific channel to use for this function.
108 * This corresponds to the 'index' field of the
109 * PTP_EXTTS_REQUEST and PTP_PEROUT_REQUEST ioctls.
110 */
111 unsigned int chan;
112 /*
113 * Reserved for future use.
114 */
115 unsigned int rsv[5];
116};
117
83#define PTP_CLK_MAGIC '=' 118#define PTP_CLK_MAGIC '='
84 119
85#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps) 120#define PTP_CLOCK_GETCAPS _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
@@ -87,6 +122,8 @@ struct ptp_sys_offset {
87#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request) 122#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
88#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int) 123#define PTP_ENABLE_PPS _IOW(PTP_CLK_MAGIC, 4, int)
89#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset) 124#define PTP_SYS_OFFSET _IOW(PTP_CLK_MAGIC, 5, struct ptp_sys_offset)
125#define PTP_PIN_GETFUNC _IOWR(PTP_CLK_MAGIC, 6, struct ptp_pin_desc)
126#define PTP_PIN_SETFUNC _IOW(PTP_CLK_MAGIC, 7, struct ptp_pin_desc)
90 127
91struct ptp_extts_event { 128struct ptp_extts_event {
92 struct ptp_clock_time t; /* Time event occured. */ 129 struct ptp_clock_time t; /* Time event occured. */
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h
index bbaba22f2d1b..df40137f33dd 100644
--- a/include/uapi/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
@@ -252,6 +252,7 @@ enum
252 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */ 252 LINUX_MIB_TCPCHALLENGEACK, /* TCPChallengeACK */
253 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */ 253 LINUX_MIB_TCPSYNCHALLENGE, /* TCPSYNChallenge */
254 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */ 254 LINUX_MIB_TCPFASTOPENACTIVE, /* TCPFastOpenActive */
255 LINUX_MIB_TCPFASTOPENACTIVEFAIL, /* TCPFastOpenActiveFail */
255 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/ 256 LINUX_MIB_TCPFASTOPENPASSIVE, /* TCPFastOpenPassive*/
256 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */ 257 LINUX_MIB_TCPFASTOPENPASSIVEFAIL, /* TCPFastOpenPassiveFail */
257 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ 258 LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */
@@ -259,6 +260,11 @@ enum
259 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ 260 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */
260 LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ 261 LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */
261 LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */ 262 LINUX_MIB_TCPAUTOCORKING, /* TCPAutoCorking */
263 LINUX_MIB_TCPFROMZEROWINDOWADV, /* TCPFromZeroWindowAdv */
264 LINUX_MIB_TCPTOZEROWINDOWADV, /* TCPToZeroWindowAdv */
265 LINUX_MIB_TCPWANTZEROWINDOWADV, /* TCPWantZeroWindowAdv */
266 LINUX_MIB_TCPSYNRETRANS, /* TCPSynRetrans */
267 LINUX_MIB_TCPORIGDATASENT, /* TCPOrigDataSent */
262 __LINUX_MIB_MAX 268 __LINUX_MIB_MAX
263}; 269};
264 270
diff --git a/include/uapi/linux/spi/spidev.h b/include/uapi/linux/spi/spidev.h
index 52d9ed01855f..dd5f21e75805 100644
--- a/include/uapi/linux/spi/spidev.h
+++ b/include/uapi/linux/spi/spidev.h
@@ -42,6 +42,10 @@
42#define SPI_LOOP 0x20 42#define SPI_LOOP 0x20
43#define SPI_NO_CS 0x40 43#define SPI_NO_CS 0x40
44#define SPI_READY 0x80 44#define SPI_READY 0x80
45#define SPI_TX_DUAL 0x100
46#define SPI_TX_QUAD 0x200
47#define SPI_RX_DUAL 0x400
48#define SPI_RX_QUAD 0x800
45 49
46/*---------------------------------------------------------------------------*/ 50/*---------------------------------------------------------------------------*/
47 51
@@ -92,7 +96,9 @@ struct spi_ioc_transfer {
92 __u16 delay_usecs; 96 __u16 delay_usecs;
93 __u8 bits_per_word; 97 __u8 bits_per_word;
94 __u8 cs_change; 98 __u8 cs_change;
95 __u32 pad; 99 __u8 tx_nbits;
100 __u8 rx_nbits;
101 __u16 pad;
96 102
97 /* If the contents of 'struct spi_ioc_transfer' ever change 103 /* If the contents of 'struct spi_ioc_transfer' ever change
98 * incompatibly, then the ioctl number (currently 0) must change; 104 * incompatibly, then the ioctl number (currently 0) must change;
@@ -110,7 +116,7 @@ struct spi_ioc_transfer {
110#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)]) 116#define SPI_IOC_MESSAGE(N) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(N)])
111 117
112 118
113/* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) */ 119/* Read / Write of SPI mode (SPI_MODE_0..SPI_MODE_3) (limited to 8 bits) */
114#define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8) 120#define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, __u8)
115#define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8) 121#define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, __u8)
116 122
@@ -126,6 +132,10 @@ struct spi_ioc_transfer {
126#define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32) 132#define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, __u32)
127#define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32) 133#define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, __u32)
128 134
135/* Read / Write of the SPI mode field */
136#define SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, __u32)
137#define SPI_IOC_WR_MODE32 _IOW(SPI_IOC_MAGIC, 5, __u32)
138
129 139
130 140
131#endif /* SPIDEV_H */ 141#endif /* SPIDEV_H */
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
index 377f1e59411d..3b9718328d8b 100644
--- a/include/uapi/linux/tcp.h
+++ b/include/uapi/linux/tcp.h
@@ -186,6 +186,9 @@ struct tcp_info {
186 __u32 tcpi_rcv_space; 186 __u32 tcpi_rcv_space;
187 187
188 __u32 tcpi_total_retrans; 188 __u32 tcpi_total_retrans;
189
190 __u64 tcpi_pacing_rate;
191 __u64 tcpi_max_pacing_rate;
189}; 192};
190 193
191/* for TCP_MD5SIG socket option */ 194/* for TCP_MD5SIG socket option */
diff --git a/include/uapi/linux/tcp_metrics.h b/include/uapi/linux/tcp_metrics.h
index 54a37b13f2c4..93533926035c 100644
--- a/include/uapi/linux/tcp_metrics.h
+++ b/include/uapi/linux/tcp_metrics.h
@@ -11,12 +11,15 @@
11#define TCP_METRICS_GENL_VERSION 0x1 11#define TCP_METRICS_GENL_VERSION 0x1
12 12
13enum tcp_metric_index { 13enum tcp_metric_index {
14 TCP_METRIC_RTT, 14 TCP_METRIC_RTT, /* in ms units */
15 TCP_METRIC_RTTVAR, 15 TCP_METRIC_RTTVAR, /* in ms units */
16 TCP_METRIC_SSTHRESH, 16 TCP_METRIC_SSTHRESH,
17 TCP_METRIC_CWND, 17 TCP_METRIC_CWND,
18 TCP_METRIC_REORDERING, 18 TCP_METRIC_REORDERING,
19 19
20 TCP_METRIC_RTT_US, /* in usec units */
21 TCP_METRIC_RTTVAR_US, /* in usec units */
22
20 /* Always last. */ 23 /* Always last. */
21 __TCP_METRIC_MAX, 24 __TCP_METRIC_MAX,
22}; 25};
diff --git a/include/uapi/linux/uhid.h b/include/uapi/linux/uhid.h
index 414b74be4da1..1e3b09c191cd 100644
--- a/include/uapi/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/hid.h>
24 25
25enum uhid_event_type { 26enum uhid_event_type {
26 UHID_CREATE, 27 UHID_CREATE,
@@ -34,6 +35,8 @@ enum uhid_event_type {
34 UHID_INPUT, 35 UHID_INPUT,
35 UHID_FEATURE, 36 UHID_FEATURE,
36 UHID_FEATURE_ANSWER, 37 UHID_FEATURE_ANSWER,
38 UHID_CREATE2,
39 UHID_INPUT2,
37}; 40};
38 41
39struct uhid_create_req { 42struct uhid_create_req {
@@ -50,6 +53,19 @@ struct uhid_create_req {
50 __u32 country; 53 __u32 country;
51} __attribute__((__packed__)); 54} __attribute__((__packed__));
52 55
56struct uhid_create2_req {
57 __u8 name[128];
58 __u8 phys[64];
59 __u8 uniq[64];
60 __u16 rd_size;
61 __u16 bus;
62 __u32 vendor;
63 __u32 product;
64 __u32 version;
65 __u32 country;
66 __u8 rd_data[HID_MAX_DESCRIPTOR_SIZE];
67} __attribute__((__packed__));
68
53#define UHID_DATA_MAX 4096 69#define UHID_DATA_MAX 4096
54 70
55enum uhid_report_type { 71enum uhid_report_type {
@@ -63,6 +79,11 @@ struct uhid_input_req {
63 __u16 size; 79 __u16 size;
64} __attribute__((__packed__)); 80} __attribute__((__packed__));
65 81
82struct uhid_input2_req {
83 __u16 size;
84 __u8 data[UHID_DATA_MAX];
85} __attribute__((__packed__));
86
66struct uhid_output_req { 87struct uhid_output_req {
67 __u8 data[UHID_DATA_MAX]; 88 __u8 data[UHID_DATA_MAX];
68 __u16 size; 89 __u16 size;
@@ -100,6 +121,8 @@ struct uhid_event {
100 struct uhid_output_ev_req output_ev; 121 struct uhid_output_ev_req output_ev;
101 struct uhid_feature_req feature; 122 struct uhid_feature_req feature;
102 struct uhid_feature_answer_req feature_answer; 123 struct uhid_feature_answer_req feature_answer;
124 struct uhid_create2_req create2;
125 struct uhid_input2_req input2;
103 } u; 126 } u;
104} __attribute__((__packed__)); 127} __attribute__((__packed__));
105 128
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
index fe46431593f9..0389b489bbba 100644
--- a/include/uapi/linux/uinput.h
+++ b/include/uapi/linux/uinput.h
@@ -20,6 +20,8 @@
20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org> 20 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
21 * 21 *
22 * Changes/Revisions: 22 * Changes/Revisions:
23 * 0.4 01/09/2014 (Benjamin Tissoires <benjamin.tissoires@redhat.com>)
24 * - add UI_GET_SYSNAME ioctl
23 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>) 25 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
24 * - update ff support for the changes in kernel interface 26 * - update ff support for the changes in kernel interface
25 * - add UINPUT_VERSION 27 * - add UINPUT_VERSION
@@ -35,7 +37,7 @@
35#include <linux/types.h> 37#include <linux/types.h>
36#include <linux/input.h> 38#include <linux/input.h>
37 39
38#define UINPUT_VERSION 3 40#define UINPUT_VERSION 4
39 41
40 42
41struct uinput_ff_upload { 43struct uinput_ff_upload {
@@ -73,6 +75,15 @@ struct uinput_ff_erase {
73#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase) 75#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
74#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase) 76#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
75 77
78/**
79 * UI_GET_SYSNAME - get the sysfs name of the created uinput device
80 *
81 * @return the sysfs name of the created virtual input device.
82 * The complete sysfs path is then /sys/devices/virtual/input/--NAME--
83 * Usually, it is in the form "inputN"
84 */
85#define UI_GET_SYSNAME(len) _IOC(_IOC_READ, UINPUT_IOCTL_BASE, 300, len)
86
76/* 87/*
77 * To write a force-feedback-capable driver, the upload_effect 88 * To write a force-feedback-capable driver, the upload_effect
78 * and erase_effect callbacks in input_dev must be implemented. 89 * and erase_effect callbacks in input_dev must be implemented.
diff --git a/include/uapi/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index f35aa0a338c7..b6a9cdd6e096 100644
--- a/include/uapi/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
@@ -56,6 +56,7 @@
56#define USB_CDC_OBEX_TYPE 0x15 56#define USB_CDC_OBEX_TYPE 0x15
57#define USB_CDC_NCM_TYPE 0x1a 57#define USB_CDC_NCM_TYPE 0x1a
58#define USB_CDC_MBIM_TYPE 0x1b 58#define USB_CDC_MBIM_TYPE 0x1b
59#define USB_CDC_MBIM_EXTENDED_TYPE 0x1c
59 60
60/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ 61/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
61struct usb_cdc_header_desc { 62struct usb_cdc_header_desc {
@@ -205,6 +206,17 @@ struct usb_cdc_mbim_desc {
205 __u8 bmNetworkCapabilities; 206 __u8 bmNetworkCapabilities;
206} __attribute__ ((packed)); 207} __attribute__ ((packed));
207 208
209/* "MBIM Extended Functional Descriptor" from CDC MBIM spec 1.0 errata-1 */
210struct usb_cdc_mbim_extended_desc {
211 __u8 bLength;
212 __u8 bDescriptorType;
213 __u8 bDescriptorSubType;
214
215 __le16 bcdMBIMExtendedVersion;
216 __u8 bMaxOutstandingCommandMessages;
217 __le16 wMTU;
218} __attribute__ ((packed));
219
208/*-------------------------------------------------------------------------*/ 220/*-------------------------------------------------------------------------*/
209 221
210/* 222/*
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
index d6b01283f85c..2a4b4a72a4f9 100644
--- a/include/uapi/linux/usb/functionfs.h
+++ b/include/uapi/linux/usb/functionfs.h
@@ -10,9 +10,15 @@
10 10
11enum { 11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1, 12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2 13 FUNCTIONFS_STRINGS_MAGIC = 2,
14 FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
14}; 15};
15 16
17enum functionfs_flags {
18 FUNCTIONFS_HAS_FS_DESC = 1,
19 FUNCTIONFS_HAS_HS_DESC = 2,
20 FUNCTIONFS_HAS_SS_DESC = 4,
21};
16 22
17#ifndef __KERNEL__ 23#ifndef __KERNEL__
18 24
@@ -29,29 +35,39 @@ struct usb_endpoint_descriptor_no_audio {
29 35
30 36
31/* 37/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format: 38 * Descriptors format:
44 * 39 *
45 * | off | name | type | description | 40 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------| 41 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC | 42 * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC_V2 |
43 * | 4 | length | LE32 | length of the whole data chunk |
44 * | 8 | flags | LE32 | combination of functionfs_flags |
45 * | | fs_count | LE32 | number of full-speed descriptors |
46 * | | hs_count | LE32 | number of high-speed descriptors |
47 * | | ss_count | LE32 | number of super-speed descriptors |
48 * | | fs_descrs | Descriptor[] | list of full-speed descriptors |
49 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
50 * | | ss_descrs | Descriptor[] | list of super-speed descriptors |
51 *
52 * Depending on which flags are set, various fields may be missing in the
53 * structure. Any flags that are not recognised cause the whole block to be
54 * rejected with -ENOSYS.
55 *
56 * Legacy descriptors format:
57 *
58 * | off | name | type | description |
59 * |-----+-----------+--------------+--------------------------------------|
60 * | 0 | magic | LE32 | FUNCTIONFS_DESCRIPTORS_MAGIC |
48 * | 4 | length | LE32 | length of the whole data chunk | 61 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors | 62 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors | 63 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | 64 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors | 65 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 * 66 *
54 * descs are just valid USB descriptors and have the following format: 67 * All numbers must be in little endian order.
68 *
69 * Descriptor[] is an array of valid USB descriptors which have the following
70 * format:
55 * 71 *
56 * | off | name | type | description | 72 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------| 73 * |-----+-----------------+------+--------------------------|
diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h
index 0c65e4b12617..abe5f4bd4d82 100644
--- a/include/uapi/linux/usbdevice_fs.h
+++ b/include/uapi/linux/usbdevice_fs.h
@@ -102,7 +102,10 @@ struct usbdevfs_urb {
102 int buffer_length; 102 int buffer_length;
103 int actual_length; 103 int actual_length;
104 int start_frame; 104 int start_frame;
105 int number_of_packets; 105 union {
106 int number_of_packets; /* Only used for isoc urbs */
107 unsigned int stream_id; /* Only used with bulk streams */
108 };
106 int error_count; 109 int error_count;
107 unsigned int signr; /* signal to be sent on completion, 110 unsigned int signr; /* signal to be sent on completion,
108 or 0 if none should be sent. */ 111 or 0 if none should be sent. */
@@ -144,6 +147,11 @@ struct usbdevfs_disconnect_claim {
144 char driver[USBDEVFS_MAXDRIVERNAME + 1]; 147 char driver[USBDEVFS_MAXDRIVERNAME + 1];
145}; 148};
146 149
150struct usbdevfs_streams {
151 unsigned int num_streams; /* Not used by USBDEVFS_FREE_STREAMS */
152 unsigned int num_eps;
153 unsigned char eps[0];
154};
147 155
148#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) 156#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
149#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32) 157#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
@@ -176,5 +184,7 @@ struct usbdevfs_disconnect_claim {
176#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) 184#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
177#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32) 185#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
178#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim) 186#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
187#define USBDEVFS_ALLOC_STREAMS _IOR('U', 28, struct usbdevfs_streams)
188#define USBDEVFS_FREE_STREAMS _IOR('U', 29, struct usbdevfs_streams)
179 189
180#endif /* _UAPI_LINUX_USBDEVICE_FS_H */ 190#endif /* _UAPI_LINUX_USBDEVICE_FS_H */
diff --git a/include/uapi/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h
index 4f0667e010dd..9bf508ad0957 100644
--- a/include/uapi/linux/v4l2-common.h
+++ b/include/uapi/linux/v4l2-common.h
@@ -29,6 +29,8 @@
29#ifndef __V4L2_COMMON__ 29#ifndef __V4L2_COMMON__
30#define __V4L2_COMMON__ 30#define __V4L2_COMMON__
31 31
32#include <linux/types.h>
33
32/* 34/*
33 * 35 *
34 * Selection interface definitions 36 * Selection interface definitions
@@ -68,4 +70,12 @@
68#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE 70#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE
69#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG 71#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
70 72
73struct v4l2_edid {
74 __u32 pad;
75 __u32 start_block;
76 __u32 blocks;
77 __u32 reserved[5];
78 __u8 __user *edid;
79};
80
71#endif /* __V4L2_COMMON__ */ 81#endif /* __V4L2_COMMON__ */
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index 2cbe605bbe04..2ac5597f3ee1 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -60,6 +60,7 @@
60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */ 60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */ 61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */ 62#define V4L2_CTRL_CLASS_FM_RX 0x00a10000 /* FM Receiver controls */
63#define V4L2_CTRL_CLASS_RF_TUNER 0x00a20000 /* RF tuner controls */
63 64
64/* User-class control IDs */ 65/* User-class control IDs */
65 66
@@ -376,6 +377,8 @@ enum v4l2_mpeg_video_multi_slice_mode {
376#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) 377#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
377#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225) 378#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
378#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226) 379#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER (V4L2_CID_MPEG_BASE+226)
380#define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227)
381#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228)
379 382
380#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 383#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
381#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 384#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
@@ -812,6 +815,9 @@ enum v4l2_flash_strobe_source {
812#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) 815#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
813#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4) 816#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
814#define V4L2_FLASH_FAULT_INDICATOR (1 << 5) 817#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
818#define V4L2_FLASH_FAULT_UNDER_VOLTAGE (1 << 6)
819#define V4L2_FLASH_FAULT_INPUT_VOLTAGE (1 << 7)
820#define V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE (1 << 8)
815 821
816#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) 822#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
817#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) 823#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
@@ -895,4 +901,17 @@ enum v4l2_deemphasis {
895 901
896#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2) 902#define V4L2_CID_RDS_RECEPTION (V4L2_CID_FM_RX_CLASS_BASE + 2)
897 903
904#define V4L2_CID_RF_TUNER_CLASS_BASE (V4L2_CTRL_CLASS_RF_TUNER | 0x900)
905#define V4L2_CID_RF_TUNER_CLASS (V4L2_CTRL_CLASS_RF_TUNER | 1)
906
907#define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 11)
908#define V4L2_CID_RF_TUNER_BANDWIDTH (V4L2_CID_RF_TUNER_CLASS_BASE + 12)
909#define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 41)
910#define V4L2_CID_RF_TUNER_LNA_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 42)
911#define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 51)
912#define V4L2_CID_RF_TUNER_MIXER_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 52)
913#define V4L2_CID_RF_TUNER_IF_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 61)
914#define V4L2_CID_RF_TUNER_IF_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 62)
915#define V4L2_CID_RF_TUNER_PLL_LOCK (V4L2_CID_RF_TUNER_CLASS_BASE + 91)
916
898#endif 917#endif
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h
index be709fe29552..b6a5fe00a470 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -823,4 +823,21 @@
823 V4L2_DV_FL_REDUCED_BLANKING) \ 823 V4L2_DV_FL_REDUCED_BLANKING) \
824} 824}
825 825
826/* 4K resolutions */
827#define V4L2_DV_BT_DMT_4096X2160P60_RB { \
828 .type = V4L2_DV_BT_656_1120, \
829 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
830 556744000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \
831 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
832 V4L2_DV_FL_REDUCED_BLANKING) \
833}
834
835#define V4L2_DV_BT_DMT_4096X2160P59_94_RB { \
836 .type = V4L2_DV_BT_656_1120, \
837 V4L2_INIT_BT_TIMINGS(4096, 2160, 0, V4L2_DV_HSYNC_POS_POL, \
838 556188000, 8, 32, 40, 48, 8, 6, 0, 0, 0, \
839 V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CVT, \
840 V4L2_DV_FL_REDUCED_BLANKING) \
841}
842
826#endif 843#endif
diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index a33c4daadce3..87e05159f637 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -148,13 +148,8 @@ struct v4l2_subdev_selection {
148 __u32 reserved[8]; 148 __u32 reserved[8];
149}; 149};
150 150
151struct v4l2_subdev_edid { 151/* Backwards compatibility define --- to be removed */
152 __u32 pad; 152#define v4l2_subdev_edid v4l2_edid
153 __u32 start_block;
154 __u32 blocks;
155 __u32 reserved[5];
156 __u8 __user *edid;
157};
158 153
159#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 154#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
160#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 155#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
@@ -174,7 +169,8 @@ struct v4l2_subdev_edid {
174 _IOWR('V', 61, struct v4l2_subdev_selection) 169 _IOWR('V', 61, struct v4l2_subdev_selection)
175#define VIDIOC_SUBDEV_S_SELECTION \ 170#define VIDIOC_SUBDEV_S_SELECTION \
176 _IOWR('V', 62, struct v4l2_subdev_selection) 171 _IOWR('V', 62, struct v4l2_subdev_selection)
177#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_subdev_edid) 172/* These two G/S_EDID ioctls are identical to the ioctls in videodev2.h */
178#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_subdev_edid) 173#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_edid)
174#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_edid)
179 175
180#endif 176#endif
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
index 0fd47f5bc146..cb9023d4f063 100644
--- a/include/uapi/linux/vfio.h
+++ b/include/uapi/linux/vfio.h
@@ -23,6 +23,12 @@
23 23
24#define VFIO_TYPE1_IOMMU 1 24#define VFIO_TYPE1_IOMMU 1
25#define VFIO_SPAPR_TCE_IOMMU 2 25#define VFIO_SPAPR_TCE_IOMMU 2
26#define VFIO_TYPE1v2_IOMMU 3
27/*
28 * IOMMU enforces DMA cache coherence (ex. PCIe NoSnoop stripping). This
29 * capability is subject to change as groups are added or removed.
30 */
31#define VFIO_DMA_CC_IOMMU 4
26 32
27/* 33/*
28 * The IOCTL interface is designed for extensibility by embedding the 34 * The IOCTL interface is designed for extensibility by embedding the
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 6ae7bbe988cc..ea468ee8fe21 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -139,6 +139,7 @@ enum v4l2_buf_type {
139#endif 139#endif
140 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, 140 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
141 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, 141 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
142 V4L2_BUF_TYPE_SDR_CAPTURE = 11,
142 /* Deprecated, do not use */ 143 /* Deprecated, do not use */
143 V4L2_BUF_TYPE_PRIVATE = 0x80, 144 V4L2_BUF_TYPE_PRIVATE = 0x80,
144}; 145};
@@ -159,6 +160,8 @@ enum v4l2_tuner_type {
159 V4L2_TUNER_RADIO = 1, 160 V4L2_TUNER_RADIO = 1,
160 V4L2_TUNER_ANALOG_TV = 2, 161 V4L2_TUNER_ANALOG_TV = 2,
161 V4L2_TUNER_DIGITAL_TV = 3, 162 V4L2_TUNER_DIGITAL_TV = 3,
163 V4L2_TUNER_ADC = 4,
164 V4L2_TUNER_RF = 5,
162}; 165};
163 166
164enum v4l2_memory { 167enum v4l2_memory {
@@ -264,6 +267,8 @@ struct v4l2_capability {
264#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ 267#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
265#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ 268#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
266 269
270#define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */
271
267#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ 272#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
268#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ 273#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
269#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ 274#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
@@ -431,6 +436,10 @@ struct v4l2_pix_format {
431#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ 436#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
432#define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */ 437#define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
433 438
439/* SDR formats - used only for Software Defined Radio devices */
440#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
441#define V4L2_SDR_FMT_CU16LE v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le */
442
434/* 443/*
435 * F O R M A T E N U M E R A T I O N 444 * F O R M A T E N U M E R A T I O N
436 */ 445 */
@@ -669,24 +678,36 @@ struct v4l2_buffer {
669}; 678};
670 679
671/* Flags for 'flags' field */ 680/* Flags for 'flags' field */
672#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ 681/* Buffer is mapped (flag) */
673#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ 682#define V4L2_BUF_FLAG_MAPPED 0x00000001
674#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ 683/* Buffer is queued for processing */
675#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ 684#define V4L2_BUF_FLAG_QUEUED 0x00000002
676#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ 685/* Buffer is ready */
677#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ 686#define V4L2_BUF_FLAG_DONE 0x00000004
687/* Image is a keyframe (I-frame) */
688#define V4L2_BUF_FLAG_KEYFRAME 0x00000008
689/* Image is a P-frame */
690#define V4L2_BUF_FLAG_PFRAME 0x00000010
691/* Image is a B-frame */
692#define V4L2_BUF_FLAG_BFRAME 0x00000020
678/* Buffer is ready, but the data contained within is corrupted. */ 693/* Buffer is ready, but the data contained within is corrupted. */
679#define V4L2_BUF_FLAG_ERROR 0x0040 694#define V4L2_BUF_FLAG_ERROR 0x00000040
680#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ 695/* timecode field is valid */
681#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */ 696#define V4L2_BUF_FLAG_TIMECODE 0x00000100
697/* Buffer is prepared for queuing */
698#define V4L2_BUF_FLAG_PREPARED 0x00000400
682/* Cache handling flags */ 699/* Cache handling flags */
683#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 700#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x00000800
684#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 701#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x00001000
685/* Timestamp type */ 702/* Timestamp type */
686#define V4L2_BUF_FLAG_TIMESTAMP_MASK 0xe000 703#define V4L2_BUF_FLAG_TIMESTAMP_MASK 0x0000e000
687#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x0000 704#define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN 0x00000000
688#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x2000 705#define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC 0x00002000
689#define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x4000 706#define V4L2_BUF_FLAG_TIMESTAMP_COPY 0x00004000
707/* Timestamp sources. */
708#define V4L2_BUF_FLAG_TSTAMP_SRC_MASK 0x00070000
709#define V4L2_BUF_FLAG_TSTAMP_SRC_EOF 0x00000000
710#define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000
690 711
691/** 712/**
692 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor 713 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
@@ -1059,14 +1080,14 @@ struct v4l2_bt_timings {
1059 1080
1060/* A few useful defines to calculate the total blanking and frame sizes */ 1081/* A few useful defines to calculate the total blanking and frame sizes */
1061#define V4L2_DV_BT_BLANKING_WIDTH(bt) \ 1082#define V4L2_DV_BT_BLANKING_WIDTH(bt) \
1062 (bt->hfrontporch + bt->hsync + bt->hbackporch) 1083 ((bt)->hfrontporch + (bt)->hsync + (bt)->hbackporch)
1063#define V4L2_DV_BT_FRAME_WIDTH(bt) \ 1084#define V4L2_DV_BT_FRAME_WIDTH(bt) \
1064 (bt->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) 1085 ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt))
1065#define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ 1086#define V4L2_DV_BT_BLANKING_HEIGHT(bt) \
1066 (bt->vfrontporch + bt->vsync + bt->vbackporch + \ 1087 ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \
1067 bt->il_vfrontporch + bt->il_vsync + bt->il_vbackporch) 1088 (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch)
1068#define V4L2_DV_BT_FRAME_HEIGHT(bt) \ 1089#define V4L2_DV_BT_FRAME_HEIGHT(bt) \
1069 (bt->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) 1090 ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt))
1070 1091
1071/** struct v4l2_dv_timings - DV timings 1092/** struct v4l2_dv_timings - DV timings
1072 * @type: the type of the timings 1093 * @type: the type of the timings
@@ -1339,6 +1360,7 @@ struct v4l2_modulator {
1339#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 1360#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
1340#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400 1361#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400
1341#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 1362#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800
1363#define V4L2_TUNER_CAP_1HZ 0x1000
1342 1364
1343/* Flags for the 'rxsubchans' field */ 1365/* Flags for the 'rxsubchans' field */
1344#define V4L2_TUNER_SUB_MONO 0x0001 1366#define V4L2_TUNER_SUB_MONO 0x0001
@@ -1692,6 +1714,15 @@ struct v4l2_pix_format_mplane {
1692} __attribute__ ((packed)); 1714} __attribute__ ((packed));
1693 1715
1694/** 1716/**
1717 * struct v4l2_sdr_format - SDR format definition
1718 * @pixelformat: little endian four character code (fourcc)
1719 */
1720struct v4l2_sdr_format {
1721 __u32 pixelformat;
1722 __u8 reserved[28];
1723} __attribute__ ((packed));
1724
1725/**
1695 * struct v4l2_format - stream data format 1726 * struct v4l2_format - stream data format
1696 * @type: enum v4l2_buf_type; type of the data stream 1727 * @type: enum v4l2_buf_type; type of the data stream
1697 * @pix: definition of an image format 1728 * @pix: definition of an image format
@@ -1709,6 +1740,7 @@ struct v4l2_format {
1709 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ 1740 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1710 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ 1741 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1711 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ 1742 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1743 struct v4l2_sdr_format sdr; /* V4L2_BUF_TYPE_SDR_CAPTURE */
1712 __u8 raw_data[200]; /* user-defined */ 1744 __u8 raw_data[200]; /* user-defined */
1713 } fmt; 1745 } fmt;
1714}; 1746};
@@ -1885,6 +1917,8 @@ struct v4l2_create_buffers {
1885#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) 1917#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
1886#define VIDIOC_G_INPUT _IOR('V', 38, int) 1918#define VIDIOC_G_INPUT _IOR('V', 38, int)
1887#define VIDIOC_S_INPUT _IOWR('V', 39, int) 1919#define VIDIOC_S_INPUT _IOWR('V', 39, int)
1920#define VIDIOC_G_EDID _IOWR('V', 40, struct v4l2_edid)
1921#define VIDIOC_S_EDID _IOWR('V', 41, struct v4l2_edid)
1888#define VIDIOC_G_OUTPUT _IOR('V', 46, int) 1922#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
1889#define VIDIOC_S_OUTPUT _IOWR('V', 47, int) 1923#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
1890#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) 1924#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
index 40bbc04b6f81..c38355c1f3c9 100644
--- a/include/uapi/linux/xattr.h
+++ b/include/uapi/linux/xattr.h
@@ -7,11 +7,18 @@
7 Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved. 7 Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> 8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
9*/ 9*/
10
11#include <linux/libc-compat.h>
12
10#ifndef _UAPI_LINUX_XATTR_H 13#ifndef _UAPI_LINUX_XATTR_H
11#define _UAPI_LINUX_XATTR_H 14#define _UAPI_LINUX_XATTR_H
12 15
16#ifdef __UAPI_DEF_XATTR
17#define __USE_KERNEL_XATTR_DEFS
18
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ 19#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ 20#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
21#endif
15 22
16/* Namespaces */ 23/* Namespaces */
17#define XATTR_OS2_PREFIX "os2." 24#define XATTR_OS2_PREFIX "os2."
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index a8cd6a4a2970..25e5dd916ba4 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -298,6 +298,8 @@ enum xfrm_attr_type_t {
298 XFRMA_TFCPAD, /* __u32 */ 298 XFRMA_TFCPAD, /* __u32 */
299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ 299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */ 300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */
301 XFRMA_PROTO, /* __u8 */
302 XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
301 __XFRMA_MAX 303 __XFRMA_MAX
302 304
303#define XFRMA_MAX (__XFRMA_MAX - 1) 305#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -474,6 +476,14 @@ struct xfrm_user_mapping {
474 __be16 new_sport; 476 __be16 new_sport;
475}; 477};
476 478
479struct xfrm_address_filter {
480 xfrm_address_t saddr;
481 xfrm_address_t daddr;
482 __u16 family;
483 __u8 splen;
484 __u8 dplen;
485};
486
477#ifndef __KERNEL__ 487#ifndef __KERNEL__
478/* backwards compatibility for userspace */ 488/* backwards compatibility for userspace */
479#define XFRMGRP_ACQUIRE 1 489#define XFRMGRP_ACQUIRE 1
diff --git a/include/uapi/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h
index 723c324590c1..1927b0d78a99 100644
--- a/include/uapi/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
@@ -134,6 +134,16 @@
134 * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be 134 * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be
135 * passed. The object describes which property should be set, and to which value 135 * passed. The object describes which property should be set, and to which value
136 * it should be set. 136 * it should be set.
137 *
138 * Block devices on UBI volumes
139 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140 *
141 * To create a R/O block device on top of an UBI volume the %UBI_IOCVOLCRBLK
142 * should be used. A pointer to a &struct ubi_blkcreate_req object is expected
143 * to be passed, which is not used and reserved for future usage.
144 *
145 * Conversely, to remove a block device the %UBI_IOCVOLRMBLK should be used,
146 * which takes no arguments.
137 */ 147 */
138 148
139/* 149/*
@@ -191,6 +201,10 @@
191/* Set an UBI volume property */ 201/* Set an UBI volume property */
192#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \ 202#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \
193 struct ubi_set_vol_prop_req) 203 struct ubi_set_vol_prop_req)
204/* Create a R/O block device on top of an UBI volume */
205#define UBI_IOCVOLCRBLK _IOW(UBI_VOL_IOC_MAGIC, 7, struct ubi_blkcreate_req)
206/* Remove the R/O block device */
207#define UBI_IOCVOLRMBLK _IO(UBI_VOL_IOC_MAGIC, 8)
194 208
195/* Maximum MTD device name length supported by UBI */ 209/* Maximum MTD device name length supported by UBI */
196#define MAX_UBI_MTD_NAME_LEN 127 210#define MAX_UBI_MTD_NAME_LEN 127
@@ -420,4 +434,12 @@ struct ubi_set_vol_prop_req {
420 __u64 value; 434 __u64 value;
421} __packed; 435} __packed;
422 436
437/**
438 * struct ubi_blkcreate_req - a data structure used in block creation requests.
439 * @padding: reserved for future, not used, has to be zeroed
440 */
441struct ubi_blkcreate_req {
442 __s8 padding[128];
443} __packed;
444
423#endif /* __UBI_USER_H__ */ 445#endif /* __UBI_USER_H__ */
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 3d7c51a6f9ff..6adb44534606 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -323,7 +323,6 @@ enum omapdss_version {
323 323
324/* Board specific data */ 324/* Board specific data */
325struct omap_dss_board_info { 325struct omap_dss_board_info {
326 int (*get_context_loss_count)(struct device *dev);
327 int num_devices; 326 int num_devices;
328 struct omap_dss_device **devices; 327 struct omap_dss_device **devices;
329 struct omap_dss_device *default_device; 328 struct omap_dss_device *default_device;
@@ -344,8 +343,8 @@ struct omap_video_timings {
344 u16 x_res; 343 u16 x_res;
345 /* Unit: pixels */ 344 /* Unit: pixels */
346 u16 y_res; 345 u16 y_res;
347 /* Unit: KHz */ 346 /* Unit: Hz */
348 u32 pixel_clock; 347 u32 pixelclock;
349 /* Unit: pixel clocks */ 348 /* Unit: pixel clocks */
350 u16 hsw; /* Horizontal synchronization pulse width */ 349 u16 hsw; /* Horizontal synchronization pulse width */
351 /* Unit: pixel clocks */ 350 /* Unit: pixel clocks */
@@ -1019,4 +1018,18 @@ static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
1019 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE; 1018 return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
1020} 1019}
1021 1020
1021struct device_node *
1022omapdss_of_get_next_port(const struct device_node *parent,
1023 struct device_node *prev);
1024
1025struct device_node *
1026omapdss_of_get_next_endpoint(const struct device_node *parent,
1027 struct device_node *prev);
1028
1029struct device_node *
1030omapdss_of_get_first_endpoint(const struct device_node *parent);
1031
1032struct omap_dss_device *
1033omapdss_of_find_source_for_first_ep(struct device_node *node);
1034
1022#endif 1035#endif
diff --git a/include/video/sgivw.h b/include/video/sgivw.h
deleted file mode 100644
index f6aa5692e74b..000000000000
--- a/include/video/sgivw.h
+++ /dev/null
@@ -1,681 +0,0 @@
1/*
2 * linux/drivers/video/sgivw.h -- SGI DBE frame buffer device header
3 *
4 * Copyright (C) 1999 Silicon Graphics, Inc.
5 * Jeffrey Newquist, newquist@engr.sgi.som
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
10 */
11
12#ifndef __SGIVWFB_H__
13#define __SGIVWFB_H__
14
15#define DBE_GETREG(reg, dest) ((dest) = DBE_REG_BASE->reg)
16#define DBE_SETREG(reg, src) DBE_REG_BASE->reg = (src)
17#define DBE_IGETREG(reg, idx, dest) ((dest) = DBE_REG_BASE->reg[idx])
18#define DBE_ISETREG(reg, idx, src) (DBE_REG_BASE->reg[idx] = (src))
19
20#define MASK(msb, lsb) ( (((u32)1<<((msb)-(lsb)+1))-1) << (lsb) )
21#define GET(v, msb, lsb) ( ((u32)(v) & MASK(msb,lsb)) >> (lsb) )
22#define SET(v, f, msb, lsb) ( (v) = ((v)&~MASK(msb,lsb)) | (( (u32)(f)<<(lsb) ) & MASK(msb,lsb)) )
23
24#define GET_DBE_FIELD(reg, field, v) GET((v), DBE_##reg##_##field##_MSB, DBE_##reg##_##field##_LSB)
25#define SET_DBE_FIELD(reg, field, v, f) SET((v), (f), DBE_##reg##_##field##_MSB, DBE_##reg##_##field##_LSB)
26
27/* NOTE: All loads/stores must be 32 bits and uncached */
28
29#define DBE_REG_PHYS 0xd0000000
30#define DBE_REG_SIZE 0x01000000
31
32struct asregs {
33 volatile u32 ctrlstat; /* 0x000000 general control */
34 volatile u32 dotclock; /* 0x000004 dot clock PLL control */
35 volatile u32 i2c; /* 0x000008 crt I2C control */
36 volatile u32 sysclk; /* 0x00000c system clock PLL control */
37 volatile u32 i2cfp; /* 0x000010 flat panel I2C control */
38 volatile u32 id; /* 0x000014 device id/chip revision */
39 volatile u32 config; /* 0x000018 power on configuration */
40 volatile u32 bist; /* 0x00001c internal bist status */
41
42 char _pad0[ 0x010000 - 0x000020 ];
43
44 volatile u32 vt_xy; /* 0x010000 current dot coords */
45 volatile u32 vt_xymax; /* 0x010004 maximum dot coords */
46 volatile u32 vt_vsync; /* 0x010008 vsync on/off */
47 volatile u32 vt_hsync; /* 0x01000c hsync on/off */
48 volatile u32 vt_vblank; /* 0x010010 vblank on/off */
49 volatile u32 vt_hblank; /* 0x010014 hblank on/off */
50 volatile u32 vt_flags; /* 0x010018 polarity of vt signals */
51 volatile u32 vt_f2rf_lock; /* 0x01001c f2rf & framelck y coord */
52 volatile u32 vt_intr01; /* 0x010020 intr 0,1 y coords */
53 volatile u32 vt_intr23; /* 0x010024 intr 2,3 y coords */
54 volatile u32 fp_hdrv; /* 0x010028 flat panel hdrv on/off */
55 volatile u32 fp_vdrv; /* 0x01002c flat panel vdrv on/off */
56 volatile u32 fp_de; /* 0x010030 flat panel de on/off */
57 volatile u32 vt_hpixen; /* 0x010034 intrnl horiz pixel on/off*/
58 volatile u32 vt_vpixen; /* 0x010038 intrnl vert pixel on/off */
59 volatile u32 vt_hcmap; /* 0x01003c cmap write (horiz) */
60 volatile u32 vt_vcmap; /* 0x010040 cmap write (vert) */
61 volatile u32 did_start_xy; /* 0x010044 eol/f did/xy reset val */
62 volatile u32 crs_start_xy; /* 0x010048 eol/f crs/xy reset val */
63 volatile u32 vc_start_xy; /* 0x01004c eol/f vc/xy reset val */
64
65 char _pad1[ 0x020000 - 0x010050 ];
66
67 volatile u32 ovr_width_tile; /* 0x020000 overlay plane ctrl 0 */
68 volatile u32 ovr_inhwctrl; /* 0x020004 overlay plane ctrl 1 */
69 volatile u32 ovr_control; /* 0x020008 overlay plane ctrl 1 */
70
71 char _pad2[ 0x030000 - 0x02000C ];
72
73 volatile u32 frm_size_tile; /* 0x030000 normal plane ctrl 0 */
74 volatile u32 frm_size_pixel; /* 0x030004 normal plane ctrl 1 */
75 volatile u32 frm_inhwctrl; /* 0x030008 normal plane ctrl 2 */
76 volatile u32 frm_control; /* 0x03000C normal plane ctrl 3 */
77
78 char _pad3[ 0x040000 - 0x030010 ];
79
80 volatile u32 did_inhwctrl; /* 0x040000 DID control */
81 volatile u32 did_control; /* 0x040004 DID shadow */
82
83 char _pad4[ 0x048000 - 0x040008 ];
84
85 volatile u32 mode_regs[32]; /* 0x048000 - 0x04807c WID table */
86
87 char _pad5[ 0x050000 - 0x048080 ];
88
89 volatile u32 cmap[6144]; /* 0x050000 - 0x055ffc color map */
90
91 char _pad6[ 0x058000 - 0x056000 ];
92
93 volatile u32 cm_fifo; /* 0x058000 color map fifo status */
94
95 char _pad7[ 0x060000 - 0x058004 ];
96
97 volatile u32 gmap[256]; /* 0x060000 - 0x0603fc gamma map */
98
99 char _pad8[ 0x068000 - 0x060400 ];
100
101 volatile u32 gmap10[1024]; /* 0x068000 - 0x068ffc gamma map */
102
103 char _pad9[ 0x070000 - 0x069000 ];
104
105 volatile u32 crs_pos; /* 0x070000 cusror control 0 */
106 volatile u32 crs_ctl; /* 0x070004 cusror control 1 */
107 volatile u32 crs_cmap[3]; /* 0x070008 - 0x070010 crs cmap */
108
109 char _pad10[ 0x078000 - 0x070014 ];
110
111 volatile u32 crs_glyph[64]; /* 0x078000 - 0x0780fc crs glyph */
112
113 char _pad11[ 0x080000 - 0x078100 ];
114
115 volatile u32 vc_0; /* 0x080000 video capture crtl 0 */
116 volatile u32 vc_1; /* 0x080004 video capture crtl 1 */
117 volatile u32 vc_2; /* 0x080008 video capture crtl 2 */
118 volatile u32 vc_3; /* 0x08000c video capture crtl 3 */
119 volatile u32 vc_4; /* 0x080010 video capture crtl 3 */
120 volatile u32 vc_5; /* 0x080014 video capture crtl 3 */
121 volatile u32 vc_6; /* 0x080018 video capture crtl 3 */
122 volatile u32 vc_7; /* 0x08001c video capture crtl 3 */
123 volatile u32 vc_8; /* 0x08000c video capture crtl 3 */
124};
125
126/* Bit mask information */
127
128#define DBE_CTRLSTAT_CHIPID_MSB 3
129#define DBE_CTRLSTAT_CHIPID_LSB 0
130#define DBE_CTRLSTAT_SENSE_N_MSB 4
131#define DBE_CTRLSTAT_SENSE_N_LSB 4
132#define DBE_CTRLSTAT_PCLKSEL_MSB 29
133#define DBE_CTRLSTAT_PCLKSEL_LSB 28
134
135#define DBE_DOTCLK_M_MSB 7
136#define DBE_DOTCLK_M_LSB 0
137#define DBE_DOTCLK_N_MSB 13
138#define DBE_DOTCLK_N_LSB 8
139#define DBE_DOTCLK_P_MSB 15
140#define DBE_DOTCLK_P_LSB 14
141#define DBE_DOTCLK_RUN_MSB 20
142#define DBE_DOTCLK_RUN_LSB 20
143
144#define DBE_VT_XY_VT_FREEZE_MSB 31
145#define DBE_VT_XY_VT_FREEZE_LSB 31
146
147#define DBE_FP_VDRV_FP_VDRV_ON_MSB 23
148#define DBE_FP_VDRV_FP_VDRV_ON_LSB 12
149#define DBE_FP_VDRV_FP_VDRV_OFF_MSB 11
150#define DBE_FP_VDRV_FP_VDRV_OFF_LSB 0
151
152#define DBE_FP_HDRV_FP_HDRV_ON_MSB 23
153#define DBE_FP_HDRV_FP_HDRV_ON_LSB 12
154#define DBE_FP_HDRV_FP_HDRV_OFF_MSB 11
155#define DBE_FP_HDRV_FP_HDRV_OFF_LSB 0
156
157#define DBE_FP_DE_FP_DE_ON_MSB 23
158#define DBE_FP_DE_FP_DE_ON_LSB 12
159#define DBE_FP_DE_FP_DE_OFF_MSB 11
160#define DBE_FP_DE_FP_DE_OFF_LSB 0
161
162#define DBE_VT_VSYNC_VT_VSYNC_ON_MSB 23
163#define DBE_VT_VSYNC_VT_VSYNC_ON_LSB 12
164#define DBE_VT_VSYNC_VT_VSYNC_OFF_MSB 11
165#define DBE_VT_VSYNC_VT_VSYNC_OFF_LSB 0
166
167#define DBE_VT_HSYNC_VT_HSYNC_ON_MSB 23
168#define DBE_VT_HSYNC_VT_HSYNC_ON_LSB 12
169#define DBE_VT_HSYNC_VT_HSYNC_OFF_MSB 11
170#define DBE_VT_HSYNC_VT_HSYNC_OFF_LSB 0
171
172#define DBE_VT_VBLANK_VT_VBLANK_ON_MSB 23
173#define DBE_VT_VBLANK_VT_VBLANK_ON_LSB 12
174#define DBE_VT_VBLANK_VT_VBLANK_OFF_MSB 11
175#define DBE_VT_VBLANK_VT_VBLANK_OFF_LSB 0
176
177#define DBE_VT_HBLANK_VT_HBLANK_ON_MSB 23
178#define DBE_VT_HBLANK_VT_HBLANK_ON_LSB 12
179#define DBE_VT_HBLANK_VT_HBLANK_OFF_MSB 11
180#define DBE_VT_HBLANK_VT_HBLANK_OFF_LSB 0
181
182#define DBE_VT_FLAGS_VDRV_INVERT_MSB 0
183#define DBE_VT_FLAGS_VDRV_INVERT_LSB 0
184#define DBE_VT_FLAGS_HDRV_INVERT_MSB 2
185#define DBE_VT_FLAGS_HDRV_INVERT_LSB 2
186
187#define DBE_VT_VCMAP_VT_VCMAP_ON_MSB 23
188#define DBE_VT_VCMAP_VT_VCMAP_ON_LSB 12
189#define DBE_VT_VCMAP_VT_VCMAP_OFF_MSB 11
190#define DBE_VT_VCMAP_VT_VCMAP_OFF_LSB 0
191
192#define DBE_VT_HCMAP_VT_HCMAP_ON_MSB 23
193#define DBE_VT_HCMAP_VT_HCMAP_ON_LSB 12
194#define DBE_VT_HCMAP_VT_HCMAP_OFF_MSB 11
195#define DBE_VT_HCMAP_VT_HCMAP_OFF_LSB 0
196
197#define DBE_VT_XYMAX_VT_MAXX_MSB 11
198#define DBE_VT_XYMAX_VT_MAXX_LSB 0
199#define DBE_VT_XYMAX_VT_MAXY_MSB 23
200#define DBE_VT_XYMAX_VT_MAXY_LSB 12
201
202#define DBE_VT_HPIXEN_VT_HPIXEN_ON_MSB 23
203#define DBE_VT_HPIXEN_VT_HPIXEN_ON_LSB 12
204#define DBE_VT_HPIXEN_VT_HPIXEN_OFF_MSB 11
205#define DBE_VT_HPIXEN_VT_HPIXEN_OFF_LSB 0
206
207#define DBE_VT_VPIXEN_VT_VPIXEN_ON_MSB 23
208#define DBE_VT_VPIXEN_VT_VPIXEN_ON_LSB 12
209#define DBE_VT_VPIXEN_VT_VPIXEN_OFF_MSB 11
210#define DBE_VT_VPIXEN_VT_VPIXEN_OFF_LSB 0
211
212#define DBE_OVR_CONTROL_OVR_DMA_ENABLE_MSB 0
213#define DBE_OVR_CONTROL_OVR_DMA_ENABLE_LSB 0
214
215#define DBE_OVR_INHWCTRL_OVR_DMA_ENABLE_MSB 0
216#define DBE_OVR_INHWCTRL_OVR_DMA_ENABLE_LSB 0
217
218#define DBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_MSB 13
219#define DBE_OVR_WIDTH_TILE_OVR_FIFO_RESET_LSB 13
220
221#define DBE_FRM_CONTROL_FRM_DMA_ENABLE_MSB 0
222#define DBE_FRM_CONTROL_FRM_DMA_ENABLE_LSB 0
223#define DBE_FRM_CONTROL_FRM_TILE_PTR_MSB 31
224#define DBE_FRM_CONTROL_FRM_TILE_PTR_LSB 9
225#define DBE_FRM_CONTROL_FRM_LINEAR_MSB 1
226#define DBE_FRM_CONTROL_FRM_LINEAR_LSB 1
227
228#define DBE_FRM_INHWCTRL_FRM_DMA_ENABLE_MSB 0
229#define DBE_FRM_INHWCTRL_FRM_DMA_ENABLE_LSB 0
230
231#define DBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_MSB 12
232#define DBE_FRM_SIZE_TILE_FRM_WIDTH_TILE_LSB 5
233#define DBE_FRM_SIZE_TILE_FRM_RHS_MSB 4
234#define DBE_FRM_SIZE_TILE_FRM_RHS_LSB 0
235#define DBE_FRM_SIZE_TILE_FRM_DEPTH_MSB 14
236#define DBE_FRM_SIZE_TILE_FRM_DEPTH_LSB 13
237#define DBE_FRM_SIZE_TILE_FRM_FIFO_RESET_MSB 15
238#define DBE_FRM_SIZE_TILE_FRM_FIFO_RESET_LSB 15
239
240#define DBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_MSB 31
241#define DBE_FRM_SIZE_PIXEL_FB_HEIGHT_PIX_LSB 16
242
243#define DBE_DID_CONTROL_DID_DMA_ENABLE_MSB 0
244#define DBE_DID_CONTROL_DID_DMA_ENABLE_LSB 0
245#define DBE_DID_INHWCTRL_DID_DMA_ENABLE_MSB 0
246#define DBE_DID_INHWCTRL_DID_DMA_ENABLE_LSB 0
247
248#define DBE_DID_START_XY_DID_STARTY_MSB 23
249#define DBE_DID_START_XY_DID_STARTY_LSB 12
250#define DBE_DID_START_XY_DID_STARTX_MSB 11
251#define DBE_DID_START_XY_DID_STARTX_LSB 0
252
253#define DBE_CRS_START_XY_CRS_STARTY_MSB 23
254#define DBE_CRS_START_XY_CRS_STARTY_LSB 12
255#define DBE_CRS_START_XY_CRS_STARTX_MSB 11
256#define DBE_CRS_START_XY_CRS_STARTX_LSB 0
257
258#define DBE_WID_TYP_MSB 4
259#define DBE_WID_TYP_LSB 2
260#define DBE_WID_BUF_MSB 1
261#define DBE_WID_BUF_LSB 0
262
263#define DBE_VC_START_XY_VC_STARTY_MSB 23
264#define DBE_VC_START_XY_VC_STARTY_LSB 12
265#define DBE_VC_START_XY_VC_STARTX_MSB 11
266#define DBE_VC_START_XY_VC_STARTX_LSB 0
267
268/* Constants */
269
270#define DBE_FRM_DEPTH_8 0
271#define DBE_FRM_DEPTH_16 1
272#define DBE_FRM_DEPTH_32 2
273
274#define DBE_CMODE_I8 0
275#define DBE_CMODE_I12 1
276#define DBE_CMODE_RG3B2 2
277#define DBE_CMODE_RGB4 3
278#define DBE_CMODE_ARGB5 4
279#define DBE_CMODE_RGB8 5
280#define DBE_CMODE_RGBA5 6
281#define DBE_CMODE_RGB10 7
282
283#define DBE_BMODE_BOTH 3
284
285#define DBE_CRS_MAGIC 54
286
287#define DBE_CLOCK_REF_KHZ 27000
288
289/* Config Register (DBE Only) Definitions */
290
291#define DBE_CONFIG_VDAC_ENABLE 0x00000001
292#define DBE_CONFIG_VDAC_GSYNC 0x00000002
293#define DBE_CONFIG_VDAC_PBLANK 0x00000004
294#define DBE_CONFIG_FPENABLE 0x00000008
295#define DBE_CONFIG_LENDIAN 0x00000020
296#define DBE_CONFIG_TILEHIST 0x00000040
297#define DBE_CONFIG_EXT_ADDR 0x00000080
298
299#define DBE_CONFIG_FBDEV ( DBE_CONFIG_VDAC_ENABLE | \
300 DBE_CONFIG_VDAC_GSYNC | \
301 DBE_CONFIG_VDAC_PBLANK | \
302 DBE_CONFIG_LENDIAN | \
303 DBE_CONFIG_EXT_ADDR )
304
305/*
306 * Available Video Timings and Corresponding Indices
307 */
308
309typedef enum {
310 DBE_VT_640_480_60,
311
312 DBE_VT_800_600_60,
313 DBE_VT_800_600_75,
314 DBE_VT_800_600_120,
315
316 DBE_VT_1024_768_50,
317 DBE_VT_1024_768_60,
318 DBE_VT_1024_768_75,
319 DBE_VT_1024_768_85,
320 DBE_VT_1024_768_120,
321
322 DBE_VT_1280_1024_50,
323 DBE_VT_1280_1024_60,
324 DBE_VT_1280_1024_75,
325 DBE_VT_1280_1024_85,
326
327 DBE_VT_1600_1024_53,
328 DBE_VT_1600_1024_60,
329
330 DBE_VT_1600_1200_50,
331 DBE_VT_1600_1200_60,
332 DBE_VT_1600_1200_75,
333
334 DBE_VT_1920_1080_50,
335 DBE_VT_1920_1080_60,
336 DBE_VT_1920_1080_72,
337
338 DBE_VT_1920_1200_50,
339 DBE_VT_1920_1200_60,
340 DBE_VT_1920_1200_66,
341
342 DBE_VT_UNKNOWN
343} dbe_timing_t;
344
345
346
347/*
348 * Crime Video Timing Data Structure
349 */
350
351struct dbe_timing_info
352{
353 dbe_timing_t type;
354 int flags;
355 short width; /* Monitor resolution */
356 short height;
357 int fields_sec; /* fields/sec (Hz -3 dec. places */
358 int cfreq; /* pixel clock frequency (MHz -3 dec. places) */
359 short htotal; /* Horizontal total pixels */
360 short hblank_start; /* Horizontal blank start */
361 short hblank_end; /* Horizontal blank end */
362 short hsync_start; /* Horizontal sync start */
363 short hsync_end; /* Horizontal sync end */
364 short vtotal; /* Vertical total lines */
365 short vblank_start; /* Vertical blank start */
366 short vblank_end; /* Vertical blank end */
367 short vsync_start; /* Vertical sync start */
368 short vsync_end; /* Vertical sync end */
369 short pll_m; /* PLL M parameter */
370 short pll_n; /* PLL P parameter */
371 short pll_p; /* PLL N parameter */
372};
373
374/* Defines for dbe_vof_info_t flags */
375
376#define DBE_VOF_UNKNOWNMON 1
377#define DBE_VOF_STEREO 2
378#define DBE_VOF_DO_GENSYNC 4 /* enable incoming sync */
379#define DBE_VOF_SYNC_ON_GREEN 8 /* sync on green */
380#define DBE_VOF_FLATPANEL 0x1000 /* FLATPANEL Timing */
381#define DBE_VOF_MAGICKEY 0x2000 /* Backdoor key */
382
383/*
384 * DBE Timing Tables
385 */
386
387#ifdef INCLUDE_TIMING_TABLE_DATA
388struct dbe_timing_info dbeVTimings[] = {
389 {
390 DBE_VT_640_480_60,
391 /* flags, width, height, fields_sec, cfreq */
392 0, 640, 480, 59940, 25175,
393 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
394 800, 640, 800, 656, 752,
395 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
396 525, 480, 525, 490, 492,
397 /* pll_m, pll_n, pll_p */
398 15, 2, 3
399 },
400
401 {
402 DBE_VT_800_600_60,
403 /* flags, width, height, fields_sec, cfreq */
404 0, 800, 600, 60317, 40000,
405 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
406 1056, 800, 1056, 840, 968,
407 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
408 628, 600, 628, 601, 605,
409 /* pll_m, pll_n, pll_p */
410 3, 1, 1
411 },
412
413 {
414 DBE_VT_800_600_75,
415 /* flags, width, height, fields_sec, cfreq */
416 0, 800, 600, 75000, 49500,
417 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
418 1056, 800, 1056, 816, 896,
419 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
420 625, 600, 625, 601, 604,
421 /* pll_m, pll_n, pll_p */
422 11, 3, 1
423 },
424
425 {
426 DBE_VT_800_600_120,
427 /* flags, width, height, fields_sec, cfreq */
428 DBE_VOF_STEREO, 800, 600, 119800, 82978,
429 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
430 1040, 800, 1040, 856, 976,
431 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
432 666, 600, 666, 637, 643,
433 /* pll_m, pll_n, pll_p */
434 31, 5, 1
435 },
436
437 {
438 DBE_VT_1024_768_50,
439 /* flags, width, height, fields_sec, cfreq */
440 0, 1024, 768, 50000, 54163,
441 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
442 1344, 1024, 1344, 1048, 1184,
443 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
444 806, 768, 806, 771, 777,
445 /* pll_m, pll_n, pll_p */
446 4, 1, 1
447 },
448
449 {
450 DBE_VT_1024_768_60,
451 /* flags, width, height, fields_sec, cfreq */
452 0, 1024, 768, 60004, 65000,
453 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
454 1344, 1024, 1344, 1048, 1184,
455 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
456 806, 768, 806, 771, 777,
457 /* pll_m, pll_n, pll_p */
458 12, 5, 0
459 },
460
461 {
462 DBE_VT_1024_768_75,
463 /* flags, width, height, fields_sec, cfreq */
464 0, 1024, 768, 75029, 78750,
465 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
466 1312, 1024, 1312, 1040, 1136,
467 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
468 800, 768, 800, 769, 772,
469 /* pll_m, pll_n, pll_p */
470 29, 5, 1
471 },
472
473 {
474 DBE_VT_1024_768_85,
475 /* flags, width, height, fields_sec, cfreq */
476 0, 1024, 768, 84997, 94500,
477 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
478 1376, 1024, 1376, 1072, 1168,
479 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
480 808, 768, 808, 769, 772,
481 /* pll_m, pll_n, pll_p */
482 7, 2, 0
483 },
484
485 {
486 DBE_VT_1024_768_120,
487 /* flags, width, height, fields_sec, cfreq */
488 DBE_VOF_STEREO, 1024, 768, 119800, 133195,
489 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
490 1376, 1024, 1376, 1072, 1168,
491 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
492 808, 768, 808, 769, 772,
493 /* pll_m, pll_n, pll_p */
494 5, 1, 0
495 },
496
497 {
498 DBE_VT_1280_1024_50,
499 /* flags, width, height, fields_sec, cfreq */
500 0, 1280, 1024, 50000, 89460,
501 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
502 1680, 1280, 1680, 1360, 1480,
503 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
504 1065, 1024, 1065, 1027, 1030,
505 /* pll_m, pll_n, pll_p */
506 10, 3, 0
507 },
508
509 {
510 DBE_VT_1280_1024_60,
511 /* flags, width, height, fields_sec, cfreq */
512 0, 1280, 1024, 60020, 108000,
513 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
514 1688, 1280, 1688, 1328, 1440,
515 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
516 1066, 1024, 1066, 1025, 1028,
517 /* pll_m, pll_n, pll_p */
518 4, 1, 0
519 },
520
521 {
522 DBE_VT_1280_1024_75,
523 /* flags, width, height, fields_sec, cfreq */
524 0, 1280, 1024, 75025, 135000,
525 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
526 1688, 1280, 1688, 1296, 1440,
527 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
528 1066, 1024, 1066, 1025, 1028,
529 /* pll_m, pll_n, pll_p */
530 5, 1, 0
531 },
532
533 {
534 DBE_VT_1280_1024_85,
535 /* flags, width, height, fields_sec, cfreq */
536 0, 1280, 1024, 85024, 157500,
537 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
538 1728, 1280, 1728, 1344, 1504,
539 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
540 1072, 1024, 1072, 1025, 1028,
541 /* pll_m, pll_n, pll_p */
542 29, 5, 0
543 },
544
545 {
546 DBE_VT_1600_1024_53,
547 /* flags, width, height, fields_sec, cfreq */
548 DBE_VOF_FLATPANEL | DBE_VOF_MAGICKEY,
549 1600, 1024, 53000, 107447,
550 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
551 1900, 1600, 1900, 1630, 1730,
552 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
553 1067, 1024, 1067, 1027, 1030,
554 /* pll_m, pll_n, pll_p */
555 4, 1, 0
556 },
557
558 {
559 DBE_VT_1600_1024_60,
560 /* flags, width, height, fields_sec, cfreq */
561 DBE_VOF_FLATPANEL, 1600, 1024, 60000, 106913,
562 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
563 1670, 1600, 1670, 1630, 1650,
564 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
565 1067, 1024, 1067, 1027, 1030,
566 /* pll_m, pll_n, pll_p */
567 4, 1, 0
568 },
569
570 {
571 DBE_VT_1600_1200_50,
572 /* flags, width, height, fields_sec, cfreq */
573 0, 1600, 1200, 50000, 130500,
574 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
575 2088, 1600, 2088, 1644, 1764,
576 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
577 1250, 1200, 1250, 1205, 1211,
578 /* pll_m, pll_n, pll_p */
579 24, 5, 0
580 },
581
582 {
583 DBE_VT_1600_1200_60,
584 /* flags, width, height, fields_sec, cfreq */
585 0, 1600, 1200, 59940, 162000,
586 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
587 2160, 1600, 2160, 1644, 1856,
588 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
589 1250, 1200, 1250, 1201, 1204,
590 /* pll_m, pll_n, pll_p */
591 6, 1, 0
592 },
593
594 {
595 DBE_VT_1600_1200_75,
596 /* flags, width, height, fields_sec, cfreq */
597 0, 1600, 1200, 75000, 202500,
598 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
599 2160, 1600, 2160, 1644, 1856,
600 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
601 1250, 1200, 1250, 1201, 1204,
602 /* pll_m, pll_n, pll_p */
603 15, 2, 0
604 },
605
606 {
607 DBE_VT_1920_1080_50,
608 /* flags, width, height, fields_sec, cfreq */
609 0, 1920, 1080, 50000, 133200,
610 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
611 2368, 1920, 2368, 1952, 2096,
612 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
613 1125, 1080, 1125, 1083, 1086,
614 /* pll_m, pll_n, pll_p */
615 5, 1, 0
616 },
617
618 {
619 DBE_VT_1920_1080_60,
620 /* flags, width, height, fields_sec, cfreq */
621 0, 1920, 1080, 59940, 159840,
622 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
623 2368, 1920, 2368, 1952, 2096,
624 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
625 1125, 1080, 1125, 1083, 1086,
626 /* pll_m, pll_n, pll_p */
627 6, 1, 0
628 },
629
630 {
631 DBE_VT_1920_1080_72,
632 /* flags, width, height, fields_sec, cfreq */
633 0, 1920, 1080, 72000, 216023,
634 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
635 2560, 1920, 2560, 1968, 2184,
636 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
637 1172, 1080, 1172, 1083, 1086,
638 /* pll_m, pll_n, pll_p */
639 8, 1, 0
640 },
641
642 {
643 DBE_VT_1920_1200_50,
644 /* flags, width, height, fields_sec, cfreq */
645 0, 1920, 1200, 50000, 161500,
646 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
647 2584, 1920, 2584, 1984, 2240,
648 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
649 1250, 1200, 1250, 1203, 1206,
650 /* pll_m, pll_n, pll_p */
651 6, 1, 0
652 },
653
654 {
655 DBE_VT_1920_1200_60,
656 /* flags, width, height, fields_sec, cfreq */
657 0, 1920, 1200, 59940, 193800,
658 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
659 2584, 1920, 2584, 1984, 2240,
660 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
661 1250, 1200, 1250, 1203, 1206,
662 /* pll_m, pll_n, pll_p */
663 29, 4, 0
664 },
665
666 {
667 DBE_VT_1920_1200_66,
668 /* flags, width, height, fields_sec, cfreq */
669 0, 1920, 1200, 66000, 213180,
670 /* htotal, hblank_start, hblank_end, hsync_start, hsync_end */
671 2584, 1920, 2584, 1984, 2240,
672 /* vtotal, vblank_start, vblank_end, vsync_start, vsync_end */
673 1250, 1200, 1250, 1203, 1206,
674 /* pll_m, pll_n, pll_p */
675 8, 1, 0
676 }
677};
678
679#endif // INCLUDE_TIMING_TABLE_DATA
680
681#endif // ! __SGIVWFB_H__
diff --git a/include/xen/events.h b/include/xen/events.h
index c9c85cf84895..8bee7a75e850 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -2,6 +2,9 @@
2#define _XEN_EVENTS_H 2#define _XEN_EVENTS_H
3 3
4#include <linux/interrupt.h> 4#include <linux/interrupt.h>
5#ifdef CONFIG_PCI_MSI
6#include <linux/msi.h>
7#endif
5 8
6#include <xen/interface/event_channel.h> 9#include <xen/interface/event_channel.h>
7#include <asm/xen/hypercall.h> 10#include <asm/xen/hypercall.h>
@@ -52,7 +55,6 @@ int evtchn_get(unsigned int evtchn);
52void evtchn_put(unsigned int evtchn); 55void evtchn_put(unsigned int evtchn);
53 56
54void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector); 57void xen_send_IPI_one(unsigned int cpu, enum ipi_vector vector);
55int resend_irq_on_evtchn(unsigned int irq);
56void rebind_evtchn_irq(int evtchn, int irq); 58void rebind_evtchn_irq(int evtchn, int irq);
57 59
58static inline void notify_remote_via_evtchn(int port) 60static inline void notify_remote_via_evtchn(int port)
@@ -102,7 +104,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi,
102int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc); 104int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);
103/* Bind an PSI pirq to an irq. */ 105/* Bind an PSI pirq to an irq. */
104int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, 106int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc,
105 int pirq, const char *name, domid_t domid); 107 int pirq, int nvec, const char *name, domid_t domid);
106#endif 108#endif
107 109
108/* De-allocates the above mentioned physical interrupt. */ 110/* De-allocates the above mentioned physical interrupt. */
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index 42721d13a106..610dba9b620a 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -131,6 +131,7 @@ struct physdev_irq {
131#define MAP_PIRQ_TYPE_GSI 0x1 131#define MAP_PIRQ_TYPE_GSI 0x1
132#define MAP_PIRQ_TYPE_UNKNOWN 0x2 132#define MAP_PIRQ_TYPE_UNKNOWN 0x2
133#define MAP_PIRQ_TYPE_MSI_SEG 0x3 133#define MAP_PIRQ_TYPE_MSI_SEG 0x3
134#define MAP_PIRQ_TYPE_MULTI_MSI 0x4
134 135
135#define PHYSDEVOP_map_pirq 13 136#define PHYSDEVOP_map_pirq 13
136struct physdev_map_pirq { 137struct physdev_map_pirq {
@@ -141,11 +142,16 @@ struct physdev_map_pirq {
141 int index; 142 int index;
142 /* IN or OUT */ 143 /* IN or OUT */
143 int pirq; 144 int pirq;
144 /* IN - high 16 bits hold segment for MAP_PIRQ_TYPE_MSI_SEG */ 145 /* IN - high 16 bits hold segment for ..._MSI_SEG and ..._MULTI_MSI */
145 int bus; 146 int bus;
146 /* IN */ 147 /* IN */
147 int devfn; 148 int devfn;
148 /* IN */ 149 /* IN
150 * - For MSI-X contains entry number.
151 * - For MSI with ..._MULTI_MSI contains number of vectors.
152 * OUT (..._MULTI_MSI only)
153 * - Number of vectors allocated.
154 */
149 int entry_nr; 155 int entry_nr;
150 /* IN */ 156 /* IN */
151 uint64_t table_base; 157 uint64_t table_base;
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index fb2ea8f26552..2cf47175b12b 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -2,6 +2,7 @@
2#define INCLUDE_XEN_OPS_H 2#define INCLUDE_XEN_OPS_H
3 3
4#include <linux/percpu.h> 4#include <linux/percpu.h>
5#include <linux/notifier.h>
5#include <asm/xen/interface.h> 6#include <asm/xen/interface.h>
6 7
7DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); 8DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
@@ -16,6 +17,9 @@ void xen_mm_unpin_all(void);
16void xen_timer_resume(void); 17void xen_timer_resume(void);
17void xen_arch_resume(void); 18void xen_arch_resume(void);
18 19
20void xen_resume_notifier_register(struct notifier_block *nb);
21void xen_resume_notifier_unregister(struct notifier_block *nb);
22
19int xen_setup_shutdown_event(void); 23int xen_setup_shutdown_event(void);
20 24
21extern unsigned long *xen_contiguous_bitmap; 25extern unsigned long *xen_contiguous_bitmap;
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index 569c07f2e344..0324c6d340c1 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -207,7 +207,6 @@ int xenbus_unmap_ring(struct xenbus_device *dev,
207 grant_handle_t handle, void *vaddr); 207 grant_handle_t handle, void *vaddr);
208 208
209int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port); 209int xenbus_alloc_evtchn(struct xenbus_device *dev, int *port);
210int xenbus_bind_evtchn(struct xenbus_device *dev, int remote_port, int *port);
211int xenbus_free_evtchn(struct xenbus_device *dev, int port); 210int xenbus_free_evtchn(struct xenbus_device *dev, int port);
212 211
213enum xenbus_state xenbus_read_driver_state(const char *path); 212enum xenbus_state xenbus_read_driver_state(const char *path);